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