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
10cdf0e10cSrcweir *
11ca5ec200SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
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.
19cdf0e10cSrcweir *
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>
34*ac54f538SArmin Le Grand #include <basegfx/numeric/ftools.hxx>
35cdf0e10cSrcweir
36cdf0e10cSrcweir using rtl::OUString;
37cdf0e10cSrcweir using namespace ::oox::core;
38cdf0e10cSrcweir using namespace ::com::sun::star;
39cdf0e10cSrcweir using namespace ::com::sun::star::uno;
40cdf0e10cSrcweir using namespace ::com::sun::star::beans;
41cdf0e10cSrcweir using namespace ::com::sun::star::graphic;
42cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
43cdf0e10cSrcweir
44cdf0e10cSrcweir namespace oox { namespace drawingml {
45cdf0e10cSrcweir
CustomShapeProperties()46cdf0e10cSrcweir CustomShapeProperties::CustomShapeProperties()
47cdf0e10cSrcweir : mbMirroredX ( sal_False )
48cdf0e10cSrcweir , mbMirroredY ( sal_False )
49d742e3ecSArmin Le Grand , mnTextRotation(0) // #119920# Add missing extra text rotation
50cdf0e10cSrcweir {
51cdf0e10cSrcweir }
~CustomShapeProperties()52cdf0e10cSrcweir CustomShapeProperties::~CustomShapeProperties()
53cdf0e10cSrcweir {
54cdf0e10cSrcweir }
55cdf0e10cSrcweir
SetCustomShapeGuideValue(std::vector<CustomShapeGuide> & rGuideList,const CustomShapeGuide & rGuide)56cdf0e10cSrcweir sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir sal_uInt32 nIndex = 0;
59cdf0e10cSrcweir for( ; nIndex < rGuideList.size(); nIndex++ )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir if ( rGuideList[ nIndex ].maName == rGuide.maName )
62cdf0e10cSrcweir break;
63cdf0e10cSrcweir }
64cdf0e10cSrcweir if ( nIndex == rGuideList.size() )
65cdf0e10cSrcweir rGuideList.push_back( rGuide );
66cdf0e10cSrcweir return static_cast< sal_Int32 >( nIndex );
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
69cdf0e10cSrcweir // returns the index into the guidelist for a given formula name,
70cdf0e10cSrcweir // if the return value is < 0 then the guide value could not be found
GetCustomShapeGuideValue(const std::vector<CustomShapeGuide> & rGuideList,const rtl::OUString & rFormulaName)71cdf0e10cSrcweir sal_Int32 CustomShapeProperties::GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const rtl::OUString& rFormulaName )
72cdf0e10cSrcweir {
73cdf0e10cSrcweir sal_Int32 nIndex = 0;
74cdf0e10cSrcweir for( ; nIndex < static_cast< sal_Int32 >( rGuideList.size() ); nIndex++ )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir if ( rGuideList[ nIndex ].maName == rFormulaName )
77cdf0e10cSrcweir break;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir if ( nIndex == static_cast< sal_Int32 >( rGuideList.size() ) )
80cdf0e10cSrcweir nIndex = -1;
81cdf0e10cSrcweir return nIndex;
82cdf0e10cSrcweir }
83cdf0e10cSrcweir
apply(const CustomShapePropertiesPtr &)84cdf0e10cSrcweir void CustomShapeProperties::apply( const CustomShapePropertiesPtr& /* rSourceCustomShapeProperties */ )
85cdf0e10cSrcweir {
86cdf0e10cSrcweir // not sure if this needs to be implemented
87cdf0e10cSrcweir }
88cdf0e10cSrcweir
setOrCreatePropertyValue(uno::Sequence<beans::PropertyValue> & rPropSeq,const OUString & rName,const uno::Any & rAny)898c6705edSArmin Le Grand bool setOrCreatePropertyValue(
908c6705edSArmin Le Grand uno::Sequence< beans::PropertyValue >& rPropSeq,
918c6705edSArmin Le Grand const OUString& rName,
928c6705edSArmin Le Grand const uno::Any& rAny)
938c6705edSArmin Le Grand {
948c6705edSArmin Le Grand const sal_Int32 nCount(rPropSeq.getLength());
958c6705edSArmin Le Grand
968c6705edSArmin Le Grand for(sal_Int32 a(0); a < nCount; a++)
978c6705edSArmin Le Grand {
988c6705edSArmin Le Grand beans::PropertyValue& rEntry = rPropSeq[a];
998c6705edSArmin Le Grand
1008c6705edSArmin Le Grand if(rEntry.Name.equals(rName))
1018c6705edSArmin Le Grand {
1028c6705edSArmin Le Grand rEntry.Value = rAny;
1038c6705edSArmin Le Grand return false;
1048c6705edSArmin Le Grand }
1058c6705edSArmin Le Grand }
1068c6705edSArmin Le Grand
1078c6705edSArmin Le Grand beans::PropertyValue aNewValue;
1088c6705edSArmin Le Grand
1098c6705edSArmin Le Grand aNewValue.Name = rName;
1108c6705edSArmin Le Grand aNewValue.Value = rAny;
1118c6705edSArmin Le Grand
1128c6705edSArmin Le Grand rPropSeq.realloc(nCount + 1);
1138c6705edSArmin Le Grand rPropSeq[nCount] = aNewValue;
1148c6705edSArmin Le Grand
1158c6705edSArmin Le Grand return true;
1168c6705edSArmin Le Grand }
1178c6705edSArmin Le Grand
pushToPropSet(const::oox::core::FilterBase &,const Reference<XPropertySet> & xPropSet,const Reference<XShape> & xShape) const118cdf0e10cSrcweir void CustomShapeProperties::pushToPropSet( const ::oox::core::FilterBase& /* rFilterBase */,
119cdf0e10cSrcweir const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
120cdf0e10cSrcweir {
121cdf0e10cSrcweir if ( maShapePresetType.getLength() )
122cdf0e10cSrcweir {
123cdf0e10cSrcweir //const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
124cdf0e10cSrcweir Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
1258c6705edSArmin Le Grand const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
1268c6705edSArmin Le Grand uno::Sequence< beans::PropertyValue > aGeoPropSeq;
1278c6705edSArmin Le Grand uno::Any aGeoPropSet;
1288c6705edSArmin Le Grand bool bValuesAdded(false);
1298c6705edSArmin Le Grand
130cdf0e10cSrcweir if( xDefaulter.is() )
1318c6705edSArmin Le Grand {
132cdf0e10cSrcweir xDefaulter->createCustomShapeDefaults( maShapePresetType );
1338c6705edSArmin Le Grand }
134cdf0e10cSrcweir
1358c6705edSArmin Le Grand if(mbMirroredX || mbMirroredY || mnTextRotation)
1368c6705edSArmin Le Grand {
1378c6705edSArmin Le Grand // #121371# set these values, but do *not* set a completely new
1388c6705edSArmin Le Grand // "CustomShapeGeometry", this would reset the evtl. already created
1398c6705edSArmin Le Grand // "Type" entry
1408c6705edSArmin Le Grand aGeoPropSet = xPropSet->getPropertyValue(sCustomShapeGeometry);
141d742e3ecSArmin Le Grand
1428c6705edSArmin Le Grand if(aGeoPropSet >>= aGeoPropSeq)
1438c6705edSArmin Le Grand {
1448c6705edSArmin Le Grand uno::Any aAny;
1458c6705edSArmin Le Grand
1468c6705edSArmin Le Grand if(mbMirroredX) // TTTT: remove again after aw080, make it part of object transformation
1478c6705edSArmin Le Grand {
1488c6705edSArmin Le Grand const rtl::OUString sMirroredX(RTL_CONSTASCII_USTRINGPARAM("MirroredX"));
1498c6705edSArmin Le Grand aAny <<= mbMirroredX;
1508c6705edSArmin Le Grand bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sMirroredX, aAny);
1518c6705edSArmin Le Grand }
1528c6705edSArmin Le Grand
1538c6705edSArmin Le Grand if(mbMirroredY) // TTTT: remove again after aw080, make it part of object transformation
1548c6705edSArmin Le Grand {
1558c6705edSArmin Le Grand const rtl::OUString sMirroredY(RTL_CONSTASCII_USTRINGPARAM("MirroredY"));
1568c6705edSArmin Le Grand aAny <<= mbMirroredY;
1578c6705edSArmin Le Grand bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sMirroredY, aAny);
1588c6705edSArmin Le Grand }
159d742e3ecSArmin Le Grand
160d742e3ecSArmin Le Grand if(mnTextRotation)
161d742e3ecSArmin Le Grand {
1628c6705edSArmin Le Grand const rtl::OUString sTextRotateAngle(RTL_CONSTASCII_USTRINGPARAM("TextRotateAngle"));
1638c6705edSArmin Le Grand aAny <<= (double)mnTextRotation;
1648c6705edSArmin Le Grand bValuesAdded = setOrCreatePropertyValue(aGeoPropSeq, sTextRotateAngle, aAny);
165d742e3ecSArmin Le Grand }
1668c6705edSArmin Le Grand }
1678c6705edSArmin Le Grand }
168d742e3ecSArmin Le Grand
169cdf0e10cSrcweir if ( maAdjustmentGuideList.size() )
170cdf0e10cSrcweir {
1718c6705edSArmin Le Grand if(!aGeoPropSeq.getLength())
172cdf0e10cSrcweir {
1738c6705edSArmin Le Grand aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
1748c6705edSArmin Le Grand aGeoPropSet >>= aGeoPropSeq;
1758c6705edSArmin Le Grand }
1768c6705edSArmin Le Grand
177cdf0e10cSrcweir sal_Int32 i, nCount = aGeoPropSeq.getLength();
1788c6705edSArmin Le Grand
179cdf0e10cSrcweir for ( i = 0; i < nCount; i++ )
180cdf0e10cSrcweir {
181cdf0e10cSrcweir const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
1828c6705edSArmin Le Grand const OUString sType = CREATE_OUSTRING( "Type" );
1838c6705edSArmin Le Grand
184cdf0e10cSrcweir if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
187cdf0e10cSrcweir if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
188cdf0e10cSrcweir {
189cdf0e10cSrcweir std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() );
190cdf0e10cSrcweir while( aIter != maAdjustmentGuideList.end() )
191cdf0e10cSrcweir {
192cdf0e10cSrcweir if ( (*aIter).maName.getLength() > 3 )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1;
195cdf0e10cSrcweir if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
196cdf0e10cSrcweir {
197cdf0e10cSrcweir EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
198*ac54f538SArmin Le Grand
199*ac54f538SArmin Le Grand sal_Int32 nValue((*aIter).maFormula.toInt32());
200*ac54f538SArmin Le Grand
201*ac54f538SArmin Le Grand // #124703# The ms control point coordinates are relative to the
202*ac54f538SArmin Le Grand // object center in the range [-50000 .. 50000] while our customshapes
203*ac54f538SArmin Le Grand // use a range from [0 .. 21600], so adapt the value as needed
204*ac54f538SArmin Le Grand nValue = basegfx::fround((double(nValue) + 50000.0) * (21600.0 / 100000.0));
205*ac54f538SArmin Le Grand
206*ac54f538SArmin Le Grand aAdjustmentVal.Value <<= nValue;
207cdf0e10cSrcweir aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
208cdf0e10cSrcweir aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal;
209cdf0e10cSrcweir }
210cdf0e10cSrcweir }
211cdf0e10cSrcweir aIter++;
212cdf0e10cSrcweir }
213cdf0e10cSrcweir aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
214cdf0e10cSrcweir xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aGeoPropSeq ) );
215cdf0e10cSrcweir }
216cdf0e10cSrcweir }
217cdf0e10cSrcweir else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir aGeoPropSeq[ i ].Value <<= maShapePresetType;
220cdf0e10cSrcweir }
221cdf0e10cSrcweir }
222cdf0e10cSrcweir }
2238c6705edSArmin Le Grand
2248c6705edSArmin Le Grand if(bValuesAdded)
2258c6705edSArmin Le Grand {
2268c6705edSArmin Le Grand aGeoPropSet <<= aGeoPropSeq;
2278c6705edSArmin Le Grand xPropSet->setPropertyValue(sCustomShapeGeometry, aGeoPropSet);
228cdf0e10cSrcweir }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir else
231cdf0e10cSrcweir {
232cdf0e10cSrcweir sal_uInt32 i;
233cdf0e10cSrcweir PropertyMap aPropertyMap;
234cdf0e10cSrcweir aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "non-primitive" );
235cdf0e10cSrcweir aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
236cdf0e10cSrcweir aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
237d742e3ecSArmin Le Grand
238d742e3ecSArmin Le Grand if(mnTextRotation)
239d742e3ecSArmin Le Grand {
240d742e3ecSArmin Le Grand aPropertyMap[ PROP_TextRotation ] <<= Any(mnTextRotation);
241d742e3ecSArmin Le Grand }
242d742e3ecSArmin Le Grand
243cdf0e10cSrcweir awt::Size aSize( xShape->getSize() );
244cdf0e10cSrcweir awt::Rectangle aViewBox( 0, 0, aSize.Width * 360, aSize.Height * 360 );
245cdf0e10cSrcweir if ( maPath2DList.size() )
246cdf0e10cSrcweir { // TODO: each polygon may have its own size, but I think it is rather been used
247cdf0e10cSrcweir // so we are only taking care of the first
248cdf0e10cSrcweir if ( maPath2DList[ 0 ].w )
249cdf0e10cSrcweir aViewBox.Width = static_cast< sal_Int32 >( maPath2DList[ 0 ].w );
250cdf0e10cSrcweir if ( maPath2DList[ 0 ].h )
251cdf0e10cSrcweir aViewBox.Height = static_cast< sal_Int32 >( maPath2DList[ 0 ].h );
252cdf0e10cSrcweir }
253cdf0e10cSrcweir aPropertyMap[ PROP_ViewBox ] <<= aViewBox;
254cdf0e10cSrcweir
255cdf0e10cSrcweir Sequence< EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( maAdjustmentGuideList.size() );
256cdf0e10cSrcweir for ( i = 0; i < maAdjustmentGuideList.size(); i++ )
257cdf0e10cSrcweir {
258cdf0e10cSrcweir EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
259cdf0e10cSrcweir aAdjustmentVal.Value <<= maAdjustmentGuideList[ i ].maFormula.toInt32();
260cdf0e10cSrcweir aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
261cdf0e10cSrcweir aAdjustmentValues[ i ] = aAdjustmentVal;
262cdf0e10cSrcweir }
263cdf0e10cSrcweir aPropertyMap[ PROP_AdjustmentValues ] <<= aAdjustmentValues;
264cdf0e10cSrcweir
265cdf0e10cSrcweir Sequence< rtl::OUString > aEquations( maGuideList.size() );
266cdf0e10cSrcweir for ( i = 0; i < maGuideList.size(); i++ )
267cdf0e10cSrcweir aEquations[ i ] = maGuideList[ i ].maFormula;
268cdf0e10cSrcweir aPropertyMap[ PROP_Equations ] <<= aEquations;
269cdf0e10cSrcweir
270cdf0e10cSrcweir PropertyMap aPath;
271cdf0e10cSrcweir Sequence< EnhancedCustomShapeSegment > aSegments( maSegments.size() );
272cdf0e10cSrcweir for ( i = 0; i < maSegments.size(); i++ )
273cdf0e10cSrcweir aSegments[ i ] = maSegments[ i ];
274cdf0e10cSrcweir aPath[ PROP_Segments ] <<= aSegments;
275cdf0e10cSrcweir sal_uInt32 j, k, nParameterPairs = 0;
276cdf0e10cSrcweir for ( i = 0; i < maPath2DList.size(); i++ )
277cdf0e10cSrcweir nParameterPairs += maPath2DList[ i ].parameter.size();
278cdf0e10cSrcweir Sequence< EnhancedCustomShapeParameterPair > aParameterPairs( nParameterPairs );
279cdf0e10cSrcweir for ( i = 0, k = 0; i < maPath2DList.size(); i++ )
280cdf0e10cSrcweir for ( j = 0; j < maPath2DList[ i ].parameter.size(); j++ )
281cdf0e10cSrcweir aParameterPairs[ k++ ] = maPath2DList[ i ].parameter[ j ];
282cdf0e10cSrcweir aPath[ PROP_Coordinates ] <<= aParameterPairs;
283cdf0e10cSrcweir Sequence< PropertyValue > aPathSequence = aPath.makePropertyValueSequence();
284cdf0e10cSrcweir aPropertyMap[ PROP_Path ] <<= aPathSequence;
285cdf0e10cSrcweir
286cdf0e10cSrcweir Sequence< PropertyValues > aHandles( maAdjustHandleList.size() );
287cdf0e10cSrcweir for ( i = 0; i < maAdjustHandleList.size(); i++ )
288cdf0e10cSrcweir {
289cdf0e10cSrcweir PropertyMap aHandle;
290cdf0e10cSrcweir // maAdjustmentHandle[ i ].gdRef1 ... maAdjustmentHandle[ i ].gdRef2 ... :(
291cdf0e10cSrcweir // gdRef1 && gdRef2 -> we do not offer such reference, so it is difficult
292cdf0e10cSrcweir // to determine the correct adjustment handle that should be updated with the adjustment
293cdf0e10cSrcweir // position. here is the solution: the adjustment value that is used within the position
294cdf0e10cSrcweir // has to be updated, in case the position is a formula the first usage of a
295cdf0e10cSrcweir // adjument value is decisive
296cdf0e10cSrcweir if ( maAdjustHandleList[ i ].polar )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
299cdf0e10cSrcweir if ( maAdjustHandleList[ i ].min1.has() )
300cdf0e10cSrcweir aHandle[ PROP_RadiusRangeMinimum ] <<= maAdjustHandleList[ i ].min1.get();
301cdf0e10cSrcweir if ( maAdjustHandleList[ i ].max1.has() )
302cdf0e10cSrcweir aHandle[ PROP_RadiusRangeMaximum ] <<= maAdjustHandleList[ i ].max1.get();
303cdf0e10cSrcweir
304cdf0e10cSrcweir /* TODO: AngleMin & AngleMax
305cdf0e10cSrcweir if ( maAdjustHandleList[ i ].min2.has() )
306cdf0e10cSrcweir aHandle[ PROP_ ] = maAdjustHandleList[ i ].min2.get();
307cdf0e10cSrcweir if ( maAdjustHandleList[ i ].max2.has() )
308cdf0e10cSrcweir aHandle[ PROP_ ] = maAdjustHandleList[ i ].max2.get();
309cdf0e10cSrcweir */
310cdf0e10cSrcweir }
311cdf0e10cSrcweir else
312cdf0e10cSrcweir {
313cdf0e10cSrcweir aHandle[ PROP_Position ] <<= maAdjustHandleList[ i ].pos;
314cdf0e10cSrcweir if ( maAdjustHandleList[ i ].gdRef1.has() )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir // TODO: PROP_RefX and PROP_RefY are not yet part of our file format,
317cdf0e10cSrcweir // so the handles will not work after save/reload
318cdf0e10cSrcweir sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef1.get() );
319cdf0e10cSrcweir if ( nIndex >= 0 )
320cdf0e10cSrcweir aHandle[ PROP_RefX ] <<= nIndex;
321cdf0e10cSrcweir }
322cdf0e10cSrcweir if ( maAdjustHandleList[ i ].gdRef2.has() )
323cdf0e10cSrcweir {
324cdf0e10cSrcweir sal_Int32 nIndex = GetCustomShapeGuideValue( maAdjustmentGuideList, maAdjustHandleList[ i ].gdRef2.get() );
325cdf0e10cSrcweir if ( nIndex >= 0 )
326cdf0e10cSrcweir aHandle[ PROP_RefY ] <<= nIndex;
327cdf0e10cSrcweir }
328cdf0e10cSrcweir if ( maAdjustHandleList[ i ].min1.has() )
329cdf0e10cSrcweir aHandle[ PROP_RangeXMinimum ] <<= maAdjustHandleList[ i ].min1.get();
330cdf0e10cSrcweir if ( maAdjustHandleList[ i ].max1.has() )
331cdf0e10cSrcweir aHandle[ PROP_RangeXMaximum ] <<= maAdjustHandleList[ i ].max1.get();
332cdf0e10cSrcweir if ( maAdjustHandleList[ i ].min2.has() )
333cdf0e10cSrcweir aHandle[ PROP_RangeYMinimum ] <<= maAdjustHandleList[ i ].min2.get();
334cdf0e10cSrcweir if ( maAdjustHandleList[ i ].max2.has() )
335cdf0e10cSrcweir aHandle[ PROP_RangeYMaximum ] <<= maAdjustHandleList[ i ].max2.get();
336cdf0e10cSrcweir }
337cdf0e10cSrcweir aHandles[ i ] = aHandle.makePropertyValueSequence();
338cdf0e10cSrcweir }
339cdf0e10cSrcweir aPropertyMap[ PROP_Handles ] <<= aHandles;
340cdf0e10cSrcweir
341cdf0e10cSrcweir // converting the vector to a sequence
342cdf0e10cSrcweir Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
343cdf0e10cSrcweir PropertySet aPropSet( xPropSet );
344cdf0e10cSrcweir aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
getValue(const std::vector<CustomShapeGuide> & rGuideList,sal_uInt32 nIndex) const348cdf0e10cSrcweir double CustomShapeProperties::getValue( const std::vector< CustomShapeGuide >& rGuideList, sal_uInt32 nIndex ) const
349cdf0e10cSrcweir {
350cdf0e10cSrcweir double fRet = 0.0;
351cdf0e10cSrcweir if ( nIndex < rGuideList.size() )
352cdf0e10cSrcweir {
353cdf0e10cSrcweir
354cdf0e10cSrcweir }
355cdf0e10cSrcweir return fRet;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir
358cdf0e10cSrcweir } }
359