core.git: chart2/source
chart2/source/inc/WeakListenerAdapter.hxx | 40 chart2/source/tools/WeakListenerAdapter.cxx |7 2 files changed, 13 insertions(+), 34 deletions(-) New commits: commit d7549a402ddc75bd5b8e3a3a2e3aa98d5be85b36 Author: Noel Grandin AuthorDate: Fri Sep 20 14:33:57 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 21 16:10:28 2024 +0200 no need for a template here it is instantiated only once Change-Id: I0545219a390eb382bcffd3b1a551245f54c47f90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173730 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx index f300f1aa0391..e312f7bee56f 100644 --- a/chart2/source/inc/WeakListenerAdapter.hxx +++ b/chart2/source/inc/WeakListenerAdapter.hxx @@ -38,47 +38,31 @@ namespace chart the same wrapper that you added, i.e., you should store the adapter as a member in the adapted class for later use. */ -template< class Listener > -class WeakListenerAdapter : public -::cppu::WeakImplHelper< Listener > +class WeakSelectionChangeListenerAdapter final : +public ::cppu::WeakImplHelper< css::view::XSelectionChangeListener > { public: -explicit WeakListenerAdapter( const css::uno::Reference< Listener > & xListener ) : -m_xListener( xListener ) -{} +explicit WeakSelectionChangeListenerAdapter( +const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ) +: m_xListener( xListener ) {} +virtual ~WeakSelectionChangeListenerAdapter() override; protected: +// XSelectionChangeListener +virtual void SAL_CALL selectionChanged( +const css::lang::EventObject& aEvent ) override; + // XEventListener (base of all listeners) virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override { -css::uno::Reference< css::lang::XEventListener > xEventListener( - css::uno::Reference< Listener >( m_xListener), css::uno::UNO_QUERY ); +css::uno::Reference< css::view::XSelectionChangeListener > xEventListener( m_xListener ); if( xEventListener.is()) xEventListener->disposing( Source ); } -css::uno::Reference< Listener > getListener() const -{ -return m_xListener; -} - private: -css::uno::WeakReference< Listener > m_xListener; -}; - -class WeakSelectionChangeListenerAdapter final : -public WeakListenerAdapter< css::view::XSelectionChangeListener > -{ -public: -explicit WeakSelectionChangeListenerAdapter( -const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ); -virtual ~WeakSelectionChangeListenerAdapter() override; - -protected: -// XSelectionChangeListener -virtual void SAL_CALL selectionChanged( -const css::lang::EventObject& aEvent ) override; +css::uno::WeakReference< css::view::XSelectionChangeListener > m_xListener; }; } // namespace chart diff --git a/chart2/source/tools/WeakListenerAdapter.cxx b/chart2/source/tools/WeakListenerAdapter.cxx index 16b3d815031c..b456c5bdadf9 100644 --- a/chart2/source/tools/WeakListenerAdapter.cxx +++ b/chart2/source/tools/WeakListenerAdapter.cxx @@ -26,17 +26,12 @@ using ::com::sun::star::uno::Reference; namespace chart { -WeakSelectionChangeListenerAdapter::WeakSelectionChangeListenerAdapter( -const Reference< view::XSelectionChangeListener > & xListener ) : -WeakListenerAdapter< css::view::XSelectionChangeListener >( xListener ) -{} - WeakSelectionChangeListenerAdapter::~WeakSelectionChangeListenerAdapter() {} void SAL_CALL WeakSelectionChangeListenerAdapter::selectionChanged( const lang::EventObject& aEvent ) { -Reference< view::XSelectionChangeListener > xSelChgListener( getListener() ); +Reference< view::XSelectionChangeListener > xSelChgListener( m_xListener ); if( xSelChgListener.is()) xSelChgListener->selectionChanged( aEvent ); }
core.git: sw/inc sw/source
sw/inc/doc.hxx |3 ++ sw/source/core/bastyp/init.cxx |2 - sw/source/core/doc/doc.cxx | 12 + sw/source/filter/xml/xmlexp.cxx | 51 4 files changed, 47 insertions(+), 21 deletions(-) New commits: commit 809808f56bc79c229ca7ce84eb03274271ff1044 Author: Noel Grandin AuthorDate: Fri Sep 20 16:47:23 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 21 13:13:59 2024 +0200 dont use GetItemSurrogates for gathering SvXMLAttrContainerItem which is very expensive these days Change-Id: I1880ae272e422baca7b0540f58c9e8f9c3bb1287 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173732 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 0e16a9607e34..7137078c1571 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1461,6 +1461,9 @@ public: /// Iterate over all RES_PARATR_TABSTOP SvxTabStopItem, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachParaAtrTabStopItem(const std::function& ) const; +/// Iterate over all RES_UNKNOWNATR_CONTAINER SvXMLAttrContainerItem, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachUnknownAtrContainerItem(const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 9c1fb0bb62c5..487484512141 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -457,7 +457,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_BOXATR_FORMAT, new SwTableBoxNumFormat, 0, SFX_ITEMINFOFLAG_NONE }, { RES_BOXATR_FORMULA, new SwTableBoxFormula( OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_BOXATR_VALUE, new SwTableBoxValue, 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_UNKNOWNATR_CONTAINER, new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } +{ RES_UNKNOWNATR_CONTAINER, new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ), 0, SFX_ITEMINFOFLAG_NONE } }}; virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 1f2db1ab6668..15e6a1bf29fe 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1533,6 +1533,18 @@ void SwDoc::ForEachParaAtrTabStopItem(const std::function& rFunc ) const +{ +for(SwFrameFormat* pFormat : *GetFrameFormats()) +{ +const SwAttrSet& rAttrSet = pFormat->GetAttrSet(); +if (const SvXMLAttrContainerItem* pItem = rAttrSet.GetItemIfSet(RES_UNKNOWNATR_CONTAINER)) +if (!rFunc(*pItem)) +return; +} +} + void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 0d9e89979bdf..676317ef869e 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -148,31 +148,42 @@ ErrCode SwXMLExport::exportDoc( enum XMLTokenEnum eClass ) } return true; }); - +pDoc->ForEachUnknownAtrContainerItem([this](const SvXMLAttrContainerItem& rUnknown) -> bool { +if( rUnknown.GetAttrCount() > 0 ) +{ +sal_uInt16 nIdx = rUnknown.GetFirstNamespaceIndex(); +while( USHRT_MAX != nIdx ) +{ +GetNamespaceMap_().Add( rUnknown.GetPrefix( nIdx ), +rUnknown.GetNamespace( nIdx ) ); +nIdx = rUnknown.GetNextNamespaceIndex( nIdx ); +} +} +return true; +}); const SfxItemPool& rPool = pDoc->GetAttrPool(); -sal_uInt16 aWhichIds[4] = { RES_UNKNOWNATR_CONTAINER, -SDRATTR_XMLATTRIBUTES, -EE_PARA_XMLATTRIBS, -EE_CHAR_XMLATTRIBS }; - -const int nWhichIds = rPool.GetSecondaryPool() ? 4 : 1; -for( int j=0; j < nWhichIds; ++j ) +if (rPool.GetSecondaryPool()) { -const sal_uInt16 nWhichId = aWhichIds[j]; -ItemSurrogates aSurrogates; -rPool.GetItemSurrogates(aSurrogates, nWhichId); -for (const SfxPoolItem* pItem : aSurrogates) +sal_uInt16 aWhichIds[3] = { SDRATTR_XMLATTRIBUTES, +EE_PARA_XMLATTRIBS, +EE_CHAR_XMLATTRIBS }; +for( sal_uInt16 nWhichId : aWhichIds ) { -
core.git: sc/source
sc/source/core/data/patattr.cxx | 72 +++- 1 file changed, 14 insertions(+), 58 deletions(-) New commits: commit 944fbe89fd48fa7814c0b33ef22910e8221da9de Author: Noel Grandin AuthorDate: Fri Sep 20 15:39:31 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 20 21:03:32 2024 +0200 tdf#161562 Sluggish scrolling after saving and changing text color This reverts commit eb13c889c760cfe153d5b41188e218bdda797d52. "Speed up scrolling through large document with lots of patterns" Which seems (according to buovjaga testing) to be a pessimisation now. I can't reproduce this either way, so lets just revert it for now. Change-Id: I6b7f95173eb875d215f1192b3a7ca44014c50886 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173641 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index b5814947b906..284759d1b965 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -47,8 +47,6 @@ #include #include #include -#include -#include #include #include #include @@ -1506,66 +1504,24 @@ bool ScPatternAttr::CalcVisible() const return false; } -bool ScPatternAttr::IsVisibleEqual( const ScPatternAttr& rOther ) const +static bool OneEqual( const SfxItemSet& rSet1, const SfxItemSet& rSet2, sal_uInt16 nId ) { -// This method is hot, so we do an optimised comparison here, by -// walking the two itemsets in parallel, avoiding doing repeated searches. -auto IsInterestingWhich = [](sal_uInt16 n) -{ -return n == ATTR_BORDER_TLBR || n == ATTR_BORDER_BLTR || n == ATTR_BACKGROUND - || n == ATTR_BORDER || n == ATTR_SHADOW; -}; -SfxWhichIter aIter1(GetItemSet()); -SfxWhichIter aIter2(rOther.GetItemSet()); -sal_uInt16 nWhich1 = aIter1.FirstWhich(); -sal_uInt16 nWhich2 = aIter2.FirstWhich(); -for (;;) -{ -while (nWhich1 != nWhich2) -{ -SfxWhichIter* pIterToIncrement; -sal_uInt16* pSmallerWhich; -if (nWhich1 == 0 || nWhich1 > nWhich2) -{ -pSmallerWhich = &nWhich2; -pIterToIncrement = &aIter2; -} -else -{ -pSmallerWhich = &nWhich1; -pIterToIncrement = &aIter1; -} - -if (IsInterestingWhich(*pSmallerWhich)) -{ -// the iter with larger which has already passed this point, and has no interesting -// item available in the other - so indeed these are unequal -return false; -} - -*pSmallerWhich = pIterToIncrement->NextWhich(); -} +const SfxPoolItem* pItem1 = &rSet1.Get(nId); +const SfxPoolItem* pItem2 = &rSet2.Get(nId); +return ( pItem1 == pItem2 || *pItem1 == *pItem2 ); +} -// Here nWhich1 == nWhich2 +bool ScPatternAttr::IsVisibleEqual( const ScPatternAttr& rOther ) const +{ +const SfxItemSet& rThisSet = GetItemSet(); +const SfxItemSet& rOtherSet = rOther.GetItemSet(); -if (!nWhich1 /* && !nWhich2*/) -return true; +return OneEqual( rThisSet, rOtherSet, ATTR_BACKGROUND ) && +OneEqual( rThisSet, rOtherSet, ATTR_BORDER ) && +OneEqual( rThisSet, rOtherSet, ATTR_BORDER_TLBR ) && +OneEqual( rThisSet, rOtherSet, ATTR_BORDER_BLTR ) && +OneEqual( rThisSet, rOtherSet, ATTR_SHADOW ); -if (IsInterestingWhich(nWhich1)) -{ -const SfxPoolItem* pItem1 = nullptr; -const SfxPoolItem* pItem2 = nullptr; -SfxItemState state1 = aIter1.GetItemState(true, &pItem1); -SfxItemState state2 = aIter2.GetItemState(true, &pItem2); -if (state1 != state2 -&& (state1 < SfxItemState::DEFAULT || state2 < SfxItemState::DEFAULT)) -return false; -if (!SfxPoolItem::areSame(pItem1, pItem2)) -return false; -} -nWhich1 = aIter1.NextWhich(); -nWhich2 = aIter2.NextWhich(); -} //TODO: also here only check really visible values !!! }
core.git: basic/source
basic/source/classes/sbunoobj.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f65b2049428cda9b65199efdac46577926b1efe7 Author: Noel Grandin AuthorDate: Fri Sep 20 14:27:43 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 20 19:12:27 2024 +0200 no need to do UNO_QUERY here Change-Id: I52d13a7e4806d8fc34c4ff6f4cc5ab1e785a8b76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173729 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index bede3ce759eb..57d262960f31 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -4470,7 +4470,7 @@ void disposeComVariablesForBasic( StarBASIC const * pBasic ) ComponentRefVector& rv = pItem->m_vComImplementsObjects; for (auto const& elem : rv) { -Reference< XComponent > xComponent( elem.get(), UNO_QUERY ); +Reference< XComponent > xComponent( elem ); if (xComponent.is()) xComponent->dispose(); }
core.git: hwpfilter/source reportdesign/inc sd/source svtools/source
hwpfilter/source/hwpreader.cxx|2 - reportdesign/inc/RptObject.hxx|4 ++- sd/source/ui/framework/factories/BasicViewFactory.cxx | 20 +++--- svtools/source/dialogs/ServerDetailsControls.hxx |4 +-- 4 files changed, 14 insertions(+), 16 deletions(-) New commits: commit 66cf2087187651c10293472ae139c366f38cb1a3 Author: Noel Grandin AuthorDate: Fri Sep 20 10:49:36 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 20 12:46:10 2024 +0200 use more concrete UNO types in various Change-Id: Ia28cffdeae8ced2e19dcf695ee5c3417d4f97d64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173698 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 2921ef5ff2f0..6d24faca1ced 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -4744,7 +4744,7 @@ public: virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& rDescriptor ) override; private: -Reference< XFilter > rFilter; +rtl::Reference< HwpReader > rFilter; Reference< XImporter > rImporter; }; diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 5920eb2bc8c2..b5c8c9b239fb 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -34,6 +34,8 @@ namespace rptui { +class OObjectListener; + typedef ::std::multimap< sal_Int16, OUString > IndexToNameMap; enum DlgEdHintKind { @@ -64,7 +66,7 @@ class UNLESS_MERGELIBS_MORE(REPORTDESIGN_DLLPUBLIC) SAL_LOPLUGIN_ANNOTATE("cross { protected: mutable rtl::Reference m_xMediator; -mutable css::uno::Reference< css::beans::XPropertyChangeListener> m_xPropertyChangeListener; +mutable rtl::Reference< OObjectListener > m_xPropertyChangeListener; mutable css::uno::Reference< css::report::XReportComponent> m_xReportComponent; css::uno::Reference< css::uno::XInterface > m_xKeepShapeAlive; OUString m_sComponentName; diff --git a/sd/source/ui/framework/factories/BasicViewFactory.cxx b/sd/source/ui/framework/factories/BasicViewFactory.cxx index 20cb7ed6df2f..c9f06e6593d6 100644 --- a/sd/source/ui/framework/factories/BasicViewFactory.cxx +++ b/sd/source/ui/framework/factories/BasicViewFactory.cxx @@ -57,7 +57,7 @@ namespace sd::framework { class BasicViewFactory::ViewDescriptor { public: -Reference mxView; +rtl::Reference mxView; std::shared_ptr mpViewShell; Reference mxViewId; static bool CompareView (const std::shared_ptr& rpDescriptor, @@ -386,11 +386,10 @@ void BasicViewFactory::ReleaseView ( if (bIsCacheable) { -Reference xResource (rpDescriptor->mxView, UNO_QUERY); -if (xResource.is()) +if (rpDescriptor->mxView) { if (mxLocalPane.is()) -if (xResource->relocateToAnchor(mxLocalPane)) +if (rpDescriptor->mxView->relocateToAnchor(mxLocalPane)) mpViewCache->push_back(rpDescriptor); else bIsCacheable = false; @@ -410,9 +409,8 @@ void BasicViewFactory::ReleaseView ( mpBase->GetDocShell()->Disconnect(rpDescriptor->mpViewShell.get()); mpBase->GetViewShellManager()->DeactivateViewShell(rpDescriptor->mpViewShell.get()); -Reference xComponent (rpDescriptor->mxView, UNO_QUERY); -if (xComponent.is()) -xComponent->dispose(); +if (rpDescriptor->mxView) +rpDescriptor->mxView->dispose(); } } @@ -420,8 +418,7 @@ bool BasicViewFactory::IsCacheable (const std::shared_ptr& rpDes { bool bIsCacheable (false); -Reference xResource (rpDescriptor->mxView, UNO_QUERY); -if (xResource.is()) +if (rpDescriptor->mxView) { static ::std::vector > s_aCacheableResources = [&]() { @@ -463,10 +460,9 @@ std::shared_ptr BasicViewFactory::GetViewFromC if (pDescriptor != nullptr) { bool bRelocationSuccessful (false); -Reference xResource (pDescriptor->mxView, UNO_QUERY); -if (xResource.is() && rxPane.is()) +if (pDescriptor->mxView && rxPane.is()) { -if (xResource->relocateToAnchor(rxPane)) +if (pDescriptor->mxView->relocateToAnchor(rxPane)) bRelocationSuccessful = true; } diff --git a/svtools/source/dialogs/ServerDetailsControls.hxx b/svtools/source/dialogs/ServerDetailsControls.hxx index 186125e555bb..ddca70807d77 100644 --- a/svtools/source/dialogs/ServerDetailsControls.hxx +++ b/svtools/source/dialogs/ServerDetailsControls.hxx @@ -12,7 +12,7 @@ #include #include - +#include #include #include #include @@ -118,7 +118,7 @@ class CmisDetailsContainer final : public DetailsContainer private: OUString m_s
core.git: 2 commits - sw/inc sw/source
sw/inc/doc.hxx |6 ++ sw/source/core/bastyp/init.cxx |4 ++-- sw/source/core/doc/doc.cxx | 39 +++ sw/source/core/doc/docfmt.cxx |9 +++-- sw/source/filter/xml/xmlexp.cxx | 19 --- 5 files changed, 66 insertions(+), 11 deletions(-) New commits: commit 01ab23b13297c9d7b091dfbe2850cd343fcd3e0e Author: Noel Grandin AuthorDate: Thu Sep 19 19:53:53 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 20 07:52:02 2024 +0200 dont use GetItemSurrogates for gathering SvxTabStopItem which is very expensive these days Change-Id: Iae80c9d677fd1db8606a6a3f9462fe16b110a540 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173682 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index c11f23dcf6f6..0e16a9607e34 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1458,6 +1458,9 @@ public: /// Iterate over all RES_TXTATR_UNKNOWN_CONTAINER SvXMLAttrContainerItem, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachTxtAtrContainerItem(const std::function& ) const; +/// Iterate over all RES_PARATR_TABSTOP SvxTabStopItem, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachParaAtrTabStopItem(const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index b5b409705f1a..9c1fb0bb62c5 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -358,7 +358,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_PARATR_SPLIT, new SvxFormatSplitItem( true, RES_PARATR_SPLIT ), SID_ATTR_PARA_SPLIT, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_ORPHANS, new SvxOrphansItem( 0, RES_PARATR_ORPHANS ), SID_ATTR_PARA_ORPHANS, SFX_ITEMINFOFLAG_NONE }, { RES_PARATR_WIDOWS, new SvxWidowsItem( 0, RES_PARATR_WIDOWS ), SID_ATTR_PARA_WIDOWS, SFX_ITEMINFOFLAG_NONE }, -{ RES_PARATR_TABSTOP, new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SvxTabAdjust::Default, RES_PARATR_TABSTOP ), SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_PARATR_TABSTOP, new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SvxTabAdjust::Default, RES_PARATR_TABSTOP ), SID_ATTR_TABSTOP, SFX_ITEMINFOFLAG_NONE }, // for this at the Item GetMaxHyphens() = 0 was called, do this now on-demand at construction time // it will get added in constructor below once for LO runtime as static default diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2be295986df3..1f2db1ab6668 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1521,6 +1521,18 @@ void SwDoc::ForEachTxtAtrContainerItem(const std::function& rFunc ) const +{ +for(SwCharFormat* pFormat : *GetCharFormats()) +{ +const SwAttrSet& rAttrSet = pFormat->GetAttrSet(); +if (const SvxTabStopItem* pItem = rAttrSet.GetItemIfSet(RES_PARATR_TABSTOP)) +if (!rFunc(*pItem)) +return; +} +} + void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 75ccf557810e..b7f8d4ba7791 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -636,18 +636,15 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos(); bool bChg = false; -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurrogates, RES_PARATR_TABSTOP); -for (const SfxPoolItem* pItem2 : aSurrogates) -{ +ForEachParaAtrTabStopItem([&bChg, &nOldWidth, &nNewWidth](const SvxTabStopItem& rTabStopItem) -> bool { // pItem2 and thus pTabStopItem is a evtl. shared & RefCounted // Item and *should* not be changed that way. lcl_SetNewDefTabStops // seems to change pTabStopItem (!). This may need to be changed // to use iterateItemSurrogates and a defined write cycle. -const auto & rTabStopItem = static_cast(*pItem2); bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth, const_cast(rTabStopItem) ); -} +return true; +}); aNew.ClearItem( RES_PARATR_TABSTOP ); aOld.ClearItem( RES_PARATR_TABSTOP ); commit 1442dc4ee12251eed04e51eb324a34dc4b7973c3 Author: Noel Grandin AuthorDate: Thu Sep 19 19:11:52 2024 +0200 Commit: Noel Grandin CommitDate: Fri
core.git: include/i18nlangtag include/o3tl
include/i18nlangtag/lang.h |3 +++ include/o3tl/strong_int.hxx |9 + 2 files changed, 12 insertions(+) New commits: commit 7db1150b2c4a9adb993084d2dceedb450781b1dc Author: Noel Grandin AuthorDate: Thu Sep 19 08:46:50 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 19 17:54:32 2024 +0200 fix macos build with clang 16 Undefined symbols for architecture arm64: "o3tl::strong_int::strong_int(int, std::__1::enable_if::value, int>::type)", referenced from: sfx2::(anonymous namespace)::SvxInternalLink::Connect(sfx2::SvBaseLink*) in linkmgr2.o SfxHTMLParser::GetTableDataOptionsValNum(unsigned int&, o3tl::strong_int&, rtl::OUString const&, std::__1::basic_string_view>, SvNumberFormatter&) in sfxhtml.o SfxHTMLParser::GetTableDataOptionsValNum(unsigned int&, o3tl::strong_int&, rtl::OUString const&, std::__1::basic_string_view>, SvNumberFormatter&) in sfxhtml.o SfxHTMLParser::GetTableDataOptionsValNum(unsigned int&, o3tl::strong_int&, rtl::OUString const&, std::__1::basic_string_view>, SvNumberFormatter&) in sfxhtml.o SfxHTMLParser::GetTableDataOptionsValNum(unsigned int&, o3tl::strong_int&, rtl::OUString const&, std::__1::basic_string_view>, SvNumberFormatter&) in sfxhtml.o ld: symbol(s) not found for architecture arm64 clang++: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: *** [/Users/noelgrandin/lode/dev/core/sfx2/Library_sfx.mk:20: /Users/noelgrandin/lode/dev/core/instdir/LibreOfficeDev.app/Contents/Frameworks/libsfxlo.dylib] Error 1 make[1]: Target 'build' not remade because of errors. make: *** [Makefile:296: build] Error 2 Change-Id: Ia8c338a89156e18a1c96630ecad2bccbba7bb745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173652 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h index c9870969c6a9..1bd03fb51c98 100644 --- a/include/i18nlangtag/lang.h +++ b/include/i18nlangtag/lang.h @@ -90,10 +90,13 @@ constexpr LanguageType primary(LanguageType lt) { return LanguageType(sal_uInt16 namespace o3tl { +// when compiling LO on macOS, debug builds will display a linking error +#if !(defined MACOSX && defined __clang__ && __clang_major__ == 16) // delete "sal_Int16" constructor via specialization: values > 0x7FFF are // actually used, and unfortunately passed around in the API as signed // "short", so use this to find all places where casts must be inserted template<> template<> constexpr strong_int::strong_int(short, std::enable_if::value, int>::type) = delete; +#endif } #define LANGUAGE_MASK_PRIMARY 0x03ff diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx index fd7a9abb9c52..aea775805bda 100644 --- a/include/o3tl/strong_int.hxx +++ b/include/o3tl/strong_int.hxx @@ -84,6 +84,14 @@ template struct strong_int { public: +// when compiling LO on macOS, debug builds will display a linking error +#if defined MACOSX && defined __clang__ && __clang_major__ == 16 +explicit constexpr strong_int(unsigned long long value) : m_value(value) {} +explicit constexpr strong_int(unsigned long value) : m_value(value) {} +explicit constexpr strong_int(long value) : m_value(value) {} +explicit constexpr strong_int(int value) : m_value(value) {} +explicit constexpr strong_int(unsigned int value) : m_value(value) {} +#else template explicit constexpr strong_int( T value, typename std::enable_if::value, int>::type = 0): @@ -95,6 +103,7 @@ public: && "out of range"); #endif } +#endif strong_int() : m_value(0) {} explicit constexpr operator UNDERLYING_TYPE() const { return m_value; }
core.git: slideshow/source
slideshow/source/engine/slideview.cxx | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) New commits: commit a386837e4ea4a15609623916df5217e572480598 Author: Noel Grandin AuthorDate: Mon Sep 16 12:10:52 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 19 08:01:06 2024 +0200 use more concrete UNO types in WeakRefWrapper Change-Id: I5805a681833003c01b5c06c4719606cb27ab600c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173608 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx index 5c5758bb2831..8582918b2c4b 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -1018,23 +1019,21 @@ void SlideView::disposing( lang::EventObject const& evt ) // silly wrapper to check that event handlers don't touch dead SlideView struct WeakRefWrapper { -SlideView & m_rObj; -uno::WeakReference const m_wObj; +unotools::WeakReference const m_wObj; std::function const m_func; WeakRefWrapper(SlideView & rObj, std::function func) -: m_rObj(rObj) -, m_wObj(rObj.getXWeak()) +: m_wObj(&rObj) , m_func(std::move(func)) { } void operator()() { -uno::Reference const xObj(m_wObj); +rtl::Reference const xObj(m_wObj); if (xObj.is()) { -m_func(m_rObj); +m_func(*xObj); } } };
core.git: 2 commits - sc/inc sc/source
sc/inc/textuno.hxx |9 + sc/source/core/data/attarray.cxx |9 + sc/source/ui/unoobj/fielduno.cxx |9 - sc/source/ui/unoobj/textuno.cxx | 21 + 4 files changed, 23 insertions(+), 25 deletions(-) New commits: commit 5fdc026250c9d691730e2062a7b5e2d5a6a81575 Author: Noel Grandin AuthorDate: Wed Sep 18 12:42:14 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 19 08:00:56 2024 +0200 use more concrete UNO types in sc Change-Id: I5b70733fb5be0a4f9a51e48197454ff0452770bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173611 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx index e5ec1aca0cad..87faca864992 100644 --- a/sc/inc/textuno.hxx +++ b/sc/inc/textuno.hxx @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -96,7 +97,7 @@ class ScHeaderFooterTextData { private: std::unique_ptr mpTextObj; -css::uno::WeakReference xContentObj; +unotools::WeakReference xContentObj; ScHeaderFooterPart nPart; std::unique_ptr pEditEngine; std::unique_ptr pForwarder; @@ -106,7 +107,7 @@ public: ScHeaderFooterTextData(const ScHeaderFooterTextData&) = delete; const ScHeaderFooterTextData& operator=(const ScHeaderFooterTextData&) = delete; ScHeaderFooterTextData( -css::uno::WeakReference xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); +unotools::WeakReference xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); ~ScHeaderFooterTextData(); // helper functions @@ -116,7 +117,7 @@ public: ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine.get(); } ScHeaderFooterPart GetPart() const { return nPart; } -css::uno::Reference GetContentObj() const { return xContentObj; } +rtl::Reference GetContentObj() const { return xContentObj; } const EditTextObject* GetTextObject() const { return mpTextObj.get(); } }; @@ -142,7 +143,7 @@ private: public: ScHeaderFooterTextObj( -const css::uno::WeakReference& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); +const unotools::WeakReference& xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj); virtual ~ScHeaderFooterTextObj() override; const EditTextObject* GetTextObject() const; diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index e14cfaa4cfcb..700cb97d4492 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -449,23 +449,22 @@ uno::Reference ScHeaderFieldsObj::GetObjectByIndex_Impl(sal_In // Get the parent text range instance. uno::Reference xTextRange; -uno::Reference xContentObj = mrData.GetContentObj(); +rtl::Reference xContentObj = mrData.GetContentObj(); if (!xContentObj.is()) throw uno::RuntimeException(u""_ustr); -rtl::Reference pContentObj = ScHeaderFooterContentObj::getImplementation(xContentObj); uno::Reference xText; switch ( mrData.GetPart() ) { case ScHeaderFooterPart::LEFT: -xText = pContentObj->getLeftText(); +xText = xContentObj->getLeftText(); break; case ScHeaderFooterPart::CENTER: -xText = pContentObj->getCenterText(); +xText = xContentObj->getCenterText(); break; case ScHeaderFooterPart::RIGHT: -xText = pContentObj->getRightText(); +xText = xContentObj->getRightText(); break; } diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx index 45deb7d9bb4a..30b67d411f9f 100644 --- a/sc/source/ui/unoobj/textuno.cxx +++ b/sc/source/ui/unoobj/textuno.cxx @@ -137,14 +137,13 @@ void ScHeaderFooterContentObj::Init( const EditTextObject* pLeft, const EditTextObject* pCenter, const EditTextObject* pRight ) { -uno::Reference xThis(this); -mxLeftText = rtl::Reference(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::LEFT, pLeft)); -mxCenterText = rtl::Reference(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::CENTER, pCenter)); -mxRightText = rtl::Reference(new ScHeaderFooterTextObj(xThis, ScHeaderFooterPart::RIGHT, pRight)); +mxLeftText = rtl::Reference(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::LEFT, pLeft)); +mxCenterText = rtl::Reference(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::CENTER, pCenter)); +mxRightText = rtl::Reference(new ScHeaderFooterTextObj(this, ScHeaderFooterPart::RIGHT, pRight)); } ScHeaderFooterTextData::ScHeaderFooterTextData( -uno::WeakReference xContent, ScHeaderFooterPart nP, const EditTextObject* pTextObj) : +unotools::WeakReference xContent, ScHead
core.git: sd/source
sd/source/console/PresenterPaneFactory.cxx | 15 --- sd/source/console/PresenterPaneFactory.hxx |4 +++- sd/source/console/PresenterScreen.cxx | 14 +++--- sd/source/console/PresenterScreen.hxx |4 +++- sd/source/ui/inc/DrawController.hxx|2 +- sd/source/ui/inc/framework/ConfigurationController.hxx |3 ++- 6 files changed, 24 insertions(+), 18 deletions(-) New commits: commit b97b725312767dc5baf0a80c00c2ceda0f8dfa57 Author: Noel Grandin AuthorDate: Wed Sep 18 12:27:24 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 21:33:39 2024 +0200 use more concrete UNO types in sd Change-Id: If731da0f4839dc98b0dab1fa61669b92d5cc70f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173610 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sd/source/console/PresenterPaneFactory.cxx b/sd/source/console/PresenterPaneFactory.cxx index 5001bdec3ca3..22626286637b 100644 --- a/sd/source/console/PresenterPaneFactory.cxx +++ b/sd/source/console/PresenterPaneFactory.cxx @@ -24,6 +24,7 @@ #include "PresenterPaneContainer.hxx" #include "PresenterSpritePane.hxx" #include +#include #include #include @@ -58,12 +59,12 @@ PresenterPaneFactory::PresenterPaneFactory ( void PresenterPaneFactory::Register (const rtl::Reference<::sd::DrawController>& rxController) { -Reference xCC; +rtl::Reference<::sd::framework::ConfigurationController> xCC; try { // Get the configuration controller. -xCC.set(rxController->getConfigurationController()); -mxConfigurationControllerWeak = xCC; +xCC = rxController->getConfigurationControllerImpl(); +mxConfigurationControllerWeak = xCC.get(); if ( ! xCC.is()) { throw RuntimeException(); @@ -77,7 +78,7 @@ void PresenterPaneFactory::Register (const rtl::Reference<::sd::DrawController>& OSL_ASSERT(false); if (xCC.is()) xCC->removeResourceFactoryForReference(this); -mxConfigurationControllerWeak = WeakReference(); +mxConfigurationControllerWeak.clear(); throw; } @@ -89,10 +90,10 @@ PresenterPaneFactory::~PresenterPaneFactory() void SAL_CALL PresenterPaneFactory::disposing() { -Reference xCC (mxConfigurationControllerWeak); +rtl::Reference<::sd::framework::ConfigurationController> xCC (mxConfigurationControllerWeak); if (xCC.is()) xCC->removeResourceFactoryForReference(this); -mxConfigurationControllerWeak = WeakReference(); +mxConfigurationControllerWeak.clear(); // Dispose the panes in the cache. if (mpResourceCache != nullptr) @@ -190,7 +191,7 @@ Reference PresenterPaneFactory::CreatePane ( if ( ! rxPaneId.is()) return nullptr; -Reference xCC (mxConfigurationControllerWeak); +rtl::Reference<::sd::framework::ConfigurationController> xCC (mxConfigurationControllerWeak); if ( ! xCC.is()) return nullptr; diff --git a/sd/source/console/PresenterPaneFactory.hxx b/sd/source/console/PresenterPaneFactory.hxx index 1145cd5327af..3b00ae505dd8 100644 --- a/sd/source/console/PresenterPaneFactory.hxx +++ b/sd/source/console/PresenterPaneFactory.hxx @@ -28,10 +28,12 @@ #include #include #include +#include #include #include namespace sd { class DrawController; } +namespace sd::framework { class ConfigurationController; } namespace sdext::presenter { @@ -88,7 +90,7 @@ public: private: css::uno::WeakReference mxComponentContextWeak; -css::uno::WeakReference +unotools::WeakReference mxConfigurationControllerWeak; ::rtl::Reference mpPresenterController; typedef ::std::map > diff --git a/sd/source/console/PresenterScreen.cxx b/sd/source/console/PresenterScreen.cxx index 2b9b4bf2e5e7..ab46c2988c8a 100644 --- a/sd/source/console/PresenterScreen.cxx +++ b/sd/source/console/PresenterScreen.cxx @@ -27,6 +27,7 @@ #include "PresenterViewFactory.hxx" #include "PresenterWindowManager.hxx" #include +#include #include #include #include @@ -257,7 +258,6 @@ PresenterScreen::PresenterScreen ( : PresenterScreenInterfaceBase(m_aMutex) , mxModel(std::move(xModel)) , mxController() -, mxConfigurationControllerWeak() , mxContextWeak(rxContext) , mpPresenterController() , mxSavedConfiguration() @@ -298,12 +298,12 @@ bool PresenterScreen::isPresenterScreenFullScreen(const css::uno::Reference xCC (mxConfigurationControllerWeak); +rtl::Reference<::sd::framework::ConfigurationController> xCC (mxConfigurationControllerWeak); if (xCC.is() && mxSavedConfiguration.is()) { xCC->restoreConfiguration(mxSavedConfiguration); } -mxConfigurationControllerWeak = Reference(nullptr); +mxConfigurationControllerWeak.clear(); Reference xViewFactoryComponent (mxViewFactory, UNO_QUERY); if (xViewFactoryComponent.is()) @@ -35
core.git: 2 commits - sd/source
sd/source/ui/framework/factories/BasicPaneFactory.cxx | 11 - sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx |5 sd/source/ui/inc/unomodel.hxx | 19 ++- sd/source/ui/unoidl/unocpres.hxx |2 sd/source/ui/unoidl/unomodel.cxx | 88 ++ 5 files changed, 62 insertions(+), 63 deletions(-) New commits: commit b09c52542fc431ff9e31e5bc1d24623c6bf42ac9 Author: Noel Grandin AuthorDate: Wed Sep 18 12:15:53 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 21:33:28 2024 +0200 use more concrete UNO types in sd Change-Id: I60977cf7e0690b8a01daa2fe6700e89c8a29516b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173609 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sd/source/ui/framework/factories/BasicPaneFactory.cxx b/sd/source/ui/framework/factories/BasicPaneFactory.cxx index 0d32c1831e76..62a42f2ec2b0 100644 --- a/sd/source/ui/framework/factories/BasicPaneFactory.cxx +++ b/sd/source/ui/framework/factories/BasicPaneFactory.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -96,8 +97,8 @@ BasicPaneFactory::BasicPaneFactory ( // Tunnel through the controller to obtain access to the ViewShellBase. mpViewShellBase = rxController->GetViewShellBase(); -Reference xCC (rxController->getConfigurationController()); -mxConfigurationControllerWeak = xCC; +rtl::Reference xCC (rxController->getConfigurationControllerImpl()); +mxConfigurationControllerWeak = xCC.get(); // Add pane factories for the two left panes (one for Impress and one for // Draw) and the center pane. @@ -146,7 +147,7 @@ BasicPaneFactory::BasicPaneFactory ( } catch (RuntimeException&) { -Reference xCC (mxConfigurationControllerWeak); +rtl::Reference xCC (mxConfigurationControllerWeak); if (xCC.is()) xCC->removeResourceFactoryForReference(this); } @@ -158,7 +159,7 @@ BasicPaneFactory::~BasicPaneFactory() void BasicPaneFactory::disposing(std::unique_lock&) { -Reference xCC (mxConfigurationControllerWeak); +rtl::Reference xCC (mxConfigurationControllerWeak); if (xCC.is()) { xCC->removeResourceFactoryForReference(this); @@ -310,7 +311,7 @@ void SAL_CALL BasicPaneFactory::notifyConfigurationChange ( void SAL_CALL BasicPaneFactory::disposing ( const lang::EventObject& rEventObject) { -if (mxConfigurationControllerWeak.get() == rEventObject.Source) +if (uno::Reference(cppu::getXWeak(mxConfigurationControllerWeak.get().get())) == rEventObject.Source) { mxConfigurationControllerWeak.clear(); } diff --git a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx index 57395f196bf4..ef97cff00984 100644 --- a/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx +++ b/sd/source/ui/inc/framework/factories/BasicPaneFactory.hxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -37,6 +37,7 @@ class ViewShellBase; } namespace sd::framework { +class ConfigurationController; typedef comphelper::WeakComponentImplHelper < css::drawing::framework::XResourceFactory, @@ -85,7 +86,7 @@ public: private: css::uno::Reference mxComponentContext; -css::uno::WeakReference +unotools::WeakReference mxConfigurationControllerWeak; ViewShellBase* mpViewShellBase; class PaneDescriptor; commit ff632abcc3e907304c31c5bd8bbd7c7d4e38d2ab Author: Noel Grandin AuthorDate: Wed Sep 18 11:49:00 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 21:33:19 2024 +0200 use more concrete UNO types in sd Change-Id: I1176da07dae2ac510ac4acf310ce3e4d499573d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173607 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index da857eebaef3..02f1ee19ceb7 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -52,6 +53,12 @@ namespace com::sun::star::presentation { class XPresentation; } class SdDrawDocument; class SdPage; class SvxItemPropertySet; +class SdUnoForbiddenCharsTable; +class SdDrawPagesAccess; +class SdMasterPagesAccess; +class SdLayerManager; +class SdXCustomPresentationAccess; +class SdDocLinkTargets; namespace sd { class DrawDocShell; @@ -96,12 +103,12 @@ private: const bool mbImpressDoc; bool mbClipBoard; -css::uno::WeakReference< css::drawing::XDrawPages > mxDrawPagesAccess; -css::uno::WeakReference< css::drawing::XDrawPages > mxMasterPagesAccess; -css::uno::WeakReference< css::container::XNameAccess > mxLayerManager; -css::uno::Wea
core.git: 2 commits - sd/source
sd/source/ui/inc/DrawController.hxx |2 + sd/source/ui/tools/EventMultiplexer.cxx | 24 ++- sd/source/ui/unoidl/DrawController.cxx |8 + sd/source/ui/unoidl/unolayer.cxx| 50 +--- sd/source/ui/unoidl/unolayer.hxx|2 - sd/source/ui/unoidl/unowcntr.cxx| 25 sd/source/ui/unoidl/unowcntr.hxx| 14 7 files changed, 49 insertions(+), 76 deletions(-) New commits: commit 77a58b5f7c85e8036606791ee6fe2fb763eaab0d Author: Noel Grandin AuthorDate: Wed Sep 18 11:08:14 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 21:33:11 2024 +0200 use more concrete UNO types in sd Change-Id: I07e1db5a771c0a2391afbd715c91ea5919e19ac0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173606 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sd/source/ui/inc/DrawController.hxx b/sd/source/ui/inc/DrawController.hxx index c935888fa92c..f856df0d00b2 100644 --- a/sd/source/ui/inc/DrawController.hxx +++ b/sd/source/ui/inc/DrawController.hxx @@ -223,6 +223,8 @@ public: virtual css::uno::Reference SAL_CALL getModuleController() override; +rtl::Reference getConfigurationControllerImpl(); + private: /** This method must return the name to index table. This table contains all property names and types of this object. diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 5e20b9cc1f33..20f3b6e5e518 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -122,7 +123,7 @@ private: css::uno::WeakReference mxControllerWeak; css::uno::WeakReference mxFrameWeak; SdDrawDocument* mpDocument; -css::uno::WeakReference +unotools::WeakReference mxConfigurationControllerWeak; void ReleaseListeners(); @@ -214,15 +215,13 @@ EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase) // Listen for configuration changes. DrawController& rDrawController = *mrBase.GetDrawController(); -Reference xConfigurationController ( -rDrawController.getConfigurationController()); -mxConfigurationControllerWeak = xConfigurationController; +rtl::Reference xConfigurationController ( +rDrawController.getConfigurationControllerImpl()); +mxConfigurationControllerWeak = xConfigurationController.get(); if (!xConfigurationController.is()) return; -Reference xComponent (xConfigurationController, UNO_QUERY); -if (xComponent.is()) - xComponent->addEventListener(static_cast(this)); + xConfigurationController->addEventListener(static_cast(this)); xConfigurationController->addConfigurationChangeListener( this, @@ -268,13 +267,10 @@ void EventMultiplexer::Implementation::ReleaseListeners() } // Stop listening for configuration changes. -Reference xConfigurationController (mxConfigurationControllerWeak); +rtl::Reference xConfigurationController (mxConfigurationControllerWeak.get()); if (xConfigurationController.is()) { -Reference xComponent (xConfigurationController, UNO_QUERY); -if (xComponent.is()) - xComponent->removeEventListener(static_cast(this)); - + xConfigurationController->removeEventListener(static_cast(this)); xConfigurationController->removeConfigurationChangeListener(this); } } @@ -418,10 +414,10 @@ void SAL_CALL EventMultiplexer::Implementation::disposing ( } } -Reference xConfigurationController ( +rtl::Reference xConfigurationController ( mxConfigurationControllerWeak); if (xConfigurationController.is() -&& rEventObject.Source == xConfigurationController) +&& rEventObject.Source == cppu::getXWeak(xConfigurationController.get())) { mxConfigurationControllerWeak.clear(); } diff --git a/sd/source/ui/unoidl/DrawController.cxx b/sd/source/ui/unoidl/DrawController.cxx index 813b07477076..d35578616777 100644 --- a/sd/source/ui/unoidl/DrawController.cxx +++ b/sd/source/ui/unoidl/DrawController.cxx @@ -561,6 +561,14 @@ Reference SAL_CALL return mxConfigurationController; } +rtl::Reference +DrawController::getConfigurationControllerImpl() +{ +ThrowIfDisposed(); + +return mxConfigurationController; +} + Reference SAL_CALL DrawController::getModuleController() { commit 20c7dd09f2485838a0d230efe0a1c36d5b22723f Author: Noel Grandin AuthorDate: Wed Sep 18 11:01:11 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 21:33:03 2024 +0200 use more concrete UNO types in sd Change-Id: I01e30ca54b909da84c3bf535842d2c2283c31451 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173605 Reviewed-by: Noel Grandin Tested-by: Jenkins diff
core.git: basctl/source basic/source
basctl/source/basicide/basidesh.cxx | 14 ++ basctl/source/inc/basidesh.hxx |3 ++- basctl/source/inc/dlgedobj.hxx |8 basic/source/basmgr/basmgr.cxx |2 +- 4 files changed, 13 insertions(+), 14 deletions(-) New commits: commit f48c9d59cc1799d7eb1523af9e3b2df147676d22 Author: Noel Grandin AuthorDate: Wed Sep 18 08:20:19 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 15:02:58 2024 +0200 use more concrete UNO in basic Change-Id: I6606008d9b45e00295cf441a7321a677d62317f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173581 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 4cff365345f7..ef3e89a78f8f 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -262,8 +262,8 @@ Shell::~Shell() aWindowTable.clear(); // Destroy all ContainerListeners for Basic Container. -if (ContainerListenerImpl* pListener = static_cast(m_xLibListener.get())) -pListener->removeContainerListener(m_aCurDocument, m_aCurLibName); +if (m_xLibListener) +m_xLibListener->removeContainerListener(m_aCurDocument, m_aCurLibName); GetExtraData()->ShellInCriticalSection() = false; @@ -940,16 +940,14 @@ void Shell::SetCurLib( const ScriptDocument& rDocument, const OUString& aLibName if ( bCheck && rDocument == m_aCurDocument && aLibName == m_aCurLibName ) return; -ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() ); - -if (pListener) -pListener->removeContainerListener(m_aCurDocument, m_aCurLibName); +if (m_xLibListener) +m_xLibListener->removeContainerListener(m_aCurDocument, m_aCurLibName); m_aCurDocument = rDocument; m_aCurLibName = aLibName; -if ( pListener ) -pListener->addContainerListener( m_aCurDocument, aLibName ); +if ( m_xLibListener ) +m_xLibListener->addContainerListener( m_aCurDocument, aLibName ); if ( bUpdateWindows ) UpdateWindows(); diff --git a/basctl/source/inc/basidesh.hxx b/basctl/source/inc/basidesh.hxx index 8b0aaea0c7c5..3bf3abaa1a05 100644 --- a/basctl/source/inc/basidesh.hxx +++ b/basctl/source/inc/basidesh.hxx @@ -55,6 +55,7 @@ class TabBar; class BaseWindow; class LocalizationMgr; class BasicColorConfig; +class ContainerListenerImpl; class Shell : public SfxViewShell, @@ -98,7 +99,7 @@ private: DocumentEventNotifier m_aNotifier; friend class ContainerListenerImpl; -css::uno::Reference< css::container::XContainerListener > m_xLibListener; +rtl::Reference m_xLibListener; std::unique_ptr mpSearchItem; voidInit(); diff --git a/basctl/source/inc/dlgedobj.hxx b/basctl/source/inc/dlgedobj.hxx index a8c249adec16..7e9e396668b7 100644 --- a/basctl/source/inc/dlgedobj.hxx +++ b/basctl/source/inc/dlgedobj.hxx @@ -33,10 +33,10 @@ namespace basctl typedef std::multimap< sal_Int16, OUString > IndexToNameMap; - class DlgEdForm; class DlgEditor; - +class DlgEdEvtContListenerImpl; +class DlgEdPropListenerImpl; // DlgEdObj @@ -51,8 +51,8 @@ class DlgEdObj: public SdrUnoObj private: boolbIsListening; rtl::Reference pDlgEdForm; -css::uno::Reference< css::beans::XPropertyChangeListener> m_xPropertyChangeListener; -css::uno::Reference< css::container::XContainerListener> m_xContainerListener; +rtl::Reference m_xPropertyChangeListener; +rtl::Reference m_xContainerListener; private: DlgEditor& GetDialogEditor (); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 985f66e0f3f2..17e5d1760bbc 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -2045,7 +2045,7 @@ typedef WeakImplHelper< script::XStarBasicAccess > StarBasicAccessHelper; class StarBasicAccess_Impl : public StarBasicAccessHelper { BasicManager* mpMgr; -uno::Reference< container::XNameContainer > mxLibContainer; +rtl::Reference< LibraryContainer_Impl > mxLibContainer; public: explicit StarBasicAccess_Impl( BasicManager* pMgr )
core.git: extensions/source
extensions/source/propctrlr/taborder.cxx |4 ++-- extensions/source/propctrlr/taborder.hxx |4 +++- extensions/source/scanner/scanunx.cxx|2 +- 3 files changed, 6 insertions(+), 4 deletions(-) New commits: commit 7f445e42b6148c37c9de9180d1f192f585061479 Author: Noel Grandin AuthorDate: Wed Sep 18 08:20:31 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 12:40:04 2024 +0200 use more concrete UNO in extensions Change-Id: I67215b2b5ae03cf3c93915a7590b645914b505de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173582 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index 358b2818fc12..42a375c70238 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -79,6 +79,8 @@ namespace pcr return sImageId; } +} + //= OSimpleTabModel class OSimpleTabModel : public ::cppu::WeakImplHelper< XTabControllerModel> @@ -102,8 +104,6 @@ namespace pcr virtual void SAL_CALL setGroupControl(sal_Bool /*GroupControl*/) override {}; }; -} - //= TabOrderDialog TabOrderDialog::TabOrderDialog(weld::Window* _pParent, const Reference< XTabControllerModel >& _rxTabModel, const Reference< XControlContainer >& _rxControlCont, const Reference< XComponentContext >& _rxORB) diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx index e43f010e8282..e512cf8e9a90 100644 --- a/extensions/source/propctrlr/taborder.hxx +++ b/extensions/source/propctrlr/taborder.hxx @@ -27,10 +27,12 @@ namespace pcr { +class OSimpleTabModel; + //= TabOrderDialog class TabOrderDialog : public weld::GenericDialogController { -css::uno::Reference< css::awt::XTabControllerModel > +rtl::Reference< OSimpleTabModel > m_xTempModel; css::uno::Reference< css::awt::XTabControllerModel > m_xModel; diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index c2bbca99c982..f3402d33804b 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -83,7 +83,7 @@ namespace { struct SaneHolder { Sanem_aSane; -Reference< css::awt::XBitmap > m_xBitmap; +rtl::Reference< BitmapTransporter > m_xBitmap; osl::Mutex m_aProtector; ScanError m_nError; boolm_bBusy;
core.git: sw/inc sw/source
sw/inc/doc.hxx |3 +++ sw/source/core/bastyp/init.cxx |2 +- sw/source/core/doc/doc.cxx | 21 + sw/source/filter/ww8/rtfexport.cxx | 21 - 4 files changed, 41 insertions(+), 6 deletions(-) New commits: commit b6a5cdc0f753c8ed6ed080f9189ac2e2601dce9d Author: Noel Grandin AuthorDate: Tue Sep 17 20:19:06 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 09:24:18 2024 +0200 dont use GetItemSurrogates for gathering SvxBrushItem which is very expensive these days Change-Id: I010d174fbd256da0b220e13cbc50d9b4d8c6b1bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173576 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 9b6e56db50d9..1f5ec0e53094 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1449,6 +1449,9 @@ public: /// Iterate over all RES_CHRATR_UNDERLINE SvxUnderlineItem, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachCharacterUnderlineItem(const std::function& ) const; +/// Iterate over all RES_CHRATR_BACKGROUND SvxBrushItem, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachCharacterBrushItem(const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index daca2f32d7c4..0920842909e4 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -297,7 +297,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_BLINK, new SvxBlinkItem( false, RES_CHRATR_BLINK ), SID_ATTR_FLASH, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_NOHYPHEN, new SvxNoHyphenItem( false, RES_CHRATR_NOHYPHEN ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_UNUSED2, new SfxVoidItem( RES_CHRATR_UNUSED2 ), 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_CHRATR_BACKGROUND, new SvxBrushItem( RES_CHRATR_BACKGROUND ), SID_ATTR_BRUSH_CHAR, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_CHRATR_BACKGROUND, new SvxBrushItem( RES_CHRATR_BACKGROUND ), SID_ATTR_BRUSH_CHAR, SFX_ITEMINFOFLAG_NONE }, // CJK-Attributes { RES_CHRATR_CJK_FONT, nullptr, SID_ATTR_CHAR_CJK_FONT, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index bc5ec45973eb..58bb026e1c7e 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1473,6 +1473,27 @@ void SwDoc::ForEachCharacterUnderlineItem( const std::function& rFunc ) const +{ +for(SwCharFormat* pFormat : *GetCharFormats()) +{ +const SwAttrSet& rAttrSet = pFormat->GetAttrSet(); +if (const SvxBrushItem* pItem = rAttrSet.GetItemIfSet(RES_CHRATR_BACKGROUND)) +if (!rFunc(*pItem)) +return; +} +std::vector> aStyles; +for (auto eFamily : { IStyleAccess::AUTO_STYLE_CHAR, IStyleAccess::AUTO_STYLE_RUBY, IStyleAccess::AUTO_STYLE_PARA, IStyleAccess::AUTO_STYLE_NOTXT }) +{ +const_cast(this)->GetIStyleAccess().getAllStyles(aStyles, eFamily); +for (const auto & rxItemSet : aStyles) +if (const SvxBrushItem* pItem = rxItemSet->GetItemIfSet(RES_CHRATR_BACKGROUND)) +if (!rFunc(*pItem)) +return; +} +} + void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index ee490d562013..d7bbeb6bfb53 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1346,18 +1346,16 @@ void RtfExport::OutColorTable() } // background color -static const sal_uInt16 aBrushIds[] = { RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0 }; -for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds) { -auto pBackground = static_cast(GetDfltAttr(*pIds)); +const SvxBrushItem* pBackground = GetDfltAttr(RES_BACKGROUND); InsColor(pBackground->GetColor()); -pBackground = static_cast(rPool.GetUserDefaultItem(*pIds)); +pBackground = rPool.GetUserDefaultItem(RES_BACKGROUND); if (pBackground) { InsColor(pBackground->GetColor()); } -rPool.GetItemSurrogates(aSurrogates, *pIds); +rPool.GetItemSurrogates(aSurrogates, RES_BACKGROUND); for (const SfxPoolItem* pItem : aSurrogates) { pBackground = static_cast(pItem); @@ -1367,6 +1365,19 @@ void RtfExport::OutColorTable() } } } +{ +const SvxBrushItem* pBackground = GetDfltAttr(RES_CHRATR_BACKGROUND); +InsColor(pBackground->GetColor()); +pBa
core.git: dbaccess/source
dbaccess/source/core/api/RowSet.cxx | 20 ++-- dbaccess/source/core/api/RowSet.hxx |5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) New commits: commit 26fd88df801c91117b8819e2a1afb898d2612eba Author: Noel Grandin AuthorDate: Tue Sep 17 19:20:51 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 08:06:55 2024 +0200 remove OSubComponent from RowSet which attempts to implement a very dodgy and almost but not actually thread-safe dispose function. Rather just hold a weak reference to the rowset that created us. Change-Id: I1881ac34320b61866eefc3641b455f618d0759d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173573 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 46c4984f7439..0b6e7c5a885a 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -2708,9 +2708,9 @@ void ORowSet::impl_rebuild_throw(::osl::ResettableMutexGuard& _rGuard) // *** ORowSetClone::ORowSetClone( const Reference& _rContext, ORowSet& rParent, ::osl::Mutex* _pMutex ) - :OSubComponent(m_aMutex, rParent) + : ::cppu::WeakComponentImplHelper<>(m_aMutex) ,ORowSetBase( _rContext, WeakComponentImplHelper::rBHelper, _pMutex ) - ,m_pParent(&rParent) + ,m_xParent(&rParent) ,m_nFetchDirection(rParent.m_nFetchDirection) ,m_nFetchSize(rParent.m_nFetchSize) ,m_bIsBookmarkable(true) @@ -2801,7 +2801,7 @@ ORowSetClone::~ORowSetClone() // css::XTypeProvider Sequence< Type > ORowSetClone::getTypes() { -return ::comphelper::concatSequences(OSubComponent::getTypes(),ORowSetBase::getTypes()); +return ::comphelper::concatSequences(::cppu::WeakComponentImplHelper<>::getTypes(),ORowSetBase::getTypes()); } // css::XInterface @@ -2809,18 +2809,18 @@ Any ORowSetClone::queryInterface( const Type & rType ) { Any aRet = ORowSetBase::queryInterface(rType); if(!aRet.hasValue()) -aRet = OSubComponent::queryInterface(rType); +aRet = ::cppu::WeakComponentImplHelper<>::queryInterface(rType); return aRet; } void ORowSetClone::acquire() noexcept { -OSubComponent::acquire(); +::cppu::WeakComponentImplHelper<>::acquire(); } void ORowSetClone::release() noexcept { -OSubComponent::release(); +::cppu::WeakComponentImplHelper<>::release(); } // XServiceInfo @@ -2845,9 +2845,9 @@ void ORowSetClone::disposing() MutexGuard aGuard( m_aMutex ); ORowSetBase::disposing(); -m_pParent = nullptr; +m_xParent = nullptr; m_pMutex= &m_aMutex; // this must be done here because someone could hold a ref to us and try to do something -OSubComponent::disposing(); +::cppu::WeakComponentImplHelper<>::disposing(); } // XCloseable @@ -2879,8 +2879,8 @@ void SAL_CALL ORowSetClone::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,c { if ( nHandle == PROPERTY_ID_FETCHSIZE ) { -if ( m_pParent ) -m_pParent->setFastPropertyValue_NoBroadcast( nHandle, rValue ); +if ( auto xParent = m_xParent.get() ) +xParent->setFastPropertyValue_NoBroadcast( nHandle, rValue ); } OPropertyStateContainer::setFastPropertyValue_NoBroadcast(nHandle,rValue); diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index 3cf6fe690193..92d9e53f7461 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -48,6 +48,7 @@ #include #include #include +#include namespace dbaccess { @@ -445,11 +446,11 @@ namespace dbaccess // ORowSetClone class ORowSetClone : public cppu::BaseMutex - ,public OSubComponent + ,public ::cppu::WeakComponentImplHelper<> ,public ORowSetBase ,public ::comphelper::OPropertyArrayUsageHelper < ORowSetClone > { -ORowSet*m_pParent; +unotools::WeakReference m_xParent; sal_Int32 m_nFetchDirection; sal_Int32 m_nFetchSize; boolm_bIsBookmarkable;
core.git: 2 commits - dbaccess/source include/vcl solenv/clang-format vcl/qa
dbaccess/source/core/api/preparedstatement.cxx |5 +++-- dbaccess/source/core/api/statement.cxx | 20 +++- dbaccess/source/core/dataaccess/connection.cxx |2 +- dbaccess/source/core/dataaccess/datasource.cxx |2 +- dbaccess/source/core/inc/callablestatement.hxx |2 +- dbaccess/source/core/inc/connection.hxx|8 dbaccess/source/core/inc/preparedstatement.hxx |2 +- dbaccess/source/core/inc/statement.hxx | 11 +++ include/vcl/BitmapAlphaClampFilter.hxx |3 +-- solenv/clang-format/excludelist|2 +- vcl/qa/cppunit/BitmapFilterTest.cxx| 19 +++ 11 files changed, 50 insertions(+), 26 deletions(-) New commits: commit f7354e18731ae41ab86584b04b0b23bee844f3dd Author: Noel Grandin AuthorDate: Tue Sep 17 14:29:32 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 18 08:06:47 2024 +0200 remove OSubComponent from OStatementBase which attempts to implement a very dodgy and almost but not actually thread-safe dispose function. Rather just hold a weak reference to the connection that created us. Change-Id: I01e4f5fc0a8aeb33adc14a2981ce09522a0306bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173572 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/dbaccess/source/core/api/preparedstatement.cxx b/dbaccess/source/core/api/preparedstatement.cxx index 3691477a5ebd..ecb1a4c1e348 100644 --- a/dbaccess/source/core/api/preparedstatement.cxx +++ b/dbaccess/source/core/api/preparedstatement.cxx @@ -31,6 +31,7 @@ #include #include "resultcolumn.hxx" #include "resultset.hxx" +#include #include using namespace ::com::sun::star::sdbc; @@ -42,7 +43,7 @@ using namespace ::osl; using namespace dbaccess; -OPreparedStatement::OPreparedStatement(const Reference< XConnection > & _xConn, +OPreparedStatement::OPreparedStatement(const rtl::Reference< OConnection > & _xConn, const Reference< XInterface > & _xStatement) :OStatementBase(_xConn, _xStatement) { @@ -220,7 +221,7 @@ sal_Bool OPreparedStatement::execute() Reference< XConnection > OPreparedStatement::getConnection() { -return Reference< XConnection > (m_xParent, UNO_QUERY); +return m_xParent.get(); } // XParameters diff --git a/dbaccess/source/core/api/statement.cxx b/dbaccess/source/core/api/statement.cxx index 3a6dfe2a490e..7166de42a233 100644 --- a/dbaccess/source/core/api/statement.cxx +++ b/dbaccess/source/core/api/statement.cxx @@ -31,6 +31,7 @@ #include #include #include +#include using namespace ::com::sun::star::sdb; using namespace ::com::sun::star::sdbc; @@ -43,10 +44,11 @@ using namespace dbaccess; using namespace dbtools; -OStatementBase::OStatementBase(const Reference< XConnection > & _xConn, +OStatementBase::OStatementBase(const rtl::Reference< OConnection > & _xConn, const Reference< XInterface > & _xStatement) -:OSubComponent(m_aMutex, _xConn) +:WeakComponentImplHelper(m_aMutex) ,OPropertySetHelper(WeakComponentImplHelper::rBHelper) +,m_xParent(_xConn.get()) ,m_bUseBookmarks( false ) ,m_bEscapeProcessing( true ) @@ -68,7 +70,7 @@ Sequence< Type > OStatementBase::getTypes() cppu::UnoType::get(), cppu::UnoType::get(), cppu::UnoType::get(), - OSubComponent::getTypes() ); + ::cppu::WeakComponentImplHelper<>::getTypes() ); Reference< XGeneratedResultSet > xGRes(m_xAggregateAsSet, UNO_QUERY); if ( xGRes.is() ) aTypes = OTypeCollection(cppu::UnoType::get(),aTypes.getTypes()); @@ -82,7 +84,7 @@ Sequence< Type > OStatementBase::getTypes() // css::uno::XInterface Any OStatementBase::queryInterface( const Type & rType ) { -Any aIface = OSubComponent::queryInterface( rType ); +Any aIface = ::cppu::WeakComponentImplHelper<>::queryInterface( rType ); if (!aIface.hasValue()) { aIface = ::cppu::queryInterface( @@ -110,12 +112,12 @@ Any OStatementBase::queryInterface( const Type & rType ) void OStatementBase::acquire() noexcept { -OSubComponent::acquire(); +::cppu::WeakComponentImplHelper<>::acquire(); } void OStatementBase::release() noexcept { -OSubComponent::release(); +::cppu::WeakComponentImplHelper<>::release(); } void OStatementBase::disposeResultSet() @@ -159,7 +161,7 @@ void OStatementBase::disposing() m_xAggregateAsSet = nullptr; // free the parent at last -OSubComponent::disposing(); +::cppu::WeakComponentImplHelper<>::disposing(); } // XCloseable @@ -419,7 +421,7 @@ Reference< XResultSet > SAL_CALL OStatementBase::getGeneratedValues( ) // OStatement -OStatement::OStatement( const Reference< XConnection >& _xConn, const Reference< XInterface > & _xS
core.git: sw/inc sw/qa sw/source
sw/inc/docsh.hxx |4 sw/inc/rdfhelper.hxx | 21 +-- sw/qa/extras/mailmerge/mailmerge2.cxx |5 sw/qa/extras/uiwriter/uiwriter.cxx|5 sw/source/core/access/AccessibilityCheck.cxx |9 - sw/source/core/doc/docedt.cxx |5 sw/source/core/doc/docnew.cxx | 12 +- sw/source/core/doc/rdfhelper.cxx | 49 sw/source/core/doc/textboxhelper.cxx |5 sw/source/core/draw/dpage.cxx |6 - sw/source/core/edit/edfcol.cxx| 105 -- sw/source/core/edit/edlingu.cxx |5 sw/source/core/text/itrform2.cxx |5 sw/source/core/text/porlay.cxx|7 - sw/source/core/txtnode/thints.cxx |3 sw/source/core/unocore/unoframe.cxx |7 - sw/source/core/unocore/unoidx.cxx |8 - sw/source/core/unocore/unoobj2.cxx|7 - sw/source/core/unocore/unostyle.cxx |6 - sw/source/filter/html/htmlform.cxx|7 - sw/source/filter/html/htmlforw.cxx|4 sw/source/filter/html/htmlgrin.cxx|5 sw/source/filter/ww8/docxattributeoutput.cxx |5 sw/source/filter/ww8/docxexport.cxx | 13 +- sw/source/filter/ww8/docxexportfilter.cxx |4 sw/source/filter/ww8/docxtablestyleexport.cxx |4 sw/source/filter/ww8/ww8par.cxx | 10 - sw/source/ui/dbui/mmresultdialogs.cxx |9 - sw/source/ui/frmdlg/cption.cxx| 15 +- sw/source/ui/misc/bookmark.cxx|6 - sw/source/uibase/app/applab.cxx |5 sw/source/uibase/app/docsh.cxx|6 + sw/source/uibase/app/docsh2.cxx |5 sw/source/uibase/app/docshini.cxx | 16 +- sw/source/uibase/shells/textsh1.cxx |3 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 13 -- sw/source/uibase/uno/unomailmerge.cxx |2 sw/source/uibase/utlui/content.cxx| 49 +++- 38 files changed, 221 insertions(+), 234 deletions(-) New commits: commit c69ad797408fd93afec2c5ac47ba94eba5e4c81c Author: Noel Grandin AuthorDate: Tue Sep 17 11:37:15 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 17 18:01:18 2024 +0200 use more concrete UNO types in sw Change-Id: I0f84ce7116441abb2359ee756c912ae663baa2fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173545 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index 3cbc43c98803..f29c4ed78134 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -53,6 +53,7 @@ class SwDocShell; class SwDrawModel; class SwViewShell; class SwDocStyleSheetPool; +class SwXTextDocument; namespace svt { class EmbeddedObjectRef; @@ -185,6 +186,9 @@ public: /// OLE 2.0-notification. DECL_DLLPRIVATE_LINK( Ole2ModifiedHdl, bool, void ); +/// Override SfxObjectShell::GetBaseModel and return a more accurate type +rtl::Reference GetBaseModel() const; + /// OLE-stuff. virtual void SetVisArea( const tools::Rectangle &rRect ) override; virtual tools::Rectangle GetVisArea( sal_uInt16 nAspect ) const override; diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx index ee346c499fe2..164f99683495 100644 --- a/sw/inc/rdfhelper.hxx +++ b/sw/inc/rdfhelper.hxx @@ -12,6 +12,7 @@ #include +#include #include #include "swdllapi.h" @@ -20,7 +21,7 @@ #include class SwTextNode; - +class SwXTextDocument; namespace com::sun::star { namespace frame { class XModel; @@ -43,44 +44,44 @@ public: /// Gets all graph-names in RDF of a given type. static css::uno::Sequence> -getGraphNames(const css::uno::Reference& xModel, const OUString& rType); +getGraphNames(const rtl::Reference& xModel, const OUString& rType); /// Gets all (XResource, key, value) statements in RDF graphs given the graph-names. static std::map -getStatements(const css::uno::Reference& xModel, +getStatements(const rtl::Reference& xModel, const css::uno::Sequence>& rGraphNames, const css::uno::Reference& xSubject); /// Gets all (XResource, key, value) statements in RDF graphs of type rType. static std::map -getStatements(const css::uno::Reference& xModel, const OUString& rType, +getStatements(const rtl::Reference& xModel, const OUString& rType, const css::uno::Reference& xSubject); /// Add an (XResource, key, value) statem
core.git: unoxml/source
unoxml/source/rdf/librdf_repository.cxx | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) New commits: commit c8de7794d048b5e7e977370b6d1345e5a36d4878 Author: Noel Grandin AuthorDate: Fri Sep 13 15:19:37 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 13 20:58:54 2024 +0200 use more concrete UNO type in librdf_NamedGraph Change-Id: I97b8965bc73923c35aa086e10bfef081a263de58 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173339 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index af7cab516474..09b4a9cac17a 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -59,7 +59,7 @@ #include #include #include -#include +#include #include #include @@ -698,7 +698,6 @@ public: librdf_NamedGraph(librdf_Repository * i_pRep, uno::Reference i_xName) : m_wRep(i_pRep) -, m_pRep(i_pRep) , m_xName(std::move(i_xName)) { }; @@ -736,8 +735,7 @@ private: const uno::Reference< rdf::XNode > & i_xObject); /// weak reference: this is needed to check if m_pRep is valid -uno::WeakReference< rdf::XRepository > const m_wRep; -librdf_Repository *const m_pRep; +unotools::WeakReference< librdf_Repository > const m_wRep; uno::Reference< rdf::XURI > const m_xName; /// Querying is rather slow, so cache the results. @@ -771,14 +769,14 @@ uno::Reference< rdf::XURI > SAL_CALL librdf_NamedGraph::getName() void SAL_CALL librdf_NamedGraph::clear() { -uno::Reference< rdf::XRepository > xRep( m_wRep ); +rtl::Reference< librdf_Repository > xRep( m_wRep ); if (!xRep.is()) { throw rdf::RepositoryException( u"librdf_NamedGraph::clear: repository is gone"_ustr, *this); } const OUString contextU( m_xName->getStringValue() ); try { -m_pRep->clearGraph_NoLock(contextU); +xRep->clearGraph_NoLock(contextU); } catch (lang::IllegalArgumentException & ex) { css::uno::Any anyEx = cppu::getCaughtException(); throw lang::WrappedTargetRuntimeException( ex.Message, @@ -793,7 +791,7 @@ void SAL_CALL librdf_NamedGraph::addStatement( const uno::Reference< rdf::XURI > & i_xPredicate, const uno::Reference< rdf::XNode > & i_xObject) { -uno::Reference< rdf::XRepository > xRep( m_wRep ); +rtl::Reference< librdf_Repository > xRep( m_wRep ); if (!xRep.is()) { throw rdf::RepositoryException( u"librdf_NamedGraph::addStatement: repository is gone"_ustr, *this); @@ -802,7 +800,7 @@ void SAL_CALL librdf_NamedGraph::addStatement( std::unique_lock g(m_CacheMutex); m_aStatementsCache.clear(); } -m_pRep->addStatementGraph_NoLock( +xRep->addStatementGraph_NoLock( i_xSubject, i_xPredicate, i_xObject, m_xName); } @@ -811,7 +809,7 @@ void SAL_CALL librdf_NamedGraph::removeStatements( const uno::Reference< rdf::XURI > & i_xPredicate, const uno::Reference< rdf::XNode > & i_xObject) { -uno::Reference< rdf::XRepository > xRep( m_wRep ); +rtl::Reference< librdf_Repository > xRep( m_wRep ); if (!xRep.is()) { throw rdf::RepositoryException( u"librdf_NamedGraph::removeStatements: repository is gone"_ustr, *this); @@ -820,7 +818,7 @@ void SAL_CALL librdf_NamedGraph::removeStatements( std::unique_lock g(m_CacheMutex); m_aStatementsCache.clear(); } -m_pRep->removeStatementsGraph_NoLock( +xRep->removeStatementsGraph_NoLock( i_xSubject, i_xPredicate, i_xObject, m_xName); } @@ -853,12 +851,12 @@ librdf_NamedGraph::getStatements( } } -uno::Reference< rdf::XRepository > xRep( m_wRep ); +rtl::Reference< librdf_Repository > xRep( m_wRep ); if (!xRep.is()) { throw rdf::RepositoryException( u"librdf_NamedGraph::getStatements: repository is gone"_ustr, *this); } -std::vector vStatements = m_pRep->getStatementsGraph_NoLock( +std::vector vStatements = xRep->getStatementsGraph_NoLock( i_xSubject, i_xPredicate, i_xObject, m_xName); {
core.git: chart2/source include/comphelper include/svx
chart2/source/controller/chartapiwrapper/AxisWrapper.hxx | 10 +- chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 12 ++- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 10 +- chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx | 37 +++--- chart2/source/controller/chartapiwrapper/TitleWrapper.hxx |2 chart2/source/controller/inc/ChartDocumentWrapper.hxx |9 +- chart2/source/view/diagram/VDiagram.cxx |5 - chart2/source/view/inc/VDiagram.hxx |2 include/comphelper/types.hxx | 10 ++ include/svx/unoshape.hxx |3 10 files changed, 54 insertions(+), 46 deletions(-) New commits: commit 451a66438a58505d2e89e76c7559a9dac1bbc00e Author: Noel Grandin AuthorDate: Fri Sep 13 11:16:12 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 13 18:51:41 2024 +0200 use more concrete UNO types in chart2 Change-Id: Id2d58ad76b6e8ff569bd7b65f86a7fdd0152f3d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173324 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx index e70c85b23ff8..3b63c45c100d 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx @@ -27,7 +27,7 @@ #include #include #include - +#include #include namespace com::sun::star::chart2 { class XAxis; } @@ -35,6 +35,8 @@ namespace com::sun::star::chart2 { class XAxis; } namespace chart::wrapper { class Chart2ModelContact; +class TitleWrapper; +class GridWrapper; class AxisWrapper : public ::cppu::ImplInheritanceHelper< WrappedPropertySet @@ -113,9 +115,9 @@ private: //member tAxisType m_eType; -css::uno::Reference< css::beans::XPropertySet > m_xAxisTitle; -css::uno::Reference< css::beans::XPropertySet > m_xMajorGrid; -css::uno::Reference< css::beans::XPropertySet > m_xMinorGrid; +rtl::Reference< TitleWrapper > m_xAxisTitle; +rtl::Reference< GridWrapper > m_xMajorGrid; +rtl::Reference< GridWrapper > m_xMinorGrid; }; } // namespace chart::wrapper diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index f7825b714855..ab6de48e0fe1 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -858,7 +858,11 @@ void SAL_CALL ChartDocumentWrapper::dispose() try { Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY ); -DisposeHelper::DisposeAndClear( m_xTitle ); +if (m_xTitle) +{ +m_xTitle->dispose(); +m_xTitle.clear(); +} DisposeHelper::DisposeAndClear( m_xSubTitle ); DisposeHelper::DisposeAndClear( m_xLegend ); DisposeHelper::DisposeAndClear( m_xChartData ); @@ -1344,11 +1348,11 @@ uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType // ::utl::OEventListenerAdapter void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource ) { -if( rSource.Source == m_xTitle ) +if( rSource.Source == cppu::getXWeak(m_xTitle.get()) ) m_xTitle.clear(); -else if( rSource.Source == m_xSubTitle ) +else if( rSource.Source == cppu::getXWeak(m_xSubTitle.get()) ) m_xSubTitle.clear(); -else if( rSource.Source == m_xLegend ) +else if( rSource.Source == cppu::getXWeak(m_xLegend.get()) ) m_xLegend.clear(); else if( rSource.Source == m_xChartData ) m_xChartData.clear(); diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 1b9da6491134..12b7e1b11c7b 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -887,7 +887,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis() { if( ! m_xZAxis.is()) m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact ); -return Reference< beans::XPropertySet >( m_xZAxis, uno::UNO_QUERY ); +return m_xZAxis; } // XTwoAxisXSupplier @@ -895,7 +895,7 @@ Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis() { if( ! m_xSecondXAxis.is()) m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact ); -return Reference< beans::XPropertySet >( m_xSecondXAxis, uno::UNO_QUERY ); +return m_xSecondXAxis; } // XAxisXSupplier (base of XTwoAxisXSup
core.git: dbaccess/source
dbaccess/source/core/api/KeySet.cxx|8 dbaccess/source/core/api/KeySet.hxx|4 +++- dbaccess/source/core/api/OptimisticSet.cxx |3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) New commits: commit dff484283dcd562f60840fb9800800187c013b87 Author: Noel Grandin AuthorDate: Thu Sep 12 19:41:16 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 13 12:45:54 2024 +0200 use more concrete UNO types in dbaccess Change-Id: I017d4fd7131735dfd2dba6e1b046fbe691522745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173280 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 511338e30d9b..f931adbab02f 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -311,7 +311,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first // without extra variable to be set -OKeySetValue keySetValue{nullptr,0,Reference()}; +OKeySetValue keySetValue{nullptr,0,nullptr}; m_aKeyMap.emplace(0, keySetValue); m_aKeyIter = m_aKeyMap.begin(); } @@ -321,7 +321,7 @@ void OKeySet::reset(const Reference< XResultSet>& _xDriverSet) OCacheSet::construct(_xDriverSet, m_sRowSetFilter); m_bRowCountFinal = false; m_aKeyMap.clear(); -OKeySetValue keySetValue{nullptr,0,Reference()}; +OKeySetValue keySetValue{nullptr,0,nullptr}; m_aKeyMap.emplace(0,keySetValue); m_aKeyIter = m_aKeyMap.begin(); } @@ -752,7 +752,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size()); copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1); -m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue{aKeyRow,1,Reference()} ).first; +m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue{aKeyRow,1,nullptr} ).first; // now we set the bookmark for this row (*_rInsertRow)[0] = Any(static_cast(m_aKeyIter->first)); tryRefetch(_rInsertRow,bRefetch); @@ -1197,7 +1197,7 @@ bool OKeySet::fetchRow() aIter->fill(rColDesc.nPosition, rColDesc.nType, m_xRow); ++aIter; } -m_aKeyIter = m_aKeyMap.emplace( m_aKeyMap.rbegin()->first+1,OKeySetValue{aKeyRow,0,Reference()} ).first; +m_aKeyIter = m_aKeyMap.emplace( m_aKeyMap.rbegin()->first+1,OKeySetValue{aKeyRow,0,nullptr} ).first; } else m_bRowCountFinal = true; diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index c5b78811a814..37cde22d7e32 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -32,6 +32,8 @@ namespace dbaccess { +class OPrivateRow; + struct SelectColumnDescription { OUString sRealName; // may be empty @@ -72,7 +74,7 @@ namespace dbaccess { ORowSetRow m_aRowSetRow; sal_Int32 m_nUpdateInsert; -css::uno::Reference< css::sdbc::XRow> m_xRow; +rtl::Reference m_xRow; }; typedef std::map OKeySetMatrix; typedef std::map > OUpdatedParameter; diff --git a/dbaccess/source/core/api/OptimisticSet.cxx b/dbaccess/source/core/api/OptimisticSet.cxx index e77560d41386..a74ec45e41d7 100644 --- a/dbaccess/source/core/api/OptimisticSet.cxx +++ b/dbaccess/source/core/api/OptimisticSet.cxx @@ -36,6 +36,7 @@ #include #include #include +#include "PrivateRow.hxx" using namespace dbaccess; using namespace ::connectivity; @@ -105,7 +106,7 @@ void OptimisticSet::construct(const Reference< XResultSet>& _xDriverSet,const OU // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first // without extra variable to be set -OKeySetValue keySetValue{nullptr,0,Reference()}; +OKeySetValue keySetValue{nullptr,0,nullptr}; m_aKeyMap.emplace(0,keySetValue); m_aKeyIter = m_aKeyMap.begin();
core.git: Branch 'distro/collabora/co-24.04' - include/svx sd/source svx/source
include/svx/svdmodel.hxx |8 +++--- sd/source/filter/pdf/sdpdffilter.cxx |4 ++- svx/source/svdraw/svdmodel.cxx | 46 ++- 3 files changed, 31 insertions(+), 27 deletions(-) New commits: commit e4251f16e8659b02d36a9b44215970e77a67ead5 Author: Noel Grandin AuthorDate: Fri Sep 6 12:55:26 2024 +0200 Commit: Tomaž Vajngerl CommitDate: Fri Sep 13 11:20:41 2024 +0200 reduce time spent in RecalcPageNums when importing PDF when we have lots of pages, we trigger a O(n^2) loop. Do two things to reduce this (a) be smarter about recalculating page numbers, so we only recalculate the set of page numbers that need recalculating (b) duplicate the last page repeatedly, instead of the first page, so we don't recalculate all the page numbers for each page we duplicate Change-Id: I40aca812b47a9551039c5855b1c8d26f5f171f41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172950 Reviewed-by: Michael Meeks Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 68565e264bc3..f037baf6fcc4 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -199,12 +199,12 @@ protected: std::deque> m_aRedoStack; std::unique_ptr m_pCurrentUndoGroup; // For multi-level sal_uInt16 m_nUndoLevel; // undo nesting +sal_uInt16 m_nPageNumsDirtyFrom = SAL_MAX_UINT16; +sal_uInt16 m_nMasterPageNumsDirtyFrom = SAL_MAX_UINT16; boolm_bIsWriter:1;// to clean up pMyPool from 303a boolm_bThemedControls:1; // If false UnoControls should not use theme colors boolmbUndoEnabled:1; // If false no undo is recorded or we are during the execution of an undo action boolmbChanged:1; -boolm_bPagNumsDirty:1; -boolm_bMPgNumsDirty:1; boolm_bTransportContainer:1; // doc is temporary object container, no display (e.g. clipboard) boolm_bReadOnly:1; boolm_bTransparentTextFrames:1; @@ -397,8 +397,8 @@ public: static OUString GetPercentString(const Fraction& rVal); // RecalcPageNums is ordinarily only called by the Page. -bool IsPagNumsDirty() const { return m_bPagNumsDirty; }; -bool IsMPgNumsDirty() const { return m_bMPgNumsDirty; }; +bool IsPagNumsDirty() const { return m_nPageNumsDirtyFrom != SAL_MAX_UINT16; } +bool IsMPgNumsDirty() const { return m_nMasterPageNumsDirtyFrom != SAL_MAX_UINT16; } void RecalcPageNums(bool bMaster); // After the Insert the Page belongs to the SdrModel. virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0x); diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 9e6597ce..068aca1fcce9 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -65,9 +65,11 @@ bool SdPdfFilter::Import() // Add as many pages as we need up-front. mrDocument.CreateFirstPages(); +sal_uInt16 nPageToDuplicate = 0; for (size_t i = 0; i < aGraphics.size() - 1; ++i) { -mrDocument.DuplicatePage(0); +// duplicating the last page is cheaper than repeatedly duplicating the first one +nPageToDuplicate = mrDocument.DuplicatePage(nPageToDuplicate); } for (vcl::PDFGraphicResult const& rPDFGraphicResult : aGraphics) diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 46497f398944..8101e7ac0b96 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -133,8 +133,6 @@ SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHel , m_bThemedControls(true) , mbUndoEnabled(true) , mbChanged(false) -, m_bPagNumsDirty(false) -, m_bMPgNumsDirty(false) , m_bTransportContainer(false) , m_bReadOnly(false) , m_bTransparentTextFrames(false) @@ -1176,23 +1174,27 @@ void SdrModel::RecalcPageNums(bool bMaster) { if(bMaster) { -sal_uInt16 nCount=sal_uInt16(maMasterPages.size()); -sal_uInt16 i; -for (i=0; iSetPageNum(i); +if (m_nMasterPageNumsDirtyFrom != SAL_MAX_UINT16) +{ +sal_uInt16 nCount=sal_uInt16(maMasterPages.size()); +for (sal_uInt16 i=m_nMasterPageNumsDirtyFrom; iSetPageNum(i); +} +m_nMasterPageNumsDirtyFrom = SAL_MAX_UINT16; } -m_bMPgNumsDirty=false; } else { -sal_uInt16 nCount=sal_uInt16(maPages.size()); -sal_uInt16 i; -for (i=0; iSetPageNum(i); +if (m_nPageNumsDirtyFrom != SAL_MAX
core.git: dbaccess/source
dbaccess/source/core/api/KeySet.cxx| 32 ++--- dbaccess/source/core/api/KeySet.hxx|7 +- dbaccess/source/core/api/OptimisticSet.cxx |2 - 3 files changed, 23 insertions(+), 18 deletions(-) New commits: commit 76c6436faa5e87132cc13be42ac4510baf1c9f8a Author: Noel Grandin AuthorDate: Thu Sep 12 19:38:11 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 13 08:18:58 2024 +0200 convert OKeySetValue to a struct for better readability Change-Id: I9750668a31740bb1de0b6f024912d5cc73f7e766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173279 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 9366c990c87e..511338e30d9b 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -245,7 +245,7 @@ void OKeySet::setOneKeyColumnParameter( sal_Int32 &nPos, const Reference< XParam OUStringBuffer OKeySet::createKeyFilter() { -connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->begin(); +connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.m_aRowSetRow->begin(); static const char aAnd[] = " AND "; const OUString aQuote= getIdentifierQuoteString(); @@ -311,7 +311,7 @@ void OKeySet::construct(const Reference< XResultSet>& _xDriverSet, const OUStrin // the first row is empty because it's now easier for us to distinguish when we are beforefirst or first // without extra variable to be set -OKeySetValue keySetValue(nullptr,std::pair >(0,Reference())); +OKeySetValue keySetValue{nullptr,0,Reference()}; m_aKeyMap.emplace(0, keySetValue); m_aKeyIter = m_aKeyMap.begin(); } @@ -321,7 +321,7 @@ void OKeySet::reset(const Reference< XResultSet>& _xDriverSet) OCacheSet::construct(_xDriverSet, m_sRowSetFilter); m_bRowCountFinal = false; m_aKeyMap.clear(); -OKeySetValue keySetValue(nullptr,std::pair >(0,Reference())); +OKeySetValue keySetValue{nullptr,0,Reference()}; m_aKeyMap.emplace(0,keySetValue); m_aKeyIter = m_aKeyMap.begin(); } @@ -331,8 +331,8 @@ void OKeySet::ensureStatement( ) // do we already have a statement for the current combination of NULLness // of key & foreign columns? std::vector FilterColumnsNULL; -FilterColumnsNULL.reserve(m_aKeyIter->second.first->size()); -for (auto const& elem : *m_aKeyIter->second.first) +FilterColumnsNULL.reserve(m_aKeyIter->second.m_aRowSetRow->size()); +for (auto const& elem : *m_aKeyIter->second.m_aRowSetRow) FilterColumnsNULL.push_back(elem.isNull()); vStatements_t::const_iterator pNewStatement(m_vStatements.find(FilterColumnsNULL)); if(pNewStatement == m_vStatements.end()) @@ -575,9 +575,9 @@ void OKeySet::executeUpdate(const ORowSetRow& _rInsertRow ,const ORowSetRow& _rO const sal_Int32 nBookmark = ::comphelper::getINT32((*_rInsertRow)[0].getAny()); m_aKeyIter = m_aKeyMap.find(nBookmark); assert(m_aKeyIter != m_aKeyMap.end()); -m_aKeyIter->second.second.first = 2; -m_aKeyIter->second.second.second.clear(); -copyRowValue(_rInsertRow,m_aKeyIter->second.first,nBookmark); +m_aKeyIter->second.m_nUpdateInsert = 2; +m_aKeyIter->second.m_xRow.clear(); +copyRowValue(_rInsertRow, m_aKeyIter->second.m_aRowSetRow, nBookmark); tryRefetch(_rInsertRow,bRefetch); } } @@ -752,7 +752,7 @@ void OKeySet::executeInsert( const ORowSetRow& _rInsertRow,const OUString& i_sSQ ORowSetRow aKeyRow = new connectivity::ORowVector< ORowSetValue >(m_pKeyColumnNames->size()); copyRowValue(_rInsertRow,aKeyRow,aKeyIter->first + 1); -m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue(aKeyRow,std::pair >(1,Reference())) ).first; +m_aKeyIter = m_aKeyMap.emplace( aKeyIter->first + 1, OKeySetValue{aKeyRow,1,Reference()} ).first; // now we set the bookmark for this row (*_rInsertRow)[0] = Any(static_cast(m_aKeyIter->first)); tryRefetch(_rInsertRow,bRefetch); @@ -774,7 +774,7 @@ void OKeySet::tryRefetch(const ORowSetRow& _rInsertRow,bool bRefetch) } if ( !bRefetch ) { -m_aKeyIter->second.second.second = new OPrivateRow(std::vector(*_rInsertRow)); +m_aKeyIter->second.m_xRow = new OPrivateRow(std::vector(*_rInsertRow)); } } @@ -1102,7 +1102,7 @@ bool OKeySet::doTryRefetch_throw() } // now set the primary key column values -connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.first->begin(); +connectivity::ORowVector< ORowSetValue >::Vector::const_iterator aIter = m_aKeyIter->second.m_aRowSetRow->begin(); for (auto const& keyColumnName : *m_pKeyColumnNames) setOneKeyColumnParameter(nPos,xPa
core.git: chart2/source
chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 18 -- chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx |5 ++ chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx |5 ++ chart2/source/controller/inc/ChartDocumentWrapper.hxx |3 + chart2/source/inc/DisposeHelper.hxx |9 + 5 files changed, 28 insertions(+), 12 deletions(-) New commits: commit f976823a66858d3ecc749544be50fdda0c8c40f6 Author: Noel Grandin AuthorDate: Thu Sep 12 15:39:44 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 19:28:23 2024 +0200 use more concrete UNO class in chart2 Change-Id: Ifbdcf39f6f621dc63746a8c389a19c52aab847b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173264 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 7c832ed0d781..f7825b714855 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -709,20 +709,18 @@ Reference< XDiagram > SAL_CALL ChartDocumentWrapper::getDiagram() return m_xDiagram; } -void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDiagram ) +void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& _xDiagram ) { -uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY ); -if( xAddIn.is() ) -{ -setAddIn( xAddIn ); -} -else if( xDiagram.is() && xDiagram != m_xDiagram ) +if (!_xDiagram.is()) +return; +auto xDiagram = dynamic_cast(_xDiagram.get()); +assert(xDiagram); +if( xDiagram != m_xDiagram ) { // set new wrapped diagram at new chart. This requires the old // diagram given as parameter to implement the new interface. If // this is not possible throw an exception -Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW ); -Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram()); +rtl::Reference< ::chart::Diagram > xNewDia( xDiagram->getUnderlyingDiagram()); try { @@ -1354,7 +1352,7 @@ void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource ) m_xLegend.clear(); else if( rSource.Source == m_xChartData ) m_xChartData.clear(); -else if( rSource.Source == m_xDiagram ) +else if( rSource.Source == cppu::getXWeak(m_xDiagram.get()) ) m_xDiagram.clear(); else if( rSource.Source == m_xArea ) m_xArea.clear(); diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 1623eecb2364..1b9da6491134 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1845,6 +1845,11 @@ Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram() return m_spChart2ModelContact->getDiagram(); } +rtl::Reference< ::chart::Diagram > DiagramWrapper::getUnderlyingDiagram() +{ +return m_spChart2ModelContact->getDiagram(); +} + void SAL_CALL DiagramWrapper::setDiagram( const Reference< chart2::XDiagram >& /*xDiagram*/ ) { diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index 3a3a8383de05..2e00c0941e58 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -33,12 +33,13 @@ #include #include #include - #include +#include #include namespace com::sun::star::chart2 { class XDiagram; } namespace com::sun::star::lang { class XEventListener; } +namespace chart { class Diagram; } namespace chart::wrapper { @@ -178,6 +179,8 @@ public: virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL getDiagram() override; virtual void SAL_CALL setDiagram( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override; +rtl::Reference< ::chart::Diagram > getUnderlyingDiagram(); + protected: // WrappedPropertySet virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override; diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx index a5bded3c8fb7..008296b6a358 100644 --- a/chart2/source/controller/inc/ChartDocumentWrapper.hxx +++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx @@ -37,6 +37,7 @@ namespace chart { class ChartView; } namespace chart::wrapper { +class DiagramWrapper; class Chart2ModelContact; class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper @@ -155,7 +156,7 @@ p
core.git: 2 commits - ucb/source xmloff/inc xmloff/source
ucb/source/core/ucbstore.hxx |3 ++- ucb/source/ucp/file/prov.cxx |2 +- ucb/source/ucp/file/prov.hxx |4 +++- xmloff/inc/XMLEmbeddedObjectImportContext.hxx |2 +- xmloff/source/core/XMLEmbeddedObjectImportContext.cxx |3 +-- xmloff/source/transform/FormPropOOoTContext.cxx |6 ++ xmloff/source/transform/FormPropOOoTContext.hxx |2 +- xmloff/source/transform/MergeElemTContext.cxx |3 +-- xmloff/source/transform/MergeElemTContext.hxx |3 ++- xmloff/source/transform/StyleOASISTContext.cxx| 17 - 10 files changed, 18 insertions(+), 27 deletions(-) New commits: commit 925b8da69413708249c6d3f08c86ce54faf4b2e3 Author: Noel Grandin AuthorDate: Thu Sep 12 16:38:24 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 19:28:06 2024 +0200 use more concrete UNO types in ucb Change-Id: I3f3c94c6aa320d9e2a7658f0ee7005ae25100fc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173269 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/ucb/source/core/ucbstore.hxx b/ucb/source/core/ucbstore.hxx index 63d240b5b983..791abdf33dec 100644 --- a/ucb/source/core/ucbstore.hxx +++ b/ucb/source/core/ucbstore.hxx @@ -38,6 +38,7 @@ #include #include +class PropertySetRegistry; using UcbStore_Base = comphelper::WeakComponentImplHelper < css::lang::XServiceInfo, @@ -48,7 +49,7 @@ class UcbStore : public UcbStore_Base { css::uno::Reference< css::uno::XComponentContext >m_xContext; css::uno::Sequence< css::uno::Any > m_aInitArgs; -css::uno::Reference< css::ucb::XPropertySetRegistry > m_xTheRegistry; +rtl::Reference< PropertySetRegistry > m_xTheRegistry; public: explicit UcbStore( const css::uno::Reference< css::uno::XComponentContext >& xContext ); diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 4039c955897c..77e7772db7e2 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -193,7 +193,7 @@ FileProvider::createContentIdentifier( //XPropertySetInfoImpl -namespace { +namespace fileaccess { class XPropertySetInfoImpl2 : public cppu::OWeakObject, diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx index 530010be1f4d..311c1be0e469 100644 --- a/ucb/source/ucp/file/prov.hxx +++ b/ucb/source/ucp/file/prov.hxx @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,7 @@ namespace fileaccess { class BaseContent; class TaskManager; +class XPropertySetInfoImpl2; class FileProvider: public cppu::WeakImplHelper < css::lang::XServiceInfo, @@ -147,7 +149,7 @@ namespace fileaccess { OUString m_HomeDirectory; sal_Int32 m_FileSystemNotation; -css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo; +rtl::Reference< XPropertySetInfoImpl2 > m_xPropertySetInfo; std::unique_ptrm_pMyShell; }; commit 4000d57869fda437f0361dc4ac991858905a40e9 Author: Noel Grandin AuthorDate: Thu Sep 12 16:38:37 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 19:27:53 2024 +0200 use more concrete UNO types in xmloff Change-Id: Idf2bcf23497ef5d673ab36f776f562e8c964b3a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173270 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/xmloff/inc/XMLEmbeddedObjectImportContext.hxx b/xmloff/inc/XMLEmbeddedObjectImportContext.hxx index ca1ea2ac4dcb..557f61e5b664 100644 --- a/xmloff/inc/XMLEmbeddedObjectImportContext.hxx +++ b/xmloff/inc/XMLEmbeddedObjectImportContext.hxx @@ -26,7 +26,7 @@ namespace com::sun::star::lang { class XComponent; } class XMLEmbeddedObjectImportContext final : public SvXMLImportContext { -css::uno::Reference mxFastHandler; +rtl::Reference mxFastHandler; css::uno::Reference xComp; OUString sFilterService; diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index 25b0522ab28f..126ef93d2428 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -131,8 +131,7 @@ void XMLEmbeddedObjectImportContext::SetComponent( Reference< XComponent > const { } -Reference < XImporter > xImporter( mxFastHandler, UNO_QUERY ); -xImporter->setTargetDocument( rComp ); +mxFastHandler->setTargetDocument( rComp ); xComp = rComp; // keep ref to component only if there is a handler diff --git a/xmloff/source/transform/FormPropOOoTContext.cxx b/xmloff/source/transform/FormPropOOoTContext.cxx index 1f5c6086dbfa..5a2ea3ba983a 100644 --- a/xmloff/source/transform/FormPropOOoTContext.cxx +++ b
core.git: include/unotools unotools/source
include/unotools/configitem.hxx |8 +--- include/unotools/streamwrap.hxx |6 +++--- unotools/source/config/configitem.cxx |3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) New commits: commit d4c0bb0ce626fa24eddb886e3bf6444da292df25 Author: Noel Grandin AuthorDate: Thu Sep 12 10:19:34 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 16:21:59 2024 +0200 use more concrete UNO classes in unotools Change-Id: Iaf743ae040a3a7bd808bf3cac033197001c31b18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173250 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/include/unotools/configitem.hxx b/include/unotools/configitem.hxx index f04f2b057798..649c05fdbe28 100644 --- a/include/unotools/configitem.hxx +++ b/include/unotools/configitem.hxx @@ -21,6 +21,7 @@ #define INCLUDED_UNOTOOLS_CONFIGITEM_HXX #include +#include #include #include #include @@ -57,6 +58,7 @@ namespace o3tl namespace utl { +class ConfigChangeListener_Impl; enum class ConfigNameFormat { @@ -72,7 +74,7 @@ namespace utl const OUString sSubTree; css::uno::Reference< css::container::XHierarchicalNameAccess> m_xHierarchyAccess; -css::uno::Reference< css::util::XChangesListener > +rtl::Reference< ConfigChangeListener_Impl > xChangeLstnr; ConfigItemMode m_nMode; boolm_bIsModified; @@ -144,8 +146,8 @@ namespace utl public: virtual ~ConfigItem() override; -ConfigItem(ConfigItem const &) = default; -ConfigItem(ConfigItem &&) = default; +ConfigItem(ConfigItem const &); +ConfigItem(ConfigItem &&); ConfigItem & operator =(ConfigItem const &) = delete; // due to const sSubTree ConfigItem & operator =(ConfigItem &&) = delete; // due to const sSubTree diff --git a/include/unotools/streamwrap.hxx b/include/unotools/streamwrap.hxx index dfe0134086a0..a21d9e070995 100644 --- a/include/unotools/streamwrap.hxx +++ b/include/unotools/streamwrap.hxx @@ -104,14 +104,14 @@ class OOutputStreamWrapper : public cppu::WeakImplHelper public: UNOTOOLS_DLLPUBLIC OOutputStreamWrapper(SvStream& _rStream); -protected: -virtual ~OOutputStreamWrapper() override; - // css::io::XOutputStream virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 >& aData) override final; virtual void SAL_CALL flush() override final; virtual void SAL_CALL closeOutput() override final; +protected: +virtual ~OOutputStreamWrapper() override; + /// throws an exception according to the error flag of m_pSvStream void checkError() const; diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index a8e82ba7602a..b6c0b808dfd9 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -155,6 +155,9 @@ ConfigItem::ConfigItem(OUString aSubTree, ConfigItemMode nSetMode ) : m_xHierarchyAccess = ConfigManager::getConfigManager().addConfigItem(*this); } +ConfigItem::ConfigItem(ConfigItem const &) = default; +ConfigItem::ConfigItem(ConfigItem &&) = default; + ConfigItem::~ConfigItem() { suppress_fun_call_w_exception(RemoveChangesListener());
core.git: 2 commits - connectivity/source svx/source
connectivity/source/cpool/ZPooledConnection.cxx |2 connectivity/source/cpool/ZPooledConnection.hxx |5 - connectivity/source/drivers/evoab2/NPreparedStatement.hxx|2 connectivity/source/drivers/file/FPreparedStatement.cxx |7 + connectivity/source/drivers/firebird/PreparedStatement.hxx |4 connectivity/source/drivers/firebird/ResultSet.hxx |3 connectivity/source/drivers/firebird/StatementCommonBase.cxx |6 - connectivity/source/drivers/firebird/StatementCommonBase.hxx |3 connectivity/source/drivers/jdbc/ResultSet.cxx |4 connectivity/source/drivers/mysqlc/mysqlc_prepared_resultset.hxx |2 connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.hxx |4 connectivity/source/drivers/mysqlc/mysqlc_resultset.hxx |3 connectivity/source/drivers/mysqlc/mysqlc_statement.cxx |3 connectivity/source/drivers/mysqlc/mysqlc_statement.hxx |3 connectivity/source/drivers/odbc/OPreparedStatement.cxx |7 + connectivity/source/drivers/postgresql/pq_connection.cxx |1 connectivity/source/drivers/postgresql/pq_connection.hxx |4 connectivity/source/drivers/postgresql/pq_xkey.hxx |3 connectivity/source/drivers/postgresql/pq_xtable.hxx |2 connectivity/source/inc/FDatabaseMetaDataResultSet.hxx |4 connectivity/source/inc/TDatabaseMetaDataBase.hxx|5 - connectivity/source/inc/file/FPreparedStatement.hxx |5 - connectivity/source/inc/file/FResultSet.hxx |7 + connectivity/source/inc/java/sql/ResultSet.hxx |2 connectivity/source/inc/odbc/ODatabaseMetaDataResultSet.hxx |4 connectivity/source/inc/odbc/OPreparedStatement.hxx |5 - connectivity/source/inc/odbc/OResultSet.hxx |6 - svx/source/inc/cell.hxx |4 svx/source/table/accessibletableshape.cxx| 46 -- 29 files changed, 90 insertions(+), 66 deletions(-) New commits: commit d0d84eba568aaa9aef6ad812f19410946a274640 Author: Noel Grandin AuthorDate: Thu Sep 12 10:18:26 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 14:11:00 2024 +0200 use more concrete UNO classes in connectivity Change-Id: I5c70278add0aa0b0c4a7680c6615b75b688f2180 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173247 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/connectivity/source/cpool/ZPooledConnection.cxx b/connectivity/source/cpool/ZPooledConnection.cxx index 42e8d6c02db7..6cabc1ce2e29 100644 --- a/connectivity/source/cpool/ZPooledConnection.cxx +++ b/connectivity/source/cpool/ZPooledConnection.cxx @@ -65,7 +65,7 @@ Reference< XConnection > OPooledConnection::getConnection() if (m_xComponent.is()) m_xComponent->addEventListener(this); } -return Reference< XConnection >(m_xComponent,UNO_QUERY); +return m_xComponent; } diff --git a/connectivity/source/cpool/ZPooledConnection.hxx b/connectivity/source/cpool/ZPooledConnection.hxx index 79450ea081d3..0f5506f4f3b1 100644 --- a/connectivity/source/cpool/ZPooledConnection.hxx +++ b/connectivity/source/cpool/ZPooledConnection.hxx @@ -22,10 +22,11 @@ #include #include #include - +#include namespace connectivity { +class OConnectionWeakWrapper; // OPooledConnection - // allows to pool a real connection @@ -37,7 +38,7 @@ namespace connectivity ,public OPooledConnection_Base { css::uno::Reference< css::sdbc::XConnection > m_xRealConnection; // the connection from driver -css::uno::Reference< css::lang::XComponent > m_xComponent; // the connection which wraps the real connection +rtl::Reference< OConnectionWeakWrapper > m_xComponent; // the connection which wraps the real connection css::uno::Reference< css::reflection::XProxyFactory > m_xProxyFactory; public: // OComponentHelper diff --git a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx index cd42d42d505b..076216e0cf42 100644 --- a/connectivity/source/drivers/evoab2/NPreparedStatement.hxx +++ b/connectivity/source/drivers/evoab2/NPreparedStatement.hxx @@ -47,7 +47,7 @@ namespace connectivity::evoab // the EBookQuery we're working with QueryData m_aQueryData; // our meta data -css::uno::Reference< css::sdbc::XResultSetMetaData > m_xMetaData; +rtl::Reference m_xMetaData; virtual ~OEvoabPreparedStatement() override; diff --git a/connectivity/so
core.git: 2 commits - comphelper/source include/comphelper scripting/source
comphelper/source/misc/docpasswordrequest.cxx |4 include/comphelper/docpasswordrequest.hxx |6 +++--- scripting/source/stringresource/stringresource.cxx | 18 -- scripting/source/vbaevents/eventhelper.cxx |2 +- 4 files changed, 12 insertions(+), 18 deletions(-) New commits: commit 1fbc623a5e8183b0042e886af9e2a4e0ac7e51f7 Author: Noel Grandin AuthorDate: Thu Sep 12 10:19:03 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 12:35:00 2024 +0200 use more concrete UNO classes in scripting Change-Id: I4eddf7ccdf2d0720a4204e578c9f21d8c78dbd35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173249 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 3e06668ec7d0..a081601b42b2 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1049,13 +1049,12 @@ void StringResourcePersistenceImpl::implStoreAtLocation class BinaryOutput { rtl::Reference< utl::TempFileFastService > m_xTempFile; -Reference< io::XOutputStream > m_xOutputStream; public: explicit BinaryOutput(); -const Reference< io::XOutputStream >& getOutputStream() const -{ return m_xOutputStream; } +Reference< io::XOutputStream > getOutputStream() const +{ return m_xTempFile; } Sequence< ::sal_Int8 > closeAndGetData(); @@ -1073,13 +1072,12 @@ public: BinaryOutput::BinaryOutput() { m_xTempFile = new utl::TempFileFastService; -m_xOutputStream = m_xTempFile; } template< class T > void BinaryOutput::write16BitInt( T n ) { -if( !m_xOutputStream.is() ) +if( !m_xTempFile.is() ) return; Sequence< sal_Int8 > aSeq( 2 ); @@ -1090,12 +1088,12 @@ void BinaryOutput::write16BitInt( T n ) p[0] = nLow; p[1] = nHigh; -m_xOutputStream->writeBytes( aSeq ); +m_xTempFile->writeBytes( aSeq ); } void BinaryOutput::writeInt32( sal_Int32 n ) { -if( !m_xOutputStream.is() ) +if( !m_xTempFile.is() ) return; Sequence< sal_Int8 > aSeq( 4 ); @@ -1106,7 +1104,7 @@ void BinaryOutput::writeInt32( sal_Int32 n ) p[i] = sal_Int8( n & 0xff ); n >>= 8; } -m_xOutputStream->writeBytes( aSeq ); +m_xTempFile->writeBytes( aSeq ); } void BinaryOutput::writeString( const OUString& aStr ) @@ -1123,10 +1121,10 @@ void BinaryOutput::writeString( const OUString& aStr ) Sequence< ::sal_Int8 > BinaryOutput::closeAndGetData() { Sequence< ::sal_Int8 > aRetSeq; -if( !m_xOutputStream.is() ) +if( !m_xTempFile.is() ) return aRetSeq; -m_xOutputStream->closeOutput(); +m_xTempFile->closeOutput(); sal_Int32 nSize = static_cast(m_xTempFile->getPosition()); diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index dd68e99cf1b5..0e8acbcc3677 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -514,7 +514,7 @@ public: // XScriptEventSupplier virtual Reference< container::XNameContainer > SAL_CALL getEvents( ) override { return m_xNameContainer; } private: -Reference< container::XNameContainer > m_xNameContainer; +rtl::Reference< ReadOnlyEventsNameContainer > m_xNameContainer; }; } commit 99243746d26035b91b7301028007dbd6d5c50763 Author: Noel Grandin AuthorDate: Thu Sep 12 10:18:51 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 12:34:50 2024 +0200 use more concrete UNO classes in comphelper Change-Id: I1a81d2264a450c23a5196f980e91a686f69edca8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173248 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index 6f644336e1e2..8a606630c25e 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -41,16 +41,12 @@ using ::com::sun::star::task::XInteractionPassword2; namespace comphelper { -namespace { - class AbortContinuation : public ::cppu::WeakImplHelper< XInteractionAbort > { public: virtual void SAL_CALL select() override {} }; -} - class PasswordContinuation : public ::cppu::WeakImplHelper< XInteractionPassword2 > { public: diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx index a4e8704eb5e4..e57c293df9fd 100644 --- a/include/comphelper/docpasswordrequest.hxx +++ b/include/comphelper/docpasswordrequest.hxx @@ -31,7 +31,7 @@ namespace com::sun::star::task { class XInteractionAbort; } namespace comphelper { class PasswordContinuation; - +class AbortContinuation; /** Selects which UNO document password request type to use. */ enum class DocPasswordRequestType @@
core.git: 2 commits - editeng/source include/editeng include/svx include/vcl svx/source
editeng/source/editeng/impedit.cxx | 12 ++ editeng/source/editeng/impedit.hxx |2 - editeng/source/uno/unoipset.cxx|2 - editeng/source/xml/xmltxtexp.cxx |2 - include/editeng/unoipset.hxx |5 +- include/svx/svdotable.hxx |3 + include/svx/unoshape.hxx |2 - include/vcl/dndhelp.hxx|2 - svx/source/inc/tablemodel.hxx |6 ++- svx/source/table/cellcursor.cxx| 22 ++-- svx/source/table/svdotable.cxx | 14 +--- svx/source/table/tablecontroller.cxx | 50 + svx/source/table/tablehtmlimporter.cxx |6 +-- svx/source/table/tablelayouter.cxx |2 - svx/source/table/tablemodel.cxx|4 +- svx/source/table/tablertfexporter.cxx |8 ++-- svx/source/table/tablertfimporter.cxx |6 +-- svx/source/table/viewcontactoftableobj.cxx |4 +- svx/source/unodraw/unoshape.cxx|2 - 19 files changed, 79 insertions(+), 75 deletions(-) New commits: commit d39e7878b32a68aa34759737000aa6e138b87999 Author: Noel Grandin AuthorDate: Wed Sep 11 16:20:35 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 12 08:09:27 2024 +0200 use less dynamic_cast in svx table stuff we already statically know the types of all these objects Change-Id: I976dbf2b150fcd2176df18a07c2e9f21b1d2fe65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173214 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx index 9abacce2b9ff..e22ef60a48b7 100644 --- a/include/svx/svdotable.hxx +++ b/include/svx/svdotable.hxx @@ -39,6 +39,7 @@ namespace sdr::table { class TableLayouter; struct ImplTableShadowPaintInfo; +class TableModel; #ifndef CellRef class Cell; @@ -116,6 +117,8 @@ public: void DistributeRows( sal_Int32 nFirstRow, sal_Int32 nLastRow, const bool bOptimize, const bool bMinimize ); css::uno::Reference< css::table::XTable > getTable() const; +/// Get the concrete UNO class for the table +rtl::Reference< sdr::table::TableModel > getUnoTable() const; bool isValid( const sdr::table::CellPos& rPos ) const; static CellPos getFirstCell(); diff --git a/svx/source/inc/tablemodel.hxx b/svx/source/inc/tablemodel.hxx index 3446604bc722..a82163f7b874 100644 --- a/svx/source/inc/tablemodel.hxx +++ b/svx/source/inc/tablemodel.hxx @@ -26,6 +26,7 @@ #include #include #include "celltypes.hxx" +#include struct _xmlTextWriter; typedef struct _xmlTextWriter* xmlTextWriterPtr; @@ -50,7 +51,7 @@ protected: typedef ::comphelper::WeakComponentImplHelper< css::table::XTable, css::util::XBroadcaster > TableModelBase; -class TableModel final : +class SVXCORE_DLLPUBLIC TableModel final : public TableModelBase, public ICellRange { @@ -135,6 +136,8 @@ public: virtual void SAL_CALL lockBroadcasts() override; virtual void SAL_CALL unlockBroadcasts() override; +CellRef getCell( sal_Int32 nCol, sal_Int32 nRow ) const; + private: void notifyModification(); @@ -147,7 +150,6 @@ private: sal_Int32 getColumnCountImpl() const; CellRef createCell(); -CellRef getCell( ::sal_Int32 nCol, ::sal_Int32 nRow ) const; void UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount ); void UndoRemoveRows( sal_Int32 nIndex, RowVector& aNewRows ); diff --git a/svx/source/table/cellcursor.cxx b/svx/source/table/cellcursor.cxx index 78358ca465d5..b4d9ce812869 100644 --- a/svx/source/table/cellcursor.cxx +++ b/svx/source/table/cellcursor.cxx @@ -165,14 +165,14 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) // single cell merge is never valid if( mxTable.is() && ((mnLeft != mnRight) || (mnTop != mnBottom)) ) try { -CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnLeft, mnTop ).get() ) ); +CellRef xCell = mxTable->getCell( mnLeft, mnTop ); // check if first cell is merged if( xCell.is() && xCell->isMerged() ) findMergeOrigin( mxTable, mnLeft, mnTop, rStart.mnCol, rStart.mnRow ); // check if last cell is merged -xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( mnRight, mnBottom ).get() ) ); +xCell = mxTable->getCell( mnRight, mnBottom ); if( xCell.is() ) { if( xCell->isMerged() ) @@ -181,7 +181,7 @@ bool CellCursor::GetMergedSelection( CellPos& rStart, CellPos& rEnd ) // merge not possible if selection is only one cell and all its merges if( rEnd == rStart ) return false; -xCell.set( dynamic_cast< Cell* >( mxTable->getCellByPosition( rEnd.mnCol, rEnd.mnRow ).get() ) ); +xCell = mxTable->getCell( rEnd.mnC
core.git: include/svl svl/source
include/svl/itemprop.hxx |7 --- svl/source/items/itemprop.cxx |2 +- 2 files changed, 5 insertions(+), 4 deletions(-) New commits: commit a2ee9929c8a4a8b6d4b6857db79f0b64e230d9f6 Author: Noel Grandin AuthorDate: Wed Sep 11 10:29:49 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 11 20:40:47 2024 +0200 use more concrete UNO type in svl Change-Id: I794fba1f111709e0469812d48eb81cc4dc1f11d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173195 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx index ddd636272ea4..ff12f4060551 100644 --- a/include/svl/itemprop.hxx +++ b/include/svl/itemprop.hxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -88,10 +89,11 @@ private: mutable css::uno::Sequence< css::beans::Property > m_aPropSeq; }; +class SfxItemPropertySetInfo; class SVL_DLLPUBLIC SfxItemPropertySet final { SfxItemPropertyMapm_aMap; -mutable css::uno::Reference m_xInfo; +mutable rtl::Reference m_xInfo; public: SfxItemPropertySet( std::span pMap ) : @@ -131,8 +133,7 @@ public: getPropertyState(const SfxItemPropertyMapEntry& rEntry, const SfxItemSet& rSet) noexcept; -css::uno::Reference const & -getPropertySetInfo() const; +rtl::Reference const & getPropertySetInfo() const; const SfxItemPropertyMap& getPropertyMap() const {return m_aMap;} }; diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index 923bd7c0b260..329f84df722e 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -227,7 +227,7 @@ PropertyState SfxItemPropertySet::getPropertyState(const OUString& rName, cons return eRet; } -Reference const & SfxItemPropertySet::getPropertySetInfo() const +rtl::Reference const & SfxItemPropertySet::getPropertySetInfo() const { if( !m_xInfo.is() ) m_xInfo = new SfxItemPropertySetInfo( m_aMap );
core.git: 2 commits - framework/inc framework/source include/framework toolkit/inc toolkit/source
framework/inc/uielement/menubarmanager.hxx |3 + framework/inc/uifactory/configurationaccessfactorymanager.hxx|6 +++ framework/inc/uifactory/factoryconfiguration.hxx |5 ++- framework/inc/xml/imagesdocumenthandler.hxx |4 +- framework/inc/xml/menudocumenthandler.hxx|3 + framework/inc/xml/statusbardocumenthandler.hxx |4 +- framework/inc/xml/toolboxdocumenthandler.hxx |4 +- framework/source/accelerators/globalacceleratorconfiguration.cxx |2 - framework/source/accelerators/moduleacceleratorconfiguration.cxx |2 - framework/source/fwe/xml/menudocumenthandler.cxx |1 framework/source/fwe/xml/statusbardocumenthandler.cxx|1 framework/source/fwe/xml/toolboxdocumenthandler.cxx |1 framework/source/jobs/jobexecutor.cxx|2 - framework/source/services/desktop.cxx| 11 +- framework/source/services/frame.cxx | 16 +- framework/source/services/pathsettings.cxx |2 - framework/source/uiconfiguration/uicategorydescription.cxx |3 + framework/source/uiconfiguration/windowstateconfiguration.cxx|3 + framework/source/uielement/uicommanddescription.cxx |5 +-- framework/source/xml/imagesdocumenthandler.cxx |2 - include/framework/desktop.hxx| 11 +- toolkit/inc/awt/vclxgraphics.hxx |3 + toolkit/inc/awt/vclxprinter.hxx |5 +-- toolkit/inc/controls/controlmodelcontainerbase.hxx |2 - toolkit/inc/controls/geometrycontrolmodel.hxx|4 +- toolkit/source/awt/vclxprinter.cxx |2 - 26 files changed, 60 insertions(+), 47 deletions(-) New commits: commit ca8c59c7e645a072352b775cc32ea1af06b53413 Author: Noel Grandin AuthorDate: Wed Sep 11 09:02:48 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 11 16:14:54 2024 +0200 use more concrete UNO type in framework Change-Id: I3ee54f3967339ab52c04f48a047bc29fc5161680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173159 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 1beb2961e690..986ed951f9ea 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -45,6 +45,7 @@ #include #include #include +#include namespace framework { @@ -146,7 +147,7 @@ class MenuBarManager final : rtl::Reference< MenuBarManager > xSubMenuManager; css::uno::Reference< css::frame::XDispatch > xMenuItemDispatch; css::uno::Reference< css::frame::XPopupMenuController > xPopupMenuController; -css::uno::Reference< css::awt::XPopupMenu > xPopupMenu; +rtl::Reference< VCLXPopupMenu > xPopupMenu; vcl::KeyCode aKeyCode; }; diff --git a/framework/inc/uifactory/configurationaccessfactorymanager.hxx b/framework/inc/uifactory/configurationaccessfactorymanager.hxx index af0345b496e9..2272aabc355c 100644 --- a/framework/inc/uifactory/configurationaccessfactorymanager.hxx +++ b/framework/inc/uifactory/configurationaccessfactorymanager.hxx @@ -28,14 +28,18 @@ #include #include +#include #include #include #include #include + namespace framework { +class WeakContainerListener; + class ConfigurationAccess_FactoryManager final : public ::cppu::WeakImplHelper< css::container::XContainerListener> { public: @@ -74,7 +78,7 @@ class ConfigurationAccess_FactoryManager final : public ::cppu::WeakImplHelper< FactoryManagerMapm_aFactoryManagerMap; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; css::uno::Reference< css::container::XNameAccess > m_xConfigAccess; -css::uno::Reference< css::container::XContainerListener > m_xConfigListener; +rtl::Reference< WeakContainerListener > m_xConfigListener; bool m_bConfigAccessInitialized; }; diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index 4e5ea6c4b052..4d6b80d7943b 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -37,6 +38,8 @@ namespace framework { +class WeakContaine
core.git: package/source
package/source/xstor/xstorage.cxx |7 +++ package/source/xstor/xstorage.hxx |4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) New commits: commit cd88ea52a0902963f9c616d0d9984a6dd533 Author: Noel Grandin AuthorDate: Wed Sep 11 09:01:59 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 11 14:34:13 2024 +0200 use more concrete UNO type in package Change-Id: I95283bf49b8966d73035dd718fbcfcbdcacc78c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173157 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 3951a38fec66..e0550695e1dd 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -207,7 +207,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > const & xStream, if ( m_nStorageMode & embed::ElementModes::WRITE ) { m_pSwitchStream = new SwitchablePersistenceStream(xStream); -m_xStream = static_cast< io::XStream* >( m_pSwitchStream.get() ); +m_xStream = m_pSwitchStream.get(); } else { @@ -378,7 +378,7 @@ void OStorage_Impl::OpenOwnPackage() uno::Sequence< uno::Any > aArguments( 2 ); auto pArguments = aArguments.getArray(); if ( m_nStorageMode & embed::ElementModes::WRITE ) -pArguments[ 0 ] <<= m_xStream; +pArguments[ 0 ] <<= css::uno::Reference< css::io::XStream >(m_xStream); else { SAL_WARN_IF( !m_xInputStream.is(), "package.xstor", "Input stream must be set for readonly access!" ); @@ -1715,8 +1715,7 @@ void OStorage_Impl::CommitRelInfo( const uno::Reference< container::XNameContain if ( m_xRelStorage->hasElements() ) { -uno::Reference< embed::XTransactedObject > xTrans( m_xRelStorage, uno::UNO_QUERY_THROW ); -xTrans->commit(); +m_xRelStorage->commit(); } if ( xNewPackageFolder.is() && xNewPackageFolder->hasByName( aRelsStorName ) ) diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index 93d5f8dd32ae..f6e9890c43a3 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -141,7 +141,7 @@ struct OStorage_Impl // valid only for root storage css::uno::Reference< css::io::XInputStream > m_xInputStream; // ??? may be stored in properties -css::uno::Reference< css::io::XStream > m_xStream; // ??? may be stored in properties +rtl::Reference< SwitchablePersistenceStream > m_xStream; // ??? may be stored in properties css::uno::Sequence< css::beans::PropertyValue > m_xProperties; bool m_bHasCommonEncryptionData; ::comphelper::SequenceAsHashMap m_aCommonEncryptionData; @@ -162,7 +162,7 @@ struct OStorage_Impl // the _rels substorage that is handled in a special way in embed::StorageFormats::OFOPXML SotElement_Impl* m_pRelStorElement; -css::uno::Reference< css::embed::XStorage > m_xRelStorage; +rtl::Reference< OStorage > m_xRelStorage; css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aRelInfo; css::uno::Reference< css::io::XInputStream > m_xNewRelInfoStream; sal_Int16 m_nRelInfoStatus;
core.git: Branch 'libreoffice-24-8' - comphelper/source extensions/source forms/source include/comphelper reportdesign/source svx/source
comphelper/source/property/propmultiplex.cxx | 20 +++- extensions/source/propctrlr/submissionhandler.cxx |2 +- forms/source/component/DatabaseForm.cxx |4 ++-- forms/source/component/FormComponent.cxx |4 ++-- forms/source/component/clickableimage.cxx |4 ++-- include/comphelper/propmultiplex.hxx |8 +--- reportdesign/source/ui/dlg/AddField.cxx |2 +- reportdesign/source/ui/dlg/GroupsSorting.cxx |2 +- reportdesign/source/ui/dlg/Navigator.cxx |4 ++-- reportdesign/source/ui/report/ReportSection.cxx |2 +- reportdesign/source/ui/report/ReportWindow.cxx|2 +- reportdesign/source/ui/report/ScrollHelper.cxx|2 +- reportdesign/source/ui/report/SectionWindow.cxx |2 +- svx/source/fmcomp/gridcell.cxx|2 +- svx/source/fmcomp/gridctrl.cxx|4 ++-- 15 files changed, 38 insertions(+), 26 deletions(-) New commits: commit 68edc89a5159aace580b81e92b3c86e5116343c6 Author: Noel Grandin AuthorDate: Mon Sep 9 10:50:07 2024 +0200 Commit: Michael Stahl CommitDate: Wed Sep 11 11:25:32 2024 +0200 tsan:lock-order-inversion in forms == WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=14614) Cycle in lock order graph: M0 (0x720c004ac190) => M1 (0x720c004a8200) => M0 Mutex M1 acquired here while holding mutex M0 in thread T43: 2 osl::Mutex::acquire() /home/noel/libo-tsan/include/osl/mutex.hxx:63 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 3 osl::Guard::Guard(osl::Mutex&) /home/noel/libo-tsan/include/osl/mutex.hxx:144 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 4 cppu::OBroadcastHelperVar::addListener(com::sun::star::uno::Type const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/include/cppuhelper/interfacecontainer.h:468 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 5 cppu::OPropertySetHelper::addPropertiesChangeListener(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/cppuhelper/source/propshlp.cxx:912 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 6 comphelper::OPropertySetAggregationHelper::addPropertiesChangeListener(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:495 (libcomphelper.so+0x1a1865) 7 comphelper::OPropertySetAggregationHelper::startListening() /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:466 (libcomphelper.so+0x1a1416) ^^^ Mutex M0 previously acquired by the same thread here: 8 comphelper::OPropertySetAggregationHelper::addPropertyChangeListener(rtl::OUString const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:488 (libcomphelper.so+0x1a181a) 9 non-virtual thunk to comphelper::OPropertySetAggregationHelper::addPropertyChangeListener(rtl::OUString const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:? (libcomphelper.so+0x1a181a) 10 frm::OInterfaceContainer::implInsert(int, com::sun::star::uno::Reference const&, bool, frm::ElementDescription*, bool) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:787 (libfrmlo.so+0x23e03c) 11 frm::OInterfaceContainer::insertByIndex(int, com::sun::star::uno::Any const&) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:904 (libfrmlo.so+0x240644) 12 non-virtual thunk to frm::OInterfaceContainer::insertByIndex(int, com::sun::star::uno::Any const&) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:? (libfrmlo.so+0x240716) 13 FmXUndoEnvironment::Inserted(FmFormObj*) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:424 (libsvxcorelo.so+0x41b2a4) 14 FmXUndoEnvironment::Inserted(SdrObject*) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:336 (libsvxcorelo.so+0x41a982) 15 FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:292 (libsvxcorelo.so+0x41a8a0) 16 non-virtual thunk to FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:? (libsvxcorelo.so+0x41acd2) 17 SfxBroadcaster::Broadcast(SfxHint const&) /home/noel/libo-tsan/svl/source/notify/SfxBroadcaster.cxx:40 (libsvllo.so+0xe7c3d) 18 SdrObjList::InsertObject(SdrObject*, unsigned long) /home/noel/libo-tsan/svx/source/svdraw/svdpage.cxx:351 (libsvxcorelo.so+0x6fdf3a) 19 FmFormPage::InsertObject(SdrObject*, unsigned long) /home/noel/libo-tsan/svx/source/form/fmpage.cxx:79 (libsvxcorelo.so+0x3c1e05) 20 SvxDrawPage::add(com::sun::star::uno::Reference const&) /home/noel/libo-tsa
core.git: Branch 'libreoffice-24-8' - forms/source
forms/source/component/DatabaseForm.cxx | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) New commits: commit df7cc4207d21641082e51230ba1903566bd153b3 Author: Noel Grandin AuthorDate: Thu Sep 5 14:39:50 2024 +0200 Commit: Michael Stahl CommitDate: Wed Sep 11 11:07:07 2024 +0200 tsan:lock-order-inversion in forms ThreadSanitizer: lock-order-inversion (potential deadlock) Cycle in lock order graph: M0 (0x720c00011640) => M1 (0x720c00474120) => M0 Mutex M1 acquired here while holding mutex M0 in thread T8: 3 osl::Guard::Guard(osl::Mutex&) 4 comphelper::OPropertySetAggregationHelper::setAggregation(com::sun::star::uno::Reference const&) ^^ acquires cppu mutex 5 frm::ODatabaseForm::impl_construct() 6 frm::ODatabaseForm::ODatabaseForm(com::sun::star::uno::Reference const&) 7 com_sun_star_comp_forms_ODatabaseForm_get_implementation 12 cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference const&) 13 cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference const&, bool) 14 cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference const&) 15 cppuhelper::ServiceManager::createInstance(rtl::OUString const&) 16 non-virtual thunk to cppuhelper::ServiceManager::createInstance(rtl::OUString const&) 17 FmFormPageImpl::getDefaultForm() 18 FmFormPageImpl::findPlaceInFormComponentHierarchy(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference const&, rtl::OUString const&, rtl::OUString const&, int) 19 FmXUndoEnvironment::Inserted(FmFormObj*) 20 FmXUndoEnvironment::Inserted(SdrObject*) 21 FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) 22 non-virtual thunk to FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) 23 SfxBroadcaster::Broadcast(SfxHint const&) 24 SdrObjList::InsertObject(SdrObject*, unsigned long) 25 FmFormPage::InsertObject(SdrObject*, unsigned long) 26 SvxDrawPage::add(com::sun::star::uno::Reference const&) 27 SwFmDrawPage::add(com::sun::star::uno::Reference const&) ^^ acquires solar mutex 28 non-virtual thunk to SwFmDrawPage::add(com::sun::star::uno::Reference const&) 33 binaryurp::IncomingRequest::execute() const 35 cppu_threadpool::JobQueue::enter(void const*, bool) Mutex M0 acquired here while holding mutex M1 in thread T8: 6 SolarMutexClearableGuard::SolarMutexClearableGuard() 7 SfxModelGuard::SfxModelGuard(SfxBaseModel const&, SfxModelGuard::AllowedModelState) ^^ acquires solar mutex 8 SfxBaseModel::getArgs2(com::sun::star::uno::Sequence const&) 9 SfxBaseModel::getArgs() 10 SwXTextDocument::getArgs() 11 non-virtual thunk to SwXTextDocument::getArgs() 12 dbtools::isEmbeddedInDatabase(com::sun::star::uno::Reference const&, com::sun::star::uno::Reference&) 13 frm::ODatabaseForm::setFastPropertyValue_NoBroadcast(int, com::sun::star::uno::Any const&) 15 cppu::OPropertySetHelper::setFastPropertyValue(int, com::sun::star::uno::Any const&) ^^ acquires cppu mutex 16 comphelper::OPropertySetAggregationHelper::setFastPropertyValue(int, com::sun::star::uno::Any const&) 17 cppu::OPropertySetHelper::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) 18 non-virtual thunk to cppu::OPropertySetHelper::setPropertyValue(rtl::OUString const&, com::sun::star::uno::Any const&) 20 cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) /home/noel/libo-tsan/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:229 (libgcc3_uno.so+0x2118a) 22 binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::vector >*) const 23 binaryurp::IncomingRequest::execute() const Change-Id: I00de2ad02b7ab247ee0aa62abcb11f5d46c9b157 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173067 Reviewed-by: Noel Grandin Tested-by: Jenkins (cherry picked from commit 07db23624497d303dca142ba9376cdcf265b20d8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173099 Reviewed-by: Michael Stahl diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 118054615aa4..929d897e77a1 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1643,10 +1644,14 @@ void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const A case PROPERTY_ID_DATASOURCE: { -
core.git: 3 commits - include/vcl stoc/source ucbhelper/source vcl/inc vcl/source vcl/unx
include/vcl/toolkit/edit.hxx |2 +- include/vcl/transfer.hxx |7 --- stoc/source/servicemanager/servicemanager.cxx |3 ++- ucbhelper/source/client/content.cxx |2 +- ucbhelper/source/provider/resultset.cxx |4 ++-- vcl/inc/window.h |6 -- vcl/source/control/edit.cxx | 12 vcl/source/edit/textview.cxx |8 +++- vcl/source/treelist/transfer.cxx |2 +- vcl/source/window/dockwin.cxx |1 + vcl/source/window/mouse.cxx |7 +++ vcl/source/window/window.cxx | 11 +-- vcl/source/window/winproc.cxx | 26 -- vcl/unx/generic/dtrans/X11_selection.cxx |2 +- vcl/unx/generic/dtrans/X11_selection.hxx |5 +++-- 15 files changed, 47 insertions(+), 51 deletions(-) New commits: commit 5cd1f77618ec3d74c8c9c0743b9daef7108bc80a Author: Noel Grandin AuthorDate: Tue Sep 10 13:09:12 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 17:17:51 2024 +0200 use more concrete UNO type in vcl Change-Id: I157109d11b349e1304a3279471d4ab90b65b5841 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173138 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/vcl/toolkit/edit.hxx b/include/vcl/toolkit/edit.hxx index be84069b99ca..93abf1c5dd63 100644 --- a/include/vcl/toolkit/edit.hxx +++ b/include/vcl/toolkit/edit.hxx @@ -85,7 +85,7 @@ private: css::uno::Reference mxBreakIterator; css::uno::Reference mxISC; -css::uno::Reference mxDnDListener; +rtl::Reference mxDnDListener; SAL_DLLPRIVATE boolImplTruncateToMaxLen( OUString&, sal_Int32 nSelectionLen ) const; SAL_DLLPRIVATE voidImplInitEditData(); diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx index 3f07a9f6aab9..4a13f99db1b1 100644 --- a/include/vcl/transfer.hxx +++ b/include/vcl/transfer.hxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -166,7 +167,7 @@ private: css::uno::Any maAny; OUString maLastFormat; mutable css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard; -css::uno::Reference< css::frame::XTerminateListener > mxTerminateListener; +rtl::Reference< TerminateListener > mxTerminateListener; DataFlavorExVector maFormats; std::unique_ptr mxObjDesc; @@ -399,7 +400,7 @@ private: std::mutex maMutex; css::uno::Reference< css::datatransfer::dnd::XDragGestureRecognizer > mxDragGestureRecognizer; -css::uno::Reference< css::datatransfer::dnd::XDragGestureListener > mxDragGestureListener; +rtl::Reference< DragSourceHelper::DragGestureListener > mxDragGestureListener; DragSourceHelper& operator=( const DragSourceHelper& rDragSourceHelper ) = delete; booloperator==( const DragSourceHelper& rDragSourceHelper ) const = delete; @@ -448,7 +449,7 @@ private: std::mutex maMutex; css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; -css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener; +rtl::Reference< DropTargetHelper::DropTargetListener > mxDropTargetListener; DataFlavorExVector maFormats; DropTargetHelper() = delete; diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 69c61214ce7a..72d07bc85c01 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -48,6 +48,8 @@ class VCLXWindow; namespace vcl { class WindowData; } class SalFrame; class SalObject; +class DNDEventDispatcher; +class DNDListenerContainer; enum class MouseEventModifiers; enum class NotifyEventType; enum class ActivateModeFlags; @@ -173,7 +175,7 @@ struct ImplFrameData css::uno::Reference< css::datatransfer::dnd::XDragSource > mxDragSource; css::uno::Reference< css::datatransfer::dnd::XDropTarget > mxDropTarget; -css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > mxDropTargetListener; +rtl::Reference< DNDEventDispatcher > mxDropTargetListener; // css::datatransfer::dnd::XDropTargetListener css::uno::Reference< css::datatransfer::clipboard::XClipboard > mxClipboard; boolmbInternalDragGestureRecognizer; @@ -392,7 +394,7 @@ public: mbNonHomogeneous:1,
core.git: comphelper/source
comphelper/source/compare/AnyCompareFactory.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 369c3bb5f0e47586bd743e68690d128758f3ce7c Author: Noel Grandin AuthorDate: Tue Sep 10 13:08:30 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 16:23:08 2024 +0200 use more concrete UNO type in comphelper Change-Id: I290b3ca15d9fc50e5c272c8e6a6634811a595d20 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173134 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index 785fc9005707..52ce3c39aa8d 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.cxx @@ -25,6 +25,7 @@ #include #include #include +#include using namespace com::sun::star::uno; using namespace com::sun::star::ucb; @@ -50,7 +51,7 @@ public: class AnyCompareFactory : public cppu::WeakImplHelper< XAnyCompareFactory, XInitialization, XServiceInfo > { -Reference< XAnyCompare >m_xAnyCompare; +rtl::Reference< AnyCompare >m_xAnyCompare; Reference< XComponentContext > m_xContext; Locale m_Locale;
core.git: sax/source
sax/source/expatwrap/sax_expat.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 6f56c8da07485bb0d3b7755e25c5eb7fc8c95257 Author: Noel Grandin AuthorDate: Tue Sep 10 13:08:41 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 15:41:28 2024 +0200 use more concrete UNO type in sax Change-Id: I3b3423242012b4f637195fb3c35c0315830e06a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173135 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 2ab32b99ec68..d1eae3997514 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -139,7 +139,7 @@ struct Entity sax_expatwrap::XMLFile2UTFConverter converter; }; - +class LocatorImpl; class SaxExpatParser_Impl { public: // module scope @@ -152,7 +152,7 @@ public: // module scope css::uno::Reference< XErrorHandler > rErrorHandler; css::uno::Reference< XDTDHandler >rDTDHandler; css::uno::Reference< XEntityResolver > rEntityResolver; -css::uno::Reference < XLocator > rDocumentLocator; +rtl::Reference < LocatorImpl >rDocumentLocator; rtl::Reference < comphelper::AttributeList > rAttrList;
core.git: toolkit/inc toolkit/source
toolkit/inc/controls/controlmodelcontainerbase.hxx|5 +++-- toolkit/source/controls/controlmodelcontainerbase.cxx |1 - 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit f70276214149b8497c755f117bed8104cc1f783a Author: Noel Grandin AuthorDate: Tue Sep 10 10:25:34 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 12:05:39 2024 +0200 use concrete UNO type in ControlContainerBase Change-Id: Ibbdde51c7257ab7d8db690dd97670ef570b52556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173123 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/toolkit/inc/controls/controlmodelcontainerbase.hxx b/toolkit/inc/controls/controlmodelcontainerbase.hxx index d8efbcf700bc..31dcc3707525 100644 --- a/toolkit/inc/controls/controlmodelcontainerbase.hxx +++ b/toolkit/inc/controls/controlmodelcontainerbase.hxx @@ -37,12 +37,13 @@ #include #include #include +#include #include #include namespace com::sun::star::resource { class XStringResourceResolver; } namespace com::sun::star::uno { class XComponentContext; } - +class StdTabController; typedef UnoControlModel ControlModel_Base; typedef ::cppu::AggImplInheritanceHelper8 < ControlModel_Base @@ -221,7 +222,7 @@ protected: css::uno::Reference< css::uno::XComponentContext > m_xContext; bool mbSizeModified; bool mbPosModified; -css::uno::Reference< css::awt::XTabController > mxTabController; +rtl::Reference< StdTabController >mxTabController; css::uno::Reference< css::util::XModifyListener > mxListener; voidImplInsertControl( css::uno::Reference< css::awt::XControlModel > const & rxModel, const OUString& rName ); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index f39f12a9c816..b7c8466f1fe6 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1371,7 +1371,6 @@ sal_Bool ControlContainerBase::setModel( const Reference< XControlModel >& rxMod { mxTabController->setModel( nullptr ); // just to be sure, should not be necessary removeTabController( mxTabController ); -::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary mxTabController.clear(); }
core.git: sw/source
sw/source/core/draw/dcontact.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 880096c3a970389de9f1272509d2d03df046570a Author: Noel Grandin AuthorDate: Mon Sep 9 19:23:18 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 08:04:08 2024 +0200 no need to use dynamic_cast in SwDrawContact::GetTextObjectsFromFormat Change-Id: Ia970b120d338fc2924d5f2a86a7e85b276a01776 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173107 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 9873143463e5..73393ea67e50 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -748,7 +748,7 @@ void SwDrawContact::GetTextObjectsFromFormat(std::list& o_rTextObje { for(sw::SpzFrameFormat* pFly: *rDoc.GetSpzFrameFormats()) { -if(dynamic_cast(pFly)) +if(pFly->Which() == RES_DRAWFRMFMT) // ie. SwDrawFrameFormat* pFly->CallSwClientNotify(sw::CollectTextObjectsHint(o_rTextObjects)); } }
core.git: 2 commits - sw/inc sw/source
sw/inc/dcontact.hxx |7 --- sw/source/core/crsr/crstrvl.cxx |2 ++ sw/source/core/doc/doc.cxx |2 ++ sw/source/core/doc/docdraw.cxx |6 +++--- sw/source/core/doc/doclay.cxx |2 +- sw/source/core/undo/undraw.cxx |4 ++-- 6 files changed, 14 insertions(+), 9 deletions(-) New commits: commit 08d9f27a8f4d5a526b0e207a0bed03c0909322a0 Author: Noel Grandin AuthorDate: Mon Sep 9 19:20:45 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 08:03:59 2024 +0200 fix casting of SpzFrameFormat we need to check before casting the items in GetSpzFrameFormats. The code in SwCursorShell::SelectNxtPrvHyperlink dates from commit 9624a1307c5317652af8961a560a8798029039ee Author: jp Date: Fri Feb 8 14:06:36 2002 + Task #96967#: add travel to next/prev hyperlink and the code in SwDoc::ForEachFormatURL is from commit 68566c28b962bf46d3ffc30c635efb37df19a58e Author: Noel Grandin Date: Sun Sep 8 10:29:21 2024 +0200 dont use GetItemSurrogates for gathering SwFormatURL (Yes, I spotted the bad code __after__ I copied it, sigh). Change-Id: Iebbfba06e974bf780b644aa9c563ca23580c6870 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173106 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 96899a9db013..f09b1b146c5e 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2806,6 +2806,8 @@ bool SwCursorShell::SelectNxtPrvHyperlink( bool bNext ) { for(sw::SpzFrameFormat* pSpz: *GetDoc()->GetSpzFrameFormats()) { +if (pSpz->Which() != RES_FLYFRMFMT) +continue; auto pFormat = static_cast(pSpz); const SwFormatURL& rURLItem = pFormat->GetURL(); if( rURLItem.GetMap() || !rURLItem.GetURL().isEmpty() ) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index c2620093cb33..312250826bf7 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1399,6 +1399,8 @@ void SwDoc::ForEachFormatURL( const std::function& rFu { for(sw::SpzFrameFormat* pSpz : *GetSpzFrameFormats()) { +if (pSpz->Which() != RES_FLYFRMFMT) +continue; auto pFormat = static_cast(pSpz); const SwFormatURL& rURLItem = pFormat->GetURL(); if (!rFunc(rURLItem)) commit e164e61f46d15612e6f3ef1eaaec758bed2a05c7 Author: Noel Grandin AuthorDate: Mon Sep 9 20:21:54 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 10 08:03:48 2024 +0200 fix ubsan, partially revert this commit 43be09b29c28284c6585eaa48117e168f7c9c7b5 Author: Noel Grandin Date: Fri Sep 6 15:27:43 2024 +0200 return SwDrawFrameFormat from SwContact::GetFrameFormat since we can also have SwFlyFrameFormat* being returned there Change-Id: Ide064ec39ccb99f3a166b869c552f54f482b9bcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173108 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 86d816111ace..c924c006fc66 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -109,9 +109,10 @@ public: virtual const SdrObject *GetMaster() const = 0; virtual SdrObject *GetMaster() = 0; - SwDrawFrameFormat *GetFormat() { return static_cast(GetRegisteredIn()); } -const SwDrawFrameFormat *GetFormat() const -{ return static_cast(GetRegisteredIn()); } +/// these two methods return either SwDrawFrameFormat* or SwFltFrameFormat* + sw::SpzFrameFormat *GetFormat() { return static_cast(GetRegisteredIn()); } +const sw::SpzFrameFormat *GetFormat() const +{ return static_cast(GetRegisteredIn()); } bool IsInDTOR() const { return mbInDTOR;} diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 0be34d8f9c9f..e9316317c96e 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -239,7 +239,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) for (const auto& rTextBoxElement : pTextBoxNode->GetAllTextBoxes()) vSavedTextBoxes.emplace(rTextBoxElement); -pFormat = pContact->GetFormat(); +pFormat = static_cast(pContact->GetFormat()); // Deletes itself! pContact->Changed(*pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() ); pObj->SetUserCall( nullptr ); @@ -478,7 +478,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) { if (SwDrawContact* pC = static_cast(GetUserCall(pObj))) { -SwDrawFrameFormat* pFrameFormat = pC->GetFormat(); +SwDrawFrameFormat* pFrameFormat = static_cast(pC->GetF
core.git: sw/source
sw/source/core/bastyp/init.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 56d35ad0eaccd353c8acd2a259293199e233e8ec Author: Noel Grandin AuthorDate: Mon Sep 9 17:14:43 2024 +0200 Commit: Noel Grandin CommitDate: Mon Sep 9 20:02:54 2024 +0200 RES_CHRATR_HIGHLIGHT does not need surrogate support It is not queried anywhere using the surrogate APIs Change-Id: I056546b897d396bee49f600605e43f7e8f0addf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173082 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 83f1ca1f6b19..564c6fe5c2db 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -323,7 +323,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_RSID, new SvxRsidItem( 0, RES_CHRATR_RSID ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_BOX, new SvxBoxItem( RES_CHRATR_BOX ), SID_ATTR_CHAR_BOX, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, { RES_CHRATR_SHADOW, new SvxShadowItem( RES_CHRATR_SHADOW ), SID_ATTR_CHAR_SHADOW, SFX_ITEMINFOFLAG_NONE }, -{ RES_CHRATR_HIGHLIGHT, new SvxBrushItem( RES_CHRATR_HIGHLIGHT ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_CHRATR_HIGHLIGHT, new SvxBrushItem( RES_CHRATR_HIGHLIGHT ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_GRABBAG, new SfxGrabBagItem( RES_CHRATR_GRABBAG ), SID_ATTR_CHAR_GRABBAG, SFX_ITEMINFOFLAG_NONE }, // CharacterAttr - MSWord weak char direction/script override emulation
core.git: sw/inc sw/source
sw/inc/doc.hxx |3 sw/source/core/bastyp/init.cxx |4 sw/source/core/doc/doc.cxx | 25 ++ sw/source/core/doc/docfld.cxx | 389 +++-- sw/source/core/edit/edfld.cxx | 38 +--- sw/source/core/view/vprint.cxx | 34 +-- 6 files changed, 251 insertions(+), 242 deletions(-) New commits: commit 8849c1d9cc7fbf990b1e1633b59a09c818dabc72 Author: Noel Grandin AuthorDate: Sun Sep 8 11:03:35 2024 +0200 Commit: Noel Grandin CommitDate: Mon Sep 9 19:23:57 2024 +0200 dont use GetItemSurrogates for gathering SwFormatField which is very expensive these days Change-Id: I830e7829ee3b919647f44ab060bf170e5cf42189 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173035 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 6da96bd2cb82..1a4fff14b4c2 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1437,6 +1437,9 @@ public: /// Iterate over all SvxOverlineItem, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachOverlineItem( const std::function& ) const; +/// Iterate over all SwFormatField, if the function returns false, iteration is stopped +void ForEachFormatField( TypedWhichId nWhich, const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index cc964e7aa01a..83f1ca1f6b19 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -345,9 +345,9 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_TXTATR_CHARFMT, new SwFormatCharFormat( nullptr ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_CJK_RUBY, new SwFormatRuby( OUString() ), SID_ATTR_CHAR_CJK_RUBY, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_UNKNOWN_CONTAINER, new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, -{ RES_TXTATR_INPUTFIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_INPUTFIELD ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_TXTATR_INPUTFIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_INPUTFIELD ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_CONTENTCONTROL, new SwFormatContentControl( RES_TXTATR_CONTENTCONTROL ), 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_TXTATR_FIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_FIELD ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_TXTATR_FIELD, createSwFormatFieldForItemInfoPackage( RES_TXTATR_FIELD ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_FLYCNT, new SwFormatFlyCnt( nullptr ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_FTN, new SwFormatFootnote, 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_ANNOTATION, createSwFormatFieldForItemInfoPackage( RES_TXTATR_ANNOTATION ), 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ec69fb2057d7..c2620093cb33 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1280,6 +1280,31 @@ void SwDoc::ForEachOverlineItem( const std::function nWhich, const std::function& rFunc ) const +{ +SwNodeOffset nCount = GetNodes().Count(); +for (SwNodeOffset i(0); i < nCount; ++i) +{ +SwNode* pNode = GetNodes()[i]; +if (!pNode->IsTextNode()) +continue; +SwTextNode* pTextNode = pNode->GetTextNode(); +if (!pTextNode->HasHints()) +continue; +SwpHints& rHints = pTextNode->GetSwpHints(); +for (size_t j = 0; j < rHints.Count(); ++j) +{ +const SwTextAttr* pTextAttr = rHints.Get(j); +if (pTextAttr->Which() != nWhich) +continue; +const SwFormatField& rFormatField = pTextAttr->GetFormatField(); +if (!rFunc(rFormatField)) +return; +} +} +} + /** * Re-trigger spelling in the idle handler. * diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 613a2e0fd98c..45fda23a806a 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -465,54 +465,49 @@ void SwDoc::GetAllUsedDB( std::vector& rDBNameList, } } -for (sal_uInt16 const nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD }) +for (const TypedWhichId & nWhichHint : { RES_TXTATR_FIELD, RES_TXTATR_INPUTFIELD }) { -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurrogates, nWhichHint); -for (const SfxPoolItem* pItem : aSurrogates) -{ -const SwFormatField* pFormatField = static_cast(pItem); -const SwTextField* pTextField = pFormatField->GetTextField(); -if (!pTextField || !pTextField->GetTe
core.git: 2 commits - comphelper/source extensions/source forms/source include/comphelper reportdesign/source svx/source
comphelper/source/property/propmultiplex.cxx | 20 extensions/source/propctrlr/submissionhandler.cxx |2 - forms/source/component/DatabaseForm.cxx | 26 -- forms/source/component/FormComponent.cxx |4 +-- forms/source/component/clickableimage.cxx |4 +-- include/comphelper/propmultiplex.hxx |8 -- reportdesign/source/ui/dlg/AddField.cxx |2 - reportdesign/source/ui/dlg/GroupsSorting.cxx |2 - reportdesign/source/ui/dlg/Navigator.cxx |4 +-- reportdesign/source/ui/report/ReportSection.cxx |2 - reportdesign/source/ui/report/ReportWindow.cxx|2 - reportdesign/source/ui/report/ScrollHelper.cxx|2 - reportdesign/source/ui/report/SectionWindow.cxx |2 - svx/source/fmcomp/gridcell.cxx|2 - svx/source/fmcomp/gridctrl.cxx|4 +-- 15 files changed, 55 insertions(+), 31 deletions(-) New commits: commit f9ff22db058180d161b32f5dcd87e72cfa3b6889 Author: Noel Grandin AuthorDate: Mon Sep 9 10:50:07 2024 +0200 Commit: Noel Grandin CommitDate: Mon Sep 9 16:08:42 2024 +0200 tsan:lock-order-inversion in forms == WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock) (pid=14614) Cycle in lock order graph: M0 (0x720c004ac190) => M1 (0x720c004a8200) => M0 Mutex M1 acquired here while holding mutex M0 in thread T43: 2 osl::Mutex::acquire() /home/noel/libo-tsan/include/osl/mutex.hxx:63 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 3 osl::Guard::Guard(osl::Mutex&) /home/noel/libo-tsan/include/osl/mutex.hxx:144 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 4 cppu::OBroadcastHelperVar::addListener(com::sun::star::uno::Type const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/include/cppuhelper/interfacecontainer.h:468 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 5 cppu::OPropertySetHelper::addPropertiesChangeListener(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/cppuhelper/source/propshlp.cxx:912 (libuno_cppuhelpergcc3.so.3+0x8fdd9) 6 comphelper::OPropertySetAggregationHelper::addPropertiesChangeListener(com::sun::star::uno::Sequence const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:495 (libcomphelper.so+0x1a1865) 7 comphelper::OPropertySetAggregationHelper::startListening() /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:466 (libcomphelper.so+0x1a1416) ^^^ Mutex M0 previously acquired by the same thread here: 8 comphelper::OPropertySetAggregationHelper::addPropertyChangeListener(rtl::OUString const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:488 (libcomphelper.so+0x1a181a) 9 non-virtual thunk to comphelper::OPropertySetAggregationHelper::addPropertyChangeListener(rtl::OUString const&, com::sun::star::uno::Reference const&) /home/noel/libo-tsan/comphelper/source/property/propagg.cxx:? (libcomphelper.so+0x1a181a) 10 frm::OInterfaceContainer::implInsert(int, com::sun::star::uno::Reference const&, bool, frm::ElementDescription*, bool) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:787 (libfrmlo.so+0x23e03c) 11 frm::OInterfaceContainer::insertByIndex(int, com::sun::star::uno::Any const&) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:904 (libfrmlo.so+0x240644) 12 non-virtual thunk to frm::OInterfaceContainer::insertByIndex(int, com::sun::star::uno::Any const&) /home/noel/libo-tsan/forms/source/misc/InterfaceContainer.cxx:? (libfrmlo.so+0x240716) 13 FmXUndoEnvironment::Inserted(FmFormObj*) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:424 (libsvxcorelo.so+0x41b2a4) 14 FmXUndoEnvironment::Inserted(SdrObject*) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:336 (libsvxcorelo.so+0x41a982) 15 FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:292 (libsvxcorelo.so+0x41a8a0) 16 non-virtual thunk to FmXUndoEnvironment::Notify(SfxBroadcaster&, SfxHint const&) /home/noel/libo-tsan/svx/source/form/fmundo.cxx:? (libsvxcorelo.so+0x41acd2) 17 SfxBroadcaster::Broadcast(SfxHint const&) /home/noel/libo-tsan/svl/source/notify/SfxBroadcaster.cxx:40 (libsvllo.so+0xe7c3d) 18 SdrObjList::InsertObject(SdrObject*, unsigned long) /home/noel/libo-tsan/svx/source/svdraw/svdpage.cxx:351 (libsvxcorelo.so+0x6fdf3a) 19 FmFormPage::InsertObject(SdrObject*, unsigned long) /home/noel/libo-tsan/svx/source/form/fmpage.cxx:79 (libsvxcorelo.so+0x3c1e05) 20 SvxDrawPage::add(com::sun::star::uno::Reference const&) /home/noel/libo-tsan/
core.git: Branch 'libreoffice-24-8' - sw/source
sw/source/core/table/swtable.cxx | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) New commits: commit 55746997bafdd270158f40800ac515a36b9056c2 Author: Noel Grandin AuthorDate: Wed Sep 4 20:02:14 2024 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 9 12:35:54 2024 +0200 use less GetItemSurrogates in SwTable::UpdateFields which speeds up loading a large document with lots of nested tables from several minutes to under 15s Regression from commit ae7807c889c19145f89cec40afac82eee191837c Author: Armin Le Grand (allotropia) Date: Wed Jan 10 20:07:47 2024 +0100 ITEM: No longer register Items at Pool Change-Id: If44bbc50074fc324e9458a4ac498f402500981e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172937 Tested-by: Jenkins Reviewed-by: Noel Grandin Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172944 diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 0e7a24a6dd64..179792a682e9 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1720,21 +1720,26 @@ void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags) break; } } + // process all table box formulas -ItemSurrogates aSurrogates; -pDoc->GetAttrPool().GetItemSurrogates(aSurrogates, RES_BOXATR_FORMULA); -for(const SfxPoolItem* pItem : aSurrogates) +SwTableLines& rTableLines = GetTabLines(); +for (SwTableLine* pTableLine : rTableLines) { -// SwTableBoxFormula is non-shareable, so const_cast is somewhat OK -auto & rBoxFormula = const_cast(static_cast(*pItem)); -if(rBoxFormula.GetDefinedIn()) +SwTableBoxes& rTableBoxes = pTableLine->GetTabBoxes(); +for (SwTableBox* pTableBox : rTableBoxes) { -if(eFlags == TBL_BOXPTR) -rBoxFormula.TryBoxNmToPtr(); -else if(eFlags == TBL_RELBOXNAME) -rBoxFormula.TryRelBoxNm(); -else -rBoxFormula.ChangeState(); +SwTableBoxFormat* pTableBoxFormat = static_cast(pTableBox->GetFrameFormat()); +if (const SwTableBoxFormula* pItem = pTableBoxFormat->GetItemIfSet( RES_BOXATR_FORMULA, false )) +{ +// SwTableBoxFormula is non-shareable, so const_cast is somewhat OK +auto & rBoxFormula = const_cast(*pItem); +if(eFlags == TBL_BOXPTR) +rBoxFormula.TryBoxNmToPtr(); +else if(eFlags == TBL_RELBOXNAME) +rBoxFormula.TryRelBoxNm(); +else +rBoxFormula.ChangeState(); +} } } }
core.git: Branch 'libreoffice-24-8' - sw/source
sw/source/core/crsr/crstrvl.cxx | 14 +++--- sw/source/core/doc/DocumentFieldsManager.cxx | 16 ++-- sw/source/core/doc/doc.cxx | 35 ++ sw/source/core/doc/docbasic.cxx |4 +-- sw/source/core/doc/docfmt.cxx|6 ++-- sw/source/core/doc/doctxm.cxx| 12 +++-- sw/source/core/doc/visiturl.cxx |7 ++--- sw/source/core/edit/edfld.cxx| 12 - sw/source/core/table/swtable.cxx | 19 ++ sw/source/core/undo/unattr.cxx |7 ++--- sw/source/core/unocore/unostyle.cxx |6 ++-- sw/source/core/view/vprint.cxx | 22 ++-- sw/source/filter/html/htmlflywriter.cxx | 26 --- sw/source/filter/ww8/rtfexport.cxx | 36 ++- sw/source/filter/ww8/wrtww8.cxx | 16 sw/source/uibase/utlui/content.cxx | 23 ++--- 16 files changed, 109 insertions(+), 152 deletions(-) New commits: commit a4723eca21657862188cbcc2d905f7052be5650f Author: Noel Grandin AuthorDate: Mon Jul 22 10:31:28 2024 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 9 12:35:38 2024 +0200 no need to dynamic_cast when using GetItemSurrogates since the items returned are guaranteed to be of the right type Change-Id: I7912c0ec171b4617a7ac393786f553a1f0b6c78e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170836 Reviewed-by: Noel Grandin Tested-by: Jenkins Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173034 diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index fd26d11823d8..effc825987c7 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -426,15 +426,13 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) for (const SfxPoolItem* pItem : aSurrogates) { const SwTableBox* pTBox; -auto pFormulaItem = dynamic_cast(pItem); -if( !pFormulaItem ) -continue; -pTBox = pFormulaItem->GetTableBox(); +auto & rFormulaItem = static_cast(*pItem); +pTBox = rFormulaItem.GetTableBox(); if( pTBox && pTBox->GetSttNd() && pTBox->GetSttNd()->GetNodes().IsDocNodes() && ( !bOnlyErrors || - !pFormulaItem->HasValidBoxes() ) ) + !rFormulaItem.HasValidBoxes() ) ) { SwNodeIndex aIdx( *pTBox->GetSttNd() ); const SwContentNode* pCNd = SwNodes::GoNext(&aIdx); @@ -535,10 +533,8 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) do { for (const SfxPoolItem* pItem : aSurrogates) { -auto pToxMarkItem = dynamic_cast(pItem); -if( !pToxMarkItem ) -continue; -pTextTOX = pToxMarkItem->GetTextTOXMark(); +auto & rToxMarkItem = static_cast(*pItem); +pTextTOX = rToxMarkItem.GetTextTOXMark(); if( !pTextTOX ) continue; pTextNd = &pTextTOX->GetTextNode(); diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index f58d3f6982af..a5594aa1f86d 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -619,9 +619,9 @@ void DocumentFieldsManager::UpdateTableFields(const SwTable* pTable) for (const SfxPoolItem* pItem : aSurrogates) { // SwTableBoxFormula is non-shareable, so const_cast is somewhat OK -auto pBoxFormula = const_cast(pItem->DynamicWhichCast(RES_BOXATR_FORMULA)); -if(pBoxFormula && pBoxFormula->GetDefinedIn()) -pBoxFormula->ChangeState(); +auto & rBoxFormula = const_cast(static_cast(*pItem)); +if(rBoxFormula.GetDefinedIn()) +rBoxFormula.ChangeState(); } SwRootFrame const* pLayout(nullptr); @@ -720,10 +720,10 @@ void DocumentFieldsManager::UpdateTableFields(const SwTable* pTable) for (const SfxPoolItem* pItem : aSurrogates) { // SwTableBoxFormula is non-shareable, so const_cast is somewhat OK -auto pFormula = const_cast(pItem->DynamicWhichCast(RES_BOXATR_FORMULA)); -if(!pFormula || !pFormula->GetDefinedIn() || pFormula->IsValid()) +auto & rFormula = const_cast(static_cast(*pItem)); +if(!rFormula.GetDefinedIn() || rFormula.IsValid()) continue; -SwTableBox* pBox = pFormula->GetTableBox(); +SwTableBox* pBox = rFormula.GetTableBox(); if(!pBox || !pBox->GetSttNd() || !pBox->GetSttNd()->GetNodes().IsDocNodes()) continue; c
core.git: sw/inc sw/source
sw/inc/doc.hxx |3 + sw/inc/tblafmt.hxx |1 sw/source/core/bastyp/init.cxx |2 - sw/source/core/doc/doc.cxx | 56 + sw/source/filter/ww8/rtfexport.cxx | 10 ++ 5 files changed, 65 insertions(+), 7 deletions(-) New commits: commit 5650b8a66231033a03ae9e4c35d5aaab907655d6 Author: Noel Grandin AuthorDate: Sun Sep 8 19:16:40 2024 +0200 Commit: Noel Grandin CommitDate: Mon Sep 9 07:58:31 2024 +0200 dont use GetItemSurrogates for gathering SvxOverlineItem which is very expensive these days Change-Id: I0ac24ba8ef4df9310b9e6ca5cfd7a132a61bb889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173049 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 80f29accb3dd..6da96bd2cb82 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1434,6 +1434,9 @@ public: /// Iterate over all SwFormatURL, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachFormatURL( const std::function& ) const; +/// Iterate over all SvxOverlineItem, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachOverlineItem( const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 16f84d8ad42c..a209eab50382 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -304,6 +304,7 @@ public: SwCellStyleDescriptor(const std::pair>& rCellStyleDesc) : m_rCellStyleDesc(rCellStyleDesc) { } const OUString& GetName() const { return m_rCellStyleDesc.first; } +const SwBoxAutoFormat& GetAutoFormat() const { return *m_rCellStyleDesc.second; } }; class SwCellStyleTable diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index a1d5908458b9..cc964e7aa01a 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -319,7 +319,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_SCALEW, new SvxCharScaleWidthItem( 100, RES_CHRATR_SCALEW ), SID_ATTR_CHAR_SCALEWIDTH, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_RELIEF, new SvxCharReliefItem( FontRelief::NONE, RES_CHRATR_RELIEF ), SID_ATTR_CHAR_RELIEF, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_HIDDEN, new SvxCharHiddenItem( false, RES_CHRATR_HIDDEN ), SID_ATTR_CHAR_HIDDEN, SFX_ITEMINFOFLAG_NONE }, -{ RES_CHRATR_OVERLINE, new SvxOverlineItem( LINESTYLE_NONE, RES_CHRATR_OVERLINE ), SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_CHRATR_OVERLINE, new SvxOverlineItem( LINESTYLE_NONE, RES_CHRATR_OVERLINE ), SID_ATTR_CHAR_OVERLINE, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_RSID, new SvxRsidItem( 0, RES_CHRATR_RSID ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_BOX, new SvxBoxItem( RES_CHRATR_BOX ), SID_ATTR_CHAR_BOX, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, { RES_CHRATR_SHADOW, new SvxShadowItem( RES_CHRATR_SHADOW ), SID_ATTR_CHAR_SHADOW, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 4214849e88a7..ec69fb2057d7 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -113,6 +114,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -1224,6 +1226,60 @@ static bool lcl_CheckSmartTagsAgain( SwNode* pNd, void* ) return true; } +/// Iterate over all SvxOverlineItem, if the function returns false, iteration is stopped +void SwDoc::ForEachOverlineItem( const std::function& rFunc ) const +{ +SwNodeOffset nCount = GetNodes().Count(); +for (SwNodeOffset i(0); i < nCount; ++i) +{ +SwNode* pNode = GetNodes()[i]; +if (!pNode->IsTextNode()) +continue; +SwTextNode* pTextNode = pNode->GetTextNode(); +const SwAttrSet& rAttrSet = pTextNode->GetSwAttrSet(); +if (const SvxOverlineItem* pItem = rAttrSet.GetItemIfSet(RES_CHRATR_OVERLINE, false)) +if (!rFunc(*pItem)) +return; +if (pTextNode->HasHints()) +{ +SwpHints& rHints = pTextNode->GetSwpHints(); +for (size_t j = 0; j < rHints.Count(); ++j) +{ +const SwTextAttr* pTextAttr = rHints.Get(j); +if (pTextAttr->Which() != RES_TXTATR_AUTOFMT) +continue; +const SwFormatAutoFormat& rAutoFormat = pTextAttr->GetAutoFormat(); +const std::shared_ptr & rxItemSet = rAutoFormat.GetStyleHandle(); +if (const SvxOverlineItem* pItem = rxItemSet->GetItemIfSet(RES_CHRATR_OVERLINE, false)) +if (!rFunc(*pItem)
core.git: sw/inc sw/source
sw/inc/doc.hxx |3 ++ sw/source/core/bastyp/init.cxx |2 - sw/source/core/doc/doc.cxx | 13 sw/source/filter/html/htmlflywriter.cxx | 27 - sw/source/filter/ww8/wrtww8.cxx | 34 +++- 5 files changed, 46 insertions(+), 33 deletions(-) New commits: commit 68566c28b962bf46d3ffc30c635efb37df19a58e Author: Noel Grandin AuthorDate: Sun Sep 8 10:29:21 2024 +0200 Commit: Noel Grandin CommitDate: Sun Sep 8 18:01:22 2024 +0200 dont use GetItemSurrogates for gathering SwFormatURL which is very expensive these days Change-Id: I6dbd6d1c66cd28c4f916842cd95f000215e52bc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173033 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index e15ba644a546..80f29accb3dd 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1431,6 +1431,9 @@ public: /// Iterate over all SwFormatINetFormat, if the function returns false, iteration is stopped SW_DLLPUBLIC void ForEachINetFormat( const std::function& ) const; +/// Iterate over all SwFormatURL, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachFormatURL( const std::function& ) const; + // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 123a893df3e4..a1d5908458b9 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -413,7 +413,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_FRMMACRO, new SvxMacroItem( RES_FRMMACRO ), SID_ATTR_MACROITEM, SFX_ITEMINFOFLAG_NONE }, { RES_COL, new SwFormatCol, FN_ATTR_COLUMNS, SFX_ITEMINFOFLAG_NONE }, { RES_KEEP, new SvxFormatKeepItem( false, RES_KEEP ), SID_ATTR_PARA_KEEP, SFX_ITEMINFOFLAG_NONE }, -{ RES_URL, new SwFormatURL(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_URL, new SwFormatURL(), 0, SFX_ITEMINFOFLAG_NONE }, { RES_EDIT_IN_READONLY, new SwFormatEditInReadonly, 0, SFX_ITEMINFOFLAG_NONE }, { RES_LAYOUT_SPLIT, new SwFormatLayoutSplit, 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHAIN, new SwFormatChain, 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index a52d1efd8f49..4214849e88a7 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -112,6 +112,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -1312,6 +1313,18 @@ void SwDoc::ForEachINetFormat( const std::function& rFunc ) const +{ +for(sw::SpzFrameFormat* pSpz : *GetSpzFrameFormats()) +{ +auto pFormat = static_cast(pSpz); +const SwFormatURL& rURLItem = pFormat->GetURL(); +if (!rFunc(rURLItem)) +return; +} +} + void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress) { const SwOutlineNodes& rOutNds = GetNodes().GetOutLineNds(); diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index a2ea1f86a35a..4269e675e895 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -2247,25 +2247,24 @@ void SwHTMLWriter::CollectLinkTargets() return true; }); -ItemSurrogates aSurrogates; -m_pDoc->GetAttrPool().GetItemSurrogates(aSurrogates, RES_URL); -for (const SfxPoolItem* pItem : aSurrogates) -{ -const auto & rURL = static_cast(*pItem); -AddLinkTarget( rURL.GetURL() ); -const ImageMap *pIMap = rURL.GetMap(); -if( pIMap ) +m_pDoc->ForEachFormatURL( +[this] (const SwFormatURL& rURL) -> bool { -for( size_t i=0; iGetIMapObjectCount(); ++i ) +AddLinkTarget( rURL.GetURL() ); +const ImageMap *pIMap = rURL.GetMap(); +if( pIMap ) { -const IMapObject* pObj = pIMap->GetIMapObject( i ); -if( pObj ) +for( size_t i=0; iGetIMapObjectCount(); ++i ) { -AddLinkTarget( pObj->GetURL() ); +const IMapObject* pObj = pIMap->GetIMapObject( i ); +if( pObj ) +{ +AddLinkTarget( pObj->GetURL() ); +} } } -} -} +return true; +}); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b2cfddd9c58d..2d476ead766b 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3375,25 +3375,23 @@ void MSWordExpo
core.git: 2 commits - sw/inc sw/source
sw/inc/doc.hxx |2 + sw/source/core/bastyp/init.cxx |4 +- sw/source/core/doc/doc.cxx | 42 + sw/source/core/doc/docbasic.cxx | 19 ++--- sw/source/core/doc/visiturl.cxx | 46 +--- sw/source/core/unocore/unostyle.cxx | 39 --- sw/source/filter/html/htmlflywriter.cxx | 19 +++-- sw/source/filter/ww8/wrtww8.cxx | 26 -- 8 files changed, 99 insertions(+), 98 deletions(-) New commits: commit 7f50471615fb1b083e6c4735892359d269573e81 Author: Noel Grandin AuthorDate: Sat Sep 7 20:44:40 2024 +0200 Commit: Noel Grandin CommitDate: Sun Sep 8 08:38:48 2024 +0200 dont use GetItemSurrogates for gathering SwFormatINetFormat which is very expensive these days Change-Id: I7b552d9fec5e2971bb3c171b7dd132ee31b1a46e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173004 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index e09e51aeb0ca..e15ba644a546 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1428,6 +1428,8 @@ public: void DeleteAutoCorrExceptWord(); const SwFormatINetFormat* FindINetAttr( std::u16string_view rName ) const; +/// Iterate over all SwFormatINetFormat, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachINetFormat( const std::function& ) const; // Call into intransparent Basic; expect possible Return String. void ExecMacro( const SvxMacro& rMacro, OUString* pRet, SbxArray* pArgs ); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 0902b3fa3dad..123a893df3e4 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -340,7 +340,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() // is not initialized and the translated resource strings would not be available. // Luckily this mechanism allows to also flag this ItemInfo as 'incomplete' using // a nullptr as ItemPtr and implementing on-demand creation, see ::getItemInfo -{ RES_TXTATR_INETFMT, nullptr, FN_TXTATR_INET, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_TXTATR_INETFMT, nullptr, FN_TXTATR_INET, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_CHARFMT, new SwFormatCharFormat( nullptr ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_CJK_RUBY, new SwFormatRuby( OUString() ), SID_ATTR_CHAR_CJK_RUBY, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 3eea7da62079..a52d1efd8f49 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1273,23 +1273,43 @@ void SwDoc::InvalidateAutoCompleteFlag() const SwFormatINetFormat* SwDoc::FindINetAttr( std::u16string_view rName ) const { -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurrogates, RES_TXTATR_INETFMT); -for (const SfxPoolItem* pItem : aSurrogates) +const SwFormatINetFormat* pRet = nullptr; +ForEachINetFormat( +[&pRet, &rName] (const SwFormatINetFormat& rFormatItem) -> bool +{ +if( rFormatItem.GetName() == rName ) +{ +pRet = &rFormatItem; +return false; +}; +return true; +}); +return pRet; +} + +/// Iterate over all SwFormatINetFormat, if the function returns false, iteration is stopped +void SwDoc::ForEachINetFormat( const std::function& rFunc ) const +{ +SwNodeOffset nCount = GetNodes().Count(); +for (SwNodeOffset i(0); i < nCount; ++i) { -const auto & rFormatItem = static_cast(*pItem); -if( rFormatItem.GetName() != rName ) +SwNode* pNode = GetNodes()[i]; +if (!pNode->IsTextNode()) continue; -const SwTextINetFormat* pTextAttr = rFormatItem.GetTextINetFormat(); -if( !pTextAttr ) +SwTextNode* pTextNode = pNode->GetTextNode(); +if (!pTextNode->HasHints()) continue; -const SwTextNode* pTextNd = pTextAttr->GetpTextNode(); -if( pTextNd && &pTextNd->GetNodes() == &GetNodes() ) +SwpHints& rHints = pTextNode->GetSwpHints(); +for (size_t j = 0; j < rHints.Count(); ++j) { -return &rFormatItem; +const SwTextAttr* pTextAttr = rHints.Get(j); +if (pTextAttr->Which() != RES_TXTATR_INETFMT) +continue; +const SwFormatINetFormat& rFormat = pTextAttr->GetINetFormat(); +if (!rFunc(rFormat)) +return; } } -return nullptr; } void SwDoc::Summary(SwDoc& rExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bImpress) diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx index 39cd7fe8f000..59d055e45ea8 100644 --- a/sw/source/core/doc/docbasic.
core.git: sw/inc sw/source
sw/inc/doc.hxx |2 + sw/source/core/bastyp/init.cxx |2 - sw/source/core/crsr/crstrvl.cxx | 17 ++ sw/source/core/doc/doctxm.cxx | 64 +++- 4 files changed, 58 insertions(+), 27 deletions(-) New commits: commit 774b578c65c2443f2ea2b95bc6402a49f0020ea0 Author: Noel Grandin AuthorDate: Sat Sep 7 19:17:24 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 7 20:45:22 2024 +0200 dont use GetItemSurrogates for gathering SwTOXMark which is very expensive these days Change-Id: I412c30310f001a7b7c9350a7e0da62bdcddc498c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173001 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index a8fdadfd4b06..e09e51aeb0ca 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -937,6 +937,8 @@ public: void DeleteTOXMark( const SwTOXMark* pTOXMark ); SW_DLLPUBLIC const SwTOXMark& GotoTOXMark( const SwTOXMark& rCurTOXMark, SwTOXSearch eDir, bool bInReadOnly ); +/// Iterate over all SwTOXMark, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachTOXMark( const std::function& ) const; // Insert/Renew table/index SW_DLLPUBLIC SwTOXBaseSection* InsertTableOf( const SwPosition& rPos, diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index bfe8f4d8833f..c4ba7f2a4394 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -331,7 +331,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_IDCTHINT, new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_REFMARK, new SwFormatRefMark( OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_META, SwFormatMeta::CreatePoolDefault(RES_TXTATR_META), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_METAFIELD, SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_AUTOFMT, new SwFormatAutoFormat, 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index dd30f73f88dc..96899a9db013 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -519,10 +519,13 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) GetContentNode()->getLayoutFrame(GetLayout(), &rPos, &tmp)); } -const SwTextNode* pTextNd; -const SwTextTOXMark* pTextTOX; -ItemSurrogates aSurrogates; -GetDoc()->GetAttrPool().GetItemSurrogates(aSurrogates, RES_TXTATR_TOXMARK); +std::vector aSurrogates; +GetDoc()->ForEachTOXMark( +[&aSurrogates] (const SwTOXMark& rItem) -> bool +{ +aSurrogates.push_back(&rItem); +return true; +}); const sal_uInt32 nMaxItems(aSurrogates.size()); if( nMaxItems == 0 ) { @@ -530,10 +533,12 @@ bool SwCursorShell::GotoNxtPrvTOXMark( bool bNext ) return false; } +const SwTextNode* pTextNd; +const SwTextTOXMark* pTextTOX; do { -for (const SfxPoolItem* pItem : aSurrogates) +for (const SwTOXMark* pItem : aSurrogates) { -auto & rToxMarkItem = static_cast(*pItem); +auto & rToxMarkItem = *pItem; pTextTOX = rToxMarkItem.GetTextTOXMark(); if( !pTextTOX ) continue; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 7985233d1f9c..9f9f245a758c 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -83,34 +83,58 @@ MakeSwTOXSortTabBase(SwRootFrame const*const pLayout, Args&& ... args) return pRet; } +/// Iterate over all SwTOXMark, if the function returns false, iteration is stopped +void SwDoc::ForEachTOXMark( const std::function& rFunc ) const +{ +SwNodeOffset nCount = GetNodes().Count(); +for (SwNodeOffset i(0); i < nCount; ++i) +{ +SwNode* pNode = GetNodes()[i]; +if (!pNode->IsTextNode()) +continue; +SwTextNode* pTextNode = pNode->GetTextNode(); +if (!pTextNode->HasHints()) +continue; +SwpHints& rHints = pTextNode->GetSwpHints(); +for (size_t j = 0; j < rHints.Count(); ++j) +{ +const SwTextAttr* pTextAttr = rHints.Get(j); +if (pTextAttr->Which() != RES_TXTATR_TOXMARK) +continue; +const SwTOXMark& rToxMark = pTextAttr->GetTOXMark(); +if (!rFunc(rToxMark)) +return; +} +} +} + void SwDoc::GetTOIKeys(SwTOIKeyType eTyp, std::vector& rArr,
core.git: sw/inc sw/source
sw/inc/doc.hxx |2 sw/source/core/bastyp/init.cxx |2 sw/source/core/doc/doc.cxx | 89 + sw/source/core/undo/unattr.cxx | 23 - sw/source/uibase/utlui/content.cxx | 65 --- 5 files changed, 94 insertions(+), 87 deletions(-) New commits: commit ad74339c052667b4d10fc655e1753db92420e2bb Author: Noel Grandin AuthorDate: Sat Sep 7 15:52:03 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 7 19:18:15 2024 +0200 dont use GetItemSurrogates for gathering SwFormatRefMark which is very expensive these days Change-Id: I8698d3bb9a7d49a5444ed901859f636647e4d116 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172996 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 2652b56882f9..a8fdadfd4b06 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1333,6 +1333,8 @@ public: If array pointer is 0 return only whether a RefMark is set in document. */ SW_DLLPUBLIC sal_uInt16 GetRefMarks( std::vector* = nullptr ) const; SW_DLLPUBLIC void GetRefMarks( std::vector& ) const; +/// Iterate over all SwFormatRefMark, if the function returns false, iteration is stopped +SW_DLLPUBLIC void ForEachRefMark( const std::function& ) const; void DeleteFormatRefMark(const SwFormatRefMark* pFormatRefMark); diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index c673a1a2729b..bfe8f4d8833f 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -330,7 +330,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_CHRATR_BIDIRTL, new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_IDCTHINT, new SfxInt16Item( RES_CHRATR_IDCTHINT, sal_Int16(-1) ), 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_TXTATR_REFMARK, new SwFormatRefMark( OUString() ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_TXTATR_REFMARK, new SwFormatRefMark( OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, { RES_TXTATR_META, SwFormatMeta::CreatePoolDefault(RES_TXTATR_META), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_METAFIELD, SwFormatMeta::CreatePoolDefault(RES_TXTATR_METAFIELD), 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index ae631735138f..3eea7da62079 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1071,17 +1071,19 @@ void SwDoc::CalculatePagePairsForProspectPrinting( /// @return the reference in the doc for the name const SwFormatRefMark* SwDoc::GetRefMark( std::u16string_view rName ) const { -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurrogates, RES_TXTATR_REFMARK); -for (const SfxPoolItem* pItem : aSurrogates) -{ -const auto & rFormatRef = static_cast(*pItem); -const SwTextRefMark* pTextRef = rFormatRef.GetTextRefMark(); -if( pTextRef && &pTextRef->GetTextNode().GetNodes() == &GetNodes() && -rName == rFormatRef.GetRefName() ) -return &rFormatRef; -} -return nullptr; +const SwFormatRefMark* pRet = nullptr; +ForEachRefMark( +[&pRet, &rName] (const SwFormatRefMark& rRefMark) -> bool +{ +const SwTextRefMark* pTextRef = rRefMark.GetTextRefMark(); +if( pTextRef && rName == rRefMark.GetRefName() ) +{ +pRet = &rRefMark; +return false; +} +return true; +}); +return pRet; } /// @return the RefMark per index - for Uno @@ -1090,22 +1092,17 @@ const SwFormatRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const const SwFormatRefMark* pRet = nullptr; sal_uInt32 nCount = 0; -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurrogates, RES_TXTATR_REFMARK); -for (const SfxPoolItem* pItem : aSurrogates) -{ -const auto & rRefMark = static_cast(*pItem); -const SwTextRefMark* pTextRef = rRefMark.GetTextRefMark(); -if( pTextRef && &pTextRef->GetTextNode().GetNodes() == &GetNodes() ) +ForEachRefMark( +[&nCount, &pRet, &nIndex] (const SwFormatRefMark& rRefMark) -> bool { if(nCount == nIndex) { pRet = &rRefMark; -break; +return false; } nCount++; -} -} +return true; +}); return pRet; } @@ -1115,13 +1112,8 @@ const SwFormatRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const sal_uInt16 SwDoc::GetRefMarks( std::vector* pNames ) const { sal_uInt16 nCount = 0; -ItemSurrogates aSurrogates; -GetAttrPool().GetItemSurrogates(aSurroga
core.git: sw/inc
sw/inc/swtblfmt.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ca5113d4f862700a3b97f7fe98a720e084ecec0e Author: Noel Grandin AuthorDate: Sat Sep 7 09:37:22 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 7 12:31:07 2024 +0200 fix asan build Change-Id: Ie7970629bcf09b8b9c0f4c052d0a9187d56d9d8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172988 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx index d951196728ac..28e15e26e060 100644 --- a/sw/inc/swtblfmt.hxx +++ b/sw/inc/swtblfmt.hxx @@ -37,7 +37,7 @@ public: virtual bool supportsFullDrawingLayerFillAttributeSet() const override; }; -class SwTableLineFormat final : public SwFrameFormat +class SAL_DLLPUBLIC_RTTI SwTableLineFormat final : public SwFrameFormat { friend class SwDoc;
core.git: sw/inc sw/source
sw/inc/swtable.hxx |2 +- sw/source/core/doc/tblrwcl.cxx | 10 +- sw/source/core/docnode/ndtbl.cxx |7 +++ sw/source/core/table/swtable.cxx |2 +- sw/source/filter/xml/xmltbli.cxx |4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) New commits: commit 713592e2503c7fb2acfc713b9db2c15cd2ec806d Author: Noel Grandin AuthorDate: Fri Sep 6 15:57:41 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 7 09:34:11 2024 +0200 return SwTableBoxFormat from SwTableBox::ClaimFrameFormat since that is always the SwFrameFormat subclass we are attached to Change-Id: If4bcff17d3983f1fc55b4a25c7c4e40e9087a1a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172972 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index dc156ded1b30..c28ce241a8f1 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -492,7 +492,7 @@ public: bool HasDirectFormatting() const { return mbDirectFormatting; } // Creates its own FrameFormat if more boxes depend on it. -SwFrameFormat* ClaimFrameFormat(); +SwTableBoxFormat* ClaimFrameFormat(); void ChgFrameFormat( SwTableBoxFormat *pNewFormat, bool bNeedToReregister = true ); void RemoveFromTable(); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 13dc1a20250b..bc1333591853 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -227,7 +227,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) if( itFind == pCpyPara->rTabFrameArr.end() || !(*itFind == aFindFrame) ) { // For nested copying, also save the new Format as an old one. -SwTableBoxFormat* pNewFormat = static_cast(pBox->ClaimFrameFormat()); +SwTableBoxFormat* pNewFormat = pBox->ClaimFrameFormat(); // Find the selected Boxes in the Line: FndLine_ const* pCmpLine = nullptr; @@ -1090,7 +1090,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn SwTableBoxFormat* pCpyBoxFrameFormat = pSelBox->GetFrameFormat(); bool bChkBorder = nullptr != pCpyBoxFrameFormat->GetBox().GetTop(); if( bChkBorder ) -pCpyBoxFrameFormat = static_cast(pSelBox->ClaimFrameFormat()); +pCpyBoxFrameFormat = pSelBox->ClaimFrameFormat(); for( sal_uInt16 i = 0; i <= nCnt; ++i ) { @@ -1116,7 +1116,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn if( bChkBorder ) { -pCpyBoxFrameFormat = static_cast(pNewLine->GetTabBoxes()[ 0 ]->ClaimFrameFormat()); +pCpyBoxFrameFormat = pNewLine->GetTabBoxes()[ 0 ]->ClaimFrameFormat(); SvxBoxItem aTmp( pCpyBoxFrameFormat->GetBox() ); aTmp.SetLine( nullptr, SvxBoxItemLine::TOP ); pCpyBoxFrameFormat->SetFormatAttr( aTmp ); @@ -1139,7 +1139,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } // In Boxes with Lines, we can only have Size/Fillorder -pFrameFormat = static_cast(pNewBox->ClaimFrameFormat()); +pFrameFormat = pNewBox->ClaimFrameFormat(); pFrameFormat->ResetFormatAttr( RES_LR_SPACE, RES_FRMATR_END - 1 ); pFrameFormat->ResetFormatAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 ); } @@ -1201,7 +1201,7 @@ bool SwTable::SplitCol(SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt) if( itFind == aFrameArr.end() || !(*itFind == aFindFrame) ) { // Change the FrameFormat -aFindFrame.pNewFrameFormat = static_cast(pSelBox->ClaimFrameFormat()); +aFindFrame.pNewFrameFormat = pSelBox->ClaimFrameFormat(); SwTwips nBoxSz = aFindFrame.pNewFrameFormat->GetFrameSize().GetWidth(); SwTwips nNewBoxSz = nBoxSz / ( nCnt + 1 ); aFindFrame.pNewFrameFormat->SetFormatAttr( SwFormatFrameSize( SwFrameSize::Variable, diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index f5f3483ec914..b36fd35dba4b 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -4147,7 +4147,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) if( bSetNumberFormat || bForceNumberFormat ) { -pBoxFormat = static_cast(rBox.ClaimFrameFormat()); +pBoxFormat = rBox.ClaimFrameFormat(); aBoxSet.Put( SwTableBoxValue( fNumber )); aBoxSet.Put( SwTableBoxNumFormat( nFormatIdx )); @@ -4183,7 +4183,7 @@ void SwDoc::ChkBoxNumFormat( SwTableBox& rBox, bool bCallUpdate ) pUndo.reset(new SwUndoTableNumFormat( rBox )); } -pBoxFormat = static_cast(rBox.ClaimFr
core.git: 2 commits - sw/inc sw/source
sw/inc/dcontact.hxx |6 ++-- sw/inc/swtable.hxx |2 + sw/source/core/bastyp/init.cxx |2 - sw/source/core/crsr/crstrvl.cxx | 10 +++ sw/source/core/doc/DocumentFieldsManager.cxx | 19 ++ sw/source/core/doc/docdraw.cxx |7 ++--- sw/source/core/doc/doclay.cxx|2 - sw/source/core/table/swnewtable.cxx |6 ++-- sw/source/core/table/swtable.cxx | 35 --- sw/source/core/undo/undraw.cxx |4 +-- 10 files changed, 54 insertions(+), 39 deletions(-) New commits: commit c659d65ce1c980bbf836ce95fbdb3729bf3234f1 Author: Noel Grandin AuthorDate: Fri Sep 6 13:41:22 2024 +0200 Commit: Noel Grandin CommitDate: Sat Sep 7 09:33:33 2024 +0200 dont use GetItemSurrogates for gathering SwTableBoxFormula which is very expensive these days Change-Id: If7ab76173e2b17fe767042a9461969babc16cb6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172965 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 7bc3ed0439ac..dc156ded1b30 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -368,6 +368,8 @@ public: void Merge(SwTable& rTable, SwHistory* pHistory); void Split(OUString sNewTableName, sal_uInt16 nSplitLine, SwHistory* pHistory); +static void GatherFormulas(SwDoc& rDoc, std::vector& rvFormulas); + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 2ec1f2266aa2..c673a1a2729b 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -455,7 +455,7 @@ ItemInfoPackage& getItemInfoPackageSwAttributes() { RES_GRFATR_DUMMY4, new SfxBoolItem( RES_GRFATR_DUMMY4 ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_GRFATR_DUMMY5, new SfxBoolItem( RES_GRFATR_DUMMY5 ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_BOXATR_FORMAT, new SwTableBoxNumFormat, 0, SFX_ITEMINFOFLAG_NONE }, -{ RES_BOXATR_FORMULA, new SwTableBoxFormula( OUString() ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE }, +{ RES_BOXATR_FORMULA, new SwTableBoxFormula( OUString() ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_BOXATR_VALUE, new SwTableBoxValue, 0, SFX_ITEMINFOFLAG_NONE }, { RES_UNKNOWNATR_CONTAINER, new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ), 0, SFX_ITEMINFOFLAG_SUPPORT_SURROGATE } }}; diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index b2d640b8d695..dd30f73f88dc 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -416,17 +416,17 @@ bool SwCursorShell::GotoNxtPrvTableFormula( bool bNext, bool bOnlyErrors ) &rPos, &tmp) ); } -ItemSurrogates aSurrogates; -GetDoc()->GetAttrPool().GetItemSurrogates(aSurrogates, RES_BOXATR_FORMULA); -const sal_uInt32 nMaxItems(aSurrogates.size()); +std::vector aTableBoxFormulas; +SwTable::GatherFormulas(*GetDoc(), aTableBoxFormulas); +const sal_uInt32 nMaxItems(aTableBoxFormulas.size()); if( nMaxItems > 0 ) { sal_uInt8 nMaxDo = 2; do { -for (const SfxPoolItem* pItem : aSurrogates) +for (SwTableBoxFormula* pItem : aTableBoxFormulas) { const SwTableBox* pTBox; -auto & rFormulaItem = static_cast(*pItem); +auto & rFormulaItem = *pItem; pTBox = rFormulaItem.GetTableBox(); if( pTBox && pTBox->GetSttNd() && diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index d270ef6618d0..6b684dae4b73 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -614,14 +614,12 @@ void DocumentFieldsManager::UpdateTableFields(const SwTable* pTable) } } // process all table box formulas -ItemSurrogates aSurrogates; -m_rDoc.GetAttrPool().GetItemSurrogates(aSurrogates, RES_BOXATR_FORMULA); -for (const SfxPoolItem* pItem : aSurrogates) +std::vector aTableBoxFormulas; +SwTable::GatherFormulas(m_rDoc, aTableBoxFormulas); +for (SwTableBoxFormula* pBoxFormula : aTableBoxFormulas) { -// SwTableBoxFormula is non-shareable, so const_cast is somewhat OK -auto & rBoxFormula = const_cast(static_cast(*pItem)); -if(rBoxFormula.GetDefinedIn()) -rBoxFormula.ChangeState(); +if(pBoxFormula->GetDefinedIn()) +pBoxFormula->ChangeState(); } SwRootFrame const* pLayout(nullptr); @@ -716,11 +714,10 @@ void DocumentFieldsManager::UpdateTableFields(const SwTable* pTable) } // calculate the formula at the boxes -m_rDoc.GetAttrPool().G
core.git: sw/source
sw/source/core/table/swtable.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 42241fe7c59251c6bae2122ebcdf0c451bc66c46 Author: Noel Grandin AuthorDate: Fri Sep 6 15:40:45 2024 +0200 Commit: Xisco Fauli CommitDate: Sat Sep 7 00:35:49 2024 +0200 loplugin:redundantcast two of my patches landed close together, and the one caused a clang warning in the other commit 7b16c7db04affde593bfaf75965c4271e4c3ea58 Author: Noel Grandin Date: Wed Sep 4 20:02:14 2024 +0200 use less GetItemSurrogates in SwTable::UpdateFields commit edc20f4d34d102b385ece53a60abad0047661661 Author: Noel Grandin Date: Thu Sep 5 19:30:48 2024 +0200 return SwTableBoxFormat from SwTableBox::GetFrameFormat Change-Id: I49a00ad27e3e8bcb86e16d8ed81f35116a785aea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172971 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 86ea1ae74488..e4d066e4c22d 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1721,7 +1721,7 @@ void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags) SwTableBoxes& rTableBoxes = pTableLine->GetTabBoxes(); for (SwTableBox* pTableBox : rTableBoxes) { -SwTableBoxFormat* pTableBoxFormat = static_cast(pTableBox->GetFrameFormat()); +SwTableBoxFormat* pTableBoxFormat = pTableBox->GetFrameFormat(); if (const SwTableBoxFormula* pItem = pTableBoxFormat->GetItemIfSet( RES_BOXATR_FORMULA, false )) { // SwTableBoxFormula is non-shareable, so const_cast is somewhat OK
core.git: include/svx sd/source svx/source
include/svx/svdmodel.hxx |8 +++--- sd/source/filter/pdf/sdpdffilter.cxx |4 ++- svx/source/svdraw/svdmodel.cxx | 46 ++- 3 files changed, 31 insertions(+), 27 deletions(-) New commits: commit ad3fa69eeb89573c77feba64dab3380154a90953 Author: Noel Grandin AuthorDate: Fri Sep 6 12:55:26 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 6 14:48:17 2024 +0200 reduce time spent in RecalcPageNums when importing PDF when we have lots of pages, we trigger a O(n^2) loop. Do two things to reduce this (a) be smarter about recalculating page numbers, so we only recalculate the set of page numbers that need recalculating (b) duplicate the last page repeatedly, instead of the first page, so we don't recalculate all the page numbers for each page we duplicate Change-Id: I40aca812b47a9551039c5855b1c8d26f5f171f41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172942 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 3da5a865fe13..b0d8bd7b36a5 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -199,12 +199,12 @@ protected: std::deque> m_aRedoStack; std::unique_ptr m_pCurrentUndoGroup; // For multi-level sal_uInt16 m_nUndoLevel; // undo nesting +sal_uInt16 m_nPageNumsDirtyFrom = SAL_MAX_UINT16; +sal_uInt16 m_nMasterPageNumsDirtyFrom = SAL_MAX_UINT16; boolm_bIsWriter:1;// to clean up pMyPool from 303a boolm_bThemedControls:1; // If false UnoControls should not use theme colors boolmbUndoEnabled:1; // If false no undo is recorded or we are during the execution of an undo action boolmbChanged:1; -boolm_bPagNumsDirty:1; -boolm_bMPgNumsDirty:1; boolm_bTransportContainer:1; // doc is temporary object container, no display (e.g. clipboard) boolm_bReadOnly:1; boolm_bTransparentTextFrames:1; @@ -397,8 +397,8 @@ public: static OUString GetPercentString(const Fraction& rVal); // RecalcPageNums is ordinarily only called by the Page. -bool IsPagNumsDirty() const { return m_bPagNumsDirty; }; -bool IsMPgNumsDirty() const { return m_bMPgNumsDirty; }; +bool IsPagNumsDirty() const { return m_nPageNumsDirtyFrom != SAL_MAX_UINT16; } +bool IsMPgNumsDirty() const { return m_nMasterPageNumsDirtyFrom != SAL_MAX_UINT16; } void RecalcPageNums(bool bMaster); // After the Insert the Page belongs to the SdrModel. virtual void InsertPage(SdrPage* pPage, sal_uInt16 nPos=0x); diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx index 9e6597ce..068aca1fcce9 100644 --- a/sd/source/filter/pdf/sdpdffilter.cxx +++ b/sd/source/filter/pdf/sdpdffilter.cxx @@ -65,9 +65,11 @@ bool SdPdfFilter::Import() // Add as many pages as we need up-front. mrDocument.CreateFirstPages(); +sal_uInt16 nPageToDuplicate = 0; for (size_t i = 0; i < aGraphics.size() - 1; ++i) { -mrDocument.DuplicatePage(0); +// duplicating the last page is cheaper than repeatedly duplicating the first one +nPageToDuplicate = mrDocument.DuplicatePage(nPageToDuplicate); } for (vcl::PDFGraphicResult const& rPDFGraphicResult : aGraphics) diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index e13f1025430a..45bb96a2177b 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -132,8 +132,6 @@ SdrModel::SdrModel(SfxItemPool* pPool, comphelper::IEmbeddedHelper* pEmbeddedHel , m_bThemedControls(true) , mbUndoEnabled(true) , mbChanged(false) -, m_bPagNumsDirty(false) -, m_bMPgNumsDirty(false) , m_bTransportContainer(false) , m_bReadOnly(false) , m_bTransparentTextFrames(false) @@ -1175,23 +1173,27 @@ void SdrModel::RecalcPageNums(bool bMaster) { if(bMaster) { -sal_uInt16 nCount=sal_uInt16(maMasterPages.size()); -sal_uInt16 i; -for (i=0; iSetPageNum(i); +if (m_nMasterPageNumsDirtyFrom != SAL_MAX_UINT16) +{ +sal_uInt16 nCount=sal_uInt16(maMasterPages.size()); +for (sal_uInt16 i=m_nMasterPageNumsDirtyFrom; iSetPageNum(i); +} +m_nMasterPageNumsDirtyFrom = SAL_MAX_UINT16; } -m_bMPgNumsDirty=false; } else { -sal_uInt16 nCount=sal_uInt16(maPages.size()); -sal_uInt16 i; -for (i=0; iSetPageNum(i); +if (m_nPageNumsDirtyFrom != SAL_MAX_UINT16) +{ +sal_uInt16 nCount=sal
core.git: sw/inc sw/source
sw/inc/swtable.hxx |6 +++--- sw/source/core/doc/tblrwcl.cxx | 10 +- sw/source/core/docnode/ndcopy.cxx |2 +- sw/source/core/layout/tabfrm.cxx|2 +- sw/source/core/table/swnewtable.cxx |2 +- sw/source/core/table/swtable.cxx|4 ++-- sw/source/filter/html/htmltab.cxx |8 sw/source/filter/xml/xmltbli.cxx|2 +- 8 files changed, 18 insertions(+), 18 deletions(-) New commits: commit 7abbdb5eb30d269fcdd97eab9dcf0b7f5526c880 Author: Noel Grandin AuthorDate: Fri Sep 6 12:04:26 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 6 14:07:22 2024 +0200 return SwTableLineFormat from SwTableLine::GetFrameFormat since that is always the SwFrameFormat subclass we are attached to Change-Id: I02645ac4ab5078e5fd201fef5fdae5232652a9f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172939 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 368665e5008c..7bc3ed0439ac 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -395,11 +395,11 @@ public: const SwTableBox *GetUpper() const { return m_pUpper; } void SetUpper( SwTableBox *pNew ) { m_pUpper = pNew; } -SwFrameFormat* GetFrameFormat() { return static_cast(GetRegisteredIn()); } -SwFrameFormat* GetFrameFormat() const { return const_cast(static_cast(GetRegisteredIn())); } +SwTableLineFormat* GetFrameFormat() { return static_cast(GetRegisteredIn()); } +SwTableLineFormat* GetFrameFormat() const { return const_cast(static_cast(GetRegisteredIn())); } // Creates an own FrameFormat if more lines depend on it. -SwFrameFormat* ClaimFrameFormat(); +SwTableLineFormat* ClaimFrameFormat(); void ChgFrameFormat( SwTableLineFormat* pNewFormat ); // Search next/previous box with content. diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index e71982fd6077..13dc1a20250b 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -349,7 +349,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) static SwTableLine* lcl_CopyRow(FndLine_& rFndLine, CpyPara *const pCpyPara) { SwTableLine* pNewLine = new SwTableLine( - static_cast(rFndLine.GetLine()->GetFrameFormat()), +rFndLine.GetLine()->GetFrameFormat(), rFndLine.GetBoxes().size(), pCpyPara->pInsBox ); if( pCpyPara->pInsBox ) { @@ -1096,7 +1096,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn { // Create a new Line in the new Box SwTableLine* pNewLine = new SwTableLine( - static_cast(pInsLine->GetFrameFormat()), 1, pNewBox ); +pInsLine->GetFrameFormat(), 1, pNewBox ); if( bChgLineSz ) { pNewLine->ClaimFrameFormat()->SetFormatAttr( aFSz ); @@ -1471,7 +1471,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara) SwTableBox* pLMBox = new SwTableBox( pULPara->pLeftBox->GetFrameFormat(), 0, pInsLine ); SwTableLine* pLMLn = new SwTableLine( - static_cast(pInsLine->GetFrameFormat()), 2, pLMBox ); +pInsLine->GetFrameFormat(), 2, pLMBox ); pLMLn->ClaimFrameFormat()->ResetFormatAttr( RES_FRM_SIZE ); pLMBox->GetTabLines().insert( pLMBox->GetTabLines().begin(), pLMLn ); @@ -1505,7 +1505,7 @@ static void lcl_Merge_MoveLine(FndLine_& rFndLine, InsULPara *const pULPara) pLines = &pULPara->pInsBox->GetTabLines(); SwTableLine* pNewLine = new SwTableLine( -static_cast(rFndLine.GetLine()->GetFrameFormat()), 0, pULPara->pInsBox ); +rFndLine.GetLine()->GetFrameFormat(), 0, pULPara->pInsBox ); InsULPara aPara( *pULPara ); // copying aPara.pInsLine = pNewLine; FndBoxes_t & rLineBoxes = rFndLine.GetBoxes(); @@ -1566,7 +1566,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, } SwTableLine* pInsLine = new SwTableLine( - static_cast(pFndBox->GetLines().front()->GetLine()->GetFrameFormat()), 0, +pFndBox->GetLines().front()->GetLine()->GetFrameFormat(), 0, !pFndBox->GetUpper() ? nullptr : pFndBox->GetBox() ); pInsLine->ClaimFrameFormat()->ResetFormatAttr( RES_FRM_SIZE ); diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 142de524f5be..df894cda0aba 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -213,7 +213,7 @@ static void lcl_CopyTableBox( SwTableBox* pBox, CopyTable* pCT ) static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT ) { -SwTableLineFormat * pLineFormat = static_cast(pLine->GetFrameFormat()); +
core.git: sw/source
sw/source/core/table/swtable.cxx | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) New commits: commit 7b16c7db04affde593bfaf75965c4271e4c3ea58 Author: Noel Grandin AuthorDate: Wed Sep 4 20:02:14 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 6 12:55:48 2024 +0200 use less GetItemSurrogates in SwTable::UpdateFields which speeds up loading a large document with lots of nested tables from several minutes to under 15s Regression from commit ae7807c889c19145f89cec40afac82eee191837c Author: Armin Le Grand (allotropia) Date: Wed Jan 10 20:07:47 2024 +0100 ITEM: No longer register Items at Pool Change-Id: If44bbc50074fc324e9458a4ac498f402500981e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172937 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index ce9025ef1b7a..5225af1c0dd9 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1713,21 +1713,26 @@ void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags) break; } } + // process all table box formulas -ItemSurrogates aSurrogates; -pDoc->GetAttrPool().GetItemSurrogates(aSurrogates, RES_BOXATR_FORMULA); -for(const SfxPoolItem* pItem : aSurrogates) +SwTableLines& rTableLines = GetTabLines(); +for (SwTableLine* pTableLine : rTableLines) { -// SwTableBoxFormula is non-shareable, so const_cast is somewhat OK -auto & rBoxFormula = const_cast(static_cast(*pItem)); -if(rBoxFormula.GetDefinedIn()) +SwTableBoxes& rTableBoxes = pTableLine->GetTabBoxes(); +for (SwTableBox* pTableBox : rTableBoxes) { -if(eFlags == TBL_BOXPTR) -rBoxFormula.TryBoxNmToPtr(); -else if(eFlags == TBL_RELBOXNAME) -rBoxFormula.TryRelBoxNm(); -else -rBoxFormula.ChangeState(); +SwTableBoxFormat* pTableBoxFormat = static_cast(pTableBox->GetFrameFormat()); +if (const SwTableBoxFormula* pItem = pTableBoxFormat->GetItemIfSet( RES_BOXATR_FORMULA, false )) +{ +// SwTableBoxFormula is non-shareable, so const_cast is somewhat OK +auto & rBoxFormula = const_cast(*pItem); +if(eFlags == TBL_BOXPTR) +rBoxFormula.TryBoxNmToPtr(); +else if(eFlags == TBL_RELBOXNAME) +rBoxFormula.TryRelBoxNm(); +else +rBoxFormula.ChangeState(); +} } } }
core.git: sw/inc sw/source
sw/inc/swtable.hxx |4 ++-- sw/source/core/doc/tblrwcl.cxx | 20 ++-- sw/source/core/docnode/ndcopy.cxx |2 +- sw/source/core/docnode/ndtbl.cxx|4 ++-- sw/source/core/edit/edtab.cxx |2 +- sw/source/core/fields/ddetbl.cxx|2 +- sw/source/core/frmedt/tblsel.cxx|4 ++-- sw/source/core/table/swnewtable.cxx |6 +++--- sw/source/core/table/swtable.cxx|2 +- sw/source/core/undo/untbl.cxx |4 ++-- sw/source/filter/html/htmltab.cxx |2 +- sw/source/filter/ww8/ww8par2.cxx|2 +- sw/source/filter/xml/xmltbli.cxx|2 +- 13 files changed, 28 insertions(+), 28 deletions(-) New commits: commit edc20f4d34d102b385ece53a60abad0047661661 Author: Noel Grandin AuthorDate: Thu Sep 5 19:30:48 2024 +0200 Commit: Noel Grandin CommitDate: Fri Sep 6 10:41:45 2024 +0200 return SwTableBoxFormat from SwTableBox::GetFrameFormat since that is always the SwFrameFormat subclass we are attached to Change-Id: Iaac0503818c7c9c8e2563ad0dd7d689bdddb8438 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172922 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 4f4c5672ae4d..368665e5008c 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -480,8 +480,8 @@ public: const SwTableLine *GetUpper() const { return m_pUpper; } void SetUpper( SwTableLine *pNew ) { m_pUpper = pNew; } -SwFrameFormat* GetFrameFormat() { return static_cast(GetRegisteredIn()); } -SwFrameFormat* GetFrameFormat() const { return const_cast(static_cast(GetRegisteredIn())); } +SwTableBoxFormat* GetFrameFormat() { return static_cast(GetRegisteredIn()); } +SwTableBoxFormat* GetFrameFormat() const { return const_cast(static_cast(GetRegisteredIn())); } /// Set that this table box contains formatting that is not set by the table style. void SetDirectFormatting(bool bDirect) { mbDirectFormatting = bDirect; } diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 35e573d89d7c..e71982fd6077 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -286,7 +286,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) itFind != pCpyPara->rTabFrameArr.end() ) aFindFrame = *itFind; else -aFindFrame.pNewFrameFormat = static_cast(pBox->GetFrameFormat()); +aFindFrame.pNewFrameFormat = pBox->GetFrameFormat(); } if (!rFndBox.GetLines().empty()) @@ -333,7 +333,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) pCpyPara->nInsPos - 1 ]; } -aFindFrame.pNewFrameFormat = static_cast(pBox->GetFrameFormat()); +aFindFrame.pNewFrameFormat = pBox->GetFrameFormat(); // Else we copy before that and the first Line keeps the TopLine // and we remove it at the original @@ -1055,7 +1055,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn // Insert nCnt new Lines into the Box SwTableLine* pInsLine = pSelBox->GetUpper(); -SwTableBoxFormat* pFrameFormat = static_cast(pSelBox->GetFrameFormat()); +SwTableBoxFormat* pFrameFormat = pSelBox->GetFrameFormat(); // Respect the Line's height, reset if needed SwFormatFrameSize aFSz( pInsLine->GetFrameFormat()->GetFrameSize() ); @@ -1087,7 +1087,7 @@ bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn } } -SwTableBoxFormat* pCpyBoxFrameFormat = static_cast(pSelBox->GetFrameFormat()); +SwTableBoxFormat* pCpyBoxFrameFormat = pSelBox->GetFrameFormat(); bool bChkBorder = nullptr != pCpyBoxFrameFormat->GetBox().GetTop(); if( bChkBorder ) pCpyBoxFrameFormat = static_cast(pSelBox->ClaimFrameFormat()); @@ -1195,7 +1195,7 @@ bool SwTable::SplitCol(SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt) // Find the Frame Format in the Frame Format Array SwTableBoxFormat* pLastBoxFormat; -CpyTabFrame aFindFrame( static_cast(pSelBox->GetFrameFormat()) ); +CpyTabFrame aFindFrame( pSelBox->GetFrameFormat() ); CpyTabFrames::const_iterator itFind = aFrameArr.lower_bound( aFindFrame ); const size_t nFndPos = itFind - aFrameArr.begin(); if( itFind == aFrameArr.end() || !(*itFind == aFindFrame) ) @@ -1404,7 +1404,7 @@ static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara) return; SwTableBox* pBox = new SwTableBox( -static_cast(rFndBox.GetBox()->GetFrameFormat()), +rFndBox.GetBox()->GetFrameFormat(), 0, pULPara->pInsLine ); InsULPara aPara( *pULPara ); aPara.pInsBox = p
core.git: Branch 'libreoffice-24-8' - dbaccess/source
dbaccess/source/core/dataaccess/databasedocument.hxx |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) New commits: commit 0dcda9455d828e31bda416229a5324491353b6a0 Author: Noel Grandin AuthorDate: Wed Sep 4 18:53:40 2024 +0200 Commit: Michael Stahl CommitDate: Fri Sep 6 10:26:13 2024 +0200 tsan: data race Read of size 1 at 0x725be3fd by thread T19: 0 dbaccess::ODatabaseDocument::queryInterface(com::sun::star::uno::Type const&) 1 non-virtual thunk to dbaccess::ODatabaseDocument::queryInterface(com::sun::star::uno::Type const&) 2 com::sun::star::uno::BaseReference::iquery(com::sun::star::uno::XInterface*, com::sun::star::uno::Type const&) 3 com::sun::star::uno::Reference::iquery(com::sun::star::uno::XInterface*) Previous write of size 1 at 0x725be3fd by thread T8 (mutexes: write M0): 0 dbaccess::ODatabaseDocument::storeAsURL(rtl::OUString const&, com::sun::star::uno::Sequence const&) 1 non-virtual thunk to dbaccess::ODatabaseDocument::storeAsURL(rtl::OUString const&, com::sun::star::uno::Sequence const&) 2 gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) Change-Id: I40ce0b5995f94455b5d9ca1d652a58df96b5f553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172873 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit d50f3fa9f5811204fbf2350e4745a26154fce6d5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172893 Reviewed-by: Michael Stahl diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 545ae9f92164..2700e358a506 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -192,7 +193,8 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe */ InitState m_eInitState; bool m_bClosing; -bool m_bAllowDocumentScripting; +/// Using atomic because locking around accessing this will lead to deadlock in queryInterface +std::atomic m_bAllowDocumentScripting; bool m_bHasBeenRecovered; /// If XModel::attachResource() was called to inform us that the document is embedded into another one. bool m_bEmbedded;
core.git: Branch 'libreoffice-24-2' - cui/source
cui/source/dialogs/hldoctp.cxx | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) New commits: commit d7235d9099e5b7db80958b4a79801581198aab08 Author: Noel Grandin AuthorDate: Thu Sep 5 12:11:27 2024 +0200 Commit: Xisco Fauli CommitDate: Thu Sep 5 20:05:38 2024 +0200 fix crash in Hyperlink dialog which I managed to trigger by hitting escape repeatedly while it was trying to load the targets window Change-Id: I4c7cb3a30104c58bfc6652923a0aa2169c1bf3bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172907 Reviewed-by: Noel Grandin Tested-by: Jenkins (cherry picked from commit 6633afe0ff18e5921eb96be2f863f28bd7e1110d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172894 Reviewed-by: Xisco Fauli Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172918 diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index a1c1454b69de..8c65fdb47fd6 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -253,10 +253,13 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void) { weld::WaitObject aWait(mpDialog->getDialog()); -if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) -mxMarkWnd->RefreshTree ( "" ); -else -mxMarkWnd->RefreshTree ( maStrURL ); +if (mxMarkWnd) +{ +if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) +mxMarkWnd->RefreshTree ( "" ); +else +mxMarkWnd->RefreshTree ( maStrURL ); +} } }
core.git: Branch 'libreoffice-24-8' - cui/source
cui/source/dialogs/hldoctp.cxx | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) New commits: commit c7dec46a7dae581ed7c0a7493c7a33fbb157d0b7 Author: Noel Grandin AuthorDate: Thu Sep 5 12:11:27 2024 +0200 Commit: Xisco Fauli CommitDate: Thu Sep 5 16:25:53 2024 +0200 fix crash in Hyperlink dialog which I managed to trigger by hitting escape repeatedly while it was trying to load the targets window Change-Id: I4c7cb3a30104c58bfc6652923a0aa2169c1bf3bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172907 Reviewed-by: Noel Grandin Tested-by: Jenkins (cherry picked from commit 6633afe0ff18e5921eb96be2f863f28bd7e1110d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172894 Reviewed-by: Xisco Fauli diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index b414309bea0b..c8ed1de2fa6b 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -253,10 +253,13 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void) { weld::WaitObject aWait(mpDialog->getDialog()); -if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) -mxMarkWnd->RefreshTree ( u""_ustr ); -else -mxMarkWnd->RefreshTree ( maStrURL ); +if (mxMarkWnd) +{ +if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) +mxMarkWnd->RefreshTree ( u""_ustr ); +else +mxMarkWnd->RefreshTree ( maStrURL ); +} } }
core.git: 2 commits - comphelper/source cppuhelper/source
comphelper/source/streaming/seqinputstreamserv.cxx | 39 - cppuhelper/source/propshlp.cxx |4 +- 2 files changed, 27 insertions(+), 16 deletions(-) New commits: commit f8deb64c3c1d5baa8532a92bc16d1712f42aaa12 Author: Noel Grandin AuthorDate: Thu Sep 5 11:38:27 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 13:51:34 2024 +0200 throw more useful exception from OPropertySetHelper::getPropertyValue Change-Id: I90e7ab5763bf368cec795a8c39ece17579dd851d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172905 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index fd4e4808da35..8a864e1bad6a 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -273,6 +273,8 @@ Any OPropertySetHelper::getPropertyValue( IPropertyArrayHelper & rPH = getInfoHelper(); // map the name to the handle sal_Int32 nHandle = rPH.getHandleByName( rPropertyName ); +if (nHandle == -1) +throw UnknownPropertyException(rPropertyName); // call the method of the XFastPropertySet interface return getFastPropertyValue( nHandle ); } @@ -545,8 +547,8 @@ void OPropertySetHelper::setFastPropertyValue( sal_Int32 nHandle, const Any& rVa // XFastPropertySet Any OPropertySetHelper::getFastPropertyValue( sal_Int32 nHandle ) - { +assert(nHandle != -1 && "passing -1 here indicates that the caller knows this is not a valid handle"); IPropertyArrayHelper & rInfo = getInfoHelper(); if( !rInfo.fillPropertyMembersByHandle( nullptr, nullptr, nHandle ) ) // unknown property commit 6d6422b3ff0c3b252f87f76f1777a357aafeaea7 Author: Noel Grandin AuthorDate: Thu Sep 5 12:10:50 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 13:51:25 2024 +0200 tdf#162772 Crash in "Target in Document" in Hyperlink dialog regression from commit a6ad198d097fb4a503c8d5831d484ff46721134b Author: Noel Grandin Date: Sat Aug 17 13:19:54 2024 +0200 tdf#158556 use more comphelper::ByteReader Change-Id: I7343159d5e3ec7619ba95a98417fd3b4e25dbf6c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172906 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx index 93d421f40fe6..29b5cbbe3e7e 100644 --- a/comphelper/source/streaming/seqinputstreamserv.cxx +++ b/comphelper/source/streaming/seqinputstreamserv.cxx @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include namespace com::sun::star::uno { class XComponentContext; } @@ -40,7 +42,8 @@ class SequenceInputStreamService: public ::cppu::WeakImplHelper< lang::XServiceInfo, io::XSeekableInputStream, -lang::XInitialization> +lang::XInitialization>, +public comphelper::ByteReader { public: explicit SequenceInputStreamService(); @@ -69,14 +72,16 @@ public: // css::lang::XInitialization: virtual void SAL_CALL initialize( const uno::Sequence< css::uno::Any > & aArguments ) override; +// comphelper::ByteReader +virtual sal_Int32 readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) override; + private: virtual ~SequenceInputStreamService() override {} std::mutex m_aMutex; bool m_bInitialized; -uno::Reference< io::XInputStream > m_xInputStream; -uno::Reference< io::XSeekable > m_xSeekable; +rtl::Reference< comphelper::SequenceInputStream > m_xInputStream; }; SequenceInputStreamService::SequenceInputStreamService() @@ -118,6 +123,15 @@ uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServi return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); } +::sal_Int32 SequenceInputStreamService::readSomeBytes( sal_Int8* aData, sal_Int32 nMaxBytesToRead ) +{ +std::scoped_lock aGuard( m_aMutex ); +if ( !m_xInputStream.is() ) +throw io::NotConnectedException(); + +return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead ); +} + void SAL_CALL SequenceInputStreamService::skipBytes( ::sal_Int32 nBytesToSkip ) { std::scoped_lock aGuard( m_aMutex ); @@ -144,35 +158,34 @@ void SAL_CALL SequenceInputStreamService::closeInput() m_xInputStream->closeInput(); m_xInputStream.clear(); -m_xSeekable.clear(); } // css::io::XSeekable: void SAL_CALL SequenceInputStreamService::seek( ::sal_Int64 location ) { std::scoped_lock aGuard( m_aMutex ); -if ( !m_xSeekable.is() ) +if ( !m_xInputStream.is() ) throw io::NotConnectedException(); -m_xSeekable->seek( location ); +m_xInputStream->seek( location ); } ::sal_Int64 SAL_CALL SequenceInputStreamService::getPosition() { std::scoped_lock aGuard( m_aMutex ); -if ( !m_xSeekable.is() ) +if ( !m_xInputStream.is() )
core.git: 2 commits - cui/source sfx2/source
cui/source/dialogs/hldoctp.cxx | 11 +++ sfx2/source/doc/guisaveas.cxx |2 +- 2 files changed, 8 insertions(+), 5 deletions(-) New commits: commit 70b6d04570b22e766d1f04921cf05f9f9cdd3108 Author: Noel Grandin AuthorDate: Thu Sep 5 12:22:45 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 13:51:15 2024 +0200 tdf#162728 Crash on saving in Math Formula editor regression from commit ece0729e18b4b306933439d1a329df192fc504d3 Author: Noel Grandin Date: Tue Aug 13 13:43:25 2024 +0200 use less exception throwing for flow control Change-Id: I52dcb717e309c70d10a0609b04b2c9c659c423cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172908 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3cd788f5dc4b..a1a127a18ff6 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -226,7 +226,7 @@ public: try { uno::Reference< lang::XMultiServiceFactory > xDocSettingsSupplier( xModel, uno::UNO_QUERY ); -if (xModel) +if (xDocSettingsSupplier) { m_xDocumentSettings.set( xDocSettingsSupplier->createInstance( u"com.sun.star.document.Settings"_ustr ), commit 6633afe0ff18e5921eb96be2f863f28bd7e1110d Author: Noel Grandin AuthorDate: Thu Sep 5 12:11:27 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 13:51:07 2024 +0200 fix crash in Hyperlink dialog which I managed to trigger by hitting escape repeatedly while it was trying to load the targets window Change-Id: I4c7cb3a30104c58bfc6652923a0aa2169c1bf3bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172907 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index b414309bea0b..c8ed1de2fa6b 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -253,10 +253,13 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void) { weld::WaitObject aWait(mpDialog->getDialog()); -if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) -mxMarkWnd->RefreshTree ( u""_ustr ); -else -mxMarkWnd->RefreshTree ( maStrURL ); +if (mxMarkWnd) +{ +if ( maStrURL.equalsIgnoreAsciiCase( INET_FILE_SCHEME ) ) +mxMarkWnd->RefreshTree ( u""_ustr ); +else +mxMarkWnd->RefreshTree ( maStrURL ); +} } }
core.git: 2 commits - dbaccess/source sw/qa
dbaccess/source/core/dataaccess/databasedocument.hxx |4 +++- sw/qa/extras/odfexport/data/tdf159027.odt|binary sw/qa/extras/odfexport/odfexport2.cxx| 15 +++ 3 files changed, 18 insertions(+), 1 deletion(-) New commits: commit d50f3fa9f5811204fbf2350e4745a26154fce6d5 Author: Noel Grandin AuthorDate: Wed Sep 4 18:53:40 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 11:29:59 2024 +0200 tsan: data race Read of size 1 at 0x725be3fd by thread T19: 0 dbaccess::ODatabaseDocument::queryInterface(com::sun::star::uno::Type const&) 1 non-virtual thunk to dbaccess::ODatabaseDocument::queryInterface(com::sun::star::uno::Type const&) 2 com::sun::star::uno::BaseReference::iquery(com::sun::star::uno::XInterface*, com::sun::star::uno::Type const&) 3 com::sun::star::uno::Reference::iquery(com::sun::star::uno::XInterface*) Previous write of size 1 at 0x725be3fd by thread T8 (mutexes: write M0): 0 dbaccess::ODatabaseDocument::storeAsURL(rtl::OUString const&, com::sun::star::uno::Sequence const&) 1 non-virtual thunk to dbaccess::ODatabaseDocument::storeAsURL(rtl::OUString const&, com::sun::star::uno::Sequence const&) 2 gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) Change-Id: I40ce0b5995f94455b5d9ca1d652a58df96b5f553 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172873 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/dbaccess/source/core/dataaccess/databasedocument.hxx b/dbaccess/source/core/dataaccess/databasedocument.hxx index 545ae9f92164..2700e358a506 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.hxx +++ b/dbaccess/source/core/dataaccess/databasedocument.hxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -192,7 +193,8 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe */ InitState m_eInitState; bool m_bClosing; -bool m_bAllowDocumentScripting; +/// Using atomic because locking around accessing this will lead to deadlock in queryInterface +std::atomic m_bAllowDocumentScripting; bool m_bHasBeenRecovered; /// If XModel::attachResource() was called to inform us that the document is embedded into another one. bool m_bEmbedded; commit 497d328042b18853c5236e95a0f38a4ab733688c Author: Oliver Specht AuthorDate: Wed Aug 7 14:41:38 2024 +0200 Commit: Thorsten Behrens CommitDate: Thu Sep 5 11:29:56 2024 +0200 tdf#159027 test added Test added as follow-up to f60126a6bfae5dad4a11afcc94ddf4a58c5ce8ab checking table calculation on page break Change-Id: Icb4e8b8509db18d82647c66a6abdb87648ad4cb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171592 Tested-by: Jenkins Reviewed-by: Thorsten Behrens diff --git a/sw/qa/extras/odfexport/data/tdf159027.odt b/sw/qa/extras/odfexport/data/tdf159027.odt new file mode 100644 index ..38d9b4501d8e Binary files /dev/null and b/sw/qa/extras/odfexport/data/tdf159027.odt differ diff --git a/sw/qa/extras/odfexport/odfexport2.cxx b/sw/qa/extras/odfexport/odfexport2.cxx index f9205f752054..f964c3777600 100644 --- a/sw/qa/extras/odfexport/odfexport2.cxx +++ b/sw/qa/extras/odfexport/odfexport2.cxx @@ -40,6 +40,7 @@ #include #include #include +#include namespace { @@ -1730,6 +1731,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf122452) CPPUNIT_ASSERT_EQUAL_MESSAGE("Redlines should be Hidden", true, pWrtShell->GetLayout()->IsHideRedlines()); } +CPPUNIT_TEST_FIXTURE(Test, testTdf159027) +{ +loadAndReload("tdf159027.odt"); +SwDoc* pDoc = getSwDoc(); +pDoc->getIDocumentFieldsAccess().UpdateFields(true); + +uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); +uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); +uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); +uno::Reference xCellD9(xTextTable->getCellByName(u"D9"_ustr), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(u"70"_ustr, xCellD9->getString()); +uno::Reference xCellE9(xTextTable->getCellByName(u"E9"_ustr), uno::UNO_QUERY); +CPPUNIT_ASSERT_EQUAL(u"6"_ustr, xCellE9->getString()); +} } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT();
core.git: sc/source
sc/source/ui/unoobj/dapiuno.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 898ff23a664a4b114a31941bff9efbaec3dc9e73 Author: Noel Grandin AuthorDate: Wed Sep 4 14:27:45 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 10:30:15 2024 +0200 no need to use dynamic_cast here Change-Id: Icc5ad5972afdad128db19c6b2d6d0aa55da47f0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172880 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 5e3871481456..e8ace63308bd 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1214,8 +1214,9 @@ void SAL_CALL ScDataPilotTableObj::removeModifyListener( const uno::Reference(&rHint) ) +if ( rHint.GetId() == SfxHintId::ScDataPilotModified ) { +auto pDataPilotHint = static_cast(&rHint); if (pDataPilotHint->GetName() == aName) Refreshed_Impl(); }
core.git: cppuhelper/source
cppuhelper/source/weak.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 6ebe316635b7d4a2d8a82f79cc99eab95b0aabff Author: Noel Grandin AuthorDate: Wed Sep 4 20:02:14 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 09:58:55 2024 +0200 tsan: data race Atomic write of size 4 at 0x7254000f5f08 by thread T38 (mutexes: write M0, write M1, write M2): 0 configmgr::Access::acquireCounting() 1 configmgr::Components::initGlobalBroadcaster(configmgr::Modifications const&, rtl::Reference const&, configmgr::Broadcaster*) 2 configmgr::RootAccess::commitChanges() 3 non-virtual thunk to configmgr::RootAccess::commitChanges() 4 utl::OConfigurationTreeRoot::commit() 5 dbaccess::(anonymous namespace)::DatabaseRegistrations::registerDatabaseLocation(rtl::OUString const&, rtl::OUString const&) 6 non-virtual thunk to dbaccess::(anonymous namespace)::DatabaseRegistrations::registerDatabaseLocation(rtl::OUString const&, rtl::OUString const&) 7 dbaccess::ODatabaseContext::registerDatabaseLocation(rtl::OUString const&, rtl::OUString const&) 8 dbaccess::ODatabaseContext::registerObject(rtl::OUString const&, com::sun::star::uno::Reference const&) 9 non-virtual thunk to dbaccess::ODatabaseContext::registerObject(rtl::OUString const&, com::sun::star::uno::Reference const&) 10 gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) Previous read of size 4 at 0x7254000f5f08 by main thread (mutexes: write M3, write M4): 0 cppu::OWeakObject::disposeWeakConnectionPoint() 1 cppu::OWeakObject::release() 2 configmgr::RootAccess::release() 3 non-virtual thunk to configmgr::RootAccess::release() 4 com::sun::star::uno::Reference::~Reference() 5 SvtLinguConfig::~SvtLinguConfig() 6 SwDoc::GetGCIterator() 7 SwDoc::StartGrammarChecking(bool) 8 sw::DocumentTimerManager::GetNextIdleJob() 9 sw::DocumentTimerManager::IsDocIdle() 10 sw::SwDocIdle::UpdateMinPeriod(unsigned long) const 11 Scheduler::CallbackTaskScheduling() Change-Id: Idaf2707e5902338a873a325228e9c97e646ea768 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172874 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/cppuhelper/source/weak.cxx b/cppuhelper/source/weak.cxx index 6bb353faa9bd..446cdc0e43ba 100644 --- a/cppuhelper/source/weak.cxx +++ b/cppuhelper/source/weak.cxx @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -232,7 +233,7 @@ void SAL_CALL OWeakObject::release() noexcept void OWeakObject::disposeWeakConnectionPoint() { -OSL_PRECOND( m_refCount == 0, "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" ); +OSL_PRECOND( (atomic_thread_fence(std::memory_order_acquire), m_refCount == 0), "OWeakObject::disposeWeakConnectionPoint: only to be called with a ref count of 0!" ); if (m_pWeakConnectionPoint != nullptr) { OWeakConnectionPoint * const p = m_pWeakConnectionPoint; m_pWeakConnectionPoint = nullptr;
core.git: accessibility/source basctl/source basic/source sc/source sfx2/source sw/source vcl/source
accessibility/source/extended/textwindowaccessibility.cxx |8 - basctl/source/accessibility/accessibledialogwindow.cxx|3 basctl/source/basicide/baside2b.cxx | 24 ++--- basctl/source/basicide/basidesh.cxx |6 - basic/source/sbx/sbxcoll.cxx | 67 ++ basic/source/sbx/sbxobj.cxx | 10 -- sc/source/ui/docshell/servobj.cxx | 19 +-- sfx2/source/doc/printhelper.cxx |8 + sfx2/source/doc/sfxbasemodel.cxx |4 sw/source/core/layout/sectfrm.cxx |3 sw/source/uibase/docvw/srcedtw.cxx|7 - vcl/source/edit/vclmedit.cxx |6 - 12 files changed, 72 insertions(+), 93 deletions(-) New commits: commit ac9eaf5d11e5f44d7faa628233438a3b1bb89d6f Author: Noel Grandin AuthorDate: Wed Sep 4 11:11:57 2024 +0200 Commit: Noel Grandin CommitDate: Thu Sep 5 08:10:26 2024 +0200 use less dynamic_cast when broadcasting SfxHint Change-Id: If4d33cbbf36a9ad495b80a7347b39d0f4bc0405e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172857 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 375c2900beb5..9021f85af610 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1391,12 +1391,7 @@ void SAL_CALL Document::disposing() // virtual void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint) { -const TextHint* pTextHint = dynamic_cast(&rHint); -if (!pTextHint) -return; - -::TextHint const & rTextHint = *pTextHint; -switch (rTextHint.GetId()) +switch (rHint.GetId()) { case SfxHintId::TextParaInserted: case SfxHintId::TextParaRemoved: @@ -1420,6 +1415,7 @@ void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint) if (!isAlive()) break; +const TextHint& rTextHint = static_cast(rHint); m_aParagraphNotifications.push(rTextHint); break; } diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 8f43fa4b2556..b7740a6484b5 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -421,8 +421,9 @@ awt::Rectangle AccessibleDialogWindow::implGetBounds() void AccessibleDialogWindow::Notify( SfxBroadcaster&, const SfxHint& rHint ) { -if (SdrHint const* pSdrHint = dynamic_cast(&rHint)) +if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint) { +SdrHint const* pSdrHint = static_cast(&rHint); switch ( pSdrHint->GetKind() ) { case SdrHintKind::ObjectInserted: diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 8bf97a6c09a6..2e6ebc14349e 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1138,12 +1138,7 @@ void EditorWindow::CreateEditEngine() void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { -TextHint const* pTextHint = dynamic_cast(&rHint); -if (!pTextHint) -return; - -TextHint const& rTextHint = *pTextHint; -if( rTextHint.GetId() == SfxHintId::TextViewScrolled ) +if( rHint.GetId() == SfxHintId::TextViewScrolled ) { rModulWindow.GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() ); rModulWindow.GetEditHScrollBar().SetThumbPos( pEditView->GetStartDocPos().X() ); @@ -1152,7 +1147,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) rModulWindow.GetLineNumberWindow().DoScroll ( rModulWindow.GetLineNumberWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() ); } -else if( rTextHint.GetId() == SfxHintId::TextHeightChanged ) +else if( rHint.GetId() == SfxHintId::TextHeightChanged ) { if ( pEditView->GetStartDocPos().Y() ) { @@ -1166,7 +1161,7 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) SetScrollBarRanges(); } -else if( rTextHint.GetId() == SfxHintId::TextFormatted ) +else if( rHint.GetId() == SfxHintId::TextFormatted ) { const tools::Long nWidth = pEditEngine->CalcTextWidth(); @@ -1181,20 +1176,23 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if ( nCurTextWidth != nPrevTextWidth ) SetScrollBarRanges(); } -else if( rTextHint.GetId() == SfxHintId::TextParaInserted ) +else if( rHint.GetId() == SfxHintId::TextParaInserted ) { +TextHint const & rTex
core.git: include/svl sc/inc sc/source
include/svl/hint.hxx |1 + sc/inc/bulkdatahint.hxx |4 ++-- sc/source/core/data/bcaslot.cxx |6 +++--- sc/source/core/inc/bcaslot.hxx|2 +- sc/source/core/tool/grouparealistener.cxx |5 ++--- 5 files changed, 9 insertions(+), 9 deletions(-) New commits: commit b1309730b8a5419d48a29edf6d3caf524311ed2e Author: Noel Grandin AuthorDate: Wed Sep 4 12:47:25 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 4 20:03:40 2024 +0200 use less dynamic_cast when broadcasting BulkDataHint we never read the hint id that we pass in to the constructor, so drop it Change-Id: I8ec377e51bddbc2a12a2fd226fc1a915afef59e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172862 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index 81600f610484..bad64aa212fc 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -129,6 +129,7 @@ enum class SfxHintId { ScTables, ScEditView, ScUnoRefUndo, +ScBulkData, // SC accessibility hints ScAccTableChanged, diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx index e77ef317ef72..24227da70dcb 100644 --- a/sc/inc/bulkdatahint.hxx +++ b/sc/inc/bulkdatahint.hxx @@ -23,8 +23,8 @@ class BulkDataHint final : public SfxHint const ColumnSpanSet* mpSpans; public: -BulkDataHint(ScDocument& rDoc, SfxHintId nHintId) -: SfxHint(nHintId) +BulkDataHint(ScDocument& rDoc) +: SfxHint(SfxHintId::ScBulkData) , mrDoc(rDoc) , mpSpans(nullptr) { diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 209eb9f2a9ba..c89d44356d8a 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -1145,7 +1145,7 @@ void ScBroadcastAreaSlotMachine::LeaveBulkBroadcast( SfxHintId nHintId ) if (--nInBulkBroadcast == 0) { ScBroadcastAreasBulk().swap( aBulkBroadcastAreas); -bool bBroadcasted = BulkBroadcastGroupAreas( nHintId ); +bool bBroadcasted = BulkBroadcastGroupAreas(); // Trigger the "final" tracking. if (pDoc->IsTrackFormulasPending()) pDoc->FinalTrackFormulas( nHintId ); @@ -1172,12 +1172,12 @@ void ScBroadcastAreaSlotMachine::InsertBulkGroupArea( ScBroadcastArea* pArea, co rSet.set(*pDoc, rRange, true); } -bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas( SfxHintId nHintId ) +bool ScBroadcastAreaSlotMachine::BulkBroadcastGroupAreas() { if (m_BulkGroupAreas.empty()) return false; -sc::BulkDataHint aHint( *pDoc, nHintId); +sc::BulkDataHint aHint( *pDoc ); bool bBroadcasted = false; for (const auto& [pArea, rSpans] : m_BulkGroupAreas) diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx index 6e891e8aab5a..fc36127904d0 100644 --- a/sc/source/core/inc/bcaslot.hxx +++ b/sc/source/core/inc/bcaslot.hxx @@ -348,7 +348,7 @@ public: void InsertBulkGroupArea( ScBroadcastArea* pArea, const ScRange& rRange ); void RemoveBulkGroupArea( ScBroadcastArea* pArea ); -bool BulkBroadcastGroupAreas( SfxHintId nHintId ); +bool BulkBroadcastGroupAreas(); /// @return: how many removed size_t RemoveBulkArea( const ScBroadcastArea* p ); diff --git a/sc/source/core/tool/grouparealistener.cxx b/sc/source/core/tool/grouparealistener.cxx index 4954ce8d8d0f..092d0de62ad8 100644 --- a/sc/source/core/tool/grouparealistener.cxx +++ b/sc/source/core/tool/grouparealistener.cxx @@ -117,10 +117,9 @@ ScRange FormulaGroupAreaListener::getListeningRange() const void FormulaGroupAreaListener::Notify( const SfxHint& rHint ) { -// BulkDataHint may include (SfxHintId::ScDataChanged | -// SfxHintId::ScTableOpDirty) so has to be checked first. -if ( const BulkDataHint* pBulkHint = dynamic_cast(&rHint) ) +if ( rHint.GetId() == SfxHintId::ScBulkData ) { +const BulkDataHint* pBulkHint = static_cast(&rHint); notifyBulkChange(*pBulkHint); } else if (rHint.GetId() == SfxHintId::ScDataChanged || rHint.GetId() == SfxHintId::ScTableOpDirty)
core.git: include/svl sc/source sw/source
include/svl/hint.hxx | 15 + sc/source/core/data/drwlayer.cxx |2 sc/source/core/tool/hints.cxx|9 sc/source/ui/Accessibility/AccessibilityHints.cxx| 10 sc/source/ui/Accessibility/AccessibleDocument.cxx| 139 +-- sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx | 111 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx |3 sc/source/ui/app/uiitems.cxx |2 sc/source/ui/docshell/docsh.cxx |7 sc/source/ui/inc/AccessibilityHints.hxx | 14 - sc/source/ui/inc/uiitems.hxx |4 sc/source/ui/unoobj/PivotTableDataProvider.cxx |3 sc/source/ui/unoobj/cellsuno.cxx | 21 - sc/source/ui/unoobj/chart2uno.cxx|5 sc/source/ui/unoobj/dapiuno.cxx |3 sc/source/ui/unoobj/datauno.cxx |3 sc/source/ui/unoobj/docuno.cxx |6 sc/source/ui/unoobj/editsrc.cxx |2 sc/source/ui/unoobj/fielduno.cxx |2 sc/source/ui/unoobj/linkuno.cxx | 23 - sc/source/ui/unoobj/unoreflist.cxx |2 sc/source/ui/view/drawvie3.cxx |6 sc/source/ui/view/prevwsh2.cxx |3 sc/source/ui/view/tabvwsh5.cxx |9 sw/source/core/doc/visiturl.cxx |2 25 files changed, 218 insertions(+), 188 deletions(-) New commits: commit f2d096099a220e4caa2d532a5230785cbdb91eed Author: Noel Grandin AuthorDate: Tue Sep 3 15:46:08 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 4 13:02:56 2024 +0200 use less dynamic_cast when broadcasting SfxHint in sc Change-Id: I25ee079b5b14f82012f868ae6b348fa6982571a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172853 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index c0a927a1c954..81600f610484 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -118,6 +118,17 @@ enum class SfxHintId { ScHiddenRowsChanged, ScSelectionChanged, ScClearCache, +ScTabDeleted, +ScTabSizeChanged, +ScPaint, +ScUpdateRef, +ScLinkRefreshed, +ScAutoStyle, +ScDBRangeRefreshed, +ScDataPilotModified, +ScTables, +ScEditView, +ScUnoRefUndo, // SC accessibility hints ScAccTableChanged, @@ -127,6 +138,10 @@ enum class SfxHintId { ScAccLeaveEditMode, ScAccMakeDrawLayer, ScAccWindowResized, +ScAccGridWinFocusLost, +ScAccGridWinFocusGot, +ScAccWinFocusGot, +ScAccWinFocusLost, // sd hints SdViewShell, diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 9db9e653677e..95463a9c6d2d 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -203,6 +203,7 @@ void ScUndoAnchorData::Redo() } ScTabDeletedHint::ScTabDeletedHint( SCTAB nTabNo ) : +SfxHint(SfxHintId::ScTabDeleted), nTab( nTabNo ) { } @@ -212,6 +213,7 @@ ScTabDeletedHint::~ScTabDeletedHint() } ScTabSizeChangedHint::ScTabSizeChangedHint( SCTAB nTabNo ) : +SfxHint(SfxHintId::ScTabSizeChanged), nTab( nTabNo ) { } diff --git a/sc/source/core/tool/hints.cxx b/sc/source/core/tool/hints.cxx index a3be243750a4..728fe27855b3 100644 --- a/sc/source/core/tool/hints.cxx +++ b/sc/source/core/tool/hints.cxx @@ -23,6 +23,7 @@ // ScPaintHint - info what has to be repainted ScPaintHint::ScPaintHint( const ScRange& rRng, PaintPartFlags nPaint, tools::Long nMaxWidthAffectedHint ) : +SfxHint( SfxHintId::ScPaint ), aRange( rRng ), nParts( nPaint ), nWidthAffectedHint(nMaxWidthAffectedHint) @@ -37,6 +38,7 @@ ScPaintHint::~ScPaintHint() ScUpdateRefHint::ScUpdateRefHint( UpdateRefMode eMode, const ScRange& rR, SCCOL nX, SCROW nY, SCTAB nZ ) : +SfxHint(SfxHintId::ScUpdateRef), eUpdateRefMode( eMode ), aRange( rR ), nDx( nX ), @@ -52,7 +54,7 @@ ScUpdateRefHint::~ScUpdateRefHint() // ScLinkRefreshedHint - a link has been refreshed ScLinkRefreshedHint::ScLinkRefreshedHint() : -nLinkType( ScLinkRefType::NONE ) +SfxHint(SfxHintId::ScLinkRefreshed), nLinkType( ScLinkRefType::NONE ) { } @@ -85,6 +87,7 @@ void ScLinkRefreshedHint::SetAreaLink( const ScAddress& rPos ) ScAutoStyleHint::ScAutoStyleHint( const ScRange& rR, OUString aSt1, sal_uLong nT, OUString aSt2 ) : +SfxHint(SfxHintId::ScAutoStyle), aRange( rR ), aStyle1(std::move( aSt1
core.git: sw/inc sw/source
sw/inc/calbck.hxx |7 --- sw/inc/hintids.hxx |2 -- sw/inc/hints.hxx |4 ++-- sw/inc/node.hxx|2 +- sw/inc/pagedesc.hxx|2 +- sw/inc/paratr.hxx |2 +- sw/inc/section.hxx |2 +- sw/inc/swtable.hxx |2 +- sw/source/core/attr/calbck.cxx |4 ++-- sw/source/core/attr/hints.cxx |5 - sw/source/core/docnode/node.cxx| 13 - sw/source/core/docnode/section.cxx | 16 ++-- sw/source/core/layout/pagedesc.cxx |2 +- sw/source/core/para/paratr.cxx |2 +- sw/source/core/table/swtable.cxx | 18 ++ 15 files changed, 31 insertions(+), 52 deletions(-) New commits: commit 0272d39589ad36a38f85928d6a21eb13d28d2904 Author: Noel Grandin AuthorDate: Tue Sep 3 19:41:21 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 4 09:49:08 2024 +0200 convert SwFindNearestNode to regular class and simplify the GetInfo(), it is only used for this single purpose. Change-Id: I462cc10ff9341ace66581bd6af0cacc632866281 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172842 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 37e8b9ed62da..58a336bbc92b 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -38,6 +38,7 @@ class SwCellFrame; class SwTabFrame; class SwRowFrame; class SwTable; +class SwFindNearestNode; /* SwModify and SwClient cooperate in propagating attribute changes. @@ -169,7 +170,7 @@ public: // get information about attribute -virtual bool GetInfo( SfxPoolItem& ) const { return true; } +virtual bool GetInfo( SwFindNearestNode& ) const { return true; } }; @@ -204,7 +205,7 @@ public: bool HasOnlyOneListener() const { return m_pWriterListeners && m_pWriterListeners->IsLast(); } // get information about attribute -virtual bool GetInfo( SfxPoolItem& ) const override; +virtual bool GetInfo( SwFindNearestNode& ) const override; void LockModify() { m_bModifyLocked = true; } void UnlockModify() { m_bModifyLocked = false; } @@ -254,7 +255,7 @@ namespace sw } /** get Client information */ -virtual bool GetInfo( SfxPoolItem& rInfo) const override; +virtual bool GetInfo( SwFindNearestNode& rInfo) const override; private: virtual void SwClientNotify(const SwModify& rModify, const SfxHint& rHint) override; }; diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 7f661ab5209b..75d0f0e51a0a 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -142,7 +142,6 @@ class SwTransparencyGrf; class SwFormatRuby; class SwTableFormulaUpdate; class VirtPageNumHint; -class SwFindNearestNode; class SwFltAnchor; class SwFltTOX; class SwFltRedline; @@ -434,7 +433,6 @@ constexpr TypedWhichId RES_UPDATE_ATTR(170); constexpr TypedWhichId RES_HIDDENPARA_PRINT(178); constexpr TypedWhichId RES_REMOVE_UNO_OBJECT(181); // empty -constexpr TypedWhichId RES_FINDNEARESTNODE(184); constexpr sal_uInt16 RES_FORMAT_MSG_END(190); // An ID for the RTF-reader. The stylesheets are treated like attributes, diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx index 19fe86e95c5c..11589fb827ba 100644 --- a/sw/inc/hints.hxx +++ b/sw/inc/hints.hxx @@ -401,11 +401,11 @@ public: }; -class SwFindNearestNode final : public SwMsgPoolItem +class SwFindNearestNode final { const SwNode *m_pNode, *m_pFound; public: -SwFindNearestNode( const SwNode& rNd ); +SwFindNearestNode( const SwNode& rNd ) : m_pNode(&rNd), m_pFound(nullptr) {} void CheckNode( const SwNode& rNd ); const SwNode* GetFoundNode() const { return m_pFound; } diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index d8eaeaa9058a..dd16cff8c7a8 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -466,7 +466,7 @@ public: virtual SwContentNode* MakeCopy(SwDoc&, SwNode& rWhere, bool bNewFrames) const = 0; /// Get information from Client. -virtual bool GetInfo( SfxPoolItem& ) const override; +virtual bool GetInfo( SwFindNearestNode& ) const override; /// SS for PoolItems: hard attributation. diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 7ae59362cb42..a7769da69218 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -282,7 +282,7 @@ public: void SetPoolHlpFileId(sal_uInt8 const nId) { m_Master.SetPoolHlpFileId(nId); } /// Query information from Client. -virtual bool GetInfo( SfxPoolItem& ) const override; +virtual bool GetInfo( SwFindNearestNode& ) const override; const SwFrameFormat* GetPageFormatOfNode( const SwNode& rNd, bool bCheckForThisPgDc = true ) const; diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx index ca67197e02be..19e44ba5929d 100644 --- a/s
core.git: sc/source
sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |8 1 file changed, 8 insertions(+) New commits: commit e6557a73f12fbb2344baf51f22f9ad256ff83e4c Author: Noel Grandin AuthorDate: Tue Sep 3 15:17:06 2024 +0200 Commit: Noel Grandin CommitDate: Wed Sep 4 07:38:22 2024 +0200 make ScAccWinFocusLostHint and siblings final classes that all directly extend SfxHint, as a precursor to use more SfxHintId to avoid dynamic_cast Change-Id: I35d908740f4200badd456e1cd5edc9457745c499 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172804 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index fadce1cd0c2c..cddf1c24237f 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1197,10 +1197,18 @@ void ScAccessibleDocumentPagePreview::Notify( SfxBroadcaster& rBC, const SfxHint { CommitFocusLost(); } +else if ( dynamic_cast(&rHint) ) +{ +CommitFocusLost(); +} else if ( dynamic_cast(&rHint) ) { CommitFocusGained(); } +else if ( dynamic_cast(&rHint) ) +{ +CommitFocusGained(); +} else { // only notify if child exist, otherwise it is not necessary
core.git: 2 commits - basctl/source editeng/source include/svl include/svx reportdesign/source sd/source sfx2/source svx/source sw/inc sw/source
basctl/source/accessibility/accessibledialogwindow.cxx |3 - basctl/source/dlged/dlged.cxx|6 +- editeng/source/uno/unoedhlp.cxx |2 include/svl/hint.hxx | 43 +++ include/svl/inethist.hxx |2 include/svl/poolitem.hxx |2 include/svl/style.hxx|2 include/svx/galmisc.hxx |2 reportdesign/source/core/sdr/RptObjectListener.cxx |2 reportdesign/source/ui/report/ReportController.cxx |6 +- sd/source/ui/accessibility/AccessibleSlideSorterView.cxx |3 - sd/source/ui/slidesorter/controller/SlsListener.cxx |3 - sd/source/ui/view/ViewShellHint.cxx |3 - sfx2/source/appl/sfxpicklist.cxx |4 - sfx2/source/dialog/StyleList.cxx |5 - sfx2/source/notify/openurlhint.cxx |1 svx/source/form/filtnav.cxx | 25 svx/source/form/fmexpl.cxx | 11 ++- svx/source/form/navigatortree.cxx| 19 -- svx/source/form/navigatortreemodel.cxx |3 - svx/source/inc/fmexpl.hxx|6 +- svx/source/tbxctrls/colrctrl.cxx |6 +- sw/inc/ddefld.hxx|5 + sw/inc/fmtfld.hxx|2 sw/inc/hints.hxx | 16 +++-- sw/inc/pagedesc.hxx |6 +- sw/inc/tox.hxx |3 - sw/inc/unocrsr.hxx |4 - sw/source/core/doc/doctxm.cxx|3 - sw/source/core/doc/notxtfrm.cxx |2 sw/source/core/docnode/node.cxx |3 - sw/source/core/fields/ddetbl.cxx | 10 ++- sw/source/core/inc/pagedeschint.hxx |2 sw/source/core/layout/atrfrm.cxx |3 - sw/source/core/layout/pagechg.cxx|2 sw/source/core/layout/tabfrm.cxx | 13 ++-- sw/source/core/unocore/unotbl.cxx| 26 + sw/source/uibase/wrtsh/navmgr.cxx|2 38 files changed, 179 insertions(+), 82 deletions(-) New commits: commit 5e70ede56af526fce71672a120e5e9cea6e3365b Author: Noel Grandin AuthorDate: Tue Sep 3 15:45:37 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 3 21:41:19 2024 +0200 use less dynamic_cast when broadcasting SfxHint in sw Change-Id: I308887f377b6b97b4949ab3a8815d3d423806e0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172827 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index bfd08eb17b32..c0a927a1c954 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -195,6 +195,21 @@ enum class SfxHintId { SwRedlineUnDelText, SwMoveText, SwRedlineContentAtPos, +SwTableBoxFormatChanged, +SwFindContentFrame, +SwTableLineFormatChanged, +SwMoveTableBox, +SwMoveTableLine, +SwCondCollCondChg, +SwGatherDdeTables, +SwUnoCursorHint, +SwPageDesc, +SwPageFootnote, +SwLinkAnchorSearch, +SwInRangeSearch, +SwGrfRereadAndInCache, +SwFindUnoTextTableRowInstance, +SwFindUnoCellInstance, ThisIsAnSdrHint, ThisIsAnSfxEventHint diff --git a/sw/inc/ddefld.hxx b/sw/inc/ddefld.hxx index 3e37716b675a..233899b8e28b 100644 --- a/sw/inc/ddefld.hxx +++ b/sw/inc/ddefld.hxx @@ -34,7 +34,8 @@ namespace sw { SwNodes& m_rNodes; const SwNode*& m_rpFoundNode; -LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) : m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {}; +LinkAnchorSearchHint(SwNodes& rNodes, const SwNode*& rpFoundNode) +: SfxHint(SfxHintId::SwLinkAnchorSearch), m_rNodes(rNodes), m_rpFoundNode(rpFoundNode) {}; virtual ~LinkAnchorSearchHint() override; }; struct InRangeSearchHint final : public SfxHint @@ -42,7 +43,7 @@ namespace sw const SwNodeOffset m_nSttNd, m_nEndNd; bool& m_rIsInRange; InRangeSearchHint(const SwNodeOffset nSttNd, const SwNodeOffset nEndNd, bool& rIsInRange) -: m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {} +: SfxHint(SfxHintId::SwInRangeSearch), m_nSttNd(nSttNd), m_nEndNd(nEndNd), m_rIsInRange(rIsInRange) {} }; } diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index 5df4f0beaf57..3976152b5822 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -90,7 +90,
core.git: sw/inc sw/source
sw/inc/redline.hxx |5 - sw/source/core/undo/undobj.cxx |3 --- sw/source/uibase/misc/redlndlg.cxx |7 --- sw/source/uibase/shells/textfld.cxx | 14 -- 4 files changed, 29 deletions(-) New commits: commit e4568240bdfd173c274a392e61c05445afb73dd2 Author: Noel Grandin AuthorDate: Tue Sep 3 15:43:22 2024 +0200 Commit: Noel Grandin CommitDate: Tue Sep 3 18:55:43 2024 +0200 SwRedlineHint is dead ever since commit 43a36b36986dd2112fc90340e7a8a11ea5369def Author: Robert Roth Date: Mon Nov 1 02:50:47 2010 +0200 Commented out code, bogus comments removed, some german comments translated. Change-Id: I9a6424080728ee42e1705e144cd53aa6069f2abe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172826 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index 06ea78c6d37e..20befbaa43d7 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -344,11 +344,6 @@ public: { return m_aRedlineData; } }; -class SW_DLLPUBLIC SwRedlineHint final : public SfxHint -{ -}; - - namespace sw { std::vector> GetAllValidRanges(std::unique_ptr p); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 55f25bd238d6..28563edbbf56 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1450,9 +1450,6 @@ void SwRedlineSaveData::RedlineToDoc( SwPaM const & rPam ) RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags(); rDoc.getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld | RedlineFlags::DontCombineRedlines ); -//#i92154# let UI know about a new redline with comment -if (rDoc.GetDocShell() && (!pRedl->GetComment().isEmpty()) ) -rDoc.GetDocShell()->Broadcast(SwRedlineHint()); auto const result(rDoc.getIDocumentRedlineAccess().AppendRedline(pRedl, true)); assert(result != IDocumentRedlineAccess::AppendResult::IGNORED); // SwRedlineSaveData::RedlineToDoc: insert redline failed diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 2f758048d14b..61fff609764b 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -1465,13 +1465,6 @@ IMPL_LINK(SwRedlineAcceptDlg, CommandHdl, const CommandEvent&, rCEvt, bool) const SwRangeRedline &rRedline = pSh->GetRedline(nPos); -/* enable again once we have redline comments in the margin -sComment = rRedline.GetComment(); -if ( !sComment.Len() ) - GetActiveView()->GetDocShell()->Broadcast(SwRedlineHint(&rRedline,SWREDLINE_INSERTED)); - const_cast(rRedline).Broadcast(SwRedlineHint(&rRedline,SWREDLINE_FOCUS)); -*/ - OUString sComment = convertLineEnd(rRedline.GetComment(), GetSystemLineEnd()); SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); ::DialogGetRanges fnGetRange = pFact->GetDialogGetRangesFunc(); diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 88ad90347ceb..1335958232eb 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -536,20 +536,6 @@ void SwTextShell::ExecField(SfxRequest &rReq) break; case FN_REDLINE_COMMENT: { -/* this code can be used once we want redline comments in the margin, all other stuff can -then be deleted -String sComment; -const SwRangeRedline *pRedline = rSh.GetCurrRedline(); - -if (pRedline) -{ -sComment = pRedline->GetComment(); -if ( !sComment.Len() ) - GetView().GetDocShell()->Broadcast(SwRedlineHint(pRedline,SWREDLINE_INSERTED)); - const_cast(pRedline)->Broadcast(SwRedlineHint(pRedline,SWREDLINE_FOCUS,&GetView())); -} -*/ - const SwRangeRedline *pRedline = rSh.GetCurrRedline(); SwDoc *pDoc = rSh.GetDoc(); // If index is specified, goto and select the appropriate redline
core.git: basegfx/source
basegfx/source/polygon/b2dpolygon.cxx | 20 +++- 1 file changed, 3 insertions(+), 17 deletions(-) New commits: commit 5456431aff45c7080ad894f055bcd7513a93a6a6 Author: Noel Grandin AuthorDate: Sun Sep 1 09:16:24 2024 +0200 Commit: Noel Grandin CommitDate: Sun Sep 1 15:19:01 2024 +0200 ImplB2DPolygon could do with a move constructor somewhat surprising coverity did not flag this Change-Id: I52684c6adbf3e051c3ada88fc427078cf0867460 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172709 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index dabca6674f8f..5c68036f7644 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -611,6 +611,8 @@ public: } } +ImplB2DPolygon(ImplB2DPolygon&&) = default; + ImplB2DPolygon(const ImplB2DPolygon& rToBeCopied, sal_uInt32 nIndex, sal_uInt32 nCount) : maPoints(rToBeCopied.maPoints, nIndex, nCount), mbIsClosed(rToBeCopied.mbIsClosed) @@ -625,24 +627,8 @@ public: } } -ImplB2DPolygon& operator=(const ImplB2DPolygon& rOther) -{ -if (this != &rOther) -{ -moControlVector.reset(); -mpBufferedData.reset(); -maPoints = rOther.maPoints; -mbIsClosed = rOther.mbIsClosed; -if (rOther.moControlVector && rOther.moControlVector->isUsed()) -{ -moControlVector.emplace( *rOther.moControlVector ); -if(!moControlVector->isUsed()) -moControlVector.reset(); -} -} -return *this; -} +ImplB2DPolygon& operator=(ImplB2DPolygon&&) = default; sal_uInt32 count() const {
core.git: basegfx/source
basegfx/source/polygon/b2dpolygon.cxx | 58 +- 1 file changed, 57 insertions(+), 1 deletion(-) New commits: commit 9686a654506999a806a51ee1a13c871be4ba27a0 Author: Noel Grandin AuthorDate: Sun Sep 1 09:13:06 2024 +0200 Commit: Noel Grandin CommitDate: Sun Sep 1 12:39:13 2024 +0200 avoid intermediate copy in B2DPolygon::append Change-Id: If187028195afcef42f9171f54651ada35bf3be4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172708 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index b54570df36ac..dabca6674f8f 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -100,6 +100,16 @@ public: maVector.insert(aIndex, aStart, aEnd); } +void insert(sal_uInt32 nIndex, const CoordinateDataArray2D& rSource, sal_uInt32 nSourceIndex, sal_uInt32 nSourceCount) +{ +// insert data +auto aIndex = maVector.begin(); +aIndex += nIndex; +auto aStart = rSource.maVector.cbegin() + nSourceIndex; +auto aEnd = rSource.maVector.cbegin() + nSourceIndex + nSourceCount; +maVector.insert(aIndex, aStart, aEnd); +} + void remove(sal_uInt32 nIndex, sal_uInt32 nCount) { assert(nCount > 0); @@ -365,6 +375,27 @@ public: } } +void insert(sal_uInt32 nIndex, const ControlVectorArray2D& rSource, sal_uInt32 nSourceIndex, sal_uInt32 nSourceCount) +{ +assert(rSource.maVector.size() > 0); +assert(nIndex + nSourceCount <= maVector.size()); + +// insert data +ControlVectorPair2DVector::iterator aIndex(maVector.begin() + nIndex); +ControlVectorPair2DVector::const_iterator aStart(rSource.maVector.begin() + nSourceIndex); +ControlVectorPair2DVector::const_iterator aEnd(rSource.maVector.begin() + nSourceIndex + nSourceCount); +maVector.insert(aIndex, aStart, aEnd); + +for(; aStart != aEnd; ++aStart) +{ +if(!aStart->getPrevVector().equalZero()) +mnUsedVectors++; + +if(!aStart->getNextVector().equalZero()) +mnUsedVectors++; +} +} + void remove(sal_uInt32 nIndex, sal_uInt32 nCount) { assert(nCount > 0); @@ -807,6 +838,31 @@ public: setPrevControlVector(nCount, rPrev); } +void append(const ImplB2DPolygon& rSource, sal_uInt32 nSourceIndex, sal_uInt32 nSourceCount) +{ +assert(rSource.maPoints.count() > 0); +const sal_uInt32 nIndex = count(); + +mpBufferedData.reset(); + +maPoints.insert(nIndex, rSource.maPoints, nSourceIndex, nSourceCount); + +if(rSource.moControlVector && rSource.moControlVector->isUsed()) +{ +if (!moControlVector) +moControlVector.emplace(nIndex); +moControlVector->insert(nIndex, *rSource.moControlVector, nSourceIndex, nSourceCount); + +if(!moControlVector->isUsed()) +moControlVector.reset(); +} +else if(moControlVector) +{ +ControlVectorPair2D aVectorPair; +moControlVector->insert(nIndex, aVectorPair, rSource.count()); +} +} + void append(const ImplB2DPolygon& rSource) { assert(rSource.maPoints.count() > 0); @@ -1378,7 +1434,7 @@ namespace basegfx } else { -mpPolygon->append(ImplB2DPolygon(*rPoly.mpPolygon, nIndex, nCount)); +mpPolygon->append(*rPoly.mpPolygon, nIndex, nCount); } }
core.git: sw/source
sw/source/core/txtnode/ndtxt.cxx | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) New commits: commit 47e82cfa883b41e6a43285d78b16d20238f166cf Author: Noel Grandin AuthorDate: Fri Aug 30 10:46:06 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 30 14:35:40 2024 +0200 no need to heap allocate the collector in its empty state it is only three words big Change-Id: I5e3984126bcc5efe8fd2cc6c717d31fb2272408f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172644 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index f5686e486e54..972cccd9b512 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1266,7 +1266,7 @@ void SwTextNode::Update( assert(rPos.GetContentNode() == this); SetAutoCompleteWordDirty( true ); -std::unique_ptr pCollector; +SwpHts aCollector; const sal_Int32 nChangePos = rPos.GetIndex(); if ( HasHints() ) @@ -1389,22 +1389,18 @@ void SwTextNode::Update( } else if( bNoExp ) { -if (!pCollector) -{ - pCollector.reset( new SwpHts ); -} -auto it = std::find_if(pCollector->begin(), pCollector->end(), +auto it = std::find_if(aCollector.begin(), aCollector.end(), [nWhich](const SwTextAttr *pTmp) { return nWhich == pTmp->Which(); }); -if (it != pCollector->end()) +if (it != aCollector.end()) { SwTextAttr *pTmp = *it; -pCollector->erase( it ); +aCollector.erase( it ); SwTextAttr::Destroy( pTmp ); } SwTextAttr * const pTmp = MakeTextAttr( GetDoc(), pHint->GetAttr(), nChangePos, nChangePos + nChangeLen); -pCollector->push_back( pTmp ); +aCollector.push_back( pTmp ); } else { @@ -1594,13 +1590,9 @@ void SwTextNode::Update( // base class SwContentIndexReg::Update(rPos, nChangeLen, eMode); -if (pCollector) +for ( SwTextAttr* pAttr : aCollector ) { -const size_t nCount = pCollector->size(); -for ( size_t i = 0; i < nCount; ++i ) -{ -m_pSwpHints->TryInsertHint( (*pCollector)[ i ], *this ); -} +m_pSwpHints->TryInsertHint( pAttr, *this ); } aTmpIdxReg.MoveTo( *this );
core.git: sw/source
sw/source/writerfilter/inc/dmapper/resourcemodel.hxx |7 sw/source/writerfilter/ooxml/Handler.cxx |4 sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx |4 sw/source/writerfilter/ooxml/OOXMLFactory.cxx| 28 sw/source/writerfilter/ooxml/OOXMLFactory.hxx|2 sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx | 150 ++-- sw/source/writerfilter/ooxml/OOXMLFastContextHandler.hxx | 36 sw/source/writerfilter/ooxml/OOXMLFastHelper.hxx |9 sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx| 546 --- sw/source/writerfilter/ooxml/OOXMLPropertySet.hxx| 300 +--- sw/source/writerfilter/ooxml/factory_ns.py |2 sw/source/writerfilter/ooxml/factoryimpl_ns.py | 49 - sw/source/writerfilter/rtftok/rtfvalue.hxx |2 13 files changed, 363 insertions(+), 776 deletions(-) New commits: commit 1f5a6dd3590432f3582bd62f6c896e0c6200113c Author: Noel Grandin AuthorDate: Sun Aug 25 21:10:22 2024 +0200 Commit: Noel Grandin CommitDate: Thu Aug 29 10:05:23 2024 +0200 flatten ooxml::Value hierarchy into a std::variant. Since it is always one of a very small set of subclasses. Which means we can pass it around by value and avoid allocating it on the heap, which reduces parsing time. Change-Id: Ic83b48cb3fdec17779a2ad59abbc585156f5ffa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172451 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/writerfilter/inc/dmapper/resourcemodel.hxx b/sw/source/writerfilter/inc/dmapper/resourcemodel.hxx index ea4ecdde03af..bf1b4f65179a 100644 --- a/sw/source/writerfilter/inc/dmapper/resourcemodel.hxx +++ b/sw/source/writerfilter/inc/dmapper/resourcemodel.hxx @@ -330,14 +330,9 @@ protected: makes no sense for a certain value, e.g. the integer value of a string. */ -class Value : public virtual SvRefBase +class Value { public: -/** - Pointer to a value. - */ -typedef tools::SvRef Pointer_t; - /** Returns integer representation of the value. */ diff --git a/sw/source/writerfilter/ooxml/Handler.cxx b/sw/source/writerfilter/ooxml/Handler.cxx index 103344d2b097..bed1a9b6b866 100644 --- a/sw/source/writerfilter/ooxml/Handler.cxx +++ b/sw/source/writerfilter/ooxml/Handler.cxx @@ -386,7 +386,7 @@ OOXMLHyperlinkURLHandler::OOXMLHyperlinkURLHandler(OOXMLFastContextHandler * pCo OOXMLHyperlinkURLHandler::~OOXMLHyperlinkURLHandler() { mpFastContext->clearProps(); -mpFastContext->newProperty(NS_ooxml::LN_CT_Hyperlink_URL, OOXMLValue::Pointer_t(new OOXMLStringValue(mURL))); +mpFastContext->newProperty(NS_ooxml::LN_CT_Hyperlink_URL, OOXMLValue::createString(mURL)); } void OOXMLHyperlinkURLHandler::attribute(Id name, const Value & val) @@ -414,7 +414,7 @@ OOXMLAltChunkHandler::~OOXMLAltChunkHandler() { mpFastContext->clearProps(); mpFastContext->newProperty(NS_ooxml::LN_CT_AltChunk, - OOXMLValue::Pointer_t(new OOXMLStringValue(m_aStreamName))); + OOXMLValue::createString(m_aStreamName)); } void OOXMLAltChunkHandler::attribute(Id nName, const Value& rValue) diff --git a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx index 8321016ffb9e..45ee7e19156e 100644 --- a/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLDocumentImpl.cxx @@ -343,13 +343,13 @@ OOXMLPropertySet * OOXMLDocumentImpl::getPicturePropSet writerfilter::Reference::Pointer_t xPicture (new OOXMLBinaryObjectReference(std::move(xStream))); -OOXMLValue::Pointer_t pPayloadValue(new OOXMLBinaryValue(std::move(xPicture))); +OOXMLValue pPayloadValue(OOXMLValue::createBinary(std::move(xPicture))); OOXMLPropertySet::Pointer_t pBlipSet(new OOXMLPropertySet); pBlipSet->add(NS_ooxml::LN_payload, pPayloadValue, OOXMLProperty::ATTRIBUTE); -OOXMLValue::Pointer_t pBlipValue(new OOXMLPropertySetValue(std::move(pBlipSet))); +OOXMLValue pBlipValue(OOXMLValue::createPropertySet(std::move(pBlipSet))); OOXMLPropertySet * pProps = new OOXMLPropertySet; diff --git a/sw/source/writerfilter/ooxml/OOXMLFactory.cxx b/sw/source/writerfilter/ooxml/OOXMLFactory.cxx index b11cf07c2900..0d9185ef9601 100644 --- a/sw/source/writerfilter/ooxml/OOXMLFactory.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLFactory.cxx @@ -55,51 +55,51 @@ void OOXMLFactory::attributes(OOXMLFastContextHandler * pHandler, Id nId = pFactory->getResourceId(nDefine, nToken); -OOXMLValue::Pointer_t xValue; +OOXMLValue xValue; switch (pAttr->m_nResource) { case ResourceType::Boolean: -xValue = OOXMLBooleanValue::Create(rAttribs.getAsViewByIndex(nAttrIndex)); +xValue = OOXMLValue::createBoolea
core.git: drawinglayer/source
drawinglayer/source/processor2d/vclprocessor2d.cxx | 27 + 1 file changed, 7 insertions(+), 20 deletions(-) New commits: commit df6293ad0634a29ff4d0196d1f9230062ccc95ca Author: Noel Grandin AuthorDate: Wed Aug 28 12:44:31 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 19:35:30 2024 +0200 tdf#161983 Page background image follows scrolled view regression from commit 2a9b53bb9f85c2869c779dde36a2d77353fef14b Author: Noel Grandin Date: Thu Jun 27 10:18:15 2024 +0200 tdf#160345 Slow rendering of filled polygon Change-Id: I38abd82d33cc25a56a26d8ccac26fb5f90e9c0fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172526 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 718c725fc88f..889a46f1c019 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -722,27 +722,14 @@ bool VclProcessor2D::RenderFillGraphicPrimitive2DImpl( const sal_Int32 nOffsetX(basegfx::fround(rFillGraphicAttribute.getOffsetX() * nBWidth)); const sal_Int32 nOffsetY(basegfx::fround(rFillGraphicAttribute.getOffsetY() * nBHeight)); -if (nOffsetX == 0 && nOffsetY == 0) +// if the tile is a single pixel big, just flood fill with that pixel color +if (nOffsetX == 0 && nOffsetY == 0 && aNeededBitmapSizePixel.getWidth() == 1 +&& aNeededBitmapSizePixel.getHeight() == 1) { -if (!bPreScaled) -aBitmapEx.Scale(aNeededBitmapSizePixel); - -// if the tile is a single pixel big, just flood fill with that pixel color -if (aNeededBitmapSizePixel.getWidth() == 1 && aNeededBitmapSizePixel.getHeight() == 1) -{ -Color col = aBitmapEx.GetPixelColor(0, 0); -mpOutputDevice->SetLineColor(col); -mpOutputDevice->SetFillColor(col); -mpOutputDevice->DrawRect(aVisiblePixel); -} -else -{ -// TODO vcl does not have an optimised path here, it should be passing some kind of fill/tile -// operation down to the cairo/skia layers -Wallpaper aWallpaper(aBitmapEx); -aWallpaper.SetColor(COL_TRANSPARENT); -mpOutputDevice->DrawWallpaper(aVisiblePixel, aWallpaper); -} +Color col = aBitmapEx.GetPixelColor(0, 0); +mpOutputDevice->SetLineColor(col); +mpOutputDevice->SetFillColor(col); +mpOutputDevice->DrawRect(aVisiblePixel); } else if (nOffsetX) {
core.git: 2 commits - i18nlangtag/source sw/source
i18nlangtag/source/languagetag/languagetag.cxx | 18 - sw/source/core/unocore/unostyle.cxx| 33 +++-- 2 files changed, 38 insertions(+), 13 deletions(-) New commits: commit 741909fea54b49de295af6685efa69b8444dc382 Author: Noel Grandin AuthorDate: Wed Aug 28 14:58:29 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 19:35:19 2024 +0200 crashtesting in abiword doc regression from commit 60aeca980bbe6cd35d9ce530ea8704bc4ade7b7b Author: Noel Grandin Date: Wed Aug 14 09:32:51 2024 +0200 tdf#158556 bypass some more logic for toggle properties re-introduce some of the logic I elided Change-Id: If20ca9eb0134d743ca62335fb4eae400e8c8221a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172531 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index de77ddadf66d..3cc2533c7137 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -2451,29 +2451,38 @@ void SwXStyle::getToggleAttributes( xDocStyleSheet = new SwDocStyleSheet(*static_cast(pStyleSheetBase)); maUnoStyleSheets.insert({pStyleSheetBase, xDocStyleSheet}); } -const SfxItemSet& rItemSet(xDocStyleSheet->GetItemSet()); -assert(rItemSet.GetParent()); +std::optional oTempItemSet; +const SfxItemSet* pItemSet; +if (xDocStyleSheet->GetItemSet().GetParent()) +pItemSet = &xDocStyleSheet->GetItemSet(); +else +{ +// set parent style to have the correct XFillStyle setting as XFILL_NONE +oTempItemSet.emplace(xDocStyleSheet->GetItemSet()); + oTempItemSet->SetParent(&m_pDoc->GetDfltTextFormatColl()->GetAttrSet()); +pItemSet = &*oTempItemSet; +} uno::Any aResult; -lcl_getTogglePropertyValue(RES_CHRATR_WEIGHT, MID_WEIGHT, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_WEIGHT, MID_WEIGHT, *pItemSet, aResult); aResult >>= rfCharStyleBold; -lcl_getTogglePropertyValue(RES_CHRATR_CTL_WEIGHT, MID_WEIGHT, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_CTL_WEIGHT, MID_WEIGHT, *pItemSet, aResult); aResult >>= rfCharStyleBoldComplex; -lcl_getTogglePropertyValue(RES_CHRATR_POSTURE, MID_POSTURE, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_POSTURE, MID_POSTURE, *pItemSet, aResult); aResult >>= reCharStylePosture; -lcl_getTogglePropertyValue(RES_CHRATR_CTL_POSTURE, MID_POSTURE, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_CTL_POSTURE, MID_POSTURE, *pItemSet, aResult); aResult >>= reCharStylePostureComplex; -lcl_getTogglePropertyValue(RES_CHRATR_CASEMAP, 0, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_CASEMAP, 0, *pItemSet, aResult); aResult >>= rnCharStyleCaseMap; -lcl_getTogglePropertyValue(RES_CHRATR_RELIEF, 0, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_RELIEF, 0, *pItemSet, aResult); aResult >>= rnCharStyleRelief; -lcl_getTogglePropertyValue(RES_CHRATR_CONTOUR, 0, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_CONTOUR, 0, *pItemSet, aResult); aResult >>= rbCharStyleContoured; -lcl_getTogglePropertyValue(RES_CHRATR_SHADOWED, 0, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_SHADOWED, 0, *pItemSet, aResult); aResult >>= rbCharStyleShadowed; -lcl_getTogglePropertyValue(RES_CHRATR_CROSSEDOUT, MID_CROSS_OUT, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_CROSSEDOUT, MID_CROSS_OUT, *pItemSet, aResult); aResult >>= rnCharStyleStrikeThrough; -lcl_getTogglePropertyValue(RES_CHRATR_HIDDEN, 0, rItemSet, aResult); +lcl_getTogglePropertyValue(RES_CHRATR_HIDDEN, 0, *pItemSet, aResult); aResult >>= rbCharStyleHidden; } commit b076e6a0b92ee989d31a8525cfab4636737b30dc Author: Noel Grandin AuthorDate: Wed Aug 28 10:48:20 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 19:35:08 2024 +0200 tdf#158556 avoid a ton of temporary OUString Change-Id: I5256210d73eb54d4e6ea98b68c1e9eabf8770ccd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172525 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 5a922babd5ea..b43efe2625a0 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -2822,7 +2823,22 @@ LanguageType LanguageTag::convertToLanguageType( const css::lang::Locale& rLocal if (rLocale.Language.isEmpty() && !bResolveSystem) return LANGUAGE_SYSTEM; -return LanguageTag( rLocale).getLanguageType( bResolveSystem); +if (!bResolveSystem) +{ +// single-item c
core.git: package/inc package/source
package/inc/ZipFile.hxx |1 + package/source/zipapi/ZipFile.cxx | 29 + 2 files changed, 22 insertions(+), 8 deletions(-) New commits: commit bf1099e360193e18c29e7b042dcc1480050a4e48 Author: Noel Grandin AuthorDate: Tue Aug 27 14:21:33 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 07:35:23 2024 +0200 tdf#158556 reduce allocations in ZipFile we can allocate these buffers one caller up in ReadCEN and then re-use them Change-Id: I07e98168ee2884286f4a1c281acd86e365416149 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172481 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index 4704d0e09910..c52bfc7a0366 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -93,6 +93,7 @@ private: void getSizeAndCRC( sal_Int64 nOffset, sal_Int64 nCompressedSize, sal_Int64 *nSize, sal_Int32 *nCRC ); sal_uInt64 readLOC(ZipEntry &rEntry); +sal_uInt64 readLOC_Impl(ZipEntry &rEntry, std::vector& rNameBuffer, std::vector& rExtraBuffer); sal_Int32 readCEN(); std::tuple findCentralDirectory(); void HandlePK34(std::span data, sal_Int64 dataOffset, sal_Int64 totalSize); diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 706292148da3..7914c772dbb7 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -929,6 +929,16 @@ uno::Reference< XInputStream > ZipFile::getWrappedRawStream( } sal_uInt64 ZipFile::readLOC(ZipEntry &rEntry) +{ +::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); +std::vector aNameBuffer; +std::vector aExtraBuffer; +return readLOC_Impl(rEntry, aNameBuffer, aExtraBuffer); +} + +// Pass in a shared name buffer to reduce the number of allocations +// we do when reading the CEN. +sal_uInt64 ZipFile::readLOC_Impl(ZipEntry &rEntry, std::vector& rNameBuffer, std::vector& rExtraBuffer) { ::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() ); @@ -977,9 +987,9 @@ sal_uInt64 ZipFile::readLOC(ZipEntry &rEntry) { // read always in UTF8, some tools seem not to set UTF8 bit // coverity[tainted_data] - we've checked negative lens, and up to max short is ok here -std::vector aNameBuffer(nPathLen); -sal_Int32 nRead = aGrabber.readBytes(aNameBuffer.data(), nPathLen); -std::string_view aNameView(reinterpret_cast(aNameBuffer.data()), nRead); +rNameBuffer.reserve(nPathLen); +sal_Int32 nRead = aGrabber.readBytes(rNameBuffer.data(), nPathLen); +std::string_view aNameView(reinterpret_cast(rNameBuffer.data()), nRead); OUString sLOCPath( aNameView.data(), aNameView.size(), RTL_TEXTENCODING_UTF8 ); @@ -999,9 +1009,9 @@ sal_uInt64 ZipFile::readLOC(ZipEntry &rEntry) ::std::optional oOffset64; if (nExtraLen != 0) { -std::vector aExtraBuffer(nExtraLen); -aGrabber.readBytes(aExtraBuffer.data(), nExtraLen); -MemoryByteGrabber extraMemGrabber(aExtraBuffer.data(), nExtraLen); +rExtraBuffer.reserve(nExtraLen); +aGrabber.readBytes(rExtraBuffer.data(), nExtraLen); +MemoryByteGrabber extraMemGrabber(rExtraBuffer.data(), nExtraLen); isZip64 = readExtraFields(extraMemGrabber, nExtraLen, nLocSize, nLocCompressedSize, oOffset64, &aNameView); @@ -1330,7 +1340,8 @@ sal_Int32 ZipFile::readCEN() throw ZipException(u"central directory too big"_ustr); aGrabber.seek(nCenPos); -std::vector aCENBuffer(nCenLen); +std::vector aCENBuffer; +aCENBuffer.reserve(nCenLen); sal_Int64 nRead = aGrabber.readBytes ( aCENBuffer.data(), nCenLen ); if (nCenLen != nRead) throw ZipException (u"Error reading CEN into memory buffer!"_ustr ); @@ -1343,6 +1354,8 @@ sal_Int32 ZipFile::readCEN() aEntries.reserve(nTotal); sal_Int64 nCount; +std::vector aTempNameBuffer; +std::vector aTempExtraBuffer; for (nCount = 0 ; nCount < nTotal; nCount++) { sal_Int32 nTestSig = aMemGrabber.ReadInt32(); @@ -1420,7 +1433,7 @@ sal_Int32 ZipFile::readCEN() // unfortunately readLOC is required now to check the consistency assert(aEntry.nOffset <= 0); sal_uInt64 const nStart{ o3tl::make_unsigned(-aEntry.nOffset) }; -sal_uInt64 const nEnd = readLOC(aEntry); +sal_uInt64 const nEnd = readLOC_Impl(aEntry, aTempNameBuffer, aTempExtraBuffer); assert(nStart < nEnd); for (auto it = unallocated.begin(); ; ++it) {
core.git: sd/source
sd/source/ui/animations/CustomAnimationPane.cxx |4 ++-- sd/source/ui/annotations/annotationmanager.cxx | 14 -- sd/source/ui/func/fusearch.cxx |5 +++-- sd/source/ui/table/TableDesignPane.cxx | 18 -- sd/source/ui/view/DocumentRenderer.cxx |2 +- sd/source/ui/view/Outliner.cxx |5 +++-- sd/source/ui/view/ViewShellBase.cxx |4 ++-- sd/source/ui/view/viewshe2.cxx |4 ++-- 8 files changed, 33 insertions(+), 23 deletions(-) New commits: commit 1e0ba98adf0123aed4a0f9a208d1b132a6d2b7ab Author: Noel Grandin AuthorDate: Tue Aug 27 19:10:28 2024 +0200 Commit: Noel Grandin CommitDate: Wed Aug 28 07:34:05 2024 +0200 GetMainViewShell is not trivial Change-Id: I86eec22a6ebb8957d983f63d37bf11b8bfa1a2bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172475 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index a6fa4bad98dd..7db1fd0bb925 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -289,9 +289,9 @@ IMPL_LINK(CustomAnimationPane,EventMultiplexerListener, // At this moment the controller may not yet been set at model // or ViewShellBase. Take it from the view shell passed with // the event. -if (mrBase.GetMainViewShell() != nullptr) +if (auto pMainViewShell = mrBase.GetMainViewShell().get()) { -if( mrBase.GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS ) +if( pMainViewShell->GetShellType() == ViewShell::ST_IMPRESS ) { mxView = mrBase.GetDrawController(); onSelectionChanged(); diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index cada3c0c29ad..d3d70d45badb 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -119,16 +119,18 @@ SfxItemPool* GetAnnotationPool() static SfxBindings* getBindings( ViewShellBase const & rBase ) { -if( rBase.GetMainViewShell() && rBase.GetMainViewShell()->GetViewFrame() ) -return &rBase.GetMainViewShell()->GetViewFrame()->GetBindings(); +auto pMainViewShell = rBase.GetMainViewShell().get(); +if( pMainViewShell && pMainViewShell->GetViewFrame() ) +return &pMainViewShell->GetViewFrame()->GetBindings(); return nullptr; } static SfxDispatcher* getDispatcher( ViewShellBase const & rBase ) { -if( rBase.GetMainViewShell() && rBase.GetMainViewShell()->GetViewFrame() ) -return rBase.GetMainViewShell()->GetViewFrame()->GetDispatcher(); +auto pMainViewShell = rBase.GetMainViewShell().get(); +if( pMainViewShell && pMainViewShell->GetViewFrame() ) +return pMainViewShell->GetViewFrame()->GetDispatcher(); return nullptr; } @@ -1260,8 +1262,8 @@ SdPage* AnnotationManagerImpl::GetNextPage( SdPage const * pPage, bool bForward SdPage* AnnotationManagerImpl::GetCurrentPage() { -if (mrBase.GetMainViewShell()) -return mrBase.GetMainViewShell()->getCurrentPage(); +if (auto pMainViewShell = mrBase.GetMainViewShell().get()) +return pMainViewShell->getCurrentPage(); return nullptr; } diff --git a/sd/source/ui/func/fusearch.cxx b/sd/source/ui/func/fusearch.cxx index 4856dd20bece..d038e59f3a74 100644 --- a/sd/source/ui/func/fusearch.cxx +++ b/sd/source/ui/func/fusearch.cxx @@ -81,12 +81,13 @@ void FuSearch::DoExecute( SfxRequest& ) } else if ( dynamic_cast< const NotesPanelViewShell *>( mpViewShell ) != nullptr ) { -if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() == ViewShell::ST_OUTLINE ) +ViewShell::ShellType nShellType = mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType(); +if( nShellType == ViewShell::ST_OUTLINE ) { m_bOwnOutliner = false; m_pSdOutliner = mpDoc->GetOutliner(); } -if( mpViewShell->GetViewShellBase().GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS ) +if( nShellType == ViewShell::ST_IMPRESS ) { m_bOwnOutliner = true; m_pSdOutliner = new SdOutliner( mpDoc, OutlinerMode::TextObject ); diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index dcac6a380874..1cbdfc8a629b 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -416,18 +416,24 @@ void TableDesignWidget::EditStyle(const OUString& rCommand) static SfxBindings* getBindings( ViewShellBase const & rBase ) { -if( rBase.GetMainViewShell() && rBase.GetMainViewShell()->GetViewFrame() ) -return &rBa
core.git: sw/source
sw/source/writerfilter/ooxml/OOXMLParserState.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit fcc1b0d637807830c684741aad885986bc5b86db Author: Noel Grandin AuthorDate: Tue Aug 27 13:25:15 2024 +0200 Commit: Noel Grandin CommitDate: Tue Aug 27 19:10:56 2024 +0200 tdf#158556 avoid some temporary OOXMLPropertySet no need to allocate a new one here, the caller will hand us a new one if we need it Change-Id: Ib569535c76631c52ed997228055bbc2f36e4749b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172466 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/source/writerfilter/ooxml/OOXMLParserState.cxx b/sw/source/writerfilter/ooxml/OOXMLParserState.cxx index b8cc55377b5b..9a145bfdd038 100644 --- a/sw/source/writerfilter/ooxml/OOXMLParserState.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLParserState.cxx @@ -114,7 +114,7 @@ void OOXMLParserState::resolveCharacterProperties(Stream & rStream) if (mpCharacterProps) { rStream.props(mpCharacterProps.get()); -mpCharacterProps = new OOXMLPropertySet; +mpCharacterProps = nullptr; } }
core.git: 2 commits - include/svl package/inc package/source svl/source sw/source
include/svl/SfxBroadcaster.hxx |2 +- package/inc/ZipFile.hxx |2 +- package/source/zipapi/ZipFile.cxx| 22 +- svl/source/notify/SfxBroadcaster.cxx |2 +- sw/source/core/unocore/unostyle.cxx | 17 - 5 files changed, 24 insertions(+), 21 deletions(-) New commits: commit a9d806a68f4d8b21d80b8c0f35cb3a38d4b460aa Author: Noel Grandin AuthorDate: Tue Aug 27 13:12:41 2024 +0200 Commit: Noel Grandin CommitDate: Tue Aug 27 17:24:44 2024 +0200 tdf#158556 prevent lambda from allocating on heap bit of a hack Change-Id: Icf60fc1bc69e8c44e5612c05469164439f14a249 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172465 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/SfxBroadcaster.hxx b/include/svl/SfxBroadcaster.hxx index f4ba2264a066..e4b0f46cdeff 100644 --- a/include/svl/SfxBroadcaster.hxx +++ b/include/svl/SfxBroadcaster.hxx @@ -55,7 +55,7 @@ public: /** Iterate over all the listeners and call the passed function. return true to break the loop. */ -void ForAllListeners(std::function f) const; +void ForAllListeners(const std::function& f) const; /** used to avoid dynamic_cast cost */ virtual bool IsSfxStyleSheet() const; diff --git a/svl/source/notify/SfxBroadcaster.cxx b/svl/source/notify/SfxBroadcaster.cxx index c9a26aabb7c8..a09de0377f81 100644 --- a/svl/source/notify/SfxBroadcaster.cxx +++ b/svl/source/notify/SfxBroadcaster.cxx @@ -131,7 +131,7 @@ void SfxBroadcaster::RemoveListener(SfxListener& rListener) m_RemovedPositions.push_back(positionOfRemovedElement); } -void SfxBroadcaster::ForAllListeners(std::function f) const +void SfxBroadcaster::ForAllListeners(const std::function& f) const { for (size_t i = 0; i < m_Listeners.size(); ++i) { diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index e1525ed25e1a..de77ddadf66d 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1186,21 +1186,28 @@ uno::Any SAL_CALL SwXStyleFamily::getPropertyValue( const OUString& sPropertyNam SwXStyle* SwXStyleFamily::FindStyle(std::u16string_view rStyleName) const { -SwXStyle* pFoundStyle = nullptr; +// put params for lambda into struct, so that the lambda does not allocate memory on the heap. +struct MyParams { +const StyleFamilyEntry& m_rEntry; +SwXStyle* pFoundStyle; +std::u16string_view aStyleName; +} aParams { m_rEntry, nullptr, rStyleName }; m_pBasePool->ForAllListeners( -[this, &pFoundStyle, &rStyleName] (SfxListener* pListener) +[&aParams] (SfxListener* pListener) { if (!pListener->IsSwXStyle()) return false; SwXStyle* pTempStyle = static_cast(pListener); -if(pTempStyle && pTempStyle->GetFamily() == m_rEntry.family() && pTempStyle->GetStyleName() == rStyleName) +if(pTempStyle +&& pTempStyle->GetFamily() == aParams.m_rEntry.family() +&& pTempStyle->GetStyleName() == aParams.aStyleName) { -pFoundStyle = pTempStyle; +aParams.pFoundStyle = pTempStyle; return true; // break } return false; }); -return pFoundStyle; +return aParams.pFoundStyle; } static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum(SfxStyleFamily eFamily) commit 1a47d1e00ddadce2c4dc9e6d10fc815f8c7d9e59 Author: Noel Grandin AuthorDate: Tue Aug 27 11:53:38 2024 +0200 Commit: Noel Grandin CommitDate: Tue Aug 27 17:24:36 2024 +0200 tdf#158556 unnecessary temporary OUString in ZipFile Change-Id: Iea3bf5fa9ba5210eabca521316cfd68b440ec806 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172458 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx index 65df2ad00a60..4704d0e09910 100644 --- a/package/inc/ZipFile.hxx +++ b/package/inc/ZipFile.hxx @@ -101,7 +101,7 @@ private: static bool readExtraFields(MemoryByteGrabber& aMemGrabber, sal_Int16 nExtraLen, sal_uInt64& nSize, sal_uInt64& nCompressedSize, ::std::optional & roOffset, -OUString const* pCENFilenameToCheck); +std::string_view const * pCENFilenameToCheck); public: diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index 37907647711b..706292148da3 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -979,12 +979,9 @@ sal_uInt64 ZipFile::readLOC(ZipEntry &rEntry) // coverity[tainted_data] - we've checked negative lens, and up to max short is ok here std::vector aNameBuffer(nPathLen); sal_Int32 nRead = aGrabber.readBytes(aName
core.git: Branch 'distro/collabora/co-24.04' - sw/inc sw/source
sw/inc/IDocumentMarkAccess.hxx |7 ++ sw/source/core/doc/CntntIdxStore.cxx |4 + sw/source/core/doc/docbm.cxx | 84 +-- sw/source/core/inc/MarkManager.hxx |1 4 files changed, 92 insertions(+), 4 deletions(-) New commits: commit 2329d0ebf6a602f9a91edc155279ac1a96da573d Author: Noel Grandin AuthorDate: Sat Aug 10 15:18:15 2024 +0200 Commit: Noel Grandin CommitDate: Tue Aug 27 12:29:17 2024 +0200 speedup sorting of marks in markmanager when we modify them in ContentIdxStoreImpl, we typically only modify a tiny subset of the marks, so do a partial sort instead of fully sorting the array. Shaves 10% off the load time of a large docx with lots of fieldmarks and bookmarks Change-Id: Ia271e465fb71559b0d4da3242dc4a6e6f07ddc28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171716 Tested-by: Jenkins Reviewed-by: Noel Grandin (cherry picked from commit 62de2163967c8a55193f126922dc21261644784d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171682 Tested-by: Jenkins CollaboraOffice diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index bc8f2e1c03d6..2936d724a04f 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -255,6 +255,13 @@ class IDocumentMarkAccess virtual void assureSortedMarkContainers() const = 0; +/** + * called when we need to sort a sub-range of the container, elements starting + * at nMinIndexModified where modified. This is used from ContentIdxStoreImpl::RestoreBkmks, + * where we are only modifying a small range at the end of the container. + */ +virtual void assureSortedMarkContainers(sal_Int32 nMinIndexModified) const = 0; + /** returns a STL-like random access iterator to the begin of the sequence of marks. */ virtual const_iterator_t getAllMarksBegin() const =0; diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 6b82ebc20cd3..6078253c235a 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -258,10 +258,12 @@ void ContentIdxStoreImpl::SaveBkmks(SwDoc& rDoc, SwNodeOffset nNode, sal_Int32 n void ContentIdxStoreImpl::RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater) { IDocumentMarkAccess* const pMarkAccess = rDoc.getIDocumentMarkAccess(); +sal_Int32 nMinIndexModified = SAL_MAX_INT32; for (const MarkEntry& aEntry : m_aBkmkEntries) { if (MarkBase *const pMark = pMarkAccess->getAllMarksBegin().get()[aEntry.m_nIdx]) { +nMinIndexModified = std::min(nMinIndexModified, sal_Int32(aEntry.m_nIdx)); SwPosition aNewPos(GetRightMarkPos(pMark, aEntry.m_bOther)); rUpdater(aNewPos, aEntry.m_nContent); SetRightMarkPos(pMark, aEntry.m_bOther, &aNewPos); @@ -270,7 +272,7 @@ void ContentIdxStoreImpl::RestoreBkmks(SwDoc& rDoc, updater_t const & rUpdater) if (!m_aBkmkEntries.empty()) { // tdf#105705 sort bookmarks because SaveBkmks special handling of // "bMarkPosEqual" may destroy sort order -pMarkAccess->assureSortedMarkContainers(); +pMarkAccess->assureSortedMarkContainers(nMinIndexModified); } } diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 5ce1a6307d27..619845b07332 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1893,6 +1893,12 @@ namespace sw::mark const_cast< MarkManager* >(this)->sortMarks(); } +void MarkManager::sortMarks() +{ +sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart); +sortSubsetMarks(); +} + void MarkManager::sortSubsetMarks() { stable_sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart); @@ -1900,10 +1906,82 @@ namespace sw::mark sort(m_vAnnotationMarks.begin(), m_vAnnotationMarks.end(), &lcl_MarkOrderingByStart); } -void MarkManager::sortMarks() +template +static void lcl_assureSortedMarkContainers(typename std::vector& rContainer, +sal_Int32 nMinIndexModified) { -sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart); -sortSubsetMarks(); +// We know that the range nMinIndexModified.. has been modified, now we need to extend that range +// to find the total range of elements that need to be sorted. +// We know that the marks have been modified in fairly limited ways, see ContentIdxStoreImpl. +sal_Int32 nMin = nMinIndexModified; +while (nMin != 0) +{ +nMin--; +if (rContainer[nMin]->GetMarkStart() < rContainer[nMinIndexModified]->GetMarkStart()) +break; +} +sort(rContainer.begin() + nMin, rContainer.end(), &lcl_MarkOrde
core.git: comphelper/source include/comphelper include/package package/inc package/source sot/source ucb/source unotools/source
comphelper/source/streaming/memorystream.cxx | 25 +++ comphelper/source/streaming/seekableinput.cxx | 17 ++ include/comphelper/seekableinput.hxx |6 include/package/Inflater.hxx | 22 +++ package/inc/ByteGrabber.hxx |7 - package/inc/CRC32.hxx |1 package/source/xstor/ocompinstream.cxx| 17 ++ package/source/xstor/ocompinstream.hxx|7 - package/source/xstor/selfterminatefilestream.cxx |5 package/source/xstor/selfterminatefilestream.hxx |6 package/source/xstor/switchpersistencestream.cxx | 16 ++ package/source/xstor/switchpersistencestream.hxx |6 package/source/zipapi/ByteGrabber.cxx | 49 --- package/source/zipapi/CRC32.cxx |4 package/source/zipapi/Inflater.cxx| 108 package/source/zipapi/MemoryByteGrabber.hxx |6 package/source/zipapi/XBufferedThreadedStream.cxx | 26 +++ package/source/zipapi/XBufferedThreadedStream.hxx |7 - package/source/zipapi/ZipFile.cxx | 145 +- package/source/zippackage/ZipPackage.cxx |1 package/source/zippackage/wrapstreamforshare.cxx | 16 ++ package/source/zippackage/wrapstreamforshare.hxx |7 - sot/source/sdstor/ucbstorage.cxx | 21 +++ ucb/source/ucp/file/filinpstr.cxx | 18 ++ ucb/source/ucp/file/filinpstr.hxx |7 - unotools/source/ucbhelper/XTempFile.hxx |3 unotools/source/ucbhelper/xtempfile.cxx | 15 ++ 27 files changed, 476 insertions(+), 92 deletions(-) New commits: commit a6ad198d097fb4a503c8d5831d484ff46721134b Author: Noel Grandin AuthorDate: Sat Aug 17 13:19:54 2024 +0200 Commit: Noel Grandin CommitDate: Tue Aug 27 09:10:04 2024 +0200 tdf#158556 use more comphelper::ByteReader which avoids a ton of temporary uno::Sequence being created Change-Id: I237bb69395f692bb0272ca0daec05b81af828e01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171968 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index b457f4b42ca8..39ae66b51d07 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -55,7 +55,7 @@ namespace { class UNOMemoryStream : public WeakImplHelper, -public comphelper::ByteWriter +public comphelper::ByteWriter, public comphelper::ByteReader { public: UNOMemoryStream(); @@ -92,6 +92,9 @@ public: // comphelper::ByteWriter virtual void writeBytes(const sal_Int8* aData, sal_Int32 nBytesToWrite) override; +// comphelper::ByteReader +virtual sal_Int32 readSomeBytes(sal_Int8* aData, sal_Int32 nBytesToRead) override; + private: std::vector< sal_Int8, boost::noinit_adaptor> > maData; sal_Int32 mnCursor; @@ -153,6 +156,26 @@ sal_Int32 SAL_CALL UNOMemoryStream::readBytes( Sequence< sal_Int8 >& aData, sal_ return nBytesToRead; } +// ByteReader +sal_Int32 UNOMemoryStream::readSomeBytes( sal_Int8* aData, sal_Int32 nBytesToRead ) +{ +if( nBytesToRead < 0 ) +throw IOException(u"nBytesToRead < 0"_ustr); + +nBytesToRead = std::min( nBytesToRead, available() ); + +if( nBytesToRead ) +{ +sal_Int8* pData = &(*maData.begin()); +sal_Int8* pCursor = &(pData[mnCursor]); +memcpy( aData, pCursor, nBytesToRead ); + +mnCursor += nBytesToRead; +} + +return nBytesToRead; +} + sal_Int32 SAL_CALL UNOMemoryStream::readSomeBytes( Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) { return readBytes( aData, nMaxBytesToRead ); diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx index 6fd418df36ca..dceb16824c58 100644 --- a/comphelper/source/streaming/seekableinput.cxx +++ b/comphelper/source/streaming/seekableinput.cxx @@ -107,7 +107,11 @@ void OSeekableInputWrapper::PrepareCopy_Impl() xTempSeek->seek( 0 ); m_xCopyInput.set( xTempOut, uno::UNO_QUERY ); if ( m_xCopyInput.is() ) +{ m_xCopySeek = xTempSeek; +m_pCopyByteReader = dynamic_cast(xTempOut.get()); +assert(m_pCopyByteReader); +} } } @@ -142,6 +146,18 @@ sal_Int32 SAL_CALL OSeekableInputWrapper::readSomeBytes( uno::Sequence< sal_Int8 return m_xCopyInput->readSomeBytes( aData, nMaxBytesToRead ); } +sal_Int32 OSeekableInputWrapper::readSomeBytes( sal_Int8* aData, sal_Int32 nMaxBytesToRead ) +{ +std::scoped_lock aGuard( m_aMutex ); + +if ( !m_xOriginalStream.is() ) +throw io::NotConnectedException(); + +PrepareCopy_Impl(); + +return m_pCopyByteReader->readSomeBytes( aData, nMaxBytesTo
core.git: sw/source
sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit 780728041982ff6980a9552a5b84dd9db6b9680c Author: Noel Grandin AuthorDate: Mon Aug 26 15:33:37 2024 +0200 Commit: Noel Grandin CommitDate: Mon Aug 26 18:58:45 2024 +0200 tdf#158556 no need to clone in OOXMLPropertySetValue::getProperties the callers just want to read the data Change-Id: I037766ac007266ea81765df94021d05528a60c89 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172396 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx b/sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx index 0293f1b10928..a59746ccfae9 100644 --- a/sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx +++ b/sw/source/writerfilter/ooxml/OOXMLPropertySet.cxx @@ -429,8 +429,7 @@ OOXMLPropertySetValue::~OOXMLPropertySetValue() writerfilter::Reference::Pointer_t OOXMLPropertySetValue::getProperties() const { -return writerfilter::Reference::Pointer_t -(mpPropertySet->clone()); +return writerfilter::Reference::Pointer_t(mpPropertySet.get()); } #ifdef DBG_UTIL
core.git: Branch 'distro/collabora/co-24.04' - sw/source
sw/source/core/doc/docbm.cxx | 36 ++-- 1 file changed, 30 insertions(+), 6 deletions(-) New commits: commit 1cb43ae6b3737367fdc7d9465bb084604da59778 Author: Noel Grandin AuthorDate: Mon Aug 5 14:01:09 2024 +0200 Commit: Noel Grandin CommitDate: Mon Aug 26 17:54:24 2024 +0200 reduce use of dynamic_cast in marks which is hit quite hard during import of documents with lots of marks, mostly because of the resorting that occurs in ContentIdxStoreImpl::Restore Change-Id: I1e5e3d8cfc0e65f9bf74449df8e048cd061022ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171522 Reviewed-by: Noel Grandin Tested-by: Jenkins (cherry picked from commit 900af9c53788d5d274900f796e3aee14926abf2d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171529 Tested-by: Jenkins CollaboraOffice diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 755317b27c44..5ce1a6307d27 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -183,6 +183,8 @@ bool IDocumentMarkAccess::iterator::operator>=(iterator const& rOther) const return *m_pIter >= *rOther.m_pIter; } +static bool IsAnnotationMark(const sw::mark::MarkBase& rBkmk); +static bool IsCrossRefBookmark(const sw::mark::MarkBase& rBkmk); namespace { @@ -231,13 +233,13 @@ namespace { // consistency with SwPosition::operator< return pSecondNode != nullptr; } -auto *const pCRFirst (dynamic_cast<::sw::mark::CrossRefBookmark const*>(pFirst)); -auto *const pCRSecond(dynamic_cast<::sw::mark::CrossRefBookmark const*>(pSecond)); -if ((pCRFirst == nullptr) == (pCRSecond == nullptr)) +bool const bCRFirst (IsCrossRefBookmark(*pFirst)); +bool const bCRSecond(IsCrossRefBookmark(*pSecond)); +if (bCRFirst == bCRSecond) { return false; // equal } -return pCRFirst != nullptr; // cross-ref sorts *before* +return bCRFirst; // cross-ref sorts *before* } bool lcl_MarkOrderingByEnd(const ::sw::mark::MarkBase *const pFirst, @@ -385,7 +387,7 @@ namespace const bool bChangedOPos, MarkBase* io_pMark ) { -if ( IDocumentMarkAccess::GetType(*io_pMark) == IDocumentMarkAccess::MarkType::ANNOTATIONMARK ) +if ( IsAnnotationMark(*io_pMark) ) { // annotation marks are allowed to span a table cell range. // but trigger sorting to be save @@ -506,6 +508,28 @@ namespace }; } +static bool IsNavigatorReminder(const MarkBase& rBkmk) +{ +const std::type_info* const pMarkTypeInfo = &typeid(rBkmk); +// not using dynamic_cast<> here for performance +return (*pMarkTypeInfo == typeid(NavigatorReminder)); +} + +static bool IsCrossRefBookmark(const sw::mark::MarkBase& rBkmk) +{ +// not using dynamic_cast<> here for performance +const std::type_info* const pMarkTypeInfo = &typeid(rBkmk); +return (*pMarkTypeInfo == typeid(CrossRefHeadingBookmark)) +|| (*pMarkTypeInfo == typeid(CrossRefNumItemBookmark)); +} + +static bool IsAnnotationMark(const sw::mark::MarkBase& rBkmk) +{ +// not using dynamic_cast<> here for performance +const std::type_info* const pMarkTypeInfo = &typeid(rBkmk); +return (*pMarkTypeInfo == typeid(AnnotationMark)); +} + IDocumentMarkAccess::MarkType IDocumentMarkAccess::GetType(const IMark& rBkmk) { const std::type_info* const pMarkTypeInfo = &typeid(rBkmk); @@ -1017,7 +1041,7 @@ namespace sw::mark assert(pMark); // navigator marks should not be moved // TODO: Check if this might make them invalid -if (IDocumentMarkAccess::GetType(*pMark) == IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER) +if (IsNavigatorReminder(*pMark)) { return false; }
core.git: include/svl svl/CppunitTest_svl_items.mk svl/qa svl/source sw/source
include/svl/stylepool.hxx | 44 ++ svl/CppunitTest_svl_items.mk |1 svl/qa/unit/items/stylepool.cxx | 105 -- svl/source/items/stylepool.cxx| 41 + sw/source/core/doc/swstylemanager.cxx | 20 -- 5 files changed, 39 insertions(+), 172 deletions(-) New commits: commit 6e62e021e88f244c2de9a53a104e67b676fc2913 Author: Noel Grandin AuthorDate: Sun Aug 25 19:44:07 2024 +0200 Commit: Noel Grandin CommitDate: Mon Aug 26 11:22:25 2024 +0200 tdf#158556 simplify StylePool API StylePool is only used inside writer, and only in very limited ways. Rather move the logic for the limits functions inside StylePool so I can then reduce the complexity of the iterator. Change-Id: I12bc5965b74abace28ae9190b35661a34f5005be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172371 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/include/svl/stylepool.hxx b/include/svl/stylepool.hxx index 0a22cb1f707e..dd01f2d475e0 100644 --- a/include/svl/stylepool.hxx +++ b/include/svl/stylepool.hxx @@ -16,15 +16,15 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SVL_STYLEPOOL_HXX -#define INCLUDED_SVL_STYLEPOOL_HXX +#pragma once -#include #include #include +#include +#include +#include class StylePoolImpl; -class IStylePoolIteratorAccess; class SVL_DLLPUBLIC StylePool final { @@ -32,6 +32,7 @@ private: std::unique_ptr pImpl; public: explicit StylePool( SfxItemSet const * pIgnorableItems = nullptr ); +~StylePool(); /** Insert a SfxItemSet into the style pool. @@ -48,41 +49,12 @@ public: */ std::shared_ptr insertItemSet( const SfxItemSet& rSet, const OUString* pParentName = nullptr ); -/** Create an iterator - -The iterator walks through the StylePool -OD 2008-03-07 #i86923# -introduce optional parameter to control, if unused SfxItemsSet are skipped or not -introduce optional parameter to control, if ignorable items are skipped or not +void populateCacheMap(std::unordered_map< OUString, std::shared_ptr >& rCacheMap); -@attention every change, e.g. destruction, of the StylePool could cause undefined effects. - -@param bSkipUnusedItemSets -input parameter - boolean, indicating if unused SfxItemSets are skipped or not - -@param bSkipIgnorableItems -input parameter - boolean, indicating if ignorable items are skipped or not - -@postcond the iterator "points before the first" SfxItemSet of the pool. -The first StylePoolIterator::getNext() call will deliver the first SfxItemSet. -*/ -std::unique_ptr createIterator( const bool bSkipUnusedItemSets = false, - const bool bSkipIgnorableItems = false ); - -~StylePool(); +// skips unused and ignorable items +void getAllStyles( std::vector> &rStyles ); static OUString nameOf( const std::shared_ptr& pSet ); }; -class SVL_DLLPUBLIC IStylePoolIteratorAccess -{ -public: -/** Delivers a shared pointer to the next SfxItemSet of the pool -If there is no more SfxItemSet, the delivered share_pointer is empty. -*/ -virtual std::shared_ptr getNext() = 0; -virtual ~IStylePoolIteratorAccess() {}; -}; -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/CppunitTest_svl_items.mk b/svl/CppunitTest_svl_items.mk index 60bccd8a5852..c75f56bfef71 100644 --- a/svl/CppunitTest_svl_items.mk +++ b/svl/CppunitTest_svl_items.mk @@ -15,7 +15,6 @@ $(eval $(call gb_CppunitTest_use_sdk_api,svl_items)) $(eval $(call gb_CppunitTest_add_exception_objects,svl_items, \ svl/qa/unit/items/test_IndexedStyleSheets \ - svl/qa/unit/items/stylepool \ )) $(eval $(call gb_CppunitTest_use_libraries,svl_items, \ diff --git a/svl/qa/unit/items/stylepool.cxx b/svl/qa/unit/items/stylepool.cxx deleted file mode 100644 index 6bee19881c89.. --- a/svl/qa/unit/items/stylepool.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include - -#include -#include -#include -#include - -namespace -{ -/// Tests svl StylePool. -class StylePoolTest : public CppUnit::TestFixture -{ -}; - -ItemInfoPackage& getItemInfoPackageTest() -{ -class ItemInfoPackageTest : public ItemInfoPackage -{ -typedef std::array ItemInfoArrayTest; -ItemInfoArrayTest maItemInfos{ { // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags -
core.git: 2 commits - editeng/source include/editeng
editeng/source/items/frmitems.cxx | 11 +++ editeng/source/items/paraitem.cxx | 10 ++ include/editeng/adjustitem.hxx|2 ++ include/editeng/lrspitem.hxx |2 ++ 4 files changed, 25 insertions(+) New commits: commit 1ba2b87ba52bf26e8cef667a35bfb7f2232acf11 Author: Noel Grandin AuthorDate: Fri Aug 23 10:05:09 2024 +0200 Commit: Noel Grandin CommitDate: Sat Aug 24 09:01:29 2024 +0200 tdf#158556 make SvxAdjustItem hashable Change-Id: Ic6bda5fad24ef0d9676bfb3d997da9c32aa959f9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172324 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 3978db4bc6d5..3bdec7afbf1d 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -377,6 +377,16 @@ bool SvxAdjustItem::operator==( const SfxPoolItem& rAttr ) const bLastBlock == rItem.bLastBlock; } +size_t SvxAdjustItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, GetAdjust()); +o3tl::hash_combine(seed, bOneBlock); +o3tl::hash_combine(seed, bLastCenter); +o3tl::hash_combine(seed, bLastBlock); +return seed; +} + bool SvxAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx index c660598abfc7..b12d91806bc7 100644 --- a/include/editeng/adjustitem.hxx +++ b/include/editeng/adjustitem.hxx @@ -55,6 +55,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual boolQueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual boolPutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; commit 513b20a5f38cb3492d31e0262f0b278d77f653b0 Author: Noel Grandin AuthorDate: Fri Aug 23 10:04:55 2024 +0200 Commit: Noel Grandin CommitDate: Sat Aug 24 09:01:21 2024 +0200 tdf#158556 make SvxRightMarginItem hashable Change-Id: Iad6fef862eb0b7002bbe28ed80efe1e533ffeec6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172323 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index f457781e39bd..5dd0346ef47e 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -480,6 +480,7 @@ void SvxLRSpaceItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp) void SvxRightMarginItem::SetRight(const tools::Long nR, const sal_uInt16 nProp) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nRightMargin = (nR * nProp) / 100; m_nPropRightMargin = nProp; } @@ -1163,6 +1164,7 @@ bool SvxRightMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) const bool SvxRightMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1209,6 +1211,14 @@ bool SvxRightMarginItem::operator==(const SfxPoolItem& rAttr) const && m_nPropRightMargin == rOther.GetPropRight()); } +size_t SvxRightMarginItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, m_nRightMargin); +o3tl::hash_combine(seed, m_nPropRightMargin); +return seed; +} + SvxRightMarginItem* SvxRightMarginItem::Clone(SfxItemPool *) const { return new SvxRightMarginItem(*this); @@ -1261,6 +1271,7 @@ bool SvxRightMarginItem::GetPresentation void SvxRightMarginItem::ScaleMetrics(tools::Long const nMult, tools::Long const nDiv) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nRightMargin = BigInt::Scale(m_nRightMargin, nMult, nDiv); } diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index 4f69ce21639a..5fe01262e7c2 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -200,6 +200,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
core.git: 2 commits - editeng/source include/editeng sw/inc sw/source
editeng/source/items/paraitem.cxx | 13 + include/editeng/lspcitem.hxx |9 +++-- sw/inc/paratr.hxx | 10 ++ sw/source/core/para/paratr.cxx | 15 +++ sw/source/filter/html/htmlcss1.cxx |8 sw/source/filter/html/htmlctxt.cxx |2 +- sw/source/filter/ww8/ww8par.cxx|8 sw/source/ui/chrdlg/drpcps.cxx | 14 +++--- 8 files changed, 57 insertions(+), 22 deletions(-) New commits: commit 978f0071425e89d21225bdd2976abe15e964b6c1 Author: Noel Grandin AuthorDate: Thu Aug 22 20:22:02 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 17:45:22 2024 +0200 tdf#158556 make SvxLineSpacingItem hashable Change-Id: I19d88a35332ab3aa07e88085742d92cb48d5ff79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172293 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 27331148d486..3978db4bc6d5 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -110,6 +110,17 @@ bool SvxLineSpacingItem::operator==( const SfxPoolItem& rAttr ) const && (nInterLineSpace == rLineSpace.nInterLineSpace))); } +size_t SvxLineSpacingItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, eLineSpaceRule); +o3tl::hash_combine(seed, nLineHeight); +o3tl::hash_combine(seed, eInterLineSpaceRule); +o3tl::hash_combine(seed, nPropLineSpace); +o3tl::hash_combine(seed, nInterLineSpace); +return seed; +} + /* Who does still know why the LineSpacingItem is so complicated? We can not use it for UNO since there are only two values: - a sal_uInt16 for the mode @@ -162,6 +173,7 @@ bool SvxLineSpacingItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxLineSpacingItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -329,6 +341,7 @@ sal_uInt16 SvxLineSpacingItem::GetEnumValue() const void SvxLineSpacingItem::SetEnumValue( sal_uInt16 nVal ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; switch ( static_cast(nVal) ) { case SvxSpecialLineSpace::OneLine: nPropLineSpace = 100; break; diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx index e4c97cfcd460..1bc4e769cff1 100644 --- a/include/editeng/lspcitem.hxx +++ b/include/editeng/lspcitem.hxx @@ -51,6 +51,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual boolQueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual boolPutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -65,6 +67,7 @@ public: short GetInterLineSpace() const { return nInterLineSpace; } void SetInterLineSpace( const short nSpace ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nInterLineSpace = nSpace; eInterLineSpaceRule = SvxInterLineSpaceRule::Fix; } @@ -73,6 +76,7 @@ public: sal_uInt16 GetLineHeight() const { return nLineHeight; } void SetLineHeight( const sal_uInt16 nHeight ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nLineHeight = nHeight; eLineSpaceRule = SvxLineSpaceRule::Min; } @@ -81,14 +85,15 @@ public: sal_uInt16 GetPropLineSpace() const { return nPropLineSpace; } void SetPropLineSpace( const sal_uInt16 nProp ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nPropLineSpace = nProp; eInterLineSpaceRule = SvxInterLineSpaceRule::Prop; } -void SetLineSpaceRule(SvxLineSpaceRule e) { eLineSpaceRule = e; } +void SetLineSpaceRule(SvxLineSpaceRule e) { ASSERT_CHANGE_REFCOUNTED_ITEM; eLineSpaceRule = e; } SvxLineSpaceRule GetLineSpaceRule() const { return eLineSpaceRule; } -void SetInterLineSpaceRule(SvxInterLineSpaceRule e) { eInterLineSpaceRule = e; } +void SetInterLineSpaceRule(SvxInterLineSpaceRule e) { ASSERT_CHANGE_REFCOUNTED_ITEM; eInterLineSpaceRule = e; } SvxInterLineSpaceRule GetInterLineSpaceRule() const { return eInterLineSpaceRule; } virtual sal_uInt16 GetValueCount() const override; commit 7a648f23ecb67fbdbd29ac7a1d81db19f769ebb3 Author: Noel Grandin AuthorDate: Fri Aug 23 14:01:29 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 17:45:07 2024 +0200 tdf#158556 make SwFormatDrop hashable Change-Id: I87508693abce928c9dfd22fd888e2aa441631f1d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172314 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hx
core.git: sw/inc sw/source
sw/inc/grfatr.hxx |2 ++ sw/source/core/graphic/grfatr.cxx |1 + 2 files changed, 3 insertions(+) New commits: commit e9594ac00a65c0a55286900265eadaa997e3f6ec Author: Noel Grandin AuthorDate: Fri Aug 23 08:50:37 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 16:45:52 2024 +0200 tdf#158556 make SwGammaGrf hashable Change-Id: Ia65013ffee3ef72b61331fd3b4f7ab0b913bf01e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172304 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index f6fe5bb8b05f..39bdad0c1d1d 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -197,6 +197,8 @@ public: // pure virtual methods from SfxEnumItem virtual SwGammaGrf* Clone( SfxItemPool *pPool = nullptr ) const override; virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override { return static_cast(m_nValue); } virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index 549d2d67da3b..e6b8b57847f1 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -255,6 +255,7 @@ bool SwGammaGrf::QueryValue( uno::Any& rVal, sal_uInt8 ) const bool SwGammaGrf::PutValue( const uno::Any& rVal, sal_uInt8 ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; return rVal >>= m_nValue; }
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 18 ++ include/editeng/brushitem.hxx |2 ++ 2 files changed, 20 insertions(+) New commits: commit 01d183d2290668c310d592bf2e4c298ddcfb10b4 Author: Noel Grandin AuthorDate: Fri Aug 23 14:17:01 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 16:45:31 2024 +0200 tdf#158556 make SvxBrushItem hashable Change-Id: I82794dbf004781a86c8443b72263528167fe0359 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172316 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 25ac10818176..f457781e39bd 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -4255,6 +4255,7 @@ bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nMemberId &= ~CONVERT_TWIPS; switch( nMemberId) { @@ -4462,6 +4463,23 @@ bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const return bEqual; } +size_t SvxBrushItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, static_cast(aColor)); +o3tl::hash_combine(seed, maComplexColor); +o3tl::hash_combine(seed, static_cast(aFilterColor)); +o3tl::hash_combine(seed, eGraphicPos); +o3tl::hash_combine(seed, nGraphicTransparency); +if ( GPOS_NONE != eGraphicPos ) +{ +o3tl::hash_combine(seed, maStrLink); +o3tl::hash_combine(seed, maStrFilter); +} +o3tl::hash_combine(seed, nShadingValue); +return seed; +} + SvxBrushItem* SvxBrushItem::Clone( SfxItemPool* ) const { return new SvxBrushItem( *this ); diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx index 6897e319a3b6..cc71f6135d80 100644 --- a/include/editeng/brushitem.hxx +++ b/include/editeng/brushitem.hxx @@ -85,6 +85,8 @@ public: OUString &rText, const IntlWrapper& ) const override; virtual bool operator==( const SfxPoolItem& ) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
core.git: editeng/source include/editeng
editeng/source/items/textitem.cxx |8 include/editeng/colritem.hxx |2 ++ 2 files changed, 10 insertions(+) New commits: commit 1c4b613cda515e678a914a9bde4af3cc557532a6 Author: Noel Grandin AuthorDate: Fri Aug 23 13:20:17 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 16:44:41 2024 +0200 tdf#158556 make SvxColorItem hashable Change-Id: I39cfd46a8255b6231b0215ff22f4ac5f77fa38e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172312 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index cf4d9e27a8d8..a4ad9f8847f8 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1507,6 +1507,14 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const maComplexColor == rColorItem.maComplexColor; } +size_t SvxColorItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, static_cast(mColor)); +o3tl::hash_combine(seed, maComplexColor); +return seed; +} + bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 15c352ebff25..1acb863f6a86 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -44,6 +44,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem& rPoolItem) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
core.git: sw/inc sw/source
sw/inc/fmtpdsc.hxx |4 +++- sw/source/core/layout/atrfrm.cxx | 12 +++- 2 files changed, 14 insertions(+), 2 deletions(-) New commits: commit a111a1eff73b141c28b5ab87715eed62696f91a3 Author: Noel Grandin AuthorDate: Fri Aug 23 09:57:12 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 14:29:47 2024 +0200 tdf#158556 make SwFormatPageDesc hashable Change-Id: I609c63ec22c94ce9d5ccc10e9608787c5189937b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172305 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index 81aaaddf6048..e72181468439 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -51,6 +51,8 @@ public: /// "Pure virtual methods" of SfxPoolItem. virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual SwFormatPageDesc* Clone( SfxItemPool* pPool = nullptr ) const override; virtual bool GetPresentation( SfxItemPresentation ePres, MapUnit eCoreMetric, @@ -64,7 +66,7 @@ public: const SwPageDesc *GetPageDesc() const { return static_cast(GetRegisteredIn()); } const ::std::optional& GetNumOffset() const{ return m_oNumOffset; } -voidSetNumOffset( const ::std::optional& oNum ) { m_oNumOffset = oNum; } +voidSetNumOffset( const ::std::optional& oNum ) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_oNumOffset = oNum; } /// Query / set where attribute is anchored. const sw::BroadcastingModify* GetDefinedIn() const { return m_pDefinedIn; } diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 84e9a59d6e6e..128fc74aa629 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -672,7 +672,7 @@ SwFormatPageDesc &SwFormatPageDesc::operator=(const SwFormatPageDesc &rCpy) { if (SfxPoolItem::areSame(*this, rCpy)) return *this; - +ASSERT_CHANGE_REFCOUNTED_ITEM; if (rCpy.GetPageDesc()) RegisterToPageDesc(*const_cast(rCpy.GetPageDesc())); m_oNumOffset = rCpy.m_oNumOffset; @@ -696,6 +696,15 @@ bool SwFormatPageDesc::operator==( const SfxPoolItem& rAttr ) const ( GetPageDesc() == static_cast(rAttr).GetPageDesc() ); } +size_t SwFormatPageDesc::hashCode() const +{ +std::size_t seed(0); +// note that we cannot include m_pDefinedIn in the hash because that is updated in SwAttrSet::SetModifyAtAttr +o3tl::hash_combine(seed, m_oNumOffset); +o3tl::hash_combine(seed, GetPageDesc()); +return seed; +} + SwFormatPageDesc* SwFormatPageDesc::Clone( SfxItemPool* ) const { return new SwFormatPageDesc( *this ); @@ -789,6 +798,7 @@ bool SwFormatPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SwFormatPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; // here we convert always! nMemberId &= ~CONVERT_TWIPS; bool bRet = true;
core.git: cui/source include/svl sd/source svl/source sw/source
cui/source/dialogs/SpellDialog.cxx| 16 cui/source/tabpages/page.cxx | 15 +++ include/svl/grabbagitem.hxx |5 +- sd/source/ui/func/fupage.cxx |4 +- svl/source/items/grabbagitem.cxx | 16 sw/source/core/text/txtfld.cxx|2 - sw/source/core/txtnode/ndtxt.cxx |6 ++- sw/source/filter/ww8/wrtw8nds.cxx | 16 +++- sw/source/filter/ww8/ww8par6.cxx | 16 sw/source/ui/dbui/mmaddressblockpage.cxx |6 +-- sw/source/uibase/app/docst.cxx| 14 ++- sw/source/uibase/docvw/UnfloatTableButton.cxx |8 ++-- sw/source/uibase/shells/drwbassh.cxx |5 +- sw/source/uibase/utlui/uitool.cxx | 49 ++ 14 files changed, 90 insertions(+), 88 deletions(-) New commits: commit 25541338ae51435b9c23fe69cfa4219096e2dd50 Author: Noel Grandin AuthorDate: Fri Aug 23 12:00:51 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 13:44:26 2024 +0200 tdf#158556 make SfxGrabBagItem hashable Change-Id: I0af373e9c5c93a82eb37437ac365677700d45853 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172311 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 59ab182ca2b3..dd017cf3de15 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1034,8 +1034,8 @@ bool SpellDialog::GetNextSentence_Impl(std::unique_ptr* pG { SpellErrorDescription aDesc( false, elem.xAlternatives->getWord(), elem.xAlternatives->getLocale(), elem.xAlternatives->getAlternatives(), nullptr); -SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG); - aSpellErrorDescription.GetGrabBag()[u"SpellErrorDescription"_ustr] <<= aDesc.toSequence(); +SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG, +std::map{{ u"SpellErrorDescription"_ustr, uno::Any(aDesc.toSequence()) }}); m_xSentenceED->SetAttrib(aSpellErrorDescription, nStartPosition, nEndPosition); } else if(elem.bIsGrammarError ) @@ -1063,8 +1063,8 @@ bool SpellDialog::GetNextSentence_Impl(std::unique_ptr* pG &elem.aGrammarError.aRuleIdentifier, &sFullCommentURL ); -SfxGrabBagItem aSpellErrorDescriptionItem(EE_CHAR_GRABBAG); - aSpellErrorDescriptionItem.GetGrabBag()[u"SpellErrorDescription"_ustr] <<= aDesc.toSequence(); +SfxGrabBagItem aSpellErrorDescriptionItem(EE_CHAR_GRABBAG, +std::map{{u"SpellErrorDescription"_ustr, uno::Any(aDesc.toSequence())}}); m_xSentenceED->SetAttrib(aSpellErrorDescriptionItem, nStartPosition, nEndPosition); } @@ -1855,8 +1855,8 @@ int SentenceEditWindow_Impl::ChangeMarkedWord(const OUString& rNewWord, Language AddUndoAction(std::move(pAction)); if (bSpellErrorDescription) { -SfxGrabBagItem aSpellErrorDescriptionItem(EE_CHAR_GRABBAG); -aSpellErrorDescriptionItem.GetGrabBag()[u"SpellErrorDescription"_ustr] <<= aSpellErrorDescription.toSequence(); +SfxGrabBagItem aSpellErrorDescriptionItem(EE_CHAR_GRABBAG, +std::map{{u"SpellErrorDescription"_ustr, uno::Any(aSpellErrorDescription.toSequence())}}); SetAttrib(aSpellErrorDescriptionItem, m_nErrorStart, m_nErrorEnd); } SetAttrib(SvxLanguageItem(eLanguage, EE_CHAR_LANGUAGE), m_nErrorStart, m_nErrorEnd); @@ -1913,8 +1913,8 @@ void SentenceEditWindow_Impl::SetAlternatives( const Reference< XSpellAlternativ aAlts = xAlt->getAlternatives(); } SpellErrorDescription aDesc( false, aWord, std::move(aLocale), aAlts, nullptr); -SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG); -aSpellErrorDescription.GetGrabBag()[u"SpellErrorDescription"_ustr] <<= aDesc.toSequence(); +SfxGrabBagItem aSpellErrorDescription(EE_CHAR_GRABBAG, +std::map{{u"SpellErrorDescription"_ustr, uno::Any(aDesc.toSequence())}}); SetAttrib(aSpellErrorDescription, m_nErrorStart, m_nErrorEnd); } diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index ee0a4be0a945..809bd672817b 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -663,32 +663,31 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet ) if (rOldSet.HasItem(SID_ATTR_CHAR_GRABBAG)) { // Set gutter position. -SfxGrabBagItem aGrabBagItem(rOldSet.Get(SID_ATTR_CHAR_GRABBAG)); +const SfxGrabBagItem& rOldGrabBagItem = rOldSet.Get(SID_ATTR_CHAR_GRABBAG); +std::map aGrabBagMap = rOldGrabBagItem.GetGrabBag();
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 23 +++ include/editeng/lrspitem.hxx |8 +--- include/editeng/shaditem.hxx |8 +--- 3 files changed, 33 insertions(+), 6 deletions(-) New commits: commit f2b6a04f37e24e47984eb2539771a86cf7b08d4b Author: Noel Grandin AuthorDate: Thu Aug 22 19:45:45 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 12:01:27 2024 +0200 tdf#158556 make SvxFirstLineIndentItem hashable Change-Id: Ic23d0956b87eefb575696dad7af775a37cd50b10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172289 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 93c4a9fe646f..25ac10818176 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -497,6 +497,7 @@ void SvxLRSpaceItem::SetRight(const tools::Long nR, const sal_uInt16 nProp) void SvxFirstLineIndentItem::SetTextFirstLineOffset( const short nF, const sal_uInt16 nProp) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100); m_nPropFirstLineOffset = nProp; } @@ -967,6 +968,7 @@ bool SvxFirstLineIndentItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) con bool SvxFirstLineIndentItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -1018,6 +1020,15 @@ bool SvxFirstLineIndentItem::operator==(const SfxPoolItem& rAttr) const && m_bAutoFirst == rOther.IsAutoFirst()); } +size_t SvxFirstLineIndentItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, m_nFirstLineOffset); +o3tl::hash_combine(seed, m_nPropFirstLineOffset); +o3tl::hash_combine(seed, m_bAutoFirst); +return seed; +} + SvxFirstLineIndentItem* SvxFirstLineIndentItem::Clone(SfxItemPool *) const { return new SvxFirstLineIndentItem(*this); @@ -1070,6 +1081,7 @@ bool SvxFirstLineIndentItem::GetPresentation void SvxFirstLineIndentItem::ScaleMetrics(tools::Long const nMult, tools::Long const nDiv) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = static_cast(BigInt::Scale(m_nFirstLineOffset, nMult, nDiv)); } @@ -2108,6 +2120,7 @@ bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -2178,6 +2191,15 @@ bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const ( eLocation == rItem.GetLocation() ) ); } +size_t SvxShadowItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, sal_Int32(aShadowColor)); +o3tl::hash_combine(seed, nWidth); +o3tl::hash_combine(seed, static_cast(eLocation)); +return seed; +} + SvxShadowItem* SvxShadowItem::Clone( SfxItemPool* ) const { return new SvxShadowItem( *this ); @@ -2277,6 +2299,7 @@ bool SvxShadowItem::GetPresentation void SvxShadowItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nWidth = static_cast(BigInt::Scale( nWidth, nMult, nDiv )); } diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index ca46cd0dfc15..4f69ce21639a 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -142,16 +142,16 @@ private: public: bool IsAutoFirst() const { return m_bAutoFirst; } -void SetAutoFirst(const bool bNew) { m_bAutoFirst = bNew; } +void SetAutoFirst(const bool bNew) { ASSERT_CHANGE_REFCOUNTED_ITEM; m_bAutoFirst = bNew; } void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp = 100); short GetTextFirstLineOffset() const { return m_nFirstLineOffset; } void SetPropTextFirstLineOffset(const sal_uInt16 nProp) -{ m_nPropFirstLineOffset = nProp; } +{ ASSERT_CHANGE_REFCOUNTED_ITEM; m_nPropFirstLineOffset = nProp; } sal_uInt16 GetPropTextFirstLineOffset() const { return m_nPropFirstLineOffset; } void SetTextFirstLineOffsetValue(const short nValue) -{ m_nFirstLineOffset = nValue; } +{ ASSERT_CHANGE_REFCOUNTED_ITEM; m_nFirstLineOffset = nValue; } explicit SvxFirstLineIndentItem(const sal_uInt16 nId); SvxFirstLineIndentItem(const short nOffset, const sal_uInt16 nId); @@ -159,6 +159,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 12 include/editeng/lrspitem.hxx |2 ++ 2 files changed, 14 insertions(+) New commits: commit ba0f68732ed89e11157dc618a697bfeb173c6252 Author: Noel Grandin AuthorDate: Thu Aug 22 20:54:34 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 09:59:44 2024 +0200 tdf#158556 make SvxTextLeftMarginItem hashable Change-Id: Idc91bf66e8ba050fcd133ef98f8364fbbb2e8efa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172294 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 3a02201b65f0..93c4a9fe646f 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -532,6 +532,7 @@ void SvxTextLeftMarginItem::SetLeft(SvxFirstLineIndentItem const& rFirstLine, void SvxTextLeftMarginItem::SetTextLeft(const tools::Long nL, const sal_uInt16 nProp) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nTextLeftMargin = (nL * nProp) / 100; m_nPropLeftMargin = nProp; } @@ -784,6 +785,7 @@ bool SvxTextLeftMarginItem::QueryValue(uno::Any& rVal, sal_uInt8 nMemberId) cons bool SvxTextLeftMarginItem::PutValue(const uno::Any& rVal, sal_uInt8 nMemberId) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0 != (nMemberId & CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; @@ -830,6 +832,15 @@ bool SvxTextLeftMarginItem::operator==(const SfxPoolItem& rAttr) const && m_nPropLeftMargin == rOther.GetPropLeft()); } +size_t SvxTextLeftMarginItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, m_nTextLeftMargin); +o3tl::hash_combine(seed, m_nPropLeftMargin); +return seed; +} + + SvxTextLeftMarginItem* SvxTextLeftMarginItem::Clone(SfxItemPool *) const { return new SvxTextLeftMarginItem(*this); @@ -881,6 +892,7 @@ bool SvxTextLeftMarginItem::GetPresentation void SvxTextLeftMarginItem::ScaleMetrics(tools::Long const nMult, tools::Long const nDiv) { +ASSERT_CHANGE_REFCOUNTED_ITEM; m_nTextLeftMargin = BigInt::Scale(m_nTextLeftMargin, nMult, nDiv); } diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx index edab3ef23d73..ca46cd0dfc15 100644 --- a/include/editeng/lrspitem.hxx +++ b/include/editeng/lrspitem.hxx @@ -111,6 +111,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual bool operator==(const SfxPoolItem&) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override;
core.git: editeng/source
editeng/source/items/paraitem.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 7d3817289586d8765e066fee6551b66ddb5d0ab3 Author: Noel Grandin AuthorDate: Thu Aug 22 13:35:33 2024 +0200 Commit: Noel Grandin CommitDate: Fri Aug 23 08:04:48 2024 +0200 tdf#158556 improve SvxTabStopItem::hashCode to provide more discrimination, which means we spend less time in operator== when searching the pool Change-Id: I9beb8218fdd4b4fb3d60ecf6db461ae818d2a9ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172291 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx index 4019a6ce2c6b..27331148d486 100644 --- a/editeng/source/items/paraitem.cxx +++ b/editeng/source/items/paraitem.cxx @@ -1065,9 +1065,12 @@ bool SvxTabStopItem::operator==( const SfxPoolItem& rAttr ) const size_t SvxTabStopItem::hashCode() const { std::size_t seed(0); -o3tl::hash_combine(seed, Which()); o3tl::hash_combine(seed, mnDefaultDistance); -o3tl::hash_combine(seed, maTabStops.size()); +for (const SvxTabStop & rStop : maTabStops) +{ +o3tl::hash_combine(seed, rStop.GetTabPos()); +o3tl::hash_combine(seed, rStop. GetAdjustment()); +} return seed; }
core.git: editeng/source include/editeng
editeng/source/items/frmitems.cxx | 13 + include/editeng/ulspitem.hxx | 14 +- 2 files changed, 22 insertions(+), 5 deletions(-) New commits: commit 7e241c2babf3ad705619a120ffc71e475ce7bb7a Author: Noel Grandin AuthorDate: Thu Aug 22 18:58:52 2024 +0200 Commit: Noel Grandin CommitDate: Thu Aug 22 21:59:21 2024 +0200 tdf#158556 make SvxULSpaceItem hashable Change-Id: I381379bb4be4e27cb8af32a77505dfbb357dd720 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172288 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ee8c84888c45..3a02201b65f0 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1713,6 +1713,7 @@ bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); nMemberId &= ~CONVERT_TWIPS; sal_Int32 nVal = 0; @@ -1785,6 +1786,17 @@ bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const nPropLower == rSpaceItem.nPropLower ); } +size_t SvxULSpaceItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, nUpper); +o3tl::hash_combine(seed, nLower); +o3tl::hash_combine(seed, bContext); +o3tl::hash_combine(seed, nPropUpper); +o3tl::hash_combine(seed, nPropLower); +return seed; +} + SvxULSpaceItem* SvxULSpaceItem::Clone( SfxItemPool* ) const { return new SvxULSpaceItem( *this ); @@ -1854,6 +1866,7 @@ bool SvxULSpaceItem::GetPresentation void SvxULSpaceItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = static_cast(BigInt::Scale( nUpper, nMult, nDiv )); nLower = static_cast(BigInt::Scale( nLower, nMult, nDiv )); } diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx index b0131ab9904d..59e92f4b691b 100644 --- a/include/editeng/ulspitem.hxx +++ b/include/editeng/ulspitem.hxx @@ -47,6 +47,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual boolQueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual boolPutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -63,11 +65,11 @@ public: inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 ); inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 ); -void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; } -void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; } -void SetContextValue( const bool bC ) { bContext = bC; } -void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; } -void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; } +void SetUpperValue( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = nU; } +void SetLowerValue( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nLower = nL; } +void SetContextValue( const bool bC ) { ASSERT_CHANGE_REFCOUNTED_ITEM; bContext = bC; } +void SetPropUpper( const sal_uInt16 nU ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropUpper = nU; } +void SetPropLower( const sal_uInt16 nL ) { ASSERT_CHANGE_REFCOUNTED_ITEM; nPropLower = nL; } sal_uInt16 GetUpper() const { return nUpper; } sal_uInt16 GetLower() const { return nLower; } @@ -81,10 +83,12 @@ public: inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp; } inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp; }
core.git: 2 commits - editeng/source include/editeng include/svl
editeng/source/items/frmitems.cxx | 14 ++ include/editeng/boxitem.hxx |9 - include/svl/intitem.hxx |2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) New commits: commit 086fd5d0de83e5dbff8b69ed86b85274d9fa1c7a Author: Noel Grandin AuthorDate: Thu Aug 22 16:25:56 2024 +0200 Commit: Noel Grandin CommitDate: Thu Aug 22 21:59:12 2024 +0200 tdf#158556 make SfxInt16Item hashable Change-Id: Id4e6feb4d0072a204d68e5dc834c6828221ea617 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172263 Tested-by: Jenkins Reviewed-by: Noel Grandin diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index 0d3adcf0a750..1197ed5de085 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -51,6 +51,8 @@ public: {} virtual bool operator ==(const SfxPoolItem & rItem) const override; +virtual bool supportsHashCode() const override { return true; } +virtual size_t hashCode() const override { return m_nValue; } virtual bool GetPresentation(SfxItemPresentation, MapUnit, MapUnit, commit fc37b184eeaecee2f4d1d5cc7d6d032e59802cae Author: Noel Grandin AuthorDate: Thu Aug 22 16:06:58 2024 +0200 Commit: Noel Grandin CommitDate: Thu Aug 22 21:59:03 2024 +0200 tdf#158556 make SvxBoxItem hashable Change-Id: I33557df66341ec0d201b66f97ed33c1c61155d7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172262 Reviewed-by: Noel Grandin Tested-by: Jenkins diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index d2a788370e77..ee8c84888c45 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2377,6 +2377,15 @@ bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const CompareBorderLine(mpRightBorderLine, rBoxItem.GetRight())); } +size_t SvxBoxItem::hashCode() const +{ +std::size_t seed(0); +o3tl::hash_combine(seed, mnTopDistance); +o3tl::hash_combine(seed, mnBottomDistance); +o3tl::hash_combine(seed, mnLeftDistance); +o3tl::hash_combine(seed, mnRightDistance); +return seed; +} table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, bool bConvert) { @@ -2617,6 +2626,7 @@ lcl_setLine(const uno::Any& rAny, Item& rItem, Line nLine, const bool bConvert) bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; bool bConvert = 0!=(nMemberId&CONVERT_TWIPS); SvxBoxItemLine nLine = SvxBoxItemLine::TOP; bool bDistMember = false; @@ -3009,6 +3019,7 @@ bool SvxBoxItem::GetPresentation void SvxBoxItem::ScaleMetrics( tools::Long nMult, tools::Long nDiv ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; if (mpTopBorderLine) mpTopBorderLine->ScaleMetrics( nMult, nDiv ); if (mpBottomBorderLine) @@ -3060,6 +3071,7 @@ const SvxBorderLine *SvxBoxItem::GetLine( SvxBoxItemLine nLine ) const void SvxBoxItem::SetLine( const SvxBorderLine* pNew, SvxBoxItemLine nLine ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; std::unique_ptr pTmp( pNew ? new SvxBorderLine( *pNew ) : nullptr ); switch ( nLine ) @@ -3128,6 +3140,7 @@ sal_Int16 SvxBoxItem::GetDistance( SvxBoxItemLine nLine, bool bAllowNegative ) c void SvxBoxItem::SetDistance( sal_Int16 nNew, SvxBoxItemLine nLine ) { +ASSERT_CHANGE_REFCOUNTED_ITEM; switch ( nLine ) { case SvxBoxItemLine::TOP: @@ -3218,6 +3231,7 @@ sal_Int16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine, b void SvxBoxItem::tryMigrateComplexColor(SvxBoxItemLine eLine) { +ASSERT_CHANGE_REFCOUNTED_ITEM; if (!GetLine(eLine)) return; diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx index 6ceff99268c3..60a6d09c5b92 100644 --- a/include/editeng/boxitem.hxx +++ b/include/editeng/boxitem.hxx @@ -82,6 +82,8 @@ public: // "pure virtual Methods" from SfxPoolItem virtual booloperator==( const SfxPoolItem& ) const override; +virtual boolsupportsHashCode() const override { return true; } +virtual size_t hashCode() const override; virtual boolQueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual boolPutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; @@ -114,18 +116,22 @@ public: editeng::SvxBorderLine* GetTop() { +ASSERT_CHANGE_REFCOUNTED_ITEM; return mpTopBorderLine.get(); } editeng::SvxBorderLine* GetBottom() { +ASSERT_CHANGE_REFCOUNTED_ITEM; return mpBottomBorderLine.get(); } editeng::SvxBorderLine* GetLeft() { +ASSERT_CHANGE_REFCOUNTED_ITEM; return mpLeftBorderLine.get(); } editeng::SvxBorderLine* GetRight() { +ASSERT_CHANGE_REFCOUNTED_ITEM; return mpRightBorderLine.