LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/xmloff/source/draw - sdxmlexp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1007 1535 65.6 %
Date: 2013-07-09 Functions: 115 132 87.1 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10