fdo#72041: Intern strings as we populate the external cache.
This commit covers ods import and UNO API layer. Change-Id: I3ad1b7cfefe49575694e2351bcba6e5733b009d2
This commit is contained in:
@@ -502,7 +502,7 @@ public:
|
||||
class ScExternalSheetCacheObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalSheetCache >
|
||||
{
|
||||
public:
|
||||
explicit ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef pTable, size_t nIndex);
|
||||
explicit ScExternalSheetCacheObj(ScDocShell* pDocShell, ScExternalRefCache::TableTypeRef pTable, size_t nIndex);
|
||||
~ScExternalSheetCacheObj();
|
||||
|
||||
// XExternalSheetCache
|
||||
@@ -528,6 +528,7 @@ private:
|
||||
ScExternalSheetCacheObj(const ScExternalSheetCacheObj&);
|
||||
|
||||
private:
|
||||
ScDocShell* mpDocShell;
|
||||
ScExternalRefCache::TableTypeRef mpTable;
|
||||
size_t mnIndex;
|
||||
};
|
||||
@@ -535,7 +536,7 @@ private:
|
||||
class ScExternalDocLinkObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLink >
|
||||
{
|
||||
public:
|
||||
ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
|
||||
ScExternalDocLinkObj(ScDocShell* pDocShell, ScExternalRefManager* pRefMgr, sal_uInt16 nFileId);
|
||||
~ScExternalDocLinkObj();
|
||||
|
||||
// XExternalDocLink
|
||||
@@ -574,6 +575,7 @@ public:
|
||||
throw (::com::sun::star::uno::RuntimeException);
|
||||
|
||||
private:
|
||||
ScDocShell* mpDocShell;
|
||||
ScExternalRefManager* mpRefMgr;
|
||||
sal_uInt16 mnFileId;
|
||||
};
|
||||
|
@@ -24,7 +24,9 @@
|
||||
|
||||
#include "token.hxx"
|
||||
#include "document.hxx"
|
||||
#include <documentimport.hxx>
|
||||
|
||||
#include <svl/sharedstringpool.hxx>
|
||||
#include <xmloff/nmspmap.hxx>
|
||||
#include <xmloff/xmlnmspe.hxx>
|
||||
#include <xmloff/xmltoken.hxx>
|
||||
@@ -376,7 +378,11 @@ void ScXMLExternalRefCellContext::EndElement()
|
||||
if (mbIsNumeric)
|
||||
aToken.reset(new formula::FormulaDoubleToken(mfCellValue));
|
||||
else
|
||||
aToken.reset(new formula::FormulaStringToken(maCellString));
|
||||
{
|
||||
ScDocument& rDoc = mrScImport.GetDoc().getDoc();
|
||||
svl::SharedString aSS = rDoc.GetSharedStringPool().intern(maCellString);
|
||||
aToken.reset(new formula::FormulaStringToken(aSS));
|
||||
}
|
||||
|
||||
sal_uInt32 nNumFmt = mnNumberFormat >= 0 ? static_cast<sal_uInt32>(mnNumberFormat) : 0;
|
||||
mrExternalRefInfo.mpCacheTable->setCell(
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <svl/smplhint.hxx>
|
||||
#include <sfx2/linkmgr.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <svl/sharedstringpool.hxx>
|
||||
|
||||
#include "linkuno.hxx"
|
||||
#include "miscuno.hxx"
|
||||
@@ -1471,7 +1472,8 @@ uno::Reference< sheet::XDDELink > ScDDELinksObj::addDDELink(
|
||||
|
||||
// ============================================================================
|
||||
|
||||
ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef pTable, size_t nIndex) :
|
||||
ScExternalSheetCacheObj::ScExternalSheetCacheObj(ScDocShell* pDocShell, ScExternalRefCache::TableTypeRef pTable, size_t nIndex) :
|
||||
mpDocShell(pDocShell),
|
||||
mpTable(pTable),
|
||||
mnIndex(nIndex)
|
||||
{
|
||||
@@ -1494,7 +1496,11 @@ void SAL_CALL ScExternalSheetCacheObj::setCellValue(sal_Int32 nCol, sal_Int32 nR
|
||||
if (rValue >>= fVal)
|
||||
pToken.reset(new FormulaDoubleToken(fVal));
|
||||
else if (rValue >>= aVal)
|
||||
pToken.reset(new FormulaStringToken(aVal));
|
||||
{
|
||||
svl::SharedStringPool& rPool = mpDocShell->GetDocument()->GetSharedStringPool();
|
||||
svl::SharedString aSS = rPool.intern(aVal);
|
||||
pToken.reset(new FormulaStringToken(aSS));
|
||||
}
|
||||
else
|
||||
// unidentified value type.
|
||||
return;
|
||||
@@ -1573,8 +1579,8 @@ sal_Int32 SAL_CALL ScExternalSheetCacheObj::getTokenIndex()
|
||||
|
||||
// ============================================================================
|
||||
|
||||
ScExternalDocLinkObj::ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId) :
|
||||
mpRefMgr(pRefMgr), mnFileId(nFileId)
|
||||
ScExternalDocLinkObj::ScExternalDocLinkObj(ScDocShell* pDocShell, ScExternalRefManager* pRefMgr, sal_uInt16 nFileId) :
|
||||
mpDocShell(pDocShell), mpRefMgr(pRefMgr), mnFileId(nFileId)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1593,7 +1599,7 @@ Reference< sheet::XExternalSheetCache > SAL_CALL ScExternalDocLinkObj::addSheetC
|
||||
// Set the whole table cached to prevent access to the source document.
|
||||
pTable->setWholeTableCached();
|
||||
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable, nIndex));
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
|
||||
return aSheetCache;
|
||||
}
|
||||
|
||||
@@ -1606,7 +1612,7 @@ Any SAL_CALL ScExternalDocLinkObj::getByName(const OUString &aName)
|
||||
if (!pTable)
|
||||
throw container::NoSuchElementException();
|
||||
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable, nIndex));
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
|
||||
|
||||
Any aAny;
|
||||
aAny <<= aSheetCache;
|
||||
@@ -1668,7 +1674,7 @@ Any SAL_CALL ScExternalDocLinkObj::getByIndex(sal_Int32 nApiIndex)
|
||||
if (!pTable)
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(pTable, nIndex));
|
||||
Reference< sheet::XExternalSheetCache > aSheetCache(new ScExternalSheetCacheObj(mpDocShell, pTable, nIndex));
|
||||
|
||||
Any aAny;
|
||||
aAny <<= aSheetCache;
|
||||
@@ -1725,7 +1731,7 @@ Reference< sheet::XExternalDocLink > SAL_CALL ScExternalDocLinksObj::addDocLink(
|
||||
{
|
||||
SolarMutexGuard aGuard;
|
||||
sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aDocName);
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpRefMgr, nFileId));
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
|
||||
return aDocLink;
|
||||
}
|
||||
|
||||
@@ -1737,7 +1743,7 @@ Any SAL_CALL ScExternalDocLinksObj::getByName(const OUString &aName)
|
||||
throw container::NoSuchElementException();
|
||||
|
||||
sal_uInt16 nFileId = mpRefMgr->getExternalFileId(aName);
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpRefMgr, nFileId));
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
|
||||
|
||||
Any aAny;
|
||||
aAny <<= aDocLink;
|
||||
@@ -1785,7 +1791,7 @@ Any SAL_CALL ScExternalDocLinksObj::getByIndex(sal_Int32 nIndex)
|
||||
if (!mpRefMgr->hasExternalFile(nFileId))
|
||||
throw lang::IndexOutOfBoundsException();
|
||||
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpRefMgr, nFileId));
|
||||
Reference< sheet::XExternalDocLink > aDocLink(new ScExternalDocLinkObj(mpDocShell, mpRefMgr, nFileId));
|
||||
Any aAny;
|
||||
aAny <<= aDocLink;
|
||||
return aAny;
|
||||
|
Reference in New Issue
Block a user