diff options
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/scrwin.hxx | 68 | ||||
-rw-r--r-- | starmath/inc/view.hxx | 111 |
2 files changed, 74 insertions, 105 deletions
diff --git a/starmath/inc/scrwin.hxx b/starmath/inc/scrwin.hxx deleted file mode 100644 index 348779e312b9..000000000000 --- a/starmath/inc/scrwin.hxx +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <vcl/window.hxx> -#include <vcl/vclptr.hxx> - -class DataChangedEvent; -class ScrollBar; -class ScrollBarBox; - -class ScrollableWindow : public vcl::Window -{ -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; - - VclPtr<ScrollBar> aVScroll; // the scrollbars - VclPtr<ScrollBar> aHScroll; - VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner - bool bScrolling:1; // user controlled scrolling - - DECL_LINK( ScrollHdl, ScrollBar *, void ); - DECL_LINK( EndScrollHdl, ScrollBar *, void ); - -public: - ScrollableWindow( vcl::Window* pParent ); - virtual ~ScrollableWindow() override; - virtual void dispose() override; - - virtual void Resize() override; - virtual void Command( const CommandEvent& rCEvt ) override; - virtual void DataChanged( const DataChangedEvent& rDEvt ) override; - - using OutputDevice::SetMapMode; - virtual void SetMapMode( const MapMode& rNewMapMode ) override; - MapMode GetMapMode() const; - - void SetTotalSize( const Size& rNewSize ); - Size GetTotalSize() const { return PixelToLogic( aTotPixSz ); } - - using Window::Scroll; - virtual void Scroll( tools::Long nDeltaX, tools::Long nDeltaY, ScrollFlags nFlags = ScrollFlags::NONE ) override; - -private: - Size GetOutputSizePixel() const; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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. */ |