23#include <osl/diagnose.h>
41#include <com/sun/star/awt/Point.hpp>
42#include <com/sun/star/awt/Size.hpp>
43#include <com/sun/star/awt/XWindow.hpp>
45#include <com/sun/star/chart2/data/XDataProvider.hpp>
46#include <com/sun/star/frame/XModel.hpp>
47#include <com/sun/star/lang/XInitialization.hpp>
48#include <com/sun/star/lang/XMultiComponentFactory.hpp>
49#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
59 OSL_ENSURE( pParentWin,
"Window not found" );
69 bool bCenterHor =
false;
85 bool bFitLeft = ( aObjAbs.
Left() - aDesktop.
Left() >= rDialogSize.
Width() + aSpace.
Width() );
88 if ( bFitLeft || bFitRight )
93 bool bLayoutRTL = pView->GetWrtShell().IsTableRightToLeft();
94 bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
115 if ( aRet.
X() + rDialogSize.
Width() - 1 > aDesktop.
Right() )
117 if ( aRet.
X() < aDesktop.
Left() )
119 if ( aRet.
Y() + rDialogSize.
Height() - 1 > aDesktop.
Bottom() )
121 if ( aRet.
Y() < aDesktop.
Top() )
136 uno::Reference< chart2::data::XDataProvider > xDataProvider;
137 uno::Reference< frame::XModel > xChartModel;
138 OUString aRangeString;
159 xChartModel.set(
SwTableFUNC( &rWrtShell ).InsertChart( xDataProvider, xDataProvider.is(), aRangeString, &pFlyFrameFormat ));
163 uno::Reference< uno::XComponentContext > xContext(
164 ::cppu::defaultBootstrap_InitialComponentContext() );
165 if( !(xContext.is() && xChartModel.is() && xDataProvider.is()))
168 uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
172 uno::Reference< ui::dialogs::XAsynchronousExecutableDialog > xDialog(
173 xMCF->createInstanceWithContext(
174 "com.sun.star.comp.chart2.WizardDialog", xContext),
176 uno::Reference< lang::XInitialization > xInit( xDialog, uno::UNO_QUERY );
182 {
"ParentWindow",
uno::Any(uno::Reference< awt::XWindow >())},
183 {
"ChartModel",
uno::Any(xChartModel)}
185 xInit->initialize(
aSeq );
188 uno::Reference < beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY );
189 if ( xDialogProps.is() )
194 awt::Size aDialogAWTSize;
195 if( xDialogProps->getPropertyValue(
"Size")
198 Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height );
207 xDialogProps->setPropertyValue(
"Position",
212 catch (
const uno::Exception&)
214 OSL_FAIL(
"Chart wizard couldn't be positioned automatically" );
219 pListener->SetDialogClosedLink( rLink );
221 xDialog->startExecuteModal( pListener );
225 uno::Reference< lang::XComponent > xComponent( xDialog, uno::UNO_QUERY );
227 xComponent->dispose();
Point SwGetChartDialogPos(const vcl::Window *pParentWin, const Size &rDialogSize, const tools::Rectangle &rLogicChart)
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long getX() const
constexpr tools::Long getY() const
SfxDispatcher * GetDispatcher()
SfxViewFrame & GetViewFrame() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
bool IsTableComplexForChart()
OUString GetBoxNms() const
const SwTableNode * IsCursorInTable() const
Check if Point of current cursor is placed within a table.
IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess()
SwFrameFormat * GetTableFormat()
SwInsertChart(const Link< css::ui::dialogs::DialogClosedEvent *, void > &rLink)
Of course Writer needs its own rectangles.
tools::Rectangle SVRect() const
SwWrtShell & GetWrtShell() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const SwView & GetView() const
Point LogicToPixel(const Point &rLogicPt) const
tools::Rectangle GetDesktopRectPixel() const
const MapMode & GetMapMode() const
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
#define FN_TABLE_SELECT_ALL
Sequence< sal_Int8 > aSeq
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)