diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-09 19:10:46 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2017-08-10 15:17:59 +0200 |
commit | 71a8c7a5c4dcd440ed603810467b80cc7265cd2f (patch) | |
tree | ae7a7bf63dad1bc3f8cabd006bb2e47be9200f07 /svx | |
parent | 68eff5b6c28a136a79a7d7ad5c04e10f8ce69980 (diff) |
editviewoverlay: correct reaction on property change
Do not hand over LogicalSelectionRanges directly on
selection change, better let the visulizer do what
he needs. On AttributeChange, tge resulting repaint
needs to refresh all OverlayObjects, not only text,
but also the selection to make look okay e.g. at
font size change
Change-Id: Ibb9737c33d6f85a9f68df3edbb989c0443cd4a5c
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 3f985b24aa7c..aa369a9e61d4 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -412,7 +412,7 @@ namespace // data write access. In this OverlayObject we only have the // callback that triggers detecting if something *has* changed void checkDataChange(const basegfx::B2DRange& rMinTextEditArea); - void checkSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges); + void checkSelectionChange(); }; drawinglayer::primitive2d::Primitive2DContainer TextEditOverlayObject::createOverlayObjectPrimitive2DSequence() @@ -567,11 +567,28 @@ namespace } } - void TextEditOverlayObject::checkSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges) + void TextEditOverlayObject::checkSelectionChange() { - if (getOverlaySelection()) + if (getOverlaySelection() && getOverlayManager()) { - mpOverlaySelection->setRanges(rLogicRanges); + std::vector<tools::Rectangle> aLogicRects; + std::vector<basegfx::B2DRange> aLogicRanges; + const Size aLogicPixel(getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1))); + + // get logic selection + getOutlinerView().GetSelectionRectangles(aLogicRects); + + for (const auto& aRect : aLogicRects) + { + // convert from logic Rectangles to logic Ranges, do not forget to add + // one Unit (in this case logical units for one pixel, pre-calculated) + aLogicRanges.push_back( + basegfx::B2DRange( + aRect.Left() - aLogicPixel.Width(), aRect.Top() - aLogicPixel.Height(), + aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height())); + } + + mpOverlaySelection->setRanges(aLogicRanges); } } } // end of anonymous namespace @@ -601,7 +618,7 @@ void SdrObjEditView::EditViewInvalidate() const } } -void SdrObjEditView::EditViewSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges) const +void SdrObjEditView::EditViewSelectionChange() const { if (IsTextEdit()) { @@ -611,7 +628,7 @@ void SdrObjEditView::EditViewSelectionChange(const std::vector<basegfx::B2DRange if (pCandidate) { - pCandidate->checkSelectionChange(rLogicRanges); + pCandidate->checkSelectionChange(); } } } @@ -621,10 +638,11 @@ void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const { if (!comphelper::LibreOfficeKit::isActive()) { - // adapt TextEditOverlayObject(s). Need also to do this here to - // update the current values accordingly. Suppress new stuff when - // LibreOficeKit is active + // adapt all TextEditOverlayObject(s), so call EditViewInvalidate() + // and EditViewSelectionChange() to update accordingly. Suppress new + // stuff when LibreOficeKit is active EditViewInvalidate(); + EditViewSelectionChange(); } else { |