LCOV - code coverage report
Current view: top level - sd/source/filter/eppt - pptx-epptbase.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 443 0.0 %
Date: 2012-08-25 Functions: 0 25 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 833 0.0 %

           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 2000, 2010 Oracle and/or its affiliates.
       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 "eppt.hxx"
      31                 :            : #include "epptdef.hxx"
      32                 :            : 
      33                 :            : #include <comphelper/extract.hxx>
      34                 :            : #include <tools/globname.hxx>
      35                 :            : #include <tools/datetime.hxx>
      36                 :            : #include <tools/poly.hxx>
      37                 :            : #include <tools/stream.hxx>
      38                 :            : #include <vcl/graph.hxx>
      39                 :            : #include <vcl/bmpacc.hxx>
      40                 :            : #include <vcl/gradient.hxx>
      41                 :            : #include <vcl/virdev.hxx>
      42                 :            : #include <rtl/ustring.hxx>
      43                 :            : #include <rtl/strbuf.hxx>
      44                 :            : #include <svtools/fltcall.hxx>
      45                 :            : #include <svtools/wmf.hxx>
      46                 :            : #include <sfx2/docfile.hxx>
      47                 :            : #include <sfx2/docinf.hxx>
      48                 :            : #include <svx/unoapi.hxx>
      49                 :            : #include <svx/svdobj.hxx>
      50                 :            : #include <svx/svdoole2.hxx>
      51                 :            : #include <svx/svdmodel.hxx>
      52                 :            : #include <svx/svdpage.hxx>
      53                 :            : #include <com/sun/star/view/PaperOrientation.hpp>
      54                 :            : #include <com/sun/star/view/PaperFormat.hpp>
      55                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      56                 :            : #include <com/sun/star/office/XAnnotation.hpp>
      57                 :            : #include <com/sun/star/office/XAnnotationAccess.hpp>
      58                 :            : #include <com/sun/star/office/XAnnotationEnumeration.hpp>
      59                 :            : #include <com/sun/star/geometry/RealPoint2D.hpp>
      60                 :            : #include <com/sun/star/util/DateTime.hpp>
      61                 :            : #include <com/sun/star/animations/TransitionType.hpp>
      62                 :            : #include <com/sun/star/animations/TransitionSubType.hpp>
      63                 :            : #include <com/sun/star/awt/FontDescriptor.hpp>
      64                 :            : #include <com/sun/star/awt/FontFamily.hpp>
      65                 :            : #include <com/sun/star/awt/FontPitch.hpp>
      66                 :            : #include <com/sun/star/container/XNamed.hpp>
      67                 :            : #include <com/sun/star/container/XNameAccess.hpp>
      68                 :            : #include <com/sun/star/presentation/XPresentationPage.hpp>
      69                 :            : #include <com/sun/star/text/XSimpleText.hpp>
      70                 :            : #include <com/sun/star/style/XStyle.hpp>
      71                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      72                 :            : #include <editeng/svxenum.hxx>
      73                 :            : #include <editeng/flditem.hxx>
      74                 :            : #include <sot/storinfo.hxx>
      75                 :            : #include <filter/msfilter/msoleexp.hxx>
      76                 :            : #include <filter/msfilter/msdffimp.hxx>
      77                 :            : #include <filter/msfilter/svxmsbas.hxx>
      78                 :            : 
      79                 :            : #ifdef DEBUG
      80                 :            : #define DBG(x) x
      81                 :            : #include <stdio.h>
      82                 :            : #else
      83                 :            : #define DBG(x)
      84                 :            : #endif
      85                 :            : 
      86                 :            : using namespace com::sun::star;
      87                 :            : 
      88                 :            : using namespace ::com::sun::star::animations;
      89                 :            : using namespace ::com::sun::star::awt::FontFamily;
      90                 :            : using namespace ::com::sun::star::awt::FontPitch;
      91                 :            : using namespace ::com::sun::star::presentation;
      92                 :            : 
      93                 :            : using ::com::sun::star::awt::FontDescriptor;
      94                 :            : using ::com::sun::star::beans::XPropertySet;
      95                 :            : using ::com::sun::star::container::XNameAccess;
      96                 :            : using ::com::sun::star::container::XNamed;
      97                 :            : using ::com::sun::star::drawing::XDrawPagesSupplier;
      98                 :            : using ::com::sun::star::drawing::XMasterPagesSupplier;
      99                 :            : using ::com::sun::star::drawing::XShapes;
     100                 :            : using ::com::sun::star::drawing::XMasterPageTarget;
     101                 :            : using ::com::sun::star::drawing::XDrawPage;
     102                 :            : using ::com::sun::star::frame::XModel;
     103                 :            : using ::com::sun::star::style::XStyleFamiliesSupplier;
     104                 :            : using ::com::sun::star::style::XStyle;
     105                 :            : using ::com::sun::star::task::XStatusIndicator;
     106                 :            : using ::com::sun::star::text::XSimpleText;
     107                 :            : using ::com::sun::star::uno::Any;
     108                 :            : using ::com::sun::star::uno::Exception;
     109                 :            : using ::com::sun::star::uno::Reference;
     110                 :            : using ::com::sun::star::uno::UNO_QUERY;
     111                 :            : 
     112                 :            : static PHLayout pPHLayout[] =
     113                 :            : {
     114                 :            :     { EPP_LAYOUT_TITLESLIDE,            { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, sal_True, sal_True, sal_False },
     115                 :            :     { EPP_LAYOUT_TITLEANDBODYSLIDE,     { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     116                 :            :     { EPP_LAYOUT_TITLEANDBODYSLIDE,     { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     117                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_True, sal_True },
     118                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     119                 :            :     { EPP_LAYOUT_BLANCSLIDE,            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
     120                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     121                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     122                 :            :     { EPP_LAYOUT_TITLEANDBODYSLIDE,     { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, sal_True, sal_False, sal_False },
     123                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     124                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     125                 :            :     { EPP_LAYOUT_TITLEANDBODYSLIDE,     { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
     126                 :            :     { EPP_LAYOUT_RIGHTCOLUMN2ROWS,      { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     127                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     128                 :            :     { EPP_LAYOUT_2ROWSANDTITLE,         { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     129                 :            :     { EPP_LAYOUT_LEFTCOLUMN2ROWS,       { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     130                 :            :     { EPP_LAYOUT_TOPROW2COLUMN,         { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     131                 :            :     { EPP_LAYOUT_2ROWSANDTITLE,         { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_True, sal_False },
     132                 :            :     { EPP_LAYOUT_4OBJECTS,              { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, sal_True, sal_False, sal_False },
     133                 :            :     { EPP_LAYOUT_ONLYTITLE,             { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_True, sal_False, sal_False },
     134                 :            :     { EPP_LAYOUT_BLANCSLIDE,            { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, sal_False, sal_False, sal_False },
     135                 :            :     { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, sal_True, sal_True, sal_False },
     136                 :            :     { EPP_LAYOUT_TITLERIGHTBODYLEFT,    { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, sal_True, sal_True, sal_False },
     137                 :            :     { EPP_LAYOUT_TITLEANDBODYSLIDE,     { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, sal_True, sal_True, sal_False },
     138                 :            :     { EPP_LAYOUT_2COLUMNSANDTITLE,      { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, sal_True, sal_True, sal_False }
     139                 :            : };
     140                 :            : 
     141                 :            : #define PPT_WRITER_BASE_INIT_VALUES \
     142                 :            :     maFraction              ( 1, 576 ), \
     143                 :            :     maMapModeSrc            ( MAP_100TH_MM ), \
     144                 :            :     maMapModeDest           ( MAP_INCH, Point(), maFraction, maFraction ), \
     145                 :            :     meLatestPageType        ( NORMAL )
     146                 :            : 
     147                 :          0 : PPTWriterBase::PPTWriterBase() :
     148 [ #  # ][ #  # ]:          0 :     PPT_WRITER_BASE_INIT_VALUES
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     149                 :            : {
     150                 :            :     DBG(printf ("PPTWriterBase::PPTWriterBase()\n"));
     151                 :          0 : }
     152                 :            : 
     153                 :          0 : PPTWriterBase::PPTWriterBase( const Reference< XModel > & rXModel,
     154                 :            :                               const Reference< XStatusIndicator > & rXStatInd ) :
     155                 :            :     mXModel                 ( rXModel ),
     156                 :            :     mXStatusIndicator       ( rXStatInd ),
     157                 :            :     mbStatusIndicator       ( false ),
     158 [ #  # ][ #  # ]:          0 :     PPT_WRITER_BASE_INIT_VALUES
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     159                 :            : {
     160                 :          0 : }
     161                 :            : 
     162                 :            : // ---------------------------------------------------------------------------------------------
     163                 :            : 
     164 [ #  # ][ #  # ]:          0 : PPTWriterBase::~PPTWriterBase()
         [ #  # ][ #  # ]
     165                 :            : {
     166                 :            :     // Possibly unnecessary sanity check for mXStatusIndicator.is().
     167                 :            :     // In 3.3 we had a bug report of a crash where it was null,
     168                 :            :     // https://bugzilla.novell.com/show_bug.cgi?id=694119 (non-public,
     169                 :            :     // bug report, sorry).
     170 [ #  # ][ #  # ]:          0 :     if ( mbStatusIndicator && mXStatusIndicator.is() )
                 [ #  # ]
     171 [ #  # ][ #  # ]:          0 :         mXStatusIndicator->end();
     172         [ #  # ]:          0 : }
     173                 :            : 
     174                 :            : // ---------------------------------------------------------------------------------------------
     175                 :            : 
     176                 :          0 : void PPTWriterBase::exportPPT( const std::vector< com::sun::star::beans::PropertyValue >& rMediaData )
     177                 :            : {
     178 [ #  # ][ #  # ]:          0 :     if ( !InitSOIface() )
     179                 :            :         return;
     180                 :            : 
     181                 :            :     FontCollectionEntry aDefaultFontDesc( rtl::OUString( "Times New Roman" ),
     182                 :            :                                           ROMAN,
     183                 :            :                                           awt::FontPitch::VARIABLE,
     184 [ #  # ][ #  # ]:          0 :                                                     RTL_TEXTENCODING_MS_1252 );
                 [ #  # ]
     185         [ #  # ]:          0 :     maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman
     186                 :            : 
     187 [ #  # ][ #  # ]:          0 :     if ( !GetPageByIndex( 0, NOTICE ) )
     188                 :            :         return;
     189                 :            : 
     190                 :          0 :     sal_Int32 nWidth = 21000;
     191 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( mXPagePropSet, rtl::OUString(  "Width" ) ) )
         [ #  # ][ #  # ]
     192                 :          0 :         mAny >>= nWidth;
     193                 :          0 :     sal_Int32 nHeight = 29700;
     194 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "Height" ) ) )
         [ #  # ][ #  # ]
     195                 :          0 :         mAny >>= nHeight;
     196                 :            : 
     197         [ #  # ]:          0 :     maNotesPageSize = MapSize( awt::Size( nWidth, nHeight ) );
     198                 :            : 
     199 [ #  # ][ #  # ]:          0 :     if ( !GetPageByIndex( 0, MASTER ) )
     200                 :            :         return;
     201                 :            : 
     202                 :          0 :     nWidth = 28000;
     203 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "Width" ) ) )
         [ #  # ][ #  # ]
     204                 :          0 :         mAny >>= nWidth;
     205                 :          0 :     nHeight = 21000;
     206 [ #  # ][ #  # ]:          0 :     if ( ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "Height" ) ) )
         [ #  # ][ #  # ]
     207                 :          0 :         mAny >>= nHeight;
     208         [ #  # ]:          0 :     maDestPageSize = MapSize( awt::Size( nWidth, nHeight ) );
     209                 :            : 
     210                 :            :     DBG(printf( "call exportDocumentPre()\n"));
     211         [ #  # ]:          0 :     exportPPTPre(rMediaData);
     212                 :            : 
     213 [ #  # ][ #  # ]:          0 :     if ( !GetStyleSheets() )
     214                 :            :         return;
     215                 :            : 
     216 [ #  # ][ #  # ]:          0 :     if ( !ImplCreateDocument() )
     217                 :            :          return;
     218                 :            : 
     219                 :            :     sal_uInt32 i;
     220                 :            : 
     221         [ #  # ]:          0 :     for ( i = 0; i < mnPages; i++ )
     222                 :            :     {
     223 [ #  # ][ #  # ]:          0 :     if ( GetPageByIndex( i, NORMAL ) ) {
     224         [ #  # ]:          0 :         sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
     225 [ #  # ][ #  # ]:          0 :         ImplWriteLayout( GetLayoutOffset( mXPagePropSet ), nMasterNum );
     226                 :            :     }
     227                 :            :     }
     228                 :            : 
     229         [ #  # ]:          0 :     for ( i = 0; i < mnMasterPages; i++ )
     230                 :            :     {
     231 [ #  # ][ #  # ]:          0 :         if ( !CreateSlideMaster( i ) )
     232                 :            :             return;
     233                 :            :     }
     234 [ #  # ][ #  # ]:          0 :     if ( !CreateMainNotes() )
     235                 :            :         return;
     236                 :            : 
     237         [ #  # ]:          0 :     for ( i = 0; i < mnPages; i++ )
     238                 :            :     {
     239                 :            :         DBG(printf( "call ImplCreateSlide( %" SAL_PRIuUINT32 " )\n", i));
     240 [ #  # ][ #  # ]:          0 :         if ( !CreateSlide( i ) )
     241                 :            :             return;
     242                 :            :     }
     243                 :            : 
     244         [ #  # ]:          0 :     for ( i = 0; i < mnPages; i++ )
     245                 :            :     {
     246 [ #  # ][ #  # ]:          0 :         if ( !CreateNotes( i ) )
     247                 :            :             return;
     248                 :            :     }
     249                 :            : 
     250                 :            :     DBG(printf( "call exportDocumentPost()\n"));
     251 [ #  # ][ #  # ]:          0 :     exportPPTPost();
                 [ #  # ]
     252                 :            : }
     253                 :            : 
     254                 :            : // ---------------------------------------------------------------------------------------------
     255                 :            : 
     256                 :          0 : sal_Bool PPTWriterBase::InitSOIface()
     257                 :            : {
     258                 :            :     while( sal_True )
     259                 :            :     {
     260         [ #  # ]:          0 :         mXDrawPagesSupplier = Reference< XDrawPagesSupplier >( mXModel, UNO_QUERY );
     261         [ #  # ]:          0 :         if ( !mXDrawPagesSupplier.is() )
     262                 :          0 :             break;
     263                 :            : 
     264         [ #  # ]:          0 :         mXMasterPagesSupplier = Reference< XMasterPagesSupplier >( mXModel, UNO_QUERY );
     265         [ #  # ]:          0 :         if ( !mXMasterPagesSupplier.is() )
     266                 :          0 :             break;
     267         [ #  # ]:          0 :         mXDrawPages = mXMasterPagesSupplier->getMasterPages();
     268         [ #  # ]:          0 :         if ( !mXDrawPages.is() )
     269                 :          0 :             break;
     270                 :          0 :         mnMasterPages = mXDrawPages->getCount();
     271         [ #  # ]:          0 :         mXDrawPages = mXDrawPagesSupplier->getDrawPages();
     272         [ #  # ]:          0 :         if( !mXDrawPages.is() )
     273                 :          0 :             break;
     274                 :          0 :         mnPages =  mXDrawPages->getCount();
     275         [ #  # ]:          0 :         if ( !GetPageByIndex( 0, NORMAL ) )
     276                 :          0 :             break;
     277                 :            : 
     278                 :          0 :         return sal_True;
     279                 :            :     }
     280                 :          0 :     return sal_False;
     281                 :            : }
     282                 :            : 
     283                 :            : // ---------------------------------------------------------------------------------------------
     284                 :            : 
     285                 :          0 : sal_Bool PPTWriterBase::GetPageByIndex( sal_uInt32 nIndex, PageType ePageType )
     286                 :            : {
     287                 :            :     while( sal_True )
     288                 :            :     {
     289         [ #  # ]:          0 :         if ( ePageType != meLatestPageType )
     290                 :            :         {
     291      [ #  #  # ]:          0 :             switch( ePageType )
     292                 :            :             {
     293                 :            :                 case NORMAL :
     294                 :            :                 case NOTICE :
     295                 :            :                 {
     296 [ #  # ][ #  # ]:          0 :                     mXDrawPages = mXDrawPagesSupplier->getDrawPages();
                 [ #  # ]
     297         [ #  # ]:          0 :                     if( !mXDrawPages.is() )
     298                 :          0 :                         return sal_False;
     299                 :            :                 }
     300                 :          0 :                 break;
     301                 :            : 
     302                 :            :                 case MASTER :
     303                 :            :                 {
     304 [ #  # ][ #  # ]:          0 :                     mXDrawPages = mXMasterPagesSupplier->getMasterPages();
                 [ #  # ]
     305         [ #  # ]:          0 :                     if( !mXDrawPages.is() )
     306                 :          0 :                         return sal_False;
     307                 :            :                 }
     308                 :          0 :                 break;
     309                 :            :                 default:
     310                 :          0 :                     break;
     311                 :            :             }
     312                 :          0 :             meLatestPageType = ePageType;
     313                 :            :         }
     314 [ #  # ][ #  # ]:          0 :         Any aAny( mXDrawPages->getByIndex( nIndex ) );
     315         [ #  # ]:          0 :         aAny >>= mXDrawPage;
     316         [ #  # ]:          0 :         if ( !mXDrawPage.is() )
     317                 :            :             break;
     318         [ #  # ]:          0 :         if ( ePageType == NOTICE )
     319                 :            :         {
     320         [ #  # ]:          0 :             Reference< XPresentationPage > aXPresentationPage( mXDrawPage, UNO_QUERY );
     321         [ #  # ]:          0 :             if ( !aXPresentationPage.is() )
     322                 :            :                 break;
     323 [ #  # ][ #  # ]:          0 :             mXDrawPage = aXPresentationPage->getNotesPage();
                 [ #  # ]
     324         [ #  # ]:          0 :             if ( !mXDrawPage.is() )
     325         [ #  # ]:          0 :                 break;
     326                 :            :         }
     327 [ #  # ][ #  # ]:          0 :         mXPagePropSet = Reference< XPropertySet >( mXDrawPage, UNO_QUERY );
     328         [ #  # ]:          0 :         if ( !mXPagePropSet.is() )
     329                 :            :             break;
     330                 :            : 
     331 [ #  # ][ #  # ]:          0 :         mXShapes = Reference< XShapes >( mXDrawPage, UNO_QUERY );
     332         [ #  # ]:          0 :         if ( !mXShapes.is() )
     333                 :            :             break;
     334                 :            : 
     335                 :            :         /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is
     336                 :            :            taken the property from the master */
     337 [ #  # ][ #  # ]:          0 :         sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Background" ), sal_True );
                 [ #  # ]
     338         [ #  # ]:          0 :         if ( bHasBackground )
     339         [ #  # ]:          0 :             bHasBackground = ( aAny >>= mXBackgroundPropSet );
     340         [ #  # ]:          0 :         if ( !bHasBackground )
     341                 :            :         {
     342         [ #  # ]:          0 :             Reference< XMasterPageTarget > aXMasterPageTarget( mXDrawPage, UNO_QUERY );
     343         [ #  # ]:          0 :             if ( aXMasterPageTarget.is() )
     344                 :            :             {
     345                 :          0 :                 Reference< XDrawPage > aXMasterDrawPage;
     346 [ #  # ][ #  # ]:          0 :                 aXMasterDrawPage = aXMasterPageTarget->getMasterPage();
                 [ #  # ]
     347         [ #  # ]:          0 :                 if ( aXMasterDrawPage.is() )
     348                 :            :                 {
     349                 :          0 :                     Reference< XPropertySet > aXMasterPagePropSet;
     350                 :            :                     aXMasterPagePropSet = Reference< XPropertySet >
     351 [ #  # ][ #  # ]:          0 :                         ( aXMasterDrawPage, UNO_QUERY );
     352         [ #  # ]:          0 :                     if ( aXMasterPagePropSet.is() )
     353                 :            :                     {
     354 [ #  # ][ #  # ]:          0 :                         sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet, rtl::OUString( "Background" ) );
                 [ #  # ]
     355         [ #  # ]:          0 :                         if ( bBackground )
     356                 :            :                         {
     357         [ #  # ]:          0 :                             aAny >>= mXBackgroundPropSet;
     358                 :            :                         }
     359                 :          0 :                     }
     360                 :          0 :                 }
     361                 :          0 :             }
     362                 :            :         }
     363         [ #  # ]:          0 :         return sal_True;
     364                 :          0 :     }
     365                 :          0 :     return sal_False;
     366                 :            : }
     367                 :            : 
     368                 :            : // ---------------------------------------------------------------------------------------------
     369                 :            : 
     370                 :          0 : sal_Bool PPTWriterBase::CreateSlide( sal_uInt32 nPageNum )
     371                 :            : {
     372                 :          0 :     Any aAny;
     373                 :            : 
     374 [ #  # ][ #  # ]:          0 :     if ( !GetPageByIndex( nPageNum, NORMAL ) )
     375                 :          0 :         return sal_False;
     376                 :            : 
     377         [ #  # ]:          0 :     sal_uInt32 nMasterNum = GetMasterIndex( NORMAL );
     378         [ #  # ]:          0 :     SetCurrentStyleSheet( nMasterNum );
     379                 :            : 
     380                 :          0 :     Reference< XPropertySet > aXBackgroundPropSet;
     381 [ #  # ][ #  # ]:          0 :     sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "Background" ) );
                 [ #  # ]
     382         [ #  # ]:          0 :     if ( bHasBackground )
     383         [ #  # ]:          0 :         bHasBackground = ( aAny >>= aXBackgroundPropSet );
     384                 :            : 
     385                 :          0 :     sal_uInt16 nMode = 7;   // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background
     386         [ #  # ]:          0 :     if ( bHasBackground )
     387                 :          0 :         nMode &=~4;
     388                 :            : 
     389                 :            : /* sj: Don't know what's IsBackgroundVisible for, have to ask cl
     390                 :            :     if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) )
     391                 :            :     {
     392                 :            :         sal_Bool bBackgroundVisible;
     393                 :            :         if ( aAny >>= bBackgroundVisible )
     394                 :            :         {
     395                 :            :             if ( bBackgroundVisible )
     396                 :            :                 nMode &= ~4;
     397                 :            :         }
     398                 :            :     }
     399                 :            : */
     400 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, mXPagePropSet, rtl::OUString( "IsBackgroundObjectsVisible" ) ) )
         [ #  # ][ #  # ]
     401                 :            :     {
     402                 :          0 :         sal_Bool bBackgroundObjectsVisible = sal_False;
     403         [ #  # ]:          0 :         if ( aAny >>= bBackgroundObjectsVisible )
     404                 :            :         {
     405         [ #  # ]:          0 :             if ( !bBackgroundObjectsVisible )
     406                 :          0 :                 nMode &= ~1;
     407                 :            :         }
     408                 :            :     }
     409                 :            : 
     410         [ #  # ]:          0 :     ImplWriteSlide( nPageNum, nMasterNum, nMode, bHasBackground, aXBackgroundPropSet );
     411                 :            : 
     412                 :          0 :     return sal_True;
     413                 :            : };
     414                 :            : 
     415                 :            : // ---------------------------------------------------------------------------------------------
     416                 :            : 
     417                 :          0 : sal_Bool PPTWriterBase::CreateNotes( sal_uInt32 nPageNum )
     418                 :            : {
     419         [ #  # ]:          0 :     if ( !GetPageByIndex( nPageNum, NOTICE ) )
     420                 :          0 :         return sal_False;
     421                 :          0 :     SetCurrentStyleSheet( GetMasterIndex( NORMAL ) );
     422                 :            : 
     423                 :          0 :     ImplWriteNotes( nPageNum );
     424                 :            : 
     425                 :          0 :     return sal_True;
     426                 :            : };
     427                 :            : 
     428                 :            : // ---------------------------------------------------------------------------------------------
     429                 :            : 
     430                 :          0 : sal_Bool PPTWriterBase::CreateSlideMaster( sal_uInt32 nPageNum )
     431                 :            : {
     432 [ #  # ][ #  # ]:          0 :     if ( !GetPageByIndex( nPageNum, MASTER ) )
     433                 :          0 :         return sal_False;
     434         [ #  # ]:          0 :     SetCurrentStyleSheet( nPageNum );
     435                 :            : 
     436 [ #  # ][ #  # ]:          0 :     if ( !ImplGetPropertyValue( mXPagePropSet, rtl::OUString( "Background" ) ) )                // Backgroundshape laden
         [ #  # ][ #  # ]
     437                 :          0 :         return sal_False;
     438                 :          0 :     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet;
     439 [ #  # ][ #  # ]:          0 :     if ( !( mAny >>= aXBackgroundPropSet ) )
     440                 :          0 :         return sal_False;
     441                 :            : 
     442         [ #  # ]:          0 :     ImplWriteSlideMaster( nPageNum, aXBackgroundPropSet );
     443                 :            : 
     444                 :          0 :     return sal_True;
     445                 :            : };
     446                 :            : 
     447                 :            : // ---------------------------------------------------------------------------------------------
     448                 :            : 
     449                 :          0 : sal_Int32 PPTWriterBase::GetLayoutOffset( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
     450                 :            : {
     451                 :          0 :     ::com::sun::star::uno::Any aAny;
     452                 :          0 :     sal_Int32 nLayout = 20;
     453 [ #  # ][ #  # ]:          0 :     if ( GetPropertyValue( aAny, rXPropSet, rtl::OUString( "Layout" ) ), sal_True )
         [ #  # ][ #  # ]
     454                 :          0 :         aAny >>= nLayout;
     455                 :            : 
     456                 :            :     DBG(printf("GetLayoutOffset %" SAL_PRIdINT32 "\n", nLayout));
     457                 :            : 
     458                 :          0 :     return nLayout;
     459                 :            : }
     460                 :            : 
     461                 :          0 : sal_Int32 PPTWriterBase::GetLayoutOffsetFixed( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
     462                 :            : {
     463                 :          0 :     sal_Int32 nLayout = GetLayoutOffset( rXPropSet );
     464                 :            : 
     465 [ #  # ][ #  # ]:          0 :     if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) )   // NOTES _> HANDOUT6
     466                 :          0 :         nLayout = 20;
     467 [ #  # ][ #  # ]:          0 :     if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) )   // VERTICAL LAYOUT
     468                 :          0 :         nLayout -= 6;
     469         [ #  # ]:          0 :     else if ( nLayout > 30 )
     470                 :          0 :         nLayout = 20;
     471                 :            : 
     472                 :          0 :     return nLayout;
     473                 :            : }
     474                 :            : 
     475                 :          0 : PHLayout& PPTWriterBase::GetLayout(  const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const
     476                 :            : {
     477                 :          0 :     return pPHLayout[ GetLayoutOffsetFixed( rXPropSet ) ];
     478                 :            : }
     479                 :            : 
     480                 :            : // ---------------------------------------------------------------------------------------------
     481                 :            : 
     482                 :          0 : PHLayout& PPTWriterBase::GetLayout( sal_Int32 nOffset ) const
     483                 :            : {
     484 [ #  # ][ #  # ]:          0 :     if( nOffset >= 0 && nOffset < EPP_LAYOUT_SIZE )
     485                 :          0 :         return pPHLayout[ nOffset ];
     486                 :            : 
     487                 :            :     DBG(printf("asked %" SAL_PRIdINT32 " for layout outside of 0,%d array scope\n", nOffset, EPP_LAYOUT_SIZE ));
     488                 :            : 
     489                 :          0 :     return pPHLayout[ 0 ];
     490                 :            : }
     491                 :            : 
     492                 :            : // ---------------------------------------------------------------------------------------------
     493                 :            : 
     494                 :          0 : sal_uInt32 PPTWriterBase::GetMasterIndex( PageType ePageType )
     495                 :            : {
     496                 :          0 :     sal_uInt32 nRetValue = 0;
     497                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
     498         [ #  # ]:          0 :         aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
     499                 :            : 
     500         [ #  # ]:          0 :     if ( aXMasterPageTarget.is() )
     501                 :            :     {
     502                 :            :         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
     503 [ #  # ][ #  # ]:          0 :             aXDrawPage = aXMasterPageTarget->getMasterPage();
     504         [ #  # ]:          0 :         if ( aXDrawPage.is() )
     505                 :            :         {
     506                 :            :             ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     507         [ #  # ]:          0 :                 aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY );
     508                 :            : 
     509         [ #  # ]:          0 :             if ( aXPropertySet.is() )
     510                 :            :             {
     511 [ #  # ][ #  # ]:          0 :                 if ( ImplGetPropertyValue( aXPropertySet, rtl::OUString( "Number" ) ) )
         [ #  # ][ #  # ]
     512                 :          0 :                     nRetValue |= *(sal_Int16*)mAny.getValue();
     513         [ #  # ]:          0 :                 if ( nRetValue & 0xffff )           // ueberlauf vermeiden
     514                 :          0 :                     nRetValue--;
     515                 :          0 :             }
     516                 :          0 :         }
     517                 :            :     }
     518         [ #  # ]:          0 :     if ( ePageType == NOTICE )
     519                 :          0 :         nRetValue += mnMasterPages;
     520                 :          0 :     return nRetValue;
     521                 :            : }
     522                 :            : 
     523                 :            : //  -----------------------------------------------------------------------
     524                 :            : 
     525                 :          0 : sal_Bool PPTWriterBase::SetCurrentStyleSheet( sal_uInt32 nPageNum )
     526                 :            : {
     527                 :          0 :     sal_Bool bRet = sal_False;
     528         [ #  # ]:          0 :     if ( nPageNum >= maStyleSheetList.size() )
     529                 :          0 :         nPageNum = 0;
     530                 :            :     else
     531                 :          0 :         bRet = sal_True;
     532                 :          0 :     mpStyleSheet = maStyleSheetList[ nPageNum ];
     533                 :          0 :     return bRet;
     534                 :            : }
     535                 :            : 
     536                 :            : // ---------------------------------------------------------------------------------------------
     537                 :            : 
     538                 :          0 : sal_Bool PPTWriterBase::GetStyleSheets()
     539                 :            : {
     540                 :            :     int             nInstance, nLevel;
     541                 :          0 :     sal_Bool        bRetValue = sal_False;
     542                 :            :     sal_uInt32      nPageNum;
     543                 :            : 
     544         [ #  # ]:          0 :     for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ )
     545                 :            :     {
     546                 :            :         Reference< XNamed >
     547                 :          0 :             aXNamed;
     548                 :            : 
     549                 :            :         Reference< XNameAccess >
     550                 :          0 :             aXNameAccess;
     551                 :            : 
     552                 :            :         Reference< XStyleFamiliesSupplier >
     553         [ #  # ]:          0 :             aXStyleFamiliesSupplier( mXModel, UNO_QUERY );
     554                 :            : 
     555                 :            :         Reference< XPropertySet >
     556         [ #  # ]:          0 :             aXPropSet( mXModel, UNO_QUERY );
     557                 :            : 
     558 [ #  # ][ #  # ]:          0 :         sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, rtl::OUString( "TabStop" ) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
     559                 :          0 :             ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 )
     560 [ #  # ][ #  # ]:          0 :             : 1250;
     561                 :            : 
     562 [ #  # ][ #  # ]:          0 :         maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) );
                 [ #  # ]
     563         [ #  # ]:          0 :         SetCurrentStyleSheet( nPageNum );
     564 [ #  # ][ #  # ]:          0 :         if ( GetPageByIndex( nPageNum, MASTER ) )
     565                 :            :             aXNamed = Reference< XNamed >
     566 [ #  # ][ #  # ]:          0 :                         ( mXDrawPage, UNO_QUERY );
     567                 :            : 
     568         [ #  # ]:          0 :         if ( aXStyleFamiliesSupplier.is() )
     569 [ #  # ][ #  # ]:          0 :             aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies();
                 [ #  # ]
     570                 :            : 
     571 [ #  # ][ #  # ]:          0 :         bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is();
                 [ #  # ]
     572         [ #  # ]:          0 :         if  ( bRetValue )
     573                 :            :         {
     574         [ #  # ]:          0 :             for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ )
     575                 :            :             {
     576         [ #  # ]:          0 :                 String aStyle;
     577         [ #  # ]:          0 :                 String aFamily;
     578   [ #  #  #  #  :          0 :                 switch ( nInstance )
                      # ]
     579                 :            :                 {
     580                 :            :                     case EPP_TEXTTYPE_CenterTitle :
     581                 :            :                     case EPP_TEXTTYPE_Title :
     582                 :            :                     {
     583         [ #  # ]:          0 :                         aStyle = rtl::OUString( "title" );
     584 [ #  # ][ #  # ]:          0 :                         aFamily = aXNamed->getName();
                 [ #  # ]
     585                 :            :                     }
     586                 :          0 :                     break;
     587                 :            :                     case EPP_TEXTTYPE_Body :
     588                 :            :                     {
     589         [ #  # ]:          0 :                         aStyle = rtl::OUString( "outline1" );      // SD_LT_SEPARATOR
     590 [ #  # ][ #  # ]:          0 :                         aFamily = aXNamed->getName();
                 [ #  # ]
     591                 :            :                     }
     592                 :          0 :                     break;
     593                 :            :                     case EPP_TEXTTYPE_Other :
     594                 :            :                     {
     595         [ #  # ]:          0 :                         aStyle = rtl::OUString( "standard" );
     596         [ #  # ]:          0 :                         aFamily = rtl::OUString( "graphics" );
     597                 :            :                     }
     598                 :          0 :                     break;
     599                 :            :                     case EPP_TEXTTYPE_CenterBody :
     600                 :            :                     {
     601         [ #  # ]:          0 :                         aStyle = rtl::OUString( "subtitle" );
     602 [ #  # ][ #  # ]:          0 :                         aFamily = aXNamed->getName();
                 [ #  # ]
     603                 :            :                     }
     604                 :          0 :                     break;
     605                 :            :                 }
     606 [ #  # ][ #  # ]:          0 :                 if ( aStyle.Len() && aFamily.Len() )
                 [ #  # ]
     607                 :            :                 {
     608                 :            :                     try
     609                 :            :                     {
     610                 :          0 :                         Reference< XNameAccess >xNameAccess;
     611 [ #  # ][ #  # ]:          0 :                         if ( aXNameAccess->hasByName( aFamily ) )
         [ #  # ][ #  # ]
     612                 :            :                         {
     613 [ #  # ][ #  # ]:          0 :                             Any aAny( aXNameAccess->getByName( aFamily ) );
                 [ #  # ]
     614 [ #  # ][ #  # ]:          0 :                             if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) )
         [ #  # ][ #  # ]
     615                 :            :                             {
     616                 :          0 :                                 Reference< XNameAccess > aXFamily;
     617 [ #  # ][ #  # ]:          0 :                                 if ( aAny >>= aXFamily )
     618                 :            :                                 {
     619 [ #  # ][ #  # ]:          0 :                                     if ( aXFamily->hasByName( aStyle ) )
         [ #  # ][ #  # ]
     620                 :            :                                     {
     621                 :          0 :                                         Reference< XStyle > xStyle;
     622 [ #  # ][ #  # ]:          0 :                                         aAny = aXFamily->getByName( aStyle );
                 [ #  # ]
     623 [ #  # ][ #  # ]:          0 :                                         if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) )
         [ #  # ][ #  # ]
     624                 :            :                                         {
     625                 :          0 :                                             Reference< XStyle > aXStyle;
     626         [ #  # ]:          0 :                                             aAny >>= aXStyle;
     627                 :            :                                             Reference< XPropertySet >
     628         [ #  # ]:          0 :                                                 xPropSet( aXStyle, UNO_QUERY );
     629         [ #  # ]:          0 :                                             if( xPropSet.is() )
     630         [ #  # ]:          0 :                                                 mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 );
     631         [ #  # ]:          0 :                                             for ( nLevel = 1; nLevel < 5; nLevel++ )
     632                 :            :                                             {
     633         [ #  # ]:          0 :                                                 if ( nInstance == EPP_TEXTTYPE_Body )
     634                 :            :                                                 {
     635                 :          0 :                                                     sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 );
     636         [ #  # ]:          0 :                                                     aStyle.SetChar( aStyle.Len() - 1, ++cTemp );
     637 [ #  # ][ #  # ]:          0 :                                                     if ( aXFamily->hasByName( aStyle ) )
         [ #  # ][ #  # ]
     638                 :            :                                                     {
     639 [ #  # ][ #  # ]:          0 :                                                         aXFamily->getByName( aStyle ) >>= xStyle;
         [ #  # ][ #  # ]
     640         [ #  # ]:          0 :                                                         if( xStyle.is() )
     641                 :            :                                                         {
     642                 :            :                                                             Reference< XPropertySet >
     643         [ #  # ]:          0 :                                                                 xPropertySet( xStyle, UNO_QUERY );
     644         [ #  # ]:          0 :                                                             if ( xPropertySet.is() )
     645         [ #  # ]:          0 :                                                                 mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel );
     646                 :            :                                                         }
     647                 :            :                                                     }
     648                 :            :                                                 }
     649                 :            :                                                 else
     650         [ #  # ]:          0 :                                                     mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel );
     651                 :          0 :                                             }
     652                 :          0 :                                         }
     653                 :            :                                     }
     654                 :          0 :                                 }
     655                 :          0 :                             }
     656         [ #  # ]:          0 :                         }
     657                 :            :                     }
     658         [ #  # ]:          0 :                     catch( Exception& )
     659                 :            :                     {
     660                 :            :                     //
     661                 :            :                     }
     662                 :            :                 }
     663 [ #  # ][ #  # ]:          0 :             }
     664         [ #  # ]:          0 :             for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ )
     665                 :            :             {
     666                 :            : 
     667                 :            :             }
     668                 :            :         }
     669                 :          0 :     }
     670                 :          0 :     return bRetValue;
     671                 :            : }
     672                 :            : 
     673                 :            : //  -----------------------------------------------------------------------
     674                 :            : 
     675                 :          0 : sal_Bool PPTWriterBase::CreateMainNotes()
     676                 :            : {
     677 [ #  # ][ #  # ]:          0 :     if ( !GetPageByIndex( 0, NOTICE ) )
     678                 :          0 :         return sal_False;
     679         [ #  # ]:          0 :     SetCurrentStyleSheet( 0 );
     680                 :            : 
     681                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget >
     682         [ #  # ]:          0 :         aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
     683                 :            : 
     684         [ #  # ]:          0 :     if ( !aXMasterPageTarget.is() )
     685                 :          0 :         return sal_False;
     686                 :            : 
     687 [ #  # ][ #  # ]:          0 :     mXDrawPage = aXMasterPageTarget->getMasterPage();
                 [ #  # ]
     688         [ #  # ]:          0 :     if ( !mXDrawPage.is() )
     689                 :          0 :         return sal_False;
     690                 :            : 
     691                 :            :     mXPropSet = ::com::sun::star::uno::Reference<
     692                 :            :         ::com::sun::star::beans::XPropertySet >
     693 [ #  # ][ #  # ]:          0 :             ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
     694         [ #  # ]:          0 :     if ( !mXPropSet.is() )
     695                 :          0 :         return sal_False;
     696                 :            : 
     697                 :            :     mXShapes = ::com::sun::star::uno::Reference<
     698                 :            :         ::com::sun::star::drawing::XShapes >
     699 [ #  # ][ #  # ]:          0 :             ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY );
     700         [ #  # ]:          0 :     if ( !mXShapes.is() )
     701                 :          0 :         return sal_False;
     702                 :            : 
     703         [ #  # ]:          0 :     return ImplCreateMainNotes();
     704                 :            : }
     705                 :            : 
     706                 :            : //  -----------------------------------------------------------------------
     707                 :            : 
     708                 :          0 : awt::Size PPTWriterBase::MapSize( const awt::Size& rSize )
     709                 :            : {
     710         [ #  # ]:          0 :     Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) );
     711                 :            : 
     712         [ #  # ]:          0 :     if ( !aRetSize.Width() )
     713                 :          0 :         aRetSize.Width()++;
     714         [ #  # ]:          0 :     if ( !aRetSize.Height() )
     715                 :          0 :         aRetSize.Height()++;
     716                 :          0 :     return awt::Size( aRetSize.Width(), aRetSize.Height() );
     717                 :            : }
     718                 :            : 
     719                 :            : //  -----------------------------------------------------------------------
     720                 :            : 
     721                 :          0 : awt::Point PPTWriterBase::MapPoint( const awt::Point& rPoint )
     722                 :            : {
     723         [ #  # ]:          0 :     Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) );
     724                 :          0 :     return awt::Point( aRet.X(), aRet.Y() );
     725                 :            : }
     726                 :            : 
     727                 :            : //  -----------------------------------------------------------------------
     728                 :            : 
     729                 :          0 : Rectangle PPTWriterBase::MapRectangle( const awt::Rectangle& rRect )
     730                 :            : {
     731                 :          0 :     ::com::sun::star::awt::Point    aPoint( rRect.X, rRect.Y );
     732                 :          0 :     ::com::sun::star::awt::Size     aSize( rRect.Width, rRect.Height );
     733         [ #  # ]:          0 :     ::com::sun::star::awt::Point    aP( MapPoint( aPoint ) );
     734         [ #  # ]:          0 :     ::com::sun::star::awt::Size     aS( MapSize( aSize ) );
     735         [ #  # ]:          0 :     return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) );
     736                 :            : }
     737                 :            : 
     738                 :            : //  -----------------------------------------------------------------------
     739                 :            : 
     740                 :          0 : sal_Bool PPTWriterBase::GetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup )
     741                 :            : {
     742                 :            :     while(sal_True)
     743                 :            :     {
     744 [ #  # ][ #  # ]:          0 :         if (  ( bGroup == sal_False ) || ( GetCurrentGroupLevel() == 0 ) )
                 [ #  # ]
     745                 :            :         {
     746 [ #  # ][ #  # ]:          0 :             Any aAny( mXShapes->getByIndex( nIndex ) );
     747         [ #  # ]:          0 :             aAny >>= mXShape;
     748                 :            :         }
     749                 :            :         else
     750                 :            :         {
     751 [ #  # ][ #  # ]:          0 :             Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) );
     752         [ #  # ]:          0 :             aAny >>= mXShape;
     753                 :            :         }
     754         [ #  # ]:          0 :         if ( !mXShape.is() )
     755                 :            :             break;
     756                 :            : 
     757 [ #  # ][ #  # ]:          0 :         Any aAny( mXShape->queryInterface( ::getCppuType( (const Reference< XPropertySet >*) 0 ) ));
                 [ #  # ]
     758         [ #  # ]:          0 :         aAny >>= mXPropSet;
     759                 :            : 
     760         [ #  # ]:          0 :         if ( !mXPropSet.is() )
     761                 :            :             break;
     762 [ #  # ][ #  # ]:          0 :         maPosition = MapPoint( mXShape->getPosition() );
                 [ #  # ]
     763 [ #  # ][ #  # ]:          0 :         maSize = MapSize( mXShape->getSize() );
                 [ #  # ]
     764         [ #  # ]:          0 :         maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) );
     765                 :            : 
     766                 :            :         rtl::OStringBuffer aTypeBuffer(rtl::OUStringToOString(
     767 [ #  # ][ #  # ]:          0 :             mXShape->getShapeType(), RTL_TEXTENCODING_UTF8));
         [ #  # ][ #  # ]
     768                 :            :         // "com.sun.star." entfernen
     769         [ #  # ]:          0 :         aTypeBuffer.remove(0, RTL_CONSTASCII_LENGTH("com.sun.star."));
     770                 :            : 
     771                 :          0 :         sal_Int32 nPos = aTypeBuffer.toString().indexOf("Shape");
     772         [ #  # ]:          0 :         aTypeBuffer.remove(nPos, RTL_CONSTASCII_LENGTH("Shape"));
     773                 :          0 :         mType = aTypeBuffer.makeStringAndClear();
     774                 :            : 
     775                 :          0 :         mbPresObj = mbEmptyPresObj = sal_False;
     776 [ #  # ][ #  # ]:          0 :         if ( ImplGetPropertyValue( rtl::OUString( "IsPresentationObject" ) ) )
         [ #  # ][ #  # ]
     777                 :          0 :             mAny >>= mbPresObj;
     778                 :            : 
     779 [ #  # ][ #  # ]:          0 :         if ( mbPresObj && ImplGetPropertyValue( rtl::OUString( "IsEmptyPresentationObject" ) ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
             #  #  #  # ]
     780                 :          0 :             mAny >>= mbEmptyPresObj;
     781                 :            : 
     782                 :            :         mnAngle = ( PropValue::GetPropertyValue( aAny,
     783 [ #  # ][ #  # ]:          0 :             mXPropSet, rtl::OUString( "RotateAngle" ), sal_True ) )
                 [ #  # ]
     784                 :          0 :                 ? *((sal_Int32*)aAny.getValue() )
     785         [ #  # ]:          0 :                 : 0;
     786                 :            : 
     787                 :          0 :         return sal_True;
     788         [ #  # ]:          0 :     }
     789                 :          0 :     return sal_False;
     790                 :            : }
     791                 :            : 
     792                 :            : //  -----------------------------------------------------------------------
     793                 :            : 
     794                 :          0 : sal_Int8 PPTWriterBase::GetTransition( sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, FadeEffect eEffect, sal_uInt8& nDirection )
     795                 :            : {
     796                 :          0 :     sal_Int8 nPPTTransitionType = 0;
     797                 :          0 :     nDirection = 0;
     798                 :            : 
     799   [ #  #  #  #  :          0 :     switch( nTransitionType )
             #  #  #  #  
                      # ]
     800                 :            :     {
     801                 :            :     case TransitionType::FADE :
     802                 :            :     {
     803         [ #  # ]:          0 :         if ( nTransitionSubtype == TransitionSubType::CROSSFADE )
     804                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE;
     805         [ #  # ]:          0 :         else if ( nTransitionSubtype == TransitionSubType::FADEOVERCOLOR )
     806                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_FADE;
     807                 :            :     }
     808                 :          0 :     break;
     809                 :            :     case PPT_TRANSITION_TYPE_COMB :
     810                 :            :     {
     811                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_COMB;
     812         [ #  # ]:          0 :         if ( nTransitionSubtype == TransitionSubType::COMBVERTICAL )
     813                 :          0 :         nDirection++;
     814                 :            :     }
     815                 :          0 :     break;
     816                 :            :     case TransitionType::PUSHWIPE :
     817                 :            :     {
     818                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_PUSH;
     819   [ #  #  #  #  :          0 :         switch( nTransitionSubtype )
                      # ]
     820                 :            :         {
     821                 :          0 :         case TransitionSubType::FROMRIGHT: nDirection = 0; break;
     822                 :          0 :         case TransitionSubType::FROMBOTTOM: nDirection = 1; break;
     823                 :          0 :         case TransitionSubType::FROMLEFT: nDirection = 2; break;
     824                 :          0 :         case TransitionSubType::FROMTOP: nDirection = 3; break;
     825                 :            :         }
     826                 :            :     }
     827                 :          0 :     break;
     828                 :            :     case TransitionType::PINWHEELWIPE :
     829                 :            :     {
     830                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_WHEEL;
     831   [ #  #  #  #  :          0 :         switch( nTransitionSubtype )
                   #  # ]
     832                 :            :         {
     833                 :          0 :         case TransitionSubType::ONEBLADE: nDirection = 1; break;
     834                 :          0 :         case TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break;
     835                 :          0 :         case TransitionSubType::THREEBLADE : nDirection = 3; break;
     836                 :          0 :         case TransitionSubType::FOURBLADE: nDirection = 4; break;
     837                 :          0 :         case TransitionSubType::EIGHTBLADE: nDirection = 8; break;
     838                 :            :         }
     839                 :            :     }
     840                 :          0 :     break;
     841                 :            :     case TransitionType::FANWIPE :
     842                 :            :     {
     843                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_WEDGE;
     844                 :            :     }
     845                 :          0 :     break;
     846                 :            :     case TransitionType::ELLIPSEWIPE :
     847                 :            :     {
     848                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_CIRCLE;
     849                 :            :     }
     850                 :          0 :     break;
     851                 :            :     case TransitionType::FOURBOXWIPE :
     852                 :            :     {
     853                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_PLUS;
     854                 :            :     }
     855                 :          0 :     break;
     856                 :            :     case TransitionType::IRISWIPE :
     857                 :            :     {
     858         [ #  # ]:          0 :         switch( nTransitionSubtype ) {
     859                 :            :         case TransitionSubType::RECTANGLE:
     860                 :          0 :             nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
     861                 :          0 :             nDirection = (eEffect == FadeEffect_FADE_FROM_CENTER) ? 0 : 1;
     862                 :          0 :             break;
     863                 :            :         default:
     864                 :          0 :             nPPTTransitionType = PPT_TRANSITION_TYPE_DIAMOND;
     865                 :          0 :             break;
     866                 :            :         }
     867                 :            :     }
     868                 :          0 :     break;
     869                 :            :     }
     870                 :            : 
     871                 :          0 :     return nPPTTransitionType;
     872                 :            : }
     873                 :            : 
     874                 :          0 : sal_Int8 PPTWriterBase::GetTransition( FadeEffect eEffect, sal_uInt8& nDirection )
     875                 :            : {
     876                 :          0 :     sal_Int8 nPPTTransitionType = 0;
     877                 :            : 
     878   [ #  #  #  #  :          0 :     switch ( eEffect )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     879                 :            :     {
     880                 :            :     default :
     881                 :            :     case FadeEffect_RANDOM :
     882                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM;
     883                 :          0 :         break;
     884                 :            : 
     885                 :            :     case FadeEffect_HORIZONTAL_STRIPES :
     886                 :          0 :         nDirection++;
     887                 :            :     case FadeEffect_VERTICAL_STRIPES :
     888                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_BLINDS;
     889                 :          0 :         break;
     890                 :            : 
     891                 :            :     case FadeEffect_VERTICAL_CHECKERBOARD :
     892                 :          0 :         nDirection++;
     893                 :            :     case FadeEffect_HORIZONTAL_CHECKERBOARD :
     894                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_CHECKER;
     895                 :          0 :         break;
     896                 :            : 
     897                 :            :     case FadeEffect_MOVE_FROM_UPPERLEFT :
     898                 :          0 :         nDirection++;
     899                 :            :     case FadeEffect_MOVE_FROM_UPPERRIGHT :
     900                 :          0 :         nDirection++;
     901                 :            :     case FadeEffect_MOVE_FROM_LOWERLEFT :
     902                 :          0 :         nDirection++;
     903                 :            :     case FadeEffect_MOVE_FROM_LOWERRIGHT :
     904                 :          0 :         nDirection++;
     905                 :            :     case FadeEffect_MOVE_FROM_TOP :
     906                 :          0 :         nDirection++;
     907                 :            :     case FadeEffect_MOVE_FROM_LEFT :
     908                 :          0 :         nDirection++;
     909                 :            :     case FadeEffect_MOVE_FROM_BOTTOM :
     910                 :          0 :         nDirection++;
     911                 :            :     case FadeEffect_MOVE_FROM_RIGHT :
     912                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_COVER;
     913                 :          0 :         break;
     914                 :            : 
     915                 :            :     case FadeEffect_DISSOLVE :
     916                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_DISSOLVE;
     917                 :          0 :         break;
     918                 :            : 
     919                 :            :     case FadeEffect_VERTICAL_LINES :
     920                 :          0 :         nDirection++;
     921                 :            :     case FadeEffect_HORIZONTAL_LINES :
     922                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS;
     923                 :          0 :         break;
     924                 :            : 
     925                 :            :     case FadeEffect_CLOSE_HORIZONTAL :
     926                 :          0 :         nDirection++;
     927                 :            :     case FadeEffect_OPEN_HORIZONTAL :
     928                 :          0 :         nDirection++;
     929                 :            :     case FadeEffect_CLOSE_VERTICAL :
     930                 :          0 :         nDirection++;
     931                 :            :     case FadeEffect_OPEN_VERTICAL :
     932                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_SPLIT;
     933                 :          0 :         break;
     934                 :            : 
     935                 :            :     case FadeEffect_FADE_FROM_UPPERLEFT :
     936                 :          0 :         nDirection++;
     937                 :            :     case FadeEffect_FADE_FROM_UPPERRIGHT :
     938                 :          0 :         nDirection++;
     939                 :            :     case FadeEffect_FADE_FROM_LOWERLEFT :
     940                 :          0 :         nDirection++;
     941                 :            :     case FadeEffect_FADE_FROM_LOWERRIGHT :
     942                 :          0 :         nDirection += 4;
     943                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_STRIPS;
     944                 :          0 :         break;
     945                 :            : 
     946                 :            :     case FadeEffect_UNCOVER_TO_LOWERRIGHT :
     947                 :          0 :         nDirection++;
     948                 :            :     case FadeEffect_UNCOVER_TO_LOWERLEFT :
     949                 :          0 :         nDirection++;
     950                 :            :     case FadeEffect_UNCOVER_TO_UPPERRIGHT :
     951                 :          0 :         nDirection++;
     952                 :            :     case FadeEffect_UNCOVER_TO_UPPERLEFT :
     953                 :          0 :         nDirection++;
     954                 :            :     case FadeEffect_UNCOVER_TO_BOTTOM :
     955                 :          0 :         nDirection++;
     956                 :            :     case FadeEffect_UNCOVER_TO_RIGHT :
     957                 :          0 :         nDirection++;
     958                 :            :     case FadeEffect_UNCOVER_TO_TOP :
     959                 :          0 :         nDirection++;
     960                 :            :     case FadeEffect_UNCOVER_TO_LEFT :
     961                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_PULL;
     962                 :          0 :         break;
     963                 :            : 
     964                 :            :     case FadeEffect_FADE_FROM_TOP :
     965                 :          0 :         nDirection++;
     966                 :            :     case FadeEffect_FADE_FROM_LEFT :
     967                 :          0 :         nDirection++;
     968                 :            :     case FadeEffect_FADE_FROM_BOTTOM :
     969                 :          0 :         nDirection++;
     970                 :            :     case FadeEffect_FADE_FROM_RIGHT :
     971                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
     972                 :          0 :         break;
     973                 :            : 
     974                 :            :     case FadeEffect_ROLL_FROM_TOP :
     975                 :          0 :         nDirection++;
     976                 :            :     case FadeEffect_ROLL_FROM_LEFT :
     977                 :          0 :         nDirection++;
     978                 :            :     case FadeEffect_ROLL_FROM_BOTTOM :
     979                 :          0 :         nDirection++;
     980                 :            :     case FadeEffect_ROLL_FROM_RIGHT :
     981                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_WIPE;
     982                 :          0 :         break;
     983                 :            : 
     984                 :            :     case FadeEffect_FADE_TO_CENTER :
     985                 :          0 :         nDirection++;
     986                 :            :     case FadeEffect_FADE_FROM_CENTER :
     987                 :          0 :         nPPTTransitionType = PPT_TRANSITION_TYPE_ZOOM;
     988                 :          0 :         break;
     989                 :            : 
     990                 :            :     case FadeEffect_NONE :
     991                 :          0 :         nDirection = 2;
     992                 :          0 :         break;
     993                 :            :     }
     994                 :            : 
     995                 :          0 :     return nPPTTransitionType;
     996                 :            : }
     997                 :            : 
     998                 :            : //  -----------------------------------------------------------------------
     999                 :            : 
    1000                 :          0 : sal_Bool PPTWriterBase::ContainsOtherShapeThanPlaceholders( sal_Bool bForOOMLX )
    1001                 :            : {
    1002                 :          0 :     sal_uInt32 nShapes = mXShapes->getCount();
    1003                 :          0 :     sal_Bool bOtherThanPlaceHolders = sal_False;
    1004                 :            : 
    1005         [ #  # ]:          0 :     if ( nShapes )
    1006 [ #  # ][ #  # ]:          0 :     for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == sal_False ); nIndex++ ) {
                 [ #  # ]
    1007 [ #  # ][ #  # ]:          0 :         if ( GetShapeByIndex( nIndex ) && mType != "drawing.Page" ) {
                 [ #  # ]
    1008   [ #  #  #  #  :          0 :         if( bForOOMLX &&
           #  # ][ #  # ]
    1009                 :          0 :             ( mType == "presentation.Page" ||
    1010                 :          0 :               mType == "presentation.Notes" ) ) {
    1011         [ #  # ]:          0 :             Reference< XSimpleText > rXText( mXShape, UNO_QUERY );
    1012                 :            : 
    1013 [ #  # ][ #  # ]:          0 :             if( rXText.is() && !rXText->getString().isEmpty() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1014                 :          0 :             bOtherThanPlaceHolders = sal_True;
    1015                 :            :         } else
    1016                 :          0 :             bOtherThanPlaceHolders = sal_True;
    1017                 :            :         }
    1018                 :            :         DBG(printf("mType == %s\n", mType.getStr()));
    1019                 :            :     }
    1020                 :            : 
    1021                 :          0 :     return bOtherThanPlaceHolders;
    1022                 :            : }
    1023                 :            : 
    1024                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10