connectivity/source/parse/sqlbison.y | 1 connectivity/source/parse/sqlnode.cxx | 12 ++++++++ desktop/source/lib/lokclipboard.cxx | 9 +++++- drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 18 +++++++------ drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx | 7 ----- include/connectivity/sqlparse.hxx | 2 - sd/inc/strings.hrc | 4 ++ sd/source/ui/docshell/docshel4.cxx | 14 +++++++++- sw/inc/viewsh.hxx | 4 -- sw/source/core/txtnode/fntcache.cxx | 2 - sw/source/core/view/viewsh.cxx | 16 ++++++++++- 11 files changed, 66 insertions(+), 23 deletions(-)
New commits: commit dfa9af835c19a441a0d0aee58920bfad9e1cbe01 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Oct 24 14:53:20 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Oct 25 09:23:06 2024 +0200 Related: tdf#159860 inform if there is > 100 master slides which is atypical and easy to not notice when it happens Change-Id: I16546b0e841771c746cd33fefd7ec15e2877b08d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175559 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc index 3ff7cac89795..e8a6fe8683e1 100644 --- a/sd/inc/strings.hrc +++ b/sd/inc/strings.hrc @@ -469,4 +469,8 @@ #define STR_INSERT_TABLESTYLE NC_("STR_INSERT_TABLESTYLE", "Add a new design") #define STR_REMOVE_TABLESTYLE NC_("STR_REMOVE_TABLESTYLE", "The selected style is in use in this document. If you will delete this style, tables using it will revert to the default style. Do you still wish to delete this style? ") +// To translators: %n is replaced by a large number, 100 at the time of introduction +#define STR_MANY_MASTER_PAGES NC_("STR_MANY_MASTER_PAGES", "%n Master Slides") +#define STR_MANY_MASTER_PAGES_DETAIL NC_("STR_MANY_MASTER_PAGES_DETAIL", "Large amounts of Master Slides degrade loading performance") + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 8980bc2a0148..c71706e3caab 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -38,6 +38,7 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/dispatch.hxx> +#include <sfx2/infobar.hxx> #include <svx/svdotext.hxx> #include <sfx2/printer.hxx> #include <svtools/ctrltool.hxx> @@ -296,8 +297,10 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) if( bRet ) { + SdDrawDocument* pDoc = GetDoc(); + // for legacy markup in OOoXML filter, convert the animations now - EffectMigration::DocumentLoaded(*GetDoc()); + EffectMigration::DocumentLoaded(*pDoc); UpdateTablePointers(); // If we're an embedded OLE object, use tight bounds @@ -317,6 +320,15 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) const INetURLObject aUrl; SfxObjectShell::SetAutoLoad( aUrl, 0, false ); + + const sal_uInt16 nMasterPages = pDoc->GetMasterSdPageCount(PageKind::Standard); + if (nMasterPages > 100) + { + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetLocaleDataWrapper(); + OUString sMasterPages = rLocaleData.getNum(nMasterPages, 0, true, false); + AppendInfoBarWhenReady(u"toomanymasterpages"_ustr, SdResId(STR_MANY_MASTER_PAGES).replaceFirst("%n", sMasterPages), + SdResId(STR_MANY_MASTER_PAGES_DETAIL), InfobarType::INFO); + } } else { commit f0c49bd1554885ed601ae9a9507a5689b2cc7914 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Oct 24 19:40:35 2024 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Oct 25 09:22:55 2024 +0200 cid#1633781 Initialization or destruction ordering is unspecified and cid#1633780 Initialization or destruction ordering is unspecified cid#1633778 Initialization or destruction ordering is unspecified cid#1633777 Initialization or destruction ordering is unspecified cid#1633776 Initialization or destruction ordering is unspecified Change-Id: I8ae7cbede6df2ad747fe57d0ac2800e1b6a31038 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175576 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index e9cd110c0f02..849f925d7637 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4505,7 +4505,6 @@ sal_Int32 OSQLParser::s_nRefCount = 0; // ::osl::Mutex OSQLParser::s_aMutex; OSQLScanner* OSQLParser::s_pScanner = nullptr; OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = nullptr; -tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> OSQLParser::s_xLocaleData(tools::DeleteOnDeinitFlag::Empty); void setParser(OSQLParser* _pParser) { diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 89d3d30779e6..bccdb37a947b 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -803,6 +803,7 @@ void OSQLParser::killThousandSeparator(OSQLParseNode* pLiteral) { if ( pLiteral ) { + auto& s_xLocaleData = getLocaleData(); if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' ) { pLiteral->m_aNodeValue = pLiteral->m_aNodeValue.replace('.', sal_Unicode()); @@ -1118,6 +1119,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale) OUString aValue; if(!m_xCharClass.is()) m_xCharClass = CharacterClassification::create( m_xContext ); + auto& s_xLocaleData = getLocaleData(); if( s_xLocaleData.get() ) { try @@ -1248,10 +1250,13 @@ std::unique_ptr<OSQLParseNode> OSQLParser::predicateTree(OUString& rErrorMessage s_pScanner->SetRule(OSQLScanner::GetSTRINGRule()); break; default: + { + auto& s_xLocaleData = getLocaleData(); if ( s_xLocaleData.get()->get()->getLocaleItem( m_pData->aLocale ).decimalSeparator.toChar() == ',' ) s_pScanner->SetRule(OSQLScanner::GetGERRule()); else s_pScanner->SetRule(OSQLScanner::GetENGRule()); + } } } @@ -1334,6 +1339,7 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte s_pScanner->setScanner(); s_pGarbageCollector = new OSQLParseNodesGarbageCollector(); + auto& s_xLocaleData = getLocaleData(); if(!s_xLocaleData.get()) s_xLocaleData.set(LocaleData::create(m_xContext)); @@ -1473,6 +1479,12 @@ OSQLParser::OSQLParser(css::uno::Reference< css::uno::XComponentContext > xConte m_pData->aLocale = m_pContext->getPreferredLocale(); } +//static +tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>>& OSQLParser::getLocaleData() +{ + static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData(tools::DeleteOnDeinitFlag::Empty); + return s_xLocaleData; +} OSQLParser::~OSQLParser() { diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx index 99f803523d40..c64a9ecd9cb2 100644 --- a/desktop/source/lib/lokclipboard.cxx +++ b/desktop/source/lib/lokclipboard.cxx @@ -20,7 +20,12 @@ using namespace css; using namespace css::uno; /* static */ osl::Mutex LOKClipboardFactory::gMutex; -static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> gClipboards{}; +static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>>& getClipboards() +{ + static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> + gClipboards{}; + return gClipboards; +} rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView() { @@ -28,6 +33,7 @@ rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView() osl::MutexGuard aGuard(gMutex); + auto& gClipboards = getClipboards(); auto it = gClipboards.get()->find(nViewId); if (it != gClipboards.get()->end()) { @@ -44,6 +50,7 @@ void LOKClipboardFactory::releaseClipboardForView(int nViewId) { osl::MutexGuard aGuard(gMutex); + auto& gClipboards = getClipboards(); if (nViewId < 0) // clear all { gClipboards.get()->clear(); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 45be8e0cc47e..5d8c73b9d028 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -521,10 +521,6 @@ void VclMetafileProcessor2D::popList() popStructureElement(vcl::PDFWriter::List); } -// init static break iterator -tools::DeleteOnDeinit<uno::Reference<css::i18n::XBreakIterator>> - VclMetafileProcessor2D::mxBreakIterator; - VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, OutputDevice& rOutDev) : VclProcessor2D(rViewInformation, rOutDev) @@ -1495,14 +1491,22 @@ void VclMetafileProcessor2D::processTextSimplePortionPrimitive2D( // #i101169# if(pTextDecoratedCandidate) { + /* break iterator support + made static so it only needs to be fetched once, even with many single + constructed VclMetafileProcessor2D. It's still incarnated on demand, + but exists for OOo runtime now by purpose. + */ + static tools::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> + gxBreakIterator; + // support for TEXT_ MetaFile actions only for decorated texts - if (!mxBreakIterator.get() || !mxBreakIterator.get()->get()) + if (!gxBreakIterator.get() || !gxBreakIterator.get()->get()) { uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext()); - mxBreakIterator.set(i18n::BreakIterator::create(xContext)); + gxBreakIterator.set(i18n::BreakIterator::create(xContext)); } - auto& rBreakIterator = *mxBreakIterator.get()->get(); + auto& rBreakIterator = *gxBreakIterator.get()->get(); const OUString& rTxt = rTextCandidate.getText(); const sal_Int32 nTextLength(rTextCandidate.getTextLength()); // rTxt.getLength()); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index daad6d6e8dae..07e81b360cec 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -171,13 +171,6 @@ private: */ double mfCurrentUnifiedTransparence; - /* break iterator support - made static so it only needs to be fetched once, even with many single - constructed VclMetafileProcessor2D. It's still incarnated on demand, - but exists for OOo runtime now by purpose. - */ - static tools::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> mxBreakIterator; - /* vcl::PDFExtOutDevData support For the first step, some extra actions at vcl::PDFExtOutDevData need to be emulated with the VclMetafileProcessor2D. These are potentially temporarily diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx index 43336b9628fb..790da073aad5 100644 --- a/include/connectivity/sqlparse.hxx +++ b/include/connectivity/sqlparse.hxx @@ -140,7 +140,7 @@ namespace connectivity sal_Int32 m_nDateFormatKey; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::i18n::XCharacterClassification> m_xCharClass; - static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData; + static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>>& getLocaleData(); // convert a string into double trim it to scale of _nscale and then transform it back to string OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale); diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index f453cc375f1d..1752a167d149 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -193,7 +193,6 @@ class SAL_DLLPUBLIC_RTTI SwViewShell : public sw::Ring<SwViewShell> protected: static ShellResource* spShellRes; ///< Resources for the Shell. - static tools::DeleteOnDeinit< std::shared_ptr<weld::Window> > spCareDialog; ///< Avoid this window. SwRect maVisArea; ///< The modern version of VisArea. tools::Rectangle maLOKVisibleArea;///< The visible area in the LibreOfficeKit client. @@ -477,8 +476,7 @@ public: static weld::Window* CareChildWin(SwViewShell const & rVSh); SW_DLLPUBLIC static void SetCareDialog(const std::shared_ptr<weld::Window>& rNew); - static weld::Window* GetCareDialog(SwViewShell const & rVSh) - { return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh); } + static weld::Window* GetCareDialog(SwViewShell const & rVSh); SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; } void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; } diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index c0ae4b639d81..3ae9456e62d8 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -72,7 +72,6 @@ constexpr Color gWaveCol(COL_GRAY); tools::Long SwFntObj::s_nPixWidth; MapMode* SwFntObj::s_pPixMap = nullptr; -static tools::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {}; void SwFntCache::Flush( ) { @@ -992,6 +991,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf ) Point aTextOriginPos( rInf.GetPos() ); if( !bPrt ) { + static tools::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {}; if( rInf.GetpOut() != *s_pFntObjPixOut.get() || rInf.GetOut().GetMapMode() != *s_pPixMap ) { *s_pPixMap = rInf.GetOut().GetMapMode(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index a1bc4407f664..dccebd31546f 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -89,7 +89,12 @@ bool SwViewShell::sbLstAct = false; ShellResource *SwViewShell::spShellRes = nullptr; -tools::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::spCareDialog {}; + +static tools::DeleteOnDeinit<std::shared_ptr<weld::Window>>& getCareDialog() +{ + static tools::DeleteOnDeinit<std::shared_ptr<weld::Window>> spCareDialog {}; ///< Avoid this window. + return spCareDialog; +} static bool bInSizeNotify = false; @@ -2731,11 +2736,20 @@ ShellResource* SwViewShell::GetShellRes() return spShellRes; } +//static void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew) { + auto& spCareDialog = getCareDialog(); (*spCareDialog.get()) = rNew; } +//static +weld::Window* SwViewShell::GetCareDialog(SwViewShell const & rVSh) +{ + auto& spCareDialog = getCareDialog(); + return (*spCareDialog.get()) ? spCareDialog.get()->get() : CareChildWin(rVSh); +} + sal_uInt16 SwViewShell::GetPageCount() const { return GetLayout() ? GetLayout()->GetPageNum() : 1;
