1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_SFX2_LOKCHARTHELPER_HXX
11 #define INCLUDED_SFX2_LOKCHARTHELPER_HXX
13 #include <sfx2/dllapi.h>
14 #include <tools/gen.hxx>
15 #include <vcl/vclptr.hxx>
16 #include <vcl/window.hxx>
18 namespace com::sun::star::beans
{ struct PropertyValue
; }
19 namespace com::sun::star::frame
{ class XController
; }
20 namespace com::sun::star::frame
{ class XDispatch
; }
21 namespace com::sun::star::frame
{ class XFrame
; }
22 namespace com::sun::star::uno
{ template<class E
> class Sequence
; }
24 class SfxInPlaceClient
;
28 /// A class for chart editing support via LibreOfficeKit.
29 class SFX2_DLLPUBLIC LokChartHelper
32 SfxViewShell
* mpViewShell
;
33 css::uno::Reference
<css::frame::XController
> mxController
;
34 css::uno::Reference
<css::frame::XDispatch
> mxDispatcher
;
35 VclPtr
<vcl::Window
> mpWindow
;
39 LokChartHelper(SfxViewShell
* pViewShell
, bool bNegativeX
= false)
40 : mpViewShell(pViewShell
)
42 , mbNegativeX(bNegativeX
)
45 css::uno::Reference
<css::frame::XController
>& GetXController();
46 css::uno::Reference
<css::frame::XDispatch
>& GetXDispatcher();
47 vcl::Window
* GetWindow();
48 tools::Rectangle
GetChartBoundingBox();
51 bool Hit(const Point
& aPos
);
52 static bool HitAny(const Point
& aPos
, bool bNegativeX
= false);
53 void PaintTile(VirtualDevice
& rRenderContext
, const tools::Rectangle
& rTileRect
);
54 static void PaintAllChartsOnTile(VirtualDevice
& rDevice
,
55 int nOutputWidth
, int nOutputHeight
,
56 int nTilePosX
, int nTilePosY
,
57 tools::Long nTileWidth
, tools::Long nTileHeight
,
58 bool bNegativeX
= false);
59 bool postMouseEvent(int nType
, int nX
, int nY
,
60 int nCount
, int nButtons
, int nModifier
,
61 double fScaleX
= 1.0, double fScaleY
= 1.0);
62 bool setTextSelection(int nType
, int nX
, int nY
);
63 bool setGraphicSelection(int nType
, int nX
, int nY
,
64 double fScaleX
= 1.0, double fScaleY
= 1.0);
67 /// A class for math editing support via LibreOfficeKit.
68 class SFX2_DLLPUBLIC LokStarMathHelper
71 LokStarMathHelper(const SfxViewShell
* pViewShell
);
73 vcl::Window
* GetGraphicWindow();
74 vcl::Window
* GetWidgetWindow();
75 const SfxViewShell
* GetSmViewShell();
76 tools::Rectangle
GetBoundingBox() const;
78 void Dispatch(const OUString
& cmd
, const css::uno::Sequence
<css::beans::PropertyValue
>& rArguments
) const;
80 bool postMouseEvent(int nType
, int nX
, int nY
, int nCount
, int nButtons
, int nModifier
,
81 double fPPTScaleX
, double fPPTScaleY
);
83 static void PaintAllInPlaceOnTile(VirtualDevice
& rDevice
, int nOutputWidth
, int nOutputHeight
,
84 int nTilePosX
, int nTilePosY
, tools::Long nTileWidth
,
85 tools::Long nTileHeight
);
88 void PaintTile(VirtualDevice
& rDevice
, const tools::Rectangle
& rTileRect
);
90 const SfxViewShell
* mpViewShell
;
91 const SfxInPlaceClient
* mpIPClient
= nullptr; // not nullptr when the object is valid
92 css::uno::Reference
<css::frame::XFrame
> mxFrame
; // not empty when the object is valid
93 VclPtr
<vcl::Window
> mpGraphicWindow
;
94 VclPtr
<vcl::Window
> mpWidgetWindow
;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */