[Libreoffice-commits] core.git: sw/inc sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 19 18:18:19 UTC 2021


 sw/inc/charfmt.hxx                              |    2 +-
 sw/inc/fmtcol.hxx                               |   12 ++++++------
 sw/inc/format.hxx                               |    4 ++--
 sw/inc/frmfmt.hxx                               |    4 ++--
 sw/inc/swtblfmt.hxx                             |    6 +++---
 sw/source/core/attr/format.cxx                  |    8 ++++----
 sw/source/core/doc/DocumentStylePoolManager.cxx |    4 ++--
 sw/source/core/layout/atrfrm.cxx                |    8 ++++----
 sw/source/core/unocore/unostyle.cxx             |   10 +++++-----
 9 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit a77cbb3148d2f16b765108e2d8ff5cf20e1aee58
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Jul 19 18:25:45 2021 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Jul 19 20:17:42 2021 +0200

    Use reference to WhichRangesContainer instead of pointer in sw
    
    Change-Id: I8e6418ce08f339824433e9af52259b2a8f3bb71d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119226
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx
index b42dd303e953..27d6e5c0f896 100644
--- a/sw/inc/charfmt.hxx
+++ b/sw/inc/charfmt.hxx
@@ -29,7 +29,7 @@ class SwCharFormat final : public SwFormat
 
     SwCharFormat( SwAttrPool& rPool, const OUString &rFormatName,
                 SwCharFormat *pDerivedFrom )
-          : SwFormat( rPool, rFormatName, &aCharFormatSetRange, pDerivedFrom, RES_CHRFMT )
+          : SwFormat( rPool, rFormatName, aCharFormatSetRange, pDerivedFrom, RES_CHRFMT )
     {}
 
 public:
diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx
index 2ea13c159cae..17437a0d90eb 100644
--- a/sw/inc/fmtcol.hxx
+++ b/sw/inc/fmtcol.hxx
@@ -36,13 +36,13 @@ class SAL_DLLPUBLIC_RTTI SwFormatColl: public SwFormat
 {
 protected:
     SwFormatColl( SwAttrPool& rPool, const char* pFormatName,
-                const WhichRangesContainer* pWhichRanges, SwFormatColl* pDerFrom,
+                const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
                 sal_uInt16 nFormatWhich )
           : SwFormat( rPool, pFormatName, pWhichRanges, pDerFrom, nFormatWhich )
     { SetAuto(false); }
 
     SwFormatColl( SwAttrPool& rPool, const OUString &rFormatName,
-                const WhichRangesContainer* pWhichRanges, SwFormatColl* pDerFrom,
+                const WhichRangesContainer& pWhichRanges, SwFormatColl* pDerFrom,
                 sal_uInt16 nFormatWhich )
           : SwFormat( rPool, rFormatName, pWhichRanges, pDerFrom, nFormatWhich )
     { SetAuto(false); }
@@ -74,7 +74,7 @@ protected:
     SwTextFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
                     SwTextFormatColl* pDerFrom = nullptr,
                     sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
-        : SwFormatColl(rPool, pFormatCollName, &aTextFormatCollSetRange, pDerFrom, nFormatWh)
+        : SwFormatColl(rPool, pFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
         , mbStayAssignedToListLevelOfOutlineStyle(false)
         , mbAssignedToOutlineStyle(false)
         , m_bInSwFntCache(false)
@@ -85,7 +85,7 @@ protected:
     SwTextFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
                     SwTextFormatColl* pDerFrom,
                     sal_uInt16 nFormatWh = RES_TXTFMTCOLL )
-        : SwFormatColl(rPool, rFormatCollName, &aTextFormatCollSetRange, pDerFrom, nFormatWh)
+        : SwFormatColl(rPool, rFormatCollName, aTextFormatCollSetRange, pDerFrom, nFormatWh)
         , mbStayAssignedToListLevelOfOutlineStyle(false)
         , mbAssignedToOutlineStyle(false)
         , m_bInSwFntCache(false)
@@ -170,13 +170,13 @@ class SwGrfFormatColl final : public SwFormatColl
 
     SwGrfFormatColl( SwAttrPool& rPool, const char* pFormatCollName,
                     SwGrfFormatColl* pDerFrom = nullptr )
-        : SwFormatColl( rPool, pFormatCollName, &aGrfFormatCollSetRange,
+        : SwFormatColl( rPool, pFormatCollName, aGrfFormatCollSetRange,
                     pDerFrom, RES_GRFFMTCOLL )
     {}
 
     SwGrfFormatColl( SwAttrPool& rPool, const OUString &rFormatCollName,
                     SwGrfFormatColl* pDerFrom )
-        : SwFormatColl( rPool, rFormatCollName, &aGrfFormatCollSetRange,
+        : SwFormatColl( rPool, rFormatCollName, aGrfFormatCollSetRange,
                     pDerFrom, RES_GRFFMTCOLL )
     {}
 };
diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx
index 03d1350d2ed1..a42d04f276cf 100644
--- a/sw/inc/format.hxx
+++ b/sw/inc/format.hxx
@@ -67,8 +67,8 @@ class SW_DLLPUBLIC SwFormat : public sw::BorderCacheOwner, public sw::Broadcasti
 
 protected:
     SwFormat( SwAttrPool& rPool, const char* pFormatNm,
-            const WhichRangesContainer* pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
-    SwFormat( SwAttrPool& rPool, const OUString &rFormatNm, const WhichRangesContainer* pWhichRanges,
+            const WhichRangesContainer& pWhichRanges, SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
+    SwFormat( SwAttrPool& rPool, const OUString &rFormatNm, const WhichRangesContainer& pWhichRanges,
             SwFormat *pDrvdFrame, sal_uInt16 nFormatWhich );
     SwFormat( const SwFormat& rFormat );
     virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 243f12b05683..24554c1171f2 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -88,14 +88,14 @@ protected:
         const char* pFormatNm,
         SwFrameFormat *pDrvdFrame,
         sal_uInt16 nFormatWhich = RES_FRMFMT,
-        const WhichRangesContainer* pWhichRange = nullptr);
+        const WhichRangesContainer& pWhichRange = aFrameFormatSetRange);
 
     SwFrameFormat(
         SwAttrPool& rPool,
         const OUString &rFormatNm,
         SwFrameFormat *pDrvdFrame,
         sal_uInt16 nFormatWhich = RES_FRMFMT,
-        const WhichRangesContainer* pWhichRange = nullptr);
+        const WhichRangesContainer& pWhichRange = aFrameFormatSetRange);
 
     virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
diff --git a/sw/inc/swtblfmt.hxx b/sw/inc/swtblfmt.hxx
index fa3aed69e216..14b200164b5d 100644
--- a/sw/inc/swtblfmt.hxx
+++ b/sw/inc/swtblfmt.hxx
@@ -27,7 +27,7 @@ class SAL_DLLPUBLIC_RTTI SwTableFormat final : public SwFrameFormat
 
     SwTableFormat( SwAttrPool& rPool, const OUString &rFormatNm,
                     SwFrameFormat *pDrvdFrame )
-        : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FRMFMT, &aTableSetRange )
+        : SwFrameFormat( rPool, rFormatNm, pDrvdFrame, RES_FRMFMT, aTableSetRange )
     {}
 
 public:
