40 #include <com/sun/star/awt/Point.hpp>
41 #include <com/sun/star/awt/Size.hpp>
42 #include <com/sun/star/awt/XWindow.hpp>
44 #include <com/sun/star/chart2/data/XDataProvider.hpp>
45 #include <com/sun/star/frame/XModel.hpp>
46 #include <com/sun/star/lang/XInitialization.hpp>
47 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
48 #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
58 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 )
91 bool bPutRight = bFitRight && ( bLayoutRTL || !bFitLeft );
95 aRet.setX( aObjAbs.
Left() - rDialogSize.
Width() - aSpace.
Width() );
111 if ( aRet.X() + rDialogSize.
Width() - 1 > aDesktop.
Right() )
112 aRet.setX( aDesktop.
Right() - rDialogSize.
Width() + 1 );
113 if ( aRet.X() < aDesktop.
Left() )
114 aRet.setX( aDesktop.
Left() );
115 if ( aRet.Y() + rDialogSize.
Height() - 1 > aDesktop.
Bottom() )
116 aRet.setY( aDesktop.
Bottom() - rDialogSize.
Height() + 1 );
117 if ( aRet.Y() < aDesktop.
Top() )
118 aRet.setY( aDesktop.
Top() );
130 uno::Reference< chart2::data::XDataProvider > xDataProvider;
131 uno::Reference< frame::XModel > xChartModel;
132 OUString aRangeString;
153 xChartModel.set(
SwTableFUNC( &rWrtShell ).InsertChart( xDataProvider, xDataProvider.is(), aRangeString, &pFlyFrameFormat ));
157 uno::Reference< uno::XComponentContext > xContext(
159 if( !(xContext.is() && xChartModel.is() && xDataProvider.is()))
162 uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
166 uno::Reference< ui::dialogs::XAsynchronousExecutableDialog > xDialog(
167 xMCF->createInstanceWithContext(
168 "com.sun.star.comp.chart2.WizardDialog", xContext),
170 uno::Reference< lang::XInitialization > xInit( xDialog, uno::UNO_QUERY );
176 {
"ParentWindow",
uno::Any(uno::Reference< awt::XWindow >())},
177 {
"ChartModel",
uno::Any(xChartModel)}
179 xInit->initialize( aSeq );
182 uno::Reference < beans::XPropertySet > xDialogProps( xDialog, uno::UNO_QUERY );
183 if ( xDialogProps.is() )
188 awt::Size aDialogAWTSize;
189 if( xDialogProps->getPropertyValue(
"Size")
192 Size aDialogSize( aDialogAWTSize.Width, aDialogAWTSize.Height );
201 xDialogProps->setPropertyValue(
"Position",
202 uno::makeAny( awt::Point(aDialogPos.getX(),aDialogPos.getY()) ) );
206 catch (
const uno::Exception&)
208 OSL_FAIL(
"Chart wizard couldn't be positioned automatically" );
214 css::uno::Reference<css::ui::dialogs::XDialogClosedListener> xListener( pListener );
216 xDialog->startExecuteModal( xListener );
220 uno::Reference< lang::XComponent > xComponent( xDialog, uno::UNO_QUERY );
222 xComponent->dispose();
SfxViewFrame * GetViewFrame() const
SfxDispatcher * GetDispatcher()
const MapMode & GetMapMode() const
tools::Rectangle GetDesktopRectPixel() const
Of course Writer needs its own rectangles.
SwWrtShell & GetWrtShell() const
Used by the UI to modify the document model.
Point SwGetChartDialogPos(const vcl::Window *pParentWin, const Size &rDialogSize, const tools::Rectangle &rLogicChart)
const SwView & GetView() const
#define FN_TABLE_SELECT_ALL
bool IsTableRightToLeft() const
const SwTableNode * IsCursorInTable() const
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
virtual SwChartDataProvider * GetChartDataProvider(bool bCreate=false) const =0
returns or creates the data-provider for chart
tools::Long Width() const
const SwRect & GetObjRectWithSpaces() const
method to determine object area inclusive its spacing
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
OUString GetBoxNms() const
SwDocShell * GetDocShell()
SwFrameFormat * GetTableFormat()
Point LogicToPixel(const Point &rLogicPt) const
tools::Rectangle SVRect() const
IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess()
tools::Long Height() const
Sequence< sal_Int8 > aSeq
SwInsertChart(const Link< css::ui::dialogs::DialogClosedEvent *, void > &rLink)
bool IsTableComplexForChart()
void SetDialogClosedLink(const Link< css::ui::dialogs::DialogClosedEvent *, void > &rLink)