1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chartcontroller.hxx"
26
27 #include "WrappedSymbolProperties.hxx"
28 #include "WrappedSeriesOrDiagramProperty.hxx"
29 #include "macros.hxx"
30 #include "FastPropertyIdRanges.hxx"
31 #include "ChartTypeHelper.hxx"
32 #include <com/sun/star/chart2/Symbol.hpp>
33 #include <com/sun/star/chart2/SymbolStyle.hpp>
34 #include <com/sun/star/awt/Size.hpp>
35 #include <com/sun/star/beans/PropertyAttribute.hpp>
36 #include <com/sun/star/chart/ChartSymbolType.hpp>
37 #include <com/sun/star/drawing/LineStyle.hpp>
38
39 #include <com/sun/star/graphic/XGraphicProvider.hpp>
40
41 // for UNO_NAME_GRAPHOBJ_URLPREFIX
42 #include <editeng/unoprnms.hxx>
43
44 // for Graphic
45 #include <vcl/graph.hxx>
46 // for GraphicObject
47 #include <svtools/grfmgr.hxx>
48 #include <vcl/outdev.hxx>
49
50 #include <comphelper/processfactory.hxx>
51
52 using namespace ::com::sun::star;
53 using ::com::sun::star::uno::Any;
54 using ::com::sun::star::uno::Reference;
55 using ::com::sun::star::uno::Sequence;
56 using ::com::sun::star::beans::Property;
57 using ::rtl::OUString;
58
59 //.............................................................................
60 namespace chart
61 {
62 namespace wrapper
63 {
64
65
66 //-----------------------------------------------------------------------------
67 //-----------------------------------------------------------------------------
68 //-----------------------------------------------------------------------------
69
70 class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 >
71 {
72 public:
73 virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
74 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const;
75
76 virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const;
77 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const;
78
79 explicit WrappedSymbolTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
80 tSeriesOrDiagramPropertyType ePropertyType );
81 virtual ~WrappedSymbolTypeProperty();
82 };
83
84 class WrappedSymbolBitmapURLProperty : public WrappedSeriesOrDiagramProperty< OUString >
85 {
86 public:
87 virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
88 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewGraphicURL ) const;
89
90 explicit WrappedSymbolBitmapURLProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
91 tSeriesOrDiagramPropertyType ePropertyType );
92 virtual ~WrappedSymbolBitmapURLProperty();
93 };
94
95 class WrappedSymbolSizeProperty : public WrappedSeriesOrDiagramProperty< awt::Size >
96 {
97 public:
98 virtual awt::Size getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
99 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, awt::Size aNewSize ) const;
100 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const;
101
102 explicit WrappedSymbolSizeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
103 tSeriesOrDiagramPropertyType ePropertyType );
104 virtual ~WrappedSymbolSizeProperty();
105 };
106
107 class WrappedSymbolAndLinesProperty : public WrappedSeriesOrDiagramProperty< sal_Bool >
108 {
109 public:
110 virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
111 virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool bDrawLines ) const;
112 virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const;
113
114 explicit WrappedSymbolAndLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
115 tSeriesOrDiagramPropertyType ePropertyType );
116 virtual ~WrappedSymbolAndLinesProperty();
117 };
118
119 namespace
120 {
121 enum
122 {
123 //symbol properties
124 PROP_CHART_SYMBOL_TYPE = FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP,
125 PROP_CHART_SYMBOL_BITMAP_URL,
126 PROP_CHART_SYMBOL_SIZE,
127 PROP_CHART_SYMBOL_AND_LINES
128 };
129
lcl_getSymbolType(const::com::sun::star::chart2::Symbol & rSymbol)130 sal_Int32 lcl_getSymbolType( const ::com::sun::star::chart2::Symbol& rSymbol )
131 {
132 sal_Int32 nSymbol = ::com::sun::star::chart::ChartSymbolType::NONE;
133 switch( rSymbol.Style )
134 {
135 case chart2::SymbolStyle_NONE:
136 break;
137 case chart2::SymbolStyle_AUTO:
138 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
139 break;
140 case chart2::SymbolStyle_STANDARD:
141 nSymbol = rSymbol.StandardSymbol%15;
142 break;
143 case chart2::SymbolStyle_POLYGON://new feature
144 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
145 break;
146 case chart2::SymbolStyle_GRAPHIC:
147 nSymbol = ::com::sun::star::chart::ChartSymbolType::BITMAPURL;
148 break;
149 default:
150 nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
151 break;
152 }
153 return nSymbol;
154 }
lcl_setSymbolTypeToSymbol(sal_Int32 nSymbolType,chart2::Symbol & rSymbol)155 void lcl_setSymbolTypeToSymbol( sal_Int32 nSymbolType, chart2::Symbol& rSymbol )
156 {
157 switch( nSymbolType )
158 {
159 case ::com::sun::star::chart::ChartSymbolType::NONE:
160 rSymbol.Style = chart2::SymbolStyle_NONE;
161 break;
162 case ::com::sun::star::chart::ChartSymbolType::AUTO:
163 rSymbol.Style = chart2::SymbolStyle_AUTO;
164 break;
165 case ::com::sun::star::chart::ChartSymbolType::BITMAPURL:
166 rSymbol.Style = chart2::SymbolStyle_GRAPHIC;
167 break;
168 default:
169 rSymbol.Style = chart2::SymbolStyle_STANDARD;
170 rSymbol.StandardSymbol = nSymbolType;
171 break;
172 }
173 }
174
lcl_addWrappedProperties(std::vector<WrappedProperty * > & rList,::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact,tSeriesOrDiagramPropertyType ePropertyType)175 void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
176 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
177 , tSeriesOrDiagramPropertyType ePropertyType )
178 {
179 rList.push_back( new WrappedSymbolTypeProperty( spChart2ModelContact, ePropertyType ) );
180 rList.push_back( new WrappedSymbolBitmapURLProperty( spChart2ModelContact, ePropertyType ) );
181 rList.push_back( new WrappedSymbolSizeProperty( spChart2ModelContact, ePropertyType ) );
182 rList.push_back( new WrappedSymbolAndLinesProperty( spChart2ModelContact, ePropertyType ) );
183 }
184
185 }//anonymous namespace
186
187 //-----------------------------------------------------------------------------
188 //-----------------------------------------------------------------------------
189 //-----------------------------------------------------------------------------
addProperties(::std::vector<Property> & rOutProperties)190 void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutProperties )
191 {
192 rOutProperties.push_back(
193 Property( C2U( "SymbolType" ),
194 PROP_CHART_SYMBOL_TYPE,
195 ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
196 beans::PropertyAttribute::BOUND
197 | beans::PropertyAttribute::MAYBEDEFAULT ));
198
199 rOutProperties.push_back(
200 Property( C2U( "SymbolBitmapURL" ),
201 PROP_CHART_SYMBOL_BITMAP_URL,
202 ::getCppuType( reinterpret_cast< ::rtl::OUString * >(0)),
203 beans::PropertyAttribute::BOUND
204 | beans::PropertyAttribute::MAYBEDEFAULT ));
205
206 rOutProperties.push_back(
207 Property( C2U( "SymbolSize" ),
208 PROP_CHART_SYMBOL_SIZE,
209 ::getCppuType( reinterpret_cast< awt::Size * >(0)),
210 beans::PropertyAttribute::BOUND
211 | beans::PropertyAttribute::MAYBEDEFAULT ));
212
213 rOutProperties.push_back(
214 Property( C2U( "Lines" ),
215 PROP_CHART_SYMBOL_AND_LINES,
216 ::getBooleanCppuType(),
217 beans::PropertyAttribute::BOUND
218 | beans::PropertyAttribute::MAYBEDEFAULT ));
219 }
220
221 //-----------------------------------------------------------------------------
222 //-----------------------------------------------------------------------------
223
addWrappedPropertiesForSeries(std::vector<WrappedProperty * > & rList,::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)224 void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
225 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
226 {
227 lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
228 }
229
230 //-----------------------------------------------------------------------------
231 //-----------------------------------------------------------------------------
232
addWrappedPropertiesForDiagram(std::vector<WrappedProperty * > & rList,::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact)233 void WrappedSymbolProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
234 , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
235 {
236 lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
237 }
238
239 //-----------------------------------------------------------------------------
240 //-----------------------------------------------------------------------------
241 //-----------------------------------------------------------------------------
242
WrappedSymbolTypeProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact,tSeriesOrDiagramPropertyType ePropertyType)243 WrappedSymbolTypeProperty::WrappedSymbolTypeProperty(
244 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
245 tSeriesOrDiagramPropertyType ePropertyType )
246 : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("SymbolType")
247 , uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE )
248 , spChart2ModelContact
249 , ePropertyType )
250 {
251 }
~WrappedSymbolTypeProperty()252 WrappedSymbolTypeProperty::~WrappedSymbolTypeProperty()
253 {
254 }
255
getValueFromSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet) const256 sal_Int32 WrappedSymbolTypeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
257 {
258 sal_Int32 aRet = 0;
259 m_aDefaultValue >>= aRet;
260 chart2::Symbol aSymbol;
261 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) )
262 aRet = lcl_getSymbolType( aSymbol );
263 return aRet;
264 }
265
setValueToSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet,sal_Int32 nSymbolType) const266 void WrappedSymbolTypeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nSymbolType ) const
267 {
268 if(!xSeriesPropertySet.is())
269 return;
270
271 chart2::Symbol aSymbol;
272 xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol;
273
274 lcl_setSymbolTypeToSymbol( nSymbolType, aSymbol );
275 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
276 }
277
getPropertyValue(const Reference<beans::XPropertySet> & xInnerPropertySet) const278 Any WrappedSymbolTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
279 {
280 //the old chart (< OOo 2.3) needs symbol-type="automatic" at the plot-area if any of the series should be able to have symbols
281 if( m_ePropertyType == DIAGRAM )
282 {
283 bool bHasAmbiguousValue = false;
284 sal_Int32 aValue = 0;
285 if( detectInnerValue( aValue, bHasAmbiguousValue ) )
286 {
287 if(bHasAmbiguousValue)
288 {
289 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
290 }
291 else
292 {
293 if( ::com::sun::star::chart::ChartSymbolType::NONE == aValue )
294 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE );
295 else
296 m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
297 }
298 }
299 return m_aOuterValue;
300 }
301 else
302 {
303 ::com::sun::star::uno::Any aRet( m_aDefaultValue );
304 aRet <<= getValueFromSeries( xInnerPropertySet );
305 return aRet;
306 }
307 }
308
getPropertyState(const Reference<beans::XPropertyState> & xInnerPropertyState) const309 beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
310 {
311 //the special situation for this property here is that the diagram default can be
312 //different from the normal default and different from all sinlges series values
313 //so we need to return PropertyState_DIRECT_VALUE for more cases
314
315 if( m_ePropertyType == DATA_SERIES && //single series or point
316 m_spChart2ModelContact.get())
317 {
318 Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
319 Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY );
320 Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
321 if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) )
322 return beans::PropertyState_DIRECT_VALUE;
323 }
324 return WrappedProperty::getPropertyState( xInnerPropertyState );
325 }
326
327 //-----------------------------------------------------------------------------
328 //-----------------------------------------------------------------------------
329 //-----------------------------------------------------------------------------
330
WrappedSymbolBitmapURLProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact,tSeriesOrDiagramPropertyType ePropertyType)331 WrappedSymbolBitmapURLProperty::WrappedSymbolBitmapURLProperty(
332 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
333 tSeriesOrDiagramPropertyType ePropertyType )
334 : WrappedSeriesOrDiagramProperty< OUString >( C2U("SymbolBitmapURL")
335 , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
336 {
337 }
338
~WrappedSymbolBitmapURLProperty()339 WrappedSymbolBitmapURLProperty::~WrappedSymbolBitmapURLProperty()
340 {
341 }
342
getValueFromSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet) const343 OUString WrappedSymbolBitmapURLProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
344 {
345 OUString aRet;
346 m_aDefaultValue >>= aRet;
347 chart2::Symbol aSymbol;
348 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
349 && aSymbol.Graphic.is())
350 {
351 GraphicObject aGrObj( Graphic( aSymbol.Graphic ));
352 aRet = OUString( RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
353 aRet += OUString::createFromAscii( aGrObj.GetUniqueID().GetBuffer());
354 }
355 return aRet;
356 }
357
setValueToSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet,OUString aNewGraphicURL) const358 void WrappedSymbolBitmapURLProperty::setValueToSeries(
359 const Reference< beans::XPropertySet >& xSeriesPropertySet,
360 OUString aNewGraphicURL ) const
361 {
362 if(!xSeriesPropertySet.is())
363 return;
364
365 chart2::Symbol aSymbol;
366 if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
367 {
368 bool bMatchesPrefix =
369 aNewGraphicURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
370 if( bMatchesPrefix )
371 {
372 GraphicObject aGrObj = GraphicObject(
373 ByteString( U2C( aNewGraphicURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ))));
374 aSymbol.Graphic.set( aGrObj.GetGraphic().GetXGraphic());
375 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
376 }
377 else
378 {
379 try
380 {
381 // @todo: get factory from some context?
382 Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
383 Reference< graphic::XGraphicProvider > xGraphProv(
384 xFact->createInstance( C2U("com.sun.star.graphic.GraphicProvider")), uno::UNO_QUERY_THROW );
385 Sequence< beans::PropertyValue > aArgs(1);
386 aArgs[0] = beans::PropertyValue(
387 C2U("URL"), -1, uno::makeAny( aNewGraphicURL ),
388 beans::PropertyState_DIRECT_VALUE );
389 aSymbol.Graphic.set( xGraphProv->queryGraphic( aArgs ));
390 OSL_ENSURE( aSymbol.Graphic.is(), "Invalid URL for Symbol Bitmap" );
391 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
392 }
393 catch( const uno::Exception & ex )
394 {
395 ASSERT_EXCEPTION( ex );
396 }
397 }
398 }
399 }
400
401
402 //-----------------------------------------------------------------------------
403 //-----------------------------------------------------------------------------
404 //-----------------------------------------------------------------------------
405
406 namespace
407 {
408
lcl_correctSymbolSizeForBitmaps(chart2::Symbol & rSymbol)409 void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol )
410 {
411 if( rSymbol.Style != chart2::SymbolStyle_GRAPHIC )
412 return;
413 if( rSymbol.Size.Width != -1 )
414 return;
415 if( rSymbol.Size.Height != -1 )
416 return;
417
418 //find a good automatic size
419 try
420 {
421 const awt::Size aDefaultSize(250,250);
422 awt::Size aSize = aDefaultSize;
423 uno::Reference< beans::XPropertySet > xProp( rSymbol.Graphic, uno::UNO_QUERY );
424 if( xProp.is() )
425 {
426 bool bFoundSize = false;
427 try
428 {
429 if( (xProp->getPropertyValue( C2U( "Size100thMM" ) ) >>= aSize) )
430 {
431 if( aSize.Width == 0 && aSize.Height == 0 )
432 aSize = aDefaultSize;
433 else
434 bFoundSize = true;
435 }
436 }
437 catch( uno::Exception& e )
438 {
439 ASSERT_EXCEPTION( e );
440 }
441
442 if(!bFoundSize)
443 {
444 awt::Size aAWTPixelSize(10,10);
445 if( (xProp->getPropertyValue( C2U( "SizePixel" ) ) >>= aAWTPixelSize) )
446 {
447 Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height);
448 Size aNewSize = ( OutputDevice::LogicToLogic( aPixelSize, MAP_PIXEL, MAP_100TH_MM ));
449 aSize = awt::Size( aNewSize.Width(), aNewSize.Height() );
450
451 if( aSize.Width == 0 && aSize.Height == 0 )
452 aSize = aDefaultSize;
453 }
454 }
455 }
456 rSymbol.Size = aSize;
457 }
458 catch( uno::Exception& e )
459 {
460 ASSERT_EXCEPTION( e );
461 }
462 }
463
464 }//end anonymous namespace
465
WrappedSymbolSizeProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact,tSeriesOrDiagramPropertyType ePropertyType)466 WrappedSymbolSizeProperty::WrappedSymbolSizeProperty(
467 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
468 tSeriesOrDiagramPropertyType ePropertyType )
469 : WrappedSeriesOrDiagramProperty< awt::Size >( C2U("SymbolSize")
470 , uno::makeAny( awt::Size(250,250) ), spChart2ModelContact, ePropertyType )
471 {
472 }
473
~WrappedSymbolSizeProperty()474 WrappedSymbolSizeProperty::~WrappedSymbolSizeProperty()
475 {
476 }
477
getValueFromSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet) const478 awt::Size WrappedSymbolSizeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
479 {
480 awt::Size aRet;
481 m_aDefaultValue >>= aRet;
482 chart2::Symbol aSymbol;
483 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
484 aRet = aSymbol.Size;
485 return aRet;
486 }
487
setValueToSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet,awt::Size aNewSize) const488 void WrappedSymbolSizeProperty::setValueToSeries(
489 const Reference< beans::XPropertySet >& xSeriesPropertySet,
490 awt::Size aNewSize ) const
491 {
492 if(!xSeriesPropertySet.is())
493 return;
494
495 chart2::Symbol aSymbol;
496 if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
497 {
498 aSymbol.Size = aNewSize;
499 lcl_correctSymbolSizeForBitmaps(aSymbol);
500 xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
501 }
502 }
503
getPropertyState(const Reference<beans::XPropertyState> & xInnerPropertyState) const504 beans::PropertyState WrappedSymbolSizeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
505 {
506 //only export symbol size if necessary
507 if( m_ePropertyType == DIAGRAM )
508 return beans::PropertyState_DEFAULT_VALUE;
509
510 try
511 {
512 chart2::Symbol aSymbol;
513 Reference< beans::XPropertySet > xSeriesPropertySet( xInnerPropertyState, uno::UNO_QUERY );
514 if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
515 {
516 if( chart2::SymbolStyle_NONE != aSymbol.Style )
517 return beans::PropertyState_DIRECT_VALUE;
518 }
519 }
520 catch( const uno::Exception & ex )
521 {
522 ASSERT_EXCEPTION( ex );
523 }
524 return beans::PropertyState_DEFAULT_VALUE;
525 }
526
527 //-----------------------------------------------------------------------------
528 //-----------------------------------------------------------------------------
529 //-----------------------------------------------------------------------------
530
WrappedSymbolAndLinesProperty(::boost::shared_ptr<Chart2ModelContact> spChart2ModelContact,tSeriesOrDiagramPropertyType ePropertyType)531 WrappedSymbolAndLinesProperty::WrappedSymbolAndLinesProperty(
532 ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
533 tSeriesOrDiagramPropertyType ePropertyType )
534 : WrappedSeriesOrDiagramProperty< sal_Bool >( C2U("Lines")
535 , uno::makeAny( sal_True ), spChart2ModelContact, ePropertyType )
536 {
537 }
538
~WrappedSymbolAndLinesProperty()539 WrappedSymbolAndLinesProperty::~WrappedSymbolAndLinesProperty()
540 {
541 }
542
getValueFromSeries(const Reference<beans::XPropertySet> &) const543 sal_Bool WrappedSymbolAndLinesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& /*xSeriesPropertySet*/ ) const
544 {
545 //do not export this property anymore, instead use a linestyle none for no lines
546 return sal_True;
547 }
548
setValueToSeries(const Reference<beans::XPropertySet> & xSeriesPropertySet,sal_Bool bDrawLines) const549 void WrappedSymbolAndLinesProperty::setValueToSeries(
550 const Reference< beans::XPropertySet >& xSeriesPropertySet,
551 sal_Bool bDrawLines ) const
552 {
553 if(!xSeriesPropertySet.is())
554 return;
555
556 drawing::LineStyle eOldLineStyle( drawing::LineStyle_SOLID );
557 xSeriesPropertySet->getPropertyValue( C2U("LineStyle") ) >>= eOldLineStyle;
558 if( bDrawLines )
559 {
560 //#i114298# don't overwrite dashed lines with solid lines here
561 if( eOldLineStyle == drawing::LineStyle_NONE )
562 xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ) );
563 }
564 else
565 {
566 if( eOldLineStyle != drawing::LineStyle_NONE )
567 xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_NONE ) );
568 }
569 }
570
getPropertyState(const Reference<beans::XPropertyState> &) const571 beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
572 {
573 //do not export this property anymore, instead use a linestyle none for no lines
574 return beans::PropertyState_DEFAULT_VALUE;
575 }
576
577 //-----------------------------------------------------------------------------
578 //-----------------------------------------------------------------------------
579 //-----------------------------------------------------------------------------
580
581 } //namespace wrapper
582 } //namespace chart
583 //.............................................................................
584