summaryrefslogtreecommitdiff
path: root/starmath/inc/view.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/inc/view.hxx')
-rw-r--r--starmath/inc/view.hxx111
1 files changed, 74 insertions, 37 deletions
diff --git a/starmath/inc/view.hxx b/starmath/inc/view.hxx
index 411904105059..94733e251cf5 100644
--- a/starmath/inc/view.hxx
+++ b/starmath/inc/view.hxx
@@ -30,16 +30,61 @@
#include <vcl/timer.hxx>
#include "document.hxx"
#include "edit.hxx"
-#include "scrwin.hxx"
class SmViewShell;
class SmPrintUIOptions;
class SmGraphicAccessible;
+class SmGraphicWidget;
class SmElementsDockingWindow;
namespace svtools { class ColorConfig; }
-class SmGraphicWindow final : public ScrollableWindow
+class SmGraphicWindow final : public InterimItemWindow
+{
+private:
+ Point aPixOffset; // offset to virtual window (pixel)
+ Size aTotPixSz; // total size of virtual window (pixel)
+ tools::Long nLinePixH; // size of a line/column (pixel)
+ tools::Long nColumnPixW;
+ sal_uInt16 nZoom;
+
+ std::unique_ptr<weld::ScrolledWindow> mxScrolledWindow;
+ std::unique_ptr<SmGraphicWidget> mxGraphic;
+ std::unique_ptr<weld::CustomWeld> mxGraphicWin;
+
+ DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);
+
+ void SetGraphicMapMode(const MapMode& rNewMapMode);
+ MapMode GetGraphicMapMode() const;
+
+public:
+ explicit SmGraphicWindow(SmViewShell& rShell);
+ virtual void dispose() override;
+ virtual ~SmGraphicWindow() override;
+
+ void SetTotalSize(const Size& rNewSize);
+ Size GetTotalSize() const;
+
+ void SetZoom(sal_uInt16 Factor);
+ sal_uInt16 GetZoom() const { return nZoom; }
+
+ void ZoomToFitInWindow();
+
+ virtual void Resize() override;
+ void ShowContextMenu(const CommandEvent& rCEvt);
+
+ SmGraphicWidget& GetGraphicWidget()
+ {
+ return *mxGraphic;
+ }
+
+ const SmGraphicWidget& GetGraphicWidget() const
+ {
+ return *mxGraphic;
+ }
+};
+
+class SmGraphicWidget final : public weld::CustomWidgetController
{
public:
bool IsCursorVisible() const
@@ -54,28 +99,21 @@ public:
void ShowLine(bool bShow);
const SmNode * SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol);
- explicit SmGraphicWindow(SmViewShell* pShell);
- virtual ~SmGraphicWindow() override;
- virtual void dispose() override;
+ explicit SmGraphicWidget(SmViewShell& rShell, SmGraphicWindow& rGraphicWindow);
+ virtual ~SmGraphicWidget() override;
- // Window
- virtual void ApplySettings(vcl::RenderContext&) override;
- virtual void MouseButtonDown(const MouseEvent &rMEvt) override;
- virtual void MouseMove(const MouseEvent &rMEvt) override;
+ // CustomWidgetController
+ virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
+ virtual bool MouseButtonDown(const MouseEvent &rMEvt) override;
+ virtual bool MouseMove(const MouseEvent &rMEvt) override;
virtual void GetFocus() override;
virtual void LoseFocus() override;
- SmViewShell* GetView()
- {
- return pViewShell;
- }
+ void SetTotalSize();
- using Window::SetZoom;
- void SetZoom(sal_uInt16 Factor);
- using Window::GetZoom;
- sal_uInt16 GetZoom() const
+ SmViewShell& GetView()
{
- return nZoom;
+ return mrViewShell;
}
const Point& GetFormulaDrawPos() const
@@ -83,14 +121,9 @@ public:
return aFormulaDrawPos;
}
- void ZoomToFitInWindow();
- using ScrollableWindow::SetTotalSize;
- void SetTotalSize();
-
// for Accessibility
virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
- using Window::GetAccessible;
SmGraphicAccessible* GetAccessible_Impl()
{
return mxAccessible.get();
@@ -101,15 +134,13 @@ private:
{
bIsCursorVisible = bVis;
}
- using Window::SetCursor;
void SetCursor(const SmNode *pNode);
void SetCursor(const tools::Rectangle &rRect);
static bool IsInlineEditEnabled();
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
- virtual void KeyInput(const KeyEvent& rKEvt) override;
- virtual void Command(const CommandEvent& rCEvt) override;
- virtual void StateChanged( StateChangedType eChanged ) override;
+ virtual bool KeyInput(const KeyEvent& rKEvt) override;
+ virtual bool Command(const CommandEvent& rCEvt) override;
void RepaintViewShellDoc();
DECL_LINK(CaretBlinkTimerHdl, Timer *, void);
@@ -117,6 +148,8 @@ private:
void CaretBlinkStart();
void CaretBlinkStop();
+ SmGraphicWindow& mrGraphicWindow;
+
Point aFormulaDrawPos;
// old style editing pieces
tools::Rectangle aCursorRect;
@@ -124,15 +157,14 @@ private:
bool bIsLineVisible;
AutoTimer aCaretBlinkTimer;
rtl::Reference<SmGraphicAccessible> mxAccessible;
- SmViewShell* pViewShell;
- sal_uInt16 nZoom;
+ SmViewShell& mrViewShell;
};
class SmGraphicController final : public SfxControllerItem
{
- SmGraphicWindow &rGraphic;
+ SmGraphicWidget &rGraphic;
public:
- SmGraphicController(SmGraphicWindow &, sal_uInt16, SfxBindings & );
+ SmGraphicController(SmGraphicWidget &, sal_uInt16, SfxBindings & );
virtual void StateChanged(sal_uInt16 nSID,
SfxItemState eState,
const SfxPoolItem* pState) override;
@@ -209,7 +241,7 @@ class SmViewShell: public SfxViewShell
{
std::unique_ptr<sfx2::DocumentInserter> mpDocInserter;
std::unique_ptr<SfxRequest> mpRequest;
- VclPtr<SmGraphicWindow> mpGraphic;
+ VclPtr<SmGraphicWindow> mxGraphicWindow;
SmGraphicController maGraphicController;
OUString maStatusText;
bool mbPasteState;
@@ -266,13 +298,18 @@ public:
SmEditWindow * GetEditWindow();
- SmGraphicWindow& GetGraphicWindow()
+ SmGraphicWidget& GetGraphicWidget()
+ {
+ return mxGraphicWindow->GetGraphicWidget();
+ }
+ const SmGraphicWidget& GetGraphicWidget() const
{
- return *mpGraphic;
+ return mxGraphicWindow->GetGraphicWidget();
}
- const SmGraphicWindow& GetGraphicWindow() const
+
+ SmGraphicWindow& GetGraphicWindow()
{
- return *mpGraphic;
+ return *mxGraphicWindow;
}
SmElementsDockingWindow* GetDockingWindow();
@@ -299,7 +336,7 @@ public:
/** Set bInsertIntoEditWindow so we know where to insert
*
- * This method is called whenever SmGraphicWindow or SmEditWindow gets focus,
+ * This method is called whenever SmGraphicWidget or SmEditWindow gets focus,
* so that when text is inserted from catalog or elsewhere we know whether to
* insert for the visual editor, or the text editor.
*/