diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-07-07 20:23:44 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-07-08 08:37:32 +0200 |
commit | 0025e80ba6d882f6f885499efaf37ab0e2ed699d (patch) | |
tree | db50d60639c7f6828aa59d04e052ade33071ec78 | |
parent | 396ceb05ef2bb75ba5c81b83f443863c485fa0b9 (diff) |
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 <vmiklos@collabora.com>
-rw-r--r-- | sw/source/core/doc/textboxhelper.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
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 |