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

Generated by: LCOV version 1.11