Kaydet (Commit) 50454f38 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

cp#1000072: Skip styles import for external link cache documents.

This reduces external link update time by 10%.

Change-Id: Ic14d9ea7530818f839330a2004f6aa67ef1e831e
üst 713c2f19
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -965,6 +965,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable
bool bNullDateSetted;
bool bSelfImportingXMLSet;
bool mbLockSolarMutex;
bool mbImportStyles;
bool mbHasNewCondFormatData;
......
......@@ -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;
......
......@@ -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.
......
......@@ -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 )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment