LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/unoidl - unopage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 686 1489 46.1 %
Date: 2012-12-17 Functions: 62 127 48.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             :     /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/lang/DisposedException.hpp>
      21             : #include <com/sun/star/presentation/ClickAction.hpp>
      22             : #include <com/sun/star/presentation/FadeEffect.hpp>
      23             : #include <com/sun/star/presentation/AnimationEffect.hpp>
      24             : #include <com/sun/star/presentation/PresentationRange.hpp>
      25             : #include <com/sun/star/presentation/AnimationSpeed.hpp>
      26             : #include <com/sun/star/view/PaperOrientation.hpp>
      27             : #include <com/sun/star/animations/AnimationNodeType.hpp>
      28             : #include <com/sun/star/presentation/EffectNodeType.hpp>
      29             : #include <comphelper/processfactory.hxx>
      30             : #include <comphelper/servicehelper.hxx>
      31             : #include <rtl/ustrbuf.hxx>
      32             : #include <vcl/bitmapex.hxx>
      33             : #include <vcl/metaact.hxx>
      34             : #include <toolkit/unohlp.hxx>
      35             : #include <vcl/svapp.hxx>
      36             : #include <vcl/settings.hxx>
      37             : #include <unomodel.hxx>
      38             : #include <unopage.hxx>
      39             : #include <svx/svxids.hrc>
      40             : #include <svl/itemset.hxx>
      41             : #include <svx/svdmodel.hxx>
      42             : #include <sdresid.hxx>
      43             : #include <glob.hrc>
      44             : #include <sdpage.hxx>
      45             : #include <unoprnms.hxx>
      46             : #include <sdattr.hxx>
      47             : #include <drawdoc.hxx>
      48             : #include <svx/unoshape.hxx>
      49             : #include <com/sun/star/style/XStyle.hpp>
      50             : #include <svx/svdorect.hxx>
      51             : #include <osl/mutex.hxx>
      52             : #include <svl/style.hxx>
      53             : #include <comphelper/serviceinfohelper.hxx>
      54             : 
      55             : #include <comphelper/extract.hxx>
      56             : #include <list>
      57             : #include <svx/svditer.hxx>
      58             : #include <svtools/wmf.hxx>
      59             : #include <svx/svdoole2.hxx>
      60             : #include <svx/svdpool.hxx>
      61             : #include <svx/svdview.hxx>
      62             : #include "View.hxx"
      63             : #include "DrawDocShell.hxx"
      64             : #include "ViewShell.hxx"
      65             : #include "DrawViewShell.hxx"
      66             : #include "unoobj.hxx"
      67             : #include "res_bmp.hrc"
      68             : #include "unokywds.hxx"
      69             : #include "unopback.hxx"
      70             : #include "unohelp.hxx"
      71             : 
      72             : using ::com::sun::star::animations::XAnimationNode;
      73             : using ::com::sun::star::animations::XAnimationNodeSupplier;
      74             : using ::rtl::OUString;
      75             : using ::rtl::OUStringBuffer;
      76             : 
      77             : using namespace ::osl;
      78             : using namespace ::com::sun::star;
      79             : using namespace ::com::sun::star::uno;
      80             : using namespace ::com::sun::star::lang;
      81             : using namespace ::com::sun::star::container;
      82             : using namespace ::com::sun::star::drawing;
      83             : using namespace ::com::sun::star::office;
      84             : 
      85             : namespace sd {
      86             : extern Reference< XAnnotation > createAnnotation( const Reference< XComponentContext >& xContext, SdPage* );
      87             : extern Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& );
      88             : }
      89             : 
      90             : /* this are the ids for page properties */
      91             : enum WID_PAGE
      92             : {
      93             :     WID_PAGE_LEFT, WID_PAGE_RIGHT, WID_PAGE_TOP, WID_PAGE_BOTTOM, WID_PAGE_WIDTH,
      94             :     WID_PAGE_HEIGHT, WID_PAGE_EFFECT, WID_PAGE_CHANGE, WID_PAGE_SPEED, WID_PAGE_NUMBER,
      95             :     WID_PAGE_ORIENT, WID_PAGE_LAYOUT, WID_PAGE_DURATION, WID_PAGE_LDNAME, WID_PAGE_LDBITMAP,
      96             :     WID_PAGE_BACK, WID_PAGE_PREVIEW, WID_PAGE_PREVIEWBITMAP, WID_PAGE_VISIBLE, WID_PAGE_SOUNDFILE, WID_PAGE_BACKFULL,
      97             :     WID_PAGE_BACKVIS, WID_PAGE_BACKOBJVIS, WID_PAGE_USERATTRIBS, WID_PAGE_BOOKMARK, WID_PAGE_ISDARK,
      98             :     WID_PAGE_HEADERVISIBLE, WID_PAGE_HEADERTEXT, WID_PAGE_FOOTERVISIBLE, WID_PAGE_FOOTERTEXT,
      99             :     WID_PAGE_PAGENUMBERVISIBLE, WID_PAGE_DATETIMEVISIBLE, WID_PAGE_DATETIMEFIXED,
     100             :     WID_PAGE_DATETIMETEXT, WID_PAGE_DATETIMEFORMAT, WID_TRANSITION_TYPE, WID_TRANSITION_SUBTYPE,
     101             :     WID_TRANSITION_DIRECTION, WID_TRANSITION_FADE_COLOR, WID_TRANSITION_DURATION, WID_LOOP_SOUND,
     102             :     WID_NAVORDER
     103             : };
     104             : 
     105             : #ifndef SEQTYPE
     106             :  #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
     107             :   #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
     108             :  #else
     109             :   #define SEQTYPE(x) &(x)
     110             :  #endif
     111             : #endif
     112             : 
     113             : static sal_Char sEmptyPageName[sizeof("page")] = "page";
     114             : 
     115             : /** this function stores the property maps for draw pages in impress and draw */
     116         108 : const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKind ePageKind )
     117             : {
     118             :     static const SfxItemPropertyMapEntry aDrawPagePropertyMap_Impl[] =
     119             :     {
     120           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND),       WID_PAGE_BACK,      &ITYPE( beans::XPropertySet ),                  beans::PropertyAttribute::MAYBEVOID,0},
     121           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM),           WID_PAGE_BOTTOM,    &::getCppuType((const sal_Int32*)0),            0,  0},
     122           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT),             WID_PAGE_LEFT,      &::getCppuType((const sal_Int32*)0),            0,  0},
     123           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT),            WID_PAGE_RIGHT,     &::getCppuType((const sal_Int32*)0),            0,  0},
     124           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP),              WID_PAGE_TOP,       &::getCppuType((const sal_Int32*)0),            0,  0},
     125           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_CHANGE),           WID_PAGE_CHANGE,    &::getCppuType((const sal_Int32*)0),            0,  0},
     126           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_DURATION),         WID_PAGE_DURATION,  &::getCppuType((const sal_Int32*)0),            0,  0},
     127           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_EFFECT),           WID_PAGE_EFFECT,    &::getCppuType((const presentation::FadeEffect*)0),     0,  0},
     128           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT),           WID_PAGE_HEIGHT,    &::getCppuType((const sal_Int32*)0),            0,  0},
     129           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT),           WID_PAGE_LAYOUT,    &::getCppuType((const sal_Int16*)0),            0,  0},
     130           4 :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP),     WID_PAGE_LDBITMAP,  &ITYPE( awt::XBitmap),                          beans::PropertyAttribute::READONLY, 0},
     131           4 :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME),       WID_PAGE_LDNAME,    &::getCppuType((const OUString*)0),             beans::PropertyAttribute::READONLY, 0},
     132           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER),           WID_PAGE_NUMBER,    &::getCppuType((const sal_Int16*)0),            beans::PropertyAttribute::READONLY, 0},
     133           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION),      WID_PAGE_ORIENT,    &::getCppuType((const view::PaperOrientation*)0),0, 0},
     134           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_SPEED),            WID_PAGE_SPEED,     &::getCppuType((const presentation::AnimationSpeed*)0), 0,  0},
     135           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH),            WID_PAGE_WIDTH,     &::getCppuType((const sal_Int32*)0),            0,  0},
     136           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW),          WID_PAGE_PREVIEW,   SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
     137           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP),    WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
     138           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_VISIBLE),          WID_PAGE_VISIBLE,   &::getBooleanCppuType(),                        0, 0},
     139           4 :         { MAP_CHAR_LEN(UNO_NAME_OBJ_SOUNDFILE),         WID_PAGE_SOUNDFILE, &::getCppuType((const Any*)0),              0, 0},
     140           4 :         { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundVisible),  WID_PAGE_BACKVIS,   &::getBooleanCppuType(),                        0, 0},
     141           4 :         { MAP_CHAR_LEN(sUNO_Prop_IsBackgroundObjectsVisible),   WID_PAGE_BACKOBJVIS,    &::getBooleanCppuType(),                        0, 0},
     142           4 :         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0)  ,         0,     0},
     143           4 :         { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL),          WID_PAGE_BOOKMARK,  &::getCppuType((const OUString*)0),             0,  0},
     144           4 :         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},
     145           4 :         { MAP_CHAR_LEN("IsFooterVisible"),              WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(),                    0, 0},
     146           4 :         { MAP_CHAR_LEN("FooterText"),                   WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0),                0,  0},
     147           4 :         { MAP_CHAR_LEN("IsPageNumberVisible"),          WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(),                    0, 0},
     148           4 :         { MAP_CHAR_LEN("IsDateTimeVisible"),            WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(),                  0, 0},
     149           4 :         { MAP_CHAR_LEN("IsDateTimeFixed"),              WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(),                    0, 0},
     150           4 :         { MAP_CHAR_LEN("DateTimeText"),                 WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0),              0,  0},
     151           4 :         { MAP_CHAR_LEN("DateTimeFormat"),               WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0),           0,  0},
     152           4 :         { MAP_CHAR_LEN("TransitionType"),               WID_TRANSITION_TYPE, &::getCppuType((const sal_Int16*)0),           0,  0},
     153           4 :         { MAP_CHAR_LEN("TransitionSubtype"),            WID_TRANSITION_SUBTYPE, &::getCppuType((const sal_Int16*)0),            0,  0},
     154           4 :         { MAP_CHAR_LEN("TransitionDirection"),          WID_TRANSITION_DIRECTION, &::getCppuType((const sal_Bool*)0),           0,  0},
     155           4 :         { MAP_CHAR_LEN("TransitionFadeColor"),          WID_TRANSITION_FADE_COLOR, &::getCppuType((const sal_Int32*)0),         0,  0},
     156           4 :         { MAP_CHAR_LEN("TransitionDuration"),           WID_TRANSITION_DURATION, &::getCppuType((const double*)0),          0,  0},
     157           4 :         { MAP_CHAR_LEN("LoopSound"),                    WID_LOOP_SOUND, &::getBooleanCppuType(),                    0, 0},
     158           4 :         { MAP_CHAR_LEN("NavigationOrder"),              WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0,  0},
     159             :         {0,0,0,0,0,0}
     160         264 :     };
     161             : 
     162             : #define DRAW_PAGE_NOTES_PROPERTIES \
     163             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM),           WID_PAGE_BOTTOM,    &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     164             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT),             WID_PAGE_LEFT,      &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     165             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT),            WID_PAGE_RIGHT,     &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     166             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP),              WID_PAGE_TOP,       &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     167             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT),           WID_PAGE_HEIGHT,    &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     168             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT),           WID_PAGE_LAYOUT,    &::getCppuType((const sal_Int16*)0),            0,  0},                                                                \
     169             :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP),     WID_PAGE_LDBITMAP,  &ITYPE( awt::XBitmap),                          beans::PropertyAttribute::READONLY, 0},                                \
     170             :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME),       WID_PAGE_LDNAME,    &::getCppuType((const OUString*)0),             beans::PropertyAttribute::READONLY, 0},                                \
     171             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER),           WID_PAGE_NUMBER,    &::getCppuType((const sal_Int16*)0),            beans::PropertyAttribute::READONLY, 0},                                \
     172             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION),      WID_PAGE_ORIENT,    &::getCppuType((const view::PaperOrientation*)0),0, 0},                                                                \
     173             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH),            WID_PAGE_WIDTH,     &::getCppuType((const sal_Int32*)0),            0,  0},                                                                \
     174             :         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0)  ,      0,     0},\
     175             :         { MAP_CHAR_LEN("IsHeaderVisible"),              WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(),                    0, 0},                                                                 \
     176             :         { MAP_CHAR_LEN("HeaderText"),                   WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0),                0,  0},                                                            \
     177             :         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},                                \
     178             :         { MAP_CHAR_LEN("IsFooterVisible"),              WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(),                    0, 0},                                                                 \
     179             :         { MAP_CHAR_LEN("FooterText"),                   WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0),                0,  0},                                                            \
     180             :         { MAP_CHAR_LEN("IsPageNumberVisible"),          WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(),                    0, 0},                                                             \
     181             :         { MAP_CHAR_LEN("IsDateTimeVisible"),            WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(),                  0, 0},                                                                 \
     182             :         { MAP_CHAR_LEN("IsDateTimeFixed"),              WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(),                    0, 0},                                                                 \
     183             :         { MAP_CHAR_LEN("DateTimeText"),                 WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0),              0,  0},                                                            \
     184             :         { MAP_CHAR_LEN("DateTimeFormat"),               WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0),           0,  0},                                                            \
     185             :         { MAP_CHAR_LEN("NavigationOrder"),              WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0,  0},                                                            \
     186             :         {0,0,0,0,0,0}
     187             : 
     188             :     static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyMap_Impl[] =
     189             :     {
     190             :         // this must be the first two entries so they can be excluded for PK_STANDARD
     191           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND),       WID_PAGE_BACK,      &ITYPE( beans::XPropertySet ),                  beans::PropertyAttribute::MAYBEVOID,0},
     192          92 :         DRAW_PAGE_NOTES_PROPERTIES
     193         204 :     };
     194             :     static const SfxItemPropertyMapEntry aDrawPageNotesHandoutPropertyNoBackMap_Impl[] =
     195             :     {
     196          92 :         DRAW_PAGE_NOTES_PROPERTIES
     197         200 :     };
     198             : 
     199             : #define GRAPHIC_PAGE_PROPERTIES \
     200             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM),           WID_PAGE_BOTTOM,    &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     201             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT),             WID_PAGE_LEFT,      &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     202             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT),            WID_PAGE_RIGHT,     &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     203             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP),              WID_PAGE_TOP,       &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     204             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT),           WID_PAGE_HEIGHT,    &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     205             :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP),     WID_PAGE_LDBITMAP,  &ITYPE(awt::XBitmap),                           beans::PropertyAttribute::READONLY, 0},                                             \
     206             :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME),       WID_PAGE_LDNAME,    &::getCppuType((const OUString*)0),             beans::PropertyAttribute::READONLY, 0},                                             \
     207             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER),           WID_PAGE_NUMBER,    &::getCppuType((const sal_Int16*)0),            beans::PropertyAttribute::READONLY, 0},                                             \
     208             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION),      WID_PAGE_ORIENT,    &::getCppuType((const view::PaperOrientation*)0),0, 0},                                                                             \
     209             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH),            WID_PAGE_WIDTH,     &::getCppuType((const sal_Int32*)0),            0,  0},                                                                             \
     210             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEW),          WID_PAGE_PREVIEW,   SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},    \
     211             :         { MAP_CHAR_LEN(UNO_NAME_PAGE_PREVIEWBITMAP),    WID_PAGE_PREVIEWBITMAP, SEQTYPE(::getCppuType((::com::sun::star::uno::Sequence<sal_Int8>*)0)), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},\
     212             :         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0)  ,         0,     0},                          \
     213             :         { MAP_CHAR_LEN(sUNO_Prop_BookmarkURL),          WID_PAGE_BOOKMARK,  &::getCppuType((const OUString*)0),             0,  0},                                                                             \
     214             :         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},                                             \
     215             :         { MAP_CHAR_LEN("NavigationOrder"),              WID_NAVORDER, &::com::sun::star::container::XIndexAccess::static_type(),0,  0},                                                                         \
     216             :         {0,0,0,0,0,0}
     217             : 
     218             :     static const SfxItemPropertyMapEntry aGraphicPagePropertyMap_Impl[] =
     219             :     {
     220           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND),       WID_PAGE_BACK,      &ITYPE( beans::XPropertySet),                   beans::PropertyAttribute::MAYBEVOID,0},
     221          64 :         GRAPHIC_PAGE_PROPERTIES
     222         176 :     };
     223             :     static const SfxItemPropertyMapEntry aGraphicPagePropertyNoBackMap_Impl[] =
     224             :     {
     225          64 :         GRAPHIC_PAGE_PROPERTIES
     226         172 :     };
     227             : 
     228         108 :     bool bWithoutBackground = ePageKind != PK_STANDARD && ePageKind != PK_HANDOUT;
     229         108 :     const SvxItemPropertySet* pRet = 0;
     230         108 :     if( bImpress )
     231             :     {
     232         108 :         if( ePageKind == PK_STANDARD )
     233             :         {
     234             :             //PK_STANDARD always has a background property
     235          90 :             static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     236          90 :             pRet = &aDrawPagePropertySet_Impl;
     237             :         }
     238             :         else
     239             :         {
     240          18 :             if(bWithoutBackground)
     241             :             {
     242          18 :                 static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     243          18 :                 pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
     244             :             }
     245             :             else
     246             :             {
     247           0 :                 static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     248           0 :                 pRet = &aDrawPageNotesHandoutPropertySet_Impl;
     249             :             }
     250             :         }
     251             :     }
     252             :     else
     253             :     {
     254           0 :             if(bWithoutBackground)
     255             :             {
     256           0 :                 static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     257           0 :                 pRet = &aGraphicPagePropertyNoBackSet_Impl;
     258             :             }
     259             :             else
     260             :             {
     261           0 :                 static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     262           0 :                 pRet = &aGraphicPagePropertySet_Impl;
     263             :             }
     264             :     }
     265         108 :     return pRet;
     266             : }
     267             : 
     268             : /** this function stores the property map for master pages in impress and draw */
     269          20 : const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
     270             : {
     271             :     static const SfxItemPropertyMapEntry aMasterPagePropertyMap_Impl[] =
     272             :     {
     273           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BACKGROUND),       WID_PAGE_BACK,      &ITYPE(beans::XPropertySet),                    0,  0},
     274           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM),           WID_PAGE_BOTTOM,    &::getCppuType((const sal_Int32*)0),            0,  0},
     275           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT),             WID_PAGE_LEFT,      &::getCppuType((const sal_Int32*)0),            0,  0},
     276           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT),            WID_PAGE_RIGHT,     &::getCppuType((const sal_Int32*)0),            0,  0},
     277           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP),              WID_PAGE_TOP,       &::getCppuType((const sal_Int32*)0),            0,  0},
     278           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT),           WID_PAGE_HEIGHT,    &::getCppuType((const sal_Int32*)0),            0,  0},
     279           4 :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYBITMAP),     WID_PAGE_LDBITMAP,  &ITYPE(awt::XBitmap),                           beans::PropertyAttribute::READONLY, 0},
     280           4 :         { MAP_CHAR_LEN(UNO_NAME_LINKDISPLAYNAME),       WID_PAGE_LDNAME,    &::getCppuType((const OUString*)0),             beans::PropertyAttribute::READONLY, 0},
     281           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER),           WID_PAGE_NUMBER,    &::getCppuType((const sal_Int16*)0),            beans::PropertyAttribute::READONLY, 0},
     282           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION),      WID_PAGE_ORIENT,    &::getCppuType((const view::PaperOrientation*)0),0, 0},
     283           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH),            WID_PAGE_WIDTH,     &::getCppuType((const sal_Int32*)0),            0,  0},
     284           4 :         { MAP_CHAR_LEN("BackgroundFullSize"),           WID_PAGE_BACKFULL,  &::getBooleanCppuType(),                        0, 0},
     285           4 :         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0)  ,         0,     0},
     286           4 :         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},
     287             :         {0,0,0,0,0,0}
     288          76 :     };
     289             : 
     290             :     static const SfxItemPropertyMapEntry aHandoutMasterPagePropertyMap_Impl[] =
     291             :     {
     292           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_BOTTOM),           WID_PAGE_BOTTOM,    &::getCppuType((const sal_Int32*)0),            0,  0},
     293           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LEFT),             WID_PAGE_LEFT,      &::getCppuType((const sal_Int32*)0),            0,  0},
     294           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_RIGHT),            WID_PAGE_RIGHT,     &::getCppuType((const sal_Int32*)0),            0,  0},
     295           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_TOP),              WID_PAGE_TOP,       &::getCppuType((const sal_Int32*)0),            0,  0},
     296           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_HEIGHT),           WID_PAGE_HEIGHT,    &::getCppuType((const sal_Int32*)0),            0,  0},
     297           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_ORIENTATION),      WID_PAGE_ORIENT,    &::getCppuType((const view::PaperOrientation*)0),0, 0},
     298           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_NUMBER),           WID_PAGE_NUMBER,    &::getCppuType((const sal_Int16*)0),            beans::PropertyAttribute::READONLY, 0},
     299           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_WIDTH),            WID_PAGE_WIDTH,     &::getCppuType((const sal_Int32*)0),            0,  0},
     300           4 :         { MAP_CHAR_LEN(UNO_NAME_PAGE_LAYOUT),           WID_PAGE_LAYOUT,    &::getCppuType((const sal_Int16*)0),            0,  0},
     301           4 :         { MAP_CHAR_LEN(sUNO_Prop_UserDefinedAttributes),WID_PAGE_USERATTRIBS, &::getCppuType((const Reference< ::com::sun::star::container::XNameContainer >*)0)  ,         0,     0},
     302           4 :         { MAP_CHAR_LEN("IsBackgroundDark" ),            WID_PAGE_ISDARK,    &::getBooleanCppuType(),                        beans::PropertyAttribute::READONLY, 0},
     303           4 :         { MAP_CHAR_LEN("IsHeaderVisible"),              WID_PAGE_HEADERVISIBLE, &::getBooleanCppuType(),                    0, 0},
     304           4 :         { MAP_CHAR_LEN("HeaderText"),                   WID_PAGE_HEADERTEXT, &::getCppuType((const OUString*)0),                0,  0},
     305           4 :         { MAP_CHAR_LEN("IsFooterVisible"),              WID_PAGE_FOOTERVISIBLE, &::getBooleanCppuType(),                    0, 0},
     306           4 :         { MAP_CHAR_LEN("FooterText"),                   WID_PAGE_FOOTERTEXT, &::getCppuType((const OUString*)0),                0,  0},
     307           4 :         { MAP_CHAR_LEN("IsPageNumberVisible"),          WID_PAGE_PAGENUMBERVISIBLE, &::getBooleanCppuType(),                    0, 0},
     308           4 :         { MAP_CHAR_LEN("IsDateTimeVisible"),            WID_PAGE_DATETIMEVISIBLE, &::getBooleanCppuType(),                  0, 0},
     309           4 :         { MAP_CHAR_LEN("IsDateTimeFixed"),              WID_PAGE_DATETIMEFIXED, &::getBooleanCppuType(),                    0, 0},
     310           4 :         { MAP_CHAR_LEN("DateTimeText"),                 WID_PAGE_DATETIMETEXT, &::getCppuType((const OUString*)0),              0,  0},
     311           4 :         { MAP_CHAR_LEN("DateTimeFormat"),               WID_PAGE_DATETIMEFORMAT, &::getCppuType((const sal_Int32*)0),           0,  0},
     312             :         {0,0,0,0,0,0}
     313         100 :     };
     314             : 
     315          20 :     const SvxItemPropertySet* pRet = 0;
     316          20 :     if( ePageKind == PK_HANDOUT )
     317             :     {
     318           2 :         static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     319           2 :         pRet = &aHandoutMasterPagePropertySet_Impl;
     320             :     }
     321             :     else
     322             :     {
     323          18 :         static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
     324          18 :         pRet = &aMasterPagePropertySet_Impl;
     325             :     }
     326          20 :     return pRet;
     327             : }
     328             : 
     329             : namespace
     330             : {
     331             :     class theSdGenericDrawPageUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSdGenericDrawPageUnoTunnelId> {};
     332             : }
     333             : 
     334        1678 : const ::com::sun::star::uno::Sequence< sal_Int8 > & SdGenericDrawPage::getUnoTunnelId() throw()
     335             : {
     336        1678 :     return theSdGenericDrawPageUnoTunnelId::get().getSeq();
     337             : }
     338             : 
     339        1678 : sal_Int64 SAL_CALL SdGenericDrawPage::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException)
     340             : {
     341        5034 :         if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
     342        3356 :             rId.getConstArray(), 16 ) )
     343             :         {
     344           0 :                 return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
     345             :         }
     346             :         else
     347             :         {
     348        1678 :                 return SvxFmDrawPage::getSomething( rId );
     349             :         }
     350             : }
     351             : 
     352         128 : SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPage, const SvxItemPropertySet* _pSet ) throw()
     353             : :       SvxFmDrawPage( (SdrPage*) pInPage ),
     354             :         SdUnoSearchReplaceShape(this),
     355             :         mpModel     ( _pModel ),
     356             :         mpSdrModel(0),
     357             :         mnTempPageNumber(0),
     358             :         mpPropSet   ( _pSet ),
     359         128 :         mbIsImpressDocument(false)
     360             : {
     361         128 :     mpSdrModel = SvxFmDrawPage::mpModel;
     362         128 :     if( mpModel )
     363         128 :         mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
     364             : 
     365         128 : }
     366             : 
     367         118 : SdGenericDrawPage::~SdGenericDrawPage() throw()
     368             : {
     369         118 : }
     370             : 
     371        1546 : void SdGenericDrawPage::throwIfDisposed() const throw (::com::sun::star::uno::RuntimeException )
     372             : {
     373        1546 :     if( (SvxFmDrawPage::mpModel == 0) || (mpModel == 0) || (SvxFmDrawPage::mpPage == 0) )
     374           0 :         throw lang::DisposedException();
     375        1546 : }
     376             : 
     377        2254 : SdXImpressDocument* SdGenericDrawPage::GetModel() const
     378             : {
     379        2254 :     if( mpSdrModel != SvxFmDrawPage::mpModel )
     380             :     {
     381           0 :         const_cast< SdGenericDrawPage* >(this)->mpSdrModel = SvxFmDrawPage::mpModel;
     382           0 :         if( mpSdrModel )
     383             :         {
     384           0 :             uno::Reference< uno::XInterface > xModel( SvxFmDrawPage::mpModel->getUnoModel() );
     385           0 :             const_cast< SdGenericDrawPage*>(this)->mpModel = SdXImpressDocument::getImplementation( xModel );
     386           0 :             if( mpModel )
     387           0 :                 const_cast< SdGenericDrawPage*>(this)->mbIsImpressDocument = mpModel->IsImpressDocument() ? true : false;
     388             :         }
     389             :         else
     390             :         {
     391           0 :             const_cast< SdGenericDrawPage* >(this)->mpModel = 0;
     392             :         }
     393             :     }
     394             : 
     395        2254 :     return mpModel;
     396             : }
     397             : 
     398             : // this is called whenever a SdrObject must be created for a empty api shape wrapper
     399         308 : SdrObject * SdGenericDrawPage::_CreateSdrObject( const Reference< drawing::XShape >& xShape ) throw()
     400             : {
     401         308 :     if( NULL == SvxFmDrawPage::mpPage || !xShape.is() )
     402           0 :         return NULL;
     403             : 
     404         308 :     String aType( xShape->getShapeType() );
     405         308 :     const String aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.") );
     406         308 :     if( aType.CompareTo( aPrefix, aPrefix.Len() ) != 0 )
     407             :     {
     408         198 :         SdrObject* pObj = SvxFmDrawPage::_CreateSdrObject( xShape );
     409         198 :         if( pObj && ( (pObj->GetObjInventor() != SdrInventor) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
     410             :         {
     411         198 :             SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
     412         198 :             if( pDoc )
     413         198 :                 pObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
     414             :         }
     415         198 :         return pObj;
     416             :     }
     417             : 
     418         110 :     aType = aType.Copy( aPrefix.Len() );
     419             : 
     420         110 :     PresObjKind eObjKind = PRESOBJ_NONE;
     421             : 
     422         110 :     if( aType.EqualsAscii( "TitleTextShape" ) )
     423             :     {
     424          12 :         eObjKind = PRESOBJ_TITLE;
     425             :     }
     426          98 :     else if( aType.EqualsAscii( "OutlinerShape" ) )
     427             :     {
     428           8 :         eObjKind = PRESOBJ_OUTLINE;
     429             :     }
     430          90 :     else if( aType.EqualsAscii( "SubtitleShape" ) )
     431             :     {
     432           0 :         eObjKind = PRESOBJ_TEXT;
     433             :     }
     434          90 :     else if( aType.EqualsAscii( "OLE2Shape" ) )
     435             :     {
     436           0 :         eObjKind = PRESOBJ_OBJECT;
     437             :     }
     438          90 :     else if( aType.EqualsAscii( "ChartShape" ) )
     439             :     {
     440           0 :         eObjKind = PRESOBJ_CHART;
     441             :     }
     442          90 :     else if( aType.EqualsAscii( "CalcShape" ) )
     443             :     {
     444           0 :         eObjKind = PRESOBJ_CALC;
     445             :     }
     446          90 :     else if( aType.EqualsAscii( "TableShape" ) )
     447             :     {
     448           0 :         eObjKind = PRESOBJ_TABLE;
     449             :     }
     450          90 :     else if( aType.EqualsAscii( "GraphicObjectShape" ) )
     451             :     {
     452           2 :         eObjKind = PRESOBJ_GRAPHIC;
     453             :     }
     454          88 :     else if( aType.EqualsAscii( "OrgChartShape" ) )
     455             :     {
     456           0 :         eObjKind = PRESOBJ_ORGCHART;
     457             :     }
     458          88 :     else if( aType.EqualsAscii( "PageShape" ) )
     459             :     {
     460          20 :         if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
     461           2 :             eObjKind = PRESOBJ_TITLE;
     462             :         else
     463          18 :             eObjKind = PRESOBJ_PAGE;
     464             :     }
     465          68 :     else if( aType.EqualsAscii( "NotesShape" ) )
     466             :     {
     467          20 :         eObjKind = PRESOBJ_NOTES;
     468             :     }
     469          48 :     else if( aType.EqualsAscii( "HandoutShape" ) )
     470             :     {
     471          12 :         eObjKind = PRESOBJ_HANDOUT;
     472             :     }
     473          36 :     else if( aType.EqualsAscii( "FooterShape" ) )
     474             :     {
     475          10 :         eObjKind = PRESOBJ_FOOTER;
     476             :     }
     477          26 :     else if( aType.EqualsAscii( "HeaderShape" ) )
     478             :     {
     479           4 :         eObjKind = PRESOBJ_HEADER;
     480             :     }
     481          22 :     else if( aType.EqualsAscii( "SlideNumberShape" ) )
     482             :     {
     483          14 :         eObjKind = PRESOBJ_SLIDENUMBER;
     484             :     }
     485           8 :     else if( aType.EqualsAscii( "DateTimeShape" ) )
     486             :     {
     487           8 :         eObjKind = PRESOBJ_DATETIME;
     488             :     }
     489           0 :     else if( aType.EqualsAscii( "MediaShape" ) )
     490             :     {
     491           0 :         eObjKind = PRESOBJ_MEDIA;
     492             :     }
     493             : 
     494         110 :     Rectangle aRect( eObjKind == PRESOBJ_TITLE ? GetPage()->GetTitleRect() : GetPage()->GetLayoutRect()  );
     495             : 
     496         110 :     const awt::Point aPos( aRect.Left(), aRect.Top() );
     497         110 :     xShape->setPosition( aPos );
     498             : 
     499         110 :     const awt::Size aSize( aRect.GetWidth(), aRect.GetHeight() );
     500         110 :     xShape->setSize( aSize );
     501             : 
     502         110 :     SdrObject *pPresObj = 0;
     503         110 :     if( (eObjKind == PRESOBJ_TABLE) || (eObjKind == PRESOBJ_MEDIA) )
     504             :     {
     505           0 :         pPresObj = SvxFmDrawPage::_CreateSdrObject( xShape );
     506           0 :         if( pPresObj )
     507             :         {
     508           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
     509           0 :             if( pDoc )
     510           0 :                 pPresObj->NbcSetStyleSheet( pDoc->GetDefaultStyleSheet(), sal_True );
     511           0 :             GetPage()->InsertPresObj( pPresObj, eObjKind );
     512           0 :         }
     513             :     }
     514             :     else
     515             :     {
     516         110 :         pPresObj = GetPage()->CreatePresObj( eObjKind, sal_False, aRect, sal_True );
     517             :     }
     518             : 
     519         110 :     if( pPresObj )
     520         110 :         pPresObj->SetUserCall( GetPage() );
     521             : 
     522         110 :     return pPresObj;
     523             : }
     524             : 
     525             : // XInterface
     526        2808 : Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
     527             :     throw(uno::RuntimeException)
     528             : {
     529        2808 :     Any aAny;
     530             : 
     531        2808 :     QUERYINT( beans::XPropertySet );
     532        2666 :     else QUERYINT( container::XNamed );
     533        2646 :     else QUERYINT( util::XReplaceable );
     534        2646 :     else QUERYINT( util::XSearchable );
     535        2646 :     else QUERYINT( document::XLinkTargetSupplier );
     536        2646 :     else QUERYINT( drawing::XShapeCombiner );
     537        2646 :     else QUERYINT( drawing::XShapeBinder );
     538        2646 :     else QUERYINT( beans::XMultiPropertySet );
     539        2578 :     else if( rType == ITYPE( office::XAnnotationAccess ) )
     540             :     {
     541          42 :         return Any( Reference< office::XAnnotationAccess >( this ) );
     542             :     }
     543        2536 :     else if( rType == ITYPE( XAnimationNodeSupplier ) )
     544             :     {
     545          82 :         if( mbIsImpressDocument )
     546             :         {
     547          82 :             const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
     548             : 
     549          82 :             if( ePageKind == PK_STANDARD )
     550          80 :                 return makeAny( Reference< XAnimationNodeSupplier >( this ) );
     551             :         }
     552             :     }
     553             :     else
     554        2454 :         return SvxDrawPage::queryInterface( rType );
     555             : 
     556         232 :     return aAny;
     557             : }
     558             : 
     559             : // XPropertySet
     560         170 : Reference< beans::XPropertySetInfo > SAL_CALL SdGenericDrawPage::getPropertySetInfo()
     561             :     throw(uno::RuntimeException)
     562             : {
     563         170 :     ::SolarMutexGuard aGuard;
     564         170 :     throwIfDisposed();
     565         170 :     return mpPropSet->getPropertySetInfo();
     566             : }
     567             : 
     568         352 : void SAL_CALL SdGenericDrawPage::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
     569             :     throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
     570             : {
     571         352 :     ::SolarMutexGuard aGuard;
     572             : 
     573         352 :     throwIfDisposed();
     574             : 
     575         352 :     const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName);
     576             : 
     577         352 :     switch( pEntry ? pEntry->nWID : -1 )
     578             :     {
     579             :         case WID_NAVORDER:
     580           0 :             setNavigationOrder( aValue );
     581           0 :             break;
     582             :         case WID_PAGE_LEFT:
     583             :         case WID_PAGE_RIGHT:
     584             :         case WID_PAGE_TOP:
     585             :         case WID_PAGE_BOTTOM:
     586             :         case WID_PAGE_LAYOUT:
     587             :         case WID_PAGE_DURATION:
     588             :         case WID_PAGE_CHANGE:
     589             :         {
     590          58 :             sal_Int32 nValue = 0;
     591          58 :             if(!(aValue >>= nValue))
     592           0 :                 throw lang::IllegalArgumentException();
     593             : 
     594          58 :             switch( pEntry->nWID )
     595             :             {
     596             :             case WID_PAGE_LEFT:
     597           8 :                 SetLftBorder(nValue);
     598           8 :                 break;
     599             :             case WID_PAGE_RIGHT:
     600           8 :                 SetRgtBorder( nValue );
     601           8 :                 break;
     602             :             case WID_PAGE_TOP:
     603           8 :                 SetUppBorder( nValue );
     604           8 :                 break;
     605             :             case WID_PAGE_BOTTOM:
     606           8 :                 SetLwrBorder( nValue );
     607           8 :                 break;
     608             :             case WID_PAGE_CHANGE:
     609           0 :                 GetPage()->SetPresChange( (PresChange)nValue );
     610           0 :                 break;
     611             :             case WID_PAGE_LAYOUT:
     612          26 :                 GetPage()->SetAutoLayout( (AutoLayout)nValue, sal_True );
     613          26 :                 break;
     614             :             case WID_PAGE_DURATION:
     615           0 :                 GetPage()->SetTime((sal_uInt32)nValue);
     616           0 :                 break;
     617             :             }
     618             :             break;
     619             :         }
     620             :         case WID_PAGE_WIDTH:
     621             :         {
     622          26 :             sal_Int32 nWidth = 0;
     623          26 :             if(!(aValue >>= nWidth))
     624           0 :                 throw lang::IllegalArgumentException();
     625             : 
     626          26 :             SetWidth( nWidth );
     627             :             break;
     628             :         }
     629             :         case WID_PAGE_HEIGHT:
     630             :         {
     631          26 :             sal_Int32 nHeight = 0;
     632          26 :             if(!(aValue >>= nHeight))
     633           0 :                 throw lang::IllegalArgumentException();
     634             : 
     635          26 :             SetHeight( nHeight );
     636             :             break;
     637             :         }
     638             :         case WID_PAGE_ORIENT:
     639             :         {
     640           8 :             sal_Int32 nEnum = 0;
     641           8 :             if(!::cppu::enum2int( nEnum, aValue ))
     642           0 :                 throw lang::IllegalArgumentException();
     643             : 
     644           8 :             Orientation eOri = (((view::PaperOrientation)nEnum) == view::PaperOrientation_PORTRAIT)?ORIENTATION_PORTRAIT:ORIENTATION_LANDSCAPE;
     645             : 
     646           8 :             if( eOri != GetPage()->GetOrientation() )
     647             :             {
     648           2 :                 SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
     649           2 :                 const PageKind ePageKind = GetPage()->GetPageKind();
     650             : 
     651           2 :                 sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
     652           4 :                 for (i = 0; i < nPageCnt; i++)
     653             :                 {
     654           2 :                     SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
     655           2 :                     pPage->SetOrientation( eOri );
     656             :                 }
     657             : 
     658           2 :                 nPageCnt = pDoc->GetSdPageCount(ePageKind);
     659             : 
     660           4 :                 for (i = 0; i < nPageCnt; i++)
     661             :                 {
     662           2 :                     SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
     663           2 :                     pPage->SetOrientation( eOri );
     664             :                 }
     665             :             }
     666             :             break;
     667             :         }
     668             :         case WID_PAGE_EFFECT:
     669             :         {
     670           0 :             sal_Int32 nEnum = 0;
     671           0 :             if(!::cppu::enum2int( nEnum, aValue ))
     672           0 :                 throw lang::IllegalArgumentException();
     673             : 
     674           0 :             GetPage()->SetFadeEffect( (presentation::FadeEffect)nEnum );
     675             :             break;
     676             :         }
     677             :         case WID_PAGE_BACK:
     678          28 :             setBackground( aValue );
     679          28 :             break;
     680             :         case WID_PAGE_SPEED:
     681             :         {
     682           0 :             sal_Int32 nEnum = 0;
     683           0 :             if(!::cppu::enum2int( nEnum, aValue ))
     684           0 :                 throw lang::IllegalArgumentException();
     685             : 
     686           0 :             GetPage()->setTransitionDuration( nEnum == 0 ? 3.0 : (nEnum == 1 ? 2.0 : 1.0 )  );
     687             :             break;
     688             :         }
     689             :         case WID_PAGE_VISIBLE :
     690             :         {
     691           8 :             sal_Bool    bVisible = sal_False;
     692           8 :             if( ! ( aValue >>= bVisible ) )
     693           0 :                 throw lang::IllegalArgumentException();
     694           8 :             GetPage()->SetExcluded( bVisible == sal_False );
     695             :             break;
     696             :         }
     697             :         case WID_PAGE_SOUNDFILE :
     698             :         {
     699           0 :             OUString aURL;
     700           0 :             if( aValue >>= aURL )
     701             :             {
     702           0 :                 GetPage()->SetSoundFile( aURL );
     703           0 :                 GetPage()->SetSound( !aURL.isEmpty() );
     704             :                 break;
     705             :             }
     706             :             else
     707             :             {
     708           0 :                 sal_Bool bStopSound = sal_False;
     709           0 :                 if( aValue >>= bStopSound )
     710             :                 {
     711           0 :                     GetPage()->SetStopSound( bStopSound ? true : false );
     712             :                     break;
     713             :                 }
     714             :             }
     715             : 
     716             : 
     717           0 :             throw lang::IllegalArgumentException();
     718             :         }
     719             :         case WID_LOOP_SOUND:
     720             :         {
     721           0 :             sal_Bool bLoop = sal_False;
     722           0 :             if( ! (aValue >>= bLoop) )
     723           0 :                 throw lang::IllegalArgumentException();
     724             : 
     725           0 :             GetPage()->SetLoopSound( bLoop ? true : false );
     726             :             break;
     727             :         }
     728             :         case WID_PAGE_BACKFULL:
     729             :         {
     730           4 :             sal_Bool    bFullSize = sal_False;
     731           4 :             if( ! ( aValue >>= bFullSize ) )
     732           0 :                 throw lang::IllegalArgumentException();
     733           4 :             GetPage()->SetBackgroundFullSize( bFullSize );
     734             :             break;
     735             :         }
     736             :         case WID_PAGE_BACKVIS:
     737             :         {
     738          16 :             sal_Bool bVisible = sal_False;
     739          16 :             if( ! ( aValue >>= bVisible ) )
     740           0 :                 throw lang::IllegalArgumentException();
     741             : 
     742          16 :             SdrPage* pPage = GetPage();
     743          16 :             if( pPage )
     744             :             {
     745          16 :                 SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
     746          16 :                 if( pDoc->GetMasterPageCount() )
     747             :                 {
     748          16 :                     SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
     749          16 :                     SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
     750          16 :                     aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False), bVisible);
     751          16 :                     pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
     752             :                 }
     753             :             }
     754             :             break;
     755             :         }
     756             :         case WID_PAGE_BACKOBJVIS:
     757             :         {
     758          16 :             sal_Bool bVisible = sal_False;
     759          16 :             if( ! ( aValue >>= bVisible ) )
     760           0 :                 throw lang::IllegalArgumentException();
     761             : 
     762          16 :             SdrPage* pPage = GetPage();
     763          16 :             if( pPage )
     764             :             {
     765          16 :                 SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
     766          16 :                 if( pDoc->GetMasterPageCount() )
     767             :                 {
     768          16 :                     SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
     769          16 :                     SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
     770          16 :                     aVisibleLayers.Set(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False), bVisible);
     771          16 :                     pPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers);
     772             :                 }
     773             :             }
     774             : 
     775             :             break;
     776             :         }
     777             :         case WID_PAGE_USERATTRIBS:
     778             :         {
     779           0 :             if( !GetPage()->setAlienAttributes( aValue ) )
     780           0 :                 throw lang::IllegalArgumentException();
     781           0 :             break;
     782             :         }
     783             :         case WID_PAGE_BOOKMARK:
     784             :         {
     785           0 :             OUString aBookmarkURL;
     786           0 :             if( ! ( aValue >>= aBookmarkURL ) )
     787           0 :                 throw lang::IllegalArgumentException();
     788             : 
     789           0 :             setBookmarkURL( aBookmarkURL );
     790           0 :             break;
     791             :         }
     792             : 
     793             :         case WID_PAGE_HEADERVISIBLE:
     794             :         case WID_PAGE_HEADERTEXT:
     795             :         case WID_PAGE_FOOTERVISIBLE:
     796             :         case WID_PAGE_FOOTERTEXT:
     797             :         case WID_PAGE_PAGENUMBERVISIBLE:
     798             :         case WID_PAGE_DATETIMEVISIBLE:
     799             :         case WID_PAGE_DATETIMEFIXED:
     800             :         case WID_PAGE_DATETIMETEXT:
     801             :         case WID_PAGE_DATETIMEFORMAT:
     802             :         {
     803         144 :             sd::HeaderFooterSettings aHeaderFooterSettings( GetPage()->getHeaderFooterSettings() );
     804             : 
     805         144 :             switch( pEntry->nWID )
     806             :             {
     807             :             case WID_PAGE_HEADERVISIBLE:
     808             :             {
     809          18 :                 sal_Bool bVisible = sal_False;
     810          18 :                 if( ! ( aValue >>= bVisible ) )
     811           0 :                     throw lang::IllegalArgumentException();
     812             : 
     813          18 :                 aHeaderFooterSettings.mbHeaderVisible = bVisible;
     814             :                 break;
     815             :             }
     816             :             case WID_PAGE_HEADERTEXT:
     817             :             {
     818           0 :                 OUString aText;
     819           0 :                 if( ! ( aValue >>= aText ) )
     820           0 :                     throw lang::IllegalArgumentException();
     821             : 
     822           0 :                 aHeaderFooterSettings.maHeaderText = aText;
     823           0 :                 break;
     824             :             }
     825             :             case WID_PAGE_FOOTERVISIBLE:
     826             :             {
     827          42 :                 sal_Bool bVisible = sal_False;
     828          42 :                 if( ! ( aValue >>= bVisible ) )
     829           0 :                     throw lang::IllegalArgumentException();
     830             : 
     831          42 :                 aHeaderFooterSettings.mbFooterVisible = bVisible;
     832             :                 break;
     833             :             }
     834             :             case WID_PAGE_FOOTERTEXT:
     835             :             {
     836           0 :                 OUString aText;
     837           0 :                 if( ! ( aValue >>= aText ) )
     838           0 :                     throw lang::IllegalArgumentException();
     839             : 
     840           0 :                 aHeaderFooterSettings.maFooterText = aText;
     841           0 :                 break;
     842             :             }
     843             :             case WID_PAGE_PAGENUMBERVISIBLE:
     844             :             {
     845          42 :                 sal_Bool bVisible = sal_False;
     846          42 :                 if( ! ( aValue >>= bVisible ) )
     847           0 :                     throw lang::IllegalArgumentException();
     848             : 
     849          42 :                 aHeaderFooterSettings.mbSlideNumberVisible = bVisible;
     850             :                 break;
     851             :             }
     852             :             case WID_PAGE_DATETIMEVISIBLE:
     853             :             {
     854          42 :                 sal_Bool bVisible = sal_False;
     855          42 :                 if( ! ( aValue >>= bVisible ) )
     856           0 :                     throw lang::IllegalArgumentException();
     857             : 
     858          42 :                 aHeaderFooterSettings.mbDateTimeVisible = bVisible;
     859             :                 break;
     860             :             }
     861             :             case WID_PAGE_DATETIMEFIXED:
     862             :             {
     863           0 :                 sal_Bool bVisible = sal_False;
     864           0 :                 if( ! ( aValue >>= bVisible ) )
     865           0 :                     throw lang::IllegalArgumentException();
     866             : 
     867           0 :                 aHeaderFooterSettings.mbDateTimeIsFixed = bVisible;
     868             :                 break;
     869             :             }
     870             :             case WID_PAGE_DATETIMETEXT:
     871             :             {
     872           0 :                 OUString aText;
     873           0 :                 if( ! ( aValue >>= aText ) )
     874           0 :                     throw lang::IllegalArgumentException();
     875             : 
     876           0 :                 aHeaderFooterSettings.maDateTimeText = aText;
     877           0 :                 break;
     878             :             }
     879             :             case WID_PAGE_DATETIMEFORMAT:
     880             :             {
     881           0 :                 sal_Int32 nValue = 0;
     882           0 :                 if( ! ( aValue >>= nValue ) )
     883           0 :                     throw lang::IllegalArgumentException();
     884             : 
     885           0 :                 aHeaderFooterSettings.meDateTimeFormat = nValue;
     886             :                 break;
     887             :             }
     888             :             }
     889             : 
     890         144 :             if( !(aHeaderFooterSettings == GetPage()->getHeaderFooterSettings()) )
     891          16 :                 GetPage()->setHeaderFooterSettings( aHeaderFooterSettings );
     892             : 
     893         144 :             break;
     894             :         }
     895             : 
     896             :         case WID_PAGE_NUMBER:
     897           0 :             if( (GetPage()->GetPageKind() == PK_HANDOUT) && !GetPage()->IsMasterPage() )
     898             :             {
     899           0 :                 if( !(aValue >>= mnTempPageNumber) )
     900           0 :                     throw lang::IllegalArgumentException();
     901             : 
     902           0 :                 break;
     903             :             }
     904           0 :             throw beans::PropertyVetoException();
     905             : 
     906             :         case WID_PAGE_LDBITMAP:
     907             :         case WID_PAGE_LDNAME:
     908             :         case WID_PAGE_ISDARK:
     909           0 :             throw beans::PropertyVetoException();
     910             : 
     911             :         case WID_TRANSITION_TYPE:
     912             :         {
     913           0 :             sal_Int16 nValue = 0;
     914           0 :             if( ! ( aValue >>= nValue ) )
     915           0 :                 throw lang::IllegalArgumentException();
     916             : 
     917           0 :             GetPage()->setTransitionType( nValue );
     918             :             break;
     919             :         }
     920             : 
     921             :         case WID_TRANSITION_SUBTYPE:
     922             :         {
     923           0 :             sal_Int16 nValue = 0;
     924           0 :             if( ! ( aValue >>= nValue ) )
     925           0 :                 throw lang::IllegalArgumentException();
     926             : 
     927           0 :             GetPage()->setTransitionSubtype( nValue );
     928             :             break;
     929             :         }
     930             : 
     931             :         case WID_TRANSITION_DIRECTION:
     932             :         {
     933           0 :             sal_Bool bValue = sal_False;
     934           0 :             if( ! ( aValue >>= bValue ) )
     935           0 :                 throw lang::IllegalArgumentException();
     936             : 
     937           0 :             GetPage()->setTransitionDirection( bValue );
     938             :             break;
     939             :         }
     940             : 
     941             :         case WID_TRANSITION_FADE_COLOR:
     942             :         {
     943           0 :             sal_Int32 nValue = 0;
     944           0 :             if( ! ( aValue >>= nValue ) )
     945           0 :                 throw lang::IllegalArgumentException();
     946             : 
     947           0 :             GetPage()->setTransitionFadeColor( nValue );
     948             :             break;
     949             :         }
     950             : 
     951             :         case WID_TRANSITION_DURATION:
     952             :         {
     953           0 :             double fValue = 0.0;
     954           0 :             if( ! ( aValue >>= fValue ) )
     955           0 :                 throw lang::IllegalArgumentException();
     956             : 
     957           0 :             GetPage()->setTransitionDuration( fValue );
     958             :             break;
     959             :         }
     960             : 
     961             :         default:
     962          18 :             throw beans::UnknownPropertyException();
     963             :     }
     964             : 
     965         352 :     GetModel()->SetModified();
     966         334 : }
     967             : 
     968           0 : Any SAL_CALL SdGenericDrawPage::getPropertyValue( const OUString& PropertyName )
     969             :     throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
     970             : {
     971           0 :     ::SolarMutexGuard aGuard;
     972             : 
     973           0 :     throwIfDisposed();
     974             : 
     975           0 :     uno::Any aAny;
     976             : 
     977           0 :     const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName);
     978             : 
     979           0 :     switch( pEntry ? pEntry->nWID : -1 )
     980             :     {
     981             :     case WID_NAVORDER:
     982           0 :         aAny = getNavigationOrder();
     983           0 :         break;
     984             :     case WID_PAGE_LEFT:
     985           0 :         aAny <<= (sal_Int32)( GetPage()->GetLftBorder() );
     986           0 :         break;
     987             :     case WID_PAGE_RIGHT:
     988           0 :         aAny <<= (sal_Int32)( GetPage()->GetRgtBorder() );
     989           0 :         break;
     990             :     case WID_PAGE_TOP:
     991           0 :         aAny <<= (sal_Int32)( GetPage()->GetUppBorder() );
     992           0 :         break;
     993             :     case WID_PAGE_BOTTOM:
     994           0 :         aAny <<= (sal_Int32)( GetPage()->GetLwrBorder() );
     995           0 :         break;
     996             :     case WID_PAGE_WIDTH:
     997           0 :         aAny <<= (sal_Int32)( GetPage()->GetSize().getWidth() );
     998           0 :         break;
     999             :     case WID_PAGE_HEIGHT:
    1000           0 :         aAny <<= (sal_Int32)( GetPage()->GetSize().getHeight() );
    1001           0 :         break;
    1002             :     case WID_PAGE_ORIENT:
    1003           0 :         aAny = ::cppu::int2enum( (sal_Int32)((GetPage()->GetOrientation() == ORIENTATION_PORTRAIT)? view::PaperOrientation_PORTRAIT: view::PaperOrientation_LANDSCAPE), ::getCppuType((const view::PaperOrientation*)0) );
    1004           0 :         break;
    1005             :     case WID_PAGE_EFFECT:
    1006           0 :         aAny = ::cppu::int2enum( (sal_Int32)GetPage()->GetFadeEffect(), ::getCppuType((const presentation::FadeEffect*)0) );
    1007           0 :         break;
    1008             :     case WID_PAGE_CHANGE:
    1009           0 :         aAny <<= (sal_Int32)( GetPage()->GetPresChange() );
    1010           0 :         break;
    1011             :     case WID_PAGE_SPEED:
    1012             :         {
    1013           0 :             const double fDuration = GetPage()->getTransitionDuration();
    1014           0 :             aAny = ::cppu::int2enum( fDuration < 2.0 ? 2 : (fDuration > 2.0 ? 0 : 1), ::getCppuType((const presentation::AnimationSpeed*)0) );
    1015             :         }
    1016           0 :         break;
    1017             :     case WID_PAGE_LAYOUT:
    1018           0 :         aAny <<= (sal_Int16)( GetPage()->GetAutoLayout() );
    1019           0 :         break;
    1020             :     case WID_PAGE_NUMBER:
    1021             :         {
    1022           0 :             const sal_uInt16 nPageNumber(GetPage()->GetPageNum());
    1023             : 
    1024           0 :             if(nPageNumber > 0)
    1025             :             {
    1026             :                 // for all other pages calculate the number
    1027           0 :                 aAny <<= (sal_Int16)((sal_uInt16)((nPageNumber-1)>>1) + 1);
    1028             :             }
    1029             :             else
    1030             :             {
    1031           0 :                 aAny <<= mnTempPageNumber;
    1032             :             }
    1033             :         }
    1034           0 :         break;
    1035             :     case WID_PAGE_DURATION:
    1036           0 :         aAny <<= (sal_Int32)(GetPage()->GetTime());
    1037           0 :         break;
    1038             :     case WID_PAGE_LDNAME:
    1039             :     {
    1040           0 :         const OUString aName( GetPage()->GetName() );
    1041           0 :         aAny <<= aName;
    1042           0 :         break;
    1043             :     }
    1044             :     case WID_PAGE_LDBITMAP:
    1045             :         {
    1046             :             Reference< awt::XBitmap > xBitmap(
    1047           0 :                 VCLUnoHelper::CreateBitmap( BitmapEx( SdResId( BMP_PAGE ) ) ) );
    1048           0 :             aAny <<= xBitmap;
    1049             :         }
    1050           0 :         break;
    1051             :     case WID_PAGE_BACK:
    1052           0 :         getBackground( aAny );
    1053           0 :         break;
    1054             :     case WID_PAGE_PREVIEW :
    1055             :         {
    1056           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1057           0 :             if ( pDoc )
    1058             :             {
    1059           0 :                 ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
    1060           0 :                 if ( pDocShell )
    1061             :                 {
    1062           0 :                     sal_uInt16 nPgNum = 0;
    1063           0 :                     sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
    1064           0 :                     sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
    1065           0 :                     while( nPgNum < nPageCount )
    1066             :                     {
    1067           0 :                         pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
    1068           0 :                         nPgNum++;
    1069             :                     }
    1070             :                     ::boost::shared_ptr<GDIMetaFile> pMetaFile =
    1071           0 :                         pDocShell->GetPreviewMetaFile();
    1072           0 :                     if ( pMetaFile )
    1073             :                     {
    1074           0 :                         Point   aPoint;
    1075           0 :                         Size    aSize( GetPage()->GetSize() );
    1076           0 :                         pMetaFile->AddAction( (MetaAction*) new MetaFillColorAction( COL_WHITE, sal_True ), 0 );
    1077           0 :                         pMetaFile->AddAction( (MetaAction*) new MetaRectAction( Rectangle( aPoint, aSize ) ), 1 );
    1078           0 :                         pMetaFile->SetPrefMapMode( MAP_100TH_MM );
    1079           0 :                         pMetaFile->SetPrefSize( aSize );
    1080             : 
    1081           0 :                         SvMemoryStream aDestStrm( 65535, 65535 );
    1082           0 :                         ConvertGDIMetaFileToWMF( *pMetaFile, aDestStrm, NULL, sal_False );
    1083           0 :                         Sequence<sal_Int8> aSeq( (sal_Int8*)aDestStrm.GetData(), aDestStrm.Tell() );
    1084           0 :                         aAny <<= aSeq;
    1085           0 :                     }
    1086             :                 }
    1087             :             }
    1088             :         }
    1089           0 :         break;
    1090             : 
    1091             :     case WID_PAGE_PREVIEWBITMAP :
    1092             :         {
    1093           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1094           0 :             if ( pDoc )
    1095             :             {
    1096           0 :                 ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
    1097           0 :                 if ( pDocShell )
    1098             :                 {
    1099           0 :                     sal_uInt16 nPgNum = 0;
    1100           0 :                     sal_uInt16 nPageCount = pDoc->GetSdPageCount( PK_STANDARD );
    1101           0 :                     sal_uInt16 nPageNumber = (sal_uInt16)( ( GetPage()->GetPageNum() - 1 ) >> 1 );
    1102           0 :                     while( nPgNum < nPageCount )
    1103             :                     {
    1104           0 :                         pDoc->SetSelected( pDoc->GetSdPage( nPgNum, PK_STANDARD ), nPgNum == nPageNumber );
    1105           0 :                         nPgNum++;
    1106             :                     }
    1107             :                     ::boost::shared_ptr<GDIMetaFile> pMetaFile =
    1108           0 :                         pDocShell->GetPreviewMetaFile();
    1109           0 :                     BitmapEx aBitmap;
    1110           0 :                     if ( pMetaFile && pMetaFile->CreateThumbnail( 160, /* magic value taken from GraphicHelper::getThumbnailFormatFromGDI_Impl() */
    1111           0 :                                                                   aBitmap ) )
    1112             :                     {
    1113           0 :                         SvMemoryStream aMemStream;
    1114           0 :                         aBitmap.GetBitmap().Write( aMemStream, sal_False, sal_False );
    1115           0 :                         uno::Sequence<sal_Int8> aSeq( (sal_Int8*)aMemStream.GetData(), aMemStream.Tell() );
    1116           0 :                         aAny <<= aSeq;
    1117           0 :                     }
    1118             :                 }
    1119             :             }
    1120             :         }
    1121           0 :         break;
    1122             : 
    1123             :     case WID_PAGE_VISIBLE :
    1124             :     {
    1125           0 :         sal_Bool bVisible = GetPage()->IsExcluded() == sal_False;
    1126           0 :         aAny <<= Any( &bVisible, ::getBooleanCppuType() );
    1127             :         break;
    1128             :     }
    1129             : 
    1130             :     case WID_PAGE_SOUNDFILE :
    1131             :     {
    1132           0 :         if( GetPage()->IsStopSound() )
    1133             :         {
    1134           0 :             aAny <<= sal_True;
    1135             :         }
    1136             :         else
    1137             :         {
    1138           0 :             OUString aURL;
    1139           0 :             if( GetPage()->IsSoundOn() )
    1140           0 :                 aURL = GetPage()->GetSoundFile();
    1141           0 :             aAny <<= aURL;
    1142             :         }
    1143           0 :         break;
    1144             :     }
    1145             :     case WID_LOOP_SOUND:
    1146             :     {
    1147           0 :         aAny <<= (sal_Bool)GetPage()->IsLoopSound();
    1148           0 :         break;
    1149             :     }
    1150             :     case WID_PAGE_BACKFULL:
    1151             :     {
    1152           0 :         sal_Bool bFullSize = GetPage()->IsBackgroundFullSize();
    1153           0 :         aAny = Any( &bFullSize, ::getBooleanCppuType() );
    1154             :         break;
    1155             :     }
    1156             :     case WID_PAGE_BACKVIS:
    1157             :     {
    1158           0 :         SdrPage* pPage = GetPage();
    1159           0 :         if( pPage )
    1160             :         {
    1161           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
    1162           0 :             if( pDoc->GetMasterPageCount() )
    1163             :             {
    1164           0 :                 SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
    1165           0 :                 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
    1166           0 :                 aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False));
    1167             :             }
    1168             :             else
    1169             :             {
    1170           0 :                 aAny <<= (sal_Bool)sal_False;
    1171             :             }
    1172             :         }
    1173           0 :         break;
    1174             :     }
    1175             :     case WID_PAGE_BACKOBJVIS:
    1176             :     {
    1177           0 :         SdrPage* pPage = GetPage();
    1178           0 :         if( pPage )
    1179             :         {
    1180           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)pPage->GetModel();
    1181           0 :             if( pDoc->GetMasterPageCount() )
    1182             :             {
    1183           0 :                 SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
    1184           0 :                 SetOfByte aVisibleLayers = pPage->TRG_GetMasterPageVisibleLayers();
    1185           0 :                 aAny <<= (sal_Bool)aVisibleLayers.IsSet(rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False));
    1186             :             }
    1187             :             else
    1188             :             {
    1189           0 :                 aAny <<= (sal_Bool)sal_False;
    1190             :             }
    1191             :         }
    1192           0 :         break;
    1193             :     }
    1194             :     case WID_PAGE_USERATTRIBS:
    1195             :     {
    1196           0 :         GetPage()->getAlienAttributes( aAny );
    1197           0 :         break;
    1198             :     }
    1199             :     case WID_PAGE_BOOKMARK:
    1200             :     {
    1201           0 :         aAny <<= getBookmarkURL();
    1202           0 :         break;
    1203             :     }
    1204             :     case WID_PAGE_ISDARK:
    1205             :     {
    1206           0 :         aAny <<= (sal_Bool)GetPage()->GetPageBackgroundColor().IsDark();
    1207           0 :         break;
    1208             :     }
    1209             :     case WID_PAGE_HEADERVISIBLE:
    1210           0 :         aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbHeaderVisible;
    1211           0 :         break;
    1212             :     case WID_PAGE_HEADERTEXT:
    1213             :         {
    1214           0 :             const OUString aText( GetPage()->getHeaderFooterSettings().maHeaderText );
    1215           0 :             aAny <<= aText;
    1216             :         }
    1217           0 :         break;
    1218             :     case WID_PAGE_FOOTERVISIBLE:
    1219           0 :         aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbFooterVisible;
    1220           0 :         break;
    1221             :     case WID_PAGE_FOOTERTEXT:
    1222             :         {
    1223           0 :             const OUString aText( GetPage()->getHeaderFooterSettings().maFooterText );
    1224           0 :             aAny <<= aText;
    1225             :         }
    1226           0 :         break;
    1227             :     case WID_PAGE_PAGENUMBERVISIBLE:
    1228           0 :         aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbSlideNumberVisible;
    1229           0 :         break;
    1230             :     case WID_PAGE_DATETIMEVISIBLE:
    1231           0 :         aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeVisible;
    1232           0 :         break;
    1233             :     case WID_PAGE_DATETIMEFIXED:
    1234           0 :         aAny <<= (sal_Bool)GetPage()->getHeaderFooterSettings().mbDateTimeIsFixed;
    1235           0 :         break;
    1236             :     case WID_PAGE_DATETIMETEXT:
    1237             :         {
    1238           0 :             const OUString aText( GetPage()->getHeaderFooterSettings().maDateTimeText );
    1239           0 :             aAny <<= aText;
    1240             :         }
    1241           0 :         break;
    1242             :     case WID_PAGE_DATETIMEFORMAT:
    1243           0 :         aAny <<= (sal_Int32)GetPage()->getHeaderFooterSettings().meDateTimeFormat;
    1244           0 :         break;
    1245             : 
    1246             :     case WID_TRANSITION_TYPE:
    1247           0 :         aAny <<= GetPage()->getTransitionType();
    1248           0 :         break;
    1249             : 
    1250             :     case WID_TRANSITION_SUBTYPE:
    1251           0 :         aAny <<= GetPage()->getTransitionSubtype();
    1252           0 :         break;
    1253             : 
    1254             :     case WID_TRANSITION_DIRECTION:
    1255           0 :         aAny <<= GetPage()->getTransitionDirection();
    1256           0 :         break;
    1257             : 
    1258             :     case WID_TRANSITION_FADE_COLOR:
    1259           0 :         aAny <<= GetPage()->getTransitionFadeColor();
    1260           0 :         break;
    1261             : 
    1262             :     case WID_TRANSITION_DURATION:
    1263           0 :         aAny <<= GetPage()->getTransitionDuration();
    1264           0 :         break;
    1265             : 
    1266             :     default:
    1267           0 :         throw beans::UnknownPropertyException();
    1268             :     }
    1269           0 :     return aAny;
    1270             : }
    1271             : 
    1272           0 : void SAL_CALL SdGenericDrawPage::addPropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1273           0 : void SAL_CALL SdGenericDrawPage::removePropertyChangeListener( const OUString& , const Reference< beans::XPropertyChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1274           0 : void SAL_CALL SdGenericDrawPage::addVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1275           0 : void SAL_CALL SdGenericDrawPage::removeVetoableChangeListener( const OUString& , const Reference< beans::XVetoableChangeListener >&  ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
    1276             : 
    1277             : // XMultiPropertySet
    1278          34 : void SAL_CALL SdGenericDrawPage::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues ) throw (beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, RuntimeException )
    1279             : {
    1280          34 :     if( aPropertyNames.getLength() != aValues.getLength() )
    1281           0 :         throw lang::IllegalArgumentException();
    1282             : 
    1283          34 :     const OUString* pNames = aPropertyNames.getConstArray();
    1284          34 :     const Any* pValues = aValues.getConstArray();
    1285          34 :     sal_uInt32 nCount = aValues.getLength();
    1286         156 :     while( nCount-- )
    1287             :     {
    1288             :         try
    1289             :         {
    1290          88 :             setPropertyValue( *pNames++, *pValues++ );
    1291             :         }
    1292           8 :         catch( beans::UnknownPropertyException& )
    1293             :         {
    1294             :             // ignore for multi property set
    1295             :             // todo: optimize this!
    1296             :         }
    1297             :     }
    1298          34 : }
    1299             : 
    1300           0 : Sequence< Any > SAL_CALL SdGenericDrawPage::getPropertyValues( const Sequence< OUString >& aPropertyNames ) throw (RuntimeException)
    1301             : {
    1302           0 :     const OUString* pNames = aPropertyNames.getConstArray();
    1303           0 :     sal_uInt32 nCount = aPropertyNames.getLength();
    1304           0 :     Sequence< Any > aValues( nCount );
    1305           0 :     Any* pValues = aValues.getArray();
    1306           0 :     while( nCount-- )
    1307             :     {
    1308           0 :         Any aValue;
    1309             :         try
    1310             :         {
    1311           0 :             aValue = getPropertyValue( *pNames++ );
    1312             :         }
    1313           0 :         catch( beans::UnknownPropertyException& )
    1314             :         {
    1315             :             // ignore for multi property set
    1316             :             // todo: optimize this!
    1317             :         }
    1318           0 :         *pValues++ = aValue;
    1319           0 :     }
    1320           0 :     return aValues;
    1321             : }
    1322             : 
    1323           0 : void SAL_CALL SdGenericDrawPage::addPropertiesChangeListener( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >&  ) throw (RuntimeException)
    1324             : {
    1325           0 : }
    1326             : 
    1327           0 : void SAL_CALL SdGenericDrawPage::removePropertiesChangeListener( const Reference< beans::XPropertiesChangeListener >&  ) throw (RuntimeException)
    1328             : {
    1329           0 : }
    1330             : 
    1331           0 : void SAL_CALL SdGenericDrawPage::firePropertiesChangeEvent( const Sequence< OUString >& , const Reference< beans::XPropertiesChangeListener >&  ) throw (RuntimeException)
    1332             : {
    1333           0 : }
    1334             : 
    1335        1678 : Reference< drawing::XShape >  SdGenericDrawPage::_CreateShape( SdrObject *pObj ) const throw()
    1336             : {
    1337             :     DBG_ASSERT( GetPage(), "SdGenericDrawPage::_CreateShape(), can't create shape for disposed page!" );
    1338             :     DBG_ASSERT( pObj, "SdGenericDrawPage::_CreateShape(), invalid call with pObj == 0!" );
    1339             : 
    1340        1678 :     if( GetPage() && pObj )
    1341             :     {
    1342        1678 :         PresObjKind eKind = GetPage()->GetPresObjKind(pObj);
    1343             : 
    1344        1678 :         SvxShape* pShape = NULL;
    1345             : 
    1346        1678 :         if(pObj->GetObjInventor() == SdrInventor)
    1347             :         {
    1348        1678 :             sal_uInt32 nInventor = pObj->GetObjIdentifier();
    1349        1678 :             switch( nInventor )
    1350             :             {
    1351             :             case OBJ_TITLETEXT:
    1352          38 :                 pShape = new SvxShapeText( pObj );
    1353          38 :                 if( GetPage()->GetPageKind() == PK_NOTES && GetPage()->IsMasterPage() )
    1354             :                 {
    1355             :                     // fake a empty PageShape if its a title shape on the master page
    1356           2 :                     pShape->SetShapeType("com.sun.star.presentation.PageShape");
    1357             :                 }
    1358             :                 else
    1359             :                 {
    1360          36 :                     pShape->SetShapeType("com.sun.star.presentation.TitleTextShape");
    1361             :                 }
    1362          38 :                 eKind = PRESOBJ_NONE;
    1363          38 :                 break;
    1364             :             case OBJ_OUTLINETEXT:
    1365          38 :                 pShape = new SvxShapeText( pObj );
    1366          38 :                 pShape->SetShapeType("com.sun.star.presentation.OutlinerShape");
    1367          38 :                 eKind = PRESOBJ_NONE;
    1368          38 :                 break;
    1369             :             }
    1370             :         }
    1371             : 
    1372        1678 :         Reference< drawing::XShape >  xShape( pShape );
    1373             : 
    1374        1678 :         if(!xShape.is())
    1375        1602 :             xShape = SvxFmDrawPage::_CreateShape( pObj );
    1376             : 
    1377             : 
    1378        1678 :         if( eKind != PRESOBJ_NONE )
    1379             :         {
    1380         112 :             OUString aShapeType("com.sun.star.presentation.");
    1381             : 
    1382         112 :             switch( eKind )
    1383             :             {
    1384             :             case PRESOBJ_TITLE:
    1385           0 :                 aShapeType += "TitleTextShape";
    1386           0 :                 break;
    1387             :             case PRESOBJ_OUTLINE:
    1388           0 :                 aShapeType += "OutlinerShape";
    1389           0 :                 break;
    1390             :             case PRESOBJ_TEXT:
    1391           6 :                 aShapeType += "SubtitleShape";
    1392           6 :                 break;
    1393             :             case PRESOBJ_GRAPHIC:
    1394           2 :                 aShapeType += "GraphicObjectShape";
    1395           2 :                 break;
    1396             :             case PRESOBJ_OBJECT:
    1397           2 :                 aShapeType += "OLE2Shape";
    1398           2 :                 break;
    1399             :             case PRESOBJ_CHART:
    1400           0 :                 aShapeType += "ChartShape";
    1401           0 :                 break;
    1402             :             case PRESOBJ_ORGCHART:
    1403           0 :                 aShapeType += "OrgChartShape";
    1404           0 :                 break;
    1405             :             case PRESOBJ_CALC:
    1406           0 :                 aShapeType += "CalcShape";
    1407           0 :                 break;
    1408             :             case PRESOBJ_TABLE:
    1409           0 :                 aShapeType += "TableShape";
    1410           0 :                 break;
    1411             :             case PRESOBJ_MEDIA:
    1412           0 :                 aShapeType += "MediaShape";
    1413           0 :                 break;
    1414             :             case PRESOBJ_PAGE:
    1415          18 :                 aShapeType += "PageShape";
    1416          18 :                 break;
    1417             :             case PRESOBJ_HANDOUT:
    1418          12 :                 aShapeType += "HandoutShape";
    1419          12 :                 break;
    1420             :             case PRESOBJ_NOTES:
    1421          20 :                 aShapeType += "NotesShape";
    1422          20 :                 break;
    1423             :             case PRESOBJ_FOOTER:
    1424          16 :                 aShapeType += "FooterShape";
    1425          16 :                 break;
    1426             :             case PRESOBJ_HEADER:
    1427           4 :                 aShapeType += "HeaderShape";
    1428           4 :                 break;
    1429             :             case PRESOBJ_SLIDENUMBER:
    1430          16 :                 aShapeType += "SlideNumberShape";
    1431          16 :                 break;
    1432             :             case PRESOBJ_DATETIME:
    1433          16 :                 aShapeType += "DateTimeShape";
    1434          16 :                 break;
    1435             :             case PRESOBJ_NONE:
    1436             :             case PRESOBJ_IMAGE:
    1437             :             case PRESOBJ_MAX:
    1438           0 :                 break;
    1439             :             }
    1440             : 
    1441         112 :             if( !pShape )
    1442         112 :                 pShape = SvxShape::getImplementation( xShape );
    1443             : 
    1444         112 :             if( pShape )
    1445         112 :                 pShape->SetShapeType( aShapeType );
    1446             :         }
    1447             : 
    1448             :         // SdXShape aggregiert SvxShape
    1449        1678 :         new SdXShape( SvxShape::getImplementation( xShape ), GetModel() );
    1450        1678 :         return xShape;
    1451             :     }
    1452             :     else
    1453             :     {
    1454           0 :         return SvxFmDrawPage::_CreateShape( pObj );
    1455             :     }
    1456             : 
    1457             : }
    1458             : 
    1459             : //----------------------------------------------------------------------
    1460             : 
    1461             : // XServiceInfo
    1462          30 : Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
    1463             :     throw(uno::RuntimeException)
    1464             : {
    1465          30 :     Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
    1466             :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
    1467             :                                                   "com.sun.star.document.LinkTarget",
    1468          30 :                                                   "com.sun.star.document.LinkTargetSupplier");
    1469          30 :     return aSeq;
    1470             : }
    1471             : 
    1472             : //----------------------------------------------------------------------
    1473             : 
    1474             : // XLinkTargetSupplier
    1475           0 : Reference< container::XNameAccess > SAL_CALL SdGenericDrawPage::getLinks(  )
    1476             :     throw(uno::RuntimeException)
    1477             : {
    1478           0 :     return new SdPageLinkTargets( (SdGenericDrawPage*)this );
    1479             : }
    1480             : 
    1481             : //----------------------------------------------------------------------
    1482             : 
    1483           0 : void SdGenericDrawPage::setBackground( const Any& ) throw(lang::IllegalArgumentException)
    1484             : {
    1485             :     OSL_FAIL( "Don't call me, I'm useless!" );
    1486           0 : }
    1487             : 
    1488             : //----------------------------------------------------------------------
    1489             : 
    1490           0 : void SdGenericDrawPage::getBackground( Any& ) throw()
    1491             : {
    1492             :     OSL_FAIL( "Don't call me, I'm useless!" );
    1493           0 : }
    1494             : 
    1495             : //----------------------------------------------------------------------
    1496             : 
    1497           0 : OUString SdGenericDrawPage::getBookmarkURL() const
    1498             : {
    1499           0 :     OUStringBuffer aRet;
    1500           0 :     if( SvxFmDrawPage::mpPage )
    1501             :     {
    1502           0 :         OUString aFileName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetFileName() );
    1503           0 :         if( !aFileName.isEmpty() )
    1504             :         {
    1505           0 :             const OUString aBookmarkName( SdDrawPage::getPageApiNameFromUiName( static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetBookmarkName() ) );
    1506           0 :             aRet.append( aFileName );
    1507           0 :             aRet.append( (sal_Unicode)'#' );
    1508           0 :             aRet.append( aBookmarkName );
    1509           0 :         }
    1510             :     }
    1511             : 
    1512           0 :     return aRet.makeStringAndClear();
    1513             : }
    1514             : 
    1515             : //----------------------------------------------------------------------
    1516           0 : void SdGenericDrawPage::setBookmarkURL( rtl::OUString& rURL )
    1517             : {
    1518           0 :     if( SvxFmDrawPage::mpPage )
    1519             :     {
    1520           0 :         sal_Int32 nIndex = rURL.indexOf( (sal_Unicode)'#' );
    1521           0 :         if( nIndex != -1 )
    1522             :         {
    1523           0 :             const String aFileName( rURL.copy( 0, nIndex ) );
    1524           0 :             const String aBookmarkName( SdDrawPage::getUiNameFromPageApiName( rURL.copy( nIndex+1 )  ) );
    1525             : 
    1526           0 :             if( aFileName.Len() && aBookmarkName.Len() )
    1527             :             {
    1528           0 :                 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->DisconnectLink();
    1529           0 :                 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetFileName( aFileName );
    1530           0 :                 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->SetBookmarkName( aBookmarkName );
    1531           0 :                 static_cast<SdPage*>(SvxFmDrawPage::mpPage)->ConnectLink();
    1532           0 :             }
    1533             :         }
    1534             :     }
    1535           0 : }
    1536             : 
    1537             : //----------------------------------------------------------------------
    1538           0 : Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::combine( const Reference< drawing::XShapes >& xShapes )
    1539             :     throw( uno::RuntimeException )
    1540             : {
    1541           0 :     ::SolarMutexGuard aGuard;
    1542             : 
    1543           0 :     throwIfDisposed();
    1544             : 
    1545             :     DBG_ASSERT(SvxFmDrawPage::mpPage,"SdrPage ist NULL! [CL]");
    1546             :     DBG_ASSERT(mpView, "SdrView ist NULL! [CL]");
    1547             : 
    1548           0 :     Reference< drawing::XShape > xShape;
    1549           0 :     if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
    1550             :         return xShape;
    1551             : 
    1552           0 :     SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
    1553             : 
    1554           0 :     _SelectObjectsInView( xShapes, pPageView );
    1555             : 
    1556           0 :     mpView->CombineMarkedObjects( sal_False );
    1557             : 
    1558           0 :     mpView->AdjustMarkHdl();
    1559           0 :     const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
    1560           0 :     if( rMarkList.GetMarkCount() == 1 )
    1561             :     {
    1562           0 :         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
    1563           0 :         if( pObj )
    1564           0 :             xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
    1565             :     }
    1566             : 
    1567           0 :     mpView->HideSdrPage();
    1568             : 
    1569           0 :     GetModel()->SetModified();
    1570             : 
    1571           0 :     return xShape;
    1572             : }
    1573             : 
    1574             : //----------------------------------------------------------------------
    1575           0 : void SAL_CALL SdGenericDrawPage::split( const Reference< drawing::XShape >& xGroup )
    1576             :     throw( uno::RuntimeException )
    1577             : {
    1578           0 :     ::SolarMutexGuard aGuard;
    1579             : 
    1580           0 :     throwIfDisposed();
    1581             : 
    1582           0 :     if(mpView==NULL||!xGroup.is()||GetPage()==NULL)
    1583           0 :         return;
    1584             : 
    1585           0 :     SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
    1586           0 :     _SelectObjectInView( xGroup, pPageView );
    1587           0 :     mpView->DismantleMarkedObjects( sal_False );
    1588           0 :     mpView->HideSdrPage();
    1589             : 
    1590           0 :     GetModel()->SetModified();
    1591             : }
    1592             : 
    1593             : //----------------------------------------------------------------------
    1594           0 : Reference< drawing::XShape > SAL_CALL SdGenericDrawPage::bind( const Reference< drawing::XShapes >& xShapes )
    1595             :     throw( uno::RuntimeException )
    1596             : {
    1597           0 :     ::SolarMutexGuard aGuard;
    1598             : 
    1599           0 :     throwIfDisposed();
    1600             : 
    1601           0 :     uno::Reference< drawing::XShape > xShape;
    1602           0 :     if(mpView==NULL||!xShapes.is()||GetPage()==NULL)
    1603             :         return xShape;
    1604             : 
    1605           0 :     SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
    1606             : 
    1607           0 :     _SelectObjectsInView( xShapes, pPageView );
    1608             : 
    1609           0 :     mpView->CombineMarkedObjects( sal_True );
    1610             : 
    1611           0 :     mpView->AdjustMarkHdl();
    1612           0 :     const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
    1613           0 :     if( rMarkList.GetMarkCount() == 1 )
    1614             :     {
    1615           0 :         SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
    1616           0 :         if( pObj )
    1617           0 :             xShape = Reference< drawing::XShape >::query( pObj->getUnoShape() );
    1618             :     }
    1619             : 
    1620           0 :     mpView->HideSdrPage();
    1621             : 
    1622           0 :     GetModel()->SetModified();
    1623             : 
    1624           0 :     return xShape;
    1625             : }
    1626             : 
    1627             : //----------------------------------------------------------------------
    1628           0 : void SAL_CALL SdGenericDrawPage::unbind( const Reference< drawing::XShape >& xShape )
    1629             :     throw( uno::RuntimeException )
    1630             : {
    1631           0 :     ::SolarMutexGuard aGuard;
    1632             : 
    1633           0 :     throwIfDisposed();
    1634             : 
    1635           0 :     if(mpView==NULL||!xShape.is()||GetPage()==NULL)
    1636           0 :         return;
    1637             : 
    1638           0 :     SdrPageView* pPageView = mpView->ShowSdrPage( GetPage() );
    1639           0 :     _SelectObjectInView( xShape, pPageView );
    1640           0 :     mpView->DismantleMarkedObjects( sal_True );
    1641           0 :     mpView->HideSdrPage();
    1642             : 
    1643           0 :     GetModel()->SetModified();
    1644             : }
    1645             : 
    1646           8 : void SdGenericDrawPage::SetLftBorder( sal_Int32 nValue )
    1647             : {
    1648           8 :     if( nValue != GetPage()->GetLftBorder() )
    1649             :     {
    1650           2 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1651           2 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1652             : 
    1653           2 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1654           4 :         for (i = 0; i < nPageCnt; i++)
    1655             :         {
    1656           2 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1657           2 :             pPage->SetLftBorder( nValue );
    1658             :         }
    1659             : 
    1660           2 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1661             : 
    1662           4 :         for (i = 0; i < nPageCnt; i++)
    1663             :         {
    1664           2 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1665           2 :             pPage->SetLftBorder( nValue );
    1666             :         }
    1667             :     }
    1668           8 : }
    1669             : 
    1670           8 : void SdGenericDrawPage::SetRgtBorder( sal_Int32 nValue )
    1671             : {
    1672           8 :     if( nValue != GetPage()->GetRgtBorder() )
    1673             :     {
    1674           2 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1675           2 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1676             : 
    1677           2 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1678           4 :         for (i = 0; i < nPageCnt; i++)
    1679             :         {
    1680           2 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1681           2 :             pPage->SetRgtBorder( nValue );
    1682             :         }
    1683             : 
    1684           2 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1685             : 
    1686           4 :         for (i = 0; i < nPageCnt; i++)
    1687             :         {
    1688           2 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1689           2 :             pPage->SetRgtBorder( nValue );
    1690             :         }
    1691             :     }
    1692           8 : }
    1693             : 
    1694           8 : void SdGenericDrawPage::SetUppBorder( sal_Int32 nValue )
    1695             : {
    1696           8 :     if( nValue != GetPage()->GetUppBorder() )
    1697             :     {
    1698           2 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1699           2 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1700             : 
    1701           2 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1702           4 :         for (i = 0; i < nPageCnt; i++)
    1703             :         {
    1704           2 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1705           2 :             pPage->SetUppBorder( nValue );
    1706             :         }
    1707             : 
    1708           2 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1709             : 
    1710           4 :         for (i = 0; i < nPageCnt; i++)
    1711             :         {
    1712           2 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1713           2 :             pPage->SetUppBorder( nValue );
    1714             :         }
    1715             :     }
    1716           8 : }
    1717             : 
    1718           8 : void SdGenericDrawPage::SetLwrBorder( sal_Int32 nValue )
    1719             : {
    1720           8 :     if( nValue != GetPage()->GetLwrBorder() )
    1721             :     {
    1722           2 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1723           2 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1724             : 
    1725           2 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1726           4 :         for (i = 0; i < nPageCnt; i++)
    1727             :         {
    1728           2 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1729           2 :             pPage->SetLwrBorder( nValue );
    1730             :         }
    1731             : 
    1732           2 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1733             : 
    1734           4 :         for (i = 0; i < nPageCnt; i++)
    1735             :         {
    1736           2 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1737           2 :             pPage->SetLwrBorder( nValue );
    1738             :         }
    1739             :     }
    1740           8 : }
    1741             : 
    1742          24 : static void refreshpage( SdDrawDocument* pDoc, const PageKind ePageKind )
    1743             : {
    1744          24 :     ::sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
    1745          24 :     if ( pDocShell )
    1746             :     {
    1747          24 :         ::sd::ViewShell* pViewSh = pDocShell->GetViewShell();
    1748             : 
    1749          24 :         if( pViewSh )
    1750             :         {
    1751           0 :             if( pViewSh->ISA(::sd::DrawViewShell ) )
    1752           0 :                 static_cast< ::sd::DrawViewShell*>(pViewSh)->ResetActualPage();
    1753             : 
    1754           0 :             Size aPageSize = pDoc->GetSdPage(0, ePageKind)->GetSize();
    1755           0 :             const long nWidth = aPageSize.Width();
    1756           0 :             const long nHeight = aPageSize.Height();
    1757             : 
    1758           0 :             Point aPageOrg = Point(nWidth, nHeight / 2);
    1759           0 :             Size aViewSize = Size(nWidth * 3, nHeight * 2);
    1760             : 
    1761           0 :             pDoc->SetMaxObjSize(aViewSize);
    1762             : 
    1763           0 :             pViewSh->InitWindows(aPageOrg, aViewSize, Point(-1, -1), sal_True);
    1764             : 
    1765           0 :             pViewSh->UpdateScrollBars();
    1766             :         }
    1767             :     }
    1768          24 : }
    1769             : 
    1770          26 : void SdGenericDrawPage::SetWidth( sal_Int32 nWidth )
    1771             : {
    1772          26 :     Size aSize( GetPage()->GetSize() );
    1773          26 :     if( aSize.getWidth() != nWidth )
    1774             :     {
    1775          12 :         aSize.setWidth( nWidth );
    1776             : 
    1777          12 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1778          12 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1779             : 
    1780          12 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1781          24 :         for (i = 0; i < nPageCnt; i++)
    1782             :         {
    1783          12 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1784          12 :             pPage->SetSize(aSize);
    1785             :         }
    1786             : 
    1787          12 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1788             : 
    1789          24 :         for (i = 0; i < nPageCnt; i++)
    1790             :         {
    1791          12 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1792          12 :             pPage->SetSize(aSize);
    1793             :         }
    1794             : 
    1795          12 :         refreshpage( pDoc, ePageKind );
    1796             :     }
    1797          26 : }
    1798             : 
    1799          26 : void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
    1800             : {
    1801          26 :     Size aSize( GetPage()->GetSize() );
    1802          26 :     if( aSize.getHeight() != nHeight )
    1803             :     {
    1804          12 :         aSize.setHeight( nHeight );
    1805             : 
    1806          12 :         SdDrawDocument* pDoc = (SdDrawDocument*)GetPage()->GetModel();
    1807          12 :         const PageKind ePageKind = GetPage()->GetPageKind();
    1808             : 
    1809          12 :         sal_uInt16 i, nPageCnt = pDoc->GetMasterSdPageCount(ePageKind);
    1810          24 :         for (i = 0; i < nPageCnt; i++)
    1811             :         {
    1812          12 :             SdPage* pPage = pDoc->GetMasterSdPage(i, ePageKind);
    1813          12 :             pPage->SetSize(aSize);
    1814             :         }
    1815             : 
    1816          12 :         nPageCnt = pDoc->GetSdPageCount(ePageKind);
    1817             : 
    1818          24 :         for (i = 0; i < nPageCnt; i++)
    1819             :         {
    1820          12 :             SdPage* pPage = pDoc->GetSdPage(i, ePageKind);
    1821          12 :             pPage->SetSize(aSize);
    1822             :         }
    1823             : 
    1824          12 :         refreshpage( pDoc, ePageKind );
    1825             :     }
    1826          26 : }
    1827             : 
    1828             : // XInterface
    1829           0 : void SdGenericDrawPage::release() throw()
    1830             : {
    1831             : 
    1832           0 :     OWeakAggObject::release();
    1833           0 : }
    1834             : 
    1835             : // XComponent
    1836         118 : void SdGenericDrawPage::disposing() throw()
    1837             : {
    1838         118 :     mpModel = 0;
    1839         118 :     SvxFmDrawPage::disposing();
    1840         118 : }
    1841             : 
    1842             : // XAnimationNodeSupplier
    1843          80 : Reference< XAnimationNode > SAL_CALL SdGenericDrawPage::getAnimationNode() throw (uno::RuntimeException)
    1844             : {
    1845          80 :     ::SolarMutexGuard aGuard;
    1846             : 
    1847          80 :     throwIfDisposed();
    1848             : 
    1849          80 :     SdPage *pSdPage = static_cast<SdPage*>(SvxFmDrawPage::mpPage);
    1850             : 
    1851             : 
    1852          80 :     return pSdPage->getAnimationNode();
    1853             : }
    1854             : 
    1855             : //========================================================================
    1856             : // SdPageLinkTargets
    1857             : //========================================================================
    1858             : 
    1859           0 : SdPageLinkTargets::SdPageLinkTargets( SdGenericDrawPage* pUnoPage ) throw()
    1860             : {
    1861           0 :     mxPage = pUnoPage;
    1862           0 :     mpUnoPage = pUnoPage;
    1863           0 : }
    1864             : 
    1865           0 : SdPageLinkTargets::~SdPageLinkTargets() throw()
    1866             : {
    1867           0 : }
    1868             : 
    1869             :     // XElementAccess
    1870           0 : uno::Type SAL_CALL SdPageLinkTargets::getElementType()
    1871             :     throw(uno::RuntimeException)
    1872             : {
    1873           0 :     return ITYPE(beans::XPropertySet);
    1874             : }
    1875             : 
    1876           0 : sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
    1877             :     throw(uno::RuntimeException)
    1878             : {
    1879           0 :     ::SolarMutexGuard aGuard;
    1880             : 
    1881           0 :     SdPage* pPage = mpUnoPage->GetPage();
    1882           0 :     if( pPage != NULL )
    1883             :     {
    1884           0 :         SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
    1885             : 
    1886           0 :         while( aIter.IsMore() )
    1887             :         {
    1888           0 :             SdrObject* pObj = aIter.Next();
    1889           0 :             String aStr( pObj->GetName() );
    1890           0 :             if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
    1891           0 :                 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
    1892           0 :             if( aStr.Len() )
    1893           0 :                 return sal_True;
    1894           0 :         }
    1895             :     }
    1896             : 
    1897           0 :     return sal_False;
    1898             : }
    1899             : 
    1900             : // container::XNameAccess
    1901             : 
    1902             : // XNameAccess
    1903           0 : Any SAL_CALL SdPageLinkTargets::getByName( const OUString& aName )
    1904             :     throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
    1905             : {
    1906           0 :     ::SolarMutexGuard aGuard;
    1907             : 
    1908           0 :     SdPage* pPage = mpUnoPage->GetPage();
    1909           0 :     if( pPage != NULL )
    1910             :     {
    1911           0 :         SdrObject* pObj = FindObject( aName );
    1912           0 :         if( pObj )
    1913             :         {
    1914           0 :             Reference< beans::XPropertySet > aRef( pObj->getUnoShape(), uno::UNO_QUERY );
    1915           0 :             return makeAny( aRef );
    1916             :         }
    1917             :     }
    1918             : 
    1919           0 :     throw container::NoSuchElementException();
    1920             : }
    1921             : 
    1922           0 : Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
    1923             :     throw(uno::RuntimeException)
    1924             : {
    1925           0 :     ::SolarMutexGuard aGuard;
    1926             : 
    1927           0 :     sal_uInt32 nObjCount = 0;
    1928             : 
    1929           0 :     SdPage* pPage = mpUnoPage->GetPage();
    1930           0 :     if( pPage != NULL )
    1931             :     {
    1932           0 :         SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
    1933           0 :         while( aIter.IsMore() )
    1934             :         {
    1935           0 :             SdrObject* pObj = aIter.Next();
    1936           0 :             String aStr( pObj->GetName() );
    1937           0 :             if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
    1938           0 :                 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
    1939           0 :             if( aStr.Len() )
    1940           0 :                 nObjCount++;
    1941           0 :         }
    1942             :     }
    1943             : 
    1944           0 :     Sequence< OUString > aSeq( nObjCount );
    1945           0 :     if( nObjCount > 0 )
    1946             :     {
    1947           0 :         OUString* pStr = aSeq.getArray();
    1948             : 
    1949           0 :         SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
    1950           0 :         while( aIter.IsMore() )
    1951             :         {
    1952           0 :             SdrObject* pObj = aIter.Next();
    1953           0 :             String aStr( pObj->GetName() );
    1954           0 :             if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
    1955           0 :                 aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
    1956           0 :             if( aStr.Len() )
    1957           0 :                 *pStr++ = aStr;
    1958           0 :         }
    1959             :     }
    1960             : 
    1961           0 :     return aSeq;
    1962             : }
    1963             : 
    1964           0 : sal_Bool SAL_CALL SdPageLinkTargets::hasByName( const OUString& aName )
    1965             :     throw(uno::RuntimeException)
    1966             : {
    1967           0 :     ::SolarMutexGuard aGuard;
    1968             : 
    1969           0 :     return FindObject( aName ) != NULL;
    1970             : }
    1971             : 
    1972           0 : SdrObject* SdPageLinkTargets::FindObject( const String& rName ) const throw()
    1973             : {
    1974           0 :     SdPage* pPage = mpUnoPage->GetPage();
    1975           0 :     if( pPage == NULL )
    1976           0 :         return NULL;
    1977             : 
    1978           0 :     SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
    1979             : 
    1980           0 :     while( aIter.IsMore() )
    1981             :     {
    1982           0 :         SdrObject* pObj = aIter.Next();
    1983           0 :         String aStr( pObj->GetName() );
    1984           0 :         if( !aStr.Len() && pObj->ISA( SdrOle2Obj ) )
    1985           0 :             aStr = static_cast< const SdrOle2Obj* >( pObj )->GetPersistName();
    1986           0 :         if( aStr.Len() && (aStr == rName) )
    1987           0 :             return pObj;
    1988           0 :     }
    1989             : 
    1990           0 :     return NULL;
    1991             : }
    1992             : 
    1993             : // XServiceInfo
    1994           0 : OUString SAL_CALL SdPageLinkTargets::getImplementationName()
    1995             :     throw(uno::RuntimeException)
    1996             : {
    1997           0 :     return OUString( "SdPageLinkTargets" );
    1998             : }
    1999             : 
    2000           0 : sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
    2001             :     throw(uno::RuntimeException)
    2002             : {
    2003           0 :     return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
    2004             : }
    2005             : 
    2006           0 : Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
    2007             :     throw(uno::RuntimeException)
    2008             : {
    2009           0 :     const OUString aSN( "com.sun.star.document.LinkTargets" );
    2010           0 :     Sequence< OUString > aSeq( &aSN, 1);
    2011           0 :     return aSeq;
    2012             : }
    2013             : 
    2014             : //========================================================================
    2015             : // SdDrawPage
    2016             : //========================================================================
    2017             : 
    2018         108 : SdDrawPage::SdDrawPage(  SdXImpressDocument* pModel, SdPage* pPage ) throw()
    2019         108 : : SdGenericDrawPage( pModel, pPage, ImplGetDrawPagePropertySet( pModel->IsImpressDocument(), pPage->GetPageKind() ) )
    2020             : {
    2021         108 : }
    2022             : 
    2023         204 : SdDrawPage::~SdDrawPage() throw()
    2024             : {
    2025         204 : }
    2026             : 
    2027             : // XInterface
    2028        2484 : Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
    2029             :     throw(uno::RuntimeException)
    2030             : {
    2031        2484 :     if( rType == ITYPE( drawing::XMasterPageTarget ) )
    2032             :     {
    2033          26 :         return makeAny( Reference< drawing::XMasterPageTarget >( this ) );
    2034             :     }
    2035             :     else
    2036             :     {
    2037        2458 :         if( mbIsImpressDocument )
    2038             :         {
    2039        2458 :             const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
    2040             : 
    2041        2458 :             if( ePageKind != PK_HANDOUT && rType == ITYPE( presentation::XPresentationPage ) )
    2042             :             {
    2043          18 :                 return makeAny( Reference< presentation::XPresentationPage >( this ) );
    2044             :             }
    2045             :         }
    2046             :     }
    2047             : 
    2048        2440 :     return SdGenericDrawPage::queryInterface( rType );
    2049             : }
    2050             : 
    2051        7964 : void SAL_CALL SdDrawPage::acquire() throw()
    2052             : {
    2053        7964 :     SvxDrawPage::acquire();
    2054        7964 : }
    2055             : 
    2056        7958 : void SAL_CALL SdDrawPage::release() throw()
    2057             : {
    2058        7958 :     SvxDrawPage::release();
    2059        7958 : }
    2060             : 
    2061        3164 : UNO3_GETIMPLEMENTATION2_IMPL( SdDrawPage, SdGenericDrawPage );
    2062             : 
    2063             : // XTypeProvider
    2064           0 : Sequence< uno::Type > SAL_CALL SdDrawPage::getTypes() throw(uno::RuntimeException)
    2065             : {
    2066           0 :     ::SolarMutexGuard aGuard;
    2067             : 
    2068           0 :     throwIfDisposed();
    2069             : 
    2070           0 :     if( maTypeSequence.getLength() == 0 )
    2071             :     {
    2072           0 :         const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
    2073           0 :         sal_Bool bPresPage = mbIsImpressDocument && ePageKind != PK_HANDOUT;
    2074             : 
    2075             :         // Collect the types of this class.
    2076           0 :         ::std::vector<uno::Type> aTypes;
    2077           0 :         aTypes.reserve(13);
    2078           0 :         aTypes.push_back(ITYPE(drawing::XDrawPage));
    2079           0 :         aTypes.push_back(ITYPE(beans::XPropertySet));
    2080           0 :         aTypes.push_back(ITYPE(container::XNamed));
    2081           0 :         aTypes.push_back(ITYPE(drawing::XMasterPageTarget));
    2082           0 :         aTypes.push_back(ITYPE(lang::XServiceInfo));
    2083           0 :         aTypes.push_back(ITYPE(util::XReplaceable));
    2084           0 :         aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
    2085           0 :         aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
    2086           0 :         aTypes.push_back(ITYPE( drawing::XShapeBinder ));
    2087           0 :         aTypes.push_back(ITYPE( office::XAnnotationAccess ));
    2088           0 :         aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
    2089           0 :         if( bPresPage )
    2090           0 :             aTypes.push_back(ITYPE(presentation::XPresentationPage));
    2091           0 :         if( bPresPage && ePageKind == PK_STANDARD )
    2092           0 :             aTypes.push_back(ITYPE(XAnimationNodeSupplier));
    2093             : 
    2094             :         // Get types of base class.
    2095           0 :         const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
    2096           0 :         const sal_Int32 nBaseTypes = aBaseTypes.getLength();
    2097           0 :         const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
    2098             : 
    2099             :         // Join those types in a sequence.
    2100           0 :         maTypeSequence.realloc(aTypes.size() + nBaseTypes);
    2101           0 :         uno::Type* pTypes = maTypeSequence.getArray();
    2102           0 :         ::std::vector<uno::Type>::const_iterator iType;
    2103           0 :         for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
    2104           0 :             *pTypes++ = *iType;
    2105           0 :         for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
    2106           0 :             *pTypes++ = *pBaseTypes++;
    2107             :     }
    2108             : 
    2109           0 :     return maTypeSequence;
    2110             : }
    2111             : 
    2112             : namespace
    2113             : {
    2114             :     class theSdDrawPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdDrawPageImplementationId > {};
    2115             : }
    2116             : 
    2117           0 : Sequence< sal_Int8 > SAL_CALL SdDrawPage::getImplementationId() throw(uno::RuntimeException)
    2118             : {
    2119           0 :     return theSdDrawPageImplementationId::get().getSeq();
    2120             : }
    2121             : 
    2122           0 : OUString SdDrawPage::getPageApiName( SdPage* pPage )
    2123             : {
    2124           0 :     return ::getPageApiName( pPage );
    2125             : }
    2126             : 
    2127           0 : OUString getPageApiName( SdPage* pPage )
    2128             : {
    2129           0 :     OUString aPageName;
    2130             : 
    2131           0 :     if(pPage)
    2132             :     {
    2133           0 :         aPageName = pPage->GetRealName();
    2134             : 
    2135           0 :         if( aPageName.isEmpty() )
    2136             :         {
    2137           0 :             OUStringBuffer sBuffer;
    2138           0 :             sBuffer.appendAscii( sEmptyPageName );
    2139           0 :             const sal_Int32 nPageNum = ( ( pPage->GetPageNum() - 1 ) >> 1 ) + 1;
    2140           0 :             sBuffer.append( nPageNum );
    2141           0 :             aPageName = sBuffer.makeStringAndClear();
    2142             :         }
    2143             :     }
    2144             : 
    2145           0 :     return aPageName;
    2146             : }
    2147             : 
    2148             : 
    2149           0 : OUString getPageApiNameFromUiName( const String& rUIName )
    2150             : {
    2151           0 :     OUString aApiName;
    2152             : 
    2153           0 :     String aDefPageName(SdResId(STR_PAGE));
    2154           0 :     aDefPageName += sal_Unicode( ' ' );
    2155             : 
    2156           0 :     if( rUIName.Equals( aDefPageName, 0, aDefPageName.Len() ) )
    2157             :     {
    2158           0 :         aApiName = OUString( RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ) );
    2159           0 :         aApiName += rUIName.Copy( aDefPageName.Len() );
    2160             :     }
    2161             :     else
    2162             :     {
    2163           0 :         aApiName = rUIName;
    2164             :     }
    2165             : 
    2166           0 :     return aApiName;
    2167             : }
    2168             : 
    2169           0 : OUString SdDrawPage::getPageApiNameFromUiName( const String& rUIName )
    2170             : {
    2171           0 :     return ::getPageApiNameFromUiName( rUIName );
    2172             : }
    2173             : 
    2174           0 : String getUiNameFromPageApiNameImpl( const OUString& rApiName )
    2175             : {
    2176           0 :     const String aDefPageName(RTL_CONSTASCII_USTRINGPARAM( sEmptyPageName ));
    2177           0 :     if( rApiName.compareTo( aDefPageName, aDefPageName.Len() ) == 0 )
    2178             :     {
    2179           0 :         OUString aNumber( rApiName.copy( sizeof( sEmptyPageName ) - 1 ) );
    2180             : 
    2181             :         // create the page number
    2182           0 :         sal_Int32 nPageNumber = aNumber.toInt32();
    2183             : 
    2184             :         // check if there are non number characters in the number part
    2185           0 :         const sal_Int32 nChars = aNumber.getLength();
    2186           0 :         const sal_Unicode* pString = aNumber.getStr();
    2187             :         sal_Int32 nChar;
    2188           0 :         for( nChar = 0; nChar < nChars; nChar++, pString++ )
    2189             :         {
    2190           0 :             if((*pString < sal_Unicode('0')) || (*pString > sal_Unicode('9')))
    2191             :             {
    2192             :                 // found a non number character, so this is not the default
    2193             :                 // name for this page
    2194           0 :                 nPageNumber = -1;
    2195           0 :                 break;
    2196             :             }
    2197             :         }
    2198             : 
    2199           0 :         if( nPageNumber != -1)
    2200             :         {
    2201           0 :             OUStringBuffer sBuffer;
    2202           0 :             sBuffer.append( String(SdResId(STR_PAGE)) );
    2203           0 :             sBuffer.append( sal_Unicode( ' ' ) );
    2204           0 :             sBuffer.append( aNumber );
    2205           0 :             return sBuffer.makeStringAndClear();
    2206           0 :         }
    2207             :     }
    2208             : 
    2209           0 :     return rApiName;
    2210             : }
    2211             : 
    2212           0 : String SdDrawPage::getUiNameFromPageApiName( const OUString& rApiName )
    2213             : {
    2214           0 :     return getUiNameFromPageApiNameImpl( rApiName );
    2215             : }
    2216             : 
    2217             : // XServiceInfo
    2218           0 : OUString SAL_CALL SdDrawPage::getImplementationName() throw(uno::RuntimeException)
    2219             : {
    2220           0 :     return OUString( "SdDrawPage" );
    2221             : }
    2222             : 
    2223          16 : Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::RuntimeException)
    2224             : {
    2225          16 :     ::SolarMutexGuard aGuard;
    2226             : 
    2227          16 :     throwIfDisposed();
    2228             : 
    2229          16 :     Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
    2230          16 :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
    2231             : 
    2232          16 :     if( mbIsImpressDocument )
    2233          16 :         comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
    2234             : 
    2235          16 :     return aSeq;
    2236             : }
    2237             : 
    2238          16 : sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
    2239             :     throw(uno::RuntimeException)
    2240             : {
    2241          16 :     return SdGenericDrawPage::supportsService( ServiceName );
    2242             : }
    2243             : 
    2244             : // XNamed
    2245          20 : void SAL_CALL SdDrawPage::setName( const OUString& rName )
    2246             :     throw(uno::RuntimeException)
    2247             : {
    2248          20 :     ::SolarMutexGuard aGuard;
    2249             : 
    2250          20 :     throwIfDisposed();
    2251             : 
    2252             :     DBG_ASSERT( GetPage() && !GetPage()->IsMasterPage(), "Don't call base implementation for masterpages!" );
    2253             : 
    2254          20 :     OUString aName( rName );
    2255             : 
    2256          20 :     if(GetPage() && GetPage()->GetPageKind() != PK_NOTES)
    2257             :     {
    2258             :         // check if this is the default 'page1234' name
    2259          20 :         if(aName.compareToAscii( sEmptyPageName, sizeof( sEmptyPageName ) - 1 ) == 0)
    2260             :         {
    2261             :             // ok, it maybe is, first get the number part after 'page'
    2262          18 :             OUString aNumber( aName.copy( sizeof( sEmptyPageName ) - 1 ) );
    2263             : 
    2264             :             // create the page number
    2265          18 :             sal_Int32 nPageNumber = aNumber.toInt32();
    2266             : 
    2267             :             // check if there are non number characters in the number part
    2268          18 :             const sal_Int32 nChars = aNumber.getLength();
    2269          18 :             const sal_Unicode* pString = aNumber.getStr();
    2270             :             sal_Int32 nChar;
    2271          36 :             for( nChar = 0; nChar < nChars; nChar++, pString++ )
    2272             :             {
    2273          18 :                 if((*pString < '0') || (*pString > '9'))
    2274             :                 {
    2275             :                     // found a non number character, so this is not the default
    2276             :                     // name for this page
    2277           0 :                     nPageNumber = -1;
    2278           0 :                     break;
    2279             :                 }
    2280             :             }
    2281             : 
    2282          18 :             if( nPageNumber == ( ( GetPage()->GetPageNum() - 1 ) >> 1 ) + 1 )
    2283          18 :                 aName = OUString();
    2284             :         }
    2285             :         else
    2286             :         {
    2287           2 :             String aDefaultPageName( SdResId(STR_PAGE) );
    2288           2 :             aDefaultPageName += sal_Unicode( ' ' );
    2289           2 :             if( aName.compareTo( aDefaultPageName, aDefaultPageName.Len() ) == 0 )
    2290           0 :                 aName = OUString();
    2291             :         }
    2292             : 
    2293          20 :         GetPage()->SetName( aName );
    2294             : 
    2295          20 :         sal_uInt16 nNotesPageNum = (GetPage()->GetPageNum()-1)>>1;
    2296          20 :         if( GetModel()->GetDoc()->GetSdPageCount( PK_NOTES ) > nNotesPageNum )
    2297             :         {
    2298          20 :             SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( nNotesPageNum, PK_NOTES );
    2299          20 :             if( pNotesPage )
    2300          20 :                 pNotesPage->SetName(aName);
    2301             :         }
    2302             : 
    2303             :         // fake a mode change to repaint the page tab bar
    2304          20 :         ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
    2305          20 :         ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
    2306          20 :         if( pViewSh && pViewSh->ISA(::sd::DrawViewShell))
    2307             :         {
    2308             :             ::sd::DrawViewShell* pDrawViewSh = static_cast<
    2309           0 :                   ::sd::DrawViewShell*>(pViewSh);
    2310             : 
    2311           0 :             EditMode eMode = pDrawViewSh->GetEditMode();
    2312           0 :             if( eMode == EM_PAGE )
    2313             :             {
    2314           0 :                 sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
    2315             : 
    2316           0 :                 pDrawViewSh->ChangeEditMode( eMode, !bLayer );
    2317           0 :                 pDrawViewSh->ChangeEditMode( eMode, bLayer );
    2318             :             }
    2319             :         }
    2320             : 
    2321          20 :         GetModel()->SetModified();
    2322          20 :     }
    2323          20 : }
    2324             : 
    2325           0 : OUString SAL_CALL SdDrawPage::getName()
    2326             :     throw(uno::RuntimeException)
    2327             : {
    2328           0 :     ::SolarMutexGuard aGuard;
    2329             : 
    2330           0 :     throwIfDisposed();
    2331             : 
    2332           0 :     return getPageApiName( GetPage() );
    2333             : }
    2334             : 
    2335             : // XMasterPageTarget
    2336           0 : Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getMasterPage(  )
    2337             :     throw(uno::RuntimeException)
    2338             : {
    2339           0 :     ::SolarMutexGuard aGuard;
    2340             : 
    2341           0 :     throwIfDisposed();
    2342             : 
    2343           0 :     if(GetPage())
    2344             :     {
    2345           0 :         Reference< drawing::XDrawPages >    xPages( GetModel()->getMasterPages() );
    2346           0 :         Reference< drawing::XDrawPage > xPage;
    2347             : 
    2348           0 :         if(SvxFmDrawPage::mpPage->TRG_HasMasterPage())
    2349             :         {
    2350           0 :             SdrPage& rMasterPage = SvxFmDrawPage::mpPage->TRG_GetMasterPage();
    2351           0 :             xPage = uno::Reference< drawing::XDrawPage >( rMasterPage.getUnoPage(), uno::UNO_QUERY );
    2352             :         }
    2353             : 
    2354           0 :         return xPage;
    2355             :     }
    2356           0 :     return NULL;
    2357             : }
    2358             : 
    2359          26 : void SAL_CALL SdDrawPage::setMasterPage( const Reference< drawing::XDrawPage >& xMasterPage )
    2360             :     throw(uno::RuntimeException)
    2361             : {
    2362          26 :     ::SolarMutexGuard aGuard;
    2363             : 
    2364          26 :     throwIfDisposed();
    2365             : 
    2366          26 :     if(SvxFmDrawPage::mpPage)
    2367             :     {
    2368          26 :         SdMasterPage* pMasterPage = SdMasterPage::getImplementation( xMasterPage );
    2369          26 :         if( pMasterPage && pMasterPage->isValid() )
    2370             :         {
    2371          26 :             SvxFmDrawPage::mpPage->TRG_ClearMasterPage();
    2372             : 
    2373          26 :             SdPage* pSdPage = (SdPage*) pMasterPage->GetSdrPage();
    2374          26 :             SvxFmDrawPage::mpPage->TRG_SetMasterPage(*pSdPage);
    2375             : 
    2376          52 :             SvxFmDrawPage::mpPage->SetBorder(pSdPage->GetLftBorder(),pSdPage->GetUppBorder(),
    2377          78 :                               pSdPage->GetRgtBorder(),pSdPage->GetLwrBorder() );
    2378             : 
    2379          26 :             SvxFmDrawPage::mpPage->SetSize( pSdPage->GetSize() );
    2380          26 :             SvxFmDrawPage::mpPage->SetOrientation( pSdPage->GetOrientation() );
    2381          26 :             ((SdPage*)SvxFmDrawPage::mpPage)->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
    2382             : 
    2383             :             // set notes master also
    2384          26 :             SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
    2385             : 
    2386          26 :             pNotesPage->TRG_ClearMasterPage();
    2387          26 :             sal_uInt16 nNum = (SvxFmDrawPage::mpPage->TRG_GetMasterPage()).GetPageNum() + 1;
    2388          26 :             pNotesPage->TRG_SetMasterPage(*SvxFmDrawPage::mpPage->GetModel()->GetMasterPage(nNum));
    2389          26 :             pNotesPage->SetLayoutName( ( (SdPage*)pSdPage )->GetLayoutName() );
    2390             : 
    2391          26 :             GetModel()->SetModified();
    2392             :         }
    2393             : 
    2394          26 :     }
    2395          26 : }
    2396             : 
    2397             : // XPresentationPage
    2398          18 : Reference< drawing::XDrawPage > SAL_CALL SdDrawPage::getNotesPage()
    2399             :     throw(uno::RuntimeException)
    2400             : {
    2401          18 :     ::SolarMutexGuard aGuard;
    2402             : 
    2403          18 :     throwIfDisposed();
    2404             : 
    2405          18 :     if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() && SvxFmDrawPage::mpPage->GetPageNum() )
    2406             :     {
    2407          18 :         SdPage* pNotesPage = GetModel()->GetDoc()->GetSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
    2408          18 :         if( pNotesPage )
    2409             :         {
    2410          18 :             Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
    2411          18 :             return xPage;
    2412             :         }
    2413             :     }
    2414           0 :     return NULL;
    2415             : }
    2416             : 
    2417             : 
    2418             : // XIndexAccess
    2419         146 : sal_Int32 SAL_CALL SdDrawPage::getCount()
    2420             :     throw(uno::RuntimeException)
    2421             : {
    2422         146 :     return SdGenericDrawPage::getCount();
    2423             : }
    2424             : 
    2425         242 : Any SAL_CALL SdDrawPage::getByIndex( sal_Int32 Index )
    2426             :     throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
    2427             : {
    2428         242 :     return SdGenericDrawPage::getByIndex( Index );
    2429             : }
    2430             : 
    2431             : // XElementAccess
    2432           0 : uno::Type SAL_CALL SdDrawPage::getElementType()
    2433             :     throw(uno::RuntimeException)
    2434             : {
    2435           0 :     return SdGenericDrawPage::getElementType();
    2436             : }
    2437             : 
    2438           0 : sal_Bool SAL_CALL SdDrawPage::hasElements()
    2439             :     throw(uno::RuntimeException)
    2440             : {
    2441           0 :     return SdGenericDrawPage::hasElements();
    2442             : }
    2443             : 
    2444             : // XShapes
    2445         228 : void SAL_CALL SdDrawPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
    2446             : {
    2447         228 :     SdGenericDrawPage::add( xShape );
    2448         228 : }
    2449             : 
    2450          84 : void SAL_CALL SdDrawPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
    2451             : {
    2452          84 :     ::SolarMutexGuard aGuard;
    2453             : 
    2454          84 :     throwIfDisposed();
    2455             : 
    2456          84 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
    2457          84 :     if( pShape )
    2458             :     {
    2459          84 :         SdrObject* pObj = pShape->GetSdrObject();
    2460          84 :         if( pObj )
    2461             :         {
    2462          84 :             GetPage()->RemovePresObj(pObj);
    2463          84 :             pObj->SetUserCall(NULL);
    2464             :         }
    2465             :     }
    2466             : 
    2467          84 :     SdGenericDrawPage::remove( xShape );
    2468          84 : }
    2469             : 
    2470          18 : void SdDrawPage::setBackground( const Any& rValue )
    2471             :     throw( lang::IllegalArgumentException )
    2472             : {
    2473          18 :     Reference< beans::XPropertySet > xSet;
    2474             : 
    2475          18 :     if( !(rValue >>= xSet) && !rValue.hasValue() )
    2476           0 :         throw lang::IllegalArgumentException();
    2477             : 
    2478          18 :     if( !xSet.is() )
    2479             :     {
    2480             :         // the easy case, no background set. Set XFILL_NONE to represent this
    2481           0 :         GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
    2482          18 :         return;
    2483             :     }
    2484             : 
    2485             :     // is it our own implementation?
    2486          18 :     SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
    2487             : 
    2488          18 :     SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
    2489             : 
    2490          18 :     if( pBack )
    2491             :     {
    2492          18 :         pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
    2493             :     }
    2494             :     else
    2495             :     {
    2496           0 :         SdUnoPageBackground* pBackground = new SdUnoPageBackground();
    2497             : 
    2498           0 :         Reference< beans::XPropertySetInfo >  xSetInfo( xSet->getPropertySetInfo() );
    2499           0 :         Reference< beans::XPropertySet >  xDestSet( (beans::XPropertySet*)pBackground );
    2500           0 :         Reference< beans::XPropertySetInfo >  xDestSetInfo( xDestSet->getPropertySetInfo() );
    2501             : 
    2502           0 :         Sequence< beans::Property > aProperties( xDestSetInfo->getProperties() );
    2503           0 :         sal_Int32 nCount = aProperties.getLength();
    2504           0 :         beans::Property* pProp = aProperties.getArray();
    2505             : 
    2506           0 :         while( nCount-- )
    2507             :         {
    2508           0 :             const OUString aPropName( pProp->Name );
    2509           0 :             if( xSetInfo->hasPropertyByName( aPropName ) )
    2510           0 :                 xDestSet->setPropertyValue( aPropName,
    2511           0 :                         xSet->getPropertyValue( aPropName ) );
    2512             : 
    2513           0 :             pProp++;
    2514           0 :         }
    2515             : 
    2516           0 :         pBackground->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
    2517             :     }
    2518             : 
    2519          18 :     if( aSet.Count() == 0 )
    2520             :     {
    2521             :         // no background fill, represent by setting XFILL_NONE
    2522          18 :         GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
    2523             :     }
    2524             :     else
    2525             :     {
    2526             :         // background fill, set at page (not sure if ClearItem is needed)
    2527           0 :         GetPage()->getSdrPageProperties().ClearItem();
    2528           0 :         GetPage()->getSdrPageProperties().PutItemSet(aSet);
    2529             :     }
    2530             : 
    2531             :     // repaint only
    2532          18 :     SvxFmDrawPage::mpPage->ActionChanged();
    2533             : }
    2534             : 
    2535             : // XAnnotationAccess:
    2536           0 : Reference< XAnnotation > SAL_CALL SdGenericDrawPage::createAndInsertAnnotation() throw (RuntimeException)
    2537             : {
    2538           0 :     if( !GetPage() )
    2539           0 :         throw DisposedException();
    2540             : 
    2541           0 :     Reference< XAnnotation > xRet;
    2542           0 :     GetPage()->createAnnotation(xRet);
    2543           0 :     return xRet;
    2544             : }
    2545             : 
    2546           0 : void SAL_CALL SdGenericDrawPage::removeAnnotation(const Reference< XAnnotation > & annotation) throw (RuntimeException, IllegalArgumentException)
    2547             : {
    2548           0 :     GetPage()->removeAnnotation(annotation);
    2549           0 : }
    2550             : 
    2551           0 : Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotationEnumeration() throw (RuntimeException)
    2552             : {
    2553           0 :     return ::sd::createAnnotationEnumeration( GetPage()->getAnnotations() );
    2554             : }
    2555             : 
    2556           0 : void SdDrawPage::getBackground( Any& rValue ) throw()
    2557             : {
    2558           0 :     const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
    2559             : 
    2560           0 :        if(XFILL_NONE == ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
    2561             :     {
    2562             :         // no fill set (switched off by XFILL_NONE), clear rValue to represent this
    2563           0 :         rValue.clear();
    2564             :     }
    2565             :     else
    2566             :     {
    2567             :         // there is a fill set, export to rValue
    2568             :         Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
    2569           0 :             GetModel()->GetDoc(),
    2570           0 :             &GetPage()->getSdrPageProperties().GetItemSet()));
    2571           0 :         rValue <<= xSet;
    2572             :     }
    2573           0 : }
    2574             : 
    2575           0 : void SdGenericDrawPage::setNavigationOrder( const Any& rValue )
    2576             : {
    2577           0 :     Reference< XIndexAccess > xIA( rValue, UNO_QUERY );
    2578           0 :     if( xIA.is() )
    2579             :     {
    2580           0 :         if( dynamic_cast< SdDrawPage* >( xIA.get() ) == this )
    2581             :         {
    2582           0 :             if( GetPage()->HasObjectNavigationOrder() )
    2583           0 :                 GetPage()->ClearObjectNavigationOrder();
    2584             : 
    2585             :             return;
    2586             :         }
    2587           0 :         else if( xIA->getCount() == static_cast< sal_Int32 >( GetPage()->GetObjCount() ) )
    2588             :         {
    2589           0 :             GetPage()->SetNavigationOrder(xIA);
    2590             :             return;
    2591             :         }
    2592             :     }
    2593           0 :     throw IllegalArgumentException();
    2594             : }
    2595             : 
    2596           0 : class SdNavigationOrderAccess : public ::cppu::WeakImplHelper1< XIndexAccess >
    2597             : {
    2598             : public:
    2599             :     SdNavigationOrderAccess( SdrPage* pPage );
    2600             : 
    2601             :     // XIndexAccess
    2602             :     virtual sal_Int32 SAL_CALL getCount(  ) throw (RuntimeException);
    2603             :     virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
    2604             : 
    2605             :     // XElementAccess
    2606             :     virtual Type SAL_CALL getElementType(  ) throw (RuntimeException);
    2607             :     virtual sal_Bool SAL_CALL hasElements(  ) throw (RuntimeException);
    2608             : 
    2609             : private:
    2610             :     std::vector< Reference< XShape > > maShapes;
    2611             : };
    2612             : 
    2613           0 : SdNavigationOrderAccess::SdNavigationOrderAccess( SdrPage* pPage )
    2614           0 : : maShapes( static_cast< sal_uInt32 >( pPage ? pPage->GetObjCount() : 0 ) )
    2615             : {
    2616           0 :     if( pPage )
    2617             :     {
    2618             :         sal_uInt32 nIndex;
    2619           0 :         const sal_uInt32 nCount = static_cast< sal_uInt32 >( pPage->GetObjCount() );
    2620           0 :         for( nIndex = 0; nIndex < nCount; ++nIndex )
    2621             :         {
    2622           0 :             SdrObject* pObj = pPage->GetObj( nIndex );
    2623           0 :             sal_uInt32 nNavPos = pObj->GetNavigationPosition();
    2624             :             DBG_ASSERT( !maShapes[nNavPos].is(), "sd::SdNavigationOrderAccess::SdNavigationOrderAccess(), duplicate navigation positions from core!" );
    2625           0 :             maShapes[nNavPos] = Reference< XShape >( pObj->getUnoShape(), UNO_QUERY );
    2626             :         }
    2627             :     }
    2628           0 : }
    2629             : 
    2630             : // XIndexAccess
    2631           0 : sal_Int32 SAL_CALL SdNavigationOrderAccess::getCount(  ) throw (RuntimeException)
    2632             : {
    2633           0 :     return static_cast< sal_Int32 >( maShapes.size() );
    2634             : }
    2635             : 
    2636           0 : Any SAL_CALL SdNavigationOrderAccess::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
    2637             : {
    2638           0 :     if( (Index < 0) || (Index > getCount()) )
    2639           0 :         throw IndexOutOfBoundsException();
    2640             : 
    2641           0 :     return Any( maShapes[Index] );
    2642             : }
    2643             : 
    2644             : // XElementAccess
    2645           0 : Type SAL_CALL SdNavigationOrderAccess::getElementType(  ) throw (RuntimeException)
    2646             : {
    2647           0 :     return XShape::static_type();
    2648             : }
    2649             : 
    2650           0 : sal_Bool SAL_CALL SdNavigationOrderAccess::hasElements(  ) throw (RuntimeException)
    2651             : {
    2652           0 :     return maShapes.empty() ? sal_False : sal_True;
    2653             : }
    2654             : 
    2655           0 : Any SdGenericDrawPage::getNavigationOrder()
    2656             : {
    2657           0 :     if( GetPage()->HasObjectNavigationOrder() )
    2658             :     {
    2659           0 :         return Any( Reference< XIndexAccess >( new SdNavigationOrderAccess( GetPage() ) ) );
    2660             :     }
    2661             :     else
    2662             :     {
    2663           0 :         return Any( Reference< XIndexAccess >( this ) );
    2664             :     }
    2665             : }
    2666             : 
    2667             : //========================================================================
    2668             : // class SdMasterPage
    2669             : //========================================================================
    2670             : 
    2671          20 : SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
    2672          20 : : SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
    2673             : {
    2674          20 : }
    2675             : 
    2676          32 : SdMasterPage::~SdMasterPage() throw()
    2677             : {
    2678          32 : }
    2679             : 
    2680             : // XInterface
    2681         408 : Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
    2682             :     throw(uno::RuntimeException)
    2683             : {
    2684         408 :     ::SolarMutexGuard aGuard;
    2685             : 
    2686         408 :     throwIfDisposed();
    2687             : 
    2688         408 :     uno::Any aAny;
    2689             : 
    2690         408 :     if( rType == ITYPE( container::XIndexAccess ) )
    2691           0 :         aAny <<= Reference< container::XIndexAccess >((presentation::XPresentationPage*)(this));
    2692         408 :     else if( rType == ITYPE( container::XElementAccess ) )
    2693           0 :         aAny <<=  Reference< container::XElementAccess >((presentation::XPresentationPage*)(this));
    2694         408 :     else if( rType == ITYPE( container::XNamed ) )
    2695          38 :         aAny <<=  Reference< container::XNamed >(this);
    2696         374 :     else if( rType == ITYPE( presentation::XPresentationPage ) &&
    2697             :              ( mbIsImpressDocument &&
    2698           4 :                GetPage()  && GetPage()->GetPageKind() != PK_HANDOUT) )
    2699           2 :         aAny <<= Reference< presentation::XPresentationPage >( this );
    2700             :     else
    2701         368 :         return SdGenericDrawPage::queryInterface( rType );
    2702             : 
    2703          40 :     return aAny;
    2704             : }
    2705             : 
    2706        1426 : void SAL_CALL SdMasterPage::acquire() throw()
    2707             : {
    2708        1426 :     SvxDrawPage::acquire();
    2709        1426 : }
    2710             : 
    2711        1422 : void SAL_CALL SdMasterPage::release() throw()
    2712             : {
    2713        1422 :     SvxDrawPage::release();
    2714        1422 : }
    2715             : 
    2716         296 : UNO3_GETIMPLEMENTATION2_IMPL( SdMasterPage, SdGenericDrawPage );
    2717             : 
    2718             : // XTypeProvider
    2719           0 : Sequence< uno::Type > SAL_CALL SdMasterPage::getTypes() throw(uno::RuntimeException)
    2720             : {
    2721           0 :     ::SolarMutexGuard aGuard;
    2722             : 
    2723           0 :     throwIfDisposed();
    2724             : 
    2725           0 :     if( maTypeSequence.getLength() == 0 )
    2726             :     {
    2727           0 :         const PageKind ePageKind = GetPage() ? GetPage()->GetPageKind() : PK_STANDARD;
    2728           0 :         sal_Bool bPresPage = mbIsImpressDocument && SvxFmDrawPage::mpPage && ePageKind != PK_HANDOUT;
    2729             : 
    2730             :         // Collect the types of this class.
    2731           0 :         ::std::vector<uno::Type> aTypes;
    2732           0 :         aTypes.reserve(12);
    2733           0 :         aTypes.push_back(ITYPE(drawing::XDrawPage));
    2734           0 :         aTypes.push_back(ITYPE(beans::XPropertySet));
    2735           0 :         aTypes.push_back(ITYPE(container::XNamed));
    2736           0 :         aTypes.push_back(ITYPE(lang::XServiceInfo));
    2737           0 :         aTypes.push_back(ITYPE(util::XReplaceable));
    2738           0 :         aTypes.push_back(ITYPE(document::XLinkTargetSupplier));
    2739           0 :         aTypes.push_back(ITYPE( drawing::XShapeCombiner ));
    2740           0 :         aTypes.push_back(ITYPE( drawing::XShapeBinder ));
    2741           0 :         aTypes.push_back(ITYPE( office::XAnnotationAccess ));
    2742           0 :         aTypes.push_back(ITYPE( beans::XMultiPropertySet ));
    2743           0 :         if( bPresPage )
    2744           0 :             aTypes.push_back(ITYPE(presentation::XPresentationPage));
    2745           0 :         if( bPresPage && ePageKind == PK_STANDARD )
    2746           0 :             aTypes.push_back(ITYPE(XAnimationNodeSupplier));
    2747             : 
    2748             :         // Get types of base class.
    2749           0 :         const Sequence< uno::Type > aBaseTypes( SdGenericDrawPage::getTypes() );
    2750           0 :         const sal_Int32 nBaseTypes = aBaseTypes.getLength();
    2751           0 :         const uno::Type* pBaseTypes = aBaseTypes.getConstArray();
    2752             : 
    2753             :         // Join those types in a sequence.
    2754           0 :         maTypeSequence.realloc(aTypes.size() + nBaseTypes);
    2755           0 :         uno::Type* pTypes = maTypeSequence.getArray();
    2756           0 :         ::std::vector<uno::Type>::const_iterator iType;
    2757           0 :         for (iType=aTypes.begin(); iType!=aTypes.end(); ++iType)
    2758           0 :             *pTypes++ = *iType;
    2759           0 :         for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ )
    2760           0 :             *pTypes++ = *pBaseTypes++;
    2761             :     }
    2762             : 
    2763           0 :     return maTypeSequence;
    2764             : }
    2765             : 
    2766             : namespace
    2767             : {
    2768             :     class theSdMasterPageImplementationId : public rtl::Static< UnoTunnelIdInit, theSdMasterPageImplementationId > {};
    2769             : }
    2770             : 
    2771           0 : Sequence< sal_Int8 > SAL_CALL SdMasterPage::getImplementationId() throw(uno::RuntimeException)
    2772             : {
    2773           0 :     return theSdMasterPageImplementationId::get().getSeq();
    2774             : }
    2775             : 
    2776             : // XServiceInfo
    2777           0 : OUString SAL_CALL SdMasterPage::getImplementationName() throw(uno::RuntimeException)
    2778             : {
    2779           0 :     return OUString( "SdMasterPage" );
    2780             : }
    2781             : 
    2782          14 : Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno::RuntimeException)
    2783             : {
    2784          14 :     ::SolarMutexGuard aGuard;
    2785             : 
    2786          14 :     throwIfDisposed();
    2787             : 
    2788          14 :     Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
    2789          14 :     comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
    2790             : 
    2791          14 :     if( SvxFmDrawPage::mpPage && ((SdPage*)SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
    2792          12 :         comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
    2793             : 
    2794          14 :     return aSeq;
    2795             : }
    2796             : 
    2797          14 : sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
    2798             :     throw(uno::RuntimeException)
    2799             : {
    2800          14 :     return SdGenericDrawPage::supportsService( ServiceName );
    2801             : }
    2802             : 
    2803             : // XElementAccess
    2804           0 : sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException)
    2805             : {
    2806           0 :     ::SolarMutexGuard aGuard;
    2807             : 
    2808           0 :     throwIfDisposed();
    2809             : 
    2810           0 :     if( SvxFmDrawPage::mpPage == NULL )
    2811           0 :         return sal_False;
    2812             : 
    2813           0 :     return SvxFmDrawPage::mpPage->GetObjCount() > 0;
    2814             : }
    2815             : 
    2816           0 : uno::Type SAL_CALL SdMasterPage::getElementType()
    2817             :     throw(uno::RuntimeException)
    2818             : {
    2819           0 :     return SdGenericDrawPage::getElementType();
    2820             : }
    2821             : 
    2822             : // XIndexAccess
    2823         108 : sal_Int32 SAL_CALL SdMasterPage::getCount()
    2824             :     throw(uno::RuntimeException)
    2825             : {
    2826         108 :     ::SolarMutexGuard aGuard;
    2827             : 
    2828         108 :     throwIfDisposed();
    2829             : 
    2830         108 :     return SdGenericDrawPage::getCount();
    2831             : }
    2832             : 
    2833          92 : Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
    2834             :     throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
    2835             : {
    2836          92 :     ::SolarMutexGuard aGuard;
    2837             : 
    2838          92 :     throwIfDisposed();
    2839             : 
    2840          92 :     return SdGenericDrawPage::getByIndex(Index);
    2841             : }
    2842             : 
    2843             : // intern
    2844          10 : void SdMasterPage::setBackground( const Any& rValue )
    2845             :     throw( lang::IllegalArgumentException )
    2846             : {
    2847             :     // we need at least an beans::XPropertySet
    2848          10 :     Reference< beans::XPropertySet > xInputSet( rValue, UNO_QUERY );
    2849          10 :     if( !xInputSet.is() )
    2850           0 :         throw lang::IllegalArgumentException();
    2851             : 
    2852             :     try
    2853             :     {
    2854          10 :         if( GetModel() && mbIsImpressDocument )
    2855             :         {
    2856          10 :             Reference< container::XNameAccess >  xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
    2857          10 :             Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW ) ;
    2858          10 :             if( xFamily.is() )
    2859             :             {
    2860          10 :                 OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
    2861             : 
    2862          10 :                 Reference< beans::XPropertySet >  xStyleSet( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
    2863             : 
    2864          10 :                 Reference< beans::XPropertySetInfo >  xSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
    2865          10 :                 Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY );
    2866             : 
    2867          10 :                 PropertyEntryVector_t aBackgroundProperties = ImplGetPageBackgroundPropertySet()->getPropertyMap()->getPropertyEntries();
    2868          10 :                 PropertyEntryVector_t::const_iterator aIt = aBackgroundProperties.begin();
    2869         280 :                 while( aIt != aBackgroundProperties.end() )
    2870             :                 {
    2871         260 :                     if( xSetInfo->hasPropertyByName( aIt->sName ) )
    2872             :                     {
    2873         116 :                         if( !xSetStates.is() || xSetStates->getPropertyState( aIt->sName ) == beans::PropertyState_DIRECT_VALUE )
    2874          16 :                             xStyleSet->setPropertyValue( aIt->sName,    xInputSet->getPropertyValue( aIt->sName ) );
    2875             :                         else
    2876         100 :                             xSetStates->setPropertyToDefault( aIt->sName );
    2877             :                     }
    2878             : 
    2879         260 :                     ++aIt;
    2880          10 :                 }
    2881          10 :             }
    2882             :         }
    2883             :         else
    2884             :         {
    2885             :             // first fill an item set
    2886             :             // is it our own implementation?
    2887           0 :             SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xInputSet );
    2888             : 
    2889           0 :             SfxItemSet aSet( GetModel()->GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST );
    2890             : 
    2891           0 :             if( pBack )
    2892             :             {
    2893           0 :                 pBack->fillItemSet( (SdDrawDocument*)GetPage()->GetModel(), aSet );
    2894             :             }
    2895             :             else
    2896             :             {
    2897           0 :                 SdUnoPageBackground* pBackground = new SdUnoPageBackground();
    2898             : 
    2899           0 :                 Reference< beans::XPropertySetInfo > xInputSetInfo( xInputSet->getPropertySetInfo(), UNO_QUERY_THROW );
    2900           0 :                 Reference< beans::XPropertySet > xDestSet( (beans::XPropertySet*)pBackground );
    2901           0 :                 Reference< beans::XPropertySetInfo > xDestSetInfo( xDestSet->getPropertySetInfo(), UNO_QUERY_THROW );
    2902             : 
    2903           0 :                 uno::Sequence< beans::Property> aProperties( xDestSetInfo->getProperties() );
    2904           0 :                 sal_Int32 nCount = aProperties.getLength();
    2905           0 :                 beans::Property* pProp = aProperties.getArray();
    2906             : 
    2907           0 :                 while( nCount-- )
    2908             :                 {
    2909           0 :                     const OUString aPropName( pProp->Name );
    2910           0 :                     if( xInputSetInfo->hasPropertyByName( aPropName ) )
    2911           0 :                         xDestSet->setPropertyValue( aPropName, xInputSet->getPropertyValue( aPropName ) );
    2912             : 
    2913           0 :                     pProp++;
    2914           0 :                 }
    2915             : 
    2916           0 :                 pBackground->fillItemSet( (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel(), aSet );
    2917             :             }
    2918             : 
    2919             :             // if we find the background style, copy the set to the background
    2920           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
    2921           0 :             SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
    2922           0 :             if(pSSPool)
    2923             :             {
    2924           0 :                 String aLayoutName( static_cast< SdPage* >( SvxFmDrawPage::mpPage )->GetLayoutName() );
    2925           0 :                 aLayoutName.Erase(aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
    2926           0 :                 aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
    2927           0 :                 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
    2928             : 
    2929           0 :                 if( pStyleSheet )
    2930             :                 {
    2931           0 :                     pStyleSheet->GetItemSet().Put( aSet );
    2932             : 
    2933             :                     // repaint only
    2934           0 :                     SvxFmDrawPage::mpPage->ActionChanged();
    2935          10 :                     return;
    2936           0 :                 }
    2937             :             }
    2938             : 
    2939             :             // if no background style is available, set at page directly. This
    2940             :             // is an error and should NOT happen (and will be asserted from the SdrPage)
    2941           0 :             GetPage()->getSdrPageProperties().PutItemSet(aSet);
    2942             :         }
    2943             :     }
    2944           0 :     catch( Exception& )
    2945             :     {
    2946             :         OSL_FAIL("sd::SdMasterPage::setBackground(), exception caught!");
    2947          10 :     }
    2948             : }
    2949             : 
    2950           0 : void SdMasterPage::getBackground( Any& rValue ) throw()
    2951             : {
    2952           0 :     if( GetModel() ) try
    2953             :     {
    2954           0 :         if( mbIsImpressDocument )
    2955             :         {
    2956           0 :             Reference< container::XNameAccess > xFamilies( GetModel()->getStyleFamilies(), UNO_QUERY_THROW );
    2957           0 :             Reference< container::XNameAccess > xFamily( xFamilies->getByName( getName() ), UNO_QUERY_THROW );
    2958             : 
    2959           0 :             const OUString aStyleName( OUString::createFromAscii(sUNO_PseudoSheet_Background) );
    2960           0 :             rValue <<= Reference< beans::XPropertySet >( xFamily->getByName( aStyleName ), UNO_QUERY_THROW );
    2961             :         }
    2962             :         else
    2963             :         {
    2964           0 :             SdDrawDocument* pDoc = (SdDrawDocument*)SvxFmDrawPage::mpPage->GetModel();
    2965           0 :             SfxStyleSheetBasePool* pSSPool = (SfxStyleSheetBasePool*)pDoc->GetStyleSheetPool();
    2966           0 :             if(pSSPool)
    2967             :             {
    2968           0 :                 String aLayoutName( static_cast< SdPage* >(SvxFmDrawPage::mpPage)->GetLayoutName() );
    2969           0 :                 aLayoutName.Erase( aLayoutName.Search(String(RTL_CONSTASCII_USTRINGPARAM(SD_LT_SEPARATOR)))+4);
    2970           0 :                 aLayoutName += String(SdResId(STR_LAYOUT_BACKGROUND));
    2971           0 :                 SfxStyleSheetBase* pStyleSheet = pSSPool->Find( aLayoutName, SD_STYLE_FAMILY_MASTERPAGE );
    2972             : 
    2973           0 :                 if( pStyleSheet )
    2974             :                 {
    2975           0 :                     SfxItemSet aStyleSet( pStyleSheet->GetItemSet());
    2976           0 :                     if( aStyleSet.Count() )
    2977             :                     {
    2978           0 :                         rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( pDoc, &aStyleSet ) );
    2979           0 :                         return;
    2980           0 :                     }
    2981           0 :                 }
    2982             :             }
    2983             : 
    2984             :             // No style found, use fill attributes from page background. This
    2985             :             // should NOT happen and is an error
    2986           0 :             const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
    2987             : 
    2988           0 :             if(XFILL_NONE == ((const XFillStyleItem&)rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
    2989             :             {
    2990             :                 rValue <<= Reference< beans::XPropertySet >(
    2991           0 :                     new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
    2992             :             }
    2993             :             else
    2994             :             {
    2995           0 :                 rValue.clear();
    2996             :             }
    2997             :         }
    2998             :     }
    2999           0 :     catch( Exception& )
    3000             :     {
    3001           0 :         rValue.clear();
    3002             :         OSL_FAIL("sd::SdMasterPage::getBackground(), exception caught!");
    3003             :     }
    3004             : }
    3005             : 
    3006             : // XNamed
    3007          12 : void SAL_CALL SdMasterPage::setName( const OUString& rName )
    3008             :     throw(uno::RuntimeException)
    3009             : {
    3010          12 :     ::SolarMutexGuard aGuard;
    3011             : 
    3012          12 :     throwIfDisposed();
    3013             : 
    3014          12 :     if(SvxFmDrawPage::mpPage && GetPage()->GetPageKind() != PK_NOTES)
    3015             :     {
    3016          12 :         SdDrawDocument* pDoc = GetModel()->GetDoc();
    3017             :         sal_Bool bOutDummy;
    3018          12 :         String aNewName( rName );
    3019             : 
    3020             :         // Slide Name has to be unique
    3021          12 :         if( pDoc && pDoc->GetPageByName( aNewName, bOutDummy ) != SDRPAGE_NOTFOUND )
    3022          12 :             return; // throw Exception ?
    3023             : 
    3024          10 :         GetPage()->SetName( aNewName );
    3025             : 
    3026          10 :         if( pDoc )
    3027          10 :             pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), aNewName );
    3028             : 
    3029             :         // fake a mode change to repaint the page tab bar
    3030          10 :         ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
    3031          10 :         ::sd::ViewShell* pViewSh = pDocSh ? pDocSh->GetViewShell() : NULL;
    3032          10 :         if( pViewSh && pViewSh->ISA(::sd::DrawViewShell ) )
    3033             :         {
    3034             :             ::sd::DrawViewShell* pDrawViewSh =
    3035           0 :                   static_cast< ::sd::DrawViewShell*>(pViewSh);
    3036             : 
    3037           0 :             EditMode eMode = pDrawViewSh->GetEditMode();
    3038           0 :             if( eMode == EM_MASTERPAGE )
    3039             :             {
    3040           0 :                 sal_Bool bLayer = pDrawViewSh->IsLayerModeActive();
    3041             : 
    3042           0 :                 pDrawViewSh->ChangeEditMode( eMode, !bLayer );
    3043           0 :                 pDrawViewSh->ChangeEditMode( eMode, bLayer );
    3044             :             }
    3045             :         }
    3046             : 
    3047          10 :         GetModel()->SetModified();
    3048          12 :     }
    3049             : }
    3050             : 
    3051          52 : OUString SAL_CALL SdMasterPage::getName(  )
    3052             :     throw(uno::RuntimeException)
    3053             : {
    3054          52 :     ::SolarMutexGuard aGuard;
    3055             : 
    3056          52 :     throwIfDisposed();
    3057             : 
    3058          52 :     if(SvxFmDrawPage::mpPage)
    3059             :     {
    3060          52 :         String aLayoutName( GetPage()->GetLayoutName() );
    3061          52 :         aLayoutName = aLayoutName.Erase(aLayoutName.Search( String( RTL_CONSTASCII_USTRINGPARAM((SD_LT_SEPARATOR)))));
    3062             : 
    3063          52 :         return aLayoutName;
    3064             :     }
    3065             : 
    3066           0 :     return OUString();
    3067             : }
    3068             : 
    3069             : // XPresentationPage
    3070           2 : Reference< drawing::XDrawPage > SAL_CALL SdMasterPage::getNotesPage()
    3071             :     throw(uno::RuntimeException)
    3072             : {
    3073           2 :     ::SolarMutexGuard aGuard;
    3074             : 
    3075           2 :     throwIfDisposed();
    3076             : 
    3077           2 :     if(SvxFmDrawPage::mpPage && GetModel()->GetDoc() )
    3078             :     {
    3079           2 :         SdPage* pNotesPage = GetModel()->GetDoc()->GetMasterSdPage( (SvxFmDrawPage::mpPage->GetPageNum()-1)>>1, PK_NOTES );
    3080           2 :         if( pNotesPage )
    3081             :         {
    3082           2 :             Reference< drawing::XDrawPage > xPage( pNotesPage->getUnoPage(), uno::UNO_QUERY );
    3083           2 :             return xPage;
    3084             :         }
    3085             :     }
    3086           0 :     return NULL;
    3087             : }
    3088             : 
    3089             : // XShapes
    3090          62 : void SAL_CALL SdMasterPage::add( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
    3091             : {
    3092          62 :     SdGenericDrawPage::add( xShape );
    3093          62 : }
    3094             : 
    3095          92 : void SAL_CALL SdMasterPage::remove( const Reference< drawing::XShape >& xShape ) throw(uno::RuntimeException)
    3096             : {
    3097          92 :     ::SolarMutexGuard aGuard;
    3098             : 
    3099          92 :     throwIfDisposed();
    3100             : 
    3101          92 :     SvxShape* pShape = SvxShape::getImplementation( xShape );
    3102          92 :     if( pShape )
    3103             :     {
    3104          92 :         SdrObject* pObj = pShape->GetSdrObject();
    3105          92 :         if( pObj )
    3106             :         {
    3107          92 :             if( GetPage()->IsPresObj( pObj ) )
    3108          92 :                 GetPage()->RemovePresObj(pObj);
    3109             :         }
    3110             :     }
    3111             : 
    3112          92 :     SdGenericDrawPage::remove( xShape );
    3113          92 : }
    3114             : 
    3115             : 
    3116         128 : Reference< uno::XInterface > createUnoPageImpl( SdPage* pPage )
    3117             : {
    3118         128 :     Reference< uno::XInterface > xPage;
    3119             : 
    3120         128 :     if( pPage && pPage->GetModel() )
    3121             :     {
    3122         128 :         SdXImpressDocument* pModel = SdXImpressDocument::getImplementation( pPage->GetModel()->getUnoModel() );
    3123         128 :         if( pModel )
    3124             :         {
    3125         128 :             if( pPage->IsMasterPage() )
    3126             :             {
    3127          20 :                 xPage = (::cppu::OWeakObject*)new SdMasterPage( pModel, pPage );
    3128             :             }
    3129             :             else
    3130             :             {
    3131         108 :                 xPage = (::cppu::OWeakObject*)new SdDrawPage( pModel, pPage );
    3132             :             }
    3133             :         }
    3134             :     }
    3135             : 
    3136         128 :     return xPage;
    3137             : }
    3138             : 
    3139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10