@@ -39,7 +39,7 @@ class SwTableLineFormat final : public SwFrameFormat
     friend class SwDoc;
 
     SwTableLineFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame )
-        : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, &aTableLineSetRange )
+        : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableLineSetRange )
     {}
 
 public:
@@ -51,7 +51,7 @@ class SAL_DLLPUBLIC_RTTI SwTableBoxFormat final : public SwFrameFormat
     friend class SwDoc;
 
     SwTableBoxFormat( SwAttrPool& rPool, SwFrameFormat *pDrvdFrame )
-        : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, &aTableBoxSetRange )
+        : SwFrameFormat( rPool, OUString(), pDrvdFrame, RES_FRMFMT, aTableBoxSetRange )
     {}
 
     // For recognition of changes (especially TableBoxAttribute).
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 960f3072bf80..6e5ba61cf13d 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -38,10 +38,10 @@
 using namespace com::sun::star;
 
 SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
-              const WhichRangesContainer* pWhichRanges, SwFormat *pDrvdFrame,
+              const WhichRangesContainer& pWhichRanges, SwFormat *pDrvdFrame,
               sal_uInt16 nFormatWhich ) :
     m_aFormatName( OUString::createFromAscii(pFormatNm) ),
-    m_aSet( rPool, pWhichRanges ? *pWhichRanges : WhichRangesContainer() ),
+    m_aSet( rPool, pWhichRanges ),
     m_nWhichId( nFormatWhich ),
     m_nPoolFormatId( USHRT_MAX ),
     m_nPoolHelpId( USHRT_MAX ),
@@ -59,10 +59,10 @@ SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm,
 }
 
 SwFormat::SwFormat( SwAttrPool& rPool, const OUString& rFormatNm,
-              const WhichRangesContainer* pWhichRanges, SwFormat* pDrvdFrame,
+              const WhichRangesContainer& pWhichRanges, SwFormat* pDrvdFrame,
               sal_uInt16 nFormatWhich ) :
     m_aFormatName( rFormatNm ),
