/src/libreoffice/include/sfx2/lokcomponenthelpers.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | */ |
9 | | |
10 | | #pragma once |
11 | | |
12 | | #include <sfx2/dllapi.h> |
13 | | #include <vcl/vclptr.hxx> |
14 | | #include <vcl/window.hxx> |
15 | | |
16 | | namespace com::sun::star::beans { struct PropertyValue; } |
17 | | namespace com::sun::star::frame { class XController; } |
18 | | namespace com::sun::star::frame { class XFrame; } |
19 | | namespace com::sun::star::uno { template<class E> class Sequence; } |
20 | | |
21 | | class Point; |
22 | | class SfxInPlaceClient; |
23 | | class SfxViewShell; |
24 | | class VirtualDevice; |
25 | | namespace tools { class Rectangle; } |
26 | | |
27 | | /// A class for chart editing support via LibreOfficeKit. |
28 | | class SFX2_DLLPUBLIC LokChartHelper |
29 | | { |
30 | | private: |
31 | | SfxViewShell* mpViewShell; |
32 | | mutable css::uno::Reference<css::frame::XController> mxController; |
33 | | VclPtr<vcl::Window> mpWindow; |
34 | | bool mbNegativeX; |
35 | | |
36 | | public: |
37 | | LokChartHelper(SfxViewShell* pViewShell, bool bNegativeX = false) |
38 | 0 | : mpViewShell(pViewShell) |
39 | 0 | , mpWindow(nullptr) |
40 | 0 | , mbNegativeX(bNegativeX) |
41 | 0 | {} |
42 | | |
43 | | css::uno::Reference<css::frame::XController>& GetXController() const; |
44 | | vcl::Window* GetWindow(); |
45 | | tools::Rectangle GetChartBoundingBox(); |
46 | | void Invalidate(); |
47 | | |
48 | | void Dispatch(const OUString& cmd, const css::uno::Sequence<css::beans::PropertyValue>& rArguments) const; |
49 | | |
50 | | bool Hit(const Point& aPos); |
51 | | static bool HitAny(const Point& aPos, bool bNegativeX = false); |
52 | | void PaintTile(VirtualDevice& rRenderContext, const tools::Rectangle& rTileRect); |
53 | | static void PaintAllChartsOnTile(VirtualDevice& rDevice, |
54 | | int nOutputWidth, int nOutputHeight, |
55 | | int nTilePosX, int nTilePosY, |
56 | | tools::Long nTileWidth, tools::Long nTileHeight, |
57 | | bool bNegativeX = false); |
58 | | bool postMouseEvent(int nType, int nX, int nY, |
59 | | int nCount, int nButtons, int nModifier, |
60 | | double fScaleX = 1.0, double fScaleY = 1.0); |
61 | | bool setTextSelection(int nType, int nX, int nY); |
62 | | bool setGraphicSelection(int nType, int nX, int nY, |
63 | | double fScaleX = 1.0, double fScaleY = 1.0); |
64 | | }; |
65 | | |
66 | | /// A class for math editing support via LibreOfficeKit. |
67 | | class SFX2_DLLPUBLIC LokStarMathHelper |
68 | | { |
69 | | public: |
70 | | LokStarMathHelper(const SfxViewShell* pViewShell); |
71 | | |
72 | | vcl::Window* GetGraphicWindow(); |
73 | | vcl::Window* GetWidgetWindow(); |
74 | | const SfxViewShell* GetSmViewShell(); |
75 | | tools::Rectangle GetBoundingBox() const; |
76 | | |
77 | | void Dispatch(const OUString& cmd, const css::uno::Sequence<css::beans::PropertyValue>& rArguments) const; |
78 | | |
79 | | bool postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier, |
80 | | double fPPTScaleX, double fPPTScaleY); |
81 | | |
82 | | static void PaintAllInPlaceOnTile(VirtualDevice& rDevice, int nOutputWidth, int nOutputHeight, |
83 | | int nTilePosX, int nTilePosY, tools::Long nTileWidth, |
84 | | tools::Long nTileHeight); |
85 | | |
86 | | private: |
87 | | void PaintTile(VirtualDevice& rDevice, const tools::Rectangle& rTileRect); |
88 | | |
89 | | const SfxViewShell* mpViewShell; |
90 | | const SfxInPlaceClient* mpIPClient = nullptr; // not nullptr when the object is valid |
91 | | css::uno::Reference<css::frame::XFrame> mxFrame; // not empty when the object is valid |
92 | | VclPtr<vcl::Window> mpGraphicWindow; |
93 | | VclPtr<vcl::Window> mpWidgetWindow; |
94 | | }; |
95 | | |
96 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |