1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartController_Properties.cxx,v $
10 * $Revision: 1.33.44.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #include "ChartController.hxx"
34 #include "ChartWindow.hxx"
35 #include "chartview/DrawModelWrapper.hxx"
36 #include "ObjectIdentifier.hxx"
37 #include "chartview/ExplicitValueProvider.hxx"
39 #include "dlg_ObjectProperties.hxx"
40 #include "dlg_View3D.hxx"
41 #include "dlg_InsertErrorBars.hxx"
42 #include "ViewElementListProvider.hxx"
43 #include "DataPointItemConverter.hxx"
44 #include "AxisItemConverter.hxx"
45 #include "MultipleChartConverters.hxx"
46 #include "TitleItemConverter.hxx"
47 #include "LegendItemConverter.hxx"
48 #include "RegressionCurveItemConverter.hxx"
49 #include "RegressionEquationItemConverter.hxx"
50 #include "ErrorBarItemConverter.hxx"
51 #include "ChartModelHelper.hxx"
52 #include "AxisHelper.hxx"
53 #include "TitleHelper.hxx"
54 #include "LegendHelper.hxx"
55 #include "ChartTypeHelper.hxx"
56 #include "ColorPerPointHelper.hxx"
57 #include "DiagramHelper.hxx"
58 #include "servicenames_charttypes.hxx"
59 #include "ControllerLockGuard.hxx"
60 #include "UndoGuard.hxx"
61 #include "ObjectNameProvider.hxx"
63 #include "Strings.hrc"
64 #include "ReferenceSizeProvider.hxx"
65 #include <com/sun/star/chart2/XChartDocument.hpp>
70 // header for define RET_OK
71 #include <vcl/msgbox.hxx>
73 #include <vcl/svapp.hxx>
74 #include <vos/mutex.hxx>
75 #include <svx/ActionDescriptionProvider.hxx>
77 //.............................................................................
80 //.............................................................................
81 using namespace ::com::sun::star
;
82 using namespace ::com::sun::star::chart2
;
87 ::comphelper::ItemConverter
* createItemConverter(
88 const ::rtl::OUString
& aObjectCID
89 , const uno::Reference
< frame::XModel
> & xChartModel
90 , const uno::Reference
< uno::XComponentContext
> & xContext
91 , SdrModel
& rDrawModel
92 , NumberFormatterWrapper
* pNumberFormatterWrapper
= NULL
93 , ExplicitValueProvider
* pExplicitValueProvider
= NULL
94 , ::std::auto_ptr
< ReferenceSizeProvider
> pRefSizeProvider
=
95 ::std::auto_ptr
< ReferenceSizeProvider
>()
98 ::comphelper::ItemConverter
* pItemConverter
=NULL
;
100 //-------------------------------------------------------------
101 //get type of selected object
102 ObjectType eObjectType
= ObjectIdentifier::getObjectType( aObjectCID
);
103 if( OBJECTTYPE_UNKNOWN
==eObjectType
)
105 DBG_ERROR("unknown ObjectType");
109 rtl::OUString aParticleID
= ObjectIdentifier::getParticleID( aObjectCID
);
110 bool bAffectsMultipleObjects
= aParticleID
.equals(C2U("ALLELEMENTS"));
111 //-------------------------------------------------------------
112 if( !bAffectsMultipleObjects
)
114 uno::Reference
< beans::XPropertySet
> xObjectProperties
=
115 ObjectIdentifier::getObjectPropertySet( aObjectCID
, xChartModel
);
116 if(!xObjectProperties
.is())
118 //create itemconverter for a single object
121 case OBJECTTYPE_PAGE
:
122 pItemConverter
= new wrapper::GraphicPropertyItemConverter(
123 xObjectProperties
, rDrawModel
.GetItemPool(),
124 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
125 wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES
);
127 case OBJECTTYPE_TITLE
:
129 ::std::auto_ptr
< awt::Size
> pRefSize
;
130 if( pRefSizeProvider
.get() )
131 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
133 pItemConverter
= new wrapper::TitleItemConverter( xObjectProperties
,
134 rDrawModel
.GetItemPool(), rDrawModel
,
135 uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
139 case OBJECTTYPE_LEGEND
:
141 ::std::auto_ptr
< awt::Size
> pRefSize
;
142 if( pRefSizeProvider
.get() )
143 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
145 pItemConverter
= new wrapper::LegendItemConverter( xObjectProperties
,
146 rDrawModel
.GetItemPool(), rDrawModel
,
147 uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
151 case OBJECTTYPE_LEGEND_ENTRY
:
153 case OBJECTTYPE_DIAGRAM
:
155 case OBJECTTYPE_DIAGRAM_WALL
:
156 case OBJECTTYPE_DIAGRAM_FLOOR
:
157 pItemConverter
= new wrapper::GraphicPropertyItemConverter(
158 xObjectProperties
, rDrawModel
.GetItemPool(),
159 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
160 wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES
);
162 case OBJECTTYPE_AXIS
:
164 ::std::auto_ptr
< awt::Size
> pRefSize
;
165 if( pRefSizeProvider
.get() )
166 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
168 uno::Reference
< beans::XPropertySet
> xDiaProp
;
169 xDiaProp
.set( ChartModelHelper::findDiagram( xChartModel
), uno::UNO_QUERY
);
171 // the second property set contains the property CoordinateOrigin
172 // nOriginIndex is the index of the corresponding index of the
173 // origin (x=0, y=1, z=2)
175 ExplicitScaleData aExplicitScale
;
176 ExplicitIncrementData aExplicitIncrement
;
177 if( pExplicitValueProvider
)
178 pExplicitValueProvider
->getExplicitValuesForAxis(
179 uno::Reference
< XAxis
>( xObjectProperties
, uno::UNO_QUERY
),
180 aExplicitScale
, aExplicitIncrement
);
182 pItemConverter
= new wrapper::AxisItemConverter(
183 xObjectProperties
, rDrawModel
.GetItemPool(),
185 uno::Reference
< chart2::XChartDocument
>( xChartModel
, uno::UNO_QUERY
),
186 &aExplicitScale
, &aExplicitIncrement
,
190 case OBJECTTYPE_AXIS_UNITLABEL
:
192 case OBJECTTYPE_DATA_LABELS
:
193 case OBJECTTYPE_DATA_SERIES
:
194 case OBJECTTYPE_DATA_LABEL
:
195 case OBJECTTYPE_DATA_POINT
:
197 ::std::auto_ptr
< awt::Size
> pRefSize
;
198 if( pRefSizeProvider
.get() )
199 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
201 wrapper::GraphicPropertyItemConverter::eGraphicObjectType eMapTo
=
202 wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT
;
204 uno::Reference
< XDataSeries
> xSeries
= ObjectIdentifier::getDataSeriesForCID( aObjectCID
, xChartModel
);
205 uno::Reference
< XChartType
> xChartType
= ChartModelHelper::getChartTypeOfSeries( xChartModel
, xSeries
);
207 uno::Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
208 sal_Int32 nDimensionCount
= DiagramHelper::getDimension( xDiagram
);
209 if( !ChartTypeHelper::isSupportingAreaProperties( xChartType
, nDimensionCount
) )
210 eMapTo
= wrapper::GraphicPropertyItemConverter::LINE_DATA_POINT
;
216 LINE_AND_FILL_PROPERTIES
218 bool bDataSeries
= ( eObjectType
== OBJECTTYPE_DATA_SERIES
|| eObjectType
== OBJECTTYPE_DATA_LABELS
);
220 //special color for pie chart:
221 bool bUseSpecialFillColor
= false;
222 sal_Int32 nSpecialFillColor
=0;
223 sal_Int32 nPointIndex
= -1; /*-1 for whole series*/
226 nPointIndex
= aParticleID
.toInt32();
227 uno::Reference
< beans::XPropertySet
> xSeriesProp( xSeries
, uno::UNO_QUERY
);
228 bool bVaryColorsByPoint
= false;
229 if( xSeriesProp
.is() &&
230 (xSeriesProp
->getPropertyValue(C2U("VaryColorsByPoint")) >>= bVaryColorsByPoint
) &&
233 if( !ColorPerPointHelper::hasPointOwnColor( xSeriesProp
, nPointIndex
, xObjectProperties
) )
235 bUseSpecialFillColor
= true;
236 OSL_ASSERT( xDiagram
.is());
237 uno::Reference
< XColorScheme
> xColorScheme( xDiagram
->getDefaultColorScheme() );
238 if( xColorScheme
.is())
239 nSpecialFillColor
= xColorScheme
->getColorByIndex( nPointIndex
);
243 sal_Int32 nNumberFormat
=ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel( xObjectProperties
, xSeries
, nPointIndex
, xDiagram
);
244 sal_Int32 nPercentNumberFormat
=ExplicitValueProvider::getExplicitPercentageNumberFormatKeyForDataLabel(
245 xObjectProperties
,uno::Reference
< util::XNumberFormatsSupplier
>(xChartModel
, uno::UNO_QUERY
));
247 pItemConverter
= new wrapper::DataPointItemConverter( xChartModel
, xContext
,
248 xObjectProperties
, xSeries
, rDrawModel
.GetItemPool(), rDrawModel
,
249 pNumberFormatterWrapper
,
250 uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
251 eMapTo
, pRefSize
, bDataSeries
, bUseSpecialFillColor
, nSpecialFillColor
, false,
252 nNumberFormat
, nPercentNumberFormat
);
255 case OBJECTTYPE_GRID
:
256 case OBJECTTYPE_SUBGRID
:
257 case OBJECTTYPE_DATA_AVERAGE_LINE
:
258 pItemConverter
= new wrapper::GraphicPropertyItemConverter(
259 xObjectProperties
, rDrawModel
.GetItemPool(),
260 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
261 wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES
);
264 case OBJECTTYPE_DATA_ERRORS
:
265 pItemConverter
= new wrapper::ErrorBarItemConverter(
266 xChartModel
, xObjectProperties
, rDrawModel
.GetItemPool(),
267 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
));
270 case OBJECTTYPE_DATA_CURVE
:
271 pItemConverter
= new wrapper::RegressionCurveItemConverter(
272 xObjectProperties
, uno::Reference
< chart2::XRegressionCurveContainer
>(
273 ObjectIdentifier::getDataSeriesForCID( aObjectCID
, xChartModel
), uno::UNO_QUERY
),
274 rDrawModel
.GetItemPool(), rDrawModel
,
275 uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
));
277 case OBJECTTYPE_DATA_CURVE_EQUATION
:
279 ::std::auto_ptr
< awt::Size
> pRefSize
;
280 if( pRefSizeProvider
.get() )
281 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
283 pItemConverter
= new wrapper::RegressionEquationItemConverter(
284 xObjectProperties
, rDrawModel
.GetItemPool(), rDrawModel
,
285 uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
289 case OBJECTTYPE_DATA_ERRORS_X
:
291 case OBJECTTYPE_DATA_ERRORS_Y
:
293 case OBJECTTYPE_DATA_ERRORS_Z
:
295 case OBJECTTYPE_DATA_STOCK_RANGE
:
297 case OBJECTTYPE_DATA_STOCK_LOSS
:
298 case OBJECTTYPE_DATA_STOCK_GAIN
:
299 pItemConverter
= new wrapper::GraphicPropertyItemConverter(
300 xObjectProperties
, rDrawModel
.GetItemPool(),
301 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
),
302 wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES
);
304 default: //OBJECTTYPE_UNKNOWN
310 //create itemconverter for a all objects of given type
313 case OBJECTTYPE_TITLE
:
314 pItemConverter
= new wrapper::AllTitleItemConverter( xChartModel
, rDrawModel
.GetItemPool(),
315 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
));
317 case OBJECTTYPE_AXIS
:
319 ::std::auto_ptr
< awt::Size
> pRefSize
;
320 if( pRefSizeProvider
.get() )
321 pRefSize
.reset( new awt::Size( pRefSizeProvider
->getPageSize()));
323 pItemConverter
= new wrapper::AllAxisItemConverter( xChartModel
, rDrawModel
.GetItemPool(),
324 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
), pRefSize
);
327 case OBJECTTYPE_GRID
:
328 case OBJECTTYPE_SUBGRID
:
329 pItemConverter
= new wrapper::AllGridItemConverter( xChartModel
, rDrawModel
.GetItemPool(),
330 rDrawModel
, uno::Reference
< lang::XMultiServiceFactory
>( xChartModel
, uno::UNO_QUERY
));
332 default: //for this type it is not supported to change all elements at once
337 return pItemConverter
;
340 rtl::OUString
lcl_getTitleCIDForCommand( const ::rtl::OString
& rDispatchCommand
, const uno::Reference
< frame::XModel
> & xChartModel
)
342 if( rDispatchCommand
.equals("AllTitles"))
343 return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_TITLE
, C2U("ALLELEMENTS") );
345 TitleHelper::eTitleType
nTitleType( TitleHelper::MAIN_TITLE
);
346 if( rDispatchCommand
.equals("SubTitle") )
347 nTitleType
= TitleHelper::SUB_TITLE
;
348 else if( rDispatchCommand
.equals("XTitle") )
349 nTitleType
= TitleHelper::X_AXIS_TITLE
;
350 else if( rDispatchCommand
.equals("YTitle") )
351 nTitleType
= TitleHelper::Y_AXIS_TITLE
;
352 else if( rDispatchCommand
.equals("ZTitle") )
353 nTitleType
= TitleHelper::Z_AXIS_TITLE
;
354 else if( rDispatchCommand
.equals("SecondaryXTitle") )
355 nTitleType
= TitleHelper::SECONDARY_X_AXIS_TITLE
;
356 else if( rDispatchCommand
.equals("SecondaryYTitle") )
357 nTitleType
= TitleHelper::SECONDARY_Y_AXIS_TITLE
;
359 uno::Reference
< XTitle
> xTitle( TitleHelper::getTitle( nTitleType
, xChartModel
) );
360 return ObjectIdentifier::createClassifiedIdentifierForObject( xTitle
, xChartModel
);
363 rtl::OUString
lcl_getAxisCIDForCommand( const ::rtl::OString
& rDispatchCommand
, const uno::Reference
< frame::XModel
>& xChartModel
)
365 if( rDispatchCommand
.equals("DiagramAxisAll"))
366 return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_AXIS
, C2U("ALLELEMENTS") );
368 sal_Int32 nDimensionIndex
=0;
370 if( rDispatchCommand
.equals("DiagramAxisX"))
372 nDimensionIndex
=0; bMainAxis
=true;
374 else if( rDispatchCommand
.equals("DiagramAxisY"))
376 nDimensionIndex
=1; bMainAxis
=true;
378 else if( rDispatchCommand
.equals("DiagramAxisZ"))
380 nDimensionIndex
=2; bMainAxis
=true;
382 else if( rDispatchCommand
.equals("DiagramAxisA"))
384 nDimensionIndex
=0; bMainAxis
=false;
386 else if( rDispatchCommand
.equals("DiagramAxisB"))
388 nDimensionIndex
=1; bMainAxis
=false;
391 uno::Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
392 uno::Reference
< XAxis
> xAxis( AxisHelper::getAxis( nDimensionIndex
, bMainAxis
, xDiagram
) );
393 return ObjectIdentifier::createClassifiedIdentifierForObject( xAxis
, xChartModel
);
396 rtl::OUString
lcl_getGridCIDForCommand( const ::rtl::OString
& rDispatchCommand
, const uno::Reference
< frame::XModel
>& xChartModel
)
398 uno::Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
400 if( rDispatchCommand
.equals("DiagramGridAll"))
401 return ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_GRID
, C2U("ALLELEMENTS") );
403 sal_Int32 nDimensionIndex
=0;
406 //x and y is swapped in the commands
408 if( rDispatchCommand
.equals("DiagramGridYMain"))
410 nDimensionIndex
=0; bMainGrid
=true;
412 else if( rDispatchCommand
.equals("DiagramGridXMain"))
414 nDimensionIndex
=1; bMainGrid
=true;
416 else if( rDispatchCommand
.equals("DiagramGridZMain"))
418 nDimensionIndex
=2; bMainGrid
=true;
420 else if( rDispatchCommand
.equals("DiagramGridYHelp"))
422 nDimensionIndex
=0; bMainGrid
=false;
424 else if( rDispatchCommand
.equals("DiagramGridXHelp"))
426 nDimensionIndex
=1; bMainGrid
=false;
428 else if( rDispatchCommand
.equals("DiagramGridZHelp"))
430 nDimensionIndex
=2; bMainGrid
=false;
433 bool bMainAxis
= true;
434 uno::Reference
< XAxis
> xAxis( AxisHelper::getAxis( nDimensionIndex
, bMainAxis
, xDiagram
) );
436 sal_Int32 nSubGridIndex
= bMainGrid
? (-1) : 0;
437 rtl::OUString
aCID( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis
, xChartModel
, nSubGridIndex
) );
440 rtl::OUString
lcl_getObjectCIDForCommand( const ::rtl::OString
& rDispatchCommand
, const uno::Reference
< XChartDocument
> & xChartDocument
)
442 ObjectType eObjectType
= OBJECTTYPE_UNKNOWN
;
443 rtl::OUString aParticleID
;
445 uno::Reference
< frame::XModel
> xChartModel( xChartDocument
, uno::UNO_QUERY
);
447 //-------------------------------------------------------------------------
449 if( rDispatchCommand
.equals("Legend"))
451 eObjectType
= OBJECTTYPE_LEGEND
;
452 //@todo set particular aParticleID if we have more than one legend
454 //-------------------------------------------------------------------------
456 else if( rDispatchCommand
.equals("DiagramWall"))
458 //OBJECTTYPE_DIAGRAM;
459 eObjectType
= OBJECTTYPE_DIAGRAM_WALL
;
460 //@todo set particular aParticleID if we have more than one diagram
462 else if( rDispatchCommand
.equals("DiagramFloor"))
464 eObjectType
= OBJECTTYPE_DIAGRAM_FLOOR
;
465 //@todo set particular aParticleID if we have more than one diagram
467 else if( rDispatchCommand
.equals("DiagramArea"))
469 eObjectType
= OBJECTTYPE_PAGE
;
471 //-------------------------------------------------------------------------
473 else if( rDispatchCommand
.equals("MainTitle")
474 || rDispatchCommand
.equals("SubTitle")
475 || rDispatchCommand
.equals("XTitle")
476 || rDispatchCommand
.equals("YTitle")
477 || rDispatchCommand
.equals("ZTitle")
478 || rDispatchCommand
.equals("SecondaryXTitle")
479 || rDispatchCommand
.equals("SecondaryYTitle")
480 || rDispatchCommand
.equals("AllTitles")
483 return lcl_getTitleCIDForCommand( rDispatchCommand
, xChartModel
);
485 //-------------------------------------------------------------------------
487 else if( rDispatchCommand
.equals("DiagramAxisX")
488 || rDispatchCommand
.equals("DiagramAxisY")
489 || rDispatchCommand
.equals("DiagramAxisZ")
490 || rDispatchCommand
.equals("DiagramAxisA")
491 || rDispatchCommand
.equals("DiagramAxisB")
492 || rDispatchCommand
.equals("DiagramAxisAll")
495 return lcl_getAxisCIDForCommand( rDispatchCommand
, xChartModel
);
497 //-------------------------------------------------------------------------
499 else if( rDispatchCommand
.equals("DiagramGridYMain")
500 || rDispatchCommand
.equals("DiagramGridXMain")
501 || rDispatchCommand
.equals("DiagramGridZMain")
502 || rDispatchCommand
.equals("DiagramGridYHelp")
503 || rDispatchCommand
.equals("DiagramGridXHelp")
504 || rDispatchCommand
.equals("DiagramGridZHelp")
505 || rDispatchCommand
.equals("DiagramGridAll")
508 return lcl_getGridCIDForCommand( rDispatchCommand
, xChartModel
);
510 return ObjectIdentifier::createClassifiedIdentifier(
511 eObjectType
, aParticleID
);
515 // anonymous namespace
517 void SAL_CALL
ChartController::executeDispatch_FormatObject(const ::rtl::OUString
& rDispatchCommand
)
519 uno::Reference
< XChartDocument
> xChartDocument( m_aModel
->getModel(), uno::UNO_QUERY
);
520 rtl::OString
aCommand( rtl::OUStringToOString( rDispatchCommand
, RTL_TEXTENCODING_ASCII_US
) );
521 rtl::OUString rObjectCID
= lcl_getObjectCIDForCommand( aCommand
, xChartDocument
);
522 executeDlg_ObjectProperties( rObjectCID
);
525 void SAL_CALL
ChartController::executeDispatch_ObjectProperties()
527 executeDlg_ObjectProperties( m_aSelection
.getSelectedCID() );
530 void SAL_CALL
ChartController::executeDlg_ObjectProperties( const ::rtl::OUString
& rObjectCID
)
532 if( !rObjectCID
.getLength() )
534 //DBG_ERROR("empty ObjectID");
539 ::rtl::OUString
aObjectCID(rObjectCID
);
540 NumberFormatterWrapper
aNumberFormatterWrapper( uno::Reference
< util::XNumberFormatsSupplier
>(m_aModel
->getModel(), uno::UNO_QUERY
) );
542 //-------------------------------------------------------------
543 //get type of selected object
544 ObjectType eObjectType
= ObjectIdentifier::getObjectType( aObjectCID
);
545 if( OBJECTTYPE_UNKNOWN
==eObjectType
)
547 //DBG_ERROR("unknown ObjectType");
551 // some legend entries are handled as if they were data series
552 if( OBJECTTYPE_LEGEND_ENTRY
==eObjectType
)
554 rtl::OUString
aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID
) );
555 eObjectType
= ObjectIdentifier::getObjectType( aParentParticle
);
556 aObjectCID
= ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle
);
559 // treat diagram as wall
560 if( OBJECTTYPE_DIAGRAM
==eObjectType
)
562 aObjectCID
= ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL
, rtl::OUString() );
563 eObjectType
= OBJECTTYPE_DIAGRAM_WALL
;
566 if( OBJECTTYPE_DIAGRAM_WALL
==eObjectType
|| OBJECTTYPE_DIAGRAM_FLOOR
==eObjectType
)
568 if( !DiagramHelper::isSupportingFloorAndWall( ChartModelHelper::findDiagram( m_aModel
->getModel() ) ) )
572 //-------------------------------------------------------------
573 UndoGuard
aUndoGuard(
574 ActionDescriptionProvider::createDescription(
575 ActionDescriptionProvider::FORMAT
,
576 ObjectNameProvider::getName( ObjectIdentifier::getObjectType( aObjectCID
))),
577 m_xUndoManager
, m_aModel
->getModel() );
579 //-------------------------------------------------------------
580 //convert properties to ItemSet
582 awt::Size
aPageSize( ChartModelHelper::getPageSize(m_aModel
->getModel()) );
584 ::std::auto_ptr
< ReferenceSizeProvider
> pRefSizeProv(
585 impl_createReferenceSizeProvider());
586 ::std::auto_ptr
< ::comphelper::ItemConverter
> apItemConverter(
587 createItemConverter( aObjectCID
, m_aModel
->getModel(), m_xCC
,
588 m_pDrawModelWrapper
->getSdrModel(),
589 &aNumberFormatterWrapper
,
590 ExplicitValueProvider::getExplicitValueProvider(m_xChartView
),
592 if(!apItemConverter
.get())
595 SfxItemSet aItemSet
= apItemConverter
->CreateEmptyItemSet();
596 apItemConverter
->FillItemSet( aItemSet
);
598 //-------------------------------------------------------------
600 ObjectPropertiesDialogParameter aDialogParameter
= ObjectPropertiesDialogParameter( aObjectCID
);
601 aDialogParameter
.init( m_aModel
->getModel() );
602 ViewElementListProvider
aViewElementListProvider( m_pDrawModelWrapper
.get() );
604 ::vos::OGuard
aGuard( Application::GetSolarMutex());
605 SchAttribTabDlg
aDlg( m_pChartWindow
, &aItemSet
, &aDialogParameter
, &aViewElementListProvider
606 , uno::Reference
< util::XNumberFormatsSupplier
>( m_aModel
->getModel(), uno::UNO_QUERY
) );
608 if(aDialogParameter
.HasSymbolProperties())
610 SfxItemSet
* pSymbolShapeProperties
=NULL
;
611 uno::Reference
< beans::XPropertySet
> xObjectProperties
=
612 ObjectIdentifier::getObjectPropertySet( aObjectCID
, m_aModel
->getModel() );
613 wrapper::DataPointItemConverter
aSymbolItemConverter( m_aModel
->getModel(), m_xCC
614 , xObjectProperties
, ObjectIdentifier::getDataSeriesForCID( aObjectCID
, m_aModel
->getModel() )
615 , m_pDrawModelWrapper
->getSdrModel().GetItemPool()
616 , m_pDrawModelWrapper
->getSdrModel()
617 , &aNumberFormatterWrapper
618 , uno::Reference
< lang::XMultiServiceFactory
>( m_aModel
->getModel(), uno::UNO_QUERY
)
619 , wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT
);
621 pSymbolShapeProperties
= new SfxItemSet( aSymbolItemConverter
.CreateEmptyItemSet() );
622 aSymbolItemConverter
.FillItemSet( *pSymbolShapeProperties
);
624 sal_Int32 nStandardSymbol
=0;//@todo get from somewhere
625 Graphic
* pAutoSymbolGraphic
= new Graphic( aViewElementListProvider
.GetSymbolGraphic( nStandardSymbol
, pSymbolShapeProperties
) );
626 // note: the dialog takes the ownership of pSymbolShapeProperties and pAutoSymbolGraphic
627 aDlg
.setSymbolInformation( pSymbolShapeProperties
, pAutoSymbolGraphic
);
629 if( aDialogParameter
.HasStatisticProperties() )
631 aDlg
.SetAxisMinorStepWidthForErrorBarDecimals(
632 InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( m_aModel
->getModel(), m_xChartView
, aObjectCID
) );
635 //-------------------------------------------------------------
637 if( aDlg
.Execute() == RET_OK
)
639 const SfxItemSet
* pOutItemSet
= aDlg
.GetOutputItemSet();
642 bool bChanged
= false;
644 ControllerLockGuard
aCLGuard( m_aModel
->getModel());
645 bChanged
= apItemConverter
->ApplyItemSet( *pOutItemSet
);//model should be changed now
649 aUndoGuard
.commitAction();
653 catch( util::CloseVetoException
& )
656 catch( uno::RuntimeException
& )
661 void SAL_CALL
ChartController::executeDispatch_View3D()
665 // using assignment for broken gcc 3.3
666 UndoLiveUpdateGuard aUndoGuard
= UndoLiveUpdateGuard(
667 ::rtl::OUString( String( SchResId( STR_ACTION_EDIT_3D_VIEW
))),
668 m_xUndoManager
, m_aModel
->getModel());
672 ::vos::OGuard
aSolarGuard( Application::GetSolarMutex());
673 View3DDialog
aDlg( m_pChartWindow
, m_aModel
->getModel(), m_pDrawModelWrapper
->GetColorTable() );
674 if( aDlg
.Execute() == RET_OK
)
675 aUndoGuard
.commitAction();
678 catch( uno::RuntimeException
& e
)
680 ASSERT_EXCEPTION( e
);
684 //.............................................................................
686 //.............................................................................