xref: /aoo42x/main/xmloff/source/draw/shapeexport.cxx (revision 63bba73c)
1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <memory>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx"
30cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
32cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
33cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
34cdf0e10cSrcweir #include <com/sun/star/chart/XChartDocument.hpp>
35cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp>
36cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp>
37cdf0e10cSrcweir #include <com/sun/star/drawing/XGluePointsSupplier.hpp>
38cdf0e10cSrcweir #include <com/sun/star/container/XIdentifierAccess.hpp>
39cdf0e10cSrcweir #include <com/sun/star/drawing/GluePoint2.hpp>
40cdf0e10cSrcweir #include <com/sun/star/drawing/Alignment.hpp>
41cdf0e10cSrcweir #include <com/sun/star/drawing/EscapeDirection.hpp>
42cdf0e10cSrcweir #include <com/sun/star/table/XColumnRowRange.hpp>
43cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
44cdf0e10cSrcweir #include "PropertySetMerger.hxx"
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include <xmloff/shapeexport.hxx>
47cdf0e10cSrcweir #include "sdpropls.hxx"
48cdf0e10cSrcweir #include "sdxmlexp_impl.hxx"
49cdf0e10cSrcweir #include <xmloff/families.hxx>
50cdf0e10cSrcweir #include <tools/debug.hxx>
51cdf0e10cSrcweir #include <xmloff/contextid.hxx>
52cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
53cdf0e10cSrcweir #include <tools/string.hxx>
54cdf0e10cSrcweir #include <sot/clsids.hxx>
55cdf0e10cSrcweir #include <tools/globname.hxx>
56cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
59cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
60cdf0e10cSrcweir #include <com/sun/star/drawing/XCustomShapeEngine.hpp>
61cdf0e10cSrcweir 
62cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
63cdf0e10cSrcweir 
64cdf0e10cSrcweir using ::rtl::OUString;
65cdf0e10cSrcweir using ::rtl::OUStringBuffer;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir using namespace ::com::sun::star;
68cdf0e10cSrcweir using namespace ::xmloff::token;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
71cdf0e10cSrcweir 
XMLShapeExport(SvXMLExport & rExp,SvXMLExportPropertyMapper * pExtMapper)72cdf0e10cSrcweir XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
73cdf0e10cSrcweir 								SvXMLExportPropertyMapper *pExtMapper )
74cdf0e10cSrcweir :	mrExport( rExp ),
75cdf0e10cSrcweir 	mnNextUniqueShapeId(1),
76cdf0e10cSrcweir     maShapesInfos(),
77cdf0e10cSrcweir     maCurrentShapesIter(maShapesInfos.end()),
78cdf0e10cSrcweir 	mbExportLayer( sal_False ),
79cdf0e10cSrcweir 	// #88546# init to sal_False
80cdf0e10cSrcweir 	mbHandleProgressBar( sal_False ),
81cdf0e10cSrcweir 	msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ),
82cdf0e10cSrcweir 	msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ),
83cdf0e10cSrcweir 	msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ),
84cdf0e10cSrcweir 	msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ),
85cdf0e10cSrcweir 	msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ),
86cdf0e10cSrcweir 	msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
87cdf0e10cSrcweir 	msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
88cdf0e10cSrcweir 	msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
89cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES
90cdf0e10cSrcweir 	msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
91cdf0e10cSrcweir 	msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
92cdf0e10cSrcweir 	msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
93cdf0e10cSrcweir #endif
94cdf0e10cSrcweir 	msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
95cdf0e10cSrcweir 	msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
96cdf0e10cSrcweir 	msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
97cdf0e10cSrcweir 	msScript( RTL_CONSTASCII_USTRINGPARAM("Script") ),
98cdf0e10cSrcweir 	msLibrary( RTL_CONSTASCII_USTRINGPARAM("Library") ),
99cdf0e10cSrcweir 	msClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ),
100cdf0e10cSrcweir 	msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ),
101cdf0e10cSrcweir 	msEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ),
102cdf0e10cSrcweir 	msPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ),
103cdf0e10cSrcweir 	msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ),
104cdf0e10cSrcweir 	msSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ),
105cdf0e10cSrcweir 	msSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ),
106cdf0e10cSrcweir 	msStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") )
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	// construct PropertyHandlerFactory
109cdf0e10cSrcweir 	mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp );
110cdf0e10cSrcweir 	// construct PropertySetMapper
111cdf0e10cSrcweir 	mxPropertySetMapper = CreateShapePropMapper( mrExport );
112cdf0e10cSrcweir 	if( pExtMapper )
113cdf0e10cSrcweir 	{
114cdf0e10cSrcweir 		UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper );
115cdf0e10cSrcweir 		mxPropertySetMapper->ChainExportMapper( xExtMapper );
116cdf0e10cSrcweir 	}
117cdf0e10cSrcweir 
118cdf0e10cSrcweir /*
119cdf0e10cSrcweir 	// chain text attributes
120cdf0e10cSrcweir 	xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp));
121cdf0e10cSrcweir */
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 	mrExport.GetAutoStylePool()->AddFamily(
124cdf0e10cSrcweir 		XML_STYLE_FAMILY_SD_GRAPHICS_ID,
125cdf0e10cSrcweir 		OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)),
126cdf0e10cSrcweir 		GetPropertySetMapper(),
127cdf0e10cSrcweir 		OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX)));
128cdf0e10cSrcweir 	mrExport.GetAutoStylePool()->AddFamily(
129cdf0e10cSrcweir 		XML_STYLE_FAMILY_SD_PRESENTATION_ID,
130cdf0e10cSrcweir 		OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)),
131cdf0e10cSrcweir 		GetPropertySetMapper(),
132cdf0e10cSrcweir 		OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX)));
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	maCurrentInfo = maShapeInfos.end();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	// create table export helper and let him add his families in time
137cdf0e10cSrcweir 	GetShapeTableExport();
138cdf0e10cSrcweir }
139cdf0e10cSrcweir 
140cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
141cdf0e10cSrcweir 
~XMLShapeExport()142cdf0e10cSrcweir XMLShapeExport::~XMLShapeExport()
143cdf0e10cSrcweir {
144cdf0e10cSrcweir }
145cdf0e10cSrcweir 
146cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
147cdf0e10cSrcweir 
148cdf0e10cSrcweir // sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format
checkForCustomShapeReplacement(const uno::Reference<drawing::XShape> & xShape)149cdf0e10cSrcweir uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir 	uno::Reference< drawing::XShape > xCustomShapeReplacement;
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 	if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 )
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		String aType( (OUString)xShape->getShapeType() );
156cdf0e10cSrcweir         if( aType.EqualsAscii( (const sal_Char*)"com.sun.star.drawing.CustomShape" ) )
157cdf0e10cSrcweir 		{
158cdf0e10cSrcweir 			uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
159cdf0e10cSrcweir 			if( xSet.is() )
160cdf0e10cSrcweir 			{
161cdf0e10cSrcweir 				rtl::OUString aEngine;
162cdf0e10cSrcweir 				xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) ) ) >>= aEngine;
163cdf0e10cSrcweir 				if ( !aEngine.getLength() )
164cdf0e10cSrcweir 					aEngine = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) );
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 				uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
167cdf0e10cSrcweir 		/*
168cdf0e10cSrcweir 				uno::Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape );
169cdf0e10cSrcweir 				if ( !aXShape.is() )
170cdf0e10cSrcweir 					aXShape = new SvxCustomShape( (SdrObjCustomShape*)pCustomShape );
171cdf0e10cSrcweir 		*/
172cdf0e10cSrcweir 				if ( aEngine.getLength() && xFactory.is() )
173cdf0e10cSrcweir 				{
174cdf0e10cSrcweir 					uno::Sequence< uno::Any > aArgument( 1 );
175cdf0e10cSrcweir 					uno::Sequence< beans::PropertyValue > aPropValues( 2 );
176cdf0e10cSrcweir 					aPropValues[ 0 ].Name = rtl::OUString::createFromAscii( "CustomShape" );
177cdf0e10cSrcweir 					aPropValues[ 0 ].Value <<= xShape;
178cdf0e10cSrcweir 					sal_Bool bForceGroupWithText = sal_True;
179cdf0e10cSrcweir 					aPropValues[ 1 ].Name = rtl::OUString::createFromAscii( "ForceGroupWithText" );
180cdf0e10cSrcweir 					aPropValues[ 1 ].Value <<= bForceGroupWithText;
181cdf0e10cSrcweir 					aArgument[ 0 ] <<= aPropValues;
182cdf0e10cSrcweir 					uno::Reference< uno::XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) );
183cdf0e10cSrcweir 					if ( xInterface.is() )
184cdf0e10cSrcweir 					{
185cdf0e10cSrcweir 						uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine(
186cdf0e10cSrcweir 							uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) );
187cdf0e10cSrcweir 						if ( xCustomShapeEngine.is() )
188cdf0e10cSrcweir 							xCustomShapeReplacement = xCustomShapeEngine->render();
189cdf0e10cSrcweir 					}
190cdf0e10cSrcweir 				}
191cdf0e10cSrcweir 			}
192cdf0e10cSrcweir 		}
193cdf0e10cSrcweir 	}
194cdf0e10cSrcweir 	return xCustomShapeReplacement;
195cdf0e10cSrcweir }
196cdf0e10cSrcweir 
197cdf0e10cSrcweir // This method collects all automatic styles for the given XShape
collectShapeAutoStyles(const uno::Reference<drawing::XShape> & xShape)198cdf0e10cSrcweir void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape )
199cdf0e10cSrcweir {
200cdf0e10cSrcweir 	if( maCurrentShapesIter == maShapesInfos.end() )
201cdf0e10cSrcweir 	{
202cdf0e10cSrcweir 		DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" );
203cdf0e10cSrcweir 		return;
204cdf0e10cSrcweir 	}
205cdf0e10cSrcweir 	sal_Int32 nZIndex = 0;
206cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
207cdf0e10cSrcweir 	if( xSet.is() )
208cdf0e10cSrcweir 		xSet->getPropertyValue(msZIndex) >>= nZIndex;
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 	if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
213cdf0e10cSrcweir 	{
214cdf0e10cSrcweir 		DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" );
215cdf0e10cSrcweir 		return;
216cdf0e10cSrcweir 	}
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape );
221cdf0e10cSrcweir 	if ( xCustomShapeReplacement.is() )
222cdf0e10cSrcweir 		aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement;
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	// -----------------------------
225cdf0e10cSrcweir 	// first compute the shapes type
226cdf0e10cSrcweir 	// -----------------------------
227cdf0e10cSrcweir 	ImpCalcShapeType(xShape, aShapeInfo.meShapeType);
228cdf0e10cSrcweir 
229a5258243SPedro Giffuni     // #i118485# enabled XmlShapeTypeDrawChartShape and XmlShapeTypeDrawOLE2Shape
230a5258243SPedro Giffuni     // to have text
231cdf0e10cSrcweir 	const bool bObjSupportsText =
232cdf0e10cSrcweir //		aShapeInfo.meShapeType != XmlShapeTypeDrawControlShape &&
233cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypePresChartShape &&
234cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape &&
235cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape &&
236cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypePresSheetShape &&
237cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDraw3DSceneObject &&
238cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDraw3DCubeObject &&
239cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDraw3DSphereObject &&
240cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDraw3DLatheObject &&
241cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject &&
242cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape &&
243cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
244cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	const bool bObjSupportsStyle =
247cdf0e10cSrcweir 		aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape;
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	sal_Bool bIsEmptyPresObj = sal_False;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY);
252cdf0e10cSrcweir 	if ( aShapeInfo.xCustomShapeReplacement.is() )
253cdf0e10cSrcweir 		xPropSet.clear();
254cdf0e10cSrcweir 
255cdf0e10cSrcweir 	// ----------------
256cdf0e10cSrcweir 	// prep text styles
257cdf0e10cSrcweir 	// ----------------
258cdf0e10cSrcweir 	if( xPropSet.is() && bObjSupportsText )
259cdf0e10cSrcweir 	{
260cdf0e10cSrcweir 		uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY);
261cdf0e10cSrcweir 		if(xText.is() && xText->getString().getLength())
262cdf0e10cSrcweir 		{
263cdf0e10cSrcweir 			uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(msEmptyPres) )
266cdf0e10cSrcweir 			{
267cdf0e10cSrcweir 				uno::Any aAny = xPropSet->getPropertyValue(msEmptyPres);
268cdf0e10cSrcweir 				aAny >>= bIsEmptyPresObj;
269cdf0e10cSrcweir 			}
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 			if(!bIsEmptyPresObj)
272cdf0e10cSrcweir 			{
273cdf0e10cSrcweir 				GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText );
274cdf0e10cSrcweir 			}
275cdf0e10cSrcweir 		}
276cdf0e10cSrcweir 	}
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	// ------------------------------
279cdf0e10cSrcweir 	// compute the shape parent style
280cdf0e10cSrcweir 	// ------------------------------
281cdf0e10cSrcweir 	if( xPropSet.is() )
282cdf0e10cSrcweir 	{
283cdf0e10cSrcweir 		uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() );
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 		OUString aParentName;
286cdf0e10cSrcweir 		uno::Reference< style::XStyle > xStyle;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 		if( bObjSupportsStyle )
289cdf0e10cSrcweir 		{
290cdf0e10cSrcweir 			if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) )
291cdf0e10cSrcweir 				xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) >>= xStyle;
292cdf0e10cSrcweir 
293cdf0e10cSrcweir 			if(xStyle.is())
294cdf0e10cSrcweir 			{
295cdf0e10cSrcweir 				// get family ID
296cdf0e10cSrcweir 				uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY);
297cdf0e10cSrcweir 				DBG_ASSERT( xStylePropSet.is(), "style without a XPropertySet?" );
298cdf0e10cSrcweir                 try
299cdf0e10cSrcweir                 {
300cdf0e10cSrcweir 				    if(xStylePropSet.is())
301cdf0e10cSrcweir 				    {
302cdf0e10cSrcweir 					    OUString aFamilyName;
303cdf0e10cSrcweir     					xStylePropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Family"))) >>= aFamilyName;
304cdf0e10cSrcweir 	    				if(aFamilyName.getLength() && !aFamilyName.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics"))))
305cdf0e10cSrcweir 		    				aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
306cdf0e10cSrcweir 			    	}
307cdf0e10cSrcweir                 }
308cdf0e10cSrcweir                 catch(beans::UnknownPropertyException aException)
309cdf0e10cSrcweir                 {
310cdf0e10cSrcweir                     // Ignored.
311cdf0e10cSrcweir                     DBG_ASSERT(false,
312cdf0e10cSrcweir                         "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property");
313cdf0e10cSrcweir                 }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 				// get parent-style name
316cdf0e10cSrcweir 				if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily)
317cdf0e10cSrcweir 				{
318cdf0e10cSrcweir 					aParentName = msPresentationStylePrefix;
319cdf0e10cSrcweir 				}
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 				aParentName += xStyle->getName();
322cdf0e10cSrcweir 			}
323cdf0e10cSrcweir 		}
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 		// filter propset
326cdf0e10cSrcweir 		std::vector< XMLPropertyState > xPropStates;
327cdf0e10cSrcweir 
328cdf0e10cSrcweir 		sal_Int32 nCount = 0;
329cdf0e10cSrcweir 		if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) )
330cdf0e10cSrcweir 		{
331cdf0e10cSrcweir 			xPropStates = GetPropertySetMapper()->Filter( xPropSet );
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 			if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType)
334cdf0e10cSrcweir 			{
335cdf0e10cSrcweir 				// for control shapes, we additionally need the number format style (if any)
336cdf0e10cSrcweir 				uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY);
337cdf0e10cSrcweir 				DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!");
338cdf0e10cSrcweir 				if (xControl.is())
339cdf0e10cSrcweir 				{
340cdf0e10cSrcweir 					uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY);
341cdf0e10cSrcweir 					DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!");
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 					::rtl::OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel);
344cdf0e10cSrcweir 					if (0 != sNumberStyle.getLength())
345cdf0e10cSrcweir 					{
346cdf0e10cSrcweir 						sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE);
347cdf0e10cSrcweir 							// TODO : this retrieval of the index could be moved into the ctor, holding the index
348cdf0e10cSrcweir 							//			as member, thus saving time.
349cdf0e10cSrcweir 						DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!");
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 						XMLPropertyState aNewState(nIndex, uno::makeAny(sNumberStyle));
352cdf0e10cSrcweir 						xPropStates.push_back(aNewState);
353cdf0e10cSrcweir 					}
354cdf0e10cSrcweir 				}
355cdf0e10cSrcweir 			}
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 			std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
358cdf0e10cSrcweir 			std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
359cdf0e10cSrcweir 			while( aIter != aEnd )
360cdf0e10cSrcweir 			{
361cdf0e10cSrcweir 				if( aIter->mnIndex != -1 )
362cdf0e10cSrcweir 					nCount++;
363cdf0e10cSrcweir 				aIter++;
364cdf0e10cSrcweir 			}
365cdf0e10cSrcweir 		}
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 		if(nCount == 0)
368cdf0e10cSrcweir 		{
369cdf0e10cSrcweir 			// no hard attributes, use parent style name for export
370cdf0e10cSrcweir 			aShapeInfo.msStyleName = aParentName;
371cdf0e10cSrcweir 		}
372cdf0e10cSrcweir 		else
373cdf0e10cSrcweir 		{
374cdf0e10cSrcweir 			// there are filtered properties -> hard attributes
375cdf0e10cSrcweir 			// try to find this style in AutoStylePool
376cdf0e10cSrcweir 			aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, xPropStates);
377cdf0e10cSrcweir 
378cdf0e10cSrcweir 			if(!aShapeInfo.msStyleName.getLength())
379cdf0e10cSrcweir 			{
380cdf0e10cSrcweir 				// Style did not exist, add it to AutoStalePool
381cdf0e10cSrcweir 				aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, xPropStates);
382cdf0e10cSrcweir 			}
383cdf0e10cSrcweir 		}
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 		// optionaly generate auto style for text attributes
386cdf0e10cSrcweir 		if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText )
387cdf0e10cSrcweir 		{
388cdf0e10cSrcweir 			xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet );
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 			// ----------------------------------------------------------------------
391cdf0e10cSrcweir 			// yet more additionally, we need to care for the ParaAdjust property
392cdf0e10cSrcweir 			if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType )
393cdf0e10cSrcweir 			{
394cdf0e10cSrcweir 				uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
395cdf0e10cSrcweir 				uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
396cdf0e10cSrcweir                 if ( xPropSetInfo.is() && xPropState.is() )
397cdf0e10cSrcweir                 {
398cdf0e10cSrcweir 				    // this is because:
399cdf0e10cSrcweir 				    // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model
400cdf0e10cSrcweir 				    // * control models are allowed to have an Align of "void"
401cdf0e10cSrcweir 				    // * the Default for control model's Align is TextAlign_LEFT
402cdf0e10cSrcweir 				    // * defaults for style properties are not written, but we need to write the "left",
403cdf0e10cSrcweir 				    //   because we need to distiguish this "left" from the case where not align attribute
404cdf0e10cSrcweir 				    //   is present which means "void"
405cdf0e10cSrcweir 				    // 102407 - 2002-11-01 - fs@openoffice.org
406cdf0e10cSrcweir 				    static const ::rtl::OUString s_sParaAdjustPropertyName( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) );
407cdf0e10cSrcweir 				    if  (   xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName )
408cdf0e10cSrcweir                         &&  ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) )
409cdf0e10cSrcweir                         )
410cdf0e10cSrcweir 					{
411cdf0e10cSrcweir 						sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST );
412cdf0e10cSrcweir 							// TODO : this retrieval of the index should be moved into the ctor, holding the index
413cdf0e10cSrcweir 							//			as member, thus saving time.
414cdf0e10cSrcweir 						DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!");
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 						uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName );
417cdf0e10cSrcweir 						XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue );
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 						xPropStates.push_back( aAlignDefaultState );
420cdf0e10cSrcweir 					}
421cdf0e10cSrcweir                 }
422cdf0e10cSrcweir 			}
423cdf0e10cSrcweir 			// ----------------------------------------------------------------------
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 			nCount = 0;
426cdf0e10cSrcweir 			std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin();
427cdf0e10cSrcweir 			std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end();
428cdf0e10cSrcweir 			while( aIter != aEnd )
429cdf0e10cSrcweir 			{
430cdf0e10cSrcweir 				if( aIter->mnIndex != -1 )
431cdf0e10cSrcweir 					nCount++;
432cdf0e10cSrcweir 				aIter++;
433cdf0e10cSrcweir 			}
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 			if( nCount )
436cdf0e10cSrcweir 			{
437cdf0e10cSrcweir 				const OUString aEmpty;
438cdf0e10cSrcweir 				aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates );
439cdf0e10cSrcweir 				if(!aShapeInfo.msTextStyleName.getLength())
440cdf0e10cSrcweir 				{
441cdf0e10cSrcweir 					// Style did not exist, add it to AutoStalePool
442cdf0e10cSrcweir 					aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates);
443cdf0e10cSrcweir 				}
444cdf0e10cSrcweir 			}
445cdf0e10cSrcweir 		}
446cdf0e10cSrcweir 	}
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 	// ----------------------------------------
449cdf0e10cSrcweir 	// prepare animation informations if needed
450cdf0e10cSrcweir 	// ----------------------------------------
451cdf0e10cSrcweir 	if( mxAnimationsExporter.is() )
452cdf0e10cSrcweir 		mxAnimationsExporter->prepare( xShape, mrExport );
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 	// check for special shapes
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 	switch( aShapeInfo.meShapeType )
457cdf0e10cSrcweir 	{
458cdf0e10cSrcweir 		case XmlShapeTypeDrawConnectorShape:
459cdf0e10cSrcweir 		{
460cdf0e10cSrcweir 			uno::Reference< uno::XInterface > xConnection;
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 			// create shape ids for export later
463cdf0e10cSrcweir 			xPropSet->getPropertyValue( msStartShape ) >>= xConnection;
464cdf0e10cSrcweir 			if( xConnection.is() )
465cdf0e10cSrcweir 				mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
466cdf0e10cSrcweir 
467cdf0e10cSrcweir 			xPropSet->getPropertyValue( msEndShape ) >>= xConnection;
468cdf0e10cSrcweir 			if( xConnection.is() )
469cdf0e10cSrcweir 				mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection );
470cdf0e10cSrcweir 			break;
471cdf0e10cSrcweir 		}
472cdf0e10cSrcweir 		case XmlShapeTypePresTableShape:
473cdf0e10cSrcweir 		case XmlShapeTypeDrawTableShape:
474cdf0e10cSrcweir 		{
475cdf0e10cSrcweir 			try
476cdf0e10cSrcweir 			{
477cdf0e10cSrcweir 				uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW );
478cdf0e10cSrcweir 				GetShapeTableExport()->collectTableAutoStyles( xRange );
479cdf0e10cSrcweir 			}
480cdf0e10cSrcweir 			catch( uno::Exception& )
481cdf0e10cSrcweir 			{
482cdf0e10cSrcweir 				DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" );
483cdf0e10cSrcweir 			}
484cdf0e10cSrcweir 			break;
485cdf0e10cSrcweir 		}
486cdf0e10cSrcweir 		default:
487cdf0e10cSrcweir 			break;
488cdf0e10cSrcweir 	}
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 	maShapeInfos.push_back( aShapeInfo );
491cdf0e10cSrcweir 	maCurrentInfo = maShapeInfos.begin();
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 	// -----------------------------------------------------
494cdf0e10cSrcweir 	// check for shape collections (group shape or 3d scene)
495cdf0e10cSrcweir 	// and collect contained shapes style infos
496cdf0e10cSrcweir 	// -----------------------------------------------------
497cdf0e10cSrcweir 	const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is()
498cdf0e10cSrcweir 												? aShapeInfo.xCustomShapeReplacement : xShape;
499cdf0e10cSrcweir 	{
500cdf0e10cSrcweir 		uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY );
501cdf0e10cSrcweir 		if( xShapes.is() )
502cdf0e10cSrcweir 		{
503cdf0e10cSrcweir 			collectShapesAutoStyles( xShapes );
504cdf0e10cSrcweir 		}
505cdf0e10cSrcweir 	}
506cdf0e10cSrcweir }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
509cdf0e10cSrcweir 
510cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists#
511cdf0e10cSrcweir namespace
512cdf0e10cSrcweir {
513cdf0e10cSrcweir     class NewTextListsHelper
514cdf0e10cSrcweir     {
515cdf0e10cSrcweir         public:
NewTextListsHelper(SvXMLExport & rExp)516cdf0e10cSrcweir             NewTextListsHelper( SvXMLExport& rExp )
517cdf0e10cSrcweir                 : mrExport( rExp )
518cdf0e10cSrcweir             {
519cdf0e10cSrcweir                 mrExport.GetTextParagraphExport()->PushNewTextListsHelper();
520cdf0e10cSrcweir             }
521cdf0e10cSrcweir 
~NewTextListsHelper()522cdf0e10cSrcweir             ~NewTextListsHelper()
523cdf0e10cSrcweir             {
524cdf0e10cSrcweir                 mrExport.GetTextParagraphExport()->PopTextListsHelper();
525cdf0e10cSrcweir             }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir         private:
528cdf0e10cSrcweir             SvXMLExport& mrExport;
529cdf0e10cSrcweir     };
530cdf0e10cSrcweir }
531cdf0e10cSrcweir // This method exports the given XShape
exportShape(const uno::Reference<drawing::XShape> & xShape,sal_Int32 nFeatures,com::sun::star::awt::Point * pRefPoint,SvXMLAttributeList * pAttrList)532cdf0e10cSrcweir void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape,
533cdf0e10cSrcweir 								 sal_Int32 nFeatures /* = SEF_DEFAULT */,
534cdf0e10cSrcweir 								 com::sun::star::awt::Point* pRefPoint /* = NULL */,
535cdf0e10cSrcweir                                  SvXMLAttributeList* pAttrList /* = NULL */ )
536cdf0e10cSrcweir {
537cdf0e10cSrcweir     if( maCurrentShapesIter == maShapesInfos.end() )
538cdf0e10cSrcweir 	{
539cdf0e10cSrcweir 		DBG_ERROR( "XMLShapeExport::exportShape(): no auto styles where collected before export" );
540cdf0e10cSrcweir 		return;
541cdf0e10cSrcweir 	}
542cdf0e10cSrcweir 	sal_Int32 nZIndex = 0;
543cdf0e10cSrcweir 	uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	::std::auto_ptr< SvXMLElementExport >  mpHyperlinkElement;
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	// export hyperlinks with <a><shape/></a>. Currently only in draw since draw
549cdf0e10cSrcweir 	// does not support document events
550cdf0e10cSrcweir 	if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try
551cdf0e10cSrcweir 	{
552cdf0e10cSrcweir 		presentation::ClickAction eAction = presentation::ClickAction_NONE;
553cdf0e10cSrcweir 		xSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("OnClick"))) >>= eAction;
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 		if( (eAction == presentation::ClickAction_DOCUMENT) ||
556cdf0e10cSrcweir 			(eAction == presentation::ClickAction_BOOKMARK) )
557cdf0e10cSrcweir 		{
558cdf0e10cSrcweir 			OUString sURL;
559cdf0e10cSrcweir 			xSet->getPropertyValue(msBookmark) >>= sURL;
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 			if( sURL.getLength() )
562cdf0e10cSrcweir 			{
563cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL );
564cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
565cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED );
566cdf0e10cSrcweir 				mpHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, sal_True, sal_True) );
567cdf0e10cSrcweir 			}
568cdf0e10cSrcweir 		}
569cdf0e10cSrcweir 	}
570cdf0e10cSrcweir 	catch( uno::Exception& )
571cdf0e10cSrcweir 	{
572cdf0e10cSrcweir 		DBG_ERROR("XMLShapeExport::exportShape(): exception during hyperlink export");
573cdf0e10cSrcweir 	}
574cdf0e10cSrcweir 
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 	if( xSet.is() )
577cdf0e10cSrcweir 		xSet->getPropertyValue(msZIndex) >>= nZIndex;
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 	ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second;
580cdf0e10cSrcweir 
581cdf0e10cSrcweir 	if( (sal_Int32)aShapeInfoVector.size() <= nZIndex )
582cdf0e10cSrcweir 	{
583cdf0e10cSrcweir 		DBG_ERROR( "XMLShapeExport::exportShape(): no shape info collected for a given shape" );
584cdf0e10cSrcweir 		return;
585cdf0e10cSrcweir 	}
586cdf0e10cSrcweir 
587cdf0e10cSrcweir     // --> OD 2008-05-08 #refactorlists#
588cdf0e10cSrcweir     NewTextListsHelper aNewTextListsHelper( mrExport );
589cdf0e10cSrcweir     // <--
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 	const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex];
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 
594cdf0e10cSrcweir #ifdef DBG_UTIL
595cdf0e10cSrcweir 	// ---------------------------------------
596cdf0e10cSrcweir 	// check if this is the correct ShapesInfo
597cdf0e10cSrcweir 	// ---------------------------------------
598cdf0e10cSrcweir 	uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY );
599cdf0e10cSrcweir 	if( xChild.is() )
600cdf0e10cSrcweir 	{
601cdf0e10cSrcweir 		uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY );
602cdf0e10cSrcweir 		DBG_ASSERT( xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" );
603cdf0e10cSrcweir 	}
604cdf0e10cSrcweir 
605cdf0e10cSrcweir 	// -----------------------------
606cdf0e10cSrcweir 	// first compute the shapes type
607cdf0e10cSrcweir 	// -----------------------------
608cdf0e10cSrcweir 	{
609cdf0e10cSrcweir 		XmlShapeType eShapeType(XmlShapeTypeNotYetSet);
610cdf0e10cSrcweir 		ImpCalcShapeType(xShape, eShapeType);
611cdf0e10cSrcweir 
612cdf0e10cSrcweir 		DBG_ASSERT( eShapeType == aShapeInfo.meShapeType, "exportShape callings do not correspond to collectShapeAutoStyles calls!" );
613cdf0e10cSrcweir 	}
614cdf0e10cSrcweir #endif
615cdf0e10cSrcweir 
616cdf0e10cSrcweir 	// ----------------------------------------
617cdf0e10cSrcweir 	// collect animation informations if needed
618cdf0e10cSrcweir 	// ----------------------------------------
619cdf0e10cSrcweir 	if( mxAnimationsExporter.is() )
620cdf0e10cSrcweir 		mxAnimationsExporter->collect( xShape, mrExport );
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 	// -------------------------------
623cdf0e10cSrcweir 	// export shapes name if he has one
624cdf0e10cSrcweir     // --> OD 2006-03-13 #i51726#
625cdf0e10cSrcweir     // Export of the shape name for text documents only if the OpenDocument
626cdf0e10cSrcweir     // file format is written - exceptions are group shapes.
627cdf0e10cSrcweir     // Note: Writer documents in OpenOffice.org file format doesn't contain
628cdf0e10cSrcweir     //       any names for shapes, except for group shapes.
629cdf0e10cSrcweir 	// -------------------------------
630cdf0e10cSrcweir 	{
631cdf0e10cSrcweir         // --> OD 2006-03-10 #i51726#
632cdf0e10cSrcweir         if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER &&
633cdf0e10cSrcweir                GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB &&
634cdf0e10cSrcweir                GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) ||
635cdf0e10cSrcweir              ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 ||
636cdf0e10cSrcweir              aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape ||
637cdf0e10cSrcweir              ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape &&
638cdf0e10cSrcweir                aShapeInfo.xCustomShapeReplacement.is() ) )
639cdf0e10cSrcweir         {
640cdf0e10cSrcweir             uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY );
641cdf0e10cSrcweir             if( xNamed.is() )
642cdf0e10cSrcweir             {
643cdf0e10cSrcweir                 const OUString aName( xNamed->getName() );
644cdf0e10cSrcweir                 if( aName.getLength() )
645cdf0e10cSrcweir                     mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, aName );
646cdf0e10cSrcweir             }
647cdf0e10cSrcweir         }
648cdf0e10cSrcweir         // <--
649cdf0e10cSrcweir 	}
650cdf0e10cSrcweir 
651cdf0e10cSrcweir 	// ------------------
652cdf0e10cSrcweir 	// export style name
653cdf0e10cSrcweir 	// ------------------
654cdf0e10cSrcweir 	if( aShapeInfo.msStyleName.getLength() != 0 )
655cdf0e10cSrcweir 	{
656cdf0e10cSrcweir 		if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily)
657cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
658cdf0e10cSrcweir 		else
659cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) );
660cdf0e10cSrcweir 	}
661cdf0e10cSrcweir 
662cdf0e10cSrcweir 	// ------------------
663cdf0e10cSrcweir 	// export text style name
664cdf0e10cSrcweir 	// ------------------
665cdf0e10cSrcweir 	if( aShapeInfo.msTextStyleName.getLength() != 0 )
666cdf0e10cSrcweir 	{
667cdf0e10cSrcweir 		mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TEXT_STYLE_NAME, aShapeInfo.msTextStyleName );
668cdf0e10cSrcweir 	}
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 	// --------------------------
671cdf0e10cSrcweir 	// export shapes id if needed
672cdf0e10cSrcweir 	// --------------------------
673cdf0e10cSrcweir 	{
674cdf0e10cSrcweir 		uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY );
675cdf0e10cSrcweir 		const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef );
676cdf0e10cSrcweir 		if( rShapeId.getLength() )
677cdf0e10cSrcweir         {
678cdf0e10cSrcweir             mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId);
679cdf0e10cSrcweir         }
680cdf0e10cSrcweir 	}
681cdf0e10cSrcweir 
682cdf0e10cSrcweir 	// --------------------------
683cdf0e10cSrcweir 	// export layer information
684cdf0e10cSrcweir 	// --------------------------
685cdf0e10cSrcweir 	if( IsLayerExportEnabled() )
686cdf0e10cSrcweir 	{
687cdf0e10cSrcweir 		// check for group or scene shape and not export layer if this is one
688cdf0e10cSrcweir 		uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY );
689cdf0e10cSrcweir 		if( !xShapes.is() )
690cdf0e10cSrcweir 		{
691cdf0e10cSrcweir 			try
692cdf0e10cSrcweir 			{
693cdf0e10cSrcweir 				uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY );
694cdf0e10cSrcweir 				OUString aLayerName;
695cdf0e10cSrcweir 				xProps->getPropertyValue( OUString::createFromAscii( "LayerName" ) ) >>= aLayerName;
696cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 			}
699cdf0e10cSrcweir 			catch( uno::Exception e )
700cdf0e10cSrcweir 			{
701cdf0e10cSrcweir 				DBG_ERROR( "could not export layer name for shape!" );
702cdf0e10cSrcweir 			}
703cdf0e10cSrcweir 		}
704cdf0e10cSrcweir 	}
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	// export draw:display (do not export in ODF 1.2 or older)
707cdf0e10cSrcweir 	if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) )
708cdf0e10cSrcweir 	{
709cdf0e10cSrcweir 		if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape &&
710cdf0e10cSrcweir 			aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape )
711cdf0e10cSrcweir 
712cdf0e10cSrcweir 		try
713cdf0e10cSrcweir 		{
714cdf0e10cSrcweir 			sal_Bool bVisible = sal_True;
715cdf0e10cSrcweir 			sal_Bool bPrintable = sal_True;
716cdf0e10cSrcweir 
717cdf0e10cSrcweir 			xSet->getPropertyValue(msVisible) >>= bVisible;
718cdf0e10cSrcweir 			xSet->getPropertyValue(msPrintable) >>= bPrintable;
719cdf0e10cSrcweir 
720cdf0e10cSrcweir 			XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID;
721cdf0e10cSrcweir 			const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0);
722cdf0e10cSrcweir 			switch( nDisplay )
723cdf0e10cSrcweir 			{
724cdf0e10cSrcweir 			case 0: eDisplayToken = XML_NONE; break;
725cdf0e10cSrcweir 			case 1: eDisplayToken = XML_PRINTER; break;
726cdf0e10cSrcweir 			case 2: eDisplayToken = XML_SCREEN; break;
727cdf0e10cSrcweir 			// case 3: eDisplayToken = XML_ALWAYS break; this is the default
728cdf0e10cSrcweir 			}
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 			if( eDisplayToken != XML_TOKEN_INVALID )
731cdf0e10cSrcweir 				mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken );
732cdf0e10cSrcweir 		}
733cdf0e10cSrcweir 		catch( uno::Exception& )
734cdf0e10cSrcweir 		{
735cdf0e10cSrcweir 			DBG_ERROR( "XMLShapeExport::exportShape(), exception caught!" );
736cdf0e10cSrcweir 		}
737cdf0e10cSrcweir 	}
738cdf0e10cSrcweir 
739cdf0e10cSrcweir 	// #82003# test export count
740cdf0e10cSrcweir 	// #91587# ALWAYS increment since now ALL to be exported shapes are counted.
741cdf0e10cSrcweir 	if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled())
742cdf0e10cSrcweir 	{
743cdf0e10cSrcweir 		mrExport.GetProgressBarHelper()->Increment();
744cdf0e10cSrcweir 	}
745cdf0e10cSrcweir 
746cdf0e10cSrcweir 	onExport( xShape );
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 	// --------------------
749cdf0e10cSrcweir 	// export shape element
750cdf0e10cSrcweir 	// --------------------
751cdf0e10cSrcweir 	switch(aShapeInfo.meShapeType)
752cdf0e10cSrcweir 	{
753cdf0e10cSrcweir 		case XmlShapeTypeDrawRectangleShape:
754cdf0e10cSrcweir 		{
755cdf0e10cSrcweir 			ImpExportRectangleShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
756cdf0e10cSrcweir 			break;
757cdf0e10cSrcweir 		}
758cdf0e10cSrcweir 		case XmlShapeTypeDrawEllipseShape:
759cdf0e10cSrcweir 		{
760cdf0e10cSrcweir 			ImpExportEllipseShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
761cdf0e10cSrcweir 			break;
762cdf0e10cSrcweir 		}
763cdf0e10cSrcweir 		case XmlShapeTypeDrawLineShape:
764cdf0e10cSrcweir 		{
765cdf0e10cSrcweir 			ImpExportLineShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
766cdf0e10cSrcweir 			break;
767cdf0e10cSrcweir 		}
768cdf0e10cSrcweir 		case XmlShapeTypeDrawPolyPolygonShape:	// closed PolyPolygon
769cdf0e10cSrcweir 		case XmlShapeTypeDrawPolyLineShape:		// open PolyPolygon
770cdf0e10cSrcweir 		case XmlShapeTypeDrawClosedBezierShape:	// closed PolyPolygon containing curves
771cdf0e10cSrcweir 		case XmlShapeTypeDrawOpenBezierShape:	// open PolyPolygon containing curves
772cdf0e10cSrcweir 		{
773cdf0e10cSrcweir 			ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
774cdf0e10cSrcweir 			break;
775cdf0e10cSrcweir 		}
776cdf0e10cSrcweir 
777cdf0e10cSrcweir 		case XmlShapeTypeDrawTextShape:
778cdf0e10cSrcweir 		case XmlShapeTypePresTitleTextShape:
779cdf0e10cSrcweir 		case XmlShapeTypePresOutlinerShape:
780cdf0e10cSrcweir 		case XmlShapeTypePresSubtitleShape:
781cdf0e10cSrcweir 		case XmlShapeTypePresNotesShape:
782cdf0e10cSrcweir 		case XmlShapeTypePresHeaderShape:
783cdf0e10cSrcweir 		case XmlShapeTypePresFooterShape:
784cdf0e10cSrcweir 		case XmlShapeTypePresSlideNumberShape:
785cdf0e10cSrcweir 		case XmlShapeTypePresDateTimeShape:
786cdf0e10cSrcweir 		{
787cdf0e10cSrcweir 			ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
788cdf0e10cSrcweir 			break;
789cdf0e10cSrcweir 		}
790cdf0e10cSrcweir 
791cdf0e10cSrcweir 		case XmlShapeTypeDrawGraphicObjectShape:
792cdf0e10cSrcweir 		case XmlShapeTypePresGraphicObjectShape:
793cdf0e10cSrcweir 		{
794cdf0e10cSrcweir 			ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
795cdf0e10cSrcweir 			break;
796cdf0e10cSrcweir 		}
797cdf0e10cSrcweir 
798cdf0e10cSrcweir 		case XmlShapeTypeDrawChartShape:
799cdf0e10cSrcweir 		case XmlShapeTypePresChartShape:
800cdf0e10cSrcweir 		{
801cdf0e10cSrcweir 			ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList );
802cdf0e10cSrcweir 			break;
803cdf0e10cSrcweir 		}
804cdf0e10cSrcweir 
805cdf0e10cSrcweir 		case XmlShapeTypeDrawControlShape:
806cdf0e10cSrcweir 		{
807cdf0e10cSrcweir 			ImpExportControlShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
808cdf0e10cSrcweir 			break;
809cdf0e10cSrcweir 		}
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 		case XmlShapeTypeDrawConnectorShape:
812cdf0e10cSrcweir 		{
813cdf0e10cSrcweir 			ImpExportConnectorShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
814cdf0e10cSrcweir 			break;
815cdf0e10cSrcweir 		}
816cdf0e10cSrcweir 
817cdf0e10cSrcweir 		case XmlShapeTypeDrawMeasureShape:
818cdf0e10cSrcweir 		{
819cdf0e10cSrcweir 			ImpExportMeasureShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
820cdf0e10cSrcweir 			break;
821cdf0e10cSrcweir 		}
822cdf0e10cSrcweir 
823cdf0e10cSrcweir 		case XmlShapeTypeDrawOLE2Shape:
824cdf0e10cSrcweir 		case XmlShapeTypePresOLE2Shape:
825cdf0e10cSrcweir 		case XmlShapeTypeDrawSheetShape:
826cdf0e10cSrcweir 		case XmlShapeTypePresSheetShape:
827cdf0e10cSrcweir 		{
828cdf0e10cSrcweir 			ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
829cdf0e10cSrcweir 			break;
830cdf0e10cSrcweir 		}
831cdf0e10cSrcweir 
832cdf0e10cSrcweir 		case XmlShapeTypePresTableShape:
833cdf0e10cSrcweir 		case XmlShapeTypeDrawTableShape:
834cdf0e10cSrcweir 		{
835cdf0e10cSrcweir 			ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
836cdf0e10cSrcweir 			break;
837cdf0e10cSrcweir 		}
838cdf0e10cSrcweir 
839cdf0e10cSrcweir 		case XmlShapeTypeDrawPageShape:
840cdf0e10cSrcweir 		case XmlShapeTypePresPageShape:
841cdf0e10cSrcweir 		case XmlShapeTypeHandoutShape:
842cdf0e10cSrcweir 		{
843cdf0e10cSrcweir 			ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
844cdf0e10cSrcweir 			break;
845cdf0e10cSrcweir 		}
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 		case XmlShapeTypeDrawCaptionShape:
848cdf0e10cSrcweir 		{
849cdf0e10cSrcweir 			ImpExportCaptionShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
850cdf0e10cSrcweir 			break;
851cdf0e10cSrcweir 		}
852cdf0e10cSrcweir 
853cdf0e10cSrcweir 		case XmlShapeTypeDraw3DCubeObject:
854cdf0e10cSrcweir 		case XmlShapeTypeDraw3DSphereObject:
855cdf0e10cSrcweir 		case XmlShapeTypeDraw3DLatheObject:
856cdf0e10cSrcweir 		case XmlShapeTypeDraw3DExtrudeObject:
857cdf0e10cSrcweir 		{
858cdf0e10cSrcweir 			ImpExport3DShape(xShape, aShapeInfo.meShapeType);
859cdf0e10cSrcweir 			break;
860cdf0e10cSrcweir 		}
861cdf0e10cSrcweir 
862cdf0e10cSrcweir 		case XmlShapeTypeDraw3DSceneObject:
863cdf0e10cSrcweir 		{
864cdf0e10cSrcweir 			ImpExport3DSceneShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
865cdf0e10cSrcweir 			break;
866cdf0e10cSrcweir 		}
867cdf0e10cSrcweir 
868cdf0e10cSrcweir 		case XmlShapeTypeDrawGroupShape:
869cdf0e10cSrcweir 		{
870cdf0e10cSrcweir 			// empty group
871cdf0e10cSrcweir 			ImpExportGroupShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
872cdf0e10cSrcweir 			break;
873cdf0e10cSrcweir 		}
874cdf0e10cSrcweir 
875cdf0e10cSrcweir 		case XmlShapeTypeDrawFrameShape:
876cdf0e10cSrcweir 		{
877cdf0e10cSrcweir 			ImpExportFrameShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
878cdf0e10cSrcweir 			break;
879cdf0e10cSrcweir 		}
880cdf0e10cSrcweir 
881cdf0e10cSrcweir 		case XmlShapeTypeDrawAppletShape:
882cdf0e10cSrcweir 		{
883cdf0e10cSrcweir 			ImpExportAppletShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
884cdf0e10cSrcweir 			break;
885cdf0e10cSrcweir 		}
886cdf0e10cSrcweir 
887cdf0e10cSrcweir 		case XmlShapeTypeDrawPluginShape:
888cdf0e10cSrcweir 		{
889cdf0e10cSrcweir 			ImpExportPluginShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
890cdf0e10cSrcweir 			break;
891cdf0e10cSrcweir 		}
892cdf0e10cSrcweir 
893cdf0e10cSrcweir 		case XmlShapeTypeDrawCustomShape:
894cdf0e10cSrcweir 		{
895cdf0e10cSrcweir 			if ( aShapeInfo.xCustomShapeReplacement.is() )
896cdf0e10cSrcweir 				ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint );
897cdf0e10cSrcweir 			else
898cdf0e10cSrcweir 				ImpExportCustomShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
899cdf0e10cSrcweir 			break;
900cdf0e10cSrcweir 		}
901cdf0e10cSrcweir 
902cdf0e10cSrcweir 		case XmlShapeTypePresMediaShape:
903cdf0e10cSrcweir 		case XmlShapeTypeDrawMediaShape:
904cdf0e10cSrcweir 		{
905cdf0e10cSrcweir 			ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint );
906cdf0e10cSrcweir 			break;
907cdf0e10cSrcweir 		}
908cdf0e10cSrcweir 
909cdf0e10cSrcweir 		case XmlShapeTypePresOrgChartShape:
910cdf0e10cSrcweir 		case XmlShapeTypeUnknown:
911cdf0e10cSrcweir 		case XmlShapeTypeNotYetSet:
912cdf0e10cSrcweir 		default:
913cdf0e10cSrcweir 		{
914cdf0e10cSrcweir 			// this should never happen and is an error
915cdf0e10cSrcweir 			DBG_ERROR("XMLEXP: WriteShape: unknown or unexpected type of shape in export!");
916cdf0e10cSrcweir 			break;
917cdf0e10cSrcweir 		}
918cdf0e10cSrcweir 	}
919cdf0e10cSrcweir 
920cdf0e10cSrcweir 	mpHyperlinkElement.reset();
921cdf0e10cSrcweir 
922cdf0e10cSrcweir 	// #97489# #97111#
923cdf0e10cSrcweir 	// if there was an error and no element for the shape was exported
924cdf0e10cSrcweir 	// we need to clear the attribute list or the attributes will be
925cdf0e10cSrcweir 	// set on the next exported element, which can result in corrupt
926cdf0e10cSrcweir 	// xml files due to duplicate attributes
927cdf0e10cSrcweir 
928cdf0e10cSrcweir 	mrExport.CheckAttrList();	// asserts in non pro if we have attributes left
929cdf0e10cSrcweir 	mrExport.ClearAttrList();	// clears the attributes
930cdf0e10cSrcweir }
931cdf0e10cSrcweir 
932cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
933cdf0e10cSrcweir 
934cdf0e10cSrcweir // This method collects all automatic styles for the shapes inside the given XShapes collection
collectShapesAutoStyles(const uno::Reference<drawing::XShapes> & xShapes)935cdf0e10cSrcweir void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes )
936cdf0e10cSrcweir {
937cdf0e10cSrcweir 	ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
938cdf0e10cSrcweir 	seekShapes( xShapes );
939cdf0e10cSrcweir 
940cdf0e10cSrcweir 	uno::Reference< drawing::XShape > xShape;
941cdf0e10cSrcweir 	const sal_Int32 nShapeCount(xShapes->getCount());
942cdf0e10cSrcweir 	for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
943cdf0e10cSrcweir 	{
944cdf0e10cSrcweir 		xShapes->getByIndex(nShapeId) >>= xShape;
945cdf0e10cSrcweir 		DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
946cdf0e10cSrcweir 		if(!xShape.is())
947cdf0e10cSrcweir 			continue;
948cdf0e10cSrcweir 
949cdf0e10cSrcweir 		collectShapeAutoStyles( xShape );
950cdf0e10cSrcweir 	}
951cdf0e10cSrcweir 
952cdf0e10cSrcweir 	maCurrentShapesIter = aOldCurrentShapesIter;
953cdf0e10cSrcweir }
954cdf0e10cSrcweir 
955cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
956cdf0e10cSrcweir 
957cdf0e10cSrcweir // This method exports all XShape inside the given XShapes collection
exportShapes(const uno::Reference<drawing::XShapes> & xShapes,sal_Int32 nFeatures,awt::Point * pRefPoint)958cdf0e10cSrcweir void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ )
959cdf0e10cSrcweir {
960cdf0e10cSrcweir 	ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter;
961cdf0e10cSrcweir 	seekShapes( xShapes );
962cdf0e10cSrcweir 
963cdf0e10cSrcweir 	uno::Reference< drawing::XShape > xShape;
964cdf0e10cSrcweir 	const sal_Int32 nShapeCount(xShapes->getCount());
965cdf0e10cSrcweir 	for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++)
966cdf0e10cSrcweir 	{
967cdf0e10cSrcweir 		xShapes->getByIndex(nShapeId) >>= xShape;
968cdf0e10cSrcweir 		DBG_ASSERT( xShape.is(), "Shape without a XShape?" );
969cdf0e10cSrcweir 		if(!xShape.is())
970cdf0e10cSrcweir 			continue;
971cdf0e10cSrcweir 
972cdf0e10cSrcweir 		exportShape( xShape, nFeatures, pRefPoint );
973cdf0e10cSrcweir 	}
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 	maCurrentShapesIter = aOldCurrentShapesIter;
976cdf0e10cSrcweir }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
979cdf0e10cSrcweir 
seekShapes(const uno::Reference<drawing::XShapes> & xShapes)980cdf0e10cSrcweir void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) throw()
981cdf0e10cSrcweir {
982cdf0e10cSrcweir 	if( xShapes.is() )
983cdf0e10cSrcweir 	{
984cdf0e10cSrcweir 		maCurrentShapesIter = maShapesInfos.find( xShapes );
985cdf0e10cSrcweir 		if( maCurrentShapesIter == maShapesInfos.end() )
986cdf0e10cSrcweir 		{
987cdf0e10cSrcweir 			ImplXMLShapeExportInfoVector aNewInfoVector;
988cdf0e10cSrcweir 			aNewInfoVector.resize( (ShapesInfos::size_type) xShapes->getCount() );
989cdf0e10cSrcweir 			maShapesInfos[ xShapes ] = aNewInfoVector;
990cdf0e10cSrcweir 
991cdf0e10cSrcweir 			maCurrentShapesIter = maShapesInfos.find( xShapes );
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 			DBG_ASSERT( maCurrentShapesIter != maShapesInfos.end(), "XMLShapeExport::seekShapes(): insert into stl::map failed" );
994cdf0e10cSrcweir 		}
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 		DBG_ASSERT( (*maCurrentShapesIter).second.size() == (ShapesInfos::size_type)xShapes->getCount(), "XMLShapeExport::seekShapes(): XShapes size varied between calls" );
997cdf0e10cSrcweir 
998cdf0e10cSrcweir 	}
999cdf0e10cSrcweir 	else
1000cdf0e10cSrcweir 	{
1001cdf0e10cSrcweir 		maCurrentShapesIter = maShapesInfos.end();
1002cdf0e10cSrcweir 	}
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
1006cdf0e10cSrcweir 
exportAutoStyles()1007cdf0e10cSrcweir void XMLShapeExport::exportAutoStyles()
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir 	// export all autostyle infos
1010cdf0e10cSrcweir 
1011cdf0e10cSrcweir 	// ...for graphic
1012cdf0e10cSrcweir //	if(IsFamilyGraphicUsed())
1013cdf0e10cSrcweir 	{
1014cdf0e10cSrcweir 		GetExport().GetAutoStylePool()->exportXML(
1015cdf0e10cSrcweir 			XML_STYLE_FAMILY_SD_GRAPHICS_ID
1016cdf0e10cSrcweir             , GetExport().GetDocHandler(),
1017cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter(),
1018cdf0e10cSrcweir 			GetExport().GetNamespaceMap()
1019cdf0e10cSrcweir             );
1020cdf0e10cSrcweir 	}
1021cdf0e10cSrcweir 
1022cdf0e10cSrcweir 	// ...for presentation
1023cdf0e10cSrcweir //	if(IsFamilyPresentationUsed())
1024cdf0e10cSrcweir 	{
1025cdf0e10cSrcweir 		GetExport().GetAutoStylePool()->exportXML(
1026cdf0e10cSrcweir 			XML_STYLE_FAMILY_SD_PRESENTATION_ID
1027cdf0e10cSrcweir             , GetExport().GetDocHandler(),
1028cdf0e10cSrcweir 			GetExport().GetMM100UnitConverter(),
1029cdf0e10cSrcweir 			GetExport().GetNamespaceMap()
1030cdf0e10cSrcweir             );
1031cdf0e10cSrcweir 	}
1032cdf0e10cSrcweir 
1033cdf0e10cSrcweir 	if( mxShapeTableExport.is() )
1034cdf0e10cSrcweir 		mxShapeTableExport->exportAutoStyles();
1035cdf0e10cSrcweir }
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir /// returns the export property mapper for external chaining
CreateShapePropMapper(SvXMLExport & rExport)1040cdf0e10cSrcweir SvXMLExportPropertyMapper* XMLShapeExport::CreateShapePropMapper(
1041cdf0e10cSrcweir 	SvXMLExport& rExport )
1042cdf0e10cSrcweir {
1043cdf0e10cSrcweir 	UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rExport.GetModel(), rExport );
1044cdf0e10cSrcweir 	UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory );
1045cdf0e10cSrcweir 	SvXMLExportPropertyMapper* pResult =
1046cdf0e10cSrcweir 		new XMLShapeExportPropertyMapper( xMapper,
1047cdf0e10cSrcweir 										  (XMLTextListAutoStylePool*)&rExport.GetTextParagraphExport()->GetListAutoStylePool(),
1048cdf0e10cSrcweir 										  rExport );
1049cdf0e10cSrcweir 	// chain text attributes
1050cdf0e10cSrcweir 	return pResult;
1051cdf0e10cSrcweir }
1052cdf0e10cSrcweir 
1053cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
1054cdf0e10cSrcweir 
ImpCalcShapeType(const uno::Reference<drawing::XShape> & xShape,XmlShapeType & eShapeType)1055cdf0e10cSrcweir void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape,
1056cdf0e10cSrcweir 	XmlShapeType& eShapeType)
1057cdf0e10cSrcweir {
1058cdf0e10cSrcweir 	// set in every case, so init here
1059cdf0e10cSrcweir 	eShapeType = XmlShapeTypeUnknown;
1060cdf0e10cSrcweir 
1061cdf0e10cSrcweir 	uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY);
1062cdf0e10cSrcweir 	if(xShapeDescriptor.is())
1063cdf0e10cSrcweir 	{
1064cdf0e10cSrcweir 		String aType((OUString)xShapeDescriptor->getShapeType());
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir 		if(aType.EqualsAscii((const sal_Char*)"com.sun.star.", 0, 13))
1067cdf0e10cSrcweir 		{
1068cdf0e10cSrcweir 			if(aType.EqualsAscii("drawing.", 13, 8))
1069cdf0e10cSrcweir 			{
1070cdf0e10cSrcweir 				// drawing shapes
1071cdf0e10cSrcweir 				if     (aType.EqualsAscii("Rectangle", 21, 9)) { eShapeType = XmlShapeTypeDrawRectangleShape; }
1072cdf0e10cSrcweir 
1073cdf0e10cSrcweir 				// #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6.
1074cdf0e10cSrcweir 				// As can be seen at the other compares, the appendix "Shape" is left out of the comparison.
1075cdf0e10cSrcweir 				else if(aType.EqualsAscii("Custom", 21, 6)) { eShapeType = XmlShapeTypeDrawCustomShape; }
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir 				else if(aType.EqualsAscii("Ellipse", 21, 7)) { eShapeType = XmlShapeTypeDrawEllipseShape; }
1078cdf0e10cSrcweir 				else if(aType.EqualsAscii("Control", 21, 7)) { eShapeType = XmlShapeTypeDrawControlShape; }
1079cdf0e10cSrcweir 				else if(aType.EqualsAscii("Connector", 21, 9)) { eShapeType = XmlShapeTypeDrawConnectorShape; }
1080cdf0e10cSrcweir 				else if(aType.EqualsAscii("Measure", 21, 7)) { eShapeType = XmlShapeTypeDrawMeasureShape; }
1081cdf0e10cSrcweir 				else if(aType.EqualsAscii("Line", 21, 4)) { eShapeType = XmlShapeTypeDrawLineShape; }
1082cdf0e10cSrcweir 
1083cdf0e10cSrcweir 				// #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape
1084cdf0e10cSrcweir 				else if(aType.EqualsAscii("PolyPolygon", 21, 11)) { eShapeType = XmlShapeTypeDrawPolyPolygonShape; }
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 				// #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape
1087cdf0e10cSrcweir 				else if(aType.EqualsAscii("PolyLine", 21, 8)) { eShapeType = XmlShapeTypeDrawPolyLineShape; }
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 				else if(aType.EqualsAscii("OpenBezier", 21, 10)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
1090cdf0e10cSrcweir 				else if(aType.EqualsAscii("ClosedBezier", 21, 12)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
1091cdf0e10cSrcweir 
1092cdf0e10cSrcweir 				// #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and
1093cdf0e10cSrcweir 				// ClosedFreeHandShape respectively. Represent them as bezier shapes
1094cdf0e10cSrcweir 				else if(aType.EqualsAscii("OpenFreeHand", 21, 12)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; }
1095cdf0e10cSrcweir 				else if(aType.EqualsAscii("ClosedFreeHand", 21, 14)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; }
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir 				else if(aType.EqualsAscii("GraphicObject", 21, 13)) { eShapeType = XmlShapeTypeDrawGraphicObjectShape; }
1098cdf0e10cSrcweir 				else if(aType.EqualsAscii("Group", 21, 5)) { eShapeType = XmlShapeTypeDrawGroupShape; }
1099cdf0e10cSrcweir 				else if(aType.EqualsAscii("Text", 21, 4)) { eShapeType = XmlShapeTypeDrawTextShape; }
1100cdf0e10cSrcweir 				else if(aType.EqualsAscii("OLE2", 21, 4))
1101cdf0e10cSrcweir 				{
1102cdf0e10cSrcweir 					eShapeType = XmlShapeTypeDrawOLE2Shape;
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir 					// get info about presentation shape
1105cdf0e10cSrcweir 					uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir 					if(xPropSet.is())
1108cdf0e10cSrcweir 					{
1109cdf0e10cSrcweir 						rtl::OUString sCLSID;
1110cdf0e10cSrcweir 						if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
1111cdf0e10cSrcweir 						{
1112cdf0e10cSrcweir 							if (sCLSID.equals(mrExport.GetChartExport()->getChartCLSID()))
1113cdf0e10cSrcweir 							{
1114cdf0e10cSrcweir 								eShapeType = XmlShapeTypeDrawChartShape;
1115cdf0e10cSrcweir 							}
1116cdf0e10cSrcweir 							else if (
1117cdf0e10cSrcweir 								sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName()))
1118cdf0e10cSrcweir 								// #110680#
1119cdf0e10cSrcweir 								// same reaction for binfilter
1120cdf0e10cSrcweir 								|| sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName()))
1121cdf0e10cSrcweir 								)
1122cdf0e10cSrcweir 							{
1123cdf0e10cSrcweir 								eShapeType = XmlShapeTypeDrawSheetShape;
1124cdf0e10cSrcweir 							}
1125cdf0e10cSrcweir 							else
1126cdf0e10cSrcweir 							{
1127cdf0e10cSrcweir 								// general OLE2 Object
1128cdf0e10cSrcweir 							}
1129cdf0e10cSrcweir 						}
1130cdf0e10cSrcweir 					}
1131cdf0e10cSrcweir 				}
1132cdf0e10cSrcweir 				else if(aType.EqualsAscii("Page", 21, 4)) { eShapeType = XmlShapeTypeDrawPageShape; }
1133cdf0e10cSrcweir 				else if(aType.EqualsAscii("Frame", 21, 5)) { eShapeType = XmlShapeTypeDrawFrameShape; }
1134cdf0e10cSrcweir 				else if(aType.EqualsAscii("Caption", 21, 7)) { eShapeType = XmlShapeTypeDrawCaptionShape; }
1135cdf0e10cSrcweir 				else if(aType.EqualsAscii("Plugin", 21, 6)) { eShapeType = XmlShapeTypeDrawPluginShape; }
1136cdf0e10cSrcweir 				else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; }
1137cdf0e10cSrcweir 				else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; }
1138cdf0e10cSrcweir 				else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; }
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir 				// 3D shapes
1141cdf0e10cSrcweir 				else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; }
1142cdf0e10cSrcweir 				else if(aType.EqualsAscii("Cube", 21 + 7, 4)) { eShapeType = XmlShapeTypeDraw3DCubeObject; }
1143cdf0e10cSrcweir 				else if(aType.EqualsAscii("Sphere", 21 + 7, 6)) { eShapeType = XmlShapeTypeDraw3DSphereObject; }
1144cdf0e10cSrcweir 				else if(aType.EqualsAscii("Lathe", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DLatheObject; }
1145cdf0e10cSrcweir 				else if(aType.EqualsAscii("Extrude", 21 + 7, 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; }
1146cdf0e10cSrcweir 			}
1147cdf0e10cSrcweir 			else if(aType.EqualsAscii("presentation.", 13, 13))
1148cdf0e10cSrcweir 			{
1149cdf0e10cSrcweir 				// presentation shapes
1150cdf0e10cSrcweir 				if     (aType.EqualsAscii("TitleText", 26, 9)) { eShapeType = XmlShapeTypePresTitleTextShape; }
1151cdf0e10cSrcweir 				else if(aType.EqualsAscii("Outliner", 26, 8)) { eShapeType = XmlShapeTypePresOutlinerShape;  }
1152cdf0e10cSrcweir 				else if(aType.EqualsAscii("Subtitle", 26, 8)) { eShapeType = XmlShapeTypePresSubtitleShape;  }
1153cdf0e10cSrcweir 				else if(aType.EqualsAscii("GraphicObject", 26, 13)) { eShapeType = XmlShapeTypePresGraphicObjectShape;  }
1154cdf0e10cSrcweir 				else if(aType.EqualsAscii("Page", 26, 4)) { eShapeType = XmlShapeTypePresPageShape;  }
1155cdf0e10cSrcweir 				else if(aType.EqualsAscii("OLE2", 26, 4))
1156cdf0e10cSrcweir 				{
1157cdf0e10cSrcweir 					eShapeType = XmlShapeTypePresOLE2Shape;
1158cdf0e10cSrcweir 
1159cdf0e10cSrcweir 					// get info about presentation shape
1160cdf0e10cSrcweir 					uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY);
1161cdf0e10cSrcweir 
1162cdf0e10cSrcweir 					if(xPropSet.is()) try
1163cdf0e10cSrcweir 					{
1164cdf0e10cSrcweir 						rtl::OUString sCLSID;
1165cdf0e10cSrcweir 						if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID)
1166cdf0e10cSrcweir 						{
1167cdf0e10cSrcweir 							if( sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) ||
1168cdf0e10cSrcweir 								sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) )
1169cdf0e10cSrcweir 							{
1170cdf0e10cSrcweir 								eShapeType = XmlShapeTypePresSheetShape;
1171cdf0e10cSrcweir 							}
1172cdf0e10cSrcweir 						}
1173cdf0e10cSrcweir 					}
1174cdf0e10cSrcweir 					catch( uno::Exception& )
1175cdf0e10cSrcweir 					{
1176cdf0e10cSrcweir 						DBG_ERROR( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" );
1177cdf0e10cSrcweir 					}
1178cdf0e10cSrcweir 				}
1179cdf0e10cSrcweir 				else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape;  }
1180cdf0e10cSrcweir 				else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape;  }
1181cdf0e10cSrcweir 				else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; }
1182cdf0e10cSrcweir 				else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; }
1183cdf0e10cSrcweir 				else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape;  }
1184cdf0e10cSrcweir 				else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; }
1185cdf0e10cSrcweir 				else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; }
1186cdf0e10cSrcweir 				else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; }
1187cdf0e10cSrcweir 				else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; }
1188cdf0e10cSrcweir 				else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; }
1189cdf0e10cSrcweir 				else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; }
1190cdf0e10cSrcweir 			}
1191cdf0e10cSrcweir 		}
1192cdf0e10cSrcweir 	}
1193cdf0e10cSrcweir }
1194cdf0e10cSrcweir 
1195cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////////
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[];
1198cdf0e10cSrcweir extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[];
1199cdf0e10cSrcweir 
1200cdf0e10cSrcweir /** exports all user defined glue points */
ImpExportGluePoints(const uno::Reference<drawing::XShape> & xShape)1201cdf0e10cSrcweir void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape )
1202cdf0e10cSrcweir {
1203cdf0e10cSrcweir 	uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY );
1204cdf0e10cSrcweir 	if( !xSupplier.is() )
1205cdf0e10cSrcweir 		return;
1206cdf0e10cSrcweir 
1207cdf0e10cSrcweir 	uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY );
1208cdf0e10cSrcweir 	if( !xGluePoints.is() )
1209cdf0e10cSrcweir 		return;
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir 	drawing::GluePoint2 aGluePoint;
1212cdf0e10cSrcweir 
1213cdf0e10cSrcweir 	uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() );
1214cdf0e10cSrcweir 
1215cdf0e10cSrcweir 	const sal_Int32 nCount = aIdSequence.getLength();
1216cdf0e10cSrcweir 	for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
1217cdf0e10cSrcweir 	{
1218cdf0e10cSrcweir 		const sal_Int32 nIdentifier = aIdSequence[nIndex];
1219cdf0e10cSrcweir 		if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined )
1220cdf0e10cSrcweir 		{
1221cdf0e10cSrcweir 			// export only user defined glue points
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir 			const OUString sId( OUString::valueOf( nIdentifier ) );
1224cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId );
1225cdf0e10cSrcweir 
1226cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.X);
1227cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear());
1228cdf0e10cSrcweir 
1229cdf0e10cSrcweir 			mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.Y);
1230cdf0e10cSrcweir 			mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear());
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir 			if( !aGluePoint.IsRelative )
1233cdf0e10cSrcweir 			{
1234cdf0e10cSrcweir 				SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.PositionAlignment, aXML_GlueAlignment_EnumMap );
1235cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() );
1236cdf0e10cSrcweir 			}
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir 			if( aGluePoint.Escape != drawing::EscapeDirection_SMART )
1239cdf0e10cSrcweir 			{
1240cdf0e10cSrcweir 				SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.Escape, aXML_GlueEscapeDirection_EnumMap );
1241cdf0e10cSrcweir 				mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ESCAPE_DIRECTION, msBuffer.makeStringAndClear() );
1242cdf0e10cSrcweir 			}
1243cdf0e10cSrcweir 
1244cdf0e10cSrcweir 			SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_DRAW, XML_GLUE_POINT, sal_True, sal_True);
1245cdf0e10cSrcweir 		}
1246cdf0e10cSrcweir 	}
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir 
ExportGraphicDefaults()1249cdf0e10cSrcweir void XMLShapeExport::ExportGraphicDefaults()
1250cdf0e10cSrcweir {
1251cdf0e10cSrcweir 	XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get());
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir 	// construct PropertySetMapper
1254cdf0e10cSrcweir 	UniReference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) );
1255cdf0e10cSrcweir 	((XMLShapeExportPropertyMapper*)xPropertySetMapper.get())->SetAutoStyles( sal_False );
1256cdf0e10cSrcweir 
1257cdf0e10cSrcweir 	// chain text attributes
1258cdf0e10cSrcweir 	xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport));
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir 	// chain special Writer/text frame default attributes
1261cdf0e10cSrcweir     xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport));
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir 	// write graphic family default style
1264cdf0e10cSrcweir 	uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY );
1265cdf0e10cSrcweir 	if( xFact.is() )
1266cdf0e10cSrcweir 	{
1267cdf0e10cSrcweir 		try
1268cdf0e10cSrcweir 		{
1269cdf0e10cSrcweir 			uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), uno::UNO_QUERY );
1270cdf0e10cSrcweir 			if( xDefaults.is() )
1271cdf0e10cSrcweir 			{
1272cdf0e10cSrcweir 				aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper );
1273cdf0e10cSrcweir 
1274cdf0e10cSrcweir 				// write graphic family styles
1275cdf0e10cSrcweir 				aStEx.exportStyleFamily("graphics", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID);
1276cdf0e10cSrcweir 			}
1277cdf0e10cSrcweir 		}
1278cdf0e10cSrcweir 		catch( lang::ServiceNotRegisteredException& )
1279cdf0e10cSrcweir 		{
1280cdf0e10cSrcweir 		}
1281cdf0e10cSrcweir 	}
1282cdf0e10cSrcweir }
1283cdf0e10cSrcweir 
onExport(const com::sun::star::uno::Reference<com::sun::star::drawing::XShape> &)1284cdf0e10cSrcweir void XMLShapeExport::onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& )
1285cdf0e10cSrcweir {
1286cdf0e10cSrcweir }
1287cdf0e10cSrcweir 
GetShapeTableExport()1288cdf0e10cSrcweir const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport()
1289cdf0e10cSrcweir {
1290cdf0e10cSrcweir 	if( !mxShapeTableExport.is() )
1291cdf0e10cSrcweir 	{
1292cdf0e10cSrcweir 		rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) );
1293cdf0e10cSrcweir         UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) );
1294cdf0e10cSrcweir 		rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&mrExport.GetTextParagraphExport()->GetListAutoStylePool(), mrExport ) );
1295cdf0e10cSrcweir 		mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory );
1296cdf0e10cSrcweir 	}
1297cdf0e10cSrcweir 
1298cdf0e10cSrcweir 	return mxShapeTableExport;
1299cdf0e10cSrcweir }
1300