LibreOffice Module chart2 (master) 1
GraphicPropertyItemConverter.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21#include "SchWhichPairs.hxx"
22#include <ItemPropertyMap.hxx>
23#include <PropertyHelper.hxx>
24#include <CommonConverters.hxx>
25#include <editeng/memberids.h>
26#include <svx/unomid.hxx>
27#include <svx/xflbmtit.hxx>
28#include <svx/xflbstit.hxx>
29#include <svx/xbtmpit.hxx>
30#include <svx/xflftrit.hxx>
31#include <svx/xlndsit.hxx>
32#include <svx/xflhtit.hxx>
33#include <svx/xflgrit.hxx>
34#include <svx/xfltrit.hxx>
35#include <svx/xlntrit.hxx>
36#include <svx/xgrscit.hxx>
37#include <com/sun/star/beans/XPropertyState.hpp>
38#include <com/sun/star/beans/XPropertySet.hpp>
39#include <com/sun/star/drawing/BitmapMode.hpp>
40#include <com/sun/star/container/XNameAccess.hpp>
41#include <com/sun/star/lang/XMultiServiceFactory.hpp>
42#include <utility>
44
45using namespace ::com::sun::star;
46
47namespace chart::wrapper {
48
49namespace {
50
51ItemPropertyMapType & lcl_GetDataPointFilledPropertyMap()
52{
53 static ItemPropertyMapType aDataPointPropertyFilledMap{
54 {XATTR_FILLSTYLE, {"FillStyle", 0}},
55 {XATTR_FILLCOLOR, {"Color", 0}},
56 {XATTR_LINECOLOR, {"BorderColor", 0}},
57 {XATTR_LINESTYLE, {"BorderStyle", 0}},
58 {XATTR_LINEWIDTH, {"BorderWidth", 0}},
59 {XATTR_FILLBACKGROUND, {"FillBackground", 0}},
60 {XATTR_FILLBMP_POS, {"FillBitmapRectanglePoint", 0}},
61 {XATTR_FILLBMP_SIZEX, {"FillBitmapSizeX", 0}},
62 {XATTR_FILLBMP_SIZEY, {"FillBitmapSizeY", 0}},
63 {XATTR_FILLBMP_SIZELOG, {"FillBitmapLogicalSize", 0}},
64 {XATTR_FILLBMP_TILEOFFSETX, {"FillBitmapOffsetX", 0}},
65 {XATTR_FILLBMP_TILEOFFSETY, {"FillBitmapOffsetY", 0}},
66 {XATTR_FILLBMP_POSOFFSETX, {"FillBitmapPositionOffsetX", 0}},
67 {XATTR_FILLBMP_POSOFFSETY, {"FillBitmapPositionOffsetY", 0}}};
68 return aDataPointPropertyFilledMap;
69}
70ItemPropertyMapType & lcl_GetDataPointLinePropertyMap()
71{
72 static ItemPropertyMapType aDataPointPropertyLineMap{
73 {XATTR_LINECOLOR, {"Color", 0}},
74 {XATTR_LINESTYLE, {"LineStyle", 0}},
75 {XATTR_LINEWIDTH, {"LineWidth", 0}},
76 {XATTR_LINECAP, {"LineCap", 0}}};
77 return aDataPointPropertyLineMap;
78}
79ItemPropertyMapType & lcl_GetLinePropertyMap()
80{
81 static ItemPropertyMapType aLinePropertyMap{
82 {XATTR_LINESTYLE, {"LineStyle", 0}},
83 {XATTR_LINEWIDTH, {"LineWidth", 0}},
84 {XATTR_LINECOLOR, {"LineColor", 0}},
85 {XATTR_LINEJOINT, {"LineJoint", 0}},
86 {XATTR_LINECAP, {"LineCap", 0}}};
87 return aLinePropertyMap;
88}
89ItemPropertyMapType & lcl_GetFillPropertyMap()
90{
91 static ItemPropertyMapType aFillPropertyMap{
92 {XATTR_FILLSTYLE, {"FillStyle", 0}},
93 {XATTR_FILLCOLOR, {"FillColor", 0}},
94 {XATTR_FILLBACKGROUND, {"FillBackground", 0}},
95 {XATTR_FILLBMP_POS, {"FillBitmapRectanglePoint", 0}},
96 {XATTR_FILLBMP_SIZEX, {"FillBitmapSizeX", 0}},
97 {XATTR_FILLBMP_SIZEY, {"FillBitmapSizeY", 0}},
98 {XATTR_FILLBMP_SIZELOG, {"FillBitmapLogicalSize", 0}},
99 {XATTR_FILLBMP_TILEOFFSETX, {"FillBitmapOffsetX", 0}},
100 {XATTR_FILLBMP_TILEOFFSETY, {"FillBitmapOffsetY", 0}},
101 {XATTR_FILLBMP_POSOFFSETX, {"FillBitmapPositionOffsetX", 0}},
102 {XATTR_FILLBMP_POSOFFSETY, {"FillBitmapPositionOffsetY", 0}}};
103 return aFillPropertyMap;
104}
105
106bool lcl_supportsFillProperties( ::chart::wrapper::GraphicObjectType eType )
107{
108 return ( eType == ::chart::wrapper::GraphicObjectType::FilledDataPoint ||
109 eType == ::chart::wrapper::GraphicObjectType::LineAndFillProperties );
110}
111
112bool lcl_SetContentForNamedProperty(
113 const uno::Reference< lang::XMultiServiceFactory > & xFactory,
114 const OUString & rTableName,
115 NameOrIndex & rItem, sal_uInt8 nMemberId )
116{
117 bool bResult = false;
118 if( xFactory.is())
119 {
120 OUString aPropertyValue( rItem.GetName());
121 uno::Reference< container::XNameAccess > xNameAcc(
122 xFactory->createInstance( rTableName ),
123 uno::UNO_QUERY );
124 if( xNameAcc.is() &&
125 xNameAcc->hasByName( aPropertyValue ))
126 {
127 rItem.PutValue( xNameAcc->getByName( aPropertyValue ), nMemberId );
128 bResult = true;
129 }
130 }
131 return bResult;
132}
133
134} // anonymous namespace
135
137 const uno::Reference<
138 beans::XPropertySet > & rPropertySet,
139 SfxItemPool& rItemPool,
140 SdrModel& rDrawModel,
141 uno::Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory,
142 GraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) :
143 ItemConverter( rPropertySet, rItemPool ),
144 m_GraphicObjectType( eObjectType ),
145 m_rDrawModel( rDrawModel ),
146 m_xNamedPropertyTableFactory(std::move( xNamedPropertyContainerFactory ))
147{}
148
150{}
151
153{
154 switch( m_GraphicObjectType )
155 {
158 return nRowWhichPairs;
163 }
164
165 static const WhichRangesContainer empty;
166 return empty;
167}
168
170{
171 ItemPropertyMapType::const_iterator aEndIt;
172 ItemPropertyMapType::const_iterator aIt;
173
174 switch( m_GraphicObjectType )
175 {
177 aEndIt = lcl_GetDataPointLinePropertyMap().end();
178 aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId );
179 break;
181 aEndIt = lcl_GetDataPointFilledPropertyMap().end();
182 aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId );
183 break;
185 aEndIt = lcl_GetLinePropertyMap().end();
186 aIt = lcl_GetLinePropertyMap().find( nWhichId );
187 break;
188
190 // line
191 aEndIt = lcl_GetLinePropertyMap().end();
192 aIt = lcl_GetLinePropertyMap().find( nWhichId );
193
194 // not found => try fill
195 if( aIt == aEndIt )
196 {
197 aEndIt = lcl_GetFillPropertyMap().end();
198 aIt = lcl_GetFillPropertyMap().find( nWhichId );
199 }
200 break;
201 }
202
203 if( aIt == aEndIt )
204 return false;
205
206 rOutProperty =(*aIt).second;
207 return true;
208}
209
211 sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
212{
213 switch( nWhichId )
214 {
215 // bitmap property
218 {
219 drawing::BitmapMode aMode = drawing::BitmapMode_REPEAT;
220 if( GetPropertySet()->getPropertyValue( "FillBitmapMode" ) >>= aMode )
221 {
222 rOutItemSet.Put( XFillBmpTileItem( aMode == drawing::BitmapMode_REPEAT ));
223 rOutItemSet.Put( XFillBmpStretchItem( aMode == drawing::BitmapMode_STRETCH ));
224 }
225 }
226 break;
227
229 try
230 {
231 if( lcl_supportsFillProperties( m_GraphicObjectType ))
232 {
233 OUString aPropName =
235 ? OUString( "TransparencyGradientName" )
236 : OUString( "FillTransparenceGradientName" );
237
239 if( aValue.hasValue())
240 {
242 aItem.PutValue( aValue, MID_NAME );
243
244 lcl_SetContentForNamedProperty(
245 m_xNamedPropertyTableFactory, "com.sun.star.drawing.TransparencyGradientTable" ,
246 aItem, MID_FILLGRADIENT );
247
248 // this is important to enable the item
249 OUString aName;
250 if( (aValue >>= aName) &&
251 !aName.isEmpty())
252 {
253 aItem.SetEnabled( true );
254 rOutItemSet.Put( aItem );
255 }
256 }
257 }
258 }
259 catch( const beans::UnknownPropertyException & )
260 {
261 DBG_UNHANDLED_EXCEPTION("chart2");
262 }
263 break;
264
266 if( lcl_supportsFillProperties( m_GraphicObjectType ))
267 {
268 OUString aPropName =
270 ? OUString( "GradientStepCount" )
271 : OUString( "FillGradientStepCount" );
272
274 if( hasLongOrShortValue(aValue) )
275 {
276 sal_Int16 nStepCount = getShortForLongAlso(aValue);
277 rOutItemSet.Put( XGradientStepCountItem( nStepCount ));
278 }
279 }
280 break;
281
282 case XATTR_LINEDASH:
283 {
284 OUString aPropName =
286 ? OUString( "BorderDashName" )
287 : OUString( "LineDashName" );
288
289 XLineDashItem aItem;
291
292 lcl_SetContentForNamedProperty(
293 m_xNamedPropertyTableFactory, "com.sun.star.drawing.DashTable" ,
294 aItem, MID_LINEDASH );
295
296 // translate model name to UI-name for predefined entries, so
297 // that the correct entry is chosen in the list of UI-names
298 std::unique_ptr<XLineDashItem> pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
299
300 if(pItemToPut)
301 rOutItemSet.Put( std::move(pItemToPut) );
302 else
303 rOutItemSet.Put(aItem);
304 }
305 break;
306
308 if( lcl_supportsFillProperties( m_GraphicObjectType ))
309 {
310 OUString aPropName =
312 ? OUString( "GradientName" )
313 : OUString( "FillGradientName" );
314
315 XFillGradientItem aItem;
317
318 lcl_SetContentForNamedProperty(
319 m_xNamedPropertyTableFactory, "com.sun.star.drawing.GradientTable" ,
320 aItem, MID_FILLGRADIENT );
321
322 // translate model name to UI-name for predefined entries, so
323 // that the correct entry is chosen in the list of UI-names
324 std::unique_ptr<XFillGradientItem> pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
325
326 if(pItemToPut)
327 rOutItemSet.Put(std::move(pItemToPut) );
328 else
329 rOutItemSet.Put(aItem);
330 }
331 break;
332
333 case XATTR_FILLHATCH:
334 if( lcl_supportsFillProperties( m_GraphicObjectType ))
335 {
336 OUString aPropName =
338 ? OUString( "HatchName" )
339 : OUString( "FillHatchName" );
340
341 XFillHatchItem aItem;
343
344 lcl_SetContentForNamedProperty(
345 m_xNamedPropertyTableFactory, "com.sun.star.drawing.HatchTable" ,
346 aItem, MID_FILLHATCH );
347
348 // translate model name to UI-name for predefined entries, so
349 // that the correct entry is chosen in the list of UI-names
350 std::unique_ptr<XFillHatchItem> pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
351
352 if(pItemToPut)
353 rOutItemSet.Put( std::move(pItemToPut) );
354 else
355 rOutItemSet.Put(aItem);
356 }
357 break;
358
359 case XATTR_FILLBITMAP:
360 if( lcl_supportsFillProperties( m_GraphicObjectType ))
361 {
362 XFillBitmapItem aItem;
363 aItem.PutValue( GetPropertySet()->getPropertyValue( "FillBitmapName" ), MID_NAME );
364
365 lcl_SetContentForNamedProperty(
366 m_xNamedPropertyTableFactory, "com.sun.star.drawing.BitmapTable" ,
367 aItem, MID_BITMAP );
368
369 // translate model name to UI-name for predefined entries, so
370 // that the correct entry is chosen in the list of UI-names
371 std::unique_ptr<XFillBitmapItem> pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
372
373 if(pItemToPut)
374 rOutItemSet.Put( std::move(pItemToPut) );
375 else
376 rOutItemSet.Put(aItem);
377 }
378 break;
379
380 // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
381 // instead of sal_Int16
383 {
384 OUString aPropName =
386 ? OUString( "BorderTransparency" )
388 ? OUString( "Transparency" )
389 : OUString( "LineTransparence" );
390
392 aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), 0 );
393
394 rOutItemSet.Put( aItem );
395 }
396 break;
397
398 // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
399 // instead of sal_Int16
401 if( lcl_supportsFillProperties( m_GraphicObjectType ))
402 {
403 OUString aPropName =
405 ? OUString( "Transparency" )
406 : OUString( "FillTransparence" );
407
409 aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), 0 );
410
411 rOutItemSet.Put( aItem );
412 }
413 break;
414 }
415}
416
418 sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
419{
420 bool bChanged = false;
421 uno::Any aValue;
422
423 switch( nWhichId )
424 {
425 // bitmap property
427 if( lcl_supportsFillProperties( m_GraphicObjectType ))
428 {
429 static constexpr OUStringLiteral aModePropName(u"FillBitmapMode");
430 bool bStretched = rItemSet.Get( XATTR_FILLBMP_STRETCH ).GetValue();
431 drawing::BitmapMode aMode =
432 (bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
433 drawing::BitmapMode aOtherMode = drawing::BitmapMode_NO_REPEAT;
434
435 aValue <<= aMode;
436 GetPropertySet()->getPropertyValue( aModePropName ) >>= aOtherMode;
437
438 // don't overwrite if it has been set to BitmapMode_REPEAT (= tiled) already
439 // XATTR_FILLBMP_STRETCH and XATTR_FILLBMP_TILE often come in pairs, tdf#104658
440 if( aMode != aOtherMode && aOtherMode != drawing::BitmapMode_REPEAT )
441 {
442 GetPropertySet()->setPropertyValue( aModePropName, aValue );
443 bChanged = true;
444 }
445 }
446 break;
447
449 if( lcl_supportsFillProperties( m_GraphicObjectType ))
450 {
451 static constexpr OUStringLiteral aModePropName(u"FillBitmapMode");
452 bool bTiled = rItemSet.Get( XATTR_FILLBMP_TILE ).GetValue();
453 drawing::BitmapMode aMode =
454 (bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
455
456 aValue <<= aMode;
457 if( aValue != GetPropertySet()->getPropertyValue( aModePropName ))
458 {
459 GetPropertySet()->setPropertyValue( aModePropName, aValue );
460 bChanged = true;
461 }
462 }
463 break;
464
466 try
467 {
468 if( lcl_supportsFillProperties( m_GraphicObjectType ))
469 {
470 OUString aPropName =
472 ? OUString( "TransparencyGradientName" )
473 : OUString( "FillTransparenceGradientName" );
474
475 const XFillFloatTransparenceItem & rItem =
476 static_cast< const XFillFloatTransparenceItem & >(
477 rItemSet.Get( nWhichId ));
478
479 if( rItem.IsEnabled() &&
480 rItem.QueryValue( aValue, MID_NAME ))
481 {
482 uno::Any aGradient;
483 rItem.QueryValue( aGradient, MID_FILLGRADIENT );
484
485 // add TransparencyGradient to list if it does not already exist
486 OUString aPreferredName;
487 aValue >>= aPreferredName;
489 aGradient, m_xNamedPropertyTableFactory, aPreferredName );
490
491 if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
492 {
493 GetPropertySet()->setPropertyValue( aPropName, aValue );
494 bChanged = true;
495 }
496 }
497 else
498 {
499 OUString aName;
501 && !aName.isEmpty() )
502 {
504 if( xState.is())
505 xState->setPropertyToDefault( aPropName );
506 bChanged = true;
507 }
508 }
509 }
510 }
511 catch( const beans::UnknownPropertyException & )
512 {
513 DBG_UNHANDLED_EXCEPTION("chart2");
514 }
515 break;
516
518 {
519 if( lcl_supportsFillProperties( m_GraphicObjectType ))
520 {
521 OUString aPropName =
523 ? OUString( "GradientStepCount" )
524 : OUString( "FillGradientStepCount" );
525
526 sal_Int16 nStepCount = static_cast< const XGradientStepCountItem & >(
527 rItemSet.Get( nWhichId )).GetValue();
528
529 aValue <<= nStepCount;
530 if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
531 {
532 GetPropertySet()->setPropertyValue( aPropName, aValue );
533 bChanged = true;
534 }
535 }
536 }
537 break;
538
539 case XATTR_LINEDASH:
540 {
541 OUString aPropName =
543 ? OUString( "BorderDashName" )
544 : OUString( "LineDashName" );
545
546 const XLineDashItem & rItem =
547 static_cast< const XLineDashItem & >(
548 rItemSet.Get( nWhichId ));
549
550 if( rItem.QueryValue( aValue, MID_NAME ))
551 {
552 if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
553 {
554 // add LineDash to list
555 uno::Any aLineDash;
556 rItem.QueryValue( aLineDash, MID_LINEDASH );
557 OUString aPreferredName;
558 aValue >>= aPreferredName;
560 aLineDash, m_xNamedPropertyTableFactory, aPreferredName );
561
562 GetPropertySet()->setPropertyValue( aPropName, aValue );
563 bChanged = true;
564 }
565 }
566 }
567 break;
568
570 {
571 if( lcl_supportsFillProperties( m_GraphicObjectType ))
572 {
573 OUString aPropName =
575 ? OUString( "GradientName" )
576 : OUString( "FillGradientName" );
577
578 const XFillGradientItem & rItem =
579 static_cast< const XFillGradientItem & >(
580 rItemSet.Get( nWhichId ));
581
582 if( rItem.QueryValue( aValue, MID_NAME ))
583 {
584 if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
585 {
586 // add Gradient to list
587 uno::Any aGradient;
588 rItem.QueryValue( aGradient, MID_FILLGRADIENT );
589 OUString aPreferredName;
590 aValue >>= aPreferredName;
592 aGradient, m_xNamedPropertyTableFactory, aPreferredName );
593
594 GetPropertySet()->setPropertyValue( aPropName, aValue );
595 bChanged = true;
596 }
597 }
598 }
599 }
600 break;
601
602 case XATTR_FILLHATCH:
603 {
604 if( lcl_supportsFillProperties( m_GraphicObjectType ))
605 {
606 OUString aPropName =
608 ? OUString( "HatchName" )
609 : OUString( "FillHatchName" );
610
611 const XFillHatchItem & rItem =
612 static_cast< const XFillHatchItem & >(
613 rItemSet.Get( nWhichId ));
614
615 if( rItem.QueryValue( aValue, MID_NAME ))
616 {
617 if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
618 {
619 // add Hatch to list
620 uno::Any aHatch;
621 rItem.QueryValue( aHatch, MID_FILLHATCH );
622 OUString aPreferredName;
623 aValue >>= aPreferredName;
625 aHatch, m_xNamedPropertyTableFactory, aPreferredName );
626
627 GetPropertySet()->setPropertyValue( aPropName, aValue );
628 bChanged = true;
629 }
630 }
631 }
632 }
633 break;
634
635 case XATTR_FILLBITMAP:
636 {
637 if( lcl_supportsFillProperties( m_GraphicObjectType ))
638 {
639 const XFillBitmapItem & rItem =
640 static_cast< const XFillBitmapItem & >(
641 rItemSet.Get( nWhichId ));
642
643 if( rItem.QueryValue( aValue, MID_NAME ))
644 {
645 if( aValue != GetPropertySet()->getPropertyValue( "FillBitmapName" ))
646 {
647 // add Bitmap to list
648 uno::Any aBitmap;
649 rItem.QueryValue(aBitmap, MID_BITMAP);
650 OUString aPreferredName;
651 aValue >>= aPreferredName;
653 aBitmap, m_xNamedPropertyTableFactory, aPreferredName );
654
655 GetPropertySet()->setPropertyValue( "FillBitmapName" , aValue );
656 bChanged = true;
657 }
658 }
659 }
660 }
661 break;
662
663 // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
664 // instead of sal_Int16
666 {
667 OUString aPropName =
669 ? OUString( "BorderTransparency" )
671 ? OUString( "Transparency" )
672 : OUString( "LineTransparence" );
673
674 const XLineTransparenceItem & rItem =
675 static_cast< const XLineTransparenceItem & >(
676 rItemSet.Get( nWhichId ));
677
678 if( rItem.QueryValue( aValue ))
679 {
680 OSL_ENSURE( ! aValue.isExtractableTo(
682 "TransparenceItem QueryValue bug is fixed. Remove hack." );
683 sal_Int32 nValue = 0;
684 if( aValue >>= nValue )
685 {
686 OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
687 sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
688 aValue <<= nValueToSet;
689
690 GetPropertySet()->setPropertyValue( aPropName, aValue );
691 bChanged = true;
692 }
693 else
694 {
695 OSL_FAIL( "Wrong type in Transparency Any" );
696 }
697 }
698 }
699 break;
700
701 // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
702 // instead of sal_Int16
704 if( lcl_supportsFillProperties( m_GraphicObjectType ))
705 {
706 OUString aPropName =
708 ? OUString( "Transparency" )
709 : OUString( "FillTransparence" );
710
711 const XFillTransparenceItem & rItem =
712 static_cast< const XFillTransparenceItem & >(
713 rItemSet.Get( nWhichId ));
714
715 if( rItem.QueryValue( aValue ))
716 {
717 OSL_ENSURE( ! aValue.isExtractableTo(
719 "TransparenceItem QueryValue bug is fixed. Remove hack." );
720 sal_Int32 nValue = 0;
721 if( aValue >>= nValue )
722 {
723 OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
724 sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
725 aValue <<= nValueToSet;
726
727 GetPropertySet()->setPropertyValue( aPropName, aValue );
728 // if linear or no transparence is set, delete the gradient
729 OUString aTransGradPropName =
731 ? OUString( "TransparencyGradientName" )
732 : OUString( "FillTransparenceGradientName" );
733 GetPropertySet()->setPropertyValue(
734 aTransGradPropName, uno::Any( OUString() ));
735
736 bChanged = true;
737 }
738 else
739 {
740 OSL_FAIL( "Wrong type in Transparency Any" );
741 }
742 }
743 }
744 break;
745 }
746
747 return bChanged;
748}
749
750} // namespace chart
751
752/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const WhichRangesContainer nLineAndFillPropertyWhichPairs(svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST >)
const WhichRangesContainer nLinePropertyWhichPairs(svl::Items< XATTR_LINE_FIRST, XATTR_LINE_LAST >)
const WhichRangesContainer nRowWhichPairs(svl::Items< SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, SCHATTR_TEXT_DEGREES, SCHATTR_TEXT_DEGREES, SCHATTR_STYLE_START, SCHATTR_STYLE_END, SCHATTR_AXIS, SCHATTR_AXIS, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_BRUSH, SCHATTR_SYMBOL_SIZE, SCHATTR_SYMBOL_SIZE, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY, SCHATTR_BAR_OVERLAP, SCHATTR_BAR_CONNECT, SCHATTR_GROUP_BARS_PER_AXIS, SCHATTR_AXIS_FOR_ALL_SERIES, XATTR_LINE_FIRST, XATTR_LINE_LAST, XATTR_FILL_FIRST, XATTR_FILL_LAST, SDRATTR_3D_FIRST, SDRATTR_3D_LAST, EE_ITEMS_START, EE_ITEMS_END, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, SID_CHAR_DLG_PREVIEW_STRING, SID_CHAR_DLG_PREVIEW_STRING >)
OUString const & GetName() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XFillBitmapItem > checkForUniqueItem(SdrModel *pModel) const
void SetEnabled(bool bEnable)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
std::unique_ptr< XFillGradientItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XFillHatchItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
std::unique_ptr< XLineDashItem > checkForUniqueItem(SdrModel *pModel) const
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory
virtual void FillSpecialItem(sal_uInt16 nWhichId, SfxItemSet &rOutItemSet) const override
for items that can not be mapped directly to a property.
virtual bool ApplySpecialItem(sal_uInt16 nWhichId, const SfxItemSet &rItemSet) override
for items that can not be mapped directly to a property.
virtual const WhichRangesContainer & GetWhichPairs() const override
implement this method to provide an array of which-ranges
virtual bool GetItemProperty(tWhichIdType nWhichId, tPropertyNameWithMemberId &rOutProperty) const override
implement this method to return a Property object for a given which id.
GraphicPropertyItemConverter(const css::uno::Reference< css::beans::XPropertySet > &rPropertySet, SfxItemPool &rItemPool, SdrModel &rDrawModel, css::uno::Reference< css::lang::XMultiServiceFactory > xNamedPropertyContainerFactory, GraphicObjectType eObjectType)
This class serves for conversion between properties of an XPropertySet and SfxItems in SfxItemSets.
std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId
const css::uno::Reference< css::beans::XPropertySet > & GetPropertySet() const
Returns the XPropertySet that was given in the CTOR and is used to apply items in ApplyItemSet().
#define DBG_UNHANDLED_EXCEPTION(...)
float u
Reference< XSingleServiceFactory > xFactory
sal_Int16 nValue
OUString aName
#define MID_NAME
OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a gradient with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a line dash with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a bitmap with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addTransparencyGradientUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a transparency gradient with a unique name to the gradient obtained by the given factory.
OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable(const css::uno::Any &rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > &xFact, const OUString &rPreferredName)
adds a hatch with a unique name to the gradient obtained by the given factory.
std::map< ItemConverter::tWhichIdType, std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > ItemPropertyMapType
OOO_DLLPUBLIC_CHARTTOOLS bool hasLongOrShortValue(const css::uno::Any &rAny)
OOO_DLLPUBLIC_CHARTTOOLS sal_Int16 getShortForLongAlso(const css::uno::Any &rAny)
OUString aPropName
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
const char GetValue[]
bool hasValue()
unsigned char sal_uInt8
#define SAL_MAX_INT16
#define MID_FILLHATCH
#define MID_FILLGRADIENT
#define MID_LINEDASH
#define MID_BITMAP
constexpr TypedWhichId< XFillBmpPosOffsetYItem > XATTR_FILLBMP_POSOFFSETY(XATTR_FILL_FIRST+18)
constexpr TypedWhichId< XGradientStepCountItem > XATTR_GRADIENTSTEPCOUNT(XATTR_FILL_FIRST+6)
constexpr TypedWhichId< XFillBmpPosItem > XATTR_FILLBMP_POS(XATTR_FILL_FIRST+8)
constexpr TypedWhichId< XLineJointItem > XATTR_LINEJOINT(XATTR_LINE_FIRST+11)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillBmpTileOffsetXItem > XATTR_FILLBMP_TILEOFFSETX(XATTR_FILL_FIRST+14)
constexpr TypedWhichId< XFillTransparenceItem > XATTR_FILLTRANSPARENCE(XATTR_FILL_FIRST+5)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< SfxMetricItem > XATTR_FILLBMP_SIZEX(XATTR_FILL_FIRST+9)
constexpr TypedWhichId< XLineCapItem > XATTR_LINECAP(XATTR_LINE_FIRST+12)
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XFillBmpPosOffsetXItem > XATTR_FILLBMP_POSOFFSETX(XATTR_FILL_FIRST+17)
constexpr TypedWhichId< XFillBmpTileOffsetYItem > XATTR_FILLBMP_TILEOFFSETY(XATTR_FILL_FIRST+15)
constexpr TypedWhichId< XFillBmpSizeYItem > XATTR_FILLBMP_SIZEY(XATTR_FILL_FIRST+10)
constexpr TypedWhichId< XFillBmpStretchItem > XATTR_FILLBMP_STRETCH(XATTR_FILL_FIRST+16)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XFillBmpSizeLogItem > XATTR_FILLBMP_SIZELOG(XATTR_FILL_FIRST+13)
constexpr TypedWhichId< XFillBmpTileItem > XATTR_FILLBMP_TILE(XATTR_FILL_FIRST+7)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XFillBackgroundItem > XATTR_FILLBACKGROUND(XATTR_FILL_FIRST+19)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)