summaryrefslogtreecommitdiff
path: root/starmath/inc/visitors.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/inc/visitors.hxx')
-rw-r--r--starmath/inc/visitors.hxx60
1 files changed, 49 insertions, 11 deletions
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index 27c4e374e9ff..b29bb26fb5b0 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -111,26 +111,64 @@ protected:
virtual void DefaultVisit( SmNode* pNode ) = 0;
};
-// SmCaretDrawingVisitor
+// SmCaretLinesVisitor: ancestor of caret rectangle enumeration and drawing visitors
-/** Visitor for drawing a caret position */
-class SmCaretDrawingVisitor final : public SmDefaultingVisitor
+class SmCaretLinesVisitor : public SmDefaultingVisitor
{
public:
- /** Given position and device this constructor will draw the caret */
- SmCaretDrawingVisitor( OutputDevice& rDevice, SmCaretPos position, Point offset, bool caretVisible );
- virtual ~SmCaretDrawingVisitor() {}
- void Visit( SmTextNode* pNode ) override;
+ SmCaretLinesVisitor(OutputDevice& rDevice, SmCaretPos position, Point offset);
+ virtual ~SmCaretLinesVisitor() = default;
+ void Visit(SmTextNode* pNode) override;
using SmDefaultingVisitor::Visit;
+
+protected:
+ void DoIt();
+
+ OutputDevice& getDev() { return mrDev; }
+ virtual void ProcessCaretLine(Point from, Point to) = 0;
+ virtual void ProcessUnderline(Point from, Point to) = 0;
+
+ /** Default method for drawing pNodes */
+ void DefaultVisit(SmNode* pNode) override;
+
private:
- OutputDevice &mrDev;
+ OutputDevice& mrDev;
SmCaretPos maPos;
/** Offset to draw from */
Point maOffset;
- bool mbCaretVisible;
+};
- /** Default method for drawing pNodes */
- void DefaultVisit( SmNode* pNode ) override;
+// SmCaretRectanglesVisitor: obtains the set of rectangles to sent to lok
+
+class SmCaretRectanglesVisitor final : public SmCaretLinesVisitor
+{
+public:
+ SmCaretRectanglesVisitor(OutputDevice& rDevice, SmCaretPos position);
+ const tools::Rectangle& getCaret() const { return maCaret; }
+
+protected:
+ virtual void ProcessCaretLine(Point from, Point to) override;
+ virtual void ProcessUnderline(Point from, Point to) override;
+
+private:
+ tools::Rectangle maCaret;
+};
+
+// SmCaretDrawingVisitor
+
+/** Visitor for drawing a caret position */
+class SmCaretDrawingVisitor final : public SmCaretLinesVisitor
+{
+public:
+ /** Given position and device this constructor will draw the caret */
+ SmCaretDrawingVisitor( OutputDevice& rDevice, SmCaretPos position, Point offset, bool caretVisible );
+
+protected:
+ virtual void ProcessCaretLine(Point from, Point to) override;
+ virtual void ProcessUnderline(Point from, Point to) override;
+
+private:
+ bool mbCaretVisible;
};
// SmCaretPos2LineVisitor