14#include <LibreOfficeKit/LibreOfficeKitEnums.h>
23#include <com/sun/star/embed/XEmbeddedObject.hpp>
24#include <com/sun/star/frame/XDispatch.hpp>
25#include <com/sun/star/chart2/XChartDocument.hpp>
36 const css::uno::Reference< ::css::embed::XEmbeddedObject >& xEmbObj = pIPClient->
GetObject();
39 ::css::uno::Reference< ::css::chart2::XChartDocument > xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
42 ::css::uno::Reference< ::css::frame::XController > xChartController = xChart->getCurrentController();
43 if( xChartController.is() )
59 ::css::uno::Reference< ::css::frame::XController >& xChartController =
GetXController();
60 if( xChartController.is() )
62 ::css::uno::Reference< ::css::frame::XDispatch > xDispatcher( xChartController, uno::UNO_QUERY );
63 if( xDispatcher.is() )
77 ::css::uno::Reference< ::css::frame::XController >& xChartController =
GetXController();
78 if( xChartController.is() )
80 ::css::uno::Reference< ::css::frame::XFrame >
xFrame = xChartController->getFrame();
83 ::css::uno::Reference< ::css::awt::XWindow > xDockerWin =
xFrame->getContainerWindow();
88 while (nTotChildren--)
91 if (pChildWin && pChildWin->
IsChart())
123 const auto& scaleX = aCWMapMode.
GetScaleX();
124 const auto& scaleY = aCWMapMode.
GetScaleY();
125 const auto nXNum =
p.first * scaleX.GetDenominator();
126 const auto nXDen =
p.second * scaleX.GetNumerator();
127 const auto nYNum =
p.first * scaleY.GetDenominator();
128 const auto nYDen =
p.second * scaleY.GetNumerator();
140 aOffset = aOffset.
scale(nXNum, nXDen, nYNum, nYDen);
174 int nPartForCurView = pCurView ? pCurView->
getPart() : -1;
181 if (aChartHelper.
Hit(aPos))
223 pChartWindow->
Paint(rRenderContext, aRectangle);
225 rRenderContext.
Pop();
227 if (bRenderContextEnableMapMode)
234 int nOutputWidth,
int nOutputHeight,
235 int nTilePosX,
int nTilePosY,
258 int nPartForCurView = pCurView ? pCurView->
getPart() : -1;
259 tools::Long nTileRectLeft = bNegativeX ? -nTilePosX - nTileWidth : nTilePosX;
267 aChartHelper.
PaintTile(rDevice, aTileRect);
275 int nCount,
int nButtons,
int nModifier,
276 double fScaleX,
double fScaleY)
278 Point aMousePos(nX, nY);
285 int nChartWinX = nX - rChartBBox.
Left();
286 int nChartWinY = nY - rChartBBox.
Top();
290 Point aPos(nChartWinX * fScaleX, nChartWinY * fScaleY);
293 nButtons, nModifier);
307 css::uno::Reference<css::frame::XDispatch> xDispatcher =
GetXDispatcher();
308 if (xDispatcher.is())
310 int nChartWinX = nX - rChartBBox.
Left();
311 int nChartWinY = nY - rChartBBox.
Top();
316 aURL.Path =
"LOKSetTextSelection";
317 uno::Sequence< beans::PropertyValue > aArgs{
322 xDispatcher->dispatch(
aURL, aArgs);
330 double fScaleX,
double fScaleY)
335 int nChartWinX = nX - rChartBBox.
Left();
336 int nChartWinY = nY - rChartBBox.
Top();
340 Point aPos(nChartWinX * fScaleX, nChartWinY * fScaleY);
343 case LOK_SETGRAPHICSELECTION_START:
351 case LOK_SETGRAPHICSELECTION_END:
Fraction conversionFract(o3tl::Length from, o3tl::Length to)
constexpr auto convertTwipToMm100(N n)
static bool GetLayoutRTL()
A class for chart editing support via LibreOfficeKit.
bool setGraphicSelection(int nType, int nX, int nY, double fScaleX=1.0, double fScaleY=1.0)
tools::Rectangle GetChartBoundingBox()
static bool HitAny(const Point &aPos, bool bNegativeX=false)
bool Hit(const Point &aPos)
bool setTextSelection(int nType, int nX, int nY)
css::uno::Reference< css::frame::XController > mxController
static void PaintAllChartsOnTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight, bool bNegativeX=false)
void PaintTile(VirtualDevice &rRenderContext, const tools::Rectangle &rTileRect)
SfxViewShell * mpViewShell
bool postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier, double fScaleX=1.0, double fScaleY=1.0)
css::uno::Reference< css::frame::XDispatch > mxDispatcher
css::uno::Reference< css::frame::XController > & GetXController()
vcl::Window * GetWindow()
VclPtr< vcl::Window > mpWindow
css::uno::Reference< css::frame::XDispatch > & GetXDispatcher()
void SetOrigin(const Point &rOrigin)
void SetScaleY(const Fraction &rScaleY)
const Fraction & GetScaleX() const
const Fraction & GetScaleY() const
void SetScaleX(const Fraction &rScaleX)
void EnableMapMode(bool bEnable=true)
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
bool IsMapModeEnabled() const
void setX(tools::Long nX)
constexpr Point scale(sal_Int64 nMulX, sal_Int64 nDivX, sal_Int64 nMulY, sal_Int64 nDivY) const
const css::uno::Reference< css::embed::XEmbeddedObject > & GetObject() const
vcl::Window * GetEditWin() const
static void postMouseEventAsync(const VclPtr< vcl::Window > &xWindow, LokMouseEventData const &rLokMouseEventData)
Helper for posting async mouse event.
One SfxViewShell more or less represents one edit window for a document, there can be multiple ones f...
ViewShellDocId GetDocId() const override
Get the DocId used by Mobile LOKit to load multiple documents.
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * Current()
SfxInPlaceClient * GetIPClient() const
virtual int getPart() const
See lok::Document::getPart().
constexpr Size scale(sal_Int64 nMulX, sal_Int64 nDivX, sal_Int64 nMulY, sal_Int64 nDivY) const
constexpr tools::Long Width() const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
bool SetOutputSizePixel(const Size &rNewSize, bool bErase=true, bool bAlphaMaskTransparent=false)
tools::Long GetOutOffXPixel() const
Point GetOffsetPixelFrom(const vcl::Window &rWindow) const
sal_uInt16 GetChildCount() const
virtual void MouseButtonDown(const MouseEvent &rMEvt)
virtual bool IsChart() const
bool IsMapModeEnabled() const
virtual void MouseButtonUp(const MouseEvent &rMEvt)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
const MapMode & GetMapMode() const
virtual void MouseMove(const MouseEvent &rMEvt)
virtual Size GetSizePixel() const
void EnableMapMode(bool bEnable=true)
vcl::Window * GetChild(sal_uInt16 nChild) const
bool isTiledAnnotations()
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
Reference< XFrame > xFrame