1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3cde9e8dcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5cde9e8dcSAndrew Rist * distributed with this work for additional information
6cde9e8dcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7cde9e8dcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11cde9e8dcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13cde9e8dcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist * KIND, either express or implied. See the License for the
17cde9e8dcSAndrew Rist * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20cde9e8dcSAndrew Rist *************************************************************/
21cde9e8dcSAndrew Rist
22cde9e8dcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx"
27cdf0e10cSrcweir #include "SchWhichPairs.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "ItemPropertyMap.hxx"
30cdf0e10cSrcweir #include "PropertyHelper.hxx"
31cdf0e10cSrcweir #include "CommonConverters.hxx"
32cdf0e10cSrcweir #include <editeng/memberids.hrc>
33cdf0e10cSrcweir #include <svx/xflclit.hxx>
34cdf0e10cSrcweir #include <svx/xlnclit.hxx>
35cdf0e10cSrcweir #include <svx/xflbmtit.hxx>
36cdf0e10cSrcweir #include <svx/xflbstit.hxx>
37cdf0e10cSrcweir #include <svx/xbtmpit.hxx>
38cdf0e10cSrcweir #include <svx/xflftrit.hxx>
39cdf0e10cSrcweir #include <svx/xlndsit.hxx>
40cdf0e10cSrcweir #include <svx/xflhtit.hxx>
41cdf0e10cSrcweir #include <svx/xflgrit.hxx>
42cdf0e10cSrcweir #include <svx/xfltrit.hxx>
43cdf0e10cSrcweir #include <svx/xlntrit.hxx>
44cdf0e10cSrcweir #include <editeng/eeitem.hxx>
45cdf0e10cSrcweir // for SfxBoolItem
46cdf0e10cSrcweir #include <svl/eitem.hxx>
47cdf0e10cSrcweir // for XFillGradientStepCountItem
48cdf0e10cSrcweir #include <svx/xgrscit.hxx>
49cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
50cdf0e10cSrcweir #include <com/sun/star/chart2/FillBitmap.hpp>
51cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp>
52cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
53cdf0e10cSrcweir
54cdf0e10cSrcweir using namespace ::com::sun::star;
55cdf0e10cSrcweir
56cdf0e10cSrcweir namespace
57cdf0e10cSrcweir {
lcl_GetDataPointFilledPropertyMap()58cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetDataPointFilledPropertyMap()
59cdf0e10cSrcweir {
60cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aDataPointPropertyFilledMap(
61cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap
62cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 )
63cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLCOLOR, "Color", 0 )
64cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "Transparency", 0 )
65cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "Gradient", 0 )
66cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLHATCH, "Hatch", 0 )
67cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "BorderColor", 0 )
68cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "BorderStyle", 0 )
69cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "BorderWidth", 0 )
70cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "BorderDash", 0 )
71cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "BorderTransparency", 0 )
72cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 )
73cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 )
74cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 )
75cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 )
76cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 )
77cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 )
78cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 )
79cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 )
80cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 )
81cdf0e10cSrcweir );
82cdf0e10cSrcweir
83cdf0e10cSrcweir return aDataPointPropertyFilledMap;
84cdf0e10cSrcweir }
lcl_GetDataPointLinePropertyMap()85cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetDataPointLinePropertyMap()
86cdf0e10cSrcweir {
87cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aDataPointPropertyLineMap(
88cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap
89cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "Color", 0 )
90cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "Transparency", 0 )
91cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 )
92cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 )
93cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 )
94cdf0e10cSrcweir );
95cdf0e10cSrcweir
96cdf0e10cSrcweir return aDataPointPropertyLineMap;
97cdf0e10cSrcweir }
lcl_GetLinePropertyMap()98cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetLinePropertyMap()
99cdf0e10cSrcweir {
100cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aLinePropertyMap(
101cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap
102cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINESTYLE, "LineStyle", 0 )
103cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEWIDTH, "LineWidth", 0 )
104cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINEDASH, "LineDash", 0 )
105cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINECOLOR, "LineColor", 0 )
106cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_LINETRANSPARENCE, "LineTransparence", 0 )
107cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_LINEJOINT, "LineJoint", 0 )
108cdf0e10cSrcweir );
109cdf0e10cSrcweir
110cdf0e10cSrcweir return aLinePropertyMap;
111cdf0e10cSrcweir }
lcl_GetFillPropertyMap()112cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetFillPropertyMap()
113cdf0e10cSrcweir {
114cdf0e10cSrcweir static ::comphelper::ItemPropertyMapType aFillPropertyMap(
115cdf0e10cSrcweir ::comphelper::MakeItemPropertyMap
116cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLSTYLE, "FillStyle", 0 )
117cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLCOLOR, "FillColor", 0 )
118cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLTRANSPARENCE, "FillTransparence", 0 )
119cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLBITMAP, "FillBitmapName", MID_NAME )
120cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLGRADIENT, "FillGradient", 0 )
121cdf0e10cSrcweir // IPM_MAP_ENTRY( XATTR_FILLHATCH, "FillHatch", 0 )
122cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBACKGROUND, "FillBackground", 0 )
123cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POS, "FillBitmapRectanglePoint", 0 )
124cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEX, "FillBitmapSizeX", 0 )
125cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZEY, "FillBitmapSizeY", 0 )
126cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_SIZELOG, "FillBitmapLogicalSize", 0 )
127cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETX, "FillBitmapOffsetX", 0 )
128cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_TILEOFFSETY, "FillBitmapOffsetY", 0 )
129cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETX, "FillBitmapPositionOffsetX", 0 )
130cdf0e10cSrcweir IPM_MAP_ENTRY( XATTR_FILLBMP_POSOFFSETY, "FillBitmapPositionOffsetY", 0 )
131cdf0e10cSrcweir );
132cdf0e10cSrcweir
133cdf0e10cSrcweir return aFillPropertyMap;
134cdf0e10cSrcweir }
135cdf0e10cSrcweir
lcl_supportsFillProperties(::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType)136cdf0e10cSrcweir bool lcl_supportsFillProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir return ( eType == ::chart::wrapper::GraphicPropertyItemConverter::FILLED_DATA_POINT ||
139cdf0e10cSrcweir eType == ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES ||
140cdf0e10cSrcweir eType == ::chart::wrapper::GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES );
141cdf0e10cSrcweir }
142cdf0e10cSrcweir
lcl_supportsLineProperties(::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType)143cdf0e10cSrcweir bool lcl_supportsLineProperties( ::chart::wrapper::GraphicPropertyItemConverter::eGraphicObjectType eType )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir return ( eType != ::chart::wrapper::GraphicPropertyItemConverter::FILL_PROPERTIES );
146cdf0e10cSrcweir }
147cdf0e10cSrcweir
lcl_SetContentForNamedProperty(const uno::Reference<lang::XMultiServiceFactory> & xFactory,const::rtl::OUString & rTableName,NameOrIndex & rItem,sal_uInt8 nMemberId)148cdf0e10cSrcweir bool lcl_SetContentForNamedProperty(
149cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory > & xFactory,
150cdf0e10cSrcweir const ::rtl::OUString & rTableName,
151cdf0e10cSrcweir NameOrIndex & rItem, sal_uInt8 nMemberId )
152cdf0e10cSrcweir {
153cdf0e10cSrcweir bool bResult = false;
154cdf0e10cSrcweir if( xFactory.is())
155cdf0e10cSrcweir {
156cdf0e10cSrcweir ::rtl::OUString aPropertyValue( rItem.GetName());
157cdf0e10cSrcweir uno::Reference< container::XNameAccess > xNameAcc(
158cdf0e10cSrcweir xFactory->createInstance( rTableName ),
159cdf0e10cSrcweir uno::UNO_QUERY );
160cdf0e10cSrcweir if( xNameAcc.is() &&
161cdf0e10cSrcweir xNameAcc->hasByName( aPropertyValue ))
162cdf0e10cSrcweir {
163cdf0e10cSrcweir rItem.PutValue( xNameAcc->getByName( aPropertyValue ), nMemberId );
164cdf0e10cSrcweir bResult = true;
165cdf0e10cSrcweir }
166cdf0e10cSrcweir }
167cdf0e10cSrcweir return bResult;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
170cdf0e10cSrcweir } // anonymous namespace
171cdf0e10cSrcweir
172cdf0e10cSrcweir // ========================================
173cdf0e10cSrcweir
174cdf0e10cSrcweir namespace chart
175cdf0e10cSrcweir {
176cdf0e10cSrcweir namespace wrapper
177cdf0e10cSrcweir {
178cdf0e10cSrcweir
GraphicPropertyItemConverter(const uno::Reference<beans::XPropertySet> & rPropertySet,SfxItemPool & rItemPool,SdrModel & rDrawModel,const uno::Reference<lang::XMultiServiceFactory> & xNamedPropertyContainerFactory,eGraphicObjectType eObjectType)179cdf0e10cSrcweir GraphicPropertyItemConverter::GraphicPropertyItemConverter(
180cdf0e10cSrcweir const uno::Reference<
181cdf0e10cSrcweir beans::XPropertySet > & rPropertySet,
182cdf0e10cSrcweir SfxItemPool& rItemPool,
183cdf0e10cSrcweir SdrModel& rDrawModel,
184cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
185cdf0e10cSrcweir eGraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) :
186cdf0e10cSrcweir ItemConverter( rPropertySet, rItemPool ),
187cdf0e10cSrcweir m_eGraphicObjectType( eObjectType ),
188cdf0e10cSrcweir m_rDrawModel( rDrawModel ),
189cdf0e10cSrcweir m_xNamedPropertyTableFactory( xNamedPropertyContainerFactory )
190cdf0e10cSrcweir {}
191cdf0e10cSrcweir
~GraphicPropertyItemConverter()192cdf0e10cSrcweir GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
193cdf0e10cSrcweir {}
194cdf0e10cSrcweir
GetWhichPairs() const195cdf0e10cSrcweir const sal_uInt16 * GraphicPropertyItemConverter::GetWhichPairs() const
196cdf0e10cSrcweir {
197cdf0e10cSrcweir const sal_uInt16 * pResult = NULL;
198cdf0e10cSrcweir
199cdf0e10cSrcweir switch( m_eGraphicObjectType )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir case LINE_DATA_POINT:
202cdf0e10cSrcweir case FILLED_DATA_POINT:
203cdf0e10cSrcweir pResult = nRowWhichPairs; break;
204cdf0e10cSrcweir case LINE_PROPERTIES:
205cdf0e10cSrcweir pResult = nLinePropertyWhichPairs; break;
206cdf0e10cSrcweir case FILL_PROPERTIES:
207cdf0e10cSrcweir pResult = nFillPropertyWhichPairs; break;
208cdf0e10cSrcweir case LINE_AND_FILL_PROPERTIES:
209cdf0e10cSrcweir pResult = nLineAndFillPropertyWhichPairs; break;
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212cdf0e10cSrcweir return pResult;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir
GetItemProperty(tWhichIdType nWhichId,tPropertyNameWithMemberId & rOutProperty) const215cdf0e10cSrcweir bool GraphicPropertyItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
216cdf0e10cSrcweir {
217cdf0e10cSrcweir ::comphelper::ItemPropertyMapType::const_iterator aEndIt;
218cdf0e10cSrcweir ::comphelper::ItemPropertyMapType::const_iterator aIt;
219cdf0e10cSrcweir
220cdf0e10cSrcweir switch( m_eGraphicObjectType )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir case LINE_DATA_POINT:
223cdf0e10cSrcweir aEndIt = lcl_GetDataPointLinePropertyMap().end();
224cdf0e10cSrcweir aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId );
225cdf0e10cSrcweir break;
226cdf0e10cSrcweir case FILLED_DATA_POINT:
227cdf0e10cSrcweir aEndIt = lcl_GetDataPointFilledPropertyMap().end();
228cdf0e10cSrcweir aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId );
229cdf0e10cSrcweir break;
230cdf0e10cSrcweir case LINE_PROPERTIES:
231cdf0e10cSrcweir aEndIt = lcl_GetLinePropertyMap().end();
232cdf0e10cSrcweir aIt = lcl_GetLinePropertyMap().find( nWhichId );
233cdf0e10cSrcweir break;
234cdf0e10cSrcweir
235cdf0e10cSrcweir case FILL_PROPERTIES:
236cdf0e10cSrcweir aEndIt = lcl_GetFillPropertyMap().end();
237cdf0e10cSrcweir aIt = lcl_GetFillPropertyMap().find( nWhichId );
238cdf0e10cSrcweir break;
239cdf0e10cSrcweir
240cdf0e10cSrcweir case LINE_AND_FILL_PROPERTIES:
241cdf0e10cSrcweir // line
242cdf0e10cSrcweir aEndIt = lcl_GetLinePropertyMap().end();
243cdf0e10cSrcweir aIt = lcl_GetLinePropertyMap().find( nWhichId );
244cdf0e10cSrcweir
245cdf0e10cSrcweir // not found => try fill
246cdf0e10cSrcweir if( aIt == aEndIt )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir aEndIt = lcl_GetFillPropertyMap().end();
249cdf0e10cSrcweir aIt = lcl_GetFillPropertyMap().find( nWhichId );
250cdf0e10cSrcweir }
251cdf0e10cSrcweir break;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir if( aIt == aEndIt )
255cdf0e10cSrcweir return false;
256cdf0e10cSrcweir
257cdf0e10cSrcweir rOutProperty =(*aIt).second;
258cdf0e10cSrcweir return true;
259cdf0e10cSrcweir }
260cdf0e10cSrcweir
FillSpecialItem(sal_uInt16 nWhichId,SfxItemSet & rOutItemSet) const261cdf0e10cSrcweir void GraphicPropertyItemConverter::FillSpecialItem(
262cdf0e10cSrcweir sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
263cdf0e10cSrcweir throw( uno::Exception )
264cdf0e10cSrcweir {
265cdf0e10cSrcweir // if( m_eGraphicObjectType == LINE_DATA_POINT ||
266cdf0e10cSrcweir // m_eGraphicObjectType == LINE_PROPERTIES )
267cdf0e10cSrcweir // return;
268cdf0e10cSrcweir
269cdf0e10cSrcweir switch( nWhichId )
270cdf0e10cSrcweir {
271cdf0e10cSrcweir // bitmap property
272cdf0e10cSrcweir case XATTR_FILLBMP_TILE:
273cdf0e10cSrcweir case XATTR_FILLBMP_STRETCH:
274cdf0e10cSrcweir {
275cdf0e10cSrcweir drawing::BitmapMode aMode = drawing::BitmapMode_REPEAT;
276cdf0e10cSrcweir if( GetPropertySet()->getPropertyValue( C2U("FillBitmapMode")) >>= aMode )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir rOutItemSet.Put( XFillBmpTileItem( aMode == drawing::BitmapMode_REPEAT ));
279cdf0e10cSrcweir rOutItemSet.Put( XFillBmpStretchItem( aMode == drawing::BitmapMode_STRETCH ));
280cdf0e10cSrcweir }
281cdf0e10cSrcweir }
282cdf0e10cSrcweir break;
283cdf0e10cSrcweir
284cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE:
285cdf0e10cSrcweir try
286cdf0e10cSrcweir {
287cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
288cdf0e10cSrcweir {
289cdf0e10cSrcweir ::rtl::OUString aPropName =
290cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
291cdf0e10cSrcweir ? C2U( "TransparencyGradientName" )
292cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" );
293cdf0e10cSrcweir
294cdf0e10cSrcweir uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ));
295cdf0e10cSrcweir if( aValue.hasValue())
296cdf0e10cSrcweir {
297cdf0e10cSrcweir XFillFloatTransparenceItem aItem;
298cdf0e10cSrcweir aItem.PutValue( aValue, MID_NAME );
299cdf0e10cSrcweir
300cdf0e10cSrcweir lcl_SetContentForNamedProperty(
301cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.TransparencyGradientTable"),
302cdf0e10cSrcweir aItem, MID_FILLGRADIENT );
303cdf0e10cSrcweir
304cdf0e10cSrcweir // this is important to enable the item
305cdf0e10cSrcweir ::rtl::OUString aName;
306cdf0e10cSrcweir if( (aValue >>= aName) &&
307*9ec58d04SHerbert Dürr !aName.isEmpty())
308cdf0e10cSrcweir {
309cdf0e10cSrcweir aItem.SetEnabled( sal_True );
310cdf0e10cSrcweir rOutItemSet.Put( aItem );
311cdf0e10cSrcweir }
312cdf0e10cSrcweir }
313cdf0e10cSrcweir }
314cdf0e10cSrcweir }
315cdf0e10cSrcweir catch( beans::UnknownPropertyException ex )
316cdf0e10cSrcweir {
317cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
318cdf0e10cSrcweir }
319cdf0e10cSrcweir break;
320cdf0e10cSrcweir
321cdf0e10cSrcweir case XATTR_GRADIENTSTEPCOUNT:
322cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
323cdf0e10cSrcweir {
324cdf0e10cSrcweir ::rtl::OUString aPropName =
325cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
326cdf0e10cSrcweir ? C2U( "GradientStepCount" )
327cdf0e10cSrcweir : C2U( "FillGradientStepCount" );
328cdf0e10cSrcweir
329cdf0e10cSrcweir sal_Int16 nStepCount = 0;
330cdf0e10cSrcweir uno::Any aValue( GetPropertySet()->getPropertyValue( aPropName ) );
331cdf0e10cSrcweir if( hasLongOrShortValue(aValue) )
332cdf0e10cSrcweir {
333cdf0e10cSrcweir nStepCount = getShortForLongAlso(aValue);
334cdf0e10cSrcweir rOutItemSet.Put( XGradientStepCountItem( nStepCount ));
335cdf0e10cSrcweir }
336cdf0e10cSrcweir }
337cdf0e10cSrcweir break;
338cdf0e10cSrcweir
339cdf0e10cSrcweir case XATTR_LINEDASH:
340cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType ))
341cdf0e10cSrcweir {
342cdf0e10cSrcweir ::rtl::OUString aPropName =
343cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
344cdf0e10cSrcweir ? C2U( "BorderDashName" )
345cdf0e10cSrcweir : C2U( "LineDashName" );
346cdf0e10cSrcweir
347cdf0e10cSrcweir XLineDashItem aItem;
348cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
349cdf0e10cSrcweir
350cdf0e10cSrcweir lcl_SetContentForNamedProperty(
351cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.DashTable"),
352cdf0e10cSrcweir aItem, MID_LINEDASH );
353cdf0e10cSrcweir
354cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so
355cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names
356cdf0e10cSrcweir XLineDashItem * pItemToPut = & aItem;
357cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
358cdf0e10cSrcweir
359cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut );
360cdf0e10cSrcweir }
361cdf0e10cSrcweir break;
362cdf0e10cSrcweir
363cdf0e10cSrcweir case XATTR_FILLGRADIENT:
364cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
365cdf0e10cSrcweir {
366cdf0e10cSrcweir ::rtl::OUString aPropName =
367cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
368cdf0e10cSrcweir ? C2U( "GradientName" )
369cdf0e10cSrcweir : C2U( "FillGradientName" );
370cdf0e10cSrcweir
371cdf0e10cSrcweir XFillGradientItem aItem;
372cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
373cdf0e10cSrcweir
374cdf0e10cSrcweir lcl_SetContentForNamedProperty(
375cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.GradientTable"),
376cdf0e10cSrcweir aItem, MID_FILLGRADIENT );
377cdf0e10cSrcweir
378cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so
379cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names
380cdf0e10cSrcweir XFillGradientItem * pItemToPut = & aItem;
381cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
382cdf0e10cSrcweir
383cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut );
384cdf0e10cSrcweir }
385cdf0e10cSrcweir break;
386cdf0e10cSrcweir
387cdf0e10cSrcweir case XATTR_FILLHATCH:
388cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
389cdf0e10cSrcweir {
390cdf0e10cSrcweir ::rtl::OUString aPropName =
391cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
392cdf0e10cSrcweir ? C2U( "HatchName" )
393cdf0e10cSrcweir : C2U( "FillHatchName" );
394cdf0e10cSrcweir
395cdf0e10cSrcweir XFillHatchItem aItem;
396cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ), MID_NAME );
397cdf0e10cSrcweir
398cdf0e10cSrcweir lcl_SetContentForNamedProperty(
399cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.HatchTable"),
400cdf0e10cSrcweir aItem, MID_FILLHATCH );
401cdf0e10cSrcweir
402cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so
403cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names
404cdf0e10cSrcweir XFillHatchItem * pItemToPut = & aItem;
405cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
406cdf0e10cSrcweir
407cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut );
408cdf0e10cSrcweir }
409cdf0e10cSrcweir break;
410cdf0e10cSrcweir
411cdf0e10cSrcweir case XATTR_FILLBITMAP:
412cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
413cdf0e10cSrcweir {
414cdf0e10cSrcweir XFillBitmapItem aItem;
415cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" ) ), MID_NAME );
416cdf0e10cSrcweir
417cdf0e10cSrcweir lcl_SetContentForNamedProperty(
418cdf0e10cSrcweir m_xNamedPropertyTableFactory, C2U("com.sun.star.drawing.BitmapTable"),
419cdf0e10cSrcweir aItem, MID_GRAFURL );
420cdf0e10cSrcweir
421cdf0e10cSrcweir // translate model name to UI-name for predefined entries, so
422cdf0e10cSrcweir // that the correct entry is chosen in the list of UI-names
423cdf0e10cSrcweir XFillBitmapItem * pItemToPut = & aItem;
424cdf0e10cSrcweir pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
425cdf0e10cSrcweir
426cdf0e10cSrcweir rOutItemSet.Put( * pItemToPut );
427cdf0e10cSrcweir }
428cdf0e10cSrcweir break;
429cdf0e10cSrcweir
430cdf0e10cSrcweir // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
431cdf0e10cSrcweir // instead of sal_Int16
432cdf0e10cSrcweir case XATTR_LINETRANSPARENCE:
433cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType ))
434cdf0e10cSrcweir {
435cdf0e10cSrcweir ::rtl::OUString aPropName =
436cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
437cdf0e10cSrcweir ? C2U( "BorderTransparency" )
438cdf0e10cSrcweir : (m_eGraphicObjectType == LINE_DATA_POINT)
439cdf0e10cSrcweir ? C2U( "Transparency" )
440cdf0e10cSrcweir : C2U( "LineTransparence" );
441cdf0e10cSrcweir
442cdf0e10cSrcweir XLineTransparenceItem aItem;
443cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
444cdf0e10cSrcweir
445cdf0e10cSrcweir rOutItemSet.Put( aItem );
446cdf0e10cSrcweir }
447cdf0e10cSrcweir break;
448cdf0e10cSrcweir
449cdf0e10cSrcweir // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
450cdf0e10cSrcweir // instead of sal_Int16
451cdf0e10cSrcweir case XATTR_FILLTRANSPARENCE:
452cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
453cdf0e10cSrcweir {
454cdf0e10cSrcweir ::rtl::OUString aPropName =
455cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
456cdf0e10cSrcweir ? C2U( "Transparency" )
457cdf0e10cSrcweir : C2U( "FillTransparence" );
458cdf0e10cSrcweir
459cdf0e10cSrcweir XFillTransparenceItem aItem;
460cdf0e10cSrcweir aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
461cdf0e10cSrcweir
462cdf0e10cSrcweir rOutItemSet.Put( aItem );
463cdf0e10cSrcweir }
464cdf0e10cSrcweir break;
465cdf0e10cSrcweir }
466cdf0e10cSrcweir }
467cdf0e10cSrcweir
ApplySpecialItem(sal_uInt16 nWhichId,const SfxItemSet & rItemSet)468cdf0e10cSrcweir bool GraphicPropertyItemConverter::ApplySpecialItem(
469cdf0e10cSrcweir sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
470cdf0e10cSrcweir throw( uno::Exception )
471cdf0e10cSrcweir {
472cdf0e10cSrcweir bool bChanged = false;
473cdf0e10cSrcweir uno::Any aValue;
474cdf0e10cSrcweir
475cdf0e10cSrcweir switch( nWhichId )
476cdf0e10cSrcweir {
477cdf0e10cSrcweir // bitmap property
478cdf0e10cSrcweir case XATTR_FILLBMP_STRETCH:
479cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
480cdf0e10cSrcweir {
481cdf0e10cSrcweir const ::rtl::OUString aModePropName = C2U("FillBitmapMode");
482cdf0e10cSrcweir bool bStretched = static_cast< const XFillBmpStretchItem & >(
483cdf0e10cSrcweir rItemSet.Get( XATTR_FILLBMP_STRETCH )).GetValue();
484cdf0e10cSrcweir drawing::BitmapMode aMode =
485cdf0e10cSrcweir (bStretched ? drawing::BitmapMode_STRETCH : drawing::BitmapMode_NO_REPEAT);
486cdf0e10cSrcweir
487cdf0e10cSrcweir aValue <<= aMode;
488cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aModePropName ))
489cdf0e10cSrcweir {
490cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aModePropName, aValue );
491cdf0e10cSrcweir bChanged = true;
492cdf0e10cSrcweir }
493cdf0e10cSrcweir }
494cdf0e10cSrcweir break;
495cdf0e10cSrcweir
496cdf0e10cSrcweir case XATTR_FILLBMP_TILE:
497cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
498cdf0e10cSrcweir {
499cdf0e10cSrcweir const ::rtl::OUString aModePropName = C2U("FillBitmapMode");
500cdf0e10cSrcweir bool bTiled = static_cast< const XFillBmpTileItem & >(
501cdf0e10cSrcweir rItemSet.Get( XATTR_FILLBMP_TILE )).GetValue();
502cdf0e10cSrcweir drawing::BitmapMode aMode =
503cdf0e10cSrcweir (bTiled ? drawing::BitmapMode_REPEAT : drawing::BitmapMode_NO_REPEAT);
504cdf0e10cSrcweir
505cdf0e10cSrcweir aValue <<= aMode;
506cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aModePropName ))
507cdf0e10cSrcweir {
508cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aModePropName, aValue );
509cdf0e10cSrcweir bChanged = true;
510cdf0e10cSrcweir }
511cdf0e10cSrcweir }
512cdf0e10cSrcweir break;
513cdf0e10cSrcweir
514cdf0e10cSrcweir case XATTR_FILLFLOATTRANSPARENCE:
515cdf0e10cSrcweir try
516cdf0e10cSrcweir {
517cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
518cdf0e10cSrcweir {
519cdf0e10cSrcweir ::rtl::OUString aPropName =
520cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
521cdf0e10cSrcweir ? C2U( "TransparencyGradientName" )
522cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" );
523cdf0e10cSrcweir
524cdf0e10cSrcweir const XFillFloatTransparenceItem & rItem =
525cdf0e10cSrcweir static_cast< const XFillFloatTransparenceItem & >(
526cdf0e10cSrcweir rItemSet.Get( nWhichId ));
527cdf0e10cSrcweir
528cdf0e10cSrcweir if( rItem.IsEnabled() &&
529cdf0e10cSrcweir rItem.QueryValue( aValue, MID_NAME ))
530cdf0e10cSrcweir {
531cdf0e10cSrcweir uno::Any aGradient;
532cdf0e10cSrcweir rItem.QueryValue( aGradient, MID_FILLGRADIENT );
533cdf0e10cSrcweir
534cdf0e10cSrcweir // add TransparencyGradient to list if it does not already exist
535cdf0e10cSrcweir ::rtl::OUString aPreferredName;
536cdf0e10cSrcweir aValue >>= aPreferredName;
537cdf0e10cSrcweir aValue <<= PropertyHelper::addTransparencyGradientUniqueNameToTable(
538cdf0e10cSrcweir aGradient, m_xNamedPropertyTableFactory, aPreferredName );
539cdf0e10cSrcweir
540cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
541cdf0e10cSrcweir {
542cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
543cdf0e10cSrcweir bChanged = true;
544cdf0e10cSrcweir }
545cdf0e10cSrcweir }
546cdf0e10cSrcweir else
547cdf0e10cSrcweir {
548cdf0e10cSrcweir ::rtl::OUString aName;
549cdf0e10cSrcweir if( ( GetPropertySet()->getPropertyValue( aPropName ) >>= aName )
550*9ec58d04SHerbert Dürr && !aName.isEmpty() )
551cdf0e10cSrcweir {
552cdf0e10cSrcweir uno::Reference< beans::XPropertyState > xState( GetPropertySet(), uno::UNO_QUERY );
553cdf0e10cSrcweir if( xState.is())
554cdf0e10cSrcweir xState->setPropertyToDefault( aPropName );
555cdf0e10cSrcweir bChanged = true;
556cdf0e10cSrcweir }
557cdf0e10cSrcweir }
558cdf0e10cSrcweir }
559cdf0e10cSrcweir }
560cdf0e10cSrcweir catch( beans::UnknownPropertyException ex )
561cdf0e10cSrcweir {
562cdf0e10cSrcweir ASSERT_EXCEPTION( ex );
563cdf0e10cSrcweir }
564cdf0e10cSrcweir break;
565cdf0e10cSrcweir
566cdf0e10cSrcweir case XATTR_GRADIENTSTEPCOUNT:
567cdf0e10cSrcweir {
568cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
569cdf0e10cSrcweir {
570cdf0e10cSrcweir ::rtl::OUString aPropName =
571cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
572cdf0e10cSrcweir ? C2U( "GradientStepCount" )
573cdf0e10cSrcweir : C2U( "FillGradientStepCount" );
574cdf0e10cSrcweir
575cdf0e10cSrcweir sal_Int16 nStepCount = ( static_cast< const XGradientStepCountItem & >(
576cdf0e10cSrcweir rItemSet.Get( nWhichId ))).GetValue();
577cdf0e10cSrcweir
578cdf0e10cSrcweir aValue <<= nStepCount;
579cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
580cdf0e10cSrcweir {
581cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
582cdf0e10cSrcweir bChanged = true;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir }
585cdf0e10cSrcweir }
586cdf0e10cSrcweir break;
587cdf0e10cSrcweir
588cdf0e10cSrcweir case XATTR_LINEDASH:
589cdf0e10cSrcweir {
590cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType ))
591cdf0e10cSrcweir {
592cdf0e10cSrcweir
593cdf0e10cSrcweir ::rtl::OUString aPropName =
594cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
595cdf0e10cSrcweir ? C2U( "BorderDashName" )
596cdf0e10cSrcweir : C2U( "LineDashName" );
597cdf0e10cSrcweir
598cdf0e10cSrcweir const XLineDashItem & rItem =
599cdf0e10cSrcweir static_cast< const XLineDashItem & >(
600cdf0e10cSrcweir rItemSet.Get( nWhichId ));
601cdf0e10cSrcweir
602cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME ))
603cdf0e10cSrcweir {
604cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
605cdf0e10cSrcweir {
606cdf0e10cSrcweir // add LineDash to list
607cdf0e10cSrcweir uno::Any aLineDash;
608cdf0e10cSrcweir rItem.QueryValue( aLineDash, MID_LINEDASH );
609cdf0e10cSrcweir ::rtl::OUString aPreferredName;
610cdf0e10cSrcweir aValue >>= aPreferredName;
611cdf0e10cSrcweir aValue <<= PropertyHelper::addLineDashUniqueNameToTable(
612cdf0e10cSrcweir aLineDash, m_xNamedPropertyTableFactory, aPreferredName );
613cdf0e10cSrcweir
614cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
615cdf0e10cSrcweir bChanged = true;
616cdf0e10cSrcweir }
617cdf0e10cSrcweir }
618cdf0e10cSrcweir }
619cdf0e10cSrcweir }
620cdf0e10cSrcweir break;
621cdf0e10cSrcweir
622cdf0e10cSrcweir case XATTR_FILLGRADIENT:
623cdf0e10cSrcweir {
624cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
625cdf0e10cSrcweir {
626cdf0e10cSrcweir ::rtl::OUString aPropName =
627cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
628cdf0e10cSrcweir ? C2U( "GradientName" )
629cdf0e10cSrcweir : C2U( "FillGradientName" );
630cdf0e10cSrcweir
631cdf0e10cSrcweir const XFillGradientItem & rItem =
632cdf0e10cSrcweir static_cast< const XFillGradientItem & >(
633cdf0e10cSrcweir rItemSet.Get( nWhichId ));
634cdf0e10cSrcweir
635cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME ))
636cdf0e10cSrcweir {
637cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
638cdf0e10cSrcweir {
639cdf0e10cSrcweir // add Gradient to list
640cdf0e10cSrcweir uno::Any aGradient;
641cdf0e10cSrcweir rItem.QueryValue( aGradient, MID_FILLGRADIENT );
642cdf0e10cSrcweir ::rtl::OUString aPreferredName;
643cdf0e10cSrcweir aValue >>= aPreferredName;
644cdf0e10cSrcweir aValue <<= PropertyHelper::addGradientUniqueNameToTable(
645cdf0e10cSrcweir aGradient, m_xNamedPropertyTableFactory, aPreferredName );
646cdf0e10cSrcweir
647cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
648cdf0e10cSrcweir bChanged = true;
649cdf0e10cSrcweir }
650cdf0e10cSrcweir }
651cdf0e10cSrcweir }
652cdf0e10cSrcweir }
653cdf0e10cSrcweir break;
654cdf0e10cSrcweir
655cdf0e10cSrcweir case XATTR_FILLHATCH:
656cdf0e10cSrcweir {
657cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
658cdf0e10cSrcweir {
659cdf0e10cSrcweir ::rtl::OUString aPropName =
660cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
661cdf0e10cSrcweir ? C2U( "HatchName" )
662cdf0e10cSrcweir : C2U( "FillHatchName" );
663cdf0e10cSrcweir
664cdf0e10cSrcweir const XFillHatchItem & rItem =
665cdf0e10cSrcweir static_cast< const XFillHatchItem & >(
666cdf0e10cSrcweir rItemSet.Get( nWhichId ));
667cdf0e10cSrcweir
668cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME ))
669cdf0e10cSrcweir {
670cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
671cdf0e10cSrcweir {
672cdf0e10cSrcweir // add Hatch to list
673cdf0e10cSrcweir uno::Any aHatch;
674cdf0e10cSrcweir rItem.QueryValue( aHatch, MID_FILLHATCH );
675cdf0e10cSrcweir ::rtl::OUString aPreferredName;
676cdf0e10cSrcweir aValue >>= aPreferredName;
677cdf0e10cSrcweir aValue <<= PropertyHelper::addHatchUniqueNameToTable(
678cdf0e10cSrcweir aHatch, m_xNamedPropertyTableFactory, aPreferredName );
679cdf0e10cSrcweir
680cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
681cdf0e10cSrcweir bChanged = true;
682cdf0e10cSrcweir }
683cdf0e10cSrcweir }
684cdf0e10cSrcweir }
685cdf0e10cSrcweir }
686cdf0e10cSrcweir break;
687cdf0e10cSrcweir
688cdf0e10cSrcweir case XATTR_FILLBITMAP:
689cdf0e10cSrcweir {
690cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
691cdf0e10cSrcweir {
692cdf0e10cSrcweir const XFillBitmapItem & rItem =
693cdf0e10cSrcweir static_cast< const XFillBitmapItem & >(
694cdf0e10cSrcweir rItemSet.Get( nWhichId ));
695cdf0e10cSrcweir
696cdf0e10cSrcweir if( rItem.QueryValue( aValue, MID_NAME ))
697cdf0e10cSrcweir {
698cdf0e10cSrcweir if( aValue != GetPropertySet()->getPropertyValue( C2U( "FillBitmapName" )))
699cdf0e10cSrcweir {
700cdf0e10cSrcweir // add Bitmap to list
701cdf0e10cSrcweir uno::Any aBitmap;
702cdf0e10cSrcweir rItem.QueryValue( aBitmap, MID_GRAFURL );
703cdf0e10cSrcweir ::rtl::OUString aPreferredName;
704cdf0e10cSrcweir aValue >>= aPreferredName;
705cdf0e10cSrcweir aValue <<= PropertyHelper::addBitmapUniqueNameToTable(
706cdf0e10cSrcweir aBitmap, m_xNamedPropertyTableFactory, aPreferredName );
707cdf0e10cSrcweir
708cdf0e10cSrcweir GetPropertySet()->setPropertyValue( C2U( "FillBitmapName" ), aValue );
709cdf0e10cSrcweir bChanged = true;
710cdf0e10cSrcweir }
711cdf0e10cSrcweir }
712cdf0e10cSrcweir }
713cdf0e10cSrcweir }
714cdf0e10cSrcweir break;
715cdf0e10cSrcweir
716cdf0e10cSrcweir // hack, because QueryValue of XLineTransparenceItem returns sal_Int32
717cdf0e10cSrcweir // instead of sal_Int16
718cdf0e10cSrcweir case XATTR_LINETRANSPARENCE:
719cdf0e10cSrcweir if( lcl_supportsLineProperties( m_eGraphicObjectType ))
720cdf0e10cSrcweir {
721cdf0e10cSrcweir ::rtl::OUString aPropName =
722cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
723cdf0e10cSrcweir ? C2U( "BorderTransparency" )
724cdf0e10cSrcweir : (m_eGraphicObjectType == LINE_DATA_POINT)
725cdf0e10cSrcweir ? C2U( "Transparency" )
726cdf0e10cSrcweir : C2U( "LineTransparence" );
727cdf0e10cSrcweir
728cdf0e10cSrcweir const XLineTransparenceItem & rItem =
729cdf0e10cSrcweir static_cast< const XLineTransparenceItem & >(
730cdf0e10cSrcweir rItemSet.Get( nWhichId ));
731cdf0e10cSrcweir
732cdf0e10cSrcweir if( rItem.QueryValue( aValue ))
733cdf0e10cSrcweir {
734cdf0e10cSrcweir OSL_ENSURE( ! aValue.isExtractableTo(
735cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))),
736cdf0e10cSrcweir "TransparenceItem QueryValue bug is fixed. Remove hack." );
737cdf0e10cSrcweir sal_Int32 nValue = 0;
738cdf0e10cSrcweir if( aValue >>= nValue )
739cdf0e10cSrcweir {
740cdf0e10cSrcweir OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
741cdf0e10cSrcweir sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
742cdf0e10cSrcweir aValue <<= nValueToSet;
743cdf0e10cSrcweir
744cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
745cdf0e10cSrcweir bChanged = true;
746cdf0e10cSrcweir }
747cdf0e10cSrcweir else
748cdf0e10cSrcweir {
749cdf0e10cSrcweir OSL_ENSURE( false, "Wrong type in Transparency Any" );
750cdf0e10cSrcweir }
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir break;
754cdf0e10cSrcweir
755cdf0e10cSrcweir // hack, because QueryValue of XFillTransparenceItem returns sal_Int32
756cdf0e10cSrcweir // instead of sal_Int16
757cdf0e10cSrcweir case XATTR_FILLTRANSPARENCE:
758cdf0e10cSrcweir if( lcl_supportsFillProperties( m_eGraphicObjectType ))
759cdf0e10cSrcweir {
760cdf0e10cSrcweir ::rtl::OUString aPropName =
761cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
762cdf0e10cSrcweir ? C2U( "Transparency" )
763cdf0e10cSrcweir : C2U( "FillTransparence" );
764cdf0e10cSrcweir
765cdf0e10cSrcweir const XFillTransparenceItem & rItem =
766cdf0e10cSrcweir static_cast< const XFillTransparenceItem & >(
767cdf0e10cSrcweir rItemSet.Get( nWhichId ));
768cdf0e10cSrcweir
769cdf0e10cSrcweir if( rItem.QueryValue( aValue ))
770cdf0e10cSrcweir {
771cdf0e10cSrcweir OSL_ENSURE( ! aValue.isExtractableTo(
772cdf0e10cSrcweir ::getCppuType( reinterpret_cast< const sal_Int16 * >(0))),
773cdf0e10cSrcweir "TransparenceItem QueryValue bug is fixed. Remove hack." );
774cdf0e10cSrcweir sal_Int32 nValue = 0;
775cdf0e10cSrcweir if( aValue >>= nValue )
776cdf0e10cSrcweir {
777cdf0e10cSrcweir OSL_ENSURE( nValue < SAL_MAX_INT16, "Transparency value too large" );
778cdf0e10cSrcweir sal_Int16 nValueToSet( static_cast< sal_Int16 >( nValue ));
779cdf0e10cSrcweir aValue <<= nValueToSet;
780cdf0e10cSrcweir
781cdf0e10cSrcweir GetPropertySet()->setPropertyValue( aPropName, aValue );
782cdf0e10cSrcweir // if linear or no transparence is set, delete the gradient
783cdf0e10cSrcweir ::rtl::OUString aTransGradPropName =
784cdf0e10cSrcweir (m_eGraphicObjectType == FILLED_DATA_POINT)
785cdf0e10cSrcweir ? C2U( "TransparencyGradientName" )
786cdf0e10cSrcweir : C2U( "FillTransparenceGradientName" );
787cdf0e10cSrcweir GetPropertySet()->setPropertyValue(
788cdf0e10cSrcweir aTransGradPropName, uno::makeAny( ::rtl::OUString() ));
789cdf0e10cSrcweir
790cdf0e10cSrcweir bChanged = true;
791cdf0e10cSrcweir }
792cdf0e10cSrcweir else
793cdf0e10cSrcweir {
794cdf0e10cSrcweir OSL_ENSURE( false, "Wrong type in Transparency Any" );
795cdf0e10cSrcweir }
796cdf0e10cSrcweir }
797cdf0e10cSrcweir }
798cdf0e10cSrcweir break;
799cdf0e10cSrcweir }
800cdf0e10cSrcweir
801cdf0e10cSrcweir return bChanged;
802cdf0e10cSrcweir }
803cdf0e10cSrcweir
804cdf0e10cSrcweir } // namespace wrapper
805cdf0e10cSrcweir } // namespace chart
806