diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-16 12:04:48 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-08-16 15:00:56 +0200 |
commit | 3ec86ad77071af577f37a83a0b1d0389b2204716 (patch) | |
tree | 5c48e447185bf6a8872cbbbc8a19b967987f8e9b /svx | |
parent | e75a01f4a00fdafad918099b90d1ca79224b4dca (diff) |
tdf#119284 bg for automatic not set while editing
refactor and reuse fdo#35779 solution for this case
Change-Id: I0631cd2560aa2acc2310f95b5c4dea36a2845a58
Reviewed-on: https://gerrit.libreoffice.org/59165
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 70f23a4e5974..5a79e8818b6d 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -852,6 +852,37 @@ void SdrTextObj::impDecomposeAutoFitTextPrimitive( rTarget = aConverter.getPrimitive2DSequence(); } +// Resolves: fdo#35779 set background color of this shape as the editeng background if there +// is one. Check the shape itself, then the host page, then that page's master page. +void SdrObject::setSuitableOutlinerBg(::Outliner& rOutliner) const +{ + const SfxItemSet* pBackgroundFillSet = &GetObjectItemSet(); + + if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) + { + SdrPage* pOwnerPage(getSdrPageFromSdrObject()); + if (pOwnerPage) + { + pBackgroundFillSet = &pOwnerPage->getSdrPageProperties().GetItemSet(); + + if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) + { + if (!pOwnerPage->IsMasterPage() && pOwnerPage->TRG_HasMasterPage()) + { + pBackgroundFillSet = &pOwnerPage->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); + } + } + } + } + + if (drawing::FillStyle_NONE != pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) + { + Color aColor(rOutliner.GetBackgroundColor()); + GetDraftFillColor(*pBackgroundFillSet, aColor); + rOutliner.SetBackgroundColor(aColor); + } +} + void SdrTextObj::impDecomposeBlockTextPrimitive( drawinglayer::primitive2d::Primitive2DContainer& rTarget, const drawinglayer::primitive2d::SdrBlockTextPrimitive2D& rSdrBlockTextPrimitive, @@ -882,35 +913,9 @@ void SdrTextObj::impDecomposeBlockTextPrimitive( rOutliner.SetMinAutoPaperSize(aNullSize); rOutliner.SetMaxAutoPaperSize(Size(1000000,1000000)); - // Resolves: fdo#35779 set background color of this shape as the editeng background if there - // is one. Check the shape itself, then the host page, then that page's master page. // That color needs to be restored on leaving this method Color aOriginalBackColor(rOutliner.GetBackgroundColor()); - const SfxItemSet* pBackgroundFillSet = &GetObjectItemSet(); - - if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) - { - SdrPage* pOwnerPage(getSdrPageFromSdrObject()); - if (pOwnerPage) - { - pBackgroundFillSet = &pOwnerPage->getSdrPageProperties().GetItemSet(); - - if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) - { - if (!pOwnerPage->IsMasterPage() && pOwnerPage->TRG_HasMasterPage()) - { - pBackgroundFillSet = &pOwnerPage->TRG_GetMasterPage().getSdrPageProperties().GetItemSet(); - } - } - } - } - - if (drawing::FillStyle_NONE != pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue()) - { - Color aColor(rOutliner.GetBackgroundColor()); - GetDraftFillColor(*pBackgroundFillSet, aColor); - rOutliner.SetBackgroundColor(aColor); - } + setSuitableOutlinerBg(rOutliner); // add one to rage sizes to get back to the old Rectangle and outliner measurements const sal_uInt32 nAnchorTextWidth(FRound(aAnchorTextRange.getWidth() + 1)); |