diff options
43 files changed, 222 insertions, 183 deletions
diff --git a/avmedia/source/qt6/QtPlayer.cxx b/avmedia/source/qt6/QtPlayer.cxx index 23460c92d675..b1d5fbb85370 100644 --- a/avmedia/source/qt6/QtPlayer.cxx +++ b/avmedia/source/qt6/QtPlayer.cxx @@ -72,9 +72,11 @@ void SAL_CALL QtPlayer::stop() { osl::MutexGuard aGuard(m_aMutex); - assert(m_xMediaPlayer); - // don't use QMediaPlayer::stop because XPlayer::stop should leave the position unchanged - m_xMediaPlayer->pause(); + if (m_xMediaPlayer) + { + // don't use QMediaPlayer::stop because XPlayer::stop should leave the position unchanged + m_xMediaPlayer->pause(); + } } sal_Bool SAL_CALL QtPlayer::isPlaying() @@ -284,9 +286,13 @@ void SAL_CALL QtPlayer::disposing() QtPlayer::~QtPlayer() { - // ensure output objects get deleted as QMediaPlayer doesn't take ownership of them - std::unique_ptr<QObject> xVideoWidget(m_xMediaPlayer->videoOutput()); - std::unique_ptr<QAudioOutput> xAudioOutput(m_xMediaPlayer->audioOutput()); + if (m_xMediaPlayer) + { + // ensure output objects get deleted as QMediaPlayer doesn't take ownership of them + std::unique_ptr<QObject> xVideoWidget(m_xMediaPlayer->videoOutput()); + std::unique_ptr<QAudioOutput> xAudioOutput(m_xMediaPlayer->audioOutput()); + } + m_xMediaPlayer.reset(); } diff --git a/basegfx/source/range/b2drange.cxx b/basegfx/source/range/b2drange.cxx index 1f20cce90a48..d43c6d6e12ec 100644 --- a/basegfx/source/range/b2drange.cxx +++ b/basegfx/source/range/b2drange.cxx @@ -48,6 +48,17 @@ namespace basegfx } } + void B2DRange::translate(double fTranslateX, double fTranslateY) + { + if(!(fTools::equalZero(fTranslateX) && fTools::equalZero(fTranslateY))) + { + *this = basegfx::B2DRange(fTranslateX + getMinX(), + fTranslateY + getMinY(), + fTranslateX + getMaxX(), + fTranslateY + getMaxY()); + } + } + B2DRange& B2DRange::operator*=(const basegfx::B2DHomMatrix& rMatrix) { transform(rMatrix); diff --git a/bridges/Library_net_uno.mk b/bridges/Library_net_uno.mk index 5579c3178492..ef6e74dd1693 100644 --- a/bridges/Library_net_uno.mk +++ b/bridges/Library_net_uno.mk @@ -22,6 +22,11 @@ $(eval $(call gb_Library_use_libraries,net_uno,\ salhelper \ )) +$(eval $(call gb_Library_use_externals,net_uno,\ + frozen \ +)) + + $(eval $(call gb_Library_add_exception_objects,net_uno,\ bridges/source/net_uno/net_base \ bridges/source/net_uno/net_bridge \ diff --git a/bridges/source/net_uno/net_data.cxx b/bridges/source/net_uno/net_data.cxx index fde61dba230c..3e2f73a12bc5 100644 --- a/bridges/source/net_uno/net_data.cxx +++ b/bridges/source/net_uno/net_data.cxx @@ -11,9 +11,10 @@ #include "net_proxy.hxx" #include <cstring> -#include <unordered_map> #include <vector> +#include <frozen/unordered_map.h> + #include <bridges/net_uno/net_context.hxx> namespace net_uno @@ -22,7 +23,7 @@ namespace { size_t net_sizeof(typelib_TypeClass eTypeClass) { - static const std::unordered_map<typelib_TypeClass, size_t> s_sizes{ + static constexpr frozen::unordered_map<typelib_TypeClass, size_t, 19> s_sizes{ { typelib_TypeClass_BOOLEAN, sizeof(sal_Bool) }, { typelib_TypeClass_BYTE, sizeof(sal_Int8) }, { typelib_TypeClass_CHAR, sizeof(sal_Unicode) }, diff --git a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx index f9e476021e44..f51f37c85966 100644 --- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx +++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx @@ -82,9 +82,9 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition( // manipulated (e.g. deleted) Primitive2DReference xTmp; { + maLastAccess = std::chrono::steady_clock::now(); // only hold the lock for long enough to get a valid reference std::lock_guard Guard(maCallbackLock); - maLastAccess = std::chrono::steady_clock::now(); if (!maBuffered2DDecomposition) { maBuffered2DDecomposition = create2DDecomposition(rViewInformation); diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index 7276da584bd9..e1cbc87eb66b 100644 --- a/editeng/source/misc/forbiddencharacterstable.cxx +++ b/editeng/source/misc/forbiddencharacterstable.cxx @@ -44,8 +44,8 @@ SvxForbiddenCharactersTable::GetForbiddenCharacters(LanguageType nLanguage, bool pForbiddenCharacters = &(it->second); else if (bGetDefault && m_xContext.is()) { - LocaleDataWrapper aWrapper(m_xContext, LanguageTag(nLanguage)); - maMap[nLanguage] = aWrapper.getForbiddenCharacters(); + const LocaleDataWrapper* pWrapper = LocaleDataWrapper::get(LanguageTag(nLanguage)); + maMap[nLanguage] = pWrapper->getForbiddenCharacters(); pForbiddenCharacters = &maMap[nLanguage]; } return pForbiddenCharacters; diff --git a/helpcontent2 b/helpcontent2 -Subproject d80c8eab1992dd82a197755e9c8e5c35eaff1be +Subproject c3aecb2749de2eea7c4eb0ad6481fc5eb97d3d7 diff --git a/include/basegfx/range/b2drange.hxx b/include/basegfx/range/b2drange.hxx index b0f726ac0e36..9a0aecbdae4c 100644 --- a/include/basegfx/range/b2drange.hxx +++ b/include/basegfx/range/b2drange.hxx @@ -114,6 +114,15 @@ namespace basegfx /** Transform Range by given transformation matrix. */ BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix); + /** Translate Range (ie. move). + Much faster equivalent of transform(createTranslateB2DHomMatrix(xx)). */ + BASEGFX_DLLPUBLIC void translate(double fTranslateX, double fTranslateY); + + inline void translate(const B2DTuple& rTranslate) + { + translate(rTranslate.getX(), rTranslate.getY()); + } + /** Transform Range by given transformation matrix. This operation transforms the Range by transforming all four possible diff --git a/include/svl/ondemand.hxx b/include/svl/ondemand.hxx index 691fd6fc8099..200958b2d99c 100644 --- a/include/svl/ondemand.hxx +++ b/include/svl/ondemand.hxx @@ -55,8 +55,8 @@ class OnDemandLocaleDataWrapper SvtSysLocale aSysLocale; LanguageType eCurrentLanguage; LanguageType eLastAnyLanguage; - std::optional<LocaleDataWrapper> moEnglish; - std::optional<LocaleDataWrapper> moAny; + const LocaleDataWrapper* mpEnglish{ nullptr }; + const LocaleDataWrapper* mpAny{ nullptr }; int nCurrent; // 0 == system, 1 == english, 2 == any bool bInitialized; @@ -86,20 +86,20 @@ public: nCurrent = 0; else if (eLang == LANGUAGE_ENGLISH_US) { - if (!moEnglish) - moEnglish.emplace(m_xContext, rLanguageTag); + if (!mpEnglish) + mpEnglish = LocaleDataWrapper::get(rLanguageTag); nCurrent = 1; } else { - if (!moAny) + if (!mpAny) { - moAny.emplace(m_xContext, rLanguageTag); + mpAny = LocaleDataWrapper::get(rLanguageTag); eLastAnyLanguage = eLang; } else if (eLastAnyLanguage != eLang) { - moAny.emplace(m_xContext, rLanguageTag); + mpAny = LocaleDataWrapper::get(rLanguageTag); eLastAnyLanguage = eLang; } nCurrent = 2; @@ -116,9 +116,9 @@ public: case 0: return &aSysLocale.GetLocaleData(); case 1: - return &*moEnglish; + return mpEnglish; case 2: - return &*moAny; + return mpAny; default: assert(false); return nullptr; diff --git a/include/unotools/intlwrapper.hxx b/include/unotools/intlwrapper.hxx index 0c473cc4293f..6df48a9e8f12 100644 --- a/include/unotools/intlwrapper.hxx +++ b/include/unotools/intlwrapper.hxx @@ -54,7 +54,7 @@ private: LanguageTag maLanguageTag; css::uno::Reference< css::uno::XComponentContext > m_xContext; - std::unique_ptr<LocaleDataWrapper> pLocaleData; + const LocaleDataWrapper* pLocaleData { nullptr }; std::optional<CollatorWrapper> moCollator; std::optional<CollatorWrapper> moCaseCollator; @@ -69,7 +69,7 @@ public: { if ( !pLocaleData ) ImplNewLocaleData(); - return pLocaleData.get(); + return pLocaleData; } /// case insensitive collator, simple IGNORE_CASE const CollatorWrapper* getCollator() const diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx index 22fd3e07035c..9125a7e2716b 100644 --- a/include/unotools/localedatawrapper.hxx +++ b/include/unotools/localedatawrapper.hxx @@ -118,11 +118,18 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper SAL_DLLPRIVATE void loadDigitGrouping(); -public: LocaleDataWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext, LanguageTag aLanguageTag ); + +public: + + /** + * retrieve a cached LocaleDataWrapper + */ + static const LocaleDataWrapper* get(const LanguageTag& aLanguageTag); + /** @param rOverrideDateAcceptancePatterns Override locale's date acceptance patterns. An empty sequence resets the patterns to the locale's pattern sequence. diff --git a/include/vcl/i18nhelp.hxx b/include/vcl/i18nhelp.hxx index 9f6e43bb6a54..8179f7c3bc00 100644 --- a/include/vcl/i18nhelp.hxx +++ b/include/vcl/i18nhelp.hxx @@ -45,7 +45,7 @@ class VCL_DLLPUBLIC I18nHelper LanguageTag maLanguageTag; css::uno::Reference< css::uno::XComponentContext > m_xContext; - std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper; + const LocaleDataWrapper* mpLocaleDataWrapper { nullptr }; std::unique_ptr<utl::TransliterationWrapper> mpTransliterationWrapper; bool mbTransliterateIgnoreCase; @@ -53,7 +53,7 @@ class VCL_DLLPUBLIC I18nHelper SAL_DLLPRIVATE void ImplDestroyWrappers(); SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const; - SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const; + SAL_DLLPRIVATE const LocaleDataWrapper& ImplGetLocaleDataWrapper() const; public: diff --git a/include/xmloff/xmlnumfe.hxx b/include/xmloff/xmlnumfe.hxx index 9ac4e755f99c..24b397519389 100644 --- a/include/xmloff/xmlnumfe.hxx +++ b/include/xmloff/xmlnumfe.hxx @@ -54,7 +54,7 @@ private: OUStringBuffer m_sBlankWidthString; bool m_bHasText; std::unique_ptr<SvXMLNumUsedList_Impl> m_pUsedList; - std::unique_ptr<LocaleDataWrapper> m_pLocaleData; + const LocaleDataWrapper* m_pLocaleData { nullptr }; SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar ); SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong ); diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 969df405cc10..75d1caf3a627 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -702,6 +702,14 @@ <value>15</value> </prop> <group oor:name="macOS"> + <prop oor:name="EnableNativeFullScreenWindows" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies if clicking the green button in a window's + titlebar causes the window to switch to native full screen + mode.</desc> + </info> + <value>true</value> + </prop> <prop oor:name="IgnoreKeysWhenScrollingWithTrackpadOrMagicMouse" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Specifies if the Command, Option, Control, and Shift keys diff --git a/readlicense_oo/license/license.xml b/readlicense_oo/license/license.xml index 9e5bacd149f9..fc85fc10e5c9 100644 --- a/readlicense_oo/license/license.xml +++ b/readlicense_oo/license/license.xml @@ -1740,25 +1740,25 @@ <h2>Python</h2> <p>The following software may be included in this product: Python. Use of any of this software is governed by the terms of the license below:</p> - <h3>PSF LICENSE AGREEMENT FOR PYTHON 2.3</h3> + <h3>PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2</h3> <p>1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or - Organization ("Licensee") accessing and otherwise using Python 2.3 software in source or binary form and its - associated documentation.</p> + Organization ("Licensee") accessing and otherwise using this software ("Python") in source or binary form and + its associated documentation.</p> <p>2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare - derivative works, distribute, and otherwise use Python 2.3 alone or in any derivative version, provided, - however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001, 2002, 2003, - 2004 Python Software Foundation; All Rights Reserved" are retained in Python 2.3 alone or in any derivative - version prepared by Licensee.</p> - <p>3. In the event Licensee prepares a derivative work that is based on or incorporates Python 2.3 or any part + derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, + however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright © 2001-2024 Python + Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared + by Licensee.</p> + <p>3. In the event Licensee prepares a derivative work that is based on or incorporates Python or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby - agrees to include in any such work a brief summary of the changes made to Python 2.3.</p> - <p>4. PSF is making Python 2.3 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR + agrees to include in any such work a brief summary of the changes made to Python.</p> + <p>4. PSF is making Python available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON - 2.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.</p> - <p>5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.3 FOR ANY INCIDENTAL, SPECIAL, OR - CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3, OR ANY + WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.</p> + <p>5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON FOR ANY INCIDENTAL, SPECIAL, OR + CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.</p> <p>6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.</p> @@ -1766,7 +1766,7 @@ joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.</p> - <p>8. By copying, installing or otherwise using Python 2.3, Licensee agrees to be bound by the terms and + <p>8. By copying, installing or otherwise using Python, Licensee agrees to be bound by the terms and conditions of this License Agreement.</p> <p>BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0</p> <p>BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1</p> diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx index c69da6de4e3b..45f473c7e945 100644 --- a/sc/source/core/tool/numformat.cxx +++ b/sc/source/core/tool/numformat.cxx @@ -36,10 +36,9 @@ namespace return ScGlobal::getLocaleData().getNumDecimalSep(); // LocaleDataWrapper can be expensive to construct, so cache the result for // repeated calls - static std::optional<LocaleDataWrapper> localeCache; + static const LocaleDataWrapper* localeCache { nullptr }; if (!localeCache || localeCache->getLanguageTag().getLanguageType() != nFormatLang) - localeCache.emplace( - comphelper::getProcessComponentContext(), LanguageTag(nFormatLang)); + localeCache = LocaleDataWrapper::get(LanguageTag(nFormatLang)); return localeCache->getNumDecimalSep(); } } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 0fb17cee4921..4e72aa790d76 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -809,11 +809,11 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, std::u16string_vi { { ScXMLImport::MutexGuard aGuard(*this); - LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(), LanguageTag( aLocale) ); + const LocaleDataWrapper* pLocaleData = LocaleDataWrapper::get( LanguageTag( aLocale) ); sFormatString = "#" + - aLocaleData.getNumThousandSep() + + pLocaleData->getNumThousandSep() + "##0" + - aLocaleData.getNumDecimalSep() + + pLocaleData->getNumDecimalSep() + "00 [$" + rCurrency + "]"; diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index 9b43f462b194..96a324c7fad8 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -187,108 +187,68 @@ void ScRandomNumberGeneratorDialog::SelectGeneratorAndGenerateNumbers() case DIST_UNIFORM: { std::uniform_real_distribution<> distribution(parameter1, parameter2); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_REAL, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_UNIFORM_REAL, aDecimalPlaces); break; } case DIST_UNIFORM_INTEGER: { std::uniform_int_distribution<sal_Int64> distribution(parameterInteger1, parameterInteger2); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_UNIFORM_INTEGER, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_UNIFORM_INTEGER, aDecimalPlaces); break; } case DIST_NORMAL: { std::normal_distribution<> distribution(parameter1, parameter2); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_NORMAL, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_NORMAL, aDecimalPlaces); break; } case DIST_CAUCHY: { std::cauchy_distribution<> distribution(parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_CAUCHY, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_CAUCHY, aDecimalPlaces); break; } case DIST_BERNOULLI: { std::bernoulli_distribution distribution(parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_BERNOULLI, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_BERNOULLI, aDecimalPlaces); break; } case DIST_BINOMIAL: { std::binomial_distribution<> distribution(parameterInteger2, parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_BINOMIAL, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_BINOMIAL, aDecimalPlaces); break; } case DIST_CHI_SQUARED: { std::chi_squared_distribution<> distribution(parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_CHI_SQUARED, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_CHI_SQUARED, aDecimalPlaces); break; } case DIST_GEOMETRIC: { std::geometric_distribution<> distribution(parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_GEOMETRIC, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_GEOMETRIC, aDecimalPlaces); break; } case DIST_NEGATIVE_BINOMIAL: { std::negative_binomial_distribution<> distribution(parameterInteger2, parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_NEGATIVE_BINOMIAL, aDecimalPlaces); break; } case DIST_POISSON: { std::poisson_distribution<> distribution(parameter1); - auto rng = [&distribution, seed]() mutable - { - return distribution(seed); - }; - GenerateNumbers(rng, STR_DISTRIBUTION_POISSON, aDecimalPlaces); + GenerateNumbers(distribution, seed, STR_DISTRIBUTION_POISSON, aDecimalPlaces); break; } } } -template<class RNG> -void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, std::optional<sal_Int8> aDecimalPlaces) +template<class DIST> +void ScRandomNumberGeneratorDialog::GenerateNumbers(DIST& distribution, std::mt19937& seed, TranslateId pDistributionStringId, std::optional<sal_Int8> aDecimalPlaces) { OUString aUndo = ScResId(STR_UNDO_DISTRIBUTION_TEMPLATE); OUString aDistributionName = ScResId(pDistributionStringId); @@ -319,9 +279,9 @@ void ScRandomNumberGeneratorDialog::GenerateNumbers(RNG& randomGenerator, Transl { if (aDecimalPlaces) - aVals.push_back(rtl::math::round(randomGenerator(), *aDecimalPlaces)); + aVals.push_back(rtl::math::round(distribution(seed), *aDecimalPlaces)); else - aVals.push_back(randomGenerator()); + aVals.push_back(distribution(seed)); } pDocShell->GetDocFunc().SetValueCells(aPos, aVals, true); diff --git a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx index 0f890fc79936..770620bed3a8 100644 --- a/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx +++ b/sc/source/ui/inc/RandomNumberGeneratorDialog.hxx @@ -60,9 +60,8 @@ private: void Init(); void GetRangeFromSelection(); - template<class RNG> - - void GenerateNumbers(RNG& randomGenerator, TranslateId pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces); + template<class DIST> + void GenerateNumbers(DIST& distribution, std::mt19937& seed, TranslateId pDistributionStringId, const std::optional<sal_Int8> aDecimalPlaces); void SelectGeneratorAndGenerateNumbers(); diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 69ac967d2364..a594832b1107 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -456,6 +456,8 @@ void ScDBFunc::ClearAutoFilter() SCTAB nTab = GetViewData().GetTabNo(); ScDBData* pDBData = rDoc.GetDBAtCursor(nCol, nRow, nTab, ScDBDataPortion::AREA); + if (!pDBData) + return; ScQueryParam aParam; pDBData->GetQueryParam(aParam); diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx index a51a9e0e0a0d..b925b7e6e6a9 100644 --- a/sfx2/source/dialog/StyleList.cxx +++ b/sfx2/source/dialog/StyleList.cxx @@ -760,7 +760,7 @@ static void lcl_Update(weld::TreeView& rTreeView, const weld::TreeIter& rIter, rTreeView.set_id(rIter, rName); rTreeView.set_text(rIter, rName); - rTreeView.set_image(rIter, *xDevice); + rTreeView.set_image(rIter, *xDevice, 0); } static void FillBox_Impl(weld::TreeView& rBox, StyleTreeArr_Impl& rTreeArray, diff --git a/sfx2/uiconfig/ui/templatepanel.ui b/sfx2/uiconfig/ui/templatepanel.ui index 41c908c805cd..a5d232659113 100644 --- a/sfx2/uiconfig/ui/templatepanel.ui +++ b/sfx2/uiconfig/ui/templatepanel.ui @@ -4,8 +4,8 @@ <requires lib="gtk+" version="3.20"/> <object class="GtkTreeStore" id="liststore1"> <columns> - <!-- column-name image --> - <column type="CairoSurface"/> + <!-- column-name pixbuf --> + <column type="GdkPixbuf"/> <!-- column-name text --> <column type="gchararray"/> <!-- column-name id --> @@ -14,8 +14,8 @@ </object> <object class="GtkTreeStore" id="liststore2"> <columns> - <!-- column-name image --> - <column type="CairoSurface"/> + <!-- column-name pixbuf --> + <column type="GdkPixbuf"/> <!-- column-name text --> <column type="gchararray"/> <!-- column-name id --> @@ -304,6 +304,9 @@ <object class="GtkTreeViewColumn" id="treeviewcolumn0"> <child> <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/> + <attributes> + <attribute name="pixbuf">0</attribute> + </attributes> </child> </object> </child> @@ -358,6 +361,9 @@ <object class="GtkTreeViewColumn" id="treeviewcolumn3"> <child> <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf2"/> + <attributes> + <attribute name="pixbuf">0</attribute> + </attributes> </child> </object> </child> diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 80ec80e0d87e..e2969c996d75 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -2009,8 +2009,8 @@ CPPUNIT_TEST_FIXTURE(Test, testLanguageNone) sal_uInt32 nKey = aFormatter.GetEntryKey(code, LANGUAGE_GERMAN); CPPUNIT_ASSERT(nKey != NUMBERFORMAT_ENTRY_NOT_FOUND); SvNumberformat const*const pFormat = aFormatter.GetEntry(nKey); - LocaleDataWrapper ldw(m_xContext, LanguageTag(pFormat->GetLanguage())); - CPPUNIT_ASSERT_EQUAL(u"dd.mm.yyyy"_ustr, pFormat->GetMappedFormatstring(keywords, ldw)); + const LocaleDataWrapper* ldw = LocaleDataWrapper::get(LanguageTag(pFormat->GetLanguage())); + CPPUNIT_ASSERT_EQUAL(u"dd.mm.yyyy"_ustr, pFormat->GetMappedFormatstring(keywords, *ldw)); } CPPUNIT_TEST_FIXTURE(Test, testTdf160306) diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 3eb48c09f823..61fa1f06bcf7 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -4673,8 +4673,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() bInitializing = true; LanguageType eSysLang = SvtSysLocale().GetLanguageTag().getLanguageType(); - std::optional<LocaleDataWrapper> pLocaleData(std::in_place, - ::comphelper::getProcessComponentContext(), + const LocaleDataWrapper* pLocaleData = LocaleDataWrapper::get( SvtSysLocale().GetLanguageTag() ); // get user configured currency OUString aConfiguredCurrencyAbbrev; @@ -4700,9 +4699,7 @@ void SvNumberFormatter::ImpInitCurrencyTable() { LanguageType eLang = LanguageTag::convertToLanguageType( rLocale, false); theInstalledLocales.insert( eLang); - pLocaleData.emplace( - ::comphelper::getProcessComponentContext(), - LanguageTag(rLocale) ); + pLocaleData = LocaleDataWrapper::get( LanguageTag(rLocale) ); Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies(); sal_Int32 nCurrencyCount = aCurrSeq.getLength(); Currency2 const * const pCurrencies = aCurrSeq.getConstArray(); @@ -4814,7 +4811,6 @@ void SvNumberFormatter::ImpInitCurrencyTable() LocaleDataWrapper::outputCheckMessage( "SvNumberFormatter::ImpInitCurrencyTable: system currency not in I18N locale data."); } - pLocaleData.reset(); SvtSysLocaleOptions::SetCurrencyChangeLink( LINK( nullptr, SvNumberFormatter, CurrencyChangeLink ) ); bInitializing = false; g_CurrencyTableInitialized = true; diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index 33f55a1d548d..e911e5d7cdf9 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -75,10 +75,10 @@ void SwBreakIt::GetLocale_( const LanguageTag& rLanguageTag ) void SwBreakIt::GetForbidden_( const LanguageType aLang ) { - LocaleDataWrapper aWrap(m_xContext, GetLanguageTag(aLang)); + const LocaleDataWrapper* pWrap = LocaleDataWrapper::get(GetLanguageTag(aLang)); m_aForbiddenLang = aLang; - m_oForbidden.emplace(aWrap.getForbiddenCharacters()); + m_oForbidden.emplace(pWrap->getForbiddenCharacters()); } sal_uInt16 SwBreakIt::GetRealScriptOfText( const OUString& rText, sal_Int32 nPos ) const diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 517b32171d4a..74b3aa7b7574 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -567,7 +567,7 @@ bool SwTaggedPDFHelper::CheckReopenTag() { void const*const pKey = lcl_GetKeyFromFrame(*pKeyFrame); FrameTagSet& rFrameTagSet(mpPDFExtOutDevData->GetSwPDFState()->m_FrameTagSet); - if (rFrameTagSet.find(pKey) != rFrameTagSet.end() + if (rFrameTagSet.contains(pKey) || rFrame.IsFlyFrame()) // for hell layer flys { pReopenKey = pKey; @@ -654,7 +654,7 @@ void SwTaggedPDFHelper::BeginTag(vcl::pdf::StructElement eType, const OUString& if (pKey) { FrameTagSet& rFrameTagSet(mpPDFExtOutDevData->GetSwPDFState()->m_FrameTagSet); - assert(rFrameTagSet.find(pKey) == rFrameTagSet.end()); + assert(!rFrameTagSet.contains(pKey)); rFrameTagSet.emplace(pKey); } } @@ -1461,7 +1461,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } FrameTagSet& rFrameTagSet(mpPDFExtOutDevData->GetSwPDFState()->m_FrameTagSet); - if (rFrameTagSet.find(pSection) != rFrameTagSet.end()) + if (rFrameTagSet.contains(pSection)) { // special case: section may have *multiple* master frames, // when it is interrupted by nested section - reopen! @@ -1573,7 +1573,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() if (pTabFrame) { const SwTable* pTable = pTabFrame->GetTable(); - if (rTableCaptionsMap.find(pTable) != rTableCaptionsMap.end()) + if (rTableCaptionsMap.contains(pTable)) { // Reopen Caption tag: // - if the table has an above and below caption diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 856e8d039d19..93804c2b22b2 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2744,11 +2744,10 @@ bool MSWordExportBase::GetNumberFormat(const SwField& rField, OUString& rStr) { nLng = pNumFormat->GetLanguage(); } - LocaleDataWrapper aLocDat(pNFormatr->GetComponentContext(), - LanguageTag(nLng)); + const LocaleDataWrapper* pLocDat = LocaleDataWrapper::get(LanguageTag(nLng)); OUString sFormat(pNumFormat->GetMappedFormatstring(GetNfKeywordTable(), - aLocDat)); + *pLocDat)); if (!sFormat.isEmpty()) { diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 49f7a0a363df..b1ab348e7b33 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -330,14 +330,14 @@ css::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const } // the remaining is the locale - LocaleDataWrapper aLocaleInfo( m_xContext, LanguageTag(sDefaultCurrency) ); + const LocaleDataWrapper* pLocaleInfo = LocaleDataWrapper::get( LanguageTag(sDefaultCurrency) ); if ( sBankSymbol.isEmpty() ) - sBankSymbol = aLocaleInfo.getCurrBankSymbol(); + sBankSymbol = pLocaleInfo->getCurrBankSymbol(); // look for the currency entry (for this language) which has the given bank symbol - const Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies(); + const Sequence< Currency2 > aAllCurrencies = pLocaleInfo->getAllCurrencies(); - OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol(); + OUString sCurrencySymbol = pLocaleInfo->getCurrSymbol(); if ( sBankSymbol.isEmpty() ) { DBG_ASSERT( aAllCurrencies.hasElements(), "UnoControlModel::ImplGetDefaultValue: no currencies at all!" ); diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx index 19157dab4a67..cbe72e8bc430 100644 --- a/unotools/source/i18n/intlwrapper.cxx +++ b/unotools/source/i18n/intlwrapper.cxx @@ -37,7 +37,7 @@ IntlWrapper::~IntlWrapper() void IntlWrapper::ImplNewLocaleData() const { - const_cast<IntlWrapper*>(this)->pLocaleData.reset( new LocaleDataWrapper( m_xContext, maLanguageTag ) ); + const_cast<IntlWrapper*>(this)->pLocaleData = LocaleDataWrapper::get( maLanguageTag ); } void IntlWrapper::ImplNewCollator( bool bCaseSensitive ) const diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx index a49f11f15ed1..51714d9d6062 100644 --- a/unotools/source/i18n/localedatawrapper.cxx +++ b/unotools/source/i18n/localedatawrapper.cxx @@ -43,6 +43,8 @@ #include <tools/time.hxx> #include <tools/duration.hxx> #include <o3tl/string_view.hxx> +#include <map> +#include <mutex> #include <utility> const sal_uInt16 nCurrFormatDefault = 0; @@ -59,6 +61,26 @@ namespace sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0; +/** + * Loading LocaleDataWrapper can become expensive because of all the function-symbol lookups required, so + * we cache these. + */ +// static +const LocaleDataWrapper* LocaleDataWrapper::get(const LanguageTag& aLanguageTag) +{ + static std::map<LanguageTag, std::unique_ptr<LocaleDataWrapper>> gCache; + static std::mutex gMutex; + + std::unique_lock l(gMutex); + auto it = gCache.find(aLanguageTag); + if (it != gCache.end()) + return it->second.get(); + auto pNew = new LocaleDataWrapper(comphelper::getProcessComponentContext(), aLanguageTag); + gCache.insert({aLanguageTag, std::unique_ptr<LocaleDataWrapper>(pNew)}); + return pNew; +}; + + LocaleDataWrapper::LocaleDataWrapper( const Reference< uno::XComponentContext > & rxContext, LanguageTag aLanguageTag diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx index be25063a94e3..033fc8407d0c 100644 --- a/vcl/headless/CairoCommon.cxx +++ b/vcl/headless/CairoCommon.cxx @@ -777,7 +777,7 @@ void CairoCommon::drawLine(tools::Long nX1, tools::Long nY1, tools::Long nX2, to CairoCommon::applyColor(cr, *m_oLineColor); basegfx::B2DRange extents = getClippedStrokeDamage(cr); - extents.transform(basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5)); + extents.translate(0.5, 0.5); cairo_stroke(cr); @@ -965,7 +965,7 @@ void CairoCommon::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice, // expand with possible StrokeDamage basegfx::B2DRange stroke_extents = getClippedStrokeDamage(cr); - stroke_extents.transform(basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5)); + stroke_extents.translate(0.5, 0.5); extents.expand(stroke_extents); cairo_stroke(cr); @@ -1295,7 +1295,7 @@ bool CairoCommon::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWid // expand with possible StrokeDamage basegfx::B2DRange stroke_extents = getClippedStrokeDamage(cr); - stroke_extents.transform(basegfx::utils::createTranslateB2DHomMatrix(0.5, 0.5)); + stroke_extents.translate(0.5, 0.5); extents.expand(stroke_extents); cairo_stroke(cr); diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 74da526f6ba4..939f230ee8ef 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -320,12 +320,19 @@ static void updateMenuBarVisibility( const AquaSalFrame *pFrame ) defer: Application::IsHeadlessModeEnabled()]; // Enable fullscreen options if available and useful - bool bAllowFullScreen = (SalFrameStyleFlags::NONE == (mpFrame->mnStyle & (SalFrameStyleFlags::DIALOG | SalFrameStyleFlags::TOOLTIP | SalFrameStyleFlags::SYSTEMCHILD | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLWINDOW | SalFrameStyleFlags::INTRO))); - bAllowFullScreen &= (SalFrameStyleFlags::NONE == (~mpFrame->mnStyle & SalFrameStyleFlags::SIZEABLE)); - bAllowFullScreen &= (mpFrame->mpParent == nullptr); + if ( officecfg::Office::Common::VCL::macOS::EnableNativeFullScreenWindows::get() ) + { + bool bAllowFullScreen = (SalFrameStyleFlags::NONE == (mpFrame->mnStyle & (SalFrameStyleFlags::DIALOG | SalFrameStyleFlags::TOOLTIP | SalFrameStyleFlags::SYSTEMCHILD | SalFrameStyleFlags::FLOAT | SalFrameStyleFlags::TOOLWINDOW | SalFrameStyleFlags::INTRO))); + bAllowFullScreen &= (SalFrameStyleFlags::NONE == (~mpFrame->mnStyle & SalFrameStyleFlags::SIZEABLE)); + bAllowFullScreen &= (mpFrame->mpParent == nullptr); + [pNSWindow setCollectionBehavior: (bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary)]; + } + else + { + [pNSWindow setCollectionBehavior: NSWindowCollectionBehaviorFullScreenNone]; + } [pNSWindow setReleasedWhenClosed: NO]; - [pNSWindow setCollectionBehavior: (bAllowFullScreen ? NSWindowCollectionBehaviorFullScreenPrimary : NSWindowCollectionBehaviorFullScreenAuxiliary)]; // Disable window restoration until we support it directly [pNSWindow setRestorable: NO]; diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx index a14f1874c83e..8200af5663a9 100644 --- a/vcl/osx/salmenu.cxx +++ b/vcl/osx/salmenu.cxx @@ -400,6 +400,19 @@ void AquaSalMenu::setDefaultMenu() if( [pItem menu] == nil ) [pMenu insertItem: pItem atIndex: i+1]; } + + // Related: tdf#128186 force key window to a native full screen window + // AquaSalMenu::setDefaultMenu() is generally called when the key + // window has been closed. When not in native full screen mode, + // macOS appears to automatically set the key window. + // However, closing a native full screen window sometimes causes + // the application to drop out of full screen mode even if there + // are still native full screen windows open. So, if the application + // is active, activate all windows to force macOS to set the key + // to a window rather than leaving the application in a state where + // the key window is nil. + if( [NSApp isActive] ) + [[NSRunningApplication currentApplication] activateWithOptions: NSApplicationActivateAllWindows]; } void AquaSalMenu::enableMainMenu( bool bEnable ) diff --git a/vcl/source/app/i18nhelp.cxx b/vcl/source/app/i18nhelp.cxx index d497cdba4fba..0f1ab0bff29b 100644 --- a/vcl/source/app/i18nhelp.cxx +++ b/vcl/source/app/i18nhelp.cxx @@ -47,7 +47,7 @@ vcl::I18nHelper::~I18nHelper() void vcl::I18nHelper::ImplDestroyWrappers() { - mpLocaleDataWrapper.reset(); + mpLocaleDataWrapper = nullptr; mpTransliterationWrapper.reset(); } @@ -65,11 +65,11 @@ utl::TransliterationWrapper& vcl::I18nHelper::ImplGetTransliterationWrapper() co return *mpTransliterationWrapper; } -LocaleDataWrapper& vcl::I18nHelper::ImplGetLocaleDataWrapper() const +const LocaleDataWrapper& vcl::I18nHelper::ImplGetLocaleDataWrapper() const { if ( !mpLocaleDataWrapper ) { - const_cast<vcl::I18nHelper*>(this)->mpLocaleDataWrapper.reset(new LocaleDataWrapper( m_xContext, maLanguageTag )); + const_cast<vcl::I18nHelper*>(this)->mpLocaleDataWrapper = LocaleDataWrapper::get( maLanguageTag ); } return *mpLocaleDataWrapper; } diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 4cc7090697bc..c018a367a73f 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3880,6 +3880,9 @@ SalInstanceTreeView::SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBui m_xTreeView->SetCustomMeasureHdl(LINK(this, SalInstanceTreeView, CustomMeasureHdl)); const std::vector<tools::Long> aTabPositions{ 0 }; m_xTreeView->SetTabs(aTabPositions); + // by default, 1st one is editable, others not; override with set_column_editables + m_xTreeView->SetTabEditable(0, true); + SvHeaderTabListBox* pHeaderBox = dynamic_cast<SvHeaderTabListBox*>(m_xTreeView.get()); if (pHeaderBox) @@ -4533,7 +4536,7 @@ void SalInstanceTreeView::end_editing() { m_xTreeView->EndEditing(); } void SalInstanceTreeView::set_image(SvTreeListEntry* pEntry, const Image& rImage, int col) { - if (col == -1) + if (col == -1 || col == 0) { m_xTreeView->SetExpandedEntryBmp(pEntry, rImage); m_xTreeView->SetCollapsedEntryBmp(pEntry, rImage); diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 5459bc30263b..16bb4bb882f4 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -282,9 +282,9 @@ struct ImplAllSettingsData SvtSysLocale maSysLocale; LanguageTag maLocale; LanguageTag maUILocale; - mutable std::unique_ptr<LocaleDataWrapper> mpLocaleDataWrapper; - mutable std::unique_ptr<LocaleDataWrapper> mpUILocaleDataWrapper; - mutable std::unique_ptr<LocaleDataWrapper> mpNeutralLocaleDataWrapper; + mutable const LocaleDataWrapper* mpLocaleDataWrapper { nullptr }; + mutable const LocaleDataWrapper* mpUILocaleDataWrapper { nullptr }; + mutable const LocaleDataWrapper* mpNeutralLocaleDataWrapper { nullptr }; mutable std::unique_ptr<vcl::I18nHelper> mpI18nHelper; mutable std::unique_ptr<vcl::I18nHelper> mpUII18nHelper; @@ -2545,9 +2545,6 @@ ImplAllSettingsData::ImplAllSettingsData( const ImplAllSettingsData& rData ) : ImplAllSettingsData::~ImplAllSettingsData() { - mpLocaleDataWrapper.reset(); - mpUILocaleDataWrapper.reset(); - mpNeutralLocaleDataWrapper.reset(); mpI18nHelper.reset(); mpUII18nHelper.reset(); } @@ -2650,7 +2647,7 @@ void AllSettings::SetLanguageTag( const LanguageTag& rLanguageTag ) if ( myData->mpLocaleDataWrapper ) { - myData->mpLocaleDataWrapper.reset(); + myData->mpLocaleDataWrapper = nullptr; } if ( myData->mpI18nHelper ) { @@ -2753,24 +2750,21 @@ const LanguageTag& AllSettings::GetUILanguageTag() const const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const { if ( !mxData->mpLocaleDataWrapper ) - mxData->mpLocaleDataWrapper.reset( new LocaleDataWrapper( - comphelper::getProcessComponentContext(), GetLanguageTag() ) ); + mxData->mpLocaleDataWrapper = LocaleDataWrapper::get( GetLanguageTag() ); return *mxData->mpLocaleDataWrapper; } const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const { if ( !mxData->mpUILocaleDataWrapper ) - mxData->mpUILocaleDataWrapper.reset( new LocaleDataWrapper( - comphelper::getProcessComponentContext(), GetUILanguageTag() ) ); + mxData->mpUILocaleDataWrapper = LocaleDataWrapper::get( GetUILanguageTag() ); return *mxData->mpUILocaleDataWrapper; } const LocaleDataWrapper& AllSettings::GetNeutralLocaleDataWrapper() const { if ( !mxData->mpNeutralLocaleDataWrapper ) - mxData->mpNeutralLocaleDataWrapper.reset( new LocaleDataWrapper( - comphelper::getProcessComponentContext(), LanguageTag(u"en-US"_ustr) ) ); + mxData->mpNeutralLocaleDataWrapper = LocaleDataWrapper::get( LanguageTag(u"en-US"_ustr) ); return *mxData->mpNeutralLocaleDataWrapper; } diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index fe226bd63598..44e51c42c75b 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -273,8 +273,8 @@ void drawFromDrawCommands(gfx::DrawRoot const& rDrawRoot, SalGraphics& rGraphics aInputRectangle.getMinX(), aInputRectangle.getMinY(), aInputRectangle.getMaxX() + fDeltaX, aInputRectangle.getMaxY() + fDeltaY); - aFinalRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix( - aTargetSurface.getMinX() - 0.5, aTargetSurface.getMinY() - 0.5)); + aFinalRectangle.translate(aTargetSurface.getMinX() - 0.5, + aTargetSurface.getMinY() - 0.5); basegfx::B2DPolygon aB2DPolygon = basegfx::utils::createPolygonFromRect( aFinalRectangle, rRectangle.mnRx / aFinalRectangle.getWidth() * 2.0, diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 0513156c3eb3..742ebdfe61c5 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -236,7 +236,8 @@ bool SalLayout::GetBoundRect(basegfx::B2DRectangle& rRect) const { if (!aRectangle.isEmpty()) { - aRectangle.transform(basegfx::utils::createTranslateB2DHomMatrix(aPos)); + // translate rectangle to correct position + aRectangle.translate(aPos); // merge rectangle rRect.expand(aRectangle); } diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index ff83e0807a59..a54854403e8c 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -2102,15 +2102,11 @@ bool OutputDevice::GetTextBoundRect(basegfx::B2DRectangle& rRect, const OUString if( bRet ) { basegfx::B2DPoint aPos = pSalLayout->GetDrawPosition(basegfx::B2DPoint(nXOffset, 0)); - auto m = basegfx::utils::createTranslateB2DHomMatrix(mnTextOffX - aPos.getX(), - mnTextOffY - aPos.getY()); - aPixelRect.transform(m); + aPixelRect.translate(mnTextOffX - aPos.getX(), mnTextOffY - aPos.getY()); rRect = PixelToLogic( aPixelRect ); if (mbMap) { - m = basegfx::utils::createTranslateB2DHomMatrix(maMapRes.mnMapOfsX, - maMapRes.mnMapOfsY); - rRect.transform(m); + rRect.translate(maMapRes.mnMapOfsX, maMapRes.mnMapOfsY); } } } diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index c0b545a57f84..0b99201b6702 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -47,8 +47,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; -constexpr SvLBoxTabFlags MYTABMASK = SvLBoxTabFlags::ADJUST_FLAGS | SvLBoxTabFlags::FORCE; - namespace { OString lcl_extractPngString(const BitmapEx& rImage) { @@ -289,10 +287,7 @@ void SvTabListBox::SetTabs(const std::vector<tools::Long>& rTabPositions, MapUni aSize = LogicToLogic( aSize, &aMMSource, &aMMDest ); tools::Long nNewTab = aSize.Width(); mvTabList[nIdx].SetPos( nNewTab ); - mvTabList[nIdx].nFlags &= MYTABMASK; } - // by default, 1st one is editable, others not; override with set_column_editables - mvTabList[0].nFlags |= SvLBoxTabFlags::EDITABLE; SvTreeListBox::nTreeFlags |= SvTreeFlags::RECALCTABS; if( IsUpdateMode() ) Invalidate(); diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index b320850ad6c0..d5b0da792707 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -4763,7 +4763,7 @@ namespace OUString get_primary_text(GtkMessageDialog* pMessageDialog) { - gchar* pText = nullptr; + g_autofree char* pText = nullptr; g_object_get(G_OBJECT(pMessageDialog), "text", &pText, nullptr); return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); } @@ -4784,7 +4784,7 @@ namespace OUString get_secondary_text(GtkMessageDialog* pMessageDialog) { - gchar* pText = nullptr; + g_autofree char* pText = nullptr; g_object_get(G_OBJECT(pMessageDialog), "secondary-text", &pText, nullptr); return OUString(pText, pText ? strlen(pText) : 0, RTL_TEXTENCODING_UTF8); } @@ -24145,7 +24145,8 @@ private: } // if no tooltip reuse the label as default tooltip - if (!gtk_widget_get_tooltip_text(pWidget)) + g_autofree char* pTooltipText = gtk_widget_get_tooltip_text(pWidget); + if (!pTooltipText) { if (const gchar* label = gtk_tool_button_get_label(pToolButton)) gtk_widget_set_tooltip_text(pWidget, label); @@ -24218,7 +24219,11 @@ private: if (m_pStringReplace) { // tdf#136498 %PRODUCTNAME shown in tool tips +#if GTK_CHECK_VERSION(4, 0, 0) const char* pTooltip = gtk_widget_get_tooltip_text(pWidget); +#else + g_autofree char* pTooltip = gtk_widget_get_tooltip_text(pWidget); +#endif if (pTooltip && pTooltip[0]) { OUString aTooltip(pTooltip, strlen(pTooltip), RTL_TEXTENCODING_UTF8); diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index f09d1e94942b..ade9e56238a7 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -224,14 +224,13 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( m_pFormatter ) { - m_pLocaleData.reset( new LocaleDataWrapper( m_pFormatter->GetComponentContext(), - m_pFormatter->GetLanguageTag() ) ); + m_pLocaleData = LocaleDataWrapper::get( m_pFormatter->GetLanguageTag() ); } else { LanguageTag aLanguageTag( MsLangId::getConfiguredSystemLanguage() ); - m_pLocaleData.reset( new LocaleDataWrapper( m_rExport.getComponentContext(), std::move(aLanguageTag) ) ); + m_pLocaleData = LocaleDataWrapper::get( std::move(aLanguageTag) ); } m_pUsedList.reset(new SvXMLNumUsedList_Impl); @@ -254,14 +253,13 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( if ( m_pFormatter ) { - m_pLocaleData.reset( new LocaleDataWrapper( m_pFormatter->GetComponentContext(), - m_pFormatter->GetLanguageTag() ) ); + m_pLocaleData = LocaleDataWrapper::get( m_pFormatter->GetLanguageTag() ); } else { LanguageTag aLanguageTag( MsLangId::getConfiguredSystemLanguage() ); - m_pLocaleData.reset( new LocaleDataWrapper( m_rExport.getComponentContext(), std::move(aLanguageTag) ) ); + m_pLocaleData = LocaleDataWrapper::get( std::move(aLanguageTag) ); } m_pUsedList.reset(new SvXMLNumUsedList_Impl); @@ -1780,8 +1778,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt if ( nElemType == NF_KEY_NNNN ) { // write additional text element for separator - m_pLocaleData.reset( new LocaleDataWrapper( m_pFormatter->GetComponentContext(), - LanguageTag( nLang ) ) ); + m_pLocaleData = LocaleDataWrapper::get( LanguageTag( nLang ) ); AddToTextElement_Impl( m_pLocaleData->getLongDateDayOfWeekSep() ); } } diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 110300ac1828..386e48381017 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -65,7 +65,7 @@ struct SvXMLNumFmtEntry class SvXMLNumImpData { SvNumberFormatter* pFormatter; - std::unique_ptr<LocaleDataWrapper> pLocaleData; + const LocaleDataWrapper* pLocaleData { nullptr }; std::vector<SvXMLNumFmtEntry> m_NameEntries; uno::Reference< uno::XComponentContext > m_xContext; @@ -370,9 +370,7 @@ void SvXMLNumImpData::RemoveVolatileFormats() const LocaleDataWrapper& SvXMLNumImpData::GetLocaleData( LanguageType nLang ) { if ( !pLocaleData || pLocaleData->getLanguageTag() != LanguageTag(nLang) ) - pLocaleData = std::make_unique<LocaleDataWrapper>( - pFormatter ? pFormatter->GetComponentContext() : m_xContext, - LanguageTag( nLang ) ); + pLocaleData = LocaleDataWrapper::get( LanguageTag( nLang ) ); return *pLocaleData; } |