1ca5ec200SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ca5ec200SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ca5ec200SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ca5ec200SAndrew Rist  * distributed with this work for additional information
6ca5ec200SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ca5ec200SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ca5ec200SAndrew Rist  * "License"); you may not use this file except in compliance
9ca5ec200SAndrew Rist  * with the License.  You may obtain a copy of the License at
10ca5ec200SAndrew Rist  *
11ca5ec200SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ca5ec200SAndrew Rist  *
13ca5ec200SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ca5ec200SAndrew Rist  * software distributed under the License is distributed on an
15ca5ec200SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ca5ec200SAndrew Rist  * KIND, either express or implied.  See the License for the
17ca5ec200SAndrew Rist  * specific language governing permissions and limitations
18ca5ec200SAndrew Rist  * under the License.
19ca5ec200SAndrew Rist  *
20ca5ec200SAndrew Rist  *************************************************************/
21ca5ec200SAndrew Rist 
22ca5ec200SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "oox/drawingml/customshapeproperties.hxx"
25cdf0e10cSrcweir #include "oox/helper/helper.hxx"
26cdf0e10cSrcweir #include "oox/helper/propertymap.hxx"
27cdf0e10cSrcweir #include "oox/helper/propertyset.hxx"
28cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
29cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicTransformer.hpp>
32cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir using rtl::OUString;
36cdf0e10cSrcweir using namespace ::oox::core;
37cdf0e10cSrcweir using namespace ::com::sun::star;
38cdf0e10cSrcweir using namespace ::com::sun::star::uno;
39cdf0e10cSrcweir using namespace ::com::sun::star::beans;
40cdf0e10cSrcweir using namespace ::com::sun::star::graphic;
41cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir namespace oox { namespace drawingml {
44cdf0e10cSrcweir 
CustomShapeProperties()45cdf0e10cSrcweir CustomShapeProperties::CustomShapeProperties()
46cdf0e10cSrcweir : mbMirroredX	( sal_False )
47cdf0e10cSrcweir , mbMirroredY	( sal_False )
48d742e3ecSArmin Le Grand , mnTextRotation(0) // #119920# Add missing extra text rotation
49cdf0e10cSrcweir {
50cdf0e10cSrcweir }
~CustomShapeProperties()51cdf0e10cSrcweir CustomShapeProperties::~CustomShapeProperties()
52cdf0e10cSrcweir {
53cdf0e10cSrcweir }
54cdf0e10cSrcweir 
SetCustomShapeGuideValue(std::vector<CustomShapeGuide> & rGuideList,const CustomShapeGuide & rGuide)55cdf0e10cSrcweir sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	sal_uInt32 nIndex = 0;
58cdf0e10cSrcweir 	for( ; nIndex < rGuideList.size(); nIndex++ )
59cdf0e10cSrcweir 	{
60cdf0e10cSrcweir 		if ( rGuideList[ nIndex ].maName == rGuide.maName )
61cdf0e10cSrcweir 			break;
62cdf0e10cSrcweir 	}
63cdf0e10cSrcweir 	if ( nIndex == rGuideList.size() )
64cdf0e10cSrcweir 		rGuideList.push_back( rGuide );
65cdf0e10cSrcweir 	return static_cast< sal_Int32 >( nIndex );
66cdf0e10cSrcweir }
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // returns the index into the guidelist for a given formula name,
69cdf0e10cSrcweir // if the return value is < 0 then the guide value could not be found
GetCustomShapeGuideValue(const std::vector<CustomShapeGuide> & rGuideList,const rtl::OUString & rFormulaName)70cdf0e10cSrcweir sal_Int32 CustomShapeProperties::GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const rtl::OUString& rFormulaName )
71cdf0e10cSrcweir {
72cdf0e10cSrcweir 	sal_Int32 nIndex = 0;
73cdf0e10cSrcweir 	for( ; nIndex < static_cast< sal_Int32 >( rGuideList.size() ); nIndex++ )
74cdf0e10cSrcweir 	{
75cdf0e10cSrcweir 		if ( rGuideList[ nIndex ].maName == rFormulaName )
76cdf0e10cSrcweir 			break;
77cdf0e10cSrcweir 	}
78cdf0e10cSrcweir 	if ( nIndex == static_cast< sal_Int32 >( rGuideList.size() ) )
79cdf0e10cSrcweir 		nIndex = -1;
80cdf0e10cSrcweir 	return nIndex;
81cdf0e10cSrcweir }
82cdf0e10cSrcweir 
apply(const CustomShapePropertiesPtr &)83cdf0e10cSrcweir void CustomShapeProperties::apply( const CustomShapePropertiesPtr& /* rSourceCustomShapeProperties */ )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir 	// not sure if this needs to be implemented
86cdf0e10cSrcweir }
87cdf0e10cSrcweir 
setOrCreatePropertyValue(uno::Sequence<beans::PropertyValue> & rPropSeq,const OUString & rName,const uno::Any & rAny)88*8c6705edSArmin Le Grand bool setOrCreatePropertyValue(
89*8c6705edSArmin Le Grand     uno::Sequence< beans::PropertyValue >& rPropSeq,
90*8c6705edSArmin Le Grand     const OUString& rName,
91*8c6705edSArmin Le Grand     const uno::Any& rAny)
92*8c6705edSArmin Le Grand {
93*8c6705edSArmin Le Grand     const sal_Int32 nCount(rPropSeq.getLength());
94*8c6705edSArmin Le Grand 
95*8c6705edSArmin Le Grand     for(sal_Int32 a(0); a < nCount; a++)
96*8c6705edSArmin Le Grand     {
97*8c6705edSArmin Le Grand         beans::PropertyValue& rEntry = rPropSeq[a];
98*8c6705edSArmin Le Grand 
99*8c6705edSArmin Le Grand         if(rEntry.Name.equals(rName))
100*8c6705edSArmin Le Grand         {
101*8c6705edSArmin Le Grand             rEntry.Value = rAny;
102*8c6705edSArmin Le Grand             return false;
103*8c6705edSArmin Le Grand         }
104*8c6705edSArmin Le Grand     }
105*8c6705edSArmin Le Grand 
106*8c6705edSArmin Le Grand     beans::PropertyValue aNewValue;
107*8c6705edSArmin Le Grand 
108*8c6705edSArmin Le Grand     aNewValue.Name = rName;
109*8c6705edSArmin Le Grand     aNewValue.Value = rAny;
110*8c6705edSArmin Le Grand 
111*8c6705edSArmin Le Grand     rPropSeq.realloc(nCount + 1);
112*8c6705edSArmin Le Grand     rPropSeq[nCount] = aNewValue;
113*8c6705edSArmin Le Grand 
114*8c6705edSArmin Le Grand     return true;
115*8c6705edSArmin Le Grand }
116*8c6705edSArmin Le Grand 
pushToPropSet(const::oox::core::FilterBase &,const Reference<XPropertySet> & xPropSet,const Reference<XShape> & xShape) const117cdf0e10cSrcweir void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
118cdf0e10cSrcweir 	const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
119cdf0e10cSrcweir {
120cdf0e10cSrcweir 	if ( maShapePresetType.getLength() )
121cdf0e10cSrcweir 	{
122cdf0e10cSrcweir 		//const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
123cdf0e10cSrcweir         Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
124*8c6705edSArmin Le Grand         const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
125*8c6705edSArmin Le Grand         uno::Sequence< beans::PropertyValue > aGeoPropSeq;
126*8c6705edSArmin Le Grand         uno::Any aGeoPropSet;
127*8c6705edSArmin Le Grand         bool bValuesAdded(false);
128*8c6705edSArmin Le Grand 
129cdf0e10cSrcweir         if( xDefaulter.is() )
130*8c6705edSArmin Le Grand         {
131cdf0e10cSrcweir             xDefaulter->createCustomShapeDefaults( maShapePresetType );
132*8c6705edSArmin Le Grand         }
133cdf0e10cSrcweir 
134*8c6705edSArmin Le Grand         if(mbMirroredX || mbMirroredY || mnTextRotation)
135d742e3ecSArmin Le Grand         {
136*8c6705edSArmin Le Grand             // #121371# set these values, but do *not* set a completely new
137*8c6705edSArmin Le Grand             // "CustomShapeGeometry", this would reset the evtl. already created
138*8c6705edSArmin Le Grand             // "Type" entry
139*8c6705edSArmin Le Grand             aGeoPropSet = xPropSet->getPropertyValue(sCustomShapeGeometry);
140*8c6705edSArmin Le Grand 
141*8c6705edSArmin Le Grand             if(aGeoPropSet >>= aGeoPropSeq)
142*8c6705edSArmin Le Grand             {
143*8c6705edSArmin Le Grand                 uno::Any aAny;
144*8c6705edSArmin Le Grand 
145*8c6705edSArmin Le Grand                 if(mbMirroredX) // TTTT: remove again after aw080, make it part of object transformation
146*8c6705edSArmin Le Grand                 {
147*8c6705edSArmin Le Grand                     const rtl::OUString sMirroredX(RTL_CONSTASCII_USTRINGPARAM("MirroredX"));
148*8c6705edSArmin Le Grand                     aAny <<= mbMirroredX;
149*8c6705edSArmin Le Grand                     bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sMirroredX, aAny);
150*8c6705edSArmin Le Grand                 }
151*8c6705edSArmin Le Grand 
152*8c6705edSArmin Le Grand                 if(mbMirroredY) // TTTT: remove again after aw080, make it part of object transformation
153*8c6705edSArmin Le Grand                 {
154*8c6705edSArmin Le Grand                     const rtl::OUString sMirroredY(RTL_CONSTASCII_USTRINGPARAM("MirroredY"));
155*8c6705edSArmin Le Grand                     aAny <<= mbMirroredY;
156*8c6705edSArmin Le Grand                     bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sMirroredY, aAny);
157*8c6705edSArmin Le Grand                 }
158d742e3ecSArmin Le Grand 
159*8c6705edSArmin Le Grand                 if(mnTextRotation)
160*8c6705edSArmin Le Grand                 {
161*8c6705edSArmin Le Grand                     const rtl::OUString sTextRotateAngle(RTL_CONSTASCII_USTRINGPARAM("TextRotateAngle"));
162*8c6705edSArmin Le Grand                     aAny <<= (double)mnTextRotation;
163*8c6705edSArmin Le Grand                     bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sTextRotateAngle, aAny);
164*8c6705edSArmin Le Grand                 }
165*8c6705edSArmin Le Grand             }
166*8c6705edSArmin Le Grand         }
167d742e3ecSArmin Le Grand 
168d742e3ecSArmin Le Grand         if ( maAdjustmentGuideList.size() )
169cdf0e10cSrcweir 		{
170*8c6705edSArmin Le Grand             if(!aGeoPropSeq.getLength())
171*8c6705edSArmin Le Grand             {
172*8c6705edSArmin Le Grand                 aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
173*8c6705edSArmin Le Grand                 aGeoPropSet >>= aGeoPropSeq;
174*8c6705edSArmin Le Grand             }
175*8c6705edSArmin Le Grand 
176*8c6705edSArmin Le Grand             sal_Int32 i, nCount = aGeoPropSeq.getLength();
177*8c6705edSArmin Le Grand 
178*8c6705edSArmin Le Grand             for ( i = 0; i < nCount; i++ )
179cdf0e10cSrcweir 			{
180*8c6705edSArmin Le Grand 				const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
181*8c6705edSArmin Le Grand         		const OUString sType = CREATE_OUSTRING( "Type" );
182*8c6705edSArmin Le Grand 
183*8c6705edSArmin Le Grand                 if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
184cdf0e10cSrcweir 				{
185*8c6705edSArmin Le Grand 					uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
186*8c6705edSArmin Le Grand 					if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
187cdf0e10cSrcweir 					{
188*8c6705edSArmin Le Grand 						std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() );
189*8c6705edSArmin Le Grand 						while( aIter != maAdjustmentGuideList.end() )
190cdf0e10cSrcweir 						{
191*8c6705edSArmin Le Grand 							if ( (*aIter).maName.getLength() > 3 )
192cdf0e10cSrcweir 							{
193*8c6705edSArmin Le Grand 								sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1;
194*8c6705edSArmin Le Grand 								if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
195cdf0e10cSrcweir 								{
196*8c6705edSArmin Le Grand 									EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
197*8c6705edSArmin Le Grand 									aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
198*8c6705edSArmin Le Grand 									aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
199*8c6705edSArmin Le Grand 									aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal;
200cdf0e10cSrcweir 								}
201cdf0e10cSrcweir 							}
202*8c6705edSArmin Le Grand 							aIter++;
203cdf0e10cSrcweir 						}
204*8c6705edSArmin Le Grand 						aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
205*8c6705edSArmin Le Grand 						xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aGeoPropSeq ) );
206cdf0e10cSrcweir 					}
207*8c6705edSArmin Le Grand 				}
208*8c6705edSArmin Le Grand 				else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
209*8c6705edSArmin Le Grand 				{
210*8c6705edSArmin Le Grand 					aGeoPropSeq[ i ].Value <<= maShapePresetType;
211cdf0e10cSrcweir 				}
212cdf0e10cSrcweir 			}
213cdf0e10cSrcweir 		}
214*8c6705edSArmin Le Grand 
215*8c6705edSArmin Le Grand         if(bValuesAdded)
216*8c6705edSArmin Le Grand         {
217*8c6705edSArmin Le Grand             aGeoPropSet <<= aGeoPropSeq;
218*8c6705edSArmin Le Grand             xPropSet->setPropertyValue(sCustomShapeGeometry, aGeoPropSet);
219*8c6705edSArmin Le Grand         }
220cdf0e10cSrcweir 	}
221cdf0e10cSrcweir 	else
222cdf0e10cSrcweir 	{
223cdf0e10cSrcweir 		sal_uInt32 i;
224cdf0e10cSrcweir 		PropertyMap aPropertyMap;
225cdf0e10cSrcweir         aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "non-primitive" );
226cdf0e10cSrcweir 		aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
227cdf0e10cSrcweir 		aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
228d742e3ecSArmin Le Grand 
229d742e3ecSArmin Le Grand         if(mnTextRotation)
230d742e3ecSArmin Le Grand         {
231d742e3ecSArmin Le Grand             aPropertyMap[ PROP_TextRotation ] <<= Any(mnTextRotation);
232d742e3ecSArmin Le Grand         }
233d742e3ecSArmin Le Grand 
234cdf0e10cSrcweir 		awt::Size aSize( xShape->getSize() );
235cdf0e10cSrcweir 		awt::Rectangle aViewBox( 0, 0, aSize.Width * 360, aSize.Height * 360 );
236cdf0e10cSrcweir 		if ( maPath2DList.size() )
237cdf0e10cSrcweir 		{	// TODO: each polygon may have its own size, but I think it is rather been used
238cdf0e10cSrcweir 			// so we are only taking care of the first
239cdf0e10cSrcweir 			if ( maPath2DList[ 0 ].w )
240cdf0e10cSrcweir 				aViewBox.Width = static_cast< sal_Int32 >( maPath2DList[ 0 ].w );
241cdf0e10cSrcweir 			if ( maPath2DList[ 0 ].h )
242cdf0e10cSrcweir 				aViewBox.Height = static_cast< sal_Int32 >( maPath2DList[ 0 ].h );
243cdf0e10cSrcweir 		}
244cdf0e10cSrcweir 		aPropertyMap[ PROP_ViewBox ] <<= aViewBox;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 		Sequence< EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( maAdjustmentGuideList.size() );
247cdf0e10cSrcweir 		for ( i = 0; i < maAdjustmentGuideList.size(); i++ )
248cdf0e10cSrcweir 		{
249cdf0e10cSrcweir 			EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
250cdf0e10cSrcweir 			aAdjustmentVal.Value <<= maAdjustmentGuideList[ i ].maFormula.toInt32();
251cdf0e10cSrcweir 			aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
252cdf0e10cSrcweir 			aAdjustmentValues[ i ] = aAdjustmentVal;
253cdf0e10cSrcweir 		}
254cdf0e10cSrcweir 		aPropertyMap[ PROP_AdjustmentValues ] <<= aAdjustmentValues;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 		Sequence< rtl::OUString > aEquations( maGuideList.size() );
257cdf0e10cSrcweir 		for ( i = 0; i < maGuideList.size(); i++ )
258cdf0e10cSrcweir 			aEquations[ i ] = maGuideList[ i ].maFormula;
259cdf0e10cSrcweir 		aPropertyMap[ PROP_Equations ] <<= aEquations;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 		PropertyMap aPath;
262cdf0e10cSrcweir 		Sequence< EnhancedCustomShapeSegment > aSegments( maSegments.size() );
263cdf0e10cSrcweir 		for ( i = 0; i < maSegments.size(); i++ )
264cdf0e10cSrcweir 			aSegments[ i ] = maSegments[ i ];
265cdf0e10cSrcweir 		aPath[ PROP_Segments ] <<= aSegments;
266cdf0e10cSrcweir 		sal_uInt32 j, k, nParameterPairs = 0;
267cdf0e10cSrcweir 		for ( i = 0; i < maPath2DList.size(); i++ )
268cdf0e10cSrcweir 			nParameterPairs += maPath2DList[ i ].parameter.size();
269cdf0e10cSrcweir 		Sequence< EnhancedCustomShapeParameterPair > aParameterPairs( nParameterPairs );
270cdf0e10cSrcweir 		for ( i = 0, k = 0; i < maPath2DList.size(); i++ )
271cdf0e10cSrcweir 			for ( j = 0; j < maPath2DList[ i ].parameter.size(); j++ )
272cdf0e10cSrcweir 				aParameterPairs[ k++ ] = maPath2DList[ i ].parameter[ j ];
273cdf0e10cSrcweir 		aPath[ PROP_Coordinates ] <<= aParameterPairs;
274cdf0e10cSrcweir 		Sequence< PropertyValue > aPathSequence = aPath.makePropertyValueSequence();
275cdf0e10cSrcweir 		aPropertyMap[ PROP_Path ] <<= aPathSequence;
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 		Sequence< PropertyValues > aHandles( maAdjustHandleList.size() );
278cdf0e10cSrcweir 		for ( i = 0; i < maAdjustHandleList.size(); i++ )
279cdf0e10cSrcweir 		{
280cdf0e10cSrcweir 			PropertyMap aHandle;
281cdf0e10cSrcweir 			// maAdjustmentHandle[ i ].gdRef1 ... maAdjustmentHandle[ i ].gdRef2 ... :(
282cdf0e10cSrcweir 			// gdRef1 && gdRef2 -> we do not offer such reference, so it is difficult
283cdf0e10cSrcweir 			// to determine the correct adjustment handle that should be updated with the adjustment
284cdf0e10cSrcweir 			// position. here is the solution: the adjustment value that is used within the position
285cdf0e10cSrcweir 			// has to be updated, in case the position is a formula the first usage of a
286cdf0e10cSrcweir 			// adjument value is decisive
287cdf0e10cSrcweir 			if ( maAdjustHandleList[ i ].polar )
288cdf0e10cSrcweir 			{
289cdf0e10cSrcweir 				aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
290cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].min1.has() )
291cdf0e10cSrcweir 					aHandle[ PROP_RadiusRangeMinimum ] <<= maAdjustHandleList[ i ].min1.get();
292cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].max1.has() )
293cdf0e10cSrcweir 					aHandle[ PROP_RadiusRangeMaximum ] <<= maAdjustHandleList[ i ].max1.get();
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 				/* TODO: AngleMin & AngleMax
296cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].min2.has() )
297cdf0e10cSrcweir 					aHandle[ PROP_ ] = maAdjustHandleList[ i ].min2.get();
298cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].max2.has() )
299cdf0e10cSrcweir 					aHandle[ PROP_ ] = maAdjustHandleList[ i ].max2.get();
300cdf0e10cSrcweir 				*/
301cdf0e10cSrcweir 			}
302cdf0e10cSrcweir 			else
303cdf0e10cSrcweir 			{
304cdf0e10cSrcweir 				aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
305cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].gdRef1.has() )
306cdf0e10cSrcweir 				{
307cdf0e10cSrcweir 					// TODO: PROP_RefX and PROP_RefY are not yet part of our file format,
308cdf0e10cSrcweir 					// so the handles will not work after save/reload
309cdf0e10cSrcweir 					sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef1.get() );
310cdf0e10cSrcweir 					if ( nIndex >= 0 )
311cdf0e10cSrcweir 						aHandle[ PROP_RefX ] <<= nIndex;
312cdf0e10cSrcweir 				}
313cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].gdRef2.has() )
314cdf0e10cSrcweir 				{
315cdf0e10cSrcweir 					sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() );
316cdf0e10cSrcweir 					if ( nIndex >= 0 )
317cdf0e10cSrcweir 						aHandle[ PROP_RefY ] <<= nIndex;
318cdf0e10cSrcweir 				}
319cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].min1.has() )
320cdf0e10cSrcweir 					aHandle[ PROP_RangeXMinimum ] <<= maAdjustHandleList[ i ].min1.get();
321cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].max1.has() )
322cdf0e10cSrcweir 					aHandle[ PROP_RangeXMaximum ] <<= maAdjustHandleList[ i ].max1.get();
323cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].min2.has() )
324cdf0e10cSrcweir 					aHandle[ PROP_RangeYMinimum ] <<= maAdjustHandleList[ i ].min2.get();
325cdf0e10cSrcweir 				if ( maAdjustHandleList[ i ].max2.has() )
326cdf0e10cSrcweir 					aHandle[ PROP_RangeYMaximum ] <<= maAdjustHandleList[ i ].max2.get();
327cdf0e10cSrcweir 			}
328cdf0e10cSrcweir 			aHandles[ i ] = aHandle.makePropertyValueSequence();
329cdf0e10cSrcweir 		}
330cdf0e10cSrcweir 		aPropertyMap[ PROP_Handles ] <<= aHandles;
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 		// converting the vector to a sequence
333cdf0e10cSrcweir         Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
334cdf0e10cSrcweir         PropertySet aPropSet( xPropSet );
335cdf0e10cSrcweir         aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
336cdf0e10cSrcweir 	}
337cdf0e10cSrcweir }
338cdf0e10cSrcweir 
getValue(const std::vector<CustomShapeGuide> & rGuideList,sal_uInt32 nIndex) const339cdf0e10cSrcweir double CustomShapeProperties::getValue( const std::vector< CustomShapeGuide >& rGuideList, sal_uInt32 nIndex ) const
340cdf0e10cSrcweir {
341cdf0e10cSrcweir 	double fRet = 0.0;
342cdf0e10cSrcweir 	if ( nIndex < rGuideList.size() )
343cdf0e10cSrcweir 	{
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	}
346cdf0e10cSrcweir 	return fRet;
347cdf0e10cSrcweir }
348cdf0e10cSrcweir 
349cdf0e10cSrcweir } }
350