sw/source/core/doc/textboxhelper.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 0025e80ba6d882f6f885499efaf37ab0e2ed699d
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Jul 7 20:23:44 2021 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jul 8 08:37:32 2021 +0200

    sw: use SfxPoolItem::StaticWhichCast() in SwTextBoxHelper
    
            case RES_VERT_ORIENT + pItem->StaticWhichCast(RES_VERT_ORIENT)
    
    is more likely to match than
    
            case RES_VERT_ORIENT + static_cast<const 
SwFormatVertOrient&>(*pItem)
    
    Change-Id: If6ce65ae26b1088acb41b390a4fc8c1a69c141bf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118590
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index a47d1d251164..f372c21fb16b 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -921,8 +921,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
                 syncProperty(&rShape, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, 
uno::Any(aNewAnchorType));
                 if (bInlineAnchored)
                     return;
-                auto& rOrient = static_cast<const SwFormatVertOrient&>(*pItem);
-                SwFormatVertOrient aOrient(rOrient);
+                SwFormatVertOrient 
aOrient(pItem->StaticWhichCast(RES_VERT_ORIENT));
 
                 tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
                 if (!aRect.IsEmpty())
@@ -948,10 +947,9 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
                 const text::TextContentAnchorType aNewAnchorType
                     = mapAnchorType(rShape.GetAnchor().GetAnchorId());
                 syncProperty(&rShape, RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, 
uno::Any(aNewAnchorType));
-                auto& rOrient = static_cast<const SwFormatHoriOrient&>(*pItem);
                 if (bInlineAnchored)
                     return;
-                SwFormatHoriOrient aOrient(rOrient);
+                SwFormatHoriOrient 
aOrient(pItem->StaticWhichCast(RES_HORI_ORIENT));
 
                 tools::Rectangle aRect = getTextRectangle(&rShape, 
/*bAbsolute=*/false);
                 if (!aRect.IsEmpty())
@@ -993,8 +991,7 @@ void SwTextBoxHelper::syncFlyFrameAttr(SwFrameFormat& 
rShape, SfxItemSet const&
             break;
             case RES_ANCHOR:
             {
-                auto& rAnchor = static_cast<const SwFormatAnchor&>(*pItem);
-                if (rAnchor == rShape.GetAnchor())
+                if (pItem->StaticWhichCast(RES_ANCHOR) == rShape.GetAnchor())
                 // the anchor have to be synced
                 {
                     const text::TextContentAnchorType aNewAnchorType
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to