diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-16 11:47:20 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-08-28 15:50:48 +0200 |
commit | 0655121bebd976a0c651b3c4f6f85e3bf76c89d6 (patch) | |
tree | 0e5e23942703d36e43bf2f8659f176f7b43ca3f8 | |
parent | 5be8cbdb874621111cb157a98013e254de3b269c (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/59167
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r-- | include/svx/svdobj.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/view/sdview.cxx | 20 | ||||
-rw-r--r-- | svx/source/svdraw/svdotextdecomposition.cxx | 59 |
3 files changed, 42 insertions, 40 deletions
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 0972849dd74a..00b1152816e4 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -43,6 +43,7 @@ class SfxBroadcaster; class Pointer; class AutoTimer; class OutlinerParaObject; +class Outliner; class SdrOutliner; class SdrDragStat; class SdrHdl; @@ -905,6 +906,8 @@ public: const css::uno::WeakReference< css::uno::XInterface >& getWeakUnoShape() const { return maWeakUnoShape; } + void setSuitableOutlinerBg(Outliner& rOutliner) const; + protected: tools::Rectangle aOutRect; // surrounding rectangle for Paint (incl. LineWdt, ...) Point aAnchor; // anchor position (Writer) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 3409123b788b..835474e79a0f 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -712,30 +712,24 @@ bool View::SdrBeginTextEdit( } } - if (bReturn) + if (::Outliner* pOL = bReturn ? GetTextEditOutliner() : nullptr) { - ::Outliner* pOL = GetTextEditOutliner(); - - if( pObj && pObj->GetPage() ) + if (pObj) { - Color aBackground; if( pObj->GetObjInventor() == SdrInventor::Default && pObj->GetObjIdentifier() == OBJ_TABLE ) { + Color aBackground; aBackground = GetTextEditBackgroundColor(*this); + pOL->SetBackgroundColor( aBackground ); } else { - aBackground = pObj->GetPage()->GetPageBackgroundColor(pPV); + pObj->setSuitableOutlinerBg(*pOL); } - if (pOL != nullptr) - pOL->SetBackgroundColor( aBackground ); } - if (pOL != nullptr) - { - pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); - pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); - } + pOL->SetParaInsertedHdl(LINK(this, View, OnParagraphInsertedHdl)); + pOL->SetParaRemovingHdl(LINK(this, View, OnParagraphRemovingHdl)); } if (bMasterPage && bReturn && pOutl) diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 75830c864536..ede3f675e39e 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -851,6 +851,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 = GetPage(); + 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, @@ -881,35 +912,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 = GetPage(); - 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)); |