[Libreoffice-commits] core.git: Branch 'feature/editviewoverlay' - editeng/source svx/source

Armin Le Grand Armin.Le.Grand at cib.de
Wed Aug 9 14:38:43 UTC 2017


 editeng/source/editeng/impedit.cxx |    4 ++++
 svx/source/svdraw/svdedxv.cxx      |   37 ++++++++++++++++++++++++-------------
 2 files changed, 28 insertions(+), 13 deletions(-)

New commits:
commit b9a502cfa9bea1a1d01451b1dd6a9a14b7a486b8
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date:   Wed Aug 9 16:35:47 2017 +0200

    editviewoverlay: more cases secured
    
    Added support for vertical text, checked all
    combinations for text positioning, secured cursor
    stuff, ensured collaboration with LibreOfficeKit
    
    Change-Id: I98d1187700907c0c72abdccb9c9979496f6c20cf

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 48a6f1397af3..3d71f9a92b0f 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -232,6 +232,10 @@ void ImpEditView::DrawSelectionXOR( EditSelection aTmpSel, vcl::Region* pRegion,
     if (hasEditViewCallbacks() && !pRegion)
     {
         // we are done, do *not* visualize self
+        // CAUTION: do not use when comphelper::LibreOfficeKit::isActive()
+        // due to event stuff triggered below. That *should* probably be moved
+        // to SelectionChanged() which exists now, but I do not know enough about
+        // that stuff to do it
         return;
     }
 
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 7337e5eba75f..3f985b24aa7c 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -523,12 +523,23 @@ namespace
             drawinglayer::primitive2d::Primitive2DContainer aNewTextPrimitives;
 
             // active Outliner is always in unified oriented coordinate system (currently)
-            // so just translate to TopLeft of visible Range
-            tools::Rectangle aVisArea(mrOutlinerView.GetVisArea());
+            // so just translate to TopLeft of visible Range. Keep in mind that top-left
+            // depends on vertical text and top-to-bottom text attribures
+            const tools::Rectangle aVisArea(mrOutlinerView.GetVisArea());
+            const bool bVerticalWriting(pSdrOutliner->IsVertical());
+            const bool bTopToBottom(pSdrOutliner->IsTopToBottom());
+            const double fStartInX(
+                bVerticalWriting && bTopToBottom
+                ? aOutArea.Right() - aVisArea.Left()
+                : aOutArea.Left() - aVisArea.Left());
+            const double fStartInY(
+                bVerticalWriting && !bTopToBottom
+                ? aOutArea.Bottom() - aVisArea.Top()
+                : aOutArea.Top() - aVisArea.Top());
 
             aNewTransformB.translate(
-                aOutArea.Left() - aVisArea.Left(),
-                aOutArea.Top() - aVisArea.Top());
+                fStartInX,
+                fStartInY);
 
             // get the current TextPrimitives. This is the most expensive part
             // of this mechanism, it *may* be possible to buffer layouted
@@ -567,9 +578,6 @@ namespace
 
 // TextEdit
 
-// file-local static bool to control old/new behaviour of active TextEdit visualization
-static bool bAllowTextEditVisualizatkionOnOverlay(true);
-
 // callback from the active EditView, forward to evtl. existing instances of the
 // TextEditOverlayObject(s)
 void SdrObjEditView::EditViewInvalidate() const
@@ -611,10 +619,11 @@ void SdrObjEditView::EditViewSelectionChange(const std::vector<basegfx::B2DRange
 
 void SdrObjEditView::TextEditDrawing(SdrPaintWindow& rPaintWindow) const
 {
-    if (bAllowTextEditVisualizatkionOnOverlay)
+    if (!comphelper::LibreOfficeKit::isActive())
     {
         // adapt TextEditOverlayObject(s). Need also to do this here to
-        // update the current values accordingly
+        // update the current values accordingly. Suppress new stuff when
+        // LibreOficeKit is active
         EditViewInvalidate();
     }
     else
@@ -1128,9 +1137,10 @@ bool SdrObjEditView::SdrBeginTextEdit(
 
             pTextEditOutlinerView=ImpMakeOutlinerView(pWin,pGivenOutlinerView);
 
-            if (bAllowTextEditVisualizatkionOnOverlay && pTextEditOutlinerView)
+            if (!comphelper::LibreOfficeKit::isActive() && pTextEditOutlinerView)
             {
-                // activate visualization of EditView on Overlay
+                // activate visualization of EditView on Overlay, suppress when
+                // LibreOfficeKit is active
                 pTextEditOutlinerView->GetEditView().setEditViewCallbacks(this);
 
                 const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
@@ -1384,8 +1394,9 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
         GetModel()->Broadcast(aHint);
     }
 
-    // if new mechanism was used, clean it up
-    if (bAllowTextEditVisualizatkionOnOverlay && pTextEditOutlinerView)
+    // if new mechanism was used, clean it up. At cleanup no need to check
+    // for LibreOfficeKit
+    if (pTextEditOutlinerView)
     {
         pTextEditOutlinerView->GetEditView().setEditViewCallbacks(nullptr);
         maTEOverlayGroup.clear();


More information about the Libreoffice-commits mailing list