-    m_aSet( rPool, pWhichRanges ? *pWhichRanges : WhichRangesContainer() ),
+    m_aSet( rPool, pWhichRanges ),
     m_nWhichId( nFormatWhich ),
     m_nPoolFormatId( USHRT_MAX ),
     m_nPoolHelpId( USHRT_MAX ),
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 858addfb27ec..c0a31aa411a5 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -1431,7 +1431,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
     SwFormatsBase* pArray[ 2 ];
     sal_uInt16 nArrCnt = 1;
     const char* pRCId = nullptr;
-    WhichRangesContainer const * pWhichRange = nullptr;
+    WhichRangesContainer const* pWhichRange;
 
     switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
     {
@@ -1491,7 +1491,7 @@ SwFormat* DocumentStylePoolManager::GetFormatFromPool( sal_uInt16 nId )
         }
 
     OUString aNm(SwResId(pRCId));
-    SwAttrSet aSet( m_rDoc.GetAttrPool(), pWhichRange ? *pWhichRange : WhichRangesContainer() );
+    SwAttrSet aSet(m_rDoc.GetAttrPool(), *pWhichRange);
 
     {
         bool bIsModified = m_rDoc.getIDocumentState().IsModified();
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 68352c7ff642..9181f970ea18 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -2516,8 +2516,8 @@ SwFrameFormat::SwFrameFormat(
     const char* pFormatNm,
     SwFrameFormat *pDrvdFrame,
     sal_uInt16 nFormatWhich,
-    const WhichRangesContainer* pWhichRange)
-:   SwFormat(rPool, pFormatNm, pWhichRange ? pWhichRange : &aFrameFormatSetRange, pDrvdFrame, nFormatWhich),
+    const WhichRangesContainer& pWhichRange)
+:   SwFormat(rPool, pFormatNm, pWhichRange, pDrvdFrame, nFormatWhich),
     m_wXObject(),
     maFillAttributes(),
     m_ffList(nullptr),
@@ -2530,8 +2530,8 @@ SwFrameFormat::SwFrameFormat(
     const OUString &rFormatNm,
     SwFrameFormat *pDrvdFrame,
     sal_uInt16 nFormatWhich,
-    const WhichRangesContainer* pWhichRange)
-:   SwFormat(rPool, rFormatNm, (pWhichRange ? pWhichRange : &aFrameFormatSetRange), pDrvdFrame, nFormatWhich),
+    const WhichRangesContainer& pWhichRange)
+:   SwFormat(rPool, rFormatNm, pWhichRange, pDrvdFrame, nFormatWhich),
     m_wXObject(),
     maFillAttributes(),
     m_ffList(nullptr),
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 63d490480559..fd18bb1a9d5f 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -3530,25 +3530,25 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
         throw uno::RuntimeException();
     }
 
-    const WhichRangesContainer* pRange = nullptr;
+    WhichRangesContainer pRange;
     const SfxItemPropertySet* pPropSet = nullptr;
     switch( m_eFamily )
     {
         case IStyleAccess::AUTO_STYLE_CHAR:
         {
-            pRange = &aCharAutoFormatSetRange;
+            pRange = aCharAutoFormatSetRange;
             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE);
             break;
         }
         case IStyleAccess::AUTO_STYLE_RUBY:
         {
-            pRange = nullptr;//aTextNodeSetRange;
+            // pRange = aTextNodeSetRange;
             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_RUBY_AUTO_STYLE);
             break;
         }
         case IStyleAccess::AUTO_STYLE_PARA:
         {
-            pRange = &aTextNodeSetRange; // checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
+            pRange = aTextNodeSetRange; // checked, already added support for [XATTR_FILL_FIRST, XATTR_FILL_LAST]
             pPropSet = aSwMapProvider.GetPropertySet(PROPERTY_MAP_PARA_AUTO_STYLE);
             break;
         }
@@ -3558,7 +3558,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle(
     if( !pPropSet)
         throw uno::RuntimeException();
 
-    SwAttrSet aSet( m_pDocShell->GetDoc()->GetAttrPool(), pRange ? *pRange : WhichRangesContainer() );
+    SwAttrSet aSet( m_pDocShell->GetDoc()->GetAttrPool(), pRange );
     const bool bTakeCareOfDrawingLayerFillStyle(IStyleAccess::AUTO_STYLE_PARA == m_eFamily);
 
     if(!bTakeCareOfDrawingLayerFillStyle)


More information about the Libreoffice-commits mailing list