LCOV - code coverage report
Current view: top level - xmloff/source/draw - sdxmlexp.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1505 0.0 %
Date: 2014-04-14 Functions: 0 131 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      21             : #include <xmloff/nmspmap.hxx>
      22             : #include <xmloff/xmlnmspe.hxx>
      23             : #include <xmloff/xmluconv.hxx>
      24             : #include <xmloff/xmltoken.hxx>
      25             : #include <xmloff/xmlmetae.hxx>
      26             : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
      27             : #include <com/sun/star/presentation/XPresentationSupplier.hpp>
      28             : #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
      29             : #include <com/sun/star/geometry/RealPoint2D.hpp>
      30             : #include <com/sun/star/task/XStatusIndicatorSupplier.hpp>
      31             : #include <com/sun/star/office/XAnnotationAccess.hpp>
      32             : #include <com/sun/star/lang/Locale.hpp>
      33             : #include <com/sun/star/uno/Any.hxx>
      34             : #include "sdxmlexp_impl.hxx"
      35             : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      36             : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
      37             : #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
      38             : #include <com/sun/star/container/XIndexContainer.hpp>
      39             : #include <com/sun/star/view/PaperOrientation.hpp>
      40             : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      41             : #include <com/sun/star/style/XStyle.hpp>
      42             : 
      43             : #include <com/sun/star/form/XFormsSupplier2.hpp>
      44             : #include <com/sun/star/presentation/XPresentationPage.hpp>
      45             : #include <com/sun/star/drawing/XMasterPageTarget.hpp>
      46             : #include <com/sun/star/text/XText.hpp>
      47             : #include <com/sun/star/chart/XChartDocument.hpp>
      48             : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
      49             : #include <com/sun/star/container/XNamed.hpp>
      50             : #include <com/sun/star/util/Duration.hpp>
      51             : #include <com/sun/star/util/MeasureUnit.hpp>
      52             : #include <rtl/ustrbuf.hxx>
      53             : #include <tools/gen.hxx>
      54             : #include <tools/debug.hxx>
      55             : #include <sax/tools/converter.hxx>
      56             : #include <xmloff/xmlaustp.hxx>
      57             : #include <xmloff/families.hxx>
      58             : #include <xmloff/styleexp.hxx>
      59             : #include <xmloff/settingsstore.hxx>
      60             : #include "sdpropls.hxx"
      61             : #include <xmloff/xmlexppr.hxx>
      62             : #include <com/sun/star/beans/XPropertyState.hpp>
      63             : #include "facreg.hxx"
      64             : #include "xexptran.hxx"
      65             : 
      66             : #include <cppuhelper/implbase1.hxx>
      67             : #include <comphelper/extract.hxx>
      68             : #include <comphelper/processfactory.hxx>
      69             : #include <com/sun/star/lang/XServiceInfo.hpp>
      70             : #include "PropertySetMerger.hxx"
      71             : #include "layerexp.hxx"
      72             : 
      73             : #include "XMLNumberStylesExport.hxx"
      74             : 
      75             : #include <xmloff/animationexport.hxx>
      76             : 
      77             : #include <com/sun/star/document/XDocumentProperties.hpp>
      78             : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      79             : 
      80             : using namespace ::com::sun::star;
      81             : using namespace ::com::sun::star::uno;
      82             : using namespace ::com::sun::star::beans;
      83             : using namespace ::com::sun::star::util;
      84             : using namespace ::com::sun::star::container;
      85             : using namespace ::com::sun::star::drawing;
      86             : using namespace ::com::sun::star::office;
      87             : using namespace ::com::sun::star::presentation;
      88             : using namespace ::com::sun::star::geometry;
      89             : using namespace ::com::sun::star::text;
      90             : using namespace ::xmloff::token;
      91             : 
      92           0 : class ImpXMLEXPPageMasterInfo
      93             : {
      94             :     sal_Int32                   mnBorderBottom;
      95             :     sal_Int32                   mnBorderLeft;
      96             :     sal_Int32                   mnBorderRight;
      97             :     sal_Int32                   mnBorderTop;
      98             :     sal_Int32                   mnWidth;
      99             :     sal_Int32                   mnHeight;
     100             :     view::PaperOrientation      meOrientation;
     101             :     OUString                    msName;
     102             :     OUString                    msMasterPageName;
     103             : 
     104             : public:
     105             :     ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
     106             :     sal_Bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
     107             :     void SetName(const OUString& rStr);
     108             : 
     109           0 :     const OUString& GetName() const { return msName; }
     110           0 :     const OUString& GetMasterPageName() const { return msMasterPageName; }
     111             : 
     112           0 :     sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
     113           0 :     sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
     114           0 :     sal_Int32 GetBorderRight() const { return mnBorderRight; }
     115           0 :     sal_Int32 GetBorderTop() const { return mnBorderTop; }
     116           0 :     sal_Int32 GetWidth() const { return mnWidth; }
     117           0 :     sal_Int32 GetHeight() const { return mnHeight; }
     118           0 :     view::PaperOrientation GetOrientation() const { return meOrientation; }
     119             : };
     120             : 
     121           0 : ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
     122             :     const SdXMLExport& rExp,
     123             :     const Reference<XDrawPage>& xPage)
     124             : :   mnBorderBottom(0),
     125             :     mnBorderLeft(0),
     126             :     mnBorderRight(0),
     127             :     mnBorderTop(0),
     128             :     mnWidth(0),
     129             :     mnHeight(0),
     130           0 :     meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
     131             : {
     132           0 :     Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
     133           0 :     if(xPropSet.is())
     134             :     {
     135           0 :         Any aAny;
     136             : 
     137           0 :         Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
     138           0 :         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("BorderBottom"))
     139             :         {
     140           0 :             aAny = xPropSet->getPropertyValue("BorderBottom");
     141           0 :             aAny >>= mnBorderBottom;
     142             : 
     143           0 :             aAny = xPropSet->getPropertyValue("BorderLeft");
     144           0 :             aAny >>= mnBorderLeft;
     145             : 
     146           0 :             aAny = xPropSet->getPropertyValue("BorderRight");
     147           0 :             aAny >>= mnBorderRight;
     148             : 
     149           0 :             aAny = xPropSet->getPropertyValue("BorderTop");
     150           0 :             aAny >>= mnBorderTop;
     151             :         }
     152             : 
     153           0 :         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("Width"))
     154             :         {
     155           0 :             aAny = xPropSet->getPropertyValue("Width");
     156           0 :             aAny >>= mnWidth;
     157             : 
     158           0 :             aAny = xPropSet->getPropertyValue("Height");
     159           0 :             aAny >>= mnHeight;
     160             :         }
     161             : 
     162           0 :         if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("Orientation"))
     163             :         {
     164           0 :             aAny = xPropSet->getPropertyValue("Orientation");
     165           0 :             aAny >>= meOrientation;
     166           0 :         }
     167             :     }
     168             : 
     169           0 :     Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
     170           0 :     if(xMasterNamed.is())
     171             :     {
     172           0 :         msMasterPageName = xMasterNamed->getName();
     173           0 :     }
     174           0 : }
     175             : 
     176           0 : sal_Bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
     177             : {
     178           0 :     return ((mnBorderBottom == rInfo.mnBorderBottom)
     179           0 :         && (mnBorderLeft == rInfo.mnBorderLeft)
     180           0 :         && (mnBorderRight == rInfo.mnBorderRight)
     181           0 :         && (mnBorderTop == rInfo.mnBorderTop)
     182           0 :         && (mnWidth == rInfo.mnWidth)
     183           0 :         && (mnHeight == rInfo.mnHeight)
     184           0 :         && (meOrientation == rInfo.meOrientation));
     185             : }
     186             : 
     187           0 : void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
     188             : {
     189           0 :     msName = rStr;
     190           0 : }
     191             : 
     192             : #define IMP_AUTOLAYOUT_INFO_MAX         (35L)
     193             : 
     194           0 : class ImpXMLAutoLayoutInfo
     195             : {
     196             :     sal_uInt16                  mnType;
     197             :     ImpXMLEXPPageMasterInfo*    mpPageMasterInfo;
     198             :     OUString                    msLayoutName;
     199             :     Rectangle                   maTitleRect;
     200             :     Rectangle                   maPresRect;
     201             :     sal_Int32                   mnGapX;
     202             :     sal_Int32                   mnGapY;
     203             : 
     204             : public:
     205             :     ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
     206             : 
     207             :     sal_Bool operator==(const ImpXMLAutoLayoutInfo& rInfo) const;
     208             : 
     209           0 :     sal_uInt16 GetLayoutType() const { return mnType; }
     210           0 :     sal_Int32 GetGapX() const { return mnGapX; }
     211           0 :     sal_Int32 GetGapY() const { return mnGapY; }
     212             : 
     213           0 :     const OUString& GetLayoutName() const { return msLayoutName; }
     214           0 :     void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
     215             : 
     216           0 :     const Rectangle& GetTitleRectangle() const { return maTitleRect; }
     217           0 :     const Rectangle& GetPresRectangle() const { return maPresRect; }
     218             : 
     219             :     static sal_Bool IsCreateNecessary(sal_uInt16 nTyp);
     220             : };
     221             : 
     222           0 : sal_Bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
     223             : {
     224           0 :     if(nTyp == 5 /* AUTOLAYOUT_ORG */
     225           0 :         || nTyp == 20 /* AUTOLAYOUT_NONE */
     226           0 :         || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
     227           0 :         return sal_False;
     228           0 :     return sal_True;
     229             : }
     230             : 
     231           0 : sal_Bool ImpXMLAutoLayoutInfo::operator==(const ImpXMLAutoLayoutInfo& rInfo) const
     232             : {
     233           0 :     return ((mnType == rInfo.mnType
     234           0 :         && mpPageMasterInfo == rInfo.mpPageMasterInfo));
     235             : }
     236             : 
     237           0 : ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
     238             :     : mnType(nTyp)
     239             :     , mpPageMasterInfo(pInf)
     240             :     , mnGapX(0)
     241           0 :     , mnGapY(0)
     242             : {
     243             :     // create full info (initialze with typical values)
     244           0 :     Point aPagePos(0,0);
     245           0 :     Size aPageSize(28000, 21000);
     246           0 :     Size aPageInnerSize(28000, 21000);
     247             : 
     248           0 :     if(mpPageMasterInfo)
     249             :     {
     250           0 :         aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
     251           0 :         aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
     252           0 :         aPageInnerSize = aPageSize;
     253           0 :         aPageInnerSize.Width() -= mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight();
     254           0 :         aPageInnerSize.Height() -= mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom();
     255             :     }
     256             : 
     257             :     // title rectangle aligning
     258           0 :     Point aTitlePos(aPagePos);
     259           0 :     Size aTitleSize(aPageInnerSize);
     260             : 
     261           0 :     if(mnType == 21 /* AUTOLAYOUT_NOTES */)
     262             :     {
     263           0 :         aTitleSize.Height() = (long) (aTitleSize.Height() / 2.5);
     264           0 :         Point aPos = aTitlePos;
     265           0 :         aPos.Y() += long( aTitleSize.Height() * 0.083 );
     266           0 :         Size aPartArea = aTitleSize;
     267           0 :         Size aSize;
     268             : 
     269             :         // scale handout rectangle using actual page size
     270           0 :         double fH = (double) aPartArea.Width()  / aPageSize.Width();
     271           0 :         double fV = (double) aPartArea.Height() / aPageSize.Height();
     272             : 
     273           0 :         if ( fH > fV )
     274           0 :             fH = fV;
     275           0 :         aSize.Width()  = (long) (fH * aPageSize.Width());
     276           0 :         aSize.Height() = (long) (fH * aPageSize.Height());
     277             : 
     278           0 :         aPos.X() += (aPartArea.Width() - aSize.Width()) / 2;
     279           0 :         aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2;
     280             : 
     281           0 :         aTitlePos = aPos;
     282           0 :         aTitleSize = aSize;
     283             :     }
     284           0 :     else if(mnType == 27 || mnType == 28)
     285             :     {
     286             :         // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
     287             :         // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
     288             :         Point aClassicTPos(
     289           0 :             aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
     290           0 :             aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
     291             :         Size aClassicTSize(
     292           0 :             long( aTitleSize.Width() * 0.854 ),
     293           0 :             long( aTitleSize.Height() * 0.167 ));
     294           0 :         Point aLPos(aPagePos);
     295           0 :         Size aLSize(aPageInnerSize);
     296             :         Point aClassicLPos(
     297           0 :             aLPos.X() + long( aLSize.Width() * 0.0735 ),
     298           0 :             aLPos.Y() + long( aLSize.Height() * 0.472 ));
     299             :         Size aClassicLSize(
     300           0 :             long( aLSize.Width() * 0.854 ),
     301           0 :             long( aLSize.Height() * 0.444 ));
     302             : 
     303           0 :         aTitlePos.X() = (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height();
     304           0 :         aTitlePos.Y() = aClassicTPos.Y();
     305           0 :         aTitleSize.Width() = aClassicTSize.Height();
     306           0 :         aTitleSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
     307             :     }
     308             :     else
     309             :     {
     310           0 :         aTitlePos.X() += long( aTitleSize.Width() * 0.0735 );
     311           0 :         aTitlePos.Y() += long( aTitleSize.Height() * 0.083 );
     312           0 :         aTitleSize.Width() = long( aTitleSize.Width() * 0.854 );
     313           0 :         aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
     314             :     }
     315             : 
     316           0 :     maTitleRect.SetPos(aTitlePos);
     317           0 :     maTitleRect.SetSize(aTitleSize);
     318             : 
     319             :     // layout rectangle aligning
     320           0 :     Point aLayoutPos(aPagePos);
     321           0 :     Size aLayoutSize(aPageInnerSize);
     322             : 
     323           0 :     if(mnType == 21 /* AUTOLAYOUT_NOTES */)
     324             :     {
     325           0 :         aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
     326           0 :         aLayoutPos.Y() += long( aLayoutSize.Height() * 0.472 );
     327           0 :         aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
     328           0 :         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.444 );
     329             :     }
     330           0 :     else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT
     331             :     {
     332             :         // keep info for inner area in maPresRect, put info for gap size
     333             :         // to maTitleRect position
     334           0 :         mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
     335           0 :         mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
     336             : 
     337           0 :         if(!mnGapX)
     338           0 :             mnGapX = aPageSize.Width() / 10;
     339             : 
     340           0 :         if(!mnGapY)
     341           0 :             mnGapY = aPageSize.Height() / 10;
     342             : 
     343           0 :         if(mnGapX < aPageInnerSize.Width() / 10)
     344           0 :             mnGapX = aPageInnerSize.Width() / 10;
     345             : 
     346           0 :         if(mnGapY < aPageInnerSize.Height() / 10)
     347           0 :             mnGapY = aPageInnerSize.Height() / 10;
     348             :     }
     349           0 :     else if(mnType == 27 || mnType == 28)
     350             :     {
     351             :         // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART or
     352             :         // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
     353             :         Point aClassicTPos(
     354           0 :             aTitlePos.X() + long( aTitleSize.Width() * 0.0735 ),
     355           0 :             aTitlePos.Y() + long( aTitleSize.Height() * 0.083 ));
     356             :         Size aClassicTSize(
     357           0 :             long( aTitleSize.Width() * 0.854 ),
     358           0 :             long( aTitleSize.Height() * 0.167 ));
     359             :         Point aClassicLPos(
     360           0 :             aLayoutPos.X() + long( aLayoutSize.Width() * 0.0735 ),
     361           0 :             aLayoutPos.Y() + long( aLayoutSize.Height() * 0.472 ));
     362             :         Size aClassicLSize(
     363           0 :             long( aLayoutSize.Width() * 0.854 ),
     364           0 :             long( aLayoutSize.Height() * 0.444 ));
     365             : 
     366           0 :         aLayoutPos.X() = aClassicLPos.X();
     367           0 :         aLayoutPos.Y() = aClassicTPos.Y();
     368           0 :         aLayoutSize.Width() = (aClassicLPos.X() + aClassicLSize.Width())
     369           0 :             - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())));
     370           0 :         aLayoutSize.Height() = (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y();
     371             :     }
     372           0 :     else if( mnType == 32 )
     373             :     {
     374             :         // AUTOLAYOUT_ONLY_TEXT
     375           0 :         aLayoutPos = aTitlePos;
     376           0 :         aLayoutSize.Width() = aTitleSize.Width();
     377           0 :         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.825 );
     378             :     }
     379             :     else
     380             :     {
     381           0 :         aLayoutPos.X() += long( aLayoutSize.Width() * 0.0735 );
     382           0 :         aLayoutPos.Y() += long( aLayoutSize.Height() * 0.278 );
     383           0 :         aLayoutSize.Width() = long( aLayoutSize.Width() * 0.854 );
     384           0 :         aLayoutSize.Height() = long( aLayoutSize.Height() * 0.630 );
     385             :     }
     386             : 
     387           0 :     maPresRect.SetPos(aLayoutPos);
     388           0 :     maPresRect.SetSize(aLayoutSize);
     389           0 : }
     390             : 
     391             : // #110680#
     392           0 : SdXMLExport::SdXMLExport(
     393             :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
     394             :     OUString const & implementationName,
     395             :     sal_Bool bIsDraw, sal_uInt16 nExportFlags )
     396             : :   SvXMLExport( util::MeasureUnit::CM, xContext, implementationName,
     397             :         (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ),
     398             :     mnDocMasterPageCount(0L),
     399             :     mnDocDrawPageCount(0L),
     400             :     mnShapeStyleInfoIndex(0L),
     401             :     mnObjectCount(0L),
     402           0 :     mpPageMasterInfoList(new ImpXMLEXPPageMasterList()),
     403           0 :     mpPageMasterUsageList(new ImpXMLEXPPageMasterList()),
     404           0 :     mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList()),
     405             :     mpHandoutPageMaster(NULL),
     406           0 :     mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList()),
     407             :     mpSdPropHdlFactory(0L),
     408             :     mpPropertySetMapper(0L),
     409             :     mpPresPagePropsMapper(0L),
     410             :     mbIsDraw(bIsDraw),
     411             :     mbFamilyGraphicUsed(sal_False),
     412             :     mbFamilyPresentationUsed(sal_False),
     413           0 :     msZIndex( GetXMLToken(XML_ZINDEX) ),
     414             :     msEmptyPres( "IsEmptyPresentationObject" ),
     415             :     msModel( "Model" ),
     416             :     msStartShape( "StartShape" ),
     417             :     msEndShape( "EndShape" ),
     418           0 :     msPageLayoutNames( "PageLayoutNames" )
     419             : {
     420             : 
     421           0 : }
     422             : 
     423             : // XExporter
     424           0 : void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
     425             :     throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
     426             : {
     427           0 :     SvXMLExport::setSourceDocument( xDoc );
     428             : 
     429           0 :     const OUString aEmpty;
     430             : 
     431             :     // prepare factory parts
     432           0 :     mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
     433           0 :     if(mpSdPropHdlFactory)
     434             :     {
     435             :         // set lock to avoid deletion
     436           0 :         mpSdPropHdlFactory->acquire();
     437             : 
     438             :         // build one ref
     439           0 :         const UniReference< XMLPropertyHandlerFactory > aFactoryRef = mpSdPropHdlFactory;
     440             : 
     441             :         // construct PropertySetMapper
     442           0 :         UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( aFactoryRef, true);
     443             : 
     444             :         // get or create text paragraph export
     445           0 :         GetTextParagraphExport();
     446           0 :         mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this );
     447             :         // set lock to avoid deletion
     448           0 :         mpPropertySetMapper->acquire();
     449             : 
     450             :         // chain text attributes
     451           0 :         mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
     452             : 
     453             :         // construct PresPagePropsMapper
     454           0 :         xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, aFactoryRef, true);
     455             : 
     456           0 :         mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this  );
     457             :         // set lock to avoid deletion
     458           0 :         mpPresPagePropsMapper->acquire();
     459             :     }
     460             : 
     461             :     // add family name
     462             :       GetAutoStylePool()->AddFamily(
     463             :         XML_STYLE_FAMILY_SD_GRAPHICS_ID,
     464             :         OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME),
     465           0 :           GetPropertySetMapper(),
     466           0 :           OUString(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX));
     467             :     GetAutoStylePool()->AddFamily(
     468             :         XML_STYLE_FAMILY_SD_PRESENTATION_ID,
     469             :         OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
     470           0 :           GetPropertySetMapper(),
     471           0 :           OUString(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX));
     472             :     GetAutoStylePool()->AddFamily(
     473             :         XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID,
     474             :         OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME),
     475           0 :           GetPresPagePropsMapper(),
     476           0 :           OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX));
     477             :     // prepare access to styles
     478           0 :     Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
     479           0 :     if(xFamSup.is())
     480             :     {
     481           0 :         mxDocStyleFamilies = xFamSup->getStyleFamilies();
     482             :     }
     483             : 
     484             :     // prepare access to master pages
     485           0 :     Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
     486           0 :     if(xMasterPagesSupplier.is())
     487             :     {
     488           0 :         mxDocMasterPages = mxDocMasterPages.query( xMasterPagesSupplier->getMasterPages() );
     489           0 :         if(mxDocMasterPages.is())
     490             :         {
     491           0 :             mnDocMasterPageCount = mxDocMasterPages->getCount();
     492           0 :             maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, aEmpty );
     493             :         }
     494             :     }
     495             : 
     496             :     // prepare access to draw pages
     497           0 :     Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
     498           0 :     if(xDrawPagesSupplier.is())
     499             :     {
     500           0 :         mxDocDrawPages = mxDocDrawPages.query( xDrawPagesSupplier->getDrawPages() );
     501           0 :         if(mxDocDrawPages.is())
     502             :         {
     503           0 :             mnDocDrawPageCount = mxDocDrawPages->getCount();
     504           0 :             maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
     505           0 :             maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, aEmpty );
     506           0 :             if( !mbIsDraw )
     507           0 :                 maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
     508             : 
     509           0 :             HeaderFooterPageSettingsImpl aEmptySettings;
     510           0 :             maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
     511           0 :             maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
     512             :         }
     513             :     }
     514             : 
     515             :     // #82003# count all draw objects for use with progress bar.
     516             :     // #88245# init mnObjectCount once, use counter itself as flag. It
     517             :     // is initialized to 0.
     518           0 :     if(!mnObjectCount)
     519             :     {
     520           0 :         if( IsImpress() )
     521             :         {
     522             :              // #91587# add handout master count
     523           0 :             Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
     524           0 :             if(xHandoutSupp.is())
     525             :             {
     526           0 :                 Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
     527           0 :                 if(xHandoutPage.is())
     528             :                 {
     529           0 :                     Reference<drawing::XShapes> xShapes(xHandoutPage, UNO_QUERY);
     530           0 :                     if(xShapes.is() && xShapes->getCount())
     531             :                     {
     532           0 :                         mnObjectCount += ImpRecursiveObjectCount(xShapes);
     533           0 :                     }
     534           0 :                 }
     535           0 :             }
     536             :         }
     537             : 
     538           0 :         if(mxDocMasterPages.is())
     539             :         {
     540           0 :             for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
     541             :             {
     542           0 :                 Any aAny(mxDocMasterPages->getByIndex(a));
     543           0 :                 Reference< drawing::XShapes > xMasterPage;
     544             : 
     545           0 :                 if((aAny >>= xMasterPage) && xMasterPage.is())
     546             :                 {
     547           0 :                     mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
     548             :                 }
     549             : 
     550           0 :                 if( IsImpress() )
     551             :                 {
     552             :                     // #91587# take notes pages from master pages into account
     553           0 :                     Reference<presentation::XPresentationPage> xPresPage;
     554           0 :                     if((aAny >>= xPresPage) && xPresPage.is())
     555             :                     {
     556           0 :                         Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
     557           0 :                         if(xNotesPage.is())
     558             :                         {
     559           0 :                             Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
     560           0 :                             if(xShapes.is() && xShapes->getCount())
     561             :                             {
     562           0 :                                 mnObjectCount += ImpRecursiveObjectCount(xShapes);
     563           0 :                             }
     564           0 :                         }
     565           0 :                     }
     566             :                 }
     567           0 :             }
     568             :         }
     569             : 
     570           0 :         if(mxDocDrawPages.is())
     571             :         {
     572           0 :             for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
     573             :             {
     574           0 :                 Any aAny(mxDocDrawPages->getByIndex(a));
     575           0 :                 Reference< drawing::XShapes > xPage;
     576             : 
     577           0 :                 if((aAny >>= xPage) && xPage.is())
     578             :                 {
     579           0 :                     mnObjectCount += ImpRecursiveObjectCount(xPage);
     580             :                 }
     581             : 
     582           0 :                 if( IsImpress() )
     583             :                 {
     584             :                     // #91587# take notes pages from draw pages into account
     585           0 :                     Reference<presentation::XPresentationPage> xPresPage;
     586           0 :                     if((aAny >>= xPresPage) && xPresPage.is())
     587             :                     {
     588           0 :                         Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
     589           0 :                         if(xNotesPage.is())
     590             :                         {
     591           0 :                             Reference<drawing::XShapes> xShapes(xNotesPage, UNO_QUERY);
     592           0 :                             if(xShapes.is() && xShapes->getCount())
     593             :                             {
     594           0 :                                 mnObjectCount += ImpRecursiveObjectCount(xShapes);
     595           0 :                             }
     596           0 :                         }
     597           0 :                     }
     598             :                 }
     599           0 :             }
     600             :         }
     601             : 
     602             :         // #82003# init progress bar
     603           0 :         GetProgressBarHelper()->SetReference(mnObjectCount);
     604             :     }
     605             : 
     606             :     // add namespaces
     607           0 :     _GetNamespaceMap().Add(
     608           0 :         GetXMLToken(XML_NP_PRESENTATION),
     609           0 :         GetXMLToken(XML_N_PRESENTATION),
     610           0 :         XML_NAMESPACE_PRESENTATION);
     611             : 
     612           0 :     _GetNamespaceMap().Add(
     613           0 :         GetXMLToken(XML_NP_SMIL),
     614           0 :         GetXMLToken(XML_N_SMIL_COMPAT),
     615           0 :         XML_NAMESPACE_SMIL);
     616             : 
     617           0 :     _GetNamespaceMap().Add(
     618           0 :         GetXMLToken(XML_NP_ANIMATION),
     619           0 :         GetXMLToken(XML_N_ANIMATION),
     620           0 :         XML_NAMESPACE_ANIMATION);
     621             : 
     622           0 :     if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
     623             :     {
     624           0 :         _GetNamespaceMap().Add(
     625           0 :             GetXMLToken(XML_NP_OFFICE_EXT),
     626           0 :             GetXMLToken(XML_N_OFFICE_EXT),
     627           0 :             XML_NAMESPACE_OFFICE_EXT);
     628             :     }
     629             : 
     630           0 :     GetShapeExport()->enableLayerExport();
     631             : 
     632             :     // #88546# enable progress bar increments
     633           0 :     GetShapeExport()->enableHandleProgressBar();
     634           0 : }
     635             : 
     636             : // #82003# helper function for recursive object count
     637           0 : sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(Reference< drawing::XShapes > xShapes)
     638             : {
     639           0 :     sal_uInt32 nRetval(0L);
     640             : 
     641           0 :     if(xShapes.is())
     642             :     {
     643           0 :         sal_Int32 nCount = xShapes->getCount();
     644             : 
     645           0 :         for(sal_Int32 a(0L); a < nCount; a++)
     646             :         {
     647           0 :             Any aAny(xShapes->getByIndex(a));
     648           0 :             Reference< drawing::XShapes > xGroup;
     649             : 
     650           0 :             if((aAny >>= xGroup) && xGroup.is())
     651             :             {
     652             :                 // #93180# count group objects, too.
     653           0 :                 nRetval += 1 + ImpRecursiveObjectCount(xGroup);
     654             :             }
     655             :             else
     656             :             {
     657           0 :                 nRetval++;
     658             :             }
     659           0 :         }
     660             :     }
     661             : 
     662           0 :     return nRetval;
     663             : }
     664             : 
     665           0 : SdXMLExport::~SdXMLExport()
     666             : {
     667             :     // cleanup factory, decrease refcount. Should lead to destruction.
     668           0 :     if(mpSdPropHdlFactory)
     669             :     {
     670           0 :         mpSdPropHdlFactory->release();
     671           0 :         mpSdPropHdlFactory = 0L;
     672             :     }
     673             : 
     674             :     // cleanup mapper, decrease refcount. Should lead to destruction.
     675           0 :     if(mpPropertySetMapper)
     676             :     {
     677           0 :         mpPropertySetMapper->release();
     678           0 :         mpPropertySetMapper = 0L;
     679             :     }
     680             : 
     681             :     // cleanup presPage mapper, decrease refcount. Should lead to destruction.
     682           0 :     if(mpPresPagePropsMapper)
     683             :     {
     684           0 :         mpPresPagePropsMapper->release();
     685           0 :         mpPresPagePropsMapper = 0L;
     686             :     }
     687             : 
     688             :     // clear evtl. temporary page master infos
     689           0 :     if(mpPageMasterUsageList)
     690             :     {
     691             :         // note: all items in this list are also in mpPageMasterInfoList
     692           0 :         delete mpPageMasterUsageList;
     693           0 :         mpPageMasterUsageList = 0L;
     694             :     }
     695             : 
     696           0 :     if(mpNotesPageMasterUsageList)
     697             :     {
     698             :         // note: all items in this list are also in mpPageMasterInfoList
     699           0 :         delete mpNotesPageMasterUsageList;
     700           0 :         mpNotesPageMasterUsageList = 0L;
     701             :     }
     702             : 
     703           0 :     if(mpPageMasterInfoList)
     704             :     {
     705           0 :         for ( size_t i = 0, n = mpPageMasterInfoList->size(); i < n; ++i )
     706           0 :             delete mpPageMasterInfoList->at( i );
     707           0 :         mpPageMasterInfoList->clear();
     708           0 :         delete mpPageMasterInfoList;
     709           0 :         mpPageMasterInfoList = 0L;
     710             :     }
     711             : 
     712             :     // clear auto-layout infos
     713           0 :     if(mpAutoLayoutInfoList)
     714             :     {
     715           0 :         for ( size_t i = 0, n = mpAutoLayoutInfoList->size(); i < n; ++i )
     716           0 :             delete mpAutoLayoutInfoList->at( i );
     717           0 :         mpAutoLayoutInfoList->clear();
     718           0 :         delete mpAutoLayoutInfoList;
     719           0 :         mpAutoLayoutInfoList = 0L;
     720             :     }
     721           0 : }
     722             : 
     723           0 : void SdXMLExport::ImpPrepAutoLayoutInfos()
     724             : {
     725           0 :     if(IsImpress())
     726             :     {
     727           0 :         OUString aStr;
     728             : 
     729           0 :         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
     730           0 :         if( xHandoutSupp.is() )
     731             :         {
     732           0 :             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
     733           0 :             if( xHandoutPage.is() )
     734             :             {
     735           0 :                 if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
     736           0 :                     maDrawPagesAutoLayoutNames[0] = aStr;
     737           0 :             }
     738             :         }
     739             : 
     740             :         // prepare name creation
     741           0 :         for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
     742             :         {
     743           0 :             Any aAny(mxDocDrawPages->getByIndex(nCnt));
     744           0 :             Reference<XDrawPage> xDrawPage;
     745             : 
     746           0 :             if((aAny >>= xDrawPage) && xDrawPage.is())
     747             :             {
     748           0 :                 if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
     749           0 :                     maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
     750             :             }
     751           0 :         }
     752             :     }
     753           0 : }
     754             : 
     755           0 : sal_Bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
     756             : {
     757           0 :     rName = "";
     758           0 :     sal_Bool bRetval(sal_False);
     759             : 
     760           0 :     Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
     761           0 :     if(xPropSet.is())
     762             :     {
     763           0 :         sal_uInt16 nType = sal_uInt16();
     764           0 :         Any aAny;
     765             : 
     766           0 :         aAny = xPropSet->getPropertyValue("Layout");
     767           0 :         if(aAny >>= nType)
     768             :         {
     769           0 :             if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
     770             :             {
     771           0 :                 ImpXMLEXPPageMasterInfo* pInfo = 0L;
     772             : 
     773             :                 // get master-page info
     774           0 :                 Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
     775           0 :                 if(xMasterPageInt.is())
     776             :                 {
     777           0 :                     Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
     778           0 :                     if(xUsedMasterPage.is())
     779             :                     {
     780           0 :                         Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
     781           0 :                         if(xMasterNamed.is())
     782             :                         {
     783           0 :                             OUString sMasterPageName = xMasterNamed->getName();
     784           0 :                             pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
     785           0 :                         }
     786           0 :                     }
     787             :                 }
     788             : 
     789             :                 // create entry and look for existance
     790           0 :                 ImpXMLAutoLayoutInfo* pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
     791           0 :                 sal_Bool bDidExist(sal_False);
     792             : 
     793           0 :                 for( size_t nCnt = 0; !bDidExist && nCnt < mpAutoLayoutInfoList->size(); nCnt++)
     794             :                 {
     795           0 :                     if( *mpAutoLayoutInfoList->at( nCnt ) == *pNew)
     796             :                     {
     797           0 :                         delete pNew;
     798           0 :                         pNew = mpAutoLayoutInfoList->at( nCnt );
     799           0 :                         bDidExist = sal_True;
     800             :                     }
     801             :                 }
     802             : 
     803           0 :                 if(!bDidExist)
     804             :                 {
     805           0 :                     mpAutoLayoutInfoList->push_back( pNew );
     806           0 :                     OUString sNewName = "AL";
     807           0 :                     sNewName += OUString::number(mpAutoLayoutInfoList->size() - 1);
     808           0 :                     sNewName += "T";
     809           0 :                     sNewName += OUString::number(nType);
     810           0 :                     pNew->SetLayoutName(sNewName);
     811             :                 }
     812             : 
     813           0 :                 rName = pNew->GetLayoutName();
     814           0 :                 bRetval = sal_True;
     815             :             }
     816           0 :         }
     817             :     }
     818             : 
     819           0 :     return bRetval;
     820             : }
     821             : 
     822           0 : void SdXMLExport::ImpWriteAutoLayoutInfos()
     823             : {
     824           0 :     if( !mpAutoLayoutInfoList->empty() )
     825             :     {
     826           0 :         for(size_t nCnt = 0; nCnt < mpAutoLayoutInfoList->size(); nCnt++)
     827             :         {
     828           0 :             ImpXMLAutoLayoutInfo* pInfo = mpAutoLayoutInfoList->at( nCnt );
     829           0 :             if(pInfo)
     830             :             {
     831             :                 // prepare presentation-page layout attributes, style-name
     832           0 :                 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
     833             : 
     834             :                 // write draw-style attributes
     835           0 :                 SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, true, true);
     836             : 
     837             :                 // write presentation placeholders
     838           0 :                 switch(pInfo->GetLayoutType())
     839             :                 {
     840             :                     case 0 : // AUTOLAYOUT_TITLE
     841             :                     {
     842           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     843           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
     844           0 :                         break;
     845             :                     }
     846             :                     case 1 : // AUTOLAYOUT_ENUM
     847             :                     {
     848           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     849           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
     850           0 :                         break;
     851             :                     }
     852             :                     case 2 : // AUTOLAYOUT_CHART
     853             :                     {
     854           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     855           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
     856           0 :                         break;
     857             :                     }
     858             :                     case 3 : // AUTOLAYOUT_2TEXT
     859             :                     {
     860           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     861           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     862           0 :                         Rectangle aRight(aLeft);
     863           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     864             : 
     865           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     866           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
     867           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
     868           0 :                         break;
     869             :                     }
     870             :                     case 4 : // AUTOLAYOUT_TEXTCHART
     871             :                     {
     872           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     873           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     874           0 :                         Rectangle aRight(aLeft);
     875           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     876             : 
     877           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     878           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
     879           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
     880           0 :                         break;
     881             :                     }
     882             :                     case 6 : // AUTOLAYOUT_TEXTCLIP
     883             :                     {
     884           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     885           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     886           0 :                         Rectangle aRight(aLeft);
     887           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     888             : 
     889           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     890           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
     891           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
     892           0 :                         break;
     893             :                     }
     894             :                     case 7 : // AUTOLAYOUT_CHARTTEXT
     895             :                     {
     896           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     897           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     898           0 :                         Rectangle aRight(aLeft);
     899           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     900             : 
     901           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     902           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
     903           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
     904           0 :                         break;
     905             :                     }
     906             :                     case 8 : // AUTOLAYOUT_TAB
     907             :                     {
     908           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     909           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
     910           0 :                         break;
     911             :                     }
     912             :                     case 9 : // AUTOLAYOUT_CLIPTEXT
     913             :                     {
     914           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     915           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     916           0 :                         Rectangle aRight(aLeft);
     917           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     918             : 
     919           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     920           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
     921           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
     922           0 :                         break;
     923             :                     }
     924             :                     case 10 : // AUTOLAYOUT_TEXTOBJ
     925             :                     {
     926           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     927           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     928           0 :                         Rectangle aRight(aLeft);
     929           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     930             : 
     931           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     932           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
     933           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
     934           0 :                         break;
     935             :                     }
     936             :                     case 11 : // AUTOLAYOUT_OBJ
     937             :                     {
     938           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     939           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
     940           0 :                         break;
     941             :                     }
     942             :                     case 12 : // AUTOLAYOUT_TEXT2OBJ
     943             :                     {
     944           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     945           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     946           0 :                         Rectangle aRightTop(aLeft);
     947           0 :                         aRightTop.Left() = long(aRightTop.Left() + aRightTop.GetWidth() * 1.05);
     948           0 :                         aRightTop.setHeight(long(aRightTop.GetHeight() * 0.477));
     949           0 :                         Rectangle aRightBottom(aRightTop);
     950           0 :                         aRightBottom.Top() = long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095);
     951             : 
     952           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     953           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
     954           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
     955           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
     956           0 :                         break;
     957             :                     }
     958             :                     case 13 : // AUTOLAYOUT_OBJTEXT
     959             :                     {
     960           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
     961           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
     962           0 :                         Rectangle aRight(aLeft);
     963           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     964             : 
     965           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     966           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
     967           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
     968           0 :                         break;
     969             :                     }
     970             :                     case 14 : // AUTOLAYOUT_OBJOVERTEXT
     971             :                     {
     972           0 :                         Rectangle aTop(pInfo->GetPresRectangle());
     973           0 :                         aTop.setHeight(long(aTop.GetHeight() * 0.477));
     974           0 :                         Rectangle aBottom(aTop);
     975           0 :                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
     976             : 
     977           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     978           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
     979           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
     980           0 :                         break;
     981             :                     }
     982             :                     case 15 : // AUTOLAYOUT_2OBJTEXT
     983             :                     {
     984           0 :                         Rectangle aLeftTop(pInfo->GetPresRectangle());
     985           0 :                         aLeftTop.setWidth(long(aLeftTop.GetWidth() * 0.488));
     986           0 :                         Rectangle aRight(aLeftTop);
     987           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
     988           0 :                         aLeftTop.setHeight(long(aLeftTop.GetHeight() * 0.477));
     989           0 :                         Rectangle aLeftBottom(aLeftTop);
     990           0 :                         aLeftBottom.Top() = long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095);
     991             : 
     992           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
     993           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
     994           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
     995           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
     996           0 :                         break;
     997             :                     }
     998             :                     case 16 : // AUTOLAYOUT_2OBJOVERTEXT
     999             :                     {
    1000           0 :                         Rectangle aTopLeft(pInfo->GetPresRectangle());
    1001           0 :                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
    1002           0 :                         Rectangle aBottom(aTopLeft);
    1003           0 :                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
    1004           0 :                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
    1005           0 :                         Rectangle aTopRight(aTopLeft);
    1006           0 :                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
    1007             : 
    1008           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1009           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
    1010           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
    1011           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
    1012           0 :                         break;
    1013             :                     }
    1014             :                     case 17 : // AUTOLAYOUT_TEXTOVEROBJ
    1015             :                     {
    1016           0 :                         Rectangle aTop(pInfo->GetPresRectangle());
    1017           0 :                         aTop.setHeight(long(aTop.GetHeight() * 0.477));
    1018           0 :                         Rectangle aBottom(aTop);
    1019           0 :                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.095);
    1020             : 
    1021           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1022           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
    1023           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
    1024           0 :                         break;
    1025             :                     }
    1026             :                     case 18 : // AUTOLAYOUT_4OBJ
    1027             :                     {
    1028           0 :                         Rectangle aTopLeft(pInfo->GetPresRectangle());
    1029           0 :                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
    1030           0 :                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
    1031           0 :                         Rectangle aBottomLeft(aTopLeft);
    1032           0 :                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
    1033           0 :                         Rectangle aTopRight(aTopLeft);
    1034           0 :                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
    1035           0 :                         Rectangle aBottomRight(aTopRight);
    1036           0 :                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
    1037             : 
    1038           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1039           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
    1040           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
    1041           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
    1042           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
    1043           0 :                         break;
    1044             :                     }
    1045             :                     case 19 : // AUTOLAYOUT_ONLY_TITLE
    1046             :                     {
    1047           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1048           0 :                         break;
    1049             :                     }
    1050             :                     case 21 : // AUTOLAYOUT_NOTES
    1051             :                     {
    1052           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
    1053           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
    1054           0 :                         break;
    1055             :                     }
    1056             :                     case 22 : // AUTOLAYOUT_HANDOUT1
    1057             :                     case 23 : // AUTOLAYOUT_HANDOUT2
    1058             :                     case 24 : // AUTOLAYOUT_HANDOUT3
    1059             :                     case 25 : // AUTOLAYOUT_HANDOUT4
    1060             :                     case 26 : // AUTOLAYOUT_HANDOUT6
    1061             :                     case 31 : // AUTOLAYOUT_HANDOUT9
    1062             :                     {
    1063             :                         sal_Int32 nColCnt, nRowCnt;
    1064           0 :                         sal_Int32 nGapX = pInfo->GetGapX();
    1065           0 :                         sal_Int32 nGapY = pInfo->GetGapY();
    1066             : 
    1067           0 :                         switch(pInfo->GetLayoutType())
    1068             :                         {
    1069           0 :                             case 22 : nColCnt = 1; nRowCnt = 1; break;
    1070           0 :                             case 23 : nColCnt = 1; nRowCnt = 2; break;
    1071           0 :                             case 24 : nColCnt = 1; nRowCnt = 3; break;
    1072           0 :                             case 25 : nColCnt = 2; nRowCnt = 2; break;
    1073           0 :                             case 26 : nColCnt = 3; nRowCnt = 2; break;
    1074           0 :                             case 31 : nColCnt = 3; nRowCnt = 3; break;
    1075           0 :                             default:  nColCnt = 0; nRowCnt = 0; break;  // FIXME - What is correct values?
    1076             :                         }
    1077             : 
    1078           0 :                         Size aPartSize(pInfo->GetTitleRectangle().GetSize());
    1079           0 :                         Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
    1080             : 
    1081           0 :                         if(aPartSize.Width() > aPartSize.Height())
    1082             :                         {
    1083           0 :                             sal_Int32 nZwi(nColCnt);
    1084           0 :                             nColCnt = nRowCnt;
    1085           0 :                             nRowCnt = nZwi;
    1086             :                         }
    1087             : 
    1088           0 :                         aPartSize.Width() = (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt;
    1089           0 :                         aPartSize.Height() = (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt;
    1090             : 
    1091           0 :                         Point aTmpPos(aPartPos);
    1092             : 
    1093           0 :                         for (sal_Int32 a = 0; a < nRowCnt; a++)
    1094             :                         {
    1095           0 :                             aTmpPos.X() = aPartPos.X();
    1096             : 
    1097           0 :                             for (sal_Int32 b = 0; b < nColCnt; b++)
    1098             :                             {
    1099           0 :                                 Rectangle aTmpRect(aTmpPos, aPartSize);
    1100             : 
    1101           0 :                                 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
    1102           0 :                                 aTmpPos.X() += aPartSize.Width() + nGapX;
    1103             :                             }
    1104             : 
    1105           0 :                             aTmpPos.Y() += aPartSize.Height() + nGapY;
    1106             :                         }
    1107           0 :                         break;
    1108             :                     }
    1109             :                     case 27 : // AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART
    1110             :                     {
    1111           0 :                         Rectangle aTop(pInfo->GetPresRectangle());
    1112           0 :                         aTop.setHeight(long(aTop.GetHeight() * 0.488));
    1113           0 :                         Rectangle aBottom(aTop);
    1114           0 :                         aBottom.Top() = long(aBottom.Top() + aBottom.GetHeight() * 1.05);
    1115             : 
    1116           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
    1117           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
    1118           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
    1119           0 :                         break;
    1120             :                     }
    1121             :                     case 28 : // AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE
    1122             :                     {
    1123           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
    1124           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
    1125           0 :                         break;
    1126             :                     }
    1127             :                     case 29 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE
    1128             :                     {
    1129           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1130           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
    1131           0 :                         break;
    1132             :                     }
    1133             :                     case 30 : // AUTOLAYOUT_TITLE_VERTICAL_OUTLINE_CLIPART
    1134             :                     {
    1135           0 :                         Rectangle aLeft(pInfo->GetPresRectangle());
    1136           0 :                         aLeft.setWidth(long(aLeft.GetWidth() * 0.488));
    1137           0 :                         Rectangle aRight(aLeft);
    1138           0 :                         aRight.Left() = long(aRight.Left() + aRight.GetWidth() * 1.05);
    1139             : 
    1140           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1141           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
    1142           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
    1143           0 :                         break;
    1144             :                     }
    1145             :                     case 32 : // AUTOLAYOUT_TITLE
    1146             :                     {
    1147           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
    1148           0 :                         break;
    1149             :                     }
    1150             : 
    1151             :                     case 33 : // AUTOLAYOUT_4CLIPART
    1152             :                     {
    1153           0 :                         Rectangle aTopLeft(pInfo->GetPresRectangle());
    1154           0 :                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
    1155           0 :                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.488));
    1156           0 :                         Rectangle aBottomLeft(aTopLeft);
    1157           0 :                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
    1158           0 :                         Rectangle aTopRight(aTopLeft);
    1159           0 :                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 1.05);
    1160           0 :                         Rectangle aBottomRight(aTopRight);
    1161           0 :                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
    1162             : 
    1163           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1164           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
    1165           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
    1166           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
    1167           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
    1168           0 :                         break;
    1169             :                     }
    1170             : 
    1171             :                     case 34 : // AUTOLAYOUT_6CLIPART
    1172             :                     {
    1173           0 :                         Rectangle aTopLeft(pInfo->GetPresRectangle());
    1174           0 :                         aTopLeft.setHeight(long(aTopLeft.GetHeight() * 0.477));
    1175           0 :                         aTopLeft.setWidth(long(aTopLeft.GetWidth() * 0.322));
    1176           0 :                         Rectangle aTopCenter(aTopLeft);
    1177           0 :                         aTopCenter.Left() = long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05);
    1178           0 :                         Rectangle aTopRight(aTopLeft);
    1179           0 :                         aTopRight.Left() = long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05);
    1180             : 
    1181           0 :                         Rectangle aBottomLeft(aTopLeft);
    1182           0 :                         aBottomLeft.Top() = long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095);
    1183           0 :                         Rectangle aBottomCenter(aTopCenter);
    1184           0 :                         aBottomCenter.Top() = long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095);
    1185           0 :                         Rectangle aBottomRight(aTopRight);
    1186           0 :                         aBottomRight.Top() = long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095);
    1187             : 
    1188           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
    1189           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
    1190           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
    1191           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
    1192           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
    1193           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
    1194           0 :                         ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
    1195           0 :                         break;
    1196             :                     }
    1197             :                     default:
    1198             :                     {
    1199             :                         OSL_FAIL("XMLEXP: unknown autolayout export");
    1200           0 :                         break;
    1201             :                     }
    1202           0 :                 }
    1203             :             }
    1204             :         }
    1205             :     }
    1206           0 : }
    1207             : 
    1208           0 : void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect)
    1209             : {
    1210           0 :     OUString aStr;
    1211           0 :     OUStringBuffer sStringBuffer;
    1212             : 
    1213             :     // prepare presentation-placeholder attributes, presentation:object
    1214           0 :     switch(ePl)
    1215             :     {
    1216           0 :         case XmlPlaceholderTitle: aStr = "title"; break;
    1217           0 :         case XmlPlaceholderOutline: aStr = "outline"; break;
    1218           0 :         case XmlPlaceholderSubtitle: aStr = "subtitle"; break;
    1219           0 :         case XmlPlaceholderText: aStr = "text"; break;
    1220           0 :         case XmlPlaceholderGraphic: aStr = "graphic"; break;
    1221           0 :         case XmlPlaceholderObject: aStr = "object"; break;
    1222           0 :         case XmlPlaceholderChart: aStr = "chart"; break;
    1223           0 :         case XmlPlaceholderOrgchart: aStr = "orgchart"; break;
    1224           0 :         case XmlPlaceholderTable: aStr = "table"; break;
    1225           0 :         case XmlPlaceholderPage: aStr = "page"; break;
    1226           0 :         case XmlPlaceholderNotes: aStr = "notes"; break;
    1227           0 :         case XmlPlaceholderHandout: aStr = "handout"; break;
    1228           0 :         case XmlPlaceholderVerticalTitle: aStr = "vertical_title"; break;
    1229           0 :         case XmlPlaceholderVerticalOutline: aStr = "vertical_outline"; break;
    1230             :     }
    1231             : 
    1232           0 :     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
    1233             : 
    1234             :     // svg:x,y,width,height
    1235           0 :     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Left());
    1236           0 :     aStr = sStringBuffer.makeStringAndClear();
    1237           0 :     AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
    1238             : 
    1239           0 :     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Top());
    1240           0 :     aStr = sStringBuffer.makeStringAndClear();
    1241           0 :     AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
    1242             : 
    1243           0 :     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1244           0 :             rRect.GetWidth());
    1245           0 :     aStr = sStringBuffer.makeStringAndClear();
    1246           0 :     AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
    1247             : 
    1248           0 :     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1249           0 :             rRect.GetHeight());
    1250           0 :     aStr = sStringBuffer.makeStringAndClear();
    1251           0 :     AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
    1252             : 
    1253             :     // write presentation-placeholder
    1254           0 :     SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, true, true);
    1255           0 : }
    1256             : 
    1257           0 : ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( Reference< XDrawPage > xMasterPage )
    1258             : {
    1259           0 :     bool bDoesExist = false;
    1260             : 
    1261           0 :     ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
    1262             : 
    1263             :     // compare with prev page-master infos
    1264           0 :     for( size_t a = 0; !bDoesExist && a < mpPageMasterInfoList->size(); a++)
    1265             :     {
    1266           0 :         if (   mpPageMasterInfoList->at(a)
    1267           0 :            && *mpPageMasterInfoList->at(a) == *pNewInfo
    1268             :            )
    1269             :         {
    1270           0 :             delete pNewInfo;
    1271           0 :             pNewInfo = mpPageMasterInfoList->at(a);
    1272           0 :             bDoesExist = true;
    1273             :         }
    1274             :     }
    1275             :     // add entry when not found same page-master infos
    1276           0 :     if(!bDoesExist)
    1277           0 :         mpPageMasterInfoList->push_back( pNewInfo );
    1278             : 
    1279           0 :     return pNewInfo;
    1280             : }
    1281             : 
    1282           0 : void SdXMLExport::ImpPrepPageMasterInfos()
    1283             : {
    1284           0 :     if( IsImpress() )
    1285             :     {
    1286             :         // create page master info for handout master page
    1287             : 
    1288           0 :         Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
    1289           0 :         if( xHMS.is() )
    1290             :         {
    1291           0 :             Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
    1292           0 :             if( xMasterPage.is() )
    1293           0 :                 mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
    1294           0 :         }
    1295             :     }
    1296             : 
    1297             :     // create page master infos for master pages
    1298           0 :     if(mnDocMasterPageCount)
    1299             :     {
    1300             :         // look for needed page-masters, create these
    1301           0 :         for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
    1302             :         {
    1303           0 :             Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
    1304           0 :             ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
    1305             : 
    1306           0 :             if(xMasterPage.is())
    1307           0 :                 pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
    1308             : 
    1309           0 :             mpPageMasterUsageList->push_back( pNewInfo );
    1310             : 
    1311             :             // look for page master of handout page
    1312           0 :             if(IsImpress())
    1313             :             {
    1314           0 :                 pNewInfo = NULL;
    1315           0 :                 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
    1316           0 :                 if(xPresPage.is())
    1317             :                 {
    1318           0 :                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
    1319           0 :                     if(xNotesPage.is())
    1320             :                     {
    1321           0 :                         pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
    1322           0 :                     }
    1323             :                 }
    1324           0 :                 mpNotesPageMasterUsageList->push_back( pNewInfo );
    1325             :             }
    1326           0 :         }
    1327             :     }
    1328           0 : }
    1329             : 
    1330           0 : void SdXMLExport::ImpWritePageMasterInfos()
    1331             : {
    1332             :     // write created page-masters, create names for these
    1333           0 :     for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
    1334             :     {
    1335           0 :         ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
    1336           0 :         if(pInfo)
    1337             :         {
    1338             :             // create name
    1339           0 :             OUString sNewName("PM");
    1340             : 
    1341           0 :             sNewName += OUString::number(nCnt);
    1342           0 :             pInfo->SetName(sNewName);
    1343             : 
    1344             :             // prepare page-master attributes
    1345           0 :             OUString sString;
    1346           0 :             OUStringBuffer sStringBuffer;
    1347             : 
    1348           0 :             sString = sNewName;
    1349           0 :             AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
    1350             : 
    1351             :             // write page-layout
    1352           0 :             SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, true, true);
    1353             : 
    1354             :             // prepare style:properties inside page-master
    1355           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1356           0 :                     pInfo->GetBorderTop());
    1357           0 :             sString = sStringBuffer.makeStringAndClear();
    1358           0 :             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
    1359             : 
    1360           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1361           0 :                     pInfo->GetBorderBottom());
    1362           0 :             sString = sStringBuffer.makeStringAndClear();
    1363           0 :             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
    1364             : 
    1365           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1366           0 :                     pInfo->GetBorderLeft());
    1367           0 :             sString = sStringBuffer.makeStringAndClear();
    1368           0 :             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
    1369             : 
    1370           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1371           0 :                     pInfo->GetBorderRight());
    1372           0 :             sString = sStringBuffer.makeStringAndClear();
    1373           0 :             AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
    1374             : 
    1375           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1376           0 :                     pInfo->GetWidth());
    1377           0 :             sString = sStringBuffer.makeStringAndClear();
    1378           0 :             AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
    1379             : 
    1380           0 :             GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    1381           0 :                     pInfo->GetHeight());
    1382           0 :             sString = sStringBuffer.makeStringAndClear();
    1383           0 :             AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
    1384             : 
    1385           0 :             if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
    1386           0 :                 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
    1387             :             else
    1388           0 :                 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
    1389             : 
    1390             :             // write style:properties
    1391           0 :             SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, true, true);
    1392             :         }
    1393             :     }
    1394           0 : }
    1395             : 
    1396           0 : ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
    1397             : {
    1398           0 :     if(!rName.isEmpty() && !mpPageMasterInfoList->empty())
    1399             :     {
    1400           0 :         for( size_t nCnt = 0; nCnt < mpPageMasterInfoList->size(); nCnt++)
    1401             :         {
    1402           0 :             ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterInfoList->at(nCnt);
    1403           0 :             if(pInfo)
    1404             :             {
    1405           0 :                 if(!pInfo->GetMasterPageName().isEmpty() && rName.equals(pInfo->GetMasterPageName()))
    1406             :                 {
    1407           0 :                     return pInfo;
    1408             :                 }
    1409             :             }
    1410             :         }
    1411             :     }
    1412           0 :     return 0L;
    1413             : }
    1414             : 
    1415           0 : void SdXMLExport::ImpPrepDrawPageInfos()
    1416             : {
    1417             :     // create draw:style-name entries for page export
    1418             :     // containing presentation page attributes AND background attributes
    1419             :     // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
    1420             : 
    1421             :     sal_Int32 nCnt;
    1422           0 :     for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
    1423             :     {
    1424           0 :         Reference<XDrawPage> xDrawPage;
    1425           0 :         mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
    1426           0 :         maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
    1427             : 
    1428           0 :         Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
    1429           0 :         if(xPresPage.is())
    1430             :         {
    1431           0 :             maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
    1432             : 
    1433           0 :             maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
    1434           0 :             maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
    1435             :         }
    1436           0 :     }
    1437           0 : }
    1438             : 
    1439           0 : static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const sal_Char* pPrefix )
    1440             : {
    1441             :     // search rVector if there is already a string that equals rText
    1442           0 :     std::vector< OUString >::iterator aIter;
    1443             :     sal_Int32 nIndex;
    1444           0 :     for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
    1445             :     {
    1446           0 :         if( (*aIter) == rText )
    1447           0 :             break;
    1448             :     }
    1449             : 
    1450             :     // if nothing is found, append the string at the end of rVector
    1451           0 :     if( aIter == rVector.end() )
    1452           0 :         rVector.push_back( rText );
    1453             : 
    1454             :     // create a reference string with pPrefix and the index of the
    1455             :     // found or created rText
    1456           0 :     OUString aStr( OUString::createFromAscii( pPrefix ) );
    1457           0 :     aStr += OUString::number( nIndex );
    1458           0 :     return aStr;
    1459             : }
    1460             : 
    1461           0 : static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, sal_Bool bFixed, sal_Int32 nFormat, const sal_Char* pPrefix )
    1462             : {
    1463             :     // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
    1464           0 :     std::vector< DateTimeDeclImpl >::iterator aIter;
    1465             :     sal_Int32 nIndex;
    1466           0 :     for( nIndex = 1, aIter = rVector.begin(); aIter != rVector.end(); ++aIter, ++nIndex )
    1467             :     {
    1468           0 :         const DateTimeDeclImpl& rDecl = (*aIter);
    1469           0 :         if( (rDecl.mbFixed == bFixed ) &&
    1470           0 :             (!bFixed || rDecl.maStrText == rText) &&
    1471           0 :             (bFixed || (rDecl.mnFormat == nFormat) ) )
    1472           0 :             break;
    1473             :     }
    1474             : 
    1475             :     // if nothing is found, append a new DateTimeDeclImpl
    1476           0 :     if( aIter == rVector.end() )
    1477             :     {
    1478           0 :         DateTimeDeclImpl aDecl;
    1479           0 :         aDecl.maStrText = rText;
    1480           0 :         aDecl.mbFixed = bFixed;
    1481           0 :         aDecl.mnFormat = nFormat;
    1482           0 :         rVector.push_back( aDecl );
    1483             :     }
    1484             : 
    1485             :     // create a reference string with pPrefix and the index of the
    1486             :     // found or created DateTimeDeclImpl
    1487           0 :     OUString aStr( OUString::createFromAscii( pPrefix ) );
    1488           0 :     aStr += OUString::number( nIndex );
    1489           0 :     return aStr;
    1490             : 
    1491             : }
    1492             : 
    1493             : static const sal_Char* gpStrHeaderTextPrefix = "hdr";
    1494             : static const sal_Char* gpStrFooterTextPrefix = "ftr";
    1495             : static const sal_Char* gpStrDateTimeTextPrefix = "dtd";
    1496             : 
    1497           0 : HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
    1498             : {
    1499           0 :     HeaderFooterPageSettingsImpl aSettings;
    1500             : 
    1501           0 :     if( xDrawPage.is() ) try
    1502             :     {
    1503           0 :         Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
    1504           0 :         Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
    1505             : 
    1506           0 :         OUString aStrText;
    1507             : 
    1508           0 :         const OUString aStrHeaderTextProp( "HeaderText" );
    1509           0 :         if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
    1510             :         {
    1511           0 :             xSet->getPropertyValue( aStrHeaderTextProp  ) >>= aStrText;
    1512           0 :             if( !aStrText.isEmpty() )
    1513           0 :                 aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
    1514             :         }
    1515             : 
    1516           0 :         const OUString aStrFooterTextProp( "FooterText" );
    1517           0 :         if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
    1518             :         {
    1519           0 :             xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
    1520           0 :             if( !aStrText.isEmpty() )
    1521           0 :                 aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
    1522             :         }
    1523             : 
    1524           0 :         const OUString aStrDateTimeTextProp( "DateTimeText" );
    1525           0 :         if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
    1526             :         {
    1527           0 :             sal_Bool bFixed = false;
    1528           0 :             sal_Int32 nFormat = 0;
    1529           0 :             xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
    1530           0 :             xSet->getPropertyValue("IsDateTimeFixed") >>= bFixed;
    1531           0 :             xSet->getPropertyValue("DateTimeFormat") >>= nFormat;
    1532             : 
    1533           0 :             if( !bFixed || !aStrText.isEmpty() )
    1534             :             {
    1535           0 :                 aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
    1536           0 :                 if( !bFixed )
    1537           0 :                     addDataStyle( nFormat );
    1538             :             }
    1539           0 :         }
    1540             :     }
    1541           0 :     catch(const Exception&)
    1542             :     {
    1543             :         OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" );
    1544             :     }
    1545             : 
    1546           0 :     return aSettings;
    1547             : }
    1548             : 
    1549           0 : void SdXMLExport::ImpWriteHeaderFooterDecls()
    1550             : {
    1551           0 :     OUStringBuffer sBuffer;
    1552             : 
    1553           0 :     if( !maHeaderDeclsVector.empty() )
    1554             :     {
    1555             :         // export header decls
    1556           0 :         const OUString aPrefix( OUString::createFromAscii( gpStrHeaderTextPrefix ) );
    1557           0 :         std::vector< OUString >::iterator aIter;
    1558             :         sal_Int32 nIndex;
    1559           0 :         for( nIndex = 1, aIter = maHeaderDeclsVector.begin(); aIter != maHeaderDeclsVector.end(); ++aIter, ++nIndex )
    1560             :         {
    1561           0 :             sBuffer.append( aPrefix );
    1562           0 :             sBuffer.append( nIndex );
    1563           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
    1564             : 
    1565           0 :             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, true, true);
    1566           0 :             Characters((*aIter));
    1567           0 :         }
    1568             :     }
    1569             : 
    1570           0 :     if( !maFooterDeclsVector.empty() )
    1571             :     {
    1572             :         // export footer decls
    1573           0 :         const OUString aPrefix( OUString::createFromAscii( gpStrFooterTextPrefix ) );
    1574           0 :         std::vector< OUString >::iterator aIter;
    1575             :         sal_Int32 nIndex;
    1576           0 :         for( nIndex = 1, aIter = maFooterDeclsVector.begin(); aIter != maFooterDeclsVector.end(); ++aIter, ++nIndex )
    1577             :         {
    1578           0 :             sBuffer.append( aPrefix );
    1579           0 :             sBuffer.append( nIndex );
    1580           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
    1581             : 
    1582           0 :             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, false, false);
    1583           0 :             Characters((*aIter));
    1584           0 :         }
    1585             :     }
    1586             : 
    1587           0 :     if( !maDateTimeDeclsVector.empty() )
    1588             :     {
    1589             :         // export footer decls
    1590           0 :         const OUString aPrefix( OUString::createFromAscii( gpStrDateTimeTextPrefix ) );
    1591           0 :         std::vector< DateTimeDeclImpl >::iterator aIter;
    1592             :         sal_Int32 nIndex;
    1593           0 :         for( nIndex = 1, aIter = maDateTimeDeclsVector.begin(); aIter != maDateTimeDeclsVector.end(); ++aIter, ++nIndex )
    1594             :         {
    1595           0 :             const DateTimeDeclImpl& rDecl = (*aIter);
    1596             : 
    1597           0 :             sBuffer.append( aPrefix );
    1598           0 :             sBuffer.append( nIndex );
    1599           0 :             AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
    1600             : 
    1601           0 :             AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
    1602             : 
    1603           0 :             if( !rDecl.mbFixed )
    1604           0 :                 AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
    1605             : 
    1606           0 :             SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, false, false);
    1607           0 :             if( rDecl.mbFixed )
    1608           0 :                 Characters(rDecl.maStrText);
    1609           0 :         }
    1610           0 :     }
    1611           0 : }
    1612             : 
    1613           0 : void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
    1614             : {
    1615           0 :     if( !aSettings.maStrHeaderDeclName.isEmpty() )
    1616           0 :         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
    1617             : 
    1618           0 :     if( !aSettings.maStrFooterDeclName.isEmpty() )
    1619           0 :         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
    1620             : 
    1621           0 :     if( !aSettings.maStrDateTimeDeclName.isEmpty() )
    1622           0 :         AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
    1623           0 : }
    1624             : 
    1625           0 : OUString SdXMLExport::ImpCreatePresPageStyleName( Reference<XDrawPage> xDrawPage, bool bExportBackground /* = true */ )
    1626             : {
    1627             :     // create name
    1628           0 :     OUString sStyleName;
    1629             : 
    1630             :     // create style for this page and add to auto style pool
    1631             : 
    1632           0 :     Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
    1633           0 :     if(xPropSet1.is())
    1634             :     {
    1635           0 :         Reference< beans::XPropertySet > xPropSet;
    1636             : 
    1637           0 :         if( bExportBackground )
    1638             :         {
    1639             :             // since the background items are in a different propertyset
    1640             :             // which itself is a property of the pages property set
    1641             :             // we now merge these two propertysets if possible to simulate
    1642             :             // a single propertyset with all draw page properties
    1643           0 :             const OUString aBackground("Background");
    1644           0 :             Reference< beans::XPropertySet > xPropSet2;
    1645           0 :             Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
    1646           0 :             if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
    1647             :             {
    1648           0 :                 Any aAny( xPropSet1->getPropertyValue( aBackground ) );
    1649           0 :                 aAny >>= xPropSet2;
    1650             :             }
    1651             : 
    1652           0 :             if( xPropSet2.is() )
    1653           0 :                 xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
    1654             :             else
    1655           0 :                 xPropSet = xPropSet1;
    1656             :         }
    1657             :         else
    1658             :         {
    1659           0 :             xPropSet = xPropSet1;
    1660             :         }
    1661             : 
    1662           0 :         const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
    1663             : 
    1664           0 :         std::vector< XMLPropertyState > xPropStates( aMapperRef->Filter( xPropSet ) );
    1665             : 
    1666           0 :         if( !xPropStates.empty() )
    1667             :         {
    1668             :             // there are filtered properties -> hard attributes
    1669             :             // try to find this style in AutoStylePool
    1670           0 :             sStyleName = GetAutoStylePool()->Find(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
    1671             : 
    1672           0 :             if(sStyleName.isEmpty())
    1673             :             {
    1674             :                 // Style did not exist, add it to AutoStalePool
    1675           0 :                 sStyleName = GetAutoStylePool()->Add(XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID, sStyleName, xPropStates);
    1676             :             }
    1677           0 :         }
    1678             :     }
    1679             : 
    1680           0 :     return sStyleName;
    1681             : }
    1682             : 
    1683           0 : void SdXMLExport::ImpPrepMasterPageInfos()
    1684             : {
    1685             :     // create draw:style-name entries for master page export
    1686             :     // containing only background attributes
    1687             :     // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
    1688             : 
    1689             :     sal_Int32 nCnt;
    1690           0 :     for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
    1691             :     {
    1692           0 :         Reference<XDrawPage> xDrawPage;
    1693           0 :         mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
    1694           0 :         maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
    1695           0 :     }
    1696             : 
    1697           0 :     if( IsImpress() )
    1698             :     {
    1699           0 :         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
    1700           0 :         if( xHandoutSupp.is() )
    1701             :         {
    1702           0 :             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
    1703           0 :             if( xHandoutPage.is() )
    1704             :             {
    1705           0 :                 maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
    1706           0 :                 maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
    1707           0 :             }
    1708           0 :         }
    1709             :     }
    1710           0 : }
    1711             : 
    1712           0 : void SdXMLExport::ImpWritePresentationStyles()
    1713             : {
    1714           0 :     if(IsImpress())
    1715             :     {
    1716           0 :         for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
    1717             :         {
    1718           0 :             Any aAny(mxDocMasterPages->getByIndex(nCnt));
    1719           0 :             Reference<container::XNamed> xNamed;
    1720             : 
    1721           0 :             if(aAny >>= xNamed)
    1722             :             {
    1723             :                 // write presentation styles (ONLY if presentation)
    1724           0 :                 if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
    1725             :                 {
    1726           0 :                     XMLStyleExport aStEx(*this, OUString(), GetAutoStylePool().get());
    1727           0 :                     const UniReference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
    1728             : 
    1729           0 :                     OUString aPrefix( xNamed->getName() );
    1730             : 
    1731           0 :                     aPrefix += "-";
    1732           0 :                     aStEx.exportStyleFamily(xNamed->getName(),
    1733             :                         OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
    1734             :                         aMapperRef, false,
    1735           0 :                         XML_STYLE_FAMILY_SD_PRESENTATION_ID, &aPrefix);
    1736             :                 }
    1737             :             }
    1738           0 :         }
    1739             :     }
    1740           0 : }
    1741             : 
    1742           0 : void SdXMLExport::SetProgress(sal_Int32 nProg)
    1743             : {
    1744             :     // set progress view
    1745           0 :     if(GetStatusIndicator().is())
    1746           0 :         GetStatusIndicator()->setValue(nProg);
    1747           0 : }
    1748             : 
    1749             : // #82003#
    1750             : 
    1751           0 : void SdXMLExport::_ExportMeta()
    1752             : {
    1753           0 :     uno::Sequence<beans::NamedValue> stats(1);
    1754           0 :     stats[0] = beans::NamedValue(OUString( "ObjectCount" ),
    1755           0 :                 uno::makeAny(mnObjectCount));
    1756             : 
    1757             :     // update document statistics at the model
    1758           0 :     uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
    1759           0 :         uno::UNO_QUERY_THROW);
    1760             :     uno::Reference<document::XDocumentProperties> xDocProps(
    1761           0 :         xPropSup->getDocumentProperties());
    1762           0 :     if (xDocProps.is()) {
    1763           0 :         xDocProps->setDocumentStatistics(stats);
    1764             :     }
    1765             : 
    1766             :     // call parent
    1767           0 :     SvXMLExport::_ExportMeta();
    1768           0 : }
    1769             : 
    1770           0 : void SdXMLExport::_ExportFontDecls()
    1771             : {
    1772           0 :     GetFontAutoStylePool(); // make sure the pool is created
    1773           0 :     SvXMLExport::_ExportFontDecls();
    1774           0 : }
    1775             : 
    1776           0 : void SdXMLExport::_ExportContent()
    1777             : {
    1778             :     // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
    1779           0 :     ImpWriteHeaderFooterDecls();
    1780             : 
    1781             :     // page export
    1782           0 :     for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
    1783             :     {
    1784           0 :         uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
    1785             : 
    1786           0 :         SetProgress(((nPageInd + 1) * 100) / mnDocDrawPageCount);
    1787             : 
    1788           0 :         if(xDrawPage.is())
    1789             :         {
    1790             :             // prepare page attributes, name of page
    1791           0 :             Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
    1792           0 :             if(xNamed.is())
    1793           0 :                 AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
    1794             : 
    1795             :             // draw:style-name (presentation page attributes AND background attributes)
    1796           0 :             if( !maDrawPagesStyleNames[nPageInd].isEmpty() )
    1797             :                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
    1798           0 :                         maDrawPagesStyleNames[nPageInd]);
    1799             : 
    1800             :             // draw:master-page-name
    1801           0 :             Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
    1802           0 :             if(xMasterPageInt.is())
    1803             :             {
    1804           0 :                 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
    1805           0 :                 if(xUsedMasterPage.is())
    1806             :                 {
    1807           0 :                     Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
    1808           0 :                     if(xMasterNamed.is())
    1809             :                     {
    1810             :                         AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
    1811           0 :                             EncodeStyleName( xMasterNamed->getName()) );
    1812           0 :                     }
    1813           0 :                 }
    1814             :             }
    1815             : 
    1816             :             // presentation:page-layout-name
    1817           0 :             if( IsImpress() && !maDrawPagesAutoLayoutNames[nPageInd+1].isEmpty())
    1818             :             {
    1819           0 :                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
    1820             :             }
    1821             : 
    1822           0 :             Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
    1823           0 :             if( xProps.is() )
    1824             :             {
    1825             :                 try
    1826             :                 {
    1827           0 :                     OUString aBookmarkURL;
    1828           0 :                     xProps->getPropertyValue("BookmarkURL") >>= aBookmarkURL;
    1829             : 
    1830           0 :                     if( !aBookmarkURL.isEmpty() )
    1831             :                     {
    1832           0 :                         sal_Int32 nIndex = aBookmarkURL.lastIndexOf( '#' );
    1833           0 :                         if( nIndex != -1 )
    1834             :                         {
    1835           0 :                             OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
    1836           0 :                             OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
    1837             : 
    1838           0 :                             aBookmarkURL = GetRelativeReference( aFileName ) + "#" + aBookmarkName;
    1839             :                         }
    1840             : 
    1841           0 :                         AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
    1842           0 :                         AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
    1843           0 :                         AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
    1844           0 :                         AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
    1845           0 :                     }
    1846             :                 }
    1847           0 :                 catch(const Exception&)
    1848             :                 {
    1849             :                     OSL_FAIL(" no \"BookmarkURL\" property at page?" );
    1850             :                 }
    1851             :             }
    1852             : 
    1853           0 :             if( IsImpress() )
    1854           0 :                 ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
    1855             : 
    1856           0 :             OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
    1857           0 :             if( !sNavigationOrder.isEmpty() )
    1858           0 :                 AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
    1859             : 
    1860           0 :             UniReference< xmloff::AnimationsExporter >  xAnimationsExporter;
    1861           0 :             uno::Reference< ::com::sun::star::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
    1862             : 
    1863             :             // prepare animation export
    1864           0 :             if(IsImpress())
    1865             :             {
    1866           0 :                 if( getExportFlags() & EXPORT_OASIS )
    1867             :                 {
    1868             :                     // export new animations for oasis format
    1869           0 :                     xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
    1870             : 
    1871             :                     // prepare animations exporter if impress
    1872           0 :                     if(xAnimNodeSupplier.is())
    1873             :                     {
    1874           0 :                         xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
    1875           0 :                         xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
    1876             :                     }
    1877             :                 }
    1878             :                 else
    1879             :                 {
    1880             :                     // export old animations for ooo format
    1881           0 :                     UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
    1882           0 :                     GetShapeExport()->setAnimationsExporter( xAnimExport );
    1883             :                 }
    1884             :             }
    1885             : 
    1886             :             // write draw:id
    1887           0 :             const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
    1888           0 :             if( !aPageId.isEmpty() )
    1889             :             {
    1890           0 :                 AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
    1891             :             }
    1892             : 
    1893             :             // write page
    1894           0 :             SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, true, true);
    1895             : 
    1896             :             // write optional office:forms
    1897           0 :             exportFormsElement( xDrawPage );
    1898             : 
    1899             :             // write graphic objects on this page (if any)
    1900           0 :             Reference< drawing::XShapes > xExportShapes(xDrawPage, UNO_QUERY);
    1901           0 :             if(xExportShapes.is() && xExportShapes->getCount())
    1902           0 :                 GetShapeExport()->exportShapes( xExportShapes );
    1903             : 
    1904             :             // write animations and presentation notes (ONLY if presentation)
    1905           0 :             if(IsImpress())
    1906             :             {
    1907           0 :                 if(xAnimNodeSupplier.is())
    1908             :                 {
    1909           0 :                     xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
    1910             :                 }
    1911             :                 else
    1912             :                 {
    1913             :                     // animations
    1914           0 :                     UniReference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
    1915           0 :                     if( xAnimExport.is() )
    1916           0 :                         xAnimExport->exportAnimations( *this );
    1917             : 
    1918           0 :                     xAnimExport = NULL;
    1919           0 :                     GetShapeExport()->setAnimationsExporter( xAnimExport );
    1920             :                 }
    1921             : 
    1922             :                 // presentations
    1923           0 :                 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
    1924           0 :                 if(xPresPage.is())
    1925             :                 {
    1926           0 :                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
    1927           0 :                     if(xNotesPage.is())
    1928             :                     {
    1929           0 :                         Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
    1930           0 :                         if(xShapes.is())
    1931             :                         {
    1932           0 :                             if( !maDrawNotesPagesStyleNames[nPageInd].isEmpty() )
    1933           0 :                                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
    1934             : 
    1935           0 :                             ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
    1936             : 
    1937             :                             // write presentation notes
    1938           0 :                             SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true);
    1939             : 
    1940             :                             // write optional office:forms
    1941           0 :                             exportFormsElement( xNotesPage );
    1942             : 
    1943             :                             // write shapes per se
    1944           0 :                             GetShapeExport()->exportShapes( xShapes );
    1945           0 :                         }
    1946           0 :                     }
    1947           0 :                 }
    1948             :             }
    1949             : 
    1950           0 :             exportAnnotations( xDrawPage );
    1951             :         }
    1952           0 :     }
    1953             : 
    1954           0 :     if( IsImpress() )
    1955           0 :         exportPresentationSettings();
    1956           0 : }
    1957             : 
    1958           0 : void SdXMLExport::exportPresentationSettings()
    1959             : {
    1960             :     try
    1961             :     {
    1962           0 :         Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
    1963           0 :         if( !xPresSupplier.is() )
    1964           0 :             return;
    1965             : 
    1966           0 :         Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
    1967           0 :         if( !xPresProps.is() )
    1968           0 :             return;
    1969             : 
    1970           0 :         sal_Bool bHasAttr = sal_False;
    1971             : 
    1972           0 :         sal_Bool bTemp = false;
    1973             : 
    1974             :         // export range
    1975           0 :         xPresProps->getPropertyValue("IsShowAll") >>= bTemp;
    1976           0 :         if( !bTemp )
    1977             :         {
    1978           0 :             OUString aFirstPage;
    1979           0 :             xPresProps->getPropertyValue("FirstPage") >>= aFirstPage;
    1980           0 :             if( !aFirstPage.isEmpty() )
    1981             :             {
    1982           0 :                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
    1983           0 :                 bHasAttr = sal_True;
    1984             :             }
    1985             :             else
    1986             :             {
    1987           0 :                 OUString aCustomShow;
    1988           0 :                 xPresProps->getPropertyValue("CustomShow") >>= aCustomShow;
    1989           0 :                 if( !aCustomShow.isEmpty() )
    1990             :                 {
    1991           0 :                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
    1992           0 :                     bHasAttr = sal_True;
    1993           0 :                 }
    1994           0 :             }
    1995             :         }
    1996             : 
    1997           0 :         xPresProps->getPropertyValue("IsEndless") >>= bTemp;
    1998           0 :         if( bTemp )
    1999             :         {
    2000           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
    2001           0 :             bHasAttr = sal_True;
    2002             : 
    2003           0 :             sal_Int32 nPause = 0;
    2004           0 :             xPresProps->getPropertyValue("Pause") >>= nPause;
    2005             : 
    2006           0 :             util::Duration aDuration;
    2007           0 :             aDuration.Seconds = static_cast<sal_uInt16>(nPause);
    2008             : 
    2009           0 :             OUStringBuffer aOut;
    2010           0 :             ::sax::Converter::convertDuration(aOut, aDuration);
    2011           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
    2012             :         }
    2013             : 
    2014           0 :         xPresProps->getPropertyValue("AllowAnimations") >>= bTemp;
    2015           0 :         if( !bTemp )
    2016             :         {
    2017           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
    2018           0 :             bHasAttr = sal_True;
    2019             :         }
    2020             : 
    2021           0 :         xPresProps->getPropertyValue("IsAlwaysOnTop") >>= bTemp;
    2022           0 :         if( bTemp )
    2023             :         {
    2024           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
    2025           0 :             bHasAttr = sal_True;
    2026             :         }
    2027             : 
    2028           0 :         xPresProps->getPropertyValue("IsAutomatic") >>= bTemp;
    2029           0 :         if( bTemp )
    2030             :         {
    2031           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
    2032           0 :             bHasAttr = sal_True;
    2033             :         }
    2034             : 
    2035           0 :         xPresProps->getPropertyValue("IsFullScreen") >>= bTemp;
    2036           0 :         if( !bTemp )
    2037             :         {
    2038           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
    2039           0 :             bHasAttr = sal_True;
    2040             :         }
    2041             : 
    2042           0 :         xPresProps->getPropertyValue("IsMouseVisible") >>= bTemp;
    2043           0 :         if( !bTemp )
    2044             :         {
    2045           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, XML_FALSE );
    2046           0 :             bHasAttr = sal_True;
    2047             :         }
    2048             : 
    2049           0 :         xPresProps->getPropertyValue("StartWithNavigator") >>= bTemp;
    2050           0 :         if( bTemp )
    2051             :         {
    2052           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
    2053           0 :             bHasAttr = sal_True;
    2054             :         }
    2055             : 
    2056           0 :         xPresProps->getPropertyValue("UsePen") >>= bTemp;
    2057           0 :         if( bTemp )
    2058             :         {
    2059           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
    2060           0 :             bHasAttr = sal_True;
    2061             :         }
    2062             : 
    2063           0 :         xPresProps->getPropertyValue("IsTransitionOnClick") >>= bTemp;
    2064           0 :         if( !bTemp )
    2065             :         {
    2066           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
    2067           0 :             bHasAttr = sal_True;
    2068             :         }
    2069             : 
    2070           0 :         xPresProps->getPropertyValue("IsShowLogo") >>= bTemp;
    2071           0 :         if( bTemp )
    2072             :         {
    2073           0 :             AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
    2074           0 :             bHasAttr = sal_True;
    2075             :         }
    2076             : 
    2077           0 :         Reference< container::XNameContainer > xShows;
    2078           0 :         Sequence< OUString > aShowNames;
    2079           0 :         const OUString* pShowNames = NULL;
    2080           0 :         sal_Int32 nShowCount = 0;
    2081             : 
    2082           0 :         Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
    2083           0 :         if( xSup.is() )
    2084             :         {
    2085           0 :             xShows = xSup->getCustomPresentations();
    2086           0 :             if( xShows.is() )
    2087             :             {
    2088           0 :                 aShowNames = xShows->getElementNames();
    2089           0 :                 pShowNames = aShowNames.getArray();
    2090           0 :                 nShowCount = aShowNames.getLength();
    2091             :             }
    2092             :         }
    2093             : 
    2094           0 :         if( bHasAttr || nShowCount != 0 )
    2095             :         {
    2096           0 :             SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, true, true);
    2097             : 
    2098           0 :             if( nShowCount == 0 )
    2099           0 :                 return;
    2100             : 
    2101           0 :             Reference< XIndexContainer > xShow;
    2102           0 :             Reference< XNamed > xPageName;
    2103             : 
    2104           0 :             OUStringBuffer sTmp;
    2105             : 
    2106           0 :             for( sal_Int32 nIndex = 0; nIndex < nShowCount; nIndex++, pShowNames++ )
    2107             :             {
    2108           0 :                 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, *pShowNames );
    2109             : 
    2110           0 :                 xShows->getByName( *pShowNames ) >>= xShow;
    2111             :                 DBG_ASSERT( xShow.is(), "invalid custom show!" );
    2112           0 :                 if( !xShow.is() )
    2113           0 :                     continue;
    2114             : 
    2115           0 :                 const sal_Int32 nPageCount = xShow->getCount();
    2116           0 :                 for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
    2117             :                 {
    2118           0 :                     xShow->getByIndex( nPage ) >>= xPageName;
    2119             : 
    2120           0 :                     if( !xPageName.is() )
    2121           0 :                         continue;
    2122             : 
    2123           0 :                     if( !sTmp.isEmpty() )
    2124           0 :                         sTmp.append(  ',' );
    2125           0 :                     sTmp.append( xPageName->getName() );
    2126             : 
    2127             :                 }
    2128             : 
    2129           0 :                 if( !sTmp.isEmpty() )
    2130           0 :                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
    2131             : 
    2132           0 :                 SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, true, true);
    2133           0 :             }
    2134           0 :         }
    2135             :     }
    2136           0 :     catch(const uno::Exception&)
    2137             :     {
    2138             :         OSL_FAIL( "uno::Exception while exporting <presentation:settings>" );
    2139             :     }
    2140             : }
    2141             : 
    2142           0 : void SdXMLExport::_ExportStyles(bool bUsed)
    2143             : {
    2144           0 :     GetPropertySetMapper()->SetAutoStyles( sal_False );
    2145             : 
    2146             :     // export fill styles
    2147           0 :     SvXMLExport::_ExportStyles( bUsed );
    2148             : 
    2149             :     // write draw:style-name for object graphic-styles
    2150           0 :     GetShapeExport()->ExportGraphicDefaults();
    2151             : 
    2152             :     // do not export in ODF 1.1 or older
    2153           0 :     if( getDefaultVersion() >= SvtSaveOptions::ODFVER_012 )
    2154           0 :         GetShapeExport()->GetShapeTableExport()->exportTableStyles();
    2155             : 
    2156             :     // write presentation styles
    2157           0 :     ImpWritePresentationStyles();
    2158             : 
    2159             :     // prepare draw:auto-layout-name for page export
    2160           0 :     ImpPrepAutoLayoutInfos();
    2161             : 
    2162             :     // write draw:auto-layout-name for page export
    2163           0 :     ImpWriteAutoLayoutInfos();
    2164             : 
    2165           0 :     Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
    2166           0 :     if( xInfoSet.is() )
    2167             :     {
    2168           0 :         Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
    2169             : 
    2170           0 :         Any aAny;
    2171             : 
    2172           0 :         if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
    2173             :         {
    2174           0 :             aAny <<= maDrawPagesAutoLayoutNames;
    2175           0 :             xInfoSet->setPropertyValue( msPageLayoutNames, aAny );
    2176           0 :         }
    2177           0 :     }
    2178           0 : }
    2179             : 
    2180           0 : void SdXMLExport::_ExportAutoStyles()
    2181             : {
    2182           0 :     Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
    2183           0 :     if( xInfoSet.is() )
    2184             :     {
    2185           0 :         Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
    2186             : 
    2187           0 :         if( xInfoSetInfo->hasPropertyByName( msPageLayoutNames ) )
    2188             :         {
    2189           0 :             xInfoSet->getPropertyValue( msPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
    2190           0 :         }
    2191             :     }
    2192             : 
    2193           0 :     GetPropertySetMapper()->SetAutoStyles( sal_True );
    2194             : 
    2195           0 :     if( getExportFlags() & EXPORT_STYLES )
    2196             :     {
    2197             :         // #80012# PageMaster export moved from _ExportStyles
    2198             :         // prepare page-master infos
    2199           0 :         ImpPrepPageMasterInfos();
    2200             : 
    2201             :         // write page-master infos
    2202           0 :         ImpWritePageMasterInfos();
    2203             : 
    2204             :         // prepare draw:style-name for master page export
    2205           0 :         ImpPrepMasterPageInfos();
    2206             :     }
    2207             : 
    2208           0 :     if( getExportFlags() & EXPORT_CONTENT )
    2209             :     {
    2210             :         // prepare draw:style-name for page export
    2211           0 :         ImpPrepDrawPageInfos();
    2212             :     }
    2213             : 
    2214             :     // export draw-page styles
    2215             :     GetAutoStylePool()->exportXML(
    2216             :         XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID
    2217           0 :         , GetDocHandler(),
    2218           0 :         GetMM100UnitConverter(),
    2219           0 :         GetNamespaceMap()
    2220           0 :         );
    2221             : 
    2222           0 :     if( getExportFlags() & EXPORT_STYLES )
    2223             :     {
    2224             :         // create auto style infos for shapes on master handout page
    2225           0 :         if( IsImpress() )
    2226             :         {
    2227           0 :             Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
    2228           0 :             if( xHandoutSupp.is() )
    2229             :             {
    2230           0 :                 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
    2231           0 :                 if( xHandoutPage.is() )
    2232             :                 {
    2233           0 :                     Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
    2234           0 :                     if(xShapes.is() && xShapes->getCount())
    2235           0 :                         GetShapeExport()->collectShapesAutoStyles( xShapes );
    2236           0 :                 }
    2237           0 :             }
    2238             :         }
    2239             : 
    2240             :         // create auto style infos for objects on master pages
    2241           0 :         for(sal_Int32 nMPageId(0L); nMPageId < mnDocMasterPageCount; nMPageId++)
    2242             :         {
    2243           0 :             Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
    2244             : 
    2245           0 :             if( xMasterPage.is() )
    2246             :             {
    2247             :                 // collect layer information
    2248           0 :                 GetFormExport()->examineForms( xMasterPage );
    2249             : 
    2250             :                 // get MasterPage Name
    2251           0 :                 OUString aMasterPageNamePrefix;
    2252           0 :                 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
    2253           0 :                 if(xNamed.is())
    2254             :                 {
    2255           0 :                     aMasterPageNamePrefix = xNamed->getName();
    2256             :                 }
    2257           0 :                 if(!aMasterPageNamePrefix.isEmpty())
    2258             :                 {
    2259           0 :                     aMasterPageNamePrefix += "-";
    2260             :                 }
    2261           0 :                 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
    2262             : 
    2263           0 :                 Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
    2264           0 :                 if(xMasterShapes.is() && xMasterShapes->getCount())
    2265           0 :                     GetShapeExport()->collectShapesAutoStyles( xMasterShapes );
    2266             : 
    2267           0 :                 if(IsImpress())
    2268             :                 {
    2269           0 :                     Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
    2270           0 :                     if(xPresPage.is())
    2271             :                     {
    2272           0 :                         Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
    2273           0 :                         if(xNotesPage.is())
    2274             :                         {
    2275             :                             // collect layer information
    2276           0 :                             GetFormExport()->examineForms( xNotesPage );
    2277             : 
    2278           0 :                             Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
    2279           0 :                             if(xShapes.is() && xShapes->getCount())
    2280           0 :                                 GetShapeExport()->collectShapesAutoStyles( xShapes );
    2281           0 :                         }
    2282           0 :                     }
    2283             :                 }
    2284           0 :                 collectAnnotationAutoStyles(xMasterPage);
    2285             :             }
    2286           0 :         }
    2287             :     }
    2288             : 
    2289           0 :     if( getExportFlags() & EXPORT_CONTENT )
    2290             :     {
    2291             :         // prepare animations exporter if impress
    2292           0 :         if(IsImpress() && ((getExportFlags() & EXPORT_OASIS) == 0) )
    2293             :         {
    2294           0 :             UniReference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter( GetShapeExport().get() );
    2295           0 :             GetShapeExport()->setAnimationsExporter( xAnimExport );
    2296             :         }
    2297             : 
    2298             :         // create auto style infos for objects on pages
    2299           0 :         for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
    2300             :         {
    2301           0 :             Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
    2302           0 :             if( xDrawPage.is() )
    2303             :             {
    2304             :                 // collect layer information
    2305           0 :                 GetFormExport()->examineForms( xDrawPage );
    2306             : 
    2307             :                 // get MasterPage Name
    2308           0 :                 OUString aMasterPageNamePrefix;
    2309           0 :                 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
    2310           0 :                 if(xMasterPageInt.is())
    2311             :                 {
    2312           0 :                     Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
    2313           0 :                     if(xUsedMasterPage.is())
    2314             :                     {
    2315           0 :                         Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
    2316           0 :                         if(xMasterNamed.is())
    2317             :                         {
    2318           0 :                             aMasterPageNamePrefix = xMasterNamed->getName();
    2319           0 :                         }
    2320           0 :                     }
    2321             :                 }
    2322           0 :                 if(!aMasterPageNamePrefix.isEmpty())
    2323             :                 {
    2324           0 :                     aMasterPageNamePrefix += "-";
    2325             :                 }
    2326             : 
    2327           0 :                 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
    2328             : 
    2329             :                 // prepare object infos
    2330           0 :                 Reference< drawing::XShapes > xDrawShapes(xDrawPage, UNO_QUERY);
    2331           0 :                 if(xDrawShapes.is() && xDrawShapes->getCount())
    2332           0 :                     GetShapeExport()->collectShapesAutoStyles( xDrawShapes );
    2333             : 
    2334             :                 // prepare presentation notes page object infos (ONLY if presentation)
    2335           0 :                 if(IsImpress())
    2336             :                 {
    2337           0 :                     Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
    2338           0 :                     if(xPresPage.is())
    2339             :                     {
    2340           0 :                         Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
    2341           0 :                         if(xNotesPage.is())
    2342             :                         {
    2343             :                             // collect layer information
    2344           0 :                             GetFormExport()->examineForms( xNotesPage );
    2345             : 
    2346           0 :                             Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
    2347           0 :                             if(xShapes.is() && xShapes->getCount())
    2348           0 :                                 GetShapeExport()->collectShapesAutoStyles( xShapes );
    2349           0 :                         }
    2350           0 :                     }
    2351             :                 }
    2352             : 
    2353           0 :                 collectAnnotationAutoStyles( xDrawPage );
    2354             :             }
    2355           0 :         }
    2356           0 :         if(IsImpress())
    2357             :         {
    2358           0 :             UniReference< XMLAnimationsExporter > xAnimExport;
    2359           0 :             GetShapeExport()->setAnimationsExporter( xAnimExport );
    2360             :         }
    2361             :     }
    2362             : 
    2363           0 :     exportAutoDataStyles();
    2364             : 
    2365           0 :     GetShapeExport()->exportAutoStyles();
    2366             : 
    2367           0 :     sal_uInt16 nContentAutostyles = EXPORT_CONTENT | EXPORT_AUTOSTYLES;
    2368           0 :     if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
    2369           0 :         GetFormExport()->exportAutoStyles( );
    2370             : 
    2371             :     // ...for text
    2372           0 :     GetTextParagraphExport()->exportTextAutoStyles();
    2373           0 : }
    2374             : 
    2375           0 : void SdXMLExport::_ExportMasterStyles()
    2376             : {
    2377             :     // export layer
    2378           0 :     SdXMLayerExporter::exportLayer( *this );
    2379             : 
    2380             :     // export handout master page if impress
    2381           0 :     if( IsImpress() )
    2382             :     {
    2383           0 :         Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
    2384           0 :         if( xHandoutSupp.is() )
    2385             :         {
    2386           0 :             Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
    2387           0 :             if( xHandoutPage.is() )
    2388             :             {
    2389             :                 // presentation:page-layout-name
    2390           0 :                 if( IsImpress() && !maDrawPagesAutoLayoutNames[0].isEmpty())
    2391             :                 {
    2392           0 :                     AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
    2393             :                 }
    2394             : 
    2395           0 :                 ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
    2396           0 :                 if(pInfo)
    2397             :                 {
    2398           0 :                     OUString sString = pInfo->GetName();
    2399           0 :                     AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
    2400             :                 }
    2401             : 
    2402             :                 // draw:style-name
    2403           0 :                 if( !maHandoutMasterStyleName.isEmpty() )
    2404           0 :                     AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
    2405             : 
    2406           0 :                 ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
    2407             : 
    2408             :                 // write masterpage
    2409           0 :                 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, true, true);
    2410             : 
    2411             :                 // write graphic objects on this master page (if any)
    2412           0 :                 Reference< drawing::XShapes > xShapes(xHandoutPage, UNO_QUERY);
    2413           0 :                 if(xShapes.is() && xShapes->getCount())
    2414           0 :                     GetShapeExport()->exportShapes( xShapes );
    2415           0 :             }
    2416           0 :         }
    2417             :     }
    2418             : 
    2419             :     // export MasterPages in master-styles section
    2420           0 :     for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
    2421             :     {
    2422           0 :         Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
    2423           0 :         if(xMasterPage.is())
    2424             :         {
    2425             :             // prepare masterpage attributes
    2426           0 :             OUString sMasterPageName;
    2427           0 :             Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
    2428           0 :             if(xNamed.is())
    2429             :             {
    2430           0 :                 bool bEncoded = false;
    2431           0 :                 sMasterPageName = xNamed->getName();
    2432             :                 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
    2433           0 :                     EncodeStyleName( sMasterPageName, &bEncoded ));
    2434           0 :                 if( bEncoded )
    2435             :                     AddAttribute(
    2436             :                         XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
    2437           0 :                         sMasterPageName );
    2438             :             }
    2439             : 
    2440           0 :             ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->at( nMPageId );
    2441           0 :             if(pInfo)
    2442             :             {
    2443           0 :                 OUString sString = pInfo->GetName();
    2444           0 :                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
    2445             :             }
    2446             : 
    2447             :             // draw:style-name (background attributes)
    2448           0 :             if( !maMasterPagesStyleNames[nMPageId].isEmpty() )
    2449             :                 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
    2450           0 :                         maMasterPagesStyleNames[nMPageId]);
    2451             : 
    2452             :             // write masterpage
    2453           0 :             SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, true, true);
    2454             : 
    2455             :             // write optional office:forms
    2456           0 :             exportFormsElement( xMasterPage );
    2457             : 
    2458             :             // write graphic objects on this master page (if any)
    2459           0 :             Reference< drawing::XShapes > xMasterShapes(xMasterPage, UNO_QUERY);
    2460           0 :             if(xMasterShapes.is() && xMasterShapes->getCount())
    2461           0 :                 GetShapeExport()->exportShapes( xMasterShapes );
    2462             : 
    2463             :             // write presentation notes (ONLY if presentation)
    2464           0 :             if(IsImpress())
    2465             :             {
    2466           0 :                 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
    2467           0 :                 if(xPresPage.is())
    2468             :                 {
    2469           0 :                     Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
    2470           0 :                     if(xNotesPage.is())
    2471             :                     {
    2472           0 :                         Reference< drawing::XShapes > xShapes(xNotesPage, UNO_QUERY);
    2473           0 :                         if(xShapes.is())
    2474             :                         {
    2475           0 :                             ImpXMLEXPPageMasterInfo* pMasterInfo = mpNotesPageMasterUsageList->at( nMPageId );
    2476           0 :                             if(pMasterInfo)
    2477             :                             {
    2478           0 :                                 OUString sString = pMasterInfo->GetName();
    2479           0 :                                 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
    2480             :                             }
    2481             : 
    2482             :                             // write presentation notes
    2483           0 :                             SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true);
    2484             : 
    2485             :                             // write optional office:forms
    2486           0 :                             exportFormsElement( xNotesPage );
    2487             : 
    2488             :                             // write shapes per se
    2489           0 :                             GetShapeExport()->exportShapes( xShapes );
    2490           0 :                         }
    2491           0 :                     }
    2492           0 :                 }
    2493             :             }
    2494           0 :             exportAnnotations( xMasterPage );
    2495             :         }
    2496           0 :     }
    2497           0 : }
    2498             : 
    2499           0 : void SdXMLExport::exportFormsElement( Reference< XDrawPage > xDrawPage )
    2500             : {
    2501           0 :     if( xDrawPage.is() )
    2502             :     {
    2503           0 :         Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
    2504           0 :         if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
    2505             :         {
    2506             :             // write masterpage
    2507           0 :             ::xmloff::OOfficeFormsExport aForms(*this);
    2508           0 :             GetFormExport()->exportForms( xDrawPage );
    2509             :         }
    2510             : 
    2511           0 :         if(! GetFormExport()->seekPage( xDrawPage ) )
    2512             :         {
    2513             :             OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" );
    2514           0 :         }
    2515             :     }
    2516           0 : }
    2517             : 
    2518           0 : void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
    2519             : {
    2520           0 :     rProps.realloc(4);
    2521           0 :     beans::PropertyValue* pProps = rProps.getArray();
    2522           0 :     if(pProps)
    2523             :     {
    2524           0 :         Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
    2525           0 :         if( !xPropSet.is() )
    2526           0 :             return;
    2527             : 
    2528           0 :         awt::Rectangle aVisArea;
    2529           0 :         xPropSet->getPropertyValue("VisibleArea") >>= aVisArea;
    2530             : 
    2531           0 :         sal_uInt16 i = 0;
    2532           0 :         pProps[i].Name = "VisibleAreaTop";
    2533           0 :         pProps[i++].Value <<= aVisArea.Y;
    2534           0 :         pProps[i].Name = "VisibleAreaLeft";
    2535           0 :         pProps[i++].Value <<= aVisArea.X;
    2536           0 :         pProps[i].Name = "VisibleAreaWidth";
    2537           0 :         pProps[i++].Value <<= aVisArea.Width;
    2538           0 :         pProps[i].Name = "VisibleAreaHeight";
    2539           0 :         pProps[i++].Value <<= aVisArea.Height;
    2540             :     }
    2541             : }
    2542             : 
    2543           0 : void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
    2544             : {
    2545           0 :     Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
    2546           0 :     if( xFac.is() )
    2547             :     {
    2548           0 :         Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
    2549           0 :         if( xProps.is() )
    2550           0 :             SvXMLUnitConverter::convertPropertySet( rProps, xProps );
    2551             :         DocumentSettingsSerializer *pFilter;
    2552           0 :         pFilter = dynamic_cast<DocumentSettingsSerializer *>(xProps.get());
    2553           0 :         if( pFilter )
    2554           0 :             rProps = pFilter->filterStreamsToStorage( GetTargetStorage(), rProps );
    2555           0 :     }
    2556           0 : }
    2557             : 
    2558           0 : void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat )
    2559             : {
    2560           0 :     sal_Int32 nFormat = nNumberFormat;
    2561           0 :     if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
    2562           0 :         nFormat -= 2;
    2563             : 
    2564           0 :     if( bTimeFormat )
    2565             :     {
    2566           0 :         if( maUsedTimeStyles.count( nFormat ) == 0 )
    2567           0 :             maUsedTimeStyles.insert( nFormat );
    2568             :     }
    2569             :     else
    2570             :     {
    2571           0 :         if( maUsedDateStyles.count( nFormat ) == 0 )
    2572           0 :             maUsedDateStyles.insert( nFormat );
    2573             :     }
    2574           0 : }
    2575             : 
    2576           0 : void SdXMLExport::exportDataStyles()
    2577             : {
    2578             :     // there are no data styles to export in draw/impress yet
    2579           0 : }
    2580             : 
    2581           0 : void SdXMLExport::exportAutoDataStyles()
    2582             : {
    2583           0 :     SdXMLFormatMap::iterator aIter( maUsedDateStyles.begin() );
    2584           0 :     SdXMLFormatMap::iterator aEnd( maUsedDateStyles.end() );
    2585             : 
    2586           0 :     while( aIter != aEnd )
    2587           0 :         SdXMLNumberStylesExporter::exportDateStyle( *this, (*aIter++) );
    2588             : 
    2589           0 :     aIter = maUsedTimeStyles.begin();
    2590           0 :     aEnd = maUsedTimeStyles.end();
    2591           0 :     while( aIter != aEnd )
    2592           0 :         SdXMLNumberStylesExporter::exportTimeStyle( *this, (*aIter++) );
    2593             : 
    2594           0 :     if(HasFormExport())
    2595           0 :         GetFormExport()->exportAutoControlNumberStyles();
    2596           0 : }
    2597             : 
    2598           0 : OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat ) const
    2599             : {
    2600           0 :     if( bTimeFormat )
    2601             :     {
    2602           0 :         return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
    2603             :     }
    2604             :     else
    2605             :     {
    2606           0 :         return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
    2607             :     }
    2608             : }
    2609             : 
    2610           0 : OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
    2611             : {
    2612           0 :     OUStringBuffer sNavOrder;
    2613             :     try
    2614             :     {
    2615           0 :         Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
    2616           0 :         Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue("NavigationOrder"), UNO_QUERY_THROW );
    2617             : 
    2618           0 :         Reference< XIndexAccess > xZOrderAccess( xDrawPage, UNO_QUERY );
    2619             : 
    2620             :         // only export navigation order if it is different from the z-order
    2621           0 :         if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount())  )
    2622             :         {
    2623             :             sal_Int32 nIndex;
    2624           0 :             const sal_Int32 nCount = xNavOrder->getCount();
    2625           0 :             for( nIndex = 0; nIndex < nCount; ++nIndex )
    2626             :             {
    2627           0 :                 OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
    2628           0 :                 if( !sId.isEmpty() )
    2629             :                 {
    2630           0 :                     if( !sNavOrder.isEmpty() )
    2631           0 :                         sNavOrder.append( ' ' );
    2632           0 :                     sNavOrder.append( sId );
    2633             :                 }
    2634           0 :             }
    2635           0 :         }
    2636             :     }
    2637           0 :     catch(const Exception&)
    2638             :     {
    2639             :     }
    2640           0 :     return sNavOrder.makeStringAndClear();
    2641             : }
    2642             : 
    2643           0 : void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
    2644             : {
    2645           0 :     Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
    2646           0 :     if( xAnnotationAccess.is() ) try
    2647             :     {
    2648           0 :         Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
    2649           0 :         if( xAnnotationEnumeration.is() )
    2650             :         {
    2651           0 :             while( xAnnotationEnumeration->hasMoreElements() )
    2652             :             {
    2653           0 :                 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
    2654           0 :                 Reference< XText > xText( xAnnotation->getTextRange() );
    2655           0 :                 if(xText.is() && !xText->getString().isEmpty())
    2656           0 :                     GetTextParagraphExport()->collectTextAutoStyles( xText );
    2657           0 :             }
    2658           0 :         }
    2659             :     }
    2660           0 :     catch(const Exception&)
    2661             :     {
    2662             :         OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles");
    2663           0 :     }
    2664           0 : }
    2665             : 
    2666           0 : void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
    2667             : {
    2668             :     // do not export in ODF 1.2 or older
    2669           0 :     if( getDefaultVersion() <= SvtSaveOptions::ODFVER_012 )
    2670           0 :         return;
    2671             : 
    2672           0 :     Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
    2673           0 :     if( xAnnotationAccess.is() ) try
    2674             :     {
    2675           0 :         Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
    2676           0 :         if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
    2677             :         {
    2678           0 :             OUStringBuffer sStringBuffer;
    2679           0 :             do
    2680             :             {
    2681           0 :                 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_QUERY_THROW );
    2682             : 
    2683           0 :                 RealPoint2D aPosition( xAnnotation->getPosition() );
    2684             : 
    2685           0 :                 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    2686           0 :                         static_cast<sal_Int32>( aPosition.X * 100 ) );
    2687           0 :                 AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
    2688             : 
    2689           0 :                 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    2690           0 :                         static_cast<sal_Int32>( aPosition.Y * 100 ) );
    2691           0 :                 AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
    2692             : 
    2693           0 :                 RealSize2D aSize( xAnnotation->getSize() );
    2694             : 
    2695           0 :                 if( aSize.Width || aSize.Height )
    2696             :                 {
    2697           0 :                     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    2698           0 :                             static_cast<sal_Int32>( aSize.Width * 100 ) );
    2699           0 :                     AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
    2700           0 :                     GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
    2701           0 :                             static_cast<sal_Int32>( aSize.Height * 100 ) );
    2702           0 :                     AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
    2703             :                 }
    2704             : 
    2705             :                 // annotation element + content
    2706           0 :                 SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, false, true);
    2707             : 
    2708             :                 // author
    2709           0 :                 OUString aAuthor( xAnnotation->getAuthor() );
    2710           0 :                 if( !aAuthor.isEmpty() )
    2711             :                 {
    2712           0 :                     SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, true, false );
    2713           0 :                     this->Characters(aAuthor);
    2714             :                 }
    2715             : 
    2716             :                 {
    2717             :                     // date time
    2718           0 :                     com::sun::star::util::DateTime aDate( xAnnotation->getDateTime() );
    2719           0 :                     ::sax::Converter::convertDateTime(sStringBuffer, aDate, 0, true);
    2720           0 :                     SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, true, false );
    2721           0 :                     Characters(sStringBuffer.makeStringAndClear());
    2722             :                 }
    2723             : 
    2724           0 :                 com::sun::star::uno::Reference < com::sun::star::text::XText > xText( xAnnotation->getTextRange() );
    2725           0 :                 if( xText.is() )
    2726           0 :                     this->GetTextParagraphExport()->exportText( xText );
    2727             :             }
    2728           0 :             while( xAnnotationEnumeration->hasMoreElements() );
    2729           0 :         }
    2730             :     }
    2731           0 :     catch(const Exception&)
    2732             :     {
    2733             :         OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations");
    2734           0 :     }
    2735             : }
    2736             : 
    2737             : #define SERVICE( classname, servicename, implementationname, draw, flags )\
    2738             : uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw()\
    2739             : {\
    2740             :     const OUString aServiceName( servicename );\
    2741             :     const uno::Sequence< OUString > aSeq( &aServiceName, 1 );\
    2742             :     return aSeq;\
    2743             : }\
    2744             : OUString SAL_CALL classname##_getImplementationName() throw()\
    2745             : {\
    2746             :     return OUString( implementationname );\
    2747             : }\
    2748             : uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\
    2749             : {\
    2750             :     return (cppu::OWeakObject*)new SdXMLExport( comphelper::getComponentContext(rSMgr), implementationname, draw, flags ); \
    2751             : }
    2752             : 
    2753           0 : SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2754           0 : SERVICE( XMLImpressStylesExportOasis, "com.sun.star.comp.Impress.XMLOasisStylesExporter", "XMLImpressStylesExportOasis", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS );
    2755           0 : SERVICE( XMLImpressContentExportOasis, "com.sun.star.comp.Impress.XMLOasisContentExporter", "XMLImpressContentExportOasis", sal_False, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
    2756           0 : SERVICE( XMLImpressMetaExportOasis, "com.sun.star.comp.Impress.XMLOasisMetaExporter", "XMLImpressMetaExportOasis", sal_False, EXPORT_OASIS|EXPORT_META );
    2757           0 : SERVICE( XMLImpressSettingsExportOasis, "com.sun.star.comp.Impress.XMLOasisSettingsExporter", "XMLImpressSettingsExportOasis", sal_False, EXPORT_OASIS|EXPORT_SETTINGS );
    2758             : 
    2759           0 : SERVICE( XMLImpressExportOOO, "com.sun.star.comp.Impress.XMLExporter", "XMLImpressExportOOO", sal_False, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2760           0 : SERVICE( XMLImpressStylesExportOOO, "com.sun.star.comp.Impress.XMLStylesExporter", "XMLImpressStylesExportOOO", sal_False, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS );
    2761           0 : SERVICE( XMLImpressContentExportOOO, "com.sun.star.comp.Impress.XMLContentExporter", "XMLImpressContentExportOOO", sal_False, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
    2762           0 : SERVICE( XMLImpressMetaExportOOO, "com.sun.star.comp.Impress.XMLMetaExporter", "XMLImpressMetaExportOOO", sal_False, EXPORT_META );
    2763           0 : SERVICE( XMLImpressSettingsExportOOO, "com.sun.star.comp.Impress.XMLSettingsExporter", "XMLImpressSettingsExportOOO", sal_False, EXPORT_SETTINGS );
    2764             : 
    2765           0 : SERVICE( XMLDrawExportOasis, "com.sun.star.comp.Draw.XMLOasisExporter", "XMLDrawExportOasis", sal_True, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2766           0 : SERVICE( XMLDrawStylesExportOasis, "com.sun.star.comp.Draw.XMLOasisStylesExporter", "XMLDrawStylesExportOasis", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS );
    2767           0 : SERVICE( XMLDrawContentExportOasis, "com.sun.star.comp.Draw.XMLOasisContentExporter", "XMLDrawContentExportOasis", sal_True, EXPORT_OASIS|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
    2768           0 : SERVICE( XMLDrawMetaExportOasis, "com.sun.star.comp.Draw.XMLOasisMetaExporter", "XMLDrawMetaExportOasis", sal_True, EXPORT_OASIS|EXPORT_META );
    2769           0 : SERVICE( XMLDrawSettingsExportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsExporter", "XMLDrawSettingsExportOasis", sal_True, EXPORT_OASIS|EXPORT_SETTINGS );
    2770             : 
    2771           0 : SERVICE( XMLDrawExportOOO, "com.sun.star.comp.Draw.XMLExporter", "XMLDrawExportOOO", sal_True, EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2772           0 : SERVICE( XMLDrawStylesExportOOO, "com.sun.star.comp.Draw.XMLStylesExporter", "XMLDrawStylesExportOOO", sal_True, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS );
    2773           0 : SERVICE( XMLDrawContentExportOOO, "com.sun.star.comp.Draw.XMLContentExporter", "XMLDrawContentExportOOO", sal_True, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS );
    2774           0 : SERVICE( XMLDrawMetaExportOOO, "com.sun.star.comp.Draw.XMLMetaExporter", "XMLDrawMetaExportOOO", sal_True, EXPORT_META );
    2775           0 : SERVICE( XMLDrawSettingsExportOOO, "com.sun.star.comp.Draw.XMLSettingsExporter", "XMLDrawSettingsExportOOO", sal_True, EXPORT_SETTINGS );
    2776             : 
    2777           0 : SERVICE( XMLDrawingLayerExport, "com.sun.star.comp.DrawingLayer.XMLExporter", "XMLDrawingLayerExport", sal_True, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2778           0 : SERVICE( XMLImpressClipboardExport, "com.sun.star.comp.Impress.XMLClipboardExporter", "XMLImpressClipboardExport", sal_False, EXPORT_OASIS|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS|EXPORT_EMBEDDED );
    2779             : 
    2780           0 : XMLFontAutoStylePool* SdXMLExport::CreateFontAutoStylePool()
    2781             : {
    2782           0 :     bool bEmbedFonts = false;
    2783           0 :     if (getExportFlags() & EXPORT_CONTENT)
    2784             :     {
    2785           0 :         Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
    2786           0 :         if( xFac.is() )
    2787             :         {
    2788             :             try
    2789             :             {
    2790           0 :                 Reference<beans::XPropertySet> const xProps( xFac->createInstance(
    2791           0 :                              "com.sun.star.document.Settings"), UNO_QUERY_THROW );
    2792           0 :                 xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
    2793             :             }
    2794           0 :             catch (...)
    2795             :             {
    2796             :                 // clipboard document doesn't have shell so throws from getPropertyValue
    2797             :                 // gallery elements may not support com.sun.star.document.Settings so throws from createInstance
    2798             :             }
    2799           0 :         }
    2800             :     }
    2801             : 
    2802           0 :     XMLFontAutoStylePool *pPool = new XMLFontAutoStylePool( *this, bEmbedFonts );
    2803             : 
    2804           0 :     Reference< beans::XPropertySet > xProps( GetModel(), UNO_QUERY );
    2805           0 :     if ( xProps.is() ) {
    2806           0 :         Sequence<Any> aAnySeq;
    2807           0 :         if( xProps->getPropertyValue("Fonts") >>= aAnySeq )
    2808             :         {
    2809           0 :             if( aAnySeq.getLength() % 5 == 0 )
    2810             :             {
    2811           0 :                 int nLen = aAnySeq.getLength() / 5;
    2812           0 :                 int nSeqIndex = 0;
    2813           0 :                 for( int i = 0; i < nLen; i++ )
    2814             :                 {
    2815           0 :                     OUString sFamilyName, sStyleName;
    2816           0 :                     sal_Int16 eFamily(FAMILY_DONTKNOW),
    2817           0 :                         ePitch(PITCH_DONTKNOW),
    2818           0 :                         eCharSet(RTL_TEXTENCODING_DONTKNOW);
    2819             : 
    2820           0 :                     aAnySeq[nSeqIndex++] >>= sFamilyName;
    2821           0 :                     aAnySeq[nSeqIndex++] >>= sStyleName;
    2822           0 :                     aAnySeq[nSeqIndex++] >>= eFamily;
    2823           0 :                     aAnySeq[nSeqIndex++] >>= ePitch;
    2824           0 :                     aAnySeq[nSeqIndex++] >>= eCharSet;
    2825             : 
    2826           0 :                     pPool->Add( sFamilyName, sStyleName, FontFamily( eFamily ), FontPitch( ePitch ), rtl_TextEncoding( eCharSet ) );
    2827           0 :                 }
    2828             :             }
    2829           0 :         }
    2830             :     }
    2831             : 
    2832           0 :     return pPool;
    2833             : }
    2834             : 
    2835             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10