summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdedxv.cxx36
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
{