summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editeng/source/editeng/impedit.cxx20
-rw-r--r--include/editeng/editview.hxx2
-rw-r--r--include/svx/svdedxv.hxx2
-rw-r--r--svx/source/svdraw/svdedxv.cxx36
4 files changed, 31 insertions, 29 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 3d71f9a92b0f..aa2a257c5343 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -197,24 +197,8 @@ void ImpEditView::SelectionChanged()
{
if (hasEditViewCallbacks())
{
- std::vector<tools::Rectangle> aLogicRects;
- std::vector<basegfx::B2DRange> aLogicRanges;
- const Size aLogicPixel(pOutWin ? pOutWin->PixelToLogic(Size(1, 1)) : Size(1, 1));
-
- GetSelectionRectangles(GetEditSelection(), aLogicRects);
-
- for (const auto& aRect : aLogicRects)
- {
- // convert from logic Rectangles to logic Ranges, do not forget to add
- // one Unit (in this case logical unit, thus calculate first)
- aLogicRanges.push_back(
- basegfx::B2DRange(
- aRect.Left(), aRect.Top(),
- aRect.Right() + aLogicPixel.Width(), aRect.Bottom() + aLogicPixel.Height()));
- }
-
// use callback to tell about change in selection visualisation
- mpEditViewCallbacks->EditViewSelectionChange(aLogicRanges);
+ mpEditViewCallbacks->EditViewSelectionChange();
}
}
@@ -229,7 +213,7 @@ void ImpEditView::SelectionChanged()
// the Region*, see GetSelectionRectangles below.
void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion, OutputDevice* pTargetDevice )
{
- if (hasEditViewCallbacks() && !pRegion)
+ if (hasEditViewCallbacks() && !pRegion && !comphelper::LibreOfficeKit::isActive())
{
// we are done, do *not* visualize self
// CAUTION: do not use when comphelper::LibreOfficeKit::isActive()
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 9bb09f8d2d8a..8b98d1f28360 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -93,7 +93,7 @@ public:
virtual ~EditViewCallbacks();
virtual void EditViewInvalidate() const = 0;
- virtual void EditViewSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges) const = 0;
+ virtual void EditViewSelectionChange() const = 0;
};
class EDITENG_DLLPUBLIC EditView final
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 8bdae7fb0ee4..6cfb22128e08 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -66,7 +66,7 @@ class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallb
// Now derived from EditViewCallbacks and overriding these callbacks to
// allow own EditText visualization
virtual void EditViewInvalidate() const override;
- virtual void EditViewSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges) const override;
+ virtual void EditViewSelectionChange() const override;
// The OverlayObjects used for visualizing active TextEdit (currently
// using TextEditOverlayObject, but not limitied to it
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
{