diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-21 00:00:57 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-21 13:25:37 -0400 |
commit | 50454f382215d63855684402b4258183be8d0e4c (patch) | |
tree | 86fc1ef42fdc56285171b1c7ab0801435936f834 | |
parent | 713c2f197b46cefe3d46f0658536af3be1c3842e (diff) |
cp#1000072: Skip styles import for external link cache documents.
This reduces external link update time by 10%.
Change-Id: Ic14d9ea7530818f839330a2004f6aa67ef1e831e
-rw-r--r-- | include/sfx2/sfxmodelfactory.hxx | 12 | ||||
-rw-r--r-- | sc/inc/unonames.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 1 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlwrap.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objxtor.cxx | 6 |
7 files changed, 35 insertions, 10 deletions
diff --git a/include/sfx2/sfxmodelfactory.hxx b/include/sfx2/sfxmodelfactory.hxx index 7f7b05f7f5ec..2067fbf8fac2 100644 --- a/include/sfx2/sfxmodelfactory.hxx +++ b/include/sfx2/sfxmodelfactory.hxx @@ -25,16 +25,14 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XSingleServiceFactory.hpp> +#define SFXMODEL_STANDARD (sal_uInt64)(0x0000) +#define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001) +#define SFXMODEL_EXTERNAL_LINK (sal_uInt64)(0x0002) +#define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0004) +#define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0008) namespace sfx2 { - - - #define SFXMODEL_STANDARD (sal_uInt64)(0x0000) - #define SFXMODEL_EMBEDDED_OBJECT (sal_uInt64)(0x0001) - #define SFXMODEL_DISABLE_EMBEDDED_SCRIPTS (sal_uInt64)(0x0002) - #define SFXMODEL_DISABLE_DOCUMENT_RECOVERY (sal_uInt64)(0x0004) - typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ( SAL_CALL * SfxModelFactoryFunc ) ( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory, const sal_uInt64 _nCreationFlags 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. diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index c97cb4af0fea..29fe98384ee7 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -285,10 +285,14 @@ SfxObjectShell::SfxObjectShell( const sal_uInt64 i_nCreationFlags ) : pImp( new SfxObjectShell_Impl( *this ) ) , pMedium(0) , pStyleSheetPool(0) - , eCreateMode( ( i_nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD ) + , eCreateMode(SFX_CREATE_MODE_STANDARD) , bHasName( false ) , bIsInGenerateThumbnail ( false ) { + if (i_nCreationFlags & SFXMODEL_EMBEDDED_OBJECT) + eCreateMode = SFX_CREATE_MODE_EMBEDDED; + else if (i_nCreationFlags & SFXMODEL_EXTERNAL_LINK) + eCreateMode = SFX_CREATE_MODE_INTERNAL; const bool bScriptSupport = ( i_nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; if ( !bScriptSupport ) |