LCOV - code coverage report
Current view: top level - filter/source/svg - svgexport.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 907 0.1 %
Date: 2012-08-25 Functions: 2 87 2.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 2317 0.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            :  /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2008 by Sun Microsystems, Inc.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "svgwriter.hxx"
      31                 :            : #include "svgfontexport.hxx"
      32                 :            : #include "svgfilter.hxx"
      33                 :            : #include "svgscript.hxx"
      34                 :            : #include "impsvgdialog.hxx"
      35                 :            : 
      36                 :            : #include <com/sun/star/util/MeasureUnit.hpp>
      37                 :            : #include <com/sun/star/text/textfield/Type.hpp>
      38                 :            : 
      39                 :            : #include <rtl/bootstrap.hxx>
      40                 :            : #include <svtools/miscopt.hxx>
      41                 :            : #include <svx/unopage.hxx>
      42                 :            : #include <svx/unoshape.hxx>
      43                 :            : #include <svx/svdpage.hxx>
      44                 :            : #include <svx/svdoutl.hxx>
      45                 :            : #include <editeng/outliner.hxx>
      46                 :            : #include <editeng/flditem.hxx>
      47                 :            : #include <editeng/numitem.hxx>
      48                 :            : #include <comphelper/processfactory.hxx>
      49                 :            : #include <i18npool/lang.h>
      50                 :            : #include <svl/zforlist.hxx>
      51                 :            : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
      52                 :            : #include <xmloff/animationexport.hxx>
      53                 :            : 
      54                 :            : 
      55                 :            : #include <boost/preprocessor/repetition/repeat.hpp>
      56                 :            : 
      57                 :            : 
      58                 :            : using ::rtl::OUString;
      59                 :            : using namespace ::com::sun::star;
      60                 :            : 
      61                 :            : 
      62                 :            : 
      63                 :            : 
      64                 :            : // -------------------------------
      65                 :            : // - ooo elements and attributes -
      66                 :            : // -------------------------------
      67                 :            : 
      68                 :            : #define NSPREFIX "ooo:"
      69                 :            : 
      70                 :            : // ooo xml elements
      71                 :            : static const char    aOOOElemMetaSlides[] = NSPREFIX "meta_slides";
      72                 :            : static const char    aOOOElemMetaSlide[] = NSPREFIX "meta_slide";
      73                 :            : static const char    aOOOElemTextField[] = NSPREFIX "text_field";
      74                 :            : 
      75                 :            : // ooo xml attributes for meta_slides
      76                 :            : static const char    aOOOAttrNumberOfSlides[] = NSPREFIX "number-of-slides";
      77                 :            : static const char    aOOOAttrStartSlideNumber[] = NSPREFIX "start-slide-number";
      78                 :            : static const char    aOOOAttrNumberingType[] = NSPREFIX "page-numbering-type";
      79                 :            : 
      80                 :            : // ooo xml attributes for meta_slide
      81                 :            : static const char    aOOOAttrSlide[] = NSPREFIX "slide";
      82                 :            : static const char    aOOOAttrMaster[] = NSPREFIX "master";
      83                 :            : static const char    aOOOAttrBackgroundVisibility[] = NSPREFIX "background-visibility";
      84                 :            : static const char    aOOOAttrMasterObjectsVisibility[] = NSPREFIX "master-objects-visibility";
      85                 :            : static const char    aOOOAttrPageNumberVisibility[] = NSPREFIX "page-number-visibility";
      86                 :            : static const char    aOOOAttrDateTimeVisibility[] = NSPREFIX "date-time-visibility";
      87                 :            : static const char    aOOOAttrFooterVisibility[] = NSPREFIX "footer-visibility";
      88                 :            : static const char    aOOOAttrDateTimeField[] = NSPREFIX "date-time-field";
      89                 :            : static const char    aOOOAttrFooterField[] = NSPREFIX "footer-field";
      90                 :            : static const char    aOOOAttrHeaderField[] = NSPREFIX "header-field";
      91                 :            : static const char    aOOOAttrHasTransition[] = NSPREFIX "has-transition";
      92                 :            : 
      93                 :            : // ooo xml attributes for pages and shapes
      94                 :            : static const char    aOOOAttrName[] = NSPREFIX "name";
      95                 :            : 
      96                 :            : // ooo xml attributes for date_time_field
      97                 :            : static const char    aOOOAttrDateTimeFormat[] = NSPREFIX "date-time-format";
      98                 :            : 
      99                 :            : // ooo xml attributes for Placeholder Shapes
     100                 :            : static const char    aOOOAttrTextAdjust[] = NSPREFIX "text-adjust";
     101                 :            : 
     102                 :            : 
     103                 :            : 
     104                 :            : /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     105                 :            :  * - Text Field Class Hierarchy -                                  *
     106                 :            :  *                                                                 *
     107                 :            :  *  This is a set of classes for exporting text field meta info.   *
     108                 :            :  *                                                                 *
     109                 :            :  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
     110                 :            : 
     111                 :            : #define TEXT_FIELD_GET_CLASS_NAME_METHOD( class_name ) \
     112                 :            : virtual ::rtl::OUString getClassName() const                            \
     113                 :            : {                                                                       \
     114                 :            :     static const char className[] = #class_name;                        \
     115                 :            :     return B2UCONST( className );                                       \
     116                 :            : }
     117                 :            : 
     118                 :            : 
     119         [ #  # ]:          0 : class TextField
     120                 :            : {
     121                 :            : protected:
     122                 :            :     SVGFilter::ObjectSet mMasterPageSet;
     123                 :            : public:
     124                 :            : 
     125                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( TextField )
     126                 :            :     virtual sal_Bool equalTo( const TextField & aTextField ) const = 0;
     127                 :            :     virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const = 0;
     128                 :          0 :     virtual void elementExport( SVGExport* pSVGExport ) const
     129                 :            :     {
     130         [ #  # ]:          0 :         pSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", getClassName() );
     131                 :          0 :     }
     132                 :          0 :     void insertMasterPage( Reference< XDrawPage> xMasterPage )
     133                 :            :     {
     134         [ #  # ]:          0 :         mMasterPageSet.insert( xMasterPage );
     135                 :          0 :     }
     136         [ #  # ]:          0 :     virtual ~TextField() {}
     137                 :            : protected:
     138                 :          0 :     void implGrowCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets, ::rtl::OUString sText, ::rtl::OUString sTextFieldId ) const
     139                 :            :     {
     140                 :          0 :         const sal_Unicode * ustr = sText.getStr();
     141                 :          0 :         sal_Int32 nLength = sText.getLength();
     142         [ #  # ]:          0 :         SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
     143 [ #  # ][ #  # ]:          0 :         for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
     144                 :            :         {
     145         [ #  # ]:          0 :             const Reference< XInterface > & xMasterPage = *aMasterPageIt;
     146         [ #  # ]:          0 :             for( sal_Int32 i = 0; i < nLength; ++i )
     147                 :            :             {
     148 [ #  # ][ #  # ]:          0 :                 aTextFieldCharSets[ xMasterPage ][ sTextFieldId ].insert( ustr[i] );
                 [ #  # ]
     149                 :            :             }
     150                 :            :         }
     151                 :          0 :     }
     152                 :            : };
     153                 :            : 
     154                 :          0 : class FixedTextField : public TextField
     155                 :            : {
     156                 :            : public:
     157                 :            :     ::rtl::OUString text;
     158                 :            : 
     159                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedTextField )
     160                 :          0 :     virtual sal_Bool equalTo( const TextField & aTextField ) const
     161                 :            :     {
     162 [ #  # ][ #  # ]:          0 :         if( const FixedTextField* aFixedTextField = dynamic_cast< const FixedTextField* >( &aTextField ) )
     163                 :            :         {
     164                 :          0 :             return ( text == aFixedTextField->text );
     165                 :            :         }
     166                 :          0 :         return false;
     167                 :            :     }
     168                 :          0 :     virtual void elementExport( SVGExport* pSVGExport ) const
     169                 :            :     {
     170         [ #  # ]:          0 :         TextField::elementExport( pSVGExport );
     171         [ #  # ]:          0 :         SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
     172 [ #  # ][ #  # ]:          0 :         pSVGExport->GetDocHandler()->characters( text );
                 [ #  # ]
     173                 :          0 :     }
     174         [ #  # ]:          0 :     virtual ~FixedTextField() {}
     175                 :            : };
     176                 :            : 
     177                 :          0 : class FixedDateTimeField : public FixedTextField
     178                 :            : {
     179                 :            : public:
     180                 :          0 :     FixedDateTimeField() {}
     181                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedDateTimeField )
     182                 :          0 :     virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
     183                 :            :     {
     184 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField );
         [ #  # ][ #  # ]
     185         [ #  # ]:          0 :         implGrowCharSet( aTextFieldCharSets, text, sFieldId );
     186                 :          0 :     }
     187         [ #  # ]:          0 :     virtual ~FixedDateTimeField() {}
     188                 :            : };
     189                 :            : 
     190                 :          0 : class FooterField : public FixedTextField
     191                 :            : {
     192                 :            : public:
     193                 :          0 :     FooterField() {}
     194                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( FooterField )
     195                 :          0 :     virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
     196                 :            :     {
     197 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrFooterField );
         [ #  # ][ #  # ]
     198         [ #  # ]:          0 :         implGrowCharSet( aTextFieldCharSets, text, sFieldId );
     199                 :          0 :     }
     200         [ #  # ]:          0 :     virtual ~FooterField() {}
     201                 :            : };
     202                 :            : 
     203                 :            : class HeaderField : public FixedTextField
     204                 :            : {
     205                 :            : public:
     206                 :            :     HeaderField() {}
     207                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( HeaderField )
     208                 :          0 :     virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
     209                 :            :     {
     210 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrHeaderField );
         [ #  # ][ #  # ]
     211         [ #  # ]:          0 :         implGrowCharSet( aTextFieldCharSets, text, sFieldId );
     212                 :          0 :     }
     213         [ #  # ]:          0 :     virtual ~HeaderField() {}
     214                 :            : };
     215                 :            : 
     216                 :          0 : class VariableTextField : public TextField
     217                 :            : {
     218                 :            : public:
     219                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableTextField )
     220         [ #  # ]:          0 :     virtual ~VariableTextField() {}
     221                 :            : };
     222                 :            : 
     223                 :          0 : class VariableDateTimeField : public VariableTextField
     224                 :            : {
     225                 :            : public:
     226                 :            :     sal_Int32 format;
     227                 :            : 
     228                 :          0 :     VariableDateTimeField() {}
     229                 :          0 :     TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableDateTimeField )
     230                 :          0 :     virtual sal_Bool equalTo( const TextField & aTextField ) const
     231                 :            :     {
     232 [ #  # ][ #  # ]:          0 :         if( const VariableDateTimeField* aField = dynamic_cast< const VariableDateTimeField* >( &aTextField ) )
     233                 :            :         {
     234                 :          0 :             return ( format == aField->format );
     235                 :            :         }
     236                 :          0 :         return false;
     237                 :            :     }
     238                 :          0 :     virtual void elementExport( SVGExport* pSVGExport ) const
     239                 :            :     {
     240         [ #  # ]:          0 :         VariableTextField::elementExport( pSVGExport );
     241                 :          0 :         OUString sDateFormat, sTimeFormat;
     242                 :          0 :         SvxDateFormat eDateFormat = (SvxDateFormat)( format & 0x0f );
     243         [ #  # ]:          0 :         if( eDateFormat )
     244                 :            :         {
     245   [ #  #  #  #  :          0 :             switch( eDateFormat )
                   #  # ]
     246                 :            :             {
     247                 :            :                 case SVXDATEFORMAT_STDSMALL: ;
     248                 :            :                 case SVXDATEFORMAT_A:       // 13.02.96
     249         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     250                 :          0 :                     break;
     251                 :            :                 case SVXDATEFORMAT_C:       // 13.Feb 1996
     252         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     253                 :          0 :                     break;
     254                 :            :                 case SVXDATEFORMAT_D:       // 13.February 1996
     255         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     256                 :          0 :                     break;
     257                 :            :                 case SVXDATEFORMAT_E:       // Tue, 13.February 1996
     258         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     259                 :          0 :                     break;
     260                 :            :                 case SVXDATEFORMAT_STDBIG: ;
     261                 :            :                 case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
     262         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     263                 :          0 :                     break;
     264                 :            :                 // default case
     265                 :            :                 case SVXDATEFORMAT_B: ;    // 13.02.1996
     266                 :            :                 default:
     267         [ #  # ]:          0 :                     sDateFormat = B2UCONST( "" );
     268                 :          0 :                     break;
     269                 :            :             }
     270                 :            :         }
     271                 :            : 
     272                 :          0 :         SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( format >> 4 ) & 0x0f );
     273         [ #  # ]:          0 :         if( eTimeFormat )
     274                 :            :         {
     275   [ #  #  #  # ]:          0 :             switch( eTimeFormat )
     276                 :            :             {
     277                 :            :                 case SVXTIMEFORMAT_24_HMS:      // 13:49:38
     278         [ #  # ]:          0 :                     sTimeFormat = B2UCONST( "" );
     279                 :          0 :                     break;
     280                 :            :                 case SVXTIMEFORMAT_AM_HM: ;     // 01:49 PM
     281                 :            :                 case SVXTIMEFORMAT_12_HM:
     282         [ #  # ]:          0 :                     sTimeFormat = B2UCONST( "" );
     283                 :          0 :                     break;
     284                 :            :                 case SVXTIMEFORMAT_AM_HMS: ;    // 01:49:38 PM
     285                 :            :                 case SVXTIMEFORMAT_12_HMS:
     286         [ #  # ]:          0 :                     sTimeFormat = B2UCONST( "" );
     287                 :          0 :                     break;
     288                 :            :                 // default case
     289                 :            :                 case SVXTIMEFORMAT_24_HM: ;      // 13:49
     290                 :            :                 default:
     291         [ #  # ]:          0 :                     sTimeFormat = B2UCONST( "" );
     292                 :          0 :                     break;
     293                 :            :             }
     294                 :            :         }
     295                 :            : 
     296                 :          0 :         OUString sDateTimeFormat = sDateFormat;
     297                 :          0 :         sDateTimeFormat += OUString::valueOf( sal_Unicode(' ') );
     298                 :          0 :         sDateTimeFormat += sTimeFormat;
     299                 :            : 
     300         [ #  # ]:          0 :         pSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeFormat, sDateTimeFormat );
     301 [ #  # ][ #  # ]:          0 :         SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
     302                 :          0 :     }
     303                 :          0 :     virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
     304                 :            :     {
     305                 :            :         // we use the unicode char set in an improper way: we put in the date/time fortat
     306                 :            :         // in order to pass it to the CalcFieldValue method
     307 [ #  # ][ #  # ]:          0 :         static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" );
         [ #  # ][ #  # ]
                 [ #  # ]
     308         [ #  # ]:          0 :         SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
     309 [ #  # ][ #  # ]:          0 :         for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
     310                 :            :         {
     311 [ #  # ][ #  # ]:          0 :             aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( (sal_Unicode)( format ) );
         [ #  # ][ #  # ]
     312                 :            :         }
     313                 :          0 :     }
     314         [ #  # ]:          0 :     virtual ~VariableDateTimeField() {}
     315                 :            : };
     316                 :            : 
     317                 :          0 : sal_Bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField )
     318                 :            : {
     319                 :          0 :     return aLhsTextField.equalTo( aRhsTextField );
     320                 :            : }
     321                 :            : 
     322                 :            : 
     323                 :            : 
     324                 :            : // -------------
     325                 :            : // - SVGExport -
     326                 :            : // -------------
     327                 :            : 
     328                 :          0 : SVGExport::SVGExport(
     329                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
     330                 :            :     const Reference< XDocumentHandler >& rxHandler,
     331                 :            :     const Sequence< PropertyValue >& rFilterData )
     332                 :            :         : SvXMLExport( util::MeasureUnit::MM_100TH, xServiceFactory )
     333                 :          0 :         , mrFilterData( rFilterData )
     334                 :            : {
     335         [ #  # ]:          0 :     SetDocHandler( rxHandler );
     336                 :          0 :     sal_uInt16 nExportFlags = getExportFlags() | EXPORT_PRETTY;
     337                 :          0 :     setExportFlags( nExportFlags );
     338 [ #  # ][ #  # ]:          0 :     GetDocHandler()->startDocument();
     339                 :          0 : }
     340                 :            : 
     341                 :            : // -----------------------------------------------------------------------------
     342                 :            : 
     343                 :          0 : SVGExport::~SVGExport()
     344                 :            : {
     345 [ #  # ][ #  # ]:          0 :     GetDocHandler()->endDocument();
     346         [ #  # ]:          0 : }
     347                 :            : 
     348                 :            : // -----------------------------------------------------------------------------
     349                 :            : 
     350                 :          0 : sal_Bool SVGExport::IsUseTinyProfile() const
     351                 :            : {
     352                 :          0 :     sal_Bool bRet = sal_False;
     353                 :            : 
     354         [ #  # ]:          0 :     if( mrFilterData.getLength() > 0 )
     355                 :          0 :         mrFilterData[ 0 ].Value >>= bRet;
     356                 :            : 
     357                 :          0 :     return bRet;
     358                 :            : }
     359                 :            : 
     360                 :            : // -----------------------------------------------------------------------------
     361                 :            : 
     362                 :          0 : sal_Bool SVGExport::IsEmbedFonts() const
     363                 :            : {
     364                 :          0 :     sal_Bool bRet = sal_False;
     365                 :            : 
     366         [ #  # ]:          0 :     if( mrFilterData.getLength() > 1 )
     367                 :          0 :         mrFilterData[ 1 ].Value >>= bRet;
     368                 :            : 
     369                 :          0 :     return bRet;
     370                 :            : }
     371                 :            : 
     372                 :            : // -----------------------------------------------------------------------------
     373                 :            : 
     374                 :          0 : sal_Bool SVGExport::IsUseNativeTextDecoration() const
     375                 :            : {
     376         [ #  # ]:          0 :     sal_Bool bRet = !IsUseTinyProfile();
     377                 :            : 
     378 [ #  # ][ #  # ]:          0 :     if( bRet && ( mrFilterData.getLength() > 2 ) )
                 [ #  # ]
     379                 :          0 :         mrFilterData[ 2 ].Value >>= bRet;
     380                 :            : 
     381                 :          0 :     return bRet;
     382                 :            : }
     383                 :            : 
     384                 :            : // -----------------------------------------------------------------------------
     385                 :            : 
     386                 :          0 : sal_Bool SVGExport::IsUseOpacity() const
     387                 :            : {
     388         [ #  # ]:          0 :     sal_Bool bRet = !IsUseTinyProfile();
     389                 :            : 
     390 [ #  # ][ #  # ]:          0 :     if( !bRet && ( mrFilterData.getLength() > 4 ) )
                 [ #  # ]
     391                 :          0 :         mrFilterData[ 4 ].Value >>= bRet;
     392                 :            : 
     393                 :          0 :     return bRet;
     394                 :            : }
     395                 :            : 
     396                 :            : // ------------------------
     397                 :            : // - ObjectRepresentation -
     398                 :            : // ------------------------
     399                 :            : 
     400                 :          0 : ObjectRepresentation::ObjectRepresentation() :
     401                 :          0 :     mpMtf( NULL )
     402                 :            : {
     403                 :          0 : }
     404                 :            : 
     405                 :            : // -----------------------------------------------------------------------------
     406                 :            : 
     407                 :          0 : ObjectRepresentation::ObjectRepresentation( const Reference< XInterface >& rxObject,
     408                 :            :                                             const GDIMetaFile& rMtf ) :
     409                 :            :     mxObject( rxObject ),
     410 [ #  # ][ #  # ]:          0 :     mpMtf( new GDIMetaFile( rMtf ) )
     411                 :            : {
     412                 :          0 : }
     413                 :            : 
     414                 :            : // -----------------------------------------------------------------------------
     415                 :            : 
     416                 :          0 : ObjectRepresentation::ObjectRepresentation( const ObjectRepresentation& rPresentation ) :
     417                 :            :     mxObject( rPresentation.mxObject ),
     418 [ #  # ][ #  # ]:          0 :     mpMtf( rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : NULL )
                 [ #  # ]
     419                 :            : {
     420                 :          0 : }
     421                 :            : 
     422                 :            : // -----------------------------------------------------------------------------
     423                 :            : 
     424                 :          0 : ObjectRepresentation::~ObjectRepresentation()
     425                 :            : {
     426 [ #  # ][ #  # ]:          0 :     delete mpMtf;
     427                 :          0 : }
     428                 :            : 
     429                 :            : // -----------------------------------------------------------------------------
     430                 :            : 
     431                 :          0 : ObjectRepresentation& ObjectRepresentation::operator=( const ObjectRepresentation& rPresentation )
     432                 :            : {
     433                 :            :     // Check for self-assignment
     434         [ #  # ]:          0 :     if (this == &rPresentation)
     435                 :          0 :         return *this;
     436                 :          0 :     mxObject = rPresentation.mxObject;
     437 [ #  # ][ #  # ]:          0 :     delete mpMtf, ( mpMtf = rPresentation.mpMtf ? new GDIMetaFile( *rPresentation.mpMtf ) : NULL );
                 [ #  # ]
     438                 :            : 
     439                 :          0 :     return *this;
     440                 :            : }
     441                 :            : 
     442                 :            : // -----------------------------------------------------------------------------
     443                 :            : 
     444                 :          0 : sal_Bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresentation ) const
     445                 :            : {
     446                 :          0 :     return( ( mxObject == rPresentation.mxObject ) &&
     447 [ #  # ][ #  # ]:          0 :             ( *mpMtf == *rPresentation.mpMtf ) );
     448                 :            : }
     449                 :            : 
     450                 :            : // -------------
     451                 :            : // - SVGFilter -
     452                 :            : // -------------
     453                 :            : 
     454                 :          0 : sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
     455                 :            :     throw (RuntimeException)
     456                 :            : {
     457         [ #  # ]:          0 :     Reference< XMultiServiceFactory >    xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
     458                 :          0 :     Reference< XOutputStream >          xOStm;
     459                 :          0 :     SvStream*                           pOStm = NULL;
     460                 :          0 :     sal_Int32                            nLength = rDescriptor.getLength();
     461                 :          0 :     const PropertyValue*                pValue = rDescriptor.getConstArray();
     462                 :          0 :     sal_Bool                            bRet = sal_False;
     463                 :            : 
     464         [ #  # ]:          0 :     maFilterData.realloc( 0 );
     465                 :            : 
     466         [ #  # ]:          0 :     for ( sal_Int32 i = 0 ; i < nLength; ++i)
     467                 :            :     {
     468         [ #  # ]:          0 :         if ( pValue[ i ].Name == "OutputStream" )
     469         [ #  # ]:          0 :             pValue[ i ].Value >>= xOStm;
     470         [ #  # ]:          0 :         else if ( pValue[ i ].Name == "FileName" )
     471                 :            :         {
     472                 :          0 :             ::rtl::OUString aFileName;
     473                 :            : 
     474                 :          0 :             pValue[ i ].Value >>= aFileName;
     475 [ #  # ][ #  # ]:          0 :             pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, STREAM_WRITE | STREAM_TRUNC );
                 [ #  # ]
     476                 :            : 
     477         [ #  # ]:          0 :             if( pOStm )
     478 [ #  # ][ #  # ]:          0 :                 xOStm = Reference< XOutputStream >( new ::utl::OOutputStreamWrapper ( *pOStm ) );
         [ #  # ][ #  # ]
     479                 :            :         }
     480         [ #  # ]:          0 :         else if ( pValue[ i ].Name == "FilterData" )
     481                 :            :         {
     482         [ #  # ]:          0 :             pValue[ i ].Value >>= maFilterData;
     483                 :            :         }
     484                 :            :     }
     485                 :            : 
     486                 :            :     // if no filter data is given use stored/prepared ones
     487         [ #  # ]:          0 :     if( !maFilterData.getLength() )
     488                 :            :     {
     489         [ #  # ]:          0 :         maFilterData.realloc( 6 );
     490                 :            : 
     491 [ #  # ][ #  # ]:          0 :         maFilterData[ 0 ].Name = B2UCONST( SVG_PROP_TINYPROFILE );
     492 [ #  # ][ #  # ]:          0 :         maFilterData[ 0 ].Value <<= (sal_Bool) sal_True;
     493                 :            : 
     494                 :            :         // font embedding
     495                 :          0 :         const char* pSVGDisableFontEmbedding = getenv( "SVG_DISABLE_FONT_EMBEDDING" );
     496                 :            :         rtl::OUString aEmbedFontEnv(
     497         [ #  # ]:          0 :             RTL_CONSTASCII_USTRINGPARAM("${SVG_DISABLE_FONT_EMBEDDING}"));
     498                 :          0 :         rtl::Bootstrap::expandMacros(aEmbedFontEnv);
     499                 :            :         const bool bEmbedFonts=pSVGDisableFontEmbedding ? false : (
     500 [ #  # ][ #  # ]:          0 :             aEmbedFontEnv.getLength() ? false : true);
     501                 :            : 
     502 [ #  # ][ #  # ]:          0 :         maFilterData[ 1 ].Name = B2UCONST( SVG_PROP_EMBEDFONTS );
     503 [ #  # ][ #  # ]:          0 :         maFilterData[ 1 ].Value <<= (sal_Bool) (bEmbedFonts);
     504                 :            : 
     505                 :            :         // Native decoration
     506 [ #  # ][ #  # ]:          0 :         maFilterData[ 2 ].Name = B2UCONST( SVG_PROP_NATIVEDECORATION );
     507 [ #  # ][ #  # ]:          0 :         maFilterData[ 2 ].Value <<= (sal_Bool) sal_False;
     508                 :            : 
     509                 :            :         // glyph placement
     510                 :          0 :         const char* pSVGGlyphPlacement = getenv( "SVG_GLYPH_PLACEMENT" );
     511                 :            : 
     512 [ #  # ][ #  # ]:          0 :         maFilterData[ 3 ].Name = B2UCONST( SVG_PROP_GLYPHPLACEMENT );
     513                 :            : 
     514         [ #  # ]:          0 :         if( pSVGGlyphPlacement )
     515 [ #  # ][ #  # ]:          0 :             maFilterData[ 3 ].Value <<= ::rtl::OUString::createFromAscii( pSVGGlyphPlacement );
     516                 :            :         else
     517 [ #  # ][ #  # ]:          0 :             maFilterData[ 3 ].Value <<= B2UCONST( "xlist" );
                 [ #  # ]
     518                 :            : 
     519                 :            :         // Tiny Opacity
     520 [ #  # ][ #  # ]:          0 :         maFilterData[ 4 ].Name = B2UCONST( SVG_PROP_OPACITY );
     521 [ #  # ][ #  # ]:          0 :         maFilterData[ 4 ].Value <<= (sal_Bool) sal_True;
     522                 :            : 
     523                 :            :         // Tiny Gradient
     524 [ #  # ][ #  # ]:          0 :         maFilterData[ 5 ].Name = B2UCONST( SVG_PROP_GRADIENT );
     525 [ #  # ][ #  # ]:          0 :         maFilterData[ 5 ].Value <<= (sal_Bool) sal_False;
     526                 :            :     }
     527                 :            : 
     528 [ #  # ][ #  # ]:          0 :     if( xOStm.is() && xServiceFactory.is() )
                 [ #  # ]
     529                 :            :     {
     530 [ #  # ][ #  # ]:          0 :         if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() )
                 [ #  # ]
     531                 :            :         {
     532         [ #  # ]:          0 :             Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
     533                 :            : 
     534         [ #  # ]:          0 :             if( xDocHandler.is() )
     535                 :            :             {
     536         [ #  # ]:          0 :                 mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is();
     537 [ #  # ][ #  # ]:          0 :                 mpObjects = new ObjectMap;
     538                 :            : 
     539                 :            :                 // #110680#
     540                 :            :                 // mpSVGExport = new SVGExport( xDocHandler );
     541         [ #  # ]:          0 :                 mpSVGExport = new SVGExport( xServiceFactory, xDocHandler, maFilterData );
     542                 :            : 
     543         [ #  # ]:          0 :                 if( mpSVGExport != NULL )
     544                 :            :                 {
     545                 :            :                     // xSVGExport is set up only to manage the life-time of the object pointed by mpSVGExport,
     546                 :            :                     // and in order to prevent that it is destroyed when passed to AnimationExporter.
     547 [ #  # ][ #  # ]:          0 :                     Reference< XInterface > xSVGExport = static_cast< ::com::sun::star::document::XFilter* >( mpSVGExport );
     548                 :            : 
     549                 :            :                     // create an id for each draw page
     550         [ #  # ]:          0 :                     for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
     551 [ #  # ][ #  # ]:          0 :                         implRegisterInterface( mSelectedPages[i] );
     552                 :            : 
     553                 :            :                     // create an id for each master page
     554         [ #  # ]:          0 :                     for( sal_Int32 i = 0; i < mMasterPageTargets.getLength(); ++i )
     555 [ #  # ][ #  # ]:          0 :                         implRegisterInterface( mMasterPageTargets[i] );
     556                 :            : 
     557                 :            :                     try
     558                 :            :                     {
     559 [ #  # ][ #  # ]:          0 :                         mxDefaultPage = mSelectedPages[0];
     560                 :            : 
     561         [ #  # ]:          0 :                         if( mxDefaultPage.is() )
     562                 :            :                         {
     563         [ #  # ]:          0 :                             SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage );
     564                 :            : 
     565         [ #  # ]:          0 :                             if( pSvxDrawPage )
     566                 :            :                             {
     567                 :          0 :                                 mpDefaultSdrPage = pSvxDrawPage->GetSdrPage();
     568         [ #  # ]:          0 :                                 mpSdrModel = mpDefaultSdrPage->GetModel();
     569                 :            : 
     570         [ #  # ]:          0 :                                 if( mpSdrModel )
     571                 :            :                                 {
     572         [ #  # ]:          0 :                                     SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL);
     573                 :            : 
     574                 :          0 :                                     maOldFieldHdl = rOutl.GetCalcFieldValueHdl();
     575         [ #  # ]:          0 :                                     rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) );
     576                 :            :                                 }
     577                 :            :                             }
     578         [ #  # ]:          0 :                             bRet = implExportDocument();
     579                 :            :                         }
     580                 :            :                     }
     581         [ #  # ]:          0 :                     catch( ... )
     582                 :            :                     {
     583   [ #  #  #  # ]:          0 :                         delete mpSVGDoc, mpSVGDoc = NULL;
     584                 :            :                         OSL_FAIL( "Exception caught" );
     585                 :            :                     }
     586                 :            : 
     587         [ #  # ]:          0 :                     if( mpSdrModel )
     588         [ #  # ]:          0 :                         mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl );
     589                 :            : 
     590 [ #  # ][ #  # ]:          0 :                     delete mpSVGWriter, mpSVGWriter = NULL;
     591                 :          0 :                     mpSVGExport = NULL; // pointed object is released by xSVGExport dtor at the end of this scope
     592 [ #  # ][ #  # ]:          0 :                     delete mpSVGFontExport, mpSVGFontExport = NULL;
     593 [ #  # ][ #  # ]:          0 :                     delete mpObjects, mpObjects = NULL;
     594                 :          0 :                     mbPresentation = sal_False;
     595                 :            :                 }
     596                 :          0 :             }
     597                 :            :         }
     598                 :            :     }
     599                 :            : 
     600 [ #  # ][ #  # ]:          0 :     delete pOStm;
     601                 :            : 
     602                 :          0 :     return bRet;
     603                 :            : }
     604                 :            : 
     605                 :            : // -----------------------------------------------------------------------------
     606                 :            : 
     607                 :          0 : Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm )
     608                 :            : {
     609         [ #  # ]:          0 :     Reference< XMultiServiceFactory >   xMgr( ::comphelper::getProcessServiceFactory() );
     610                 :          0 :     Reference< XDocumentHandler >       xSaxWriter;
     611                 :            : 
     612 [ #  # ][ #  # ]:          0 :     if( xMgr.is() && rxOStm.is() )
                 [ #  # ]
     613                 :            :     {
     614 [ #  # ][ #  # ]:          0 :         xSaxWriter = Reference< XDocumentHandler >( xMgr->createInstance( B2UCONST( "com.sun.star.xml.sax.Writer" ) ), UNO_QUERY );
         [ #  # ][ #  # ]
                 [ #  # ]
     615                 :            : 
     616         [ #  # ]:          0 :         if( xSaxWriter.is() )
     617                 :            :         {
     618         [ #  # ]:          0 :             Reference< XActiveDataSource > xActiveDataSource( xSaxWriter, UNO_QUERY );
     619                 :            : 
     620         [ #  # ]:          0 :             if( xActiveDataSource.is() )
     621 [ #  # ][ #  # ]:          0 :                 xActiveDataSource->setOutputStream( rxOStm );
     622                 :            :             else
     623         [ #  # ]:          0 :                 xSaxWriter = NULL;
     624                 :            :         }
     625                 :            :     }
     626                 :            : 
     627                 :          0 :     return xSaxWriter;
     628                 :            : }
     629                 :            : 
     630                 :            : // -----------------------------------------------------------------------------
     631                 :            : 
     632                 :            : inline
     633                 :          0 : sal_Bool SVGFilter::implLookForFirstVisiblePage()
     634                 :            : {
     635                 :          0 :     sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.getLength() - 1;
     636                 :            : 
     637 [ #  # ][ #  # ]:          0 :     while( ( nCurPage <= nLastPage ) && ( -1 == mnVisiblePage ) )
                 [ #  # ]
     638                 :            :     {
     639                 :          0 :         const Reference< XDrawPage > & xDrawPage = mSelectedPages[nCurPage];
     640                 :            : 
     641         [ #  # ]:          0 :         if( xDrawPage.is() )
     642                 :            :         {
     643         [ #  # ]:          0 :             Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
     644                 :            : 
     645         [ #  # ]:          0 :             if( xPropSet.is() )
     646                 :            :             {
     647                 :          0 :                 sal_Bool bVisible = sal_False;
     648                 :            : 
     649         [ #  # ]:          0 :                 if( !mbPresentation || mbSinglePage ||
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     650 [ #  # ][ #  # ]:          0 :                     ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     651                 :            :                 {
     652                 :          0 :                     mnVisiblePage = nCurPage;
     653                 :            :                 }
     654                 :          0 :             }
     655                 :            :         }
     656                 :          0 :         ++nCurPage;
     657                 :            :     }
     658                 :            : 
     659                 :          0 :     return ( mnVisiblePage != -1 );
     660                 :            : }
     661                 :            : 
     662                 :            : // -----------------------------------------------------------------------------
     663                 :          0 : sal_Bool SVGFilter::implExportDocument()
     664                 :            : {
     665                 :          0 :     OUString         aAttr;
     666                 :          0 :     sal_Int32        nDocWidth = 0, nDocHeight = 0;
     667                 :          0 :     sal_Bool         bRet = sal_False;
     668                 :          0 :     sal_Int32        nLastPage = mSelectedPages.getLength() - 1;
     669                 :            : 
     670         [ #  # ]:          0 :     SvtMiscOptions aMiscOptions;
     671         [ #  # ]:          0 :     const bool bExperimentalMode = aMiscOptions.IsExperimentalMode();
     672                 :            : 
     673 [ #  # ][ #  # ]:          0 :     mbSinglePage = (nLastPage == 0) || !bExperimentalMode;
     674                 :          0 :     mnVisiblePage = -1;
     675                 :            : //    mnVisibleMasterPage = -1;
     676                 :            : 
     677         [ #  # ]:          0 :     const Reference< XPropertySet >             xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
     678         [ #  # ]:          0 :     const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
     679                 :            : 
     680         [ #  # ]:          0 :     if( xDefaultPagePropertySet.is() )
     681                 :            :     {
     682 [ #  # ][ #  # ]:          0 :         xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Width" ) ) >>= nDocWidth;
                 [ #  # ]
     683 [ #  # ][ #  # ]:          0 :         xDefaultPagePropertySet->getPropertyValue( B2UCONST( "Height" ) ) >>= nDocHeight;
                 [ #  # ]
     684                 :            :     }
     685                 :            : 
     686 [ #  # ][ #  # ]:          0 :     if( xExtDocHandler.is() && !mpSVGExport->IsUseTinyProfile() )
         [ #  # ][ #  # ]
     687                 :            :     {
     688 [ #  # ][ #  # ]:          0 :         xExtDocHandler->unknown( SVG_DTD_STRING );
                 [ #  # ]
     689                 :            :     }
     690                 :            : 
     691 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "version", B2UCONST( "1.2" ) );
     692                 :            : 
     693 [ #  # ][ #  # ]:          0 :     if( mpSVGExport->IsUseTinyProfile() )
     694 [ #  # ][ #  # ]:          0 :          mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "baseProfile", B2UCONST( "tiny" ) );
     695                 :            : 
     696                 :            :     // enabling _SVG_WRITE_EXTENTS means that the slide size is not adapted
     697                 :            :     // to the size of the browser window, moreover the slide is top left aligned
     698                 :            :     // instead of centered.
     699                 :            :     #define _SVG_WRITE_EXTENTS
     700                 :            :     #ifdef _SVG_WRITE_EXTENTS
     701         [ #  # ]:          0 :     if( mbSinglePage )
     702                 :            :     {
     703                 :          0 :         aAttr = OUString::valueOf( nDocWidth * 0.01 );
     704         [ #  # ]:          0 :         aAttr += B2UCONST( "mm" );
     705         [ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", aAttr );
     706                 :            : 
     707                 :          0 :         aAttr = OUString::valueOf( nDocHeight * 0.01 );
     708         [ #  # ]:          0 :         aAttr += B2UCONST( "mm" );
     709         [ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", aAttr );
     710                 :            :     }
     711                 :            :     #endif
     712                 :            : 
     713                 :            : 
     714         [ #  # ]:          0 :     aAttr = B2UCONST( "0 0 " );
     715                 :          0 :     aAttr += OUString::valueOf( nDocWidth );
     716         [ #  # ]:          0 :     aAttr += B2UCONST( " " );
     717                 :          0 :     aAttr += OUString::valueOf( nDocHeight );
     718                 :            : 
     719         [ #  # ]:          0 :     msClipPathId = B2UCONST( "presentation_clip_path" );
     720 [ #  # ][ #  # ]:          0 :     OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" );
     721                 :            : 
     722         [ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
     723 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", B2UCONST( "xMidYMid" ) );
     724 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "fill-rule", B2UCONST( "evenodd" ) );
     725         [ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue );
     726                 :            : 
     727                 :            :     // standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm)
     728         [ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-width", OUString::valueOf( 28.222 ) );
     729 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-linejoin", B2UCONST( "round" ) );
     730                 :            : 
     731         [ #  # ]:          0 :     if( !mbSinglePage )
     732                 :            :     {
     733 [ #  # ][ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:ooo", B2UCONST( "http://xml.openoffice.org/svg/export" ) );
     734                 :            :     }
     735                 :            : 
     736                 :            : 
     737 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns", B2UCONST( "http://www.w3.org/2000/svg" ) );
     738 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:xlink", B2UCONST( "http://www.w3.org/1999/xlink" ) );
     739                 :            : 
     740 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:draw", B2UCONST( "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" ) );
     741 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:presentation", B2UCONST( "urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" ) );
     742 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:smil", B2UCONST( "urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" ) );
     743 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:anim", B2UCONST( "urn:oasis:names:tc:opendocument:xmlns:animation:1.0" ) );
     744                 :            : 
     745 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xml:space", B2UCONST( "preserve" ) );
     746                 :            : 
     747 [ #  # ][ #  # ]:          0 :     mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
     748                 :            : 
     749                 :            :     // Create a ClipPath element that will be used for cutting bitmaps and other elements that could exceed the page margins.
     750                 :            :     {
     751 [ #  # ][ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "ClipPathGroup" ) );
     752         [ #  # ]:          0 :         SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
     753                 :            :         {
     754         [ #  # ]:          0 :             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", msClipPathId );
     755 [ #  # ][ #  # ]:          0 :             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clipPathUnits", B2UCONST( "userSpaceOnUse" ) );
     756         [ #  # ]:          0 :             SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, "clipPath", sal_True, sal_True );
     757                 :            :             {
     758         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "x", OUString::valueOf( sal_Int32(0) ) );
     759         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "y", OUString::valueOf( sal_Int32(0) ) );
     760         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", OUString::valueOf( nDocWidth ) );
     761         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", OUString::valueOf( nDocHeight ) );
     762 [ #  # ][ #  # ]:          0 :                 SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, "rect", sal_True, sal_True );
     763         [ #  # ]:          0 :             }
     764         [ #  # ]:          0 :         }
     765                 :            :     }
     766                 :            : 
     767 [ #  # ][ #  # ]:          0 :     if( implLookForFirstVisiblePage() )  // OK! We found at least one visible page.
     768                 :            :     {
     769         [ #  # ]:          0 :         if( !mbSinglePage )
     770                 :            :         {
     771         [ #  # ]:          0 :             implGenerateMetaData();
     772         [ #  # ]:          0 :             if( bExperimentalMode )
     773         [ #  # ]:          0 :                 implExportAnimations();
     774                 :            :         }
     775                 :            :         else
     776                 :            :         {
     777 [ #  # ][ #  # ]:          0 :             implGetPagePropSet( mSelectedPages[0] );
     778                 :            :         }
     779                 :            : 
     780                 :            :         // Create the (Shape, GDIMetaFile) map
     781 [ #  # ][ #  # ]:          0 :         if( implCreateObjects() )
     782                 :            :         {
     783         [ #  # ]:          0 :             ObjectMap::const_iterator                aIter( mpObjects->begin() );
     784         [ #  # ]:          0 :             ::std::vector< ObjectRepresentation >    aObjects( mpObjects->size() );
     785                 :          0 :             sal_uInt32                               nPos = 0;
     786                 :            : 
     787 [ #  # ][ #  # ]:          0 :             while( aIter != mpObjects->end() )
     788                 :            :             {
     789 [ #  # ][ #  # ]:          0 :                 aObjects[ nPos++ ] = (*aIter).second;
     790                 :          0 :                 ++aIter;
     791                 :            :             }
     792                 :            : 
     793 [ #  # ][ #  # ]:          0 :             mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects );
     794 [ #  # ][ #  # ]:          0 :             mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport );
     795                 :            : 
     796                 :            : 
     797 [ #  # ][ #  # ]:          0 :             if( mpSVGExport->IsEmbedFonts() )
     798                 :            :             {
     799         [ #  # ]:          0 :                 mpSVGFontExport->EmbedFonts();
     800                 :            :             }
     801                 :            : 
     802         [ #  # ]:          0 :             implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.getLength() - 1 );
     803         [ #  # ]:          0 :             implExportDrawPages( mSelectedPages, 0, nLastPage );
     804                 :            : 
     805         [ #  # ]:          0 :             if( !mbSinglePage )
     806                 :            :             {
     807         [ #  # ]:          0 :                 implGenerateScript();
     808                 :            :             }
     809                 :            : 
     810 [ #  # ][ #  # ]:          0 :             delete mpSVGDoc, mpSVGDoc = NULL;
     811                 :          0 :             bRet = sal_True;
     812                 :            :         }
     813                 :            :     }
     814                 :            : 
     815         [ #  # ]:          0 :     return bRet;
     816                 :            : }
     817                 :            : 
     818                 :            : 
     819                 :            : //------------------------------------------------------------------------------
     820                 :            : // Append aField to aFieldSet if it is not already present in the set
     821                 :            : // and create the field id sFieldId
     822                 :            : //
     823                 :            : 
     824                 :            : template< typename TextFieldType >
     825                 :          0 : OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet,
     826                 :            :                               const TextFieldType & aField,
     827                 :            :                               const OUString & sOOOElemField,
     828                 :            :                               Reference< XDrawPage > xMasterPage )
     829                 :            : {
     830                 :          0 :     sal_Bool bFound = sal_False;
     831                 :            :     sal_Int32 i;
     832                 :          0 :     sal_Int32 nSize = aFieldSet.size();
     833 [ #  # ][ #  # ]:          0 :     for( i = 0; i < nSize; ++i )
                 [ #  # ]
     834                 :            :     {
     835 [ #  # ][ #  # ]:          0 :         if( *(aFieldSet[i]) == aField )
                 [ #  # ]
     836                 :            :         {
     837                 :          0 :             bFound = sal_True;
     838                 :          0 :             break;
     839                 :            :         }
     840                 :            :     }
     841                 :          0 :     OUString sFieldId( sOOOElemField );
     842                 :          0 :     sFieldId += OUString::valueOf( sal_Unicode('_') );
     843   [ #  #  #  #  :          0 :     if( !bFound )
                   #  # ]
     844                 :            :     {
     845 [ #  # ][ #  # ]:          0 :         aFieldSet.push_back( new TextFieldType( aField ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     846                 :            :     }
     847 [ #  # ][ #  # ]:          0 :     aFieldSet[i]->insertMasterPage( xMasterPage );
                 [ #  # ]
     848                 :          0 :     sFieldId += OUString::valueOf( i );
     849                 :          0 :     return sFieldId;
     850                 :            : }
     851                 :            : 
     852                 :            : //------------------------------------------------------------------------------
     853                 :            : 
     854                 :          0 : sal_Bool SVGFilter::implGenerateMetaData()
     855                 :            : {
     856                 :          0 :     sal_Bool bRet = sal_False;
     857                 :          0 :     sal_Int32 nCount = mSelectedPages.getLength();
     858         [ #  # ]:          0 :     if( nCount != 0 )
     859                 :            :     {
     860                 :            :         // we wrap all meta presentation info into a svg:defs element
     861         [ #  # ]:          0 :         SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
     862                 :            : 
     863 [ #  # ][ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( aOOOElemMetaSlides ) );
     864         [ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberOfSlides, OUString::valueOf( nCount ) );
     865         [ #  # ]:          0 :         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrStartSlideNumber, OUString::valueOf( mnVisiblePage ) );
     866                 :            : 
     867                 :            :         /*
     868                 :            :          *  Add a (global) Page Numbering Type attribute for the document
     869                 :            :          */
     870                 :            :         // NOTE:
     871                 :            :         // at present pSdrModel->GetPageNumType() returns always SVX_ARABIC
     872                 :            :         // so the following code fragment is pretty unuseful
     873                 :          0 :         sal_Int32 nPageNumberingType =  SVX_ARABIC;
     874 [ #  # ][ #  # ]:          0 :         SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mSelectedPages[0] );
     875         [ #  # ]:          0 :         if( pSvxDrawPage )
     876                 :            :         {
     877                 :          0 :             SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
     878         [ #  # ]:          0 :             SdrModel* pSdrModel = pSdrPage->GetModel();
     879         [ #  # ]:          0 :             nPageNumberingType = pSdrModel->GetPageNumType();
     880                 :            : 
     881                 :            :             // That is used by CalcFieldHdl method.
     882                 :          0 :             mVisiblePagePropSet.nPageNumberingType = nPageNumberingType;
     883                 :            :         }
     884         [ #  # ]:          0 :         if( nPageNumberingType != SVX_NUMBER_NONE )
     885                 :            :         {
     886                 :          0 :             OUString sNumberingType;
     887   [ #  #  #  #  :          0 :             switch( nPageNumberingType )
                      # ]
     888                 :            :             {
     889                 :            :                 case SVX_CHARS_UPPER_LETTER:
     890         [ #  # ]:          0 :                     sNumberingType = B2UCONST( "alpha-upper" );
     891                 :          0 :                     break;
     892                 :            :                 case SVX_CHARS_LOWER_LETTER:
     893         [ #  # ]:          0 :                     sNumberingType = B2UCONST( "alpha-lower" );
     894                 :          0 :                     break;
     895                 :            :                 case SVX_ROMAN_UPPER:
     896         [ #  # ]:          0 :                     sNumberingType = B2UCONST( "roman-upper" );
     897                 :          0 :                     break;
     898                 :            :                 case SVX_ROMAN_LOWER:
     899         [ #  # ]:          0 :                     sNumberingType = B2UCONST( "roman-lower" );
     900                 :          0 :                     break;
     901                 :            :                 // arabic numbering type is the default, so we do not append any attribute for it
     902                 :            :                 case SVX_ARABIC: ;
     903                 :            :                 // in case the numbering type is not handled we fall back on arabic numbering
     904                 :            :                 default: ;
     905                 :          0 :                     break;
     906                 :            :             }
     907         [ #  # ]:          0 :             if( !sNumberingType.isEmpty() )
     908         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberingType, sNumberingType );
     909                 :            :         }
     910                 :            : 
     911                 :            : 
     912                 :            :         {
     913         [ #  # ]:          0 :             SvXMLElementExport    aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
     914         [ #  # ]:          0 :             const OUString                aId( B2UCONST( aOOOElemMetaSlide ) );
     915         [ #  # ]:          0 :             const OUString                aElemTextFieldId( B2UCONST( aOOOElemTextField ) );
     916         [ #  # ]:          0 :             std::vector< TextField* >     aFieldSet;
     917                 :            : 
     918         [ #  # ]:          0 :             for( sal_Int32 i = 0; i < nCount; ++i )
     919                 :            :             {
     920         [ #  # ]:          0 :                 const Reference< XDrawPage > &    xDrawPage = mSelectedPages[i];
     921         [ #  # ]:          0 :                 Reference< XMasterPageTarget >    xMasterPageTarget( xDrawPage, UNO_QUERY );
     922 [ #  # ][ #  # ]:          0 :                 Reference< XDrawPage >            xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
                 [ #  # ]
     923                 :          0 :                 OUString                          aSlideId( aId );
     924                 :          0 :                 aSlideId += OUString::valueOf( sal_Unicode('_') );
     925                 :          0 :                 aSlideId += OUString::valueOf( i );
     926                 :            : 
     927         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId );
     928 [ #  # ][ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, implGetValidIDFromInterface( xDrawPage ) );
     929 [ #  # ][ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, implGetValidIDFromInterface( xMasterPage ) );
     930                 :            : 
     931                 :            : 
     932         [ #  # ]:          0 :                 if( mbPresentation )
     933                 :            :                 {
     934         [ #  # ]:          0 :                     Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
     935                 :            : 
     936         [ #  # ]:          0 :                     if( xPropSet.is() )
     937                 :            :                     {
     938                 :          0 :                         sal_Bool bBackgroundVisibility                = sal_True;     // default: visible
     939                 :          0 :                         sal_Bool bBackgroundObjectsVisibility         = sal_True;     // default: visible
     940                 :          0 :                         sal_Bool bPageNumberVisibility                = sal_False;    // default: hidden
     941                 :          0 :                         sal_Bool bDateTimeVisibility                  = sal_True;     // default: visible
     942                 :          0 :                         sal_Bool bFooterVisibility                    = sal_True;     // default: visible
     943                 :          0 :                         sal_Bool bDateTimeFixed                       = sal_True;     // default: fixed
     944                 :            : 
     945         [ #  # ]:          0 :                         FixedDateTimeField            aFixedDateTimeField;
     946         [ #  # ]:          0 :                         VariableDateTimeField         aVariableDateTimeField;
     947         [ #  # ]:          0 :                         FooterField                   aFooterField;
     948                 :            : 
     949 [ #  # ][ #  # ]:          0 :                         xPropSet->getPropertyValue( B2UCONST( "IsBackgroundVisible" ) )  >>= bBackgroundVisibility;
                 [ #  # ]
     950                 :            :                         // in case the attribute is set to its default value it is not appended to the meta-slide element
     951         [ #  # ]:          0 :                         if( !bBackgroundVisibility ) // visibility default value: 'visible'
     952 [ #  # ][ #  # ]:          0 :                             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, B2UCONST( "hidden" ) );
     953                 :            : 
     954                 :            :                         // Page Number, Date/Time, Footer and Header Fields are regarded as background objects.
     955                 :            :                         // So bBackgroundObjectsVisibility overrides visibility of master page text fields.
     956 [ #  # ][ #  # ]:          0 :                         xPropSet->getPropertyValue( B2UCONST( "IsBackgroundObjectsVisible" ) )  >>= bBackgroundObjectsVisibility;
                 [ #  # ]
     957         [ #  # ]:          0 :                         if( bBackgroundObjectsVisibility ) // visibility default value: 'visible'
     958                 :            :                         {
     959                 :            :                             /*
     960                 :            :                              *  Page Number Field
     961                 :            :                              */
     962 [ #  # ][ #  # ]:          0 :                             xPropSet->getPropertyValue( B2UCONST( "IsPageNumberVisible" ) )  >>= bPageNumberVisibility;
                 [ #  # ]
     963 [ #  # ][ #  # ]:          0 :                             bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != SVX_NUMBER_NONE );
     964         [ #  # ]:          0 :                             if( bPageNumberVisibility ) // visibility default value: 'hidden'
     965                 :            :                             {
     966 [ #  # ][ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrPageNumberVisibility, B2UCONST( "visible" ) );
     967                 :            :                             }
     968                 :            :                             /*
     969                 :            :                              *  Date/Time Field
     970                 :            :                              */
     971 [ #  # ][ #  # ]:          0 :                             xPropSet->getPropertyValue( B2UCONST( "IsDateTimeVisible" ) ) >>= bDateTimeVisibility;
                 [ #  # ]
     972         [ #  # ]:          0 :                             if( bDateTimeVisibility ) // visibility default value: 'visible'
     973                 :            :                             {
     974 [ #  # ][ #  # ]:          0 :                                 xPropSet->getPropertyValue( B2UCONST( "IsDateTimeFixed" ) ) >>= bDateTimeFixed;
                 [ #  # ]
     975         [ #  # ]:          0 :                                 if( bDateTimeFixed ) // we are interested only in the field text not in the date/time format
     976                 :            :                                 {
     977 [ #  # ][ #  # ]:          0 :                                     xPropSet->getPropertyValue( B2UCONST( "DateTimeText" ) ) >>= aFixedDateTimeField.text;
                 [ #  # ]
     978         [ #  # ]:          0 :                                     if( !aFixedDateTimeField.text.isEmpty() )
     979                 :            :                                     {
     980         [ #  # ]:          0 :                                         OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage );
     981         [ #  # ]:          0 :                                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
     982                 :            :                                     }
     983                 :            :                                 }
     984                 :            :                                 else // the inverse applies: we are interested only in the date/time format not in the field text
     985                 :            :                                 {
     986 [ #  # ][ #  # ]:          0 :                                     xPropSet->getPropertyValue( B2UCONST( "DateTimeFormat" ) ) >>= aVariableDateTimeField.format;
                 [ #  # ]
     987         [ #  # ]:          0 :                                     OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage );
     988         [ #  # ]:          0 :                                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
     989                 :            :                                 }
     990                 :            :                             }
     991                 :            :                             else
     992                 :            :                             {
     993 [ #  # ][ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeVisibility, B2UCONST( "hidden" ) );
     994                 :            :                             }
     995                 :            :                             /*
     996                 :            :                              *  Footer Field
     997                 :            :                              */
     998 [ #  # ][ #  # ]:          0 :                             xPropSet->getPropertyValue( B2UCONST( "IsFooterVisible" ) )  >>= bFooterVisibility;
                 [ #  # ]
     999         [ #  # ]:          0 :                             if( bFooterVisibility ) // visibility default value: 'visible'
    1000                 :            :                             {
    1001 [ #  # ][ #  # ]:          0 :                                 xPropSet->getPropertyValue( B2UCONST( "FooterText" ) ) >>= aFooterField.text;
                 [ #  # ]
    1002         [ #  # ]:          0 :                                 if( !aFooterField.text.isEmpty() )
    1003                 :            :                                 {
    1004         [ #  # ]:          0 :                                     OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage );
    1005         [ #  # ]:          0 :                                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId );
    1006                 :            :                                 }
    1007                 :            :                             }
    1008                 :            :                             else
    1009                 :            :                             {
    1010 [ #  # ][ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterVisibility, B2UCONST( "hidden" ) );
    1011                 :            :                             }
    1012                 :            :                         }
    1013                 :            :                         else
    1014                 :            :                         {
    1015 [ #  # ][ #  # ]:          0 :                             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, B2UCONST( "hidden" ) );
    1016                 :            :                         }
    1017                 :            : 
    1018                 :            :                         // We look for a slide transition.
    1019                 :            :                         // Transition properties are exported together with animations.
    1020                 :          0 :                         sal_Int16 nTransitionType(0);
    1021 [ #  # ][ #  # ]:          0 :                         if( xPropSet->getPropertyValue( B2UCONST( "TransitionType" ) )  >>= nTransitionType )
         [ #  # ][ #  # ]
    1022                 :            :                         {
    1023                 :          0 :                             sal_Int16 nTransitionSubType(0);
    1024 [ #  # ][ #  # ]:          0 :                             if( xPropSet->getPropertyValue( B2UCONST( "TransitionSubtype" ) )  >>= nTransitionSubType )
         [ #  # ][ #  # ]
    1025                 :            :                             {
    1026 [ #  # ][ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrHasTransition, B2UCONST( "true" ) );
    1027                 :            :                             }
    1028 [ #  # ][ #  # ]:          0 :                         }
                 [ #  # ]
    1029                 :            : 
    1030                 :          0 :                     }
    1031                 :            :                 }
    1032                 :            : 
    1033                 :            :                 {
    1034 [ #  # ][ #  # ]:          0 :                     SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1035                 :            :                 }  // when the aExp2 destructor is called the </g> tag is appended to the output file
    1036                 :          0 :             }
    1037                 :            : 
    1038                 :            :             // export text field elements
    1039         [ #  # ]:          0 :             if( mbPresentation )
    1040                 :            :             {
    1041         [ #  # ]:          0 :                 for( sal_Int32 i = 0, nSize = aFieldSet.size(); i < nSize; ++i )
    1042                 :            :                 {
    1043         [ #  # ]:          0 :                     OUString sElemId = B2UCONST( aOOOElemTextField );
    1044                 :          0 :                     sElemId += OUString::valueOf( sal_Unicode('_') );
    1045                 :          0 :                     sElemId += OUString::valueOf( i );
    1046         [ #  # ]:          0 :                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sElemId );
    1047         [ #  # ]:          0 :                     aFieldSet[i]->elementExport( mpSVGExport );
    1048                 :            : 
    1049         [ #  # ]:          0 :                     aFieldSet[i]->growCharSet( mTextFieldCharSets );
    1050                 :          0 :                 }
    1051                 :            : 
    1052                 :            :             }
    1053                 :            :             // text fields are used only for generating meta info so we don't need them anymore
    1054         [ #  # ]:          0 :             for( sal_uInt32 i = 0; i < aFieldSet.size(); ++i )
    1055                 :            :             {
    1056         [ #  # ]:          0 :                 if( aFieldSet[i] != NULL )
    1057                 :            :                 {
    1058 [ #  # ][ #  # ]:          0 :                     delete aFieldSet[i];
    1059                 :            :                 }
    1060         [ #  # ]:          0 :             }
    1061                 :            :         }
    1062         [ #  # ]:          0 :         bRet = sal_True;
    1063                 :            :     }
    1064                 :            : 
    1065                 :          0 :     return bRet;
    1066                 :            : }
    1067                 :            : 
    1068                 :            : // -----------------------------------------------------------------------------
    1069                 :            : 
    1070                 :          0 : sal_Bool SVGFilter::implExportAnimations()
    1071                 :            : {
    1072                 :          0 :     sal_Bool bRet = sal_False;
    1073                 :            : 
    1074 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( "presentation-animations" )  );
    1075         [ #  # ]:          0 :     SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
    1076                 :            : 
    1077         [ #  # ]:          0 :     for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
    1078                 :            :     {
    1079 [ #  # ][ #  # ]:          0 :         Reference< XPropertySet > xProps( mSelectedPages[i], UNO_QUERY );
    1080                 :            : 
    1081         [ #  # ]:          0 :         if( xProps.is() )
    1082                 :            :         {
    1083                 :          0 :             sal_Int16 nTransition = 0;
    1084 [ #  # ][ #  # ]:          0 :             xProps->getPropertyValue(  B2UCONST( "TransitionType" ) )  >>= nTransition;
                 [ #  # ]
    1085                 :            :             // we have a slide transition ?
    1086                 :          0 :             sal_Bool bHasEffects = ( nTransition != 0 );
    1087                 :            : 
    1088 [ #  # ][ #  # ]:          0 :             Reference< XAnimationNodeSupplier > xAnimNodeSupplier( mSelectedPages[i], UNO_QUERY );
    1089         [ #  # ]:          0 :             if( xAnimNodeSupplier.is() )
    1090                 :            :             {
    1091 [ #  # ][ #  # ]:          0 :                 Reference< XAnimationNode > xRootNode = xAnimNodeSupplier->getAnimationNode();
    1092         [ #  # ]:          0 :                 if( xRootNode.is() )
    1093                 :            :                 {
    1094         [ #  # ]:          0 :                     if( !bHasEffects )
    1095                 :            :                     {
    1096                 :            :                         // first check if there are no animations
    1097         [ #  # ]:          0 :                         Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW );
    1098 [ #  # ][ #  # ]:          0 :                         Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
                 [ #  # ]
    1099 [ #  # ][ #  # ]:          0 :                         if( xEnumeration->hasMoreElements() )
                 [ #  # ]
    1100                 :            :                         {
    1101                 :            :                             // first child node may be an empty main sequence, check this
    1102 [ #  # ][ #  # ]:          0 :                             Reference< XAnimationNode > xMainNode( xEnumeration->nextElement(), UNO_QUERY_THROW );
                 [ #  # ]
    1103         [ #  # ]:          0 :                             Reference< XEnumerationAccess > xMainEnumerationAccess( xMainNode, UNO_QUERY_THROW );
    1104 [ #  # ][ #  # ]:          0 :                             Reference< XEnumeration > xMainEnumeration( xMainEnumerationAccess->createEnumeration(), UNO_QUERY_THROW );
                 [ #  # ]
    1105                 :            : 
    1106                 :            :                             // only export if the main sequence is not empty or if there are additional
    1107                 :            :                             // trigger sequences
    1108 [ #  # ][ #  # ]:          0 :                             bHasEffects = xMainEnumeration->hasMoreElements() || xEnumeration->hasMoreElements();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1109                 :          0 :                         }
    1110                 :            :                     }
    1111         [ #  # ]:          0 :                     if( bHasEffects )
    1112                 :            :                     {
    1113 [ #  # ][ #  # ]:          0 :                         OUString sId = implGetValidIDFromInterface( mSelectedPages[i] );
    1114         [ #  # ]:          0 :                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, sId  );
    1115         [ #  # ]:          0 :                         sId += B2UCONST( "-animations" );
    1116         [ #  # ]:          0 :                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sId  );
    1117 [ #  # ][ #  # ]:          0 :                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Animations" ) );
    1118         [ #  # ]:          0 :                         SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
    1119                 :            : 
    1120                 :          0 :                         UniReference< xmloff::AnimationsExporter > xAnimationsExporter;
    1121 [ #  # ][ #  # ]:          0 :                         xAnimationsExporter = new xmloff::AnimationsExporter( *mpSVGExport, xProps );
                 [ #  # ]
    1122 [ #  # ][ #  # ]:          0 :                         xAnimationsExporter->prepare( xRootNode );
    1123 [ #  # ][ #  # ]:          0 :                         xAnimationsExporter->exportAnimations( xRootNode );
         [ #  # ][ #  # ]
    1124                 :            :                     }
    1125                 :          0 :                 }
    1126                 :          0 :             }
    1127                 :            :         }
    1128                 :          0 :     }
    1129                 :            : 
    1130                 :          0 :     bRet = sal_True;
    1131         [ #  # ]:          0 :     return bRet;
    1132                 :            : }
    1133                 :            : 
    1134                 :            : 
    1135                 :            : // -----------------------------------------------------------------------------
    1136                 :            : 
    1137                 :            : #define SVGFILTER_EXPORT_SVGSCRIPT( z, n, aFragment ) \
    1138                 :            :         xExtDocHandler->unknown( OUString::createFromAscii( aFragment ## n ) );
    1139                 :            : 
    1140                 :          0 : sal_Bool SVGFilter::implGenerateScript()
    1141                 :            : {
    1142         [ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "type", B2UCONST( "text/ecmascript" ) );
    1143                 :            : 
    1144                 :            :     {
    1145         [ #  # ]:          0 :         SvXMLElementExport                       aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", sal_True, sal_True );
    1146         [ #  # ]:          0 :         Reference< XExtendedDocumentHandler >    xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
    1147                 :            : 
    1148         [ #  # ]:          0 :         if( xExtDocHandler.is() )
    1149                 :            :         {
    1150 [ #  # ][ #  # ]:          0 :             BOOST_PP_REPEAT( N_SVGSCRIPT_FRAGMENTS, SVGFILTER_EXPORT_SVGSCRIPT, aSVGScript )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1151         [ #  # ]:          0 :         }
    1152                 :            :     }
    1153                 :            : 
    1154                 :          0 :     return sal_True;
    1155                 :            : }
    1156                 :            : 
    1157                 :            : // -----------------------------------------------------------------------------
    1158                 :            : 
    1159                 :          0 : Any SVGFilter::implSafeGetPagePropSet( const OUString & sPropertyName,
    1160                 :            :                                             const Reference< XPropertySet > & rxPropSet,
    1161                 :            :                                             const Reference< XPropertySetInfo > & rxPropSetInfo )
    1162                 :            : {
    1163                 :          0 :     Any result;
    1164 [ #  # ][ #  # ]:          0 :     if( rxPropSetInfo->hasPropertyByName( sPropertyName ) )
                 [ #  # ]
    1165                 :            :     {
    1166 [ #  # ][ #  # ]:          0 :         result = rxPropSet->getPropertyValue( sPropertyName );
    1167                 :            :     }
    1168                 :          0 :     return result;
    1169                 :            : }
    1170                 :            : 
    1171                 :            : // -----------------------------------------------------------------------------
    1172                 :            : 
    1173                 :            : /*  SVGFilter::implGetPagePropSet
    1174                 :            :  *
    1175                 :            :  *  We collect info on master page elements visibility,
    1176                 :            :  *  and placeholder text shape content.
    1177                 :            :  *  This method is used when exporting a single page
    1178                 :            :  *  as implGenerateMetaData is not invoked.
    1179                 :            :  */
    1180                 :          0 : sal_Bool SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage )
    1181                 :            : {
    1182                 :          0 :     sal_Bool bRet = sal_False;
    1183                 :            : 
    1184                 :          0 :     mVisiblePagePropSet.bIsBackgroundVisible                = true;
    1185                 :          0 :     mVisiblePagePropSet.bAreBackgroundObjectsVisible        = true;
    1186                 :          0 :     mVisiblePagePropSet.bIsPageNumberFieldVisible           = false;;
    1187                 :          0 :     mVisiblePagePropSet.bIsHeaderFieldVisible               = false;
    1188                 :          0 :     mVisiblePagePropSet.bIsFooterFieldVisible               = true;
    1189                 :          0 :     mVisiblePagePropSet.bIsDateTimeFieldVisible             = true;
    1190                 :          0 :     mVisiblePagePropSet.bIsDateTimeFieldFixed               = true;
    1191                 :          0 :     mVisiblePagePropSet.nDateTimeFormat                     = SVXDATEFORMAT_B;
    1192                 :          0 :     mVisiblePagePropSet.nPageNumberingType                  = SVX_ARABIC;
    1193                 :            : 
    1194                 :            :     /*  We collect info on master page elements visibility,
    1195                 :            :      *  and placeholder text shape content.
    1196                 :            :      */
    1197                 :          0 :     Any result;
    1198         [ #  # ]:          0 :     Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY );
    1199         [ #  # ]:          0 :     if( xPropSet.is() )
    1200                 :            :     {
    1201 [ #  # ][ #  # ]:          0 :         Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
    1202         [ #  # ]:          0 :         if( xPropSetInfo.is() )
    1203                 :            :         {
    1204 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsBackgroundVisible" ), xPropSet, xPropSetInfo )          >>= mVisiblePagePropSet.bIsBackgroundVisible;
    1205 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsBackgroundObjectsVisible" ), xPropSet, xPropSetInfo )   >>= mVisiblePagePropSet.bAreBackgroundObjectsVisible;
    1206 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsPageNumberVisible" ), xPropSet, xPropSetInfo )          >>= mVisiblePagePropSet.bIsPageNumberFieldVisible;
    1207 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsHeaderVisible" ), xPropSet, xPropSetInfo )              >>= mVisiblePagePropSet.bIsHeaderFieldVisible;
    1208 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsFooterVisible" ), xPropSet, xPropSetInfo )              >>= mVisiblePagePropSet.bIsFooterFieldVisible;
    1209 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsDateTimeVisible" ), xPropSet, xPropSetInfo )            >>= mVisiblePagePropSet.bIsDateTimeFieldVisible;
    1210                 :            : 
    1211 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "IsDateTimeFixed" ), xPropSet, xPropSetInfo )              >>= mVisiblePagePropSet.bIsDateTimeFieldFixed;
    1212 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "DateTimeFormat" ), xPropSet, xPropSetInfo )               >>= mVisiblePagePropSet.nDateTimeFormat;
    1213 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "Number" ), xPropSet, xPropSetInfo )                       >>= mVisiblePagePropSet.nPageNumber;
    1214 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "DateTimeText" ), xPropSet, xPropSetInfo )                 >>= mVisiblePagePropSet.sDateTimeText;
    1215 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "FooterText" ), xPropSet, xPropSetInfo )                   >>= mVisiblePagePropSet.sFooterText;
    1216 [ #  # ][ #  # ]:          0 :             implSafeGetPagePropSet( B2UCONST( "HeaderText" ), xPropSet, xPropSetInfo )                   >>= mVisiblePagePropSet.sHeaderText;
    1217                 :            : 
    1218         [ #  # ]:          0 :             if( mVisiblePagePropSet.bIsPageNumberFieldVisible )
    1219                 :            :             {
    1220         [ #  # ]:          0 :                 SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( rxPage );
    1221         [ #  # ]:          0 :                 if( pSvxDrawPage )
    1222                 :            :                 {
    1223                 :          0 :                     SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
    1224         [ #  # ]:          0 :                     SdrModel* pSdrModel = pSdrPage->GetModel();
    1225         [ #  # ]:          0 :                     mVisiblePagePropSet.nPageNumberingType = pSdrModel->GetPageNumType();
    1226                 :            :                 }
    1227                 :            :             }
    1228                 :            : 
    1229                 :          0 :             bRet = sal_True;
    1230                 :          0 :         }
    1231                 :            :     }
    1232                 :            : 
    1233                 :          0 :     return bRet;
    1234                 :            : }
    1235                 :            : 
    1236                 :            : 
    1237                 :            : // -----------------------------------------------------------------------------
    1238                 :            : 
    1239                 :          0 : sal_Bool SVGFilter::implExportMasterPages( const SVGFilter::XDrawPageSequence & rxPages,
    1240                 :            :                                            sal_Int32 nFirstPage, sal_Int32 nLastPage )
    1241                 :            : {
    1242                 :            :     DBG_ASSERT( nFirstPage <= nLastPage,
    1243                 :            :                 "SVGFilter::implExportPages: nFirstPage > nLastPage" );
    1244                 :            : 
    1245                 :            :     // When the exported slides are more than one we wrap master page elements
    1246                 :            :     // with a svg <defs> element.
    1247 [ #  # ][ #  # ]:          0 :     OUString aContainerTag = (mbSinglePage) ? B2UCONST( "g" ) : B2UCONST( "defs" );
                 [ #  # ]
    1248         [ #  # ]:          0 :     SvXMLElementExport aContainerElement( *mpSVGExport, XML_NAMESPACE_NONE, aContainerTag, sal_True, sal_True );
    1249                 :            : 
    1250                 :          0 :     sal_Bool bRet = sal_False;
    1251         [ #  # ]:          0 :     for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
    1252                 :            :     {
    1253         [ #  # ]:          0 :         if( rxPages[i].is() )
    1254                 :            :         {
    1255         [ #  # ]:          0 :             Reference< XShapes > xShapes( rxPages[i], UNO_QUERY );
    1256                 :            : 
    1257         [ #  # ]:          0 :             if( xShapes.is() )
    1258                 :            :             {
    1259                 :            :                 // add id attribute
    1260         [ #  # ]:          0 :                 const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] );
    1261         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId );
    1262                 :            : 
    1263 [ #  # ][ #  # ]:          0 :                 bRet = implExportPage( sPageId, rxPages[i], xShapes, sal_True /* is a master page */ ) || bRet;
                 [ #  # ]
    1264                 :          0 :             }
    1265                 :            :         }
    1266                 :            :     }
    1267         [ #  # ]:          0 :     return bRet;
    1268                 :            : }
    1269                 :            : 
    1270                 :            : // -----------------------------------------------------------------------------
    1271                 :            : 
    1272                 :          0 : sal_Bool SVGFilter::implExportDrawPages( const SVGFilter::XDrawPageSequence & rxPages,
    1273                 :            :                                            sal_Int32 nFirstPage, sal_Int32 nLastPage )
    1274                 :            : {
    1275                 :            :     DBG_ASSERT( nFirstPage <= nLastPage,
    1276                 :            :                 "SVGFilter::implExportPages: nFirstPage > nLastPage" );
    1277                 :            : 
    1278                 :            :     // We wrap all slide in a group element with class name "SlideGroup".
    1279 [ #  # ][ #  # ]:          0 :     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "SlideGroup" ) );
    1280         [ #  # ]:          0 :     SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1281                 :            : 
    1282                 :          0 :     sal_Bool bRet = sal_False;
    1283         [ #  # ]:          0 :     for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
    1284                 :            :     {
    1285         [ #  # ]:          0 :         Reference< XShapes > xShapes( rxPages[i], UNO_QUERY );
    1286                 :            : 
    1287         [ #  # ]:          0 :         if( xShapes.is() )
    1288                 :            :         {
    1289                 :            :             // Insert the <g> open tag related to the svg element for
    1290                 :            :             // handling a slide visibility.
    1291                 :            :             // In case the exported slides are more than one the initial
    1292                 :            :             // visibility of each slide is set to 'hidden'.
    1293         [ #  # ]:          0 :             if( !mbSinglePage )
    1294                 :            :             {
    1295 [ #  # ][ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", B2UCONST( "hidden" ) );
    1296                 :            :             }
    1297         [ #  # ]:          0 :             SvXMLElementExport aGElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1298                 :            : 
    1299                 :            :             {
    1300                 :            :                 // add id attribute
    1301         [ #  # ]:          0 :                 const OUString & sPageId = implGetValidIDFromInterface( rxPages[i] );
    1302         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId );
    1303                 :            : 
    1304 [ #  # ][ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Slide" ) );
    1305                 :            : 
    1306                 :            :                 // Adding a clip path to each exported slide , so in case
    1307                 :            :                 // bitmaps or other elements exceed the slide margins, they are
    1308                 :            :                 // trimmed, even when they are shown inside a thumbnail view.
    1309 [ #  # ][ #  # ]:          0 :                 OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" );
    1310         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue );
    1311                 :            : 
    1312         [ #  # ]:          0 :                 SvXMLElementExport aSlideElement( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1313                 :            : 
    1314 [ #  # ][ #  # ]:          0 :                 bRet = implExportPage( sPageId, rxPages[i], xShapes, sal_False /* is not a master page */ ) || bRet;
         [ #  # ][ #  # ]
    1315         [ #  # ]:          0 :             }
    1316                 :            :         } // append the </g> closing tag related to the svg element handling the slide visibility
    1317                 :          0 :     }
    1318                 :            : 
    1319         [ #  # ]:          0 :     return bRet;
    1320                 :            : }
    1321                 :            : 
    1322                 :            : // -----------------------------------------------------------------------------
    1323                 :          0 : sal_Bool SVGFilter::implExportPage( const ::rtl::OUString & sPageId,
    1324                 :            :                                     const Reference< XDrawPage > & rxPage,
    1325                 :            :                                     const Reference< XShapes > & xShapes,
    1326                 :            :                                     sal_Bool bMaster )
    1327                 :            : {
    1328                 :          0 :     sal_Bool bRet = sal_False;
    1329                 :            : 
    1330                 :            :     {
    1331         [ #  # ]:          0 :         OUString sPageName = implGetInterfaceName( rxPage );
    1332 [ #  # ][ #  # ]:          0 :         if( !(sPageName.isEmpty() || mbSinglePage ))
                 [ #  # ]
    1333         [ #  # ]:          0 :             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrName, sPageName );
    1334                 :            : 
    1335                 :            :         {
    1336         [ #  # ]:          0 :             Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
    1337                 :            : 
    1338         [ #  # ]:          0 :             if( xExtDocHandler.is() )
    1339                 :            :             {
    1340                 :          0 :                 OUString aDesc;
    1341                 :            : 
    1342         [ #  # ]:          0 :                 if( bMaster )
    1343         [ #  # ]:          0 :                     aDesc = B2UCONST( "Master_Slide" );
    1344                 :            :                 else
    1345         [ #  # ]:          0 :                     aDesc = B2UCONST( "Page" );
    1346                 :            : 
    1347         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aDesc );
    1348                 :          0 :             }
    1349                 :            :         }
    1350                 :            : 
    1351                 :            :         // insert the <g> open tag related to the DrawPage/MasterPage
    1352         [ #  # ]:          0 :         SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1353                 :            : 
    1354                 :            :         // In case the page has a background object we append it .
    1355 [ #  # ][ #  # ]:          0 :         if( (mpObjects->find( rxPage ) != mpObjects->end()) )
                 [ #  # ]
    1356                 :            :         {
    1357         [ #  # ]:          0 :             const GDIMetaFile& rMtf = (*mpObjects)[ rxPage ].GetRepresentation();
    1358 [ #  # ][ #  # ]:          0 :             if( rMtf.GetActionSize() )
    1359                 :            :             {
    1360                 :            :                 // background id = "bg-" + page id
    1361         [ #  # ]:          0 :                 OUString sBackgroundId = B2UCONST( "bg-" );
    1362                 :          0 :                 sBackgroundId += sPageId;
    1363         [ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundId );
    1364                 :            : 
    1365                 :            :                 // At present (LibreOffice 3.4.0) the 'IsBackgroundVisible' property is not handled
    1366                 :            :                 // by Impress; anyway we handle this property as referring only to the visibility
    1367                 :            :                 // of the master page background. So if a slide has its own background object,
    1368                 :            :                 // the visibility of such a background object is always inherited from the visibility
    1369                 :            :                 // of the parent slide regardless of the value of the 'IsBackgroundVisible' property.
    1370                 :            :                 // This means that we need to set up the visibility attribute only for the background
    1371                 :            :                 // element of a master page.
    1372 [ #  # ][ #  # ]:          0 :                 if( mbSinglePage && bMaster )
    1373                 :            :                 {
    1374         [ #  # ]:          0 :                     if( !mVisiblePagePropSet.bIsBackgroundVisible )
    1375                 :            :                     {
    1376 [ #  # ][ #  # ]:          0 :                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", B2UCONST( "hidden" ) );
    1377                 :            :                     }
    1378                 :            :                 }
    1379                 :            : 
    1380 [ #  # ][ #  # ]:          0 :                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class",  B2UCONST( "Background" ) );
    1381                 :            : 
    1382                 :            :                 // insert the <g> open tag related to the Background
    1383         [ #  # ]:          0 :                 SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1384                 :            : 
    1385                 :            :                 // append all elements that make up the Background
    1386                 :          0 :                 const Point aNullPt;
    1387 [ #  # ][ #  # ]:          0 :                 mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL );
    1388                 :            :             }   // insert the </g> closing tag related to the Background
    1389                 :            :         }
    1390                 :            : 
    1391                 :            :         // In case we are dealing with a master page we need to to group all its shapes
    1392                 :            :         // into a group element, this group will make up the so named "background objects"
    1393         [ #  # ]:          0 :         if( bMaster )
    1394                 :            :         {
    1395                 :            :             // background objects id = "bo-" + page id
    1396         [ #  # ]:          0 :             OUString sBackgroundObjectsId = B2UCONST( "bo-" );
    1397                 :          0 :             sBackgroundObjectsId += sPageId;
    1398         [ #  # ]:          0 :             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundObjectsId );
    1399         [ #  # ]:          0 :             if( mbSinglePage )
    1400                 :            :             {
    1401         [ #  # ]:          0 :                 if( !mVisiblePagePropSet.bAreBackgroundObjectsVisible )
    1402                 :            :                 {
    1403 [ #  # ][ #  # ]:          0 :                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", B2UCONST( "hidden" ) );
    1404                 :            :                 }
    1405                 :            :             }
    1406 [ #  # ][ #  # ]:          0 :             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class",  B2UCONST( "BackgroundObjects" ) );
    1407                 :            : 
    1408                 :            :             // insert the <g> open tag related to the Background Objects
    1409         [ #  # ]:          0 :             SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1410                 :            : 
    1411                 :            :             // append all shapes that make up the Master Slide
    1412 [ #  # ][ #  # ]:          0 :             bRet = implExportShapes( xShapes ) || bRet;
         [ #  # ][ #  # ]
    1413                 :            :         }   // append the </g> closing tag related to the Background Objects
    1414                 :            :         else
    1415                 :            :         {
    1416                 :            :             // append all shapes that make up the Slide
    1417 [ #  # ][ #  # ]:          0 :             bRet = implExportShapes( xShapes ) || bRet;
                 [ #  # ]
    1418         [ #  # ]:          0 :         }
    1419                 :            :     }  // append the </g> closing tag related to the Slide/Master_Slide
    1420                 :            : 
    1421                 :          0 :     return bRet;
    1422                 :            : }
    1423                 :            : 
    1424                 :            : 
    1425                 :            : // -----------------------------------------------------------------------------
    1426                 :            : 
    1427                 :          0 : sal_Bool SVGFilter::implExportShapes( const Reference< XShapes >& rxShapes )
    1428                 :            : {
    1429                 :          0 :     Reference< XShape > xShape;
    1430                 :          0 :     sal_Bool            bRet = sal_False;
    1431                 :            : 
    1432 [ #  # ][ #  # ]:          0 :     for( sal_Int32 i = 0, nCount = rxShapes->getCount(); i < nCount; ++i )
                 [ #  # ]
    1433                 :            :     {
    1434 [ #  # ][ #  # ]:          0 :         if( ( rxShapes->getByIndex( i ) >>= xShape ) && xShape.is() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1435 [ #  # ][ #  # ]:          0 :             bRet = implExportShape( xShape ) || bRet;
                 [ #  # ]
    1436                 :            : 
    1437         [ #  # ]:          0 :         xShape = NULL;
    1438                 :            :     }
    1439                 :            : 
    1440                 :          0 :     return bRet;
    1441                 :            : }
    1442                 :            : 
    1443                 :            : // -----------------------------------------------------------------------------
    1444                 :            : 
    1445                 :          0 : sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
    1446                 :            : {
    1447         [ #  # ]:          0 :     Reference< XPropertySet >   xShapePropSet( rxShape, UNO_QUERY );
    1448                 :          0 :     sal_Bool                    bRet = sal_False;
    1449                 :            : 
    1450         [ #  # ]:          0 :     if( xShapePropSet.is() )
    1451                 :            :     {
    1452 [ #  # ][ #  # ]:          0 :         const ::rtl::OUString   aShapeType( rxShape->getShapeType() );
    1453                 :          0 :         sal_Bool                    bHideObj = sal_False;
    1454                 :            : 
    1455         [ #  # ]:          0 :         if( mbPresentation )
    1456                 :            :         {
    1457 [ #  # ][ #  # ]:          0 :             xShapePropSet->getPropertyValue( B2UCONST( "IsEmptyPresentationObject" ) )  >>= bHideObj;
                 [ #  # ]
    1458                 :            :         }
    1459                 :            : 
    1460         [ #  # ]:          0 :         if( !bHideObj )
    1461                 :            :         {
    1462 [ #  # ][ #  # ]:          0 :             if( aShapeType.lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
    1463                 :            :             {
    1464         [ #  # ]:          0 :                 Reference< XShapes > xShapes( rxShape, UNO_QUERY );
    1465                 :            : 
    1466         [ #  # ]:          0 :                 if( xShapes.is() )
    1467                 :            :                 {
    1468 [ #  # ][ #  # ]:          0 :                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Group" ) );
    1469         [ #  # ]:          0 :                     SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1470                 :            : 
    1471 [ #  # ][ #  # ]:          0 :                     bRet = implExportShapes( xShapes );
    1472                 :          0 :                 }
    1473                 :            :             }
    1474                 :            : 
    1475 [ #  # ][ #  # ]:          0 :             if( !bRet && mpObjects->find( rxShape ) !=  mpObjects->end() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1476                 :            :             {
    1477                 :          0 :                 const ::rtl::OUString*                    pElementId = NULL;
    1478                 :            : 
    1479                 :          0 :                 ::com::sun::star::awt::Rectangle    aBoundRect;
    1480         [ #  # ]:          0 :                 const GDIMetaFile&                  rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
    1481                 :            : 
    1482 [ #  # ][ #  # ]:          0 :                 xShapePropSet->getPropertyValue( B2UCONST( "BoundRect" ) ) >>= aBoundRect;
         [ #  # ][ #  # ]
    1483                 :            : 
    1484                 :          0 :                 const Point aTopLeft( aBoundRect.X, aBoundRect.Y );
    1485                 :          0 :                 const Size  aSize( aBoundRect.Width, aBoundRect.Height );
    1486                 :            : 
    1487 [ #  # ][ #  # ]:          0 :                 if( rMtf.GetActionSize() )
    1488                 :            :                 {   // for text field shapes we set up text-adjust attributes
    1489                 :            :                     // and set visibility to hidden
    1490         [ #  # ]:          0 :                     OUString aShapeClass = implGetClassFromShape( rxShape );
    1491         [ #  # ]:          0 :                     if( mbPresentation )
    1492                 :            :                     {
    1493                 :          0 :                         sal_Bool bIsPageNumber  = ( aShapeClass == "Slide_Number" );
    1494                 :          0 :                         sal_Bool bIsFooter      = ( aShapeClass == "Footer" );
    1495                 :          0 :                         sal_Bool bIsDateTime    = ( aShapeClass == "Date/Time" );
    1496 [ #  # ][ #  # ]:          0 :                         if( bIsPageNumber || bIsDateTime || bIsFooter )
                 [ #  # ]
    1497                 :            :                         {
    1498         [ #  # ]:          0 :                             if( !mbSinglePage )
    1499                 :            :                             {
    1500                 :            :                                 // to notify to the SVGActionWriter::ImplWriteActions method
    1501                 :            :                                 // that we are dealing with a placeholder shape
    1502                 :          0 :                                 pElementId = &sPlaceholderTag;
    1503                 :            : 
    1504 [ #  # ][ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", B2UCONST( "hidden" ) );
    1505                 :            : 
    1506                 :          0 :                                 sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT;
    1507                 :          0 :                                 OUString sTextAdjust;
    1508 [ #  # ][ #  # ]:          0 :                                 xShapePropSet->getPropertyValue( B2UCONST( "ParaAdjust" ) ) >>= nTextAdjust;
                 [ #  # ]
    1509                 :            : 
    1510   [ #  #  #  # ]:          0 :                                 switch( nTextAdjust )
    1511                 :            :                                 {
    1512                 :            :                                     case ParagraphAdjust_LEFT:
    1513         [ #  # ]:          0 :                                             sTextAdjust = B2UCONST( "left" );
    1514                 :          0 :                                             break;
    1515                 :            :                                     case ParagraphAdjust_CENTER:
    1516         [ #  # ]:          0 :                                             sTextAdjust = B2UCONST( "center" );
    1517                 :          0 :                                             break;
    1518                 :            :                                     case ParagraphAdjust_RIGHT:
    1519         [ #  # ]:          0 :                                             sTextAdjust = B2UCONST( "right" );
    1520                 :          0 :                                             break;
    1521                 :            :                                     default:
    1522                 :          0 :                                         break;
    1523                 :            :                                 }
    1524         [ #  # ]:          0 :                                 mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrTextAdjust, sTextAdjust );
    1525                 :            :                             }
    1526                 :            :                             else // single page case
    1527                 :            :                             {
    1528 [ #  # ][ #  # ]:          0 :                                 if( !mVisiblePagePropSet.bAreBackgroundObjectsVisible || (
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    1529                 :          0 :                                     ( bIsPageNumber && !mVisiblePagePropSet.bIsPageNumberFieldVisible ) ||
    1530                 :          0 :                                     ( bIsDateTime && !mVisiblePagePropSet.bIsDateTimeFieldVisible ) ||
    1531                 :          0 :                                     ( bIsFooter && !mVisiblePagePropSet.bIsFooterFieldVisible ) ) )
    1532                 :            :                                 {
    1533 [ #  # ][ #  # ]:          0 :                                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", B2UCONST( "hidden" ) );
    1534                 :            :                                 }
    1535                 :            :                             }
    1536                 :            :                         }
    1537                 :            :                     }
    1538         [ #  # ]:          0 :                     mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aShapeClass );
    1539         [ #  # ]:          0 :                     SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1540                 :            : 
    1541         [ #  # ]:          0 :                     Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
    1542                 :            : 
    1543                 :          0 :                     OUString aTitle;
    1544 [ #  # ][ #  # ]:          0 :                     xShapePropSet->getPropertyValue( B2UCONST( "Title" ) ) >>= aTitle;
                 [ #  # ]
    1545         [ #  # ]:          0 :                     if( !aTitle.isEmpty() )
    1546                 :            :                     {
    1547         [ #  # ]:          0 :                         SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "title", sal_True, sal_True );
    1548 [ #  # ][ #  # ]:          0 :                         xExtDocHandler->characters( aTitle );
                 [ #  # ]
    1549                 :            :                     }
    1550                 :            : 
    1551                 :          0 :                     OUString aDescription;
    1552 [ #  # ][ #  # ]:          0 :                     xShapePropSet->getPropertyValue( B2UCONST( "Description" ) ) >>= aDescription;
                 [ #  # ]
    1553         [ #  # ]:          0 :                     if( !aDescription.isEmpty() )
    1554                 :            :                     {
    1555         [ #  # ]:          0 :                         SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "desc", sal_True, sal_True );
    1556 [ #  # ][ #  # ]:          0 :                         xExtDocHandler->characters( aDescription );
                 [ #  # ]
    1557                 :            :                     }
    1558                 :            : 
    1559                 :            : 
    1560         [ #  # ]:          0 :                     Reference< XInterface > xRef( rxShape, UNO_QUERY );
    1561         [ #  # ]:          0 :                     const OUString& rShapeId = implGetValidIDFromInterface( xRef );
    1562         [ #  # ]:          0 :                     if( !rShapeId.isEmpty() )
    1563                 :            :                     {
    1564         [ #  # ]:          0 :                         mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", rShapeId );
    1565                 :            :                         //mpSVGExport->AddAttributeIdLegacy( XML_NAMESPACE_DRAW, rShapeId );
    1566                 :            :                     }
    1567                 :            : 
    1568                 :            :                     {
    1569         [ #  # ]:          0 :                         SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
    1570 [ #  # ][ #  # ]:          0 :                         mpSVGWriter->WriteMetaFile( aTopLeft, aSize, rMtf, SVGWRITER_WRITE_ALL, pElementId );
    1571         [ #  # ]:          0 :                     }
    1572                 :            :                 }
    1573                 :            : 
    1574                 :          0 :                 bRet = sal_True;
    1575                 :            :             }
    1576                 :          0 :         }
    1577                 :            :     }
    1578                 :            : 
    1579                 :          0 :     return bRet;
    1580                 :            : }
    1581                 :            : 
    1582                 :            : // -----------------------------------------------------------------------------
    1583                 :            : 
    1584                 :          0 : sal_Bool SVGFilter::implCreateObjects()
    1585                 :            : {
    1586                 :            :     sal_Int32 i, nCount;
    1587                 :            : 
    1588         [ #  # ]:          0 :     for( i = 0, nCount = mMasterPageTargets.getLength(); i < nCount; ++i )
    1589                 :            :     {
    1590                 :          0 :         const Reference< XDrawPage > & xMasterPage = mMasterPageTargets[i];
    1591                 :            : 
    1592         [ #  # ]:          0 :         if( xMasterPage.is() )
    1593                 :            :         {
    1594         [ #  # ]:          0 :             mCreateOjectsCurrentMasterPage = xMasterPage;
    1595         [ #  # ]:          0 :             implCreateObjectsFromBackground( xMasterPage );
    1596                 :            : 
    1597         [ #  # ]:          0 :             Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
    1598                 :            : 
    1599         [ #  # ]:          0 :             if( xShapes.is() )
    1600         [ #  # ]:          0 :                 implCreateObjectsFromShapes( xShapes );
    1601                 :            :         }
    1602                 :            :     }
    1603                 :            : 
    1604         [ #  # ]:          0 :     for( i = 0, nCount = mSelectedPages.getLength(); i < nCount; ++i )
    1605                 :            :     {
    1606                 :          0 :         const Reference< XDrawPage > & xDrawPage = mSelectedPages[i];
    1607                 :            : 
    1608         [ #  # ]:          0 :         if( xDrawPage.is() )
    1609                 :            :         {
    1610                 :            : #if ENABLE_EXPORT_CUSTOM_SLIDE_BACKGROUND
    1611                 :            :             // TODO complete the implementation for exporting custom background for each slide
    1612                 :            :             // implementation status:
    1613                 :            :             // - hatch stroke color is set to 'none' so the hatch is not visible, why ?
    1614                 :            :             // - gradient look is not really awesome, too few colors are used;
    1615                 :            :             // - stretched bitmap, gradient and hatch are not exported only once
    1616                 :            :             //   and then referenced in case more than one slide uses them.
    1617                 :            :             // - tiled bitmap: an image element is exported for each tile,
    1618                 :            :             //   this is really too expensive!
    1619                 :            :             Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
    1620                 :            :             Reference< XPropertySet > xBackground;
    1621                 :            :             xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= xBackground;
    1622                 :            :             if( xBackground.is() )
    1623                 :            :             {
    1624                 :            :                 drawing::FillStyle aFillStyle;
    1625                 :            :                 sal_Bool assigned = ( xBackground->getPropertyValue( B2UCONST( "FillStyle" ) ) >>= aFillStyle );
    1626                 :            :                 if( assigned && aFillStyle != drawing::FillStyle_NONE )
    1627                 :            :                 {
    1628                 :            :                     implCreateObjectsFromBackground( xDrawPage );
    1629                 :            :                 }
    1630                 :            :             }
    1631                 :            : #endif
    1632         [ #  # ]:          0 :             Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
    1633                 :            : 
    1634         [ #  # ]:          0 :             if( xShapes.is() )
    1635         [ #  # ]:          0 :                 implCreateObjectsFromShapes( xShapes );
    1636                 :            :         }
    1637                 :            :     }
    1638                 :          0 :     return sal_True;
    1639                 :            : }
    1640                 :            : 
    1641                 :            : // -----------------------------------------------------------------------------
    1642                 :            : 
    1643                 :          0 : sal_Bool SVGFilter::implCreateObjectsFromShapes( const Reference< XShapes >& rxShapes )
    1644                 :            : {
    1645                 :          0 :     Reference< XShape > xShape;
    1646                 :          0 :     sal_Bool            bRet = sal_False;
    1647                 :            : 
    1648 [ #  # ][ #  # ]:          0 :     for( sal_Int32 i = 0, nCount = rxShapes->getCount(); i < nCount; ++i )
                 [ #  # ]
    1649                 :            :     {
    1650 [ #  # ][ #  # ]:          0 :         if( ( rxShapes->getByIndex( i ) >>= xShape ) && xShape.is() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    1651 [ #  # ][ #  # ]:          0 :             bRet = implCreateObjectsFromShape( xShape ) || bRet;
                 [ #  # ]
    1652                 :            : 
    1653         [ #  # ]:          0 :         xShape = NULL;
    1654                 :            :     }
    1655                 :            : 
    1656                 :          0 :     return bRet;
    1657                 :            : }
    1658                 :            : 
    1659                 :            : // -----------------------------------------------------------------------------
    1660                 :            : 
    1661                 :          0 : sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxShape )
    1662                 :            : {
    1663                 :          0 :     sal_Bool bRet = sal_False;
    1664 [ #  # ][ #  # ]:          0 :     if( rxShape->getShapeType().lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
                 [ #  # ]
    1665                 :            :     {
    1666         [ #  # ]:          0 :         Reference< XShapes > xShapes( rxShape, UNO_QUERY );
    1667                 :            : 
    1668         [ #  # ]:          0 :         if( xShapes.is() )
    1669         [ #  # ]:          0 :             bRet = implCreateObjectsFromShapes( xShapes );
    1670                 :            :     }
    1671                 :            :     else
    1672                 :            :     {
    1673                 :          0 :         SdrObject*  pObj = GetSdrObjectFromXShape( rxShape );
    1674                 :            : 
    1675         [ #  # ]:          0 :         if( pObj )
    1676                 :            :         {
    1677 [ #  # ][ #  # ]:          0 :             Graphic aGraphic( SdrExchangeView::GetObjGraphic( pObj->GetModel(), pObj ) );
    1678                 :            : 
    1679 [ #  # ][ #  # ]:          0 :             if( aGraphic.GetType() != GRAPHIC_NONE )
    1680                 :            :             {
    1681 [ #  # ][ #  # ]:          0 :                 if( aGraphic.GetType() == GRAPHIC_BITMAP )
    1682                 :            :                 {
    1683         [ #  # ]:          0 :                     GDIMetaFile    aMtf;
    1684                 :          0 :                     const Point    aNullPt;
    1685 [ #  # ][ #  # ]:          0 :                     const Size    aSize( pObj->GetCurrentBoundRect().GetSize() );
    1686                 :            : 
    1687 [ #  # ][ #  # ]:          0 :                     aMtf.AddAction( new MetaBmpExScaleAction( aNullPt, aSize, aGraphic.GetBitmapEx() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1688                 :          0 :                     aMtf.SetPrefSize( aSize );
    1689 [ #  # ][ #  # ]:          0 :                     aMtf.SetPrefMapMode( MAP_100TH_MM );
                 [ #  # ]
    1690                 :            : 
    1691 [ #  # ][ #  # ]:          0 :                     (*mpObjects)[ rxShape ] = ObjectRepresentation( rxShape, aMtf );
         [ #  # ][ #  # ]
                 [ #  # ]
    1692                 :            :                 }
    1693                 :            :                 else
    1694 [ #  # ][ #  # ]:          0 :                     (*mpObjects)[ rxShape ] = ObjectRepresentation( rxShape, aGraphic.GetGDIMetaFile() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1695                 :            : 
    1696                 :          0 :                 bRet = sal_True;
    1697         [ #  # ]:          0 :             }
    1698                 :            :         }
    1699                 :            :     }
    1700                 :            : 
    1701                 :          0 :     return bRet;
    1702                 :            : }
    1703                 :            : 
    1704                 :            : // -----------------------------------------------------------------------------
    1705                 :            : 
    1706                 :          0 : sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage )
    1707                 :            : {
    1708 [ #  # ][ #  # ]:          0 :     Reference< XExporter >    xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY );
         [ #  # ][ #  # ]
    1709                 :          0 :     sal_Bool                bRet = sal_False;
    1710                 :            : 
    1711         [ #  # ]:          0 :     if( xExporter.is() )
    1712                 :            :     {
    1713         [ #  # ]:          0 :         GDIMetaFile                aMtf;
    1714         [ #  # ]:          0 :         Reference< XFilter >    xFilter( xExporter, UNO_QUERY );
    1715                 :            : 
    1716         [ #  # ]:          0 :         utl::TempFile aFile;
    1717                 :          0 :         aFile.EnableKillingFile();
    1718                 :            : 
    1719         [ #  # ]:          0 :         Sequence< PropertyValue > aDescriptor( 3 );
    1720 [ #  # ][ #  # ]:          0 :         aDescriptor[0].Name = B2UCONST( "FilterName" );
    1721 [ #  # ][ #  # ]:          0 :         aDescriptor[0].Value <<= B2UCONST( "SVM" );
                 [ #  # ]
    1722 [ #  # ][ #  # ]:          0 :         aDescriptor[1].Name = B2UCONST( "URL" );
    1723 [ #  # ][ #  # ]:          0 :         aDescriptor[1].Value <<= OUString( aFile.GetURL() );
         [ #  # ][ #  # ]
                 [ #  # ]
    1724 [ #  # ][ #  # ]:          0 :         aDescriptor[2].Name = B2UCONST( "ExportOnlyBackground" );
    1725 [ #  # ][ #  # ]:          0 :         aDescriptor[2].Value <<= (sal_Bool) sal_True;
    1726                 :            : 
    1727 [ #  # ][ #  # ]:          0 :         xExporter->setSourceDocument( Reference< XComponent >( rxDrawPage, UNO_QUERY ) );
                 [ #  # ]
    1728 [ #  # ][ #  # ]:          0 :         xFilter->filter( aDescriptor );
    1729 [ #  # ][ #  # ]:          0 :         aMtf.Read( *aFile.GetStream( STREAM_READ ) );
    1730                 :            : 
    1731 [ #  # ][ #  # ]:          0 :         (*mpObjects)[ rxDrawPage ] = ObjectRepresentation( rxDrawPage, aMtf );
         [ #  # ][ #  # ]
    1732                 :            : 
    1733 [ #  # ][ #  # ]:          0 :         bRet = sal_True;
                 [ #  # ]
    1734                 :            :     }
    1735                 :            : 
    1736                 :          0 :     return bRet;
    1737                 :            : }
    1738                 :            : 
    1739                 :            : // -----------------------------------------------------------------------------
    1740                 :            : 
    1741                 :          0 : OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape )
    1742                 :            : {
    1743                 :          0 :     OUString            aRet;
    1744 [ #  # ][ #  # ]:          0 :     const OUString      aShapeType( rxShape->getShapeType() );
    1745                 :            : 
    1746 [ #  # ][ #  # ]:          0 :     if( aShapeType.lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
    1747         [ #  # ]:          0 :         aRet = B2UCONST( "Group" );
    1748 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "drawing.GraphicObjectShape" ) ) != -1 )
    1749         [ #  # ]:          0 :         aRet = B2UCONST( "Graphic" );
    1750 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "drawing.OLE2Shape" ) ) != -1 )
    1751         [ #  # ]:          0 :         aRet = B2UCONST( "OLE2" );
    1752 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 )
    1753         [ #  # ]:          0 :         aRet = B2UCONST( "Header" );
    1754 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 )
    1755         [ #  # ]:          0 :         aRet = B2UCONST( "Footer" );
    1756 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 )
    1757         [ #  # ]:          0 :         aRet = B2UCONST( "Date/Time" );
    1758 [ #  # ][ #  # ]:          0 :     else if( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 )
    1759         [ #  # ]:          0 :         aRet = B2UCONST( "Slide_Number" );
    1760                 :            :     else
    1761                 :          0 :         aRet = aShapeType;
    1762                 :            :         //aRet = B2UCONST( "Drawing" );
    1763                 :            : 
    1764                 :          0 :     return aRet;
    1765                 :            : }
    1766                 :            : 
    1767                 :            : // -----------------------------------------------------------------------------
    1768                 :            : 
    1769                 :            : //inline
    1770                 :          0 : void SVGFilter::implRegisterInterface( const Reference< XInterface >& rxIf )
    1771                 :            : {
    1772         [ #  # ]:          0 :     if( rxIf.is() )
    1773                 :          0 :         (mpSVGExport->getInterfaceToIdentifierMapper()).registerReference( rxIf );
    1774                 :          0 : }
    1775                 :            : 
    1776                 :            : // -----------------------------------------------------------------------------
    1777                 :            : 
    1778                 :            : //inline
    1779                 :          0 : const ::rtl::OUString & SVGFilter::implGetValidIDFromInterface( const Reference< XInterface >& rxIf )
    1780                 :            : {
    1781                 :          0 :    return (mpSVGExport->getInterfaceToIdentifierMapper()).getIdentifier( rxIf );
    1782                 :            : }
    1783                 :            : 
    1784                 :            : 
    1785                 :            : // -----------------------------------------------------------------------------
    1786                 :            : 
    1787                 :          0 : OUString SVGFilter::implGetInterfaceName( const Reference< XInterface >& rxIf )
    1788                 :            : {
    1789         [ #  # ]:          0 :     Reference< XNamed > xNamed( rxIf, UNO_QUERY );
    1790                 :          0 :     OUString            aRet;
    1791         [ #  # ]:          0 :     if( xNamed.is() )
    1792                 :            :     {
    1793 [ #  # ][ #  # ]:          0 :         aRet = xNamed->getName().replace( ' ', '_' );
    1794                 :            :     }
    1795                 :          0 :     return aRet;
    1796                 :            : }
    1797                 :            : 
    1798                 :            : // -----------------------------------------------------------------------------
    1799                 :            : 
    1800                 :          0 : IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
    1801                 :            : {
    1802                 :          0 :     sal_Bool       bFieldProcessed = sal_False;
    1803 [ #  # ][ #  # ]:          0 :     if( pInfo && mbPresentation )
    1804                 :            :     {
    1805                 :          0 :         bFieldProcessed = true;
    1806         [ #  # ]:          0 :         OUString   aRepresentation = B2UCONST("");
    1807         [ #  # ]:          0 :         if( !mbSinglePage )
    1808                 :            :         {
    1809                 :            :             // to notify to the SVGActionWriter::ImplWriteText method
    1810                 :            :             // that we are dealing with a placeholder shape
    1811                 :          0 :             aRepresentation = sPlaceholderTag;
    1812                 :            : 
    1813         [ #  # ]:          0 :             if( !mCreateOjectsCurrentMasterPage.is() )
    1814                 :            :             {
    1815                 :            :                 OSL_FAIL( "error: !mCreateOjectsCurrentMasterPage.is()" );
    1816                 :          0 :                 return 0;
    1817                 :            :             }
    1818 [ #  # ][ #  # ]:          0 :             sal_Bool bHasCharSetMap = !( mTextFieldCharSets.find( mCreateOjectsCurrentMasterPage ) == mTextFieldCharSets.end() );
    1819                 :            : 
    1820 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString aHeaderId( B2UCONST( aOOOAttrHeaderField ) );
         [ #  # ][ #  # ]
    1821 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString aFooterId( B2UCONST( aOOOAttrFooterField ) );
         [ #  # ][ #  # ]
    1822 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString aDateTimeId( B2UCONST( aOOOAttrDateTimeField ) );
         [ #  # ][ #  # ]
    1823 [ #  # ][ #  # ]:          0 :             static const ::rtl::OUString aVariableDateTimeId( B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1824                 :            : 
    1825                 :          0 :             const UCharSet * pCharSet = NULL;
    1826                 :          0 :             UCharSetMap * pCharSetMap = NULL;
    1827         [ #  # ]:          0 :             if( bHasCharSetMap )
    1828                 :            :             {
    1829         [ #  # ]:          0 :                 pCharSetMap = &( mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ] );
    1830                 :            :             }
    1831                 :          0 :             const SvxFieldData* pField = pInfo->GetField().GetField();
    1832 [ #  # ][ #  # ]:          0 :             if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && ( pCharSetMap->find( aHeaderId ) != pCharSetMap->end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
    1833                 :            :             {
    1834         [ #  # ]:          0 :                 pCharSet = &( (*pCharSetMap)[ aHeaderId ] );
    1835                 :            :             }
    1836 [ #  # ][ #  # ]:          0 :             else if( bHasCharSetMap && ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && ( pCharSetMap->find( aFooterId ) != pCharSetMap->end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1837                 :            :             {
    1838         [ #  # ]:          0 :                 pCharSet = &( (*pCharSetMap)[ aFooterId ] );
    1839                 :            :             }
    1840 [ #  # ][ #  # ]:          0 :             else if( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME )
    1841                 :            :             {
    1842 [ #  # ][ #  # ]:          0 :                 if( bHasCharSetMap && ( pCharSetMap->find( aDateTimeId ) != pCharSetMap->end() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1843                 :            :                 {
    1844         [ #  # ]:          0 :                     pCharSet = &( (*pCharSetMap)[ aDateTimeId ] );
    1845                 :            :                 }
    1846 [ #  # ][ #  # ]:          0 :                 if( bHasCharSetMap && ( pCharSetMap->find( aVariableDateTimeId ) != pCharSetMap->end() ) && !(*pCharSetMap)[ aVariableDateTimeId ].empty() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
    1847                 :            :                 {
    1848                 :          0 :                     SvxDateFormat eDateFormat = SVXDATEFORMAT_B, eCurDateFormat;
    1849         [ #  # ]:          0 :                     const UCharSet & aCharSet = (*pCharSetMap)[ aVariableDateTimeId ];
    1850         [ #  # ]:          0 :                     UCharSet::const_iterator aChar = aCharSet.begin();
    1851                 :            :                     // we look for the most verbose date format
    1852 [ #  # ][ #  # ]:          0 :                     for( ; aChar != aCharSet.end(); ++aChar )
    1853                 :            :                     {
    1854         [ #  # ]:          0 :                         eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f );
    1855      [ #  #  # ]:          0 :                         switch( eDateFormat )
    1856                 :            :                         {
    1857                 :            :                             case SVXDATEFORMAT_STDSMALL: ;
    1858                 :            :                             case SVXDATEFORMAT_A: ;     // 13.02.96
    1859                 :            :                             case SVXDATEFORMAT_B:       // 13.02.1996
    1860         [ #  # ]:          0 :                                 switch( eCurDateFormat )
    1861                 :            :                                 {
    1862                 :            :                                     case SVXDATEFORMAT_C: ;     // 13.Feb 1996
    1863                 :            :                                     case SVXDATEFORMAT_D:       // 13.February 1996
    1864                 :            :                                     case SVXDATEFORMAT_E: ;     // Tue, 13.February 1996
    1865                 :            :                                     case SVXDATEFORMAT_STDBIG: ;
    1866                 :            :                                     case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
    1867                 :          0 :                                         eDateFormat = eCurDateFormat;
    1868                 :          0 :                                         break;
    1869                 :            :                                     default:
    1870                 :          0 :                                         break;
    1871                 :            :                                 }
    1872                 :            :                             case SVXDATEFORMAT_C: ;     // 13.Feb 1996
    1873                 :            :                             case SVXDATEFORMAT_D:       // 13.February 1996
    1874         [ #  # ]:          0 :                                 switch( eCurDateFormat )
    1875                 :            :                                 {
    1876                 :            :                                     case SVXDATEFORMAT_E: ;     // Tue, 13.February 1996
    1877                 :            :                                     case SVXDATEFORMAT_STDBIG: ;
    1878                 :            :                                     case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
    1879                 :          0 :                                         eDateFormat = eCurDateFormat;
    1880                 :          0 :                                         break;
    1881                 :            :                                     default:
    1882                 :          0 :                                         break;
    1883                 :            :                                 }
    1884                 :          0 :                                 break;
    1885                 :            :                             default:
    1886                 :          0 :                                 break;
    1887                 :            :                         }
    1888                 :            :                     }
    1889                 :            :                     // Independently of the date format, we always put all these characters by default.
    1890                 :            :                     // They should be enough to cover every time format.
    1891         [ #  # ]:          0 :                     aRepresentation += B2UCONST( "0123456789.:/-APM" );
    1892                 :            : 
    1893         [ #  # ]:          0 :                     if( eDateFormat )
    1894                 :            :                     {
    1895         [ #  # ]:          0 :                         String sDate;
    1896         [ #  # ]:          0 :                         LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
    1897 [ #  # ][ #  # ]:          0 :                         SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM );
                 [ #  # ]
    1898                 :            :                         // We always collect the characters obtained by using the SVXDATEFORMAT_B (as: 13.02.1996)
    1899                 :            :                         // so we are sure to include any unusual day|month|year separator.
    1900                 :          0 :                         Date aDate( 1, 1, 1996 );
    1901 [ #  # ][ #  # ]:          0 :                         sDate += SvxDateField::GetFormatted( aDate, SVXDATEFORMAT_B, *pNumberFormatter, eLang );
    1902      [ #  #  # ]:          0 :                         switch( eDateFormat )
    1903                 :            :                         {
    1904                 :            :                             case SVXDATEFORMAT_E: ;     // Tue, 13.February 1996
    1905                 :            :                             case SVXDATEFORMAT_STDBIG: ;
    1906                 :            :                             case SVXDATEFORMAT_F:       // Tuesday, 13.February 1996
    1907         [ #  # ]:          0 :                                 for( sal_uInt16 i = 1; i <= 7; ++i )  // we get all days in a week
    1908                 :            :                                 {
    1909         [ #  # ]:          0 :                                     aDate.SetDay( i );
    1910 [ #  # ][ #  # ]:          0 :                                     sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
    1911                 :            :                                 }
    1912                 :            :                                 // No break here! We need months too!
    1913                 :            :                             case SVXDATEFORMAT_C: ;     // 13.Feb 1996
    1914                 :            :                             case SVXDATEFORMAT_D:       // 13.February 1996
    1915         [ #  # ]:          0 :                                 for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
    1916                 :            :                                 {
    1917         [ #  # ]:          0 :                                     aDate.SetMonth( i );
    1918 [ #  # ][ #  # ]:          0 :                                     sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
    1919                 :            :                                 }
    1920                 :          0 :                                 break;
    1921                 :            :                             case SVXDATEFORMAT_STDSMALL: ;
    1922                 :            :                             case SVXDATEFORMAT_A: ;     // 13.02.96
    1923                 :            :                             case SVXDATEFORMAT_B: ;     // 13.02.1996
    1924                 :            :                             default:
    1925                 :            :                                 // nothing to do here, we always collect the characters needed for these cases.
    1926                 :          0 :                                 break;
    1927                 :            :                         }
    1928 [ #  # ][ #  # ]:          0 :                         aRepresentation += sDate;
    1929                 :            :                     }
    1930                 :            :                 }
    1931                 :            :             }
    1932 [ #  # ][ #  # ]:          0 :             else if( pField->GetClassId() == text::textfield::Type::PAGE )
    1933                 :            :             {
    1934   [ #  #  #  #  :          0 :                 switch( mVisiblePagePropSet.nPageNumberingType )
                      # ]
    1935                 :            :                 {
    1936                 :            :                     case SVX_CHARS_UPPER_LETTER:
    1937         [ #  # ]:          0 :                         aRepresentation += B2UCONST( "QWERTYUIOPASDFGHJKLZXCVBNM" );
    1938                 :          0 :                         break;
    1939                 :            :                     case SVX_CHARS_LOWER_LETTER:
    1940         [ #  # ]:          0 :                         aRepresentation += B2UCONST( "qwertyuiopasdfghjklzxcvbnm" );
    1941                 :          0 :                         break;
    1942                 :            :                     case SVX_ROMAN_UPPER:
    1943         [ #  # ]:          0 :                         aRepresentation += B2UCONST( "IVXLCDM" );
    1944                 :          0 :                         break;
    1945                 :            :                     case SVX_ROMAN_LOWER:
    1946         [ #  # ]:          0 :                         aRepresentation += B2UCONST( "ivxlcdm" );
    1947                 :          0 :                         break;
    1948                 :            :                     // arabic numbering type is the default
    1949                 :            :                     case SVX_ARABIC: ;
    1950                 :            :                     // in case the numbering type is not handled we fall back on arabic numbering
    1951                 :            :                     default:
    1952         [ #  # ]:          0 :                         aRepresentation += B2UCONST( "0123456789" );
    1953                 :          0 :                         break;
    1954                 :            :                 }
    1955                 :            :             }
    1956                 :            : 
    1957         [ #  # ]:          0 :             if( pCharSet != NULL )
    1958                 :            :             {
    1959         [ #  # ]:          0 :                 UCharSet::const_iterator aChar = pCharSet->begin();
    1960 [ #  # ][ #  # ]:          0 :                 for( ; aChar != pCharSet->end(); ++aChar )
    1961                 :            :                 {
    1962         [ #  # ]:          0 :                     aRepresentation += OUString::valueOf( *aChar );
    1963                 :            :                 }
    1964                 :            :             }
    1965 [ #  # ][ #  # ]:          0 :             pInfo->SetRepresentation( aRepresentation );
                 [ #  # ]
    1966                 :            :         }
    1967                 :            :         else  // single page case
    1968                 :            :         {
    1969         [ #  # ]:          0 :             if( mVisiblePagePropSet.bAreBackgroundObjectsVisible )
    1970                 :            :             {
    1971                 :          0 :                 const SvxFieldData* pField = pInfo->GetField().GetField();
    1972 [ #  # ][ #  # ]:          0 :                 if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_HEADER ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
         [ #  # ][ #  # ]
    1973                 :            :                 {
    1974                 :          0 :                     aRepresentation += mVisiblePagePropSet.sHeaderText;
    1975                 :            :                 }
    1976 [ #  # ][ #  # ]:          0 :                 else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_FOOTER ) && mVisiblePagePropSet.bIsFooterFieldVisible )
         [ #  # ][ #  # ]
    1977                 :            :                 {
    1978                 :          0 :                     aRepresentation += mVisiblePagePropSet.sFooterText;
    1979                 :            :                 }
    1980 [ #  # ][ #  # ]:          0 :                 else if( ( pField->GetClassId() == text::textfield::Type::PRESENTATION_DATE_TIME ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
         [ #  # ][ #  # ]
    1981                 :            :                 {
    1982                 :            :                     // TODO: implement the variable case
    1983                 :          0 :                     aRepresentation += mVisiblePagePropSet.sDateTimeText;
    1984                 :            :                 }
    1985 [ #  # ][ #  # ]:          0 :                 else if( ( pField->GetClassId() == text::textfield::Type::PAGE ) && mVisiblePagePropSet.bIsPageNumberFieldVisible )
         [ #  # ][ #  # ]
    1986                 :            :                 {
    1987                 :          0 :                     sal_Int16 nPageNumber = mVisiblePagePropSet.nPageNumber;
    1988   [ #  #  #  #  :          0 :                     switch( mVisiblePagePropSet.nPageNumberingType )
                      # ]
    1989                 :            :                     {
    1990                 :            :                         case SVX_CHARS_UPPER_LETTER:
    1991                 :          0 :                             aRepresentation += OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) );
    1992                 :          0 :                             break;
    1993                 :            :                         case SVX_CHARS_LOWER_LETTER:
    1994                 :          0 :                             aRepresentation += OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'a' ) );
    1995                 :          0 :                             break;
    1996                 :            :                         case SVX_ROMAN_UPPER:
    1997 [ #  # ][ #  # ]:          0 :                             aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, true /* upper */ );
                 [ #  # ]
    1998                 :          0 :                             break;
    1999                 :            :                         case SVX_ROMAN_LOWER:
    2000 [ #  # ][ #  # ]:          0 :                             aRepresentation += SvxNumberFormat::CreateRomanString( nPageNumber, false /* lower */ );
                 [ #  # ]
    2001                 :          0 :                             break;
    2002                 :            :                         // arabic numbering type is the default
    2003                 :            :                         case SVX_ARABIC: ;
    2004                 :            :                         // in case the numbering type is not handled we fall back on arabic numbering
    2005                 :            :                         default:
    2006                 :          0 :                             aRepresentation += OUString::valueOf( sal_Int32(nPageNumber) );
    2007                 :          0 :                             break;
    2008                 :            :                     }
    2009                 :            :                 }
    2010                 :            :             }
    2011 [ #  # ][ #  # ]:          0 :             pInfo->SetRepresentation( aRepresentation );
                 [ #  # ]
    2012         [ #  # ]:          0 :         }
    2013                 :            :     }
    2014         [ #  # ]:          0 :     return ( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
    2015 [ +  - ][ +  - ]:         18 : }
    2016                 :            : 
    2017                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10