summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-05-21 00:00:57 -0400
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-05-21 13:25:37 -0400
commit50454f382215d63855684402b4258183be8d0e4c (patch)
tree86fc1ef42fdc56285171b1c7ab0801435936f834 /sc
parent713c2f197b46cefe3d46f0658536af3be1c3842e (diff)
cp#1000072: Skip styles import for external link cache documents.
This reduces external link update time by 10%. Change-Id: Ic14d9ea7530818f839330a2004f6aa67ef1e831e
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/unonames.hxx3
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx16
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx1
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx5
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx2
5 files changed, 25 insertions, 2 deletions
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 689dceac66fd..ca7a28c5c3bf 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -668,7 +668,8 @@
#define SC_UNO_EMBED_FONTS "EmbedFonts"
-#define SC_UNO_ODS_LOCK_SOLAR_MUTEX "LockSolarMutex"
+#define SC_UNO_ODS_LOCK_SOLAR_MUTEX "ODSLockSolarMutex"
+#define SC_UNO_ODS_IMPORT_STYLES "ODSImportStyles"
#endif
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 813190d6f62a..91280264ff96 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2104,6 +2104,7 @@ ScXMLImport::ScXMLImport(
bNullDateSetted(false),
bSelfImportingXMLSet(false),
mbLockSolarMutex(true),
+ mbImportStyles(true),
mbHasNewCondFormatData(false)
{
pStylesImportHelper = new ScMyStylesImportHelper(*this);
@@ -2256,6 +2257,9 @@ void ScXMLImport::initialize( const css::uno::Sequence<css::uno::Any>& aArgument
if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX))
xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex;
+
+ if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_IMPORT_STYLES))
+ xInfoSet->getPropertyValue(SC_UNO_ODS_IMPORT_STYLES) >>= mbImportStyles;
}
SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const OUString& rLocalName,
@@ -2765,6 +2769,9 @@ void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
const sal_Int16 nCellType,
const OUString& rCurrency)
{
+ if (!mbImportStyles)
+ return;
+
if ((nCellType != util::NumberFormat::TEXT) && (nCellType != util::NumberFormat::UNDEFINED))
{
if (rNumberFormat == -1)
@@ -2832,6 +2839,9 @@ void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
{
+ if (!mbImportStyles)
+ return;
+
if (!xSheetCellRanges.is() && GetModel().is())
{
uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
@@ -2845,6 +2855,9 @@ void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
void ScXMLImport::SetStyleToRanges()
{
+ if (!mbImportStyles)
+ return;
+
if (!sPrevStyleName.isEmpty())
{
uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
@@ -2901,6 +2914,9 @@ void ScXMLImport::SetStyleToRanges()
void ScXMLImport::SetStyleToRange(const ScRange& rRange, const OUString* pStyleName,
const sal_Int16 nCellType, const OUString* pCurrency)
{
+ if (!mbImportStyles)
+ return;
+
if (sPrevStyleName.isEmpty())
{
nPrevCellType = nCellType;
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 660f3bd31e0a..1f449827f951 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -965,6 +965,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable
bool bNullDateSetted;
bool bSelfImportingXMLSet;
bool mbLockSolarMutex;
+ bool mbImportStyles;
bool mbHasNewCondFormatData;
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 159c3d80091d..640890b94247 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -345,6 +345,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError )
::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString("SourceStorage"), 0, cppu::UnoType<embed::XStorage>::get(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString(SC_UNO_ODS_LOCK_SOLAR_MUTEX), 0, getBooleanCppuType(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
+ { OUString(SC_UNO_ODS_IMPORT_STYLES), 0, getBooleanCppuType(), css::beans::PropertyAttribute::MAYBEVOID, 0 },
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aImportInfoMap ) ) );
@@ -520,6 +521,10 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError )
sal_uInt32 nDocRetval(0);
if ((nMode & CONTENT) == CONTENT)
{
+ if (mrDocShell.GetCreateMode() == SFX_CREATE_MODE_INTERNAL)
+ // We only need to import content for external link cache document.
+ xInfoSet->setPropertyValue(SC_UNO_ODS_IMPORT_STYLES, uno::makeAny(false));
+
uno::Sequence<uno::Any> aDocArgs(4);
uno::Any* pDocArgs = aDocArgs.getArray();
pDocArgs[0] <<= xInfoSet;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index a2a569e1b2fb..38f900b9abde 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2372,7 +2372,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
// To load encrypted documents with password, user interaction needs to be enabled.
pMedium->UseInteractionHandler(mbUserInteractionEnabled);
- ScDocShell* pNewShell = new ScDocShell(SFX_CREATE_MODE_INTERNAL);
+ ScDocShell* pNewShell = new ScDocShell(SFXMODEL_EXTERNAL_LINK);
SfxObjectShellRef aRef = pNewShell;
// increment the recursive link count of the source document.