View | Details | Raw Unified | Return to issue 121371
Collapse All | Expand All

(-)oox/source/drawingml/customshapeproperties.cxx (-56 / +65 lines)
Lines 92-160 Link Here
92
	{
92
	{
93
		//const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
93
		//const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
94
        Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
94
        Reference< drawing::XEnhancedCustomShapeDefaulter > xDefaulter( xShape, UNO_QUERY );
95
95
        if( xDefaulter.is() )
96
        if( xDefaulter.is() )
97
        {
96
            xDefaulter->createCustomShapeDefaults( maShapePresetType );
98
            xDefaulter->createCustomShapeDefaults( maShapePresetType );
99
        }
97
100
98
        PropertyMap aPropertyMap;
101
        const bool bAdjustmentGuideList(maAdjustmentGuideList.size());
99
        
100
        aPropertyMap[ PROP_MirroredX ] <<= Any( mbMirroredX );
101
        aPropertyMap[ PROP_MirroredY ] <<= Any( mbMirroredY );
102
102
103
        if(mnTextRotation)
103
        if(bAdjustmentGuideList || mbMirroredX || mbMirroredY || mnTextRotation)
104
        {
104
        {
105
            // #119920# Handle missing text rotation
105
            const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
106
            aPropertyMap[ PROP_TextRotateAngle ] <<= Any(mnTextRotation);
106
            uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
107
        }
107
            uno::Sequence< beans::PropertyValue > aGeoPropSeq;
108
108
109
        // converting the vector to a sequence
109
            if(aGeoPropSet >>= aGeoPropSeq)
110
        Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
110
            {
111
        PropertySet aPropSet( xPropSet );
111
                const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
112
        aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
112
                const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM( "Type" ) );
113
                const rtl::OUString sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "MirroredX" ) );
114
                const rtl::OUString sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
115
                const rtl::OUString sTextRotateAngle( RTL_CONSTASCII_USTRINGPARAM ( "TextRotateAngle" ) );
116
                sal_Int32 i, nCount = aGeoPropSeq.getLength();
113
117
114
        if ( maAdjustmentGuideList.size() )
118
                for(i = 0; i < nCount; i++)
115
		{
119
                {
116
			const OUString sType = CREATE_OUSTRING( "Type" );
120
                    if( bAdjustmentGuideList )
117
			const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
121
                    {
118
			uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
122
                        if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
119
			uno::Sequence< beans::PropertyValue > aGeoPropSeq;
123
                        {
120
			if ( aGeoPropSet >>= aGeoPropSeq )
124
                            uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
121
			{
125
                            if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
122
				sal_Int32 i, nCount = aGeoPropSeq.getLength();
126
                            {
123
				for ( i = 0; i < nCount; i++ )
127
                                std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() );
124
				{
128
                                while( aIter != maAdjustmentGuideList.end() )
125
					const rtl::OUString sAdjustmentValues( RTL_CONSTASCII_USTRINGPARAM( "AdjustmentValues" ) );
129
                                {
126
					if ( aGeoPropSeq[ i ].Name.equals( sAdjustmentValues ) )
130
                                    if ( (*aIter).maName.getLength() > 3 )
127
					{
131
                                    {
128
						uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
132
                                        sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1;
129
						if ( aGeoPropSeq[ i ].Value >>= aAdjustmentSeq )
133
                                        if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
130
						{
134
                                        {
131
							std::vector< CustomShapeGuide >::const_iterator aIter( maAdjustmentGuideList.begin() );
135
                                            EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
132
							while( aIter != maAdjustmentGuideList.end() )
136
                                            aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
133
							{
137
                                            aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
134
								if ( (*aIter).maName.getLength() > 3 )
138
                                            aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal;
135
								{
139
                                        }
136
									sal_Int32 nAdjustmentIndex = (*aIter).maName.copy( 3 ).toInt32() - 1;
140
                                    }
137
									if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
141
                                    aIter++;
138
									{
142
                                }
139
										EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
143
                                aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
140
										aAdjustmentVal.Value <<= (*aIter).maFormula.toInt32();
144
                                xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aGeoPropSeq ) );
141
										aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
145
                            }
142
										aAdjustmentSeq[ nAdjustmentIndex ] = aAdjustmentVal;
146
                        }
143
									}
147
                        else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
144
								}
148
                        {
145
								aIter++;
149
                            aGeoPropSeq[ i ].Value <<= maShapePresetType;
146
							}
150
                        }
147
							aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
151
                    }
148
							xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aGeoPropSeq ) );
152
                    if(mbMirroredX && aGeoPropSeq[i].Name.equals(sMirroredX))
149
						}
153
                    {
150
					}
154
                        aGeoPropSeq[i].Value <<= mbMirroredX;
151
					else if ( aGeoPropSeq[ i ].Name.equals( sType ) )
155
                    }
152
					{
156
                    if(mbMirroredY && aGeoPropSeq[i].Name.equals(sMirroredY))
153
						aGeoPropSeq[ i ].Value <<= maShapePresetType;
157
                    {
154
					}
158
                        aGeoPropSeq[i].Value <<= mbMirroredY;
155
				}
159
                    }
156
			}
160
                    if(mnTextRotation && aGeoPropSeq[i].Name.equals(sTextRotateAngle))
157
		}
161
                    {
162
                        aGeoPropSeq[i].Value <<= mnTextRotation;
163
                    }
164
                }
165
            }
166
        }
158
	}
167
	}
159
	else
168
	else
160
	{
169
	{

Return to issue 121371