[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/externalrefmgr.hxx|4 ++ sc/source/core/data/documen8.cxx | 56 --- sc/source/ui/docshell/externalrefmgr.cxx | 30 ++-- 3 files changed, 67 insertions(+), 23 deletions(-) New commits: commit 70658b23f2d426e9a1a42d194f11c954cb2f5890 Author: Kohei Yoshida Date: Tue May 20 00:59:29 2014 -0400 cp#172: Stop the external doc shell timer while mass-updating. To prevent collision with the timer wanting to purge the doc cache while updating external links. Also, show progress bar, and make the timer interval and the document cache life span longer. Change-Id: I325984c8fa68425a2621cf8f9c016463291afc89 diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 1c7fcc1..bbb3094 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -689,6 +689,8 @@ public: void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell); +void enableDocTimer( bool bEnable ); + private: ScExternalRefManager(); ScExternalRefManager(const ScExternalRefManager&); @@ -822,6 +824,8 @@ private: */ bool mbUserInteractionEnabled:1; +bool mbDocTimerEnabled:1; + AutoTimer maSrcDocTimer; DECL_LINK(TimeOutHdl, AutoTimer*); }; diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 316738a..4563b02 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -780,6 +780,9 @@ bool ScDocument::IsInLinkUpdate() const void ScDocument::UpdateExternalRefLinks(Window* pWin) { +if (!pExternalRefMgr.get()) +return; + sfx2::LinkManager* pMgr = GetDocLinkManager().getLinkManager(bAutoCalc); if (!pMgr) return; @@ -788,33 +791,48 @@ void ScDocument::UpdateExternalRefLinks(Window* pWin) sal_uInt16 nCount = rLinks.size(); bool bAny = false; + +// Collect all the external ref links first. +std::vector aRefLinks; for (sal_uInt16 i = 0; i < nCount; ++i) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; ScExternalRefLink* pRefLink = dynamic_cast(pBase); if (pRefLink) +aRefLinks.push_back(pRefLink); +} + +pExternalRefMgr->enableDocTimer(false); +ScProgress aProgress(GetDocumentShell(), "Updating external links", aRefLinks.size()); +for (size_t i = 0, n = aRefLinks.size(); i < n; ++i) +{ +aProgress.SetState(i); + +ScExternalRefLink* pRefLink = aRefLinks[i]; +if (pRefLink->Update()) { -if (pRefLink->Update()) -bAny = true; -else -{ -// Update failed. Notify the user. - -OUString aFile; -pMgr->GetDisplayNames(pRefLink, NULL, &aFile, NULL, NULL); -// Decode encoded URL for display friendliness. -INetURLObject aUrl(aFile,INetURLObject::WAS_ENCODED); -aFile = aUrl.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS); - -OUStringBuffer aBuf; -aBuf.append(OUString(ScResId(SCSTR_EXTDOC_NOT_LOADED))); -aBuf.appendAscii("\n\n"); -aBuf.append(aFile); -ErrorBox aBox(pWin, WB_OK, aBuf.makeStringAndClear()); -aBox.Execute(); -} +bAny = true; +continue; } + +// Update failed. Notify the user. + +OUString aFile; +pMgr->GetDisplayNames(pRefLink, NULL, &aFile, NULL, NULL); +// Decode encoded URL for display friendliness. +INetURLObject aUrl(aFile,INetURLObject::WAS_ENCODED); +aFile = aUrl.GetMainURL(INetURLObject::DECODE_UNAMBIGUOUS); + +OUStringBuffer aBuf; +aBuf.append(OUString(ScResId(SCSTR_EXTDOC_NOT_LOADED))); +aBuf.appendAscii("\n\n"); +aBuf.append(aFile); +ErrorBox aBox(pWin, WB_OK, aBuf.makeStringAndClear()); +aBox.Execute(); } + +pExternalRefMgr->enableDocTimer(true); + if (bAny) { TrackFormulas(); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 549549a..ded749f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -71,8 +71,8 @@ using ::std::list; using ::std::unary_function; using namespace formula; -#define SRCDOC_LIFE_SPAN 6000 // 1 minute (in 100th of a sec) -#define SRCDOC_SCAN_INTERVAL 1000*5 // every 5 seconds (in msec) +#define SRCDOC_LIFE_SPAN 3 // 5 minutes (in 100th of a sec) +#define SRCDOC_SCAN_INTERVAL 1000*30// every 30 seconds (in msec) namespace { @@ -1537,7 +1537,8 @@ static ScTokenArray* lcl_fillEmptyMatrix(const ScRange& rRange) ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) : mpDoc(pDoc), mbInReferenceMarking(false), -mbUserInteractionEnabled(true) +mbUserInteractionE
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/scopetools.hxx |9 + sc/source/core/data/documen8.cxx |3 +++ sc/source/core/tool/scopetools.cxx | 14 ++ 3 files changed, 26 insertions(+) New commits: commit a1c7e073fe545e6a0bd8c5eecb152106b9ec35fa Author: Kohei Yoshida Date: Tue May 20 14:24:44 2014 -0400 Turn the mouse cursor to the "wait hand" during the external link update. Change-Id: I983127828b28c72dd12d4778b88051964e9bceaa diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx index 443ceaf..785fd70 100644 --- a/sc/inc/scopetools.hxx +++ b/sc/inc/scopetools.hxx @@ -13,6 +13,7 @@ #include "scdllapi.h" class ScDocument; +class Window; namespace sc { @@ -55,6 +56,14 @@ public: ~IdleSwitch(); }; +class WaitPointerSwitch +{ +Window* mpFrameWin; +public: +WaitPointerSwitch(Window* pWin); +~WaitPointerSwitch(); +}; + } #endif diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index e8ce20c..1247563 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -87,6 +87,7 @@ #include "globalnames.hxx" #include "stringutil.hxx" #include +#include #include @@ -802,6 +803,8 @@ void ScDocument::UpdateExternalRefLinks(Window* pWin) aRefLinks.push_back(pRefLink); } +sc::WaitPointerSwitch aWaitSwitch(pWin); + pExternalRefMgr->enableDocTimer(false); ScProgress aProgress(GetDocumentShell(), ScResId(SCSTR_UPDATE_EXTDOCS).toString(), aRefLinks.size()); for (size_t i = 0, n = aRefLinks.size(); i < n; ++i) diff --git a/sc/source/core/tool/scopetools.cxx b/sc/source/core/tool/scopetools.cxx index 96f4458..0664219 100644 --- a/sc/source/core/tool/scopetools.cxx +++ b/sc/source/core/tool/scopetools.cxx @@ -9,6 +9,7 @@ #include "scopetools.hxx" #include "document.hxx" +#include namespace sc { @@ -56,6 +57,19 @@ IdleSwitch::~IdleSwitch() mrDoc.EnableIdle(mbOldValue); } +WaitPointerSwitch::WaitPointerSwitch(Window* pWin) : +mpFrameWin(pWin) +{ +if (mpFrameWin) +mpFrameWin->EnterWait(); +} + +WaitPointerSwitch::~WaitPointerSwitch() +{ +if (mpFrameWin) +mpFrameWin->LeaveWait(); +} + } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/document.hxx |3 sc/inc/xmlwrap.hxx | 14 sc/source/core/data/documen2.cxx |1 sc/source/core/data/documen9.cxx |5 sc/source/filter/xml/xmlimprt.cxx| 23 + sc/source/filter/xml/xmlimprt.hxx|6 sc/source/filter/xml/xmlwrap.cxx | 473 +++ sc/source/ui/docshell/docsh.cxx | 10 sc/source/ui/docshell/externalrefmgr.cxx |4 9 files changed, 268 insertions(+), 271 deletions(-) New commits: commit ce3152ab14937cc37102b0be4264c793d288235a Author: Kohei Yoshida Date: Tue May 20 21:01:46 2014 -0400 Let's not use ScDocument as a convenient "anything goes" storage place. Change-Id: I0ae2f44b89b0db915e78a9b07835000e843d016f diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 08f1ca4..e1aabf4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -400,7 +400,6 @@ private: boolbInsertingFromOtherDoc; boolbLoadingMedium; boolbImportingXML; // special handling of formula text -boolbXMLFromWrapper;// distinguish ScXMLImportWrapper from external component boolbCalcingAfterLoad; // in CalcAfterLoad TRUE // don't construct/destruct listeners temporarily boolbNoListening; @@ -1754,8 +1753,6 @@ public: voidSetLoadingMedium( bool bVal ); voidSetImportingXML( bool bVal ); boolIsImportingXML() const { return bImportingXML; } -voidSetXMLFromWrapper( bool bVal ); -boolIsXMLFromWrapper() const { return bXMLFromWrapper; } voidSetCalcingAfterLoad( bool bVal ) { bCalcingAfterLoad = bVal; } boolIsCalcingAfterLoad() const { return bCalcingAfterLoad; } voidSetNoListening( bool bVal ) { bNoListening = bVal; } diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx index 8bb78af..e74c01a 100644 --- a/sc/inc/xmlwrap.hxx +++ b/sc/inc/xmlwrap.hxx @@ -26,10 +26,6 @@ #include "importfilterdata.hxx" #include -class ScDocument; -class SfxMedium; -class ScMySharedData; - #include namespace com { namespace sun { namespace star { @@ -43,10 +39,16 @@ namespace com { namespace sun { namespace star { namespace sax { struct InputSource; class XParser; class XWriter; } } } } } +class ScDocument; +class SfxMedium; +class ScMySharedData; +class ScDocShell; + class ScXMLImportWrapper { sc::ImportPostProcessData maPostProcessData; +ScDocShell& mrDocShell; ScDocument& rDoc; SfxMedium* pMedium; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xStorage; @@ -70,7 +72,9 @@ class ScXMLImportWrapper ScMySharedData*& pSharedData); public: -ScXMLImportWrapper(ScDocument& rD, SfxMedium* pM, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >&); +ScXMLImportWrapper( +ScDocShell& rDocSh, SfxMedium* pM, const css::uno::Reference& xStor ); + bool Import(bool bStylesOnly, ErrCode& ); bool Export(bool bStylesOnly); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index e0ed474..d65c42c 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -194,7 +194,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : bInsertingFromOtherDoc( false ), bLoadingMedium( false ), bImportingXML( false ), -bXMLFromWrapper( false ), bCalcingAfterLoad( false ), bNoListening( false ), mbIdleEnabled(true), diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 4d7920e..c9fe85b 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -620,11 +620,6 @@ void ScDocument::SetImportingXML( bool bVal ) SetLoadingMedium(bVal); } -void ScDocument::SetXMLFromWrapper( bool bVal ) -{ -bXMLFromWrapper = bVal; -} - rtl::Reference ScDocument::GetForbiddenCharacters() { return xForbiddenCharacters; diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index f95b2aa..2aa6c14 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2102,7 +2102,7 @@ ScXMLImport::ScXMLImport( bRemoveLastChar(false), bNullDateSetted(false), bSelfImportingXMLSet(false), -bFromWrapper(false), +mbLockSolarMutex(true), mbHasNewCondFormatData(false) { pStylesImportHelper = new ScMyStylesImportHelper(*this); @@ -2240,6 +2240,23 @@ ScXMLImport::~ScXMLImport() throw() delete pDetectiveOpArray; } +void ScXMLImport::initialize( const css::uno::Sequence& aArguments ) +throw (css::uno::Exception, css::uno::RuntimeException, std::exception) +{ +SvXMLImport::initialize(aArguments); +
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/unonames.hxx |2 ++ sc/source/filter/xml/xmlimprt.cxx |5 +++-- sc/source/filter/xml/xmlwrap.cxx |3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) New commits: commit 1d17a0fe5312f7107beb50b6bb779f4eff8c67c8 Author: Kohei Yoshida Date: Tue May 20 21:09:41 2014 -0400 Let's use constant uno name for these. Change-Id: I5e34f4d7561ef7f4f7b8b3b4d7d06cca072831c7 diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 1cc71a9..689dcea 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -668,6 +668,8 @@ #define SC_UNO_EMBED_FONTS "EmbedFonts" +#define SC_UNO_ODS_LOCK_SOLAR_MUTEX "LockSolarMutex" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 2aa6c14..813190d 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -69,6 +69,7 @@ #include "editattributemap.hxx" #include "documentimport.hxx" #include "pivotsource.hxx" +#include #include @@ -2253,8 +2254,8 @@ void ScXMLImport::initialize( const css::uno::Sequence& aArgument if (!xInfoSetInfo.is()) return; -if (xInfoSetInfo->hasPropertyByName("LockSolarMutex")) -xInfoSet->getPropertyValue("LockSolarMutex") >>= mbLockSolarMutex; +if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX)) +xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex; } SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 6282b9f..4402b2b 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -71,6 +71,7 @@ #include "sheetdata.hxx" #include "XMLCodeNameProvider.hxx" #include +#include using namespace com::sun::star; @@ -348,7 +349,7 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) }; uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aImportInfoMap ) ) ); -xInfoSet->setPropertyValue("LockSolarMutex", uno::makeAny(false)); +xInfoSet->setPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX, uno::makeAny(false)); // get BuildId from parent container if available ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
Rebased ref, commits from common ancestor: commit 4ea57c9f946a0078429a8a87b9d34372eb5c5072 Author: Kohei Yoshida Date: Tue May 20 21:09:41 2014 -0400 Let's use constant uno name for these. Change-Id: I5e34f4d7561ef7f4f7b8b3b4d7d06cca072831c7 diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 1cc71a9..689dcea 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -668,6 +668,8 @@ #define SC_UNO_EMBED_FONTS "EmbedFonts" +#define SC_UNO_ODS_LOCK_SOLAR_MUTEX "LockSolarMutex" + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 2aa6c14..813190d 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -69,6 +69,7 @@ #include "editattributemap.hxx" #include "documentimport.hxx" #include "pivotsource.hxx" +#include #include @@ -2253,8 +2254,8 @@ void ScXMLImport::initialize( const css::uno::Sequence& aArgument if (!xInfoSetInfo.is()) return; -if (xInfoSetInfo->hasPropertyByName("LockSolarMutex")) -xInfoSet->getPropertyValue("LockSolarMutex") >>= mbLockSolarMutex; +if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX)) +xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex; } SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 6282b9f..cc1cbff 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -71,6 +71,7 @@ #include "sheetdata.hxx" #include "XMLCodeNameProvider.hxx" #include +#include using namespace com::sun::star; @@ -343,12 +344,12 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) { OUString("OrganizerMode"), 0, ::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, { OUString("SourceStorage"), 0, cppu::UnoType::get(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, -{ OUString("LockSolarMutex"), 0, getBooleanCppuType(), css::beans::PropertyAttribute::MAYBEVOID, 0 }, +{ OUString(SC_UNO_ODS_LOCK_SOLAR_MUTEX), 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 ) ) ); -xInfoSet->setPropertyValue("LockSolarMutex", uno::makeAny(false)); +xInfoSet->setPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX, uno::makeAny(false)); // get BuildId from parent container if available ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/xmlwrap.hxx |9 +++- sc/source/filter/xml/xmlwrap.cxx | 81 ++- sc/source/ui/docshell/docsh.cxx |8 +-- 3 files changed, 50 insertions(+), 48 deletions(-) New commits: commit ec639ad118ecb02ab0efea3a60c793d9b6ea3ef6 Author: Kohei Yoshida Date: Tue May 20 22:32:43 2014 -0400 Finer grained ODS import mode selection. Change-Id: I18520837f8d25103bf8482a0204b8a7b7740feb1 diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx index e74c01a..b7ec5cd 100644 --- a/sc/inc/xmlwrap.hxx +++ b/sc/inc/xmlwrap.hxx @@ -72,10 +72,17 @@ class ScXMLImportWrapper ScMySharedData*& pSharedData); public: + +static const sal_uInt8 STYLES = 0x01; +static const sal_uInt8 CONTENT = 0x02; +static const sal_uInt8 METADATA = 0x04; +static const sal_uInt8 SETTINGS = 0x08; +static const sal_uInt8 ALL = STYLES | CONTENT | METADATA | SETTINGS; + ScXMLImportWrapper( ScDocShell& rDocSh, SfxMedium* pM, const css::uno::Reference& xStor ); -bool Import(bool bStylesOnly, ErrCode& ); +bool Import( sal_uInt8 nMode, ErrCode& rError ); bool Export(bool bStylesOnly); const sc::ImportPostProcessData& GetImportPostProcessData() const; diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index cc1cbff..159c3d8 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -309,7 +309,7 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(const uno::Reference xContext = comphelper::getProcessComponentContext(); @@ -349,6 +349,7 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) }; uno::Reference< beans::XPropertySet > xInfoSet( comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aImportInfoMap ) ) ); +// No need to lock solar mutex when calling from the wrapper. xInfoSet->setPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX, uno::makeAny(false)); // get BuildId from parent container if available @@ -403,14 +404,14 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) } } -if (bStylesOnly) -xInfoSet->setPropertyValue("OrganizerMode", uno::makeAny(sal_True)); +if (mrDocShell.GetCreateMode() == SFX_CREATE_MODE_ORGANIZER) +xInfoSet->setPropertyValue("OrganizerMode", uno::makeAny(true)); xInfoSet->setPropertyValue( "SourceStorage", uno::Any( xStorage ) ); bool bOasis = ( SotStorage::GetVersion( xStorage ) > SOFFICE_FILEFORMAT_60 ); -if (!bStylesOnly && bOasis) +if ((nMode & METADATA) == METADATA && bOasis) { // RDF metadata: ODF >= 1.2 try @@ -428,34 +429,37 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) ucb::InteractiveAugmentedIOException iaioe; if ( e.TargetException >>= iaioe ) { -nError = SCERR_IMPORT_UNKNOWN; +rError = SCERR_IMPORT_UNKNOWN; } else { -nError = SCWARN_IMPORT_FEATURES_LOST; +rError = SCWARN_IMPORT_FEATURES_LOST; } } catch ( const uno::Exception &) { -nError = SCWARN_IMPORT_FEATURES_LOST; +rError = SCWARN_IMPORT_FEATURES_LOST; } } // #i103539#: always read meta.xml for generator sal_uInt32 nMetaRetval(0); -uno::Sequence aMetaArgs(1); -uno::Any* pMetaArgs = aMetaArgs.getArray(); -pMetaArgs[0] <<= xInfoSet; +if ((nMode & METADATA) == METADATA) +{ +uno::Sequence aMetaArgs(1); +uno::Any* pMetaArgs = aMetaArgs.getArray(); +pMetaArgs[0] <<= xInfoSet; -SAL_INFO( "sc.filter", "meta import start" ); +SAL_INFO( "sc.filter", "meta import start" ); -nMetaRetval = ImportFromComponent( -xContext, xModel, xXMLParser, aParserInput, -bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisMetaImporter") -: OUString("com.sun.star.comp.Calc.XMLMetaImporter"), -"meta.xml", "Meta.xml", aMetaArgs, false); +nMetaRetval = ImportFromComponent( +xContext, xModel, xXMLParser, aParserInput, +bOasis ? OUString("com.sun.star.comp.Calc.XMLOasisMetaImporter") +: OUString("com.sun.star.comp.Calc.XMLMetaImporter"), +"meta.xml", "Meta.xml", aMetaArgs, false); -SAL_INFO( "sc.filter", "meta import end" ); +SAL_INFO( "sc.filter", "meta import end" ); +} SvXMLGraphicHelper* pGraphicHelper = NULL; uno::Reference< document::XGraphicObjectResolver > xGrfContainer; @@ -479,7 +483,7 @@ bool ScXMLImportWrapper::Import(bool bStylesOnly, ErrCode& nError) pStylesArgs[3] <<= xObjectResolver; sal_uI
[Libreoffice-commits] core.git: Branch 'private/kohei/external-ref-refresh' - sc/inc sc/source
sc/inc/compiler.hxx |2 sc/source/core/tool/compiler.cxx | 106 --- 2 files changed, 35 insertions(+), 73 deletions(-) New commits: commit a51459b960bfb4d726598712c00ff3d3c8139c4e Author: Kohei Yoshida Date: Wed May 21 11:14:44 2014 -0400 Avoid unnecessary cloning of ScRawToken during token check. Change-Id: Ia980054437394ef48f7df655411f81d20b9cfa32 diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx index 527ad76..a720d1c5 100644 --- a/sc/inc/compiler.hxx +++ b/sc/inc/compiler.hxx @@ -317,7 +317,7 @@ private: sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol OUStringaFormula; // formula source code sal_Int32 nSrcPos;// tokenizer position (source code) -mutable ScRawTokenRef pRawToken; +mutable ScRawToken maRawToken; const CharClass*pCharClass; // which character classification is used for parseAnyToken sal_uInt16 mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 751b98b..1be643f 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2334,7 +2334,6 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) bool bFound = (iLook != mxSymbols->getHashMap()->end()); if (bFound) { -ScRawToken aToken; OpCode eOp = iLook->second; if (bInArray) { @@ -2343,8 +2342,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) else if (rName.equals(mxSymbols->getSymbol(ocArrayRowSep))) eOp = ocArrayRowSep; } -aToken.SetOpCode(eOp); -pRawToken = aToken.Clone(); +maRawToken.SetOpCode(eOp); } else if (mxSymbols->isODFF()) { @@ -2372,9 +2370,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) { if (rName.equalsIgnoreAsciiCaseAscii( aOdffAliases[i].pName)) { -ScRawToken aToken; -aToken.SetOpCode( aOdffAliases[i].eOp); -pRawToken = aToken.Clone(); +maRawToken.SetOpCode( aOdffAliases[i].eOp); bFound = true; break; // for } @@ -2407,9 +2403,7 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) // Old (deprecated) addins first for legacy. if (ScGlobal::GetFuncCollection()->findByName(cSymbol)) { -ScRawToken aToken; -aToken.SetExternal( cSymbol ); -pRawToken = aToken.Clone(); +maRawToken.SetExternal( cSymbol ); } else // bLocalFirst=false for (English) upper full original name @@ -2419,14 +2413,12 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) } if (!aIntName.isEmpty()) { -ScRawToken aToken; -aToken.SetExternal( aIntName.getStr() ); // international name -pRawToken = aToken.Clone(); +maRawToken.SetExternal( aIntName.getStr() ); // international name bFound = true; } } OpCode eOp; -if (bFound && ((eOp = pRawToken->GetOpCode()) == ocSub || eOp == ocNegSub)) +if (bFound && ((eOp = maRawToken.GetOpCode()) == ocSub || eOp == ocNegSub)) { bool bShouldBeNegSub = (eLastOp == ocOpen || eLastOp == ocSep || eLastOp == ocNegSub || @@ -2434,10 +2426,10 @@ bool ScCompiler::IsOpCode( const OUString& rName, bool bInArray ) eLastOp == ocArrayOpen || eLastOp == ocArrayColSep || eLastOp == ocArrayRowSep); if (bShouldBeNegSub && eOp == ocSub) -pRawToken->NewOpCode( ocNegSub ); +maRawToken.NewOpCode( ocNegSub ); //! if ocNegSub had ForceArray we'd have to set it here else if (!bShouldBeNegSub && eOp == ocNegSub) -pRawToken->NewOpCode( ocSub ); +maRawToken.NewOpCode( ocSub ); } return bFound; } @@ -2452,9 +2444,7 @@ bool ScCompiler::IsOpCode2( const OUString& rName ) if (bFound) { -ScRawToken aToken; -aToken.SetOpCode( (OpCode) --i ); -pRawToken = aToken.Clone(); +maRawToken.SetOpCode( (OpCode) --i ); } return bFound; } @@ -2489,9 +2479,7 @@ bool ScCompiler::IsValue( const OUString& rSym ) if( nType == NUMBERFORMAT_TEXT ) // HACK: number too big! SetError( errIllegalArgument ); -ScRawToken aToken; -aToken.SetDouble( fVal ); -pRawToken = aToken.Clone(); +maRawToken.SetDouble( fVal ); return true; } @@ -2510,11 +2498,9 @@ bool ScCompiler::IsString() if ( bQuote ) { cSymbol[nLen] = '\0'; -ScRawToken