sw/inc/calbck.hxx                        |    2 ++
 sw/source/core/access/accframebase.cxx   |    2 +-
 sw/source/core/access/accnotextframe.cxx |    2 +-
 sw/source/core/access/acctable.cxx       |    2 +-
 sw/source/core/access/acctextframe.cxx   |    2 +-
 sw/source/core/table/swtable.cxx         |    2 +-
 sw/source/core/text/txtfrm.cxx           |    3 ++-
 7 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit dec9a123867dcd0fea4683beeb3b4b6659f926f3
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sun Sep 20 12:03:42 2020 +0200
Commit:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Sun Sep 27 23:03:06 2020 +0200

    Move default way to find Which to an inline function
    
    Change-Id: Ie3aa3f8a2c34c510a391d729f3dc2286f735111a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103066
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index fc17b826f965..62742cb1cab5 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -24,6 +24,7 @@
 
 #include <svl/hint.hxx>
 #include <svl/broadcast.hxx>
+#include <svl/poolitem.hxx>
 #include "swdllapi.h"
 #include "ring.hxx"
 #include <type_traits>
@@ -63,6 +64,7 @@ namespace sw
     struct LegacyModifyHint final: SfxHint
     {
         LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : 
m_pOld(pOld), m_pNew(pNew) {};
+        sal_uInt16 GetWhich() const { return m_pOld ? m_pOld->Which() : m_pNew 
? m_pNew->Which() : 0; };
         virtual ~LegacyModifyHint() override;
         const SfxPoolItem* m_pOld;
         const SfxPoolItem* m_pNew;
diff --git a/sw/source/core/access/accframebase.cxx 
b/sw/source/core/access/accframebase.cxx
index a0d3aeacf73a..6338ee18a5c1 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -215,7 +215,7 @@ void SwAccessibleFrameBase::Notify(const SfxHint& rHint)
     }
     else if(auto pLegacyModifyHint = dynamic_cast<const 
sw::LegacyModifyHint*>(&rHint))
     {
-        sal_uInt16 nWhich = pLegacyModifyHint->m_pOld ? 
pLegacyModifyHint->m_pOld->Which() : pLegacyModifyHint->m_pNew ? 
pLegacyModifyHint->m_pNew->Which() : 0;
+        const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
         const SwFlyFrame* pFlyFrame = static_cast<const 
SwFlyFrame*>(GetFrame());
         if(nWhich == RES_NAME_CHANGED && pFlyFrame)
         {
diff --git a/sw/source/core/access/accnotextframe.cxx 
b/sw/source/core/access/accnotextframe.cxx
index acc4f0ce31a5..3dfed9ea3303 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -89,7 +89,7 @@ void SwAccessibleNoTextFrame::Notify(const SfxHint& rHint)
         EndListeningAll();
     else if(auto pLegacyModifyHint = dynamic_cast<const 
sw::LegacyModifyHint*>(&rHint))
     {
-        const sal_uInt16 nWhich = pLegacyModifyHint->m_pOld ? 
pLegacyModifyHint->m_pOld->Which() : pLegacyModifyHint->m_pNew ? 
pLegacyModifyHint->m_pNew->Which() : 0;
+        const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
         if (nWhich != RES_TITLE_CHANGED && nWhich != RES_DESCRIPTION_CHANGED)
             return;
         const SwNoTextNode* pNd = GetNoTextNode();
diff --git a/sw/source/core/access/acctable.cxx 
b/sw/source/core/access/acctable.cxx
index 9e164c7c5696..457e5451dc3b 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -641,7 +641,7 @@ void SwAccessibleTable::Notify(const SfxHint& rHint)
     }
     else if(auto pLegacyHint = dynamic_cast<const 
sw::LegacyModifyHint*>(&rHint))
     {
-        sal_uInt16 nWhich = pLegacyHint->m_pOld ? pLegacyHint->m_pOld->Which() 
: pLegacyHint->m_pNew ? pLegacyHint->m_pNew->Which() : 0;
+        const sal_uInt16 nWhich = pLegacyHint->GetWhich();
         const SwTabFrame* pTabFrame = static_cast<const 
SwTabFrame*>(GetFrame());
         if(nWhich == RES_NAME_CHANGED && pTabFrame)
         {
diff --git a/sw/source/core/access/acctextframe.cxx 
b/sw/source/core/access/acctextframe.cxx
index 928a68677283..95937bbd1e99 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -69,7 +69,7 @@ void SwAccessibleTextFrame::Notify(const SfxHint& rHint)
         EndListeningAll();
     else if(auto pLegacyModifyHint = dynamic_cast<const 
sw::LegacyModifyHint*>(&rHint))
     {
-        const sal_uInt16 nWhich = pLegacyModifyHint->m_pOld ? 
pLegacyModifyHint->m_pOld->Which() : pLegacyModifyHint->m_pNew ? 
pLegacyModifyHint->m_pNew->Which() : 0;
+        const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
         const SwFlyFrame* pFlyFrame = static_cast<const 
SwFlyFrame*>(GetFrame());
         switch(nWhich)
         {
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index a14e8060b429..8d6b2b504d60 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -344,7 +344,7 @@ void SwTable::SwClientNotify(const SwModify&, const 
SfxHint& rHint)
     if(!pLegacy)
         return;
     // catch SSize changes, to adjust the lines/boxes
-    const sal_uInt16 nWhich = pLegacy->m_pOld ? pLegacy->m_pOld->Which() : 
pLegacy->m_pNew ? pLegacy->m_pNew->Which() : 0;
+    const sal_uInt16 nWhich = pLegacy->GetWhich();
     const SwFormatFrameSize* pNewSize = nullptr, *pOldSize = nullptr;
     switch(nWhich)
     {
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 1325122c7ca8..b89360fdc789 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1967,10 +1967,12 @@ void SwTextFrame::SwClientNotify(SwModify const& 
rModify, SfxHint const& rHint)
     sw::RedlineDelText const* pRedlineDelText(nullptr);
     sw::RedlineUnDelText const* pRedlineUnDelText(nullptr);
 
+    sal_uInt16 nWhich = 0;
     if (auto const pHint = dynamic_cast<sw::LegacyModifyHint const*>(&rHint))
     {
         pOld = pHint->m_pOld;
         pNew = pHint->m_pNew;
+        nWhich = pHint->GetWhich();
     }
     else if (auto const pHt = dynamic_cast<sw::MoveText const*>(&rHint))
     {
@@ -1995,7 +1997,6 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, 
SfxHint const& rHint)
     }
 
     SwTextNode const& rNode(static_cast<SwTextNode const&>(rModify));
-    const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
 
     // modifications concerning frame attributes are processed by the base 
class
     if( IsInRange( aFrameFormatSetRange, nWhich ) || RES_FMT_CHG == nWhich )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to