summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-08-04 18:56:43 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-08-10 15:17:58 +0200
commitf06b48a5dddab20fd1bbf9b5f3e8543593f5e590 (patch)
treece3bb9e57cdb21a8414a49bf919b1c442d2687ea /include
parent2ae717f2d722d78b29b51dc40194b64ab3bb5bc8 (diff)
editviewoverlay: Allow EditView to run in Overlay
This is the first basic functionality to get the active EditView with EditEngine work in the Overlay which all Apps support. Reason is that the current EditEngine 'plugs' into the Window and uses Invalidate() calls to repaint deeply everything under a text change. While this is acceptable for simple cases it can get very slow when there are excessive, expensive to paint objects in the background, e.g. MasterPages in Draw/Impress with gradients and other stuff. This was avoided in older versions (LO51) by 'guessing' a good BackgrundColor by the EditEngine, not invalidating but painting actively using that guess (with better or worse results) which someone removed. For the future it is anyways the better way to get the EditEngine functionality to Overlay and using Primitives, this will be a first step. This may enable Text Editing without repainting the Background (fast), using a non-XOR selection paint and more. It will need thorough testing and further experimenting due to EditEngine being used in many places (DrawObjects, Calc Cells, Formular Fields, Controls, ...) Change-Id: Ib9eb0f3999fd61a82ddf7a60ab1ea6ccda3a60da
Diffstat (limited to 'include')
-rw-r--r--include/editeng/editview.hxx21
-rw-r--r--include/svx/svdedxv.hxx12
-rw-r--r--include/svx/svdotext.hxx10
-rw-r--r--include/svx/svdoutl.hxx2
4 files changed, 43 insertions, 2 deletions
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 07333c75fe93..ac6ffc5433d1 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -72,6 +72,7 @@ namespace linguistic2 {
class XLanguageGuessing;
}
}}}
+namespace basegfx { class B2DRange; }
enum class ScrollRangeCheck
{
@@ -79,6 +80,21 @@ enum class ScrollRangeCheck
PaperWidthTextSize = 2, // VisArea must be within paper width, Text Size
};
+// Helper class that allows to set a callback at the EditView. When
+// set, Invalidates and repains are suppressed at the EditView, but
+// EditViewInvalidate() will be triggered to allow the consumer to
+// react itself as needed.
+// Also Selection visualization is suppressed and EditViewSelectionChange
+// is triggered when Selection changes and needs reaction.
+class EDITENG_DLLPUBLIC EditViewCallbacks
+{
+public:
+ EditViewCallbacks() {}
+ virtual ~EditViewCallbacks();
+
+ virtual void EditViewInvalidate() const = 0;
+ virtual void EditViewSelectionChange(const std::vector<basegfx::B2DRange>& rLogicRanges) const = 0;
+};
class EDITENG_DLLPUBLIC EditView final
{
@@ -105,6 +121,10 @@ public:
EditView( EditEngine* pEng, vcl::Window* pWindow );
~EditView();
+ // set EditViewCallbacks for external handling of Repaints/Visualization
+ void setEditViewCallbacks(const EditViewCallbacks* pEditViewCallbacks);
+ bool hasEditViewCallbacks() const;
+
void SetEditEngine( EditEngine* pEditEngine );
EditEngine* GetEditEngine() const;
@@ -117,6 +137,7 @@ public:
void Paint( const tools::Rectangle& rRect, OutputDevice* pTargetDevice = nullptr );
tools::Rectangle GetInvalidateRect() const;
+ void InvalidateWindow(const tools::Rectangle& rClipRect);
void InvalidateOtherViewWindows( const tools::Rectangle& rInvRect );
void Invalidate();
Pair Scroll( long nHorzScroll, long nVertScroll, ScrollRangeCheck nRangeCheck = ScrollRangeCheck::NoNegative );
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index 8dd62ff0b3ec..8bdae7fb0ee4 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -25,6 +25,7 @@
#include <svx/svxdllapi.h>
#include <svx/svdglev.hxx>
#include <svx/selectioncontroller.hxx>
+#include <editeng/editview.hxx>
#include <memory>
class SdrOutliner;
@@ -57,11 +58,20 @@ enum class SdrEndTextEditKind
// - macromod
-class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView
+class SVX_DLLPUBLIC SdrObjEditView: public SdrGlueEditView, public EditViewCallbacks
{
friend class SdrPageView;
friend class ImpSdrEditPara;
+ // 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;
+
+ // The OverlayObjects used for visualizing active TextEdit (currently
+ // using TextEditOverlayObject, but not limitied to it
+ sdr::overlay::OverlayObjectList maTEOverlayGroup;
+
protected:
// TextEdit
SdrObjectWeakRef mxTextEditObj; // current object in TextEdit
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 0269c88e5d39..33fa54a321fa 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -598,11 +598,19 @@ public:
const drawinglayer::geometry::ViewInformation2D& aViewInformation) const;
void impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutliner) const;
-
// timing generators
void impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
void impGetScrollTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList, double fFrameLength, double fTextLength) const;
+ // Direct decomposer for text visualization when you already have a prepared
+ // Outliner containing all the needed information
+ static void impDecomposeBlockTextPrimitiveDirect(
+ drawinglayer::primitive2d::Primitive2DContainer& rTarget,
+ SdrOutliner& rOutliner,
+ const basegfx::B2DHomMatrix& rNewTransformA,
+ const basegfx::B2DHomMatrix& rNewTransformB,
+ const basegfx::B2DRange& rClipRange);
+
/** returns false if the given pointer is NULL
or if the given SdrOutliner contains no text.
Also checks for one empty paragraph.
diff --git a/include/svx/svdoutl.hxx b/include/svx/svdoutl.hxx
index a9a885f68fac..5d1f9e842593 100644
--- a/include/svx/svdoutl.hxx
+++ b/include/svx/svdoutl.hxx
@@ -45,6 +45,8 @@ public:
const SdrPage* getVisualizedPage() const { return mpVisualizedPage; }
virtual OUString CalcFieldValue(const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor) override;
+
+ bool hasEditViewCallbacks() const;
};
#endif // INCLUDED_SVX_SVDOUTL_HXX