15b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 35b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 45b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 55b190011SAndrew Rist * distributed with this work for additional information 65b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 75b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 85b190011SAndrew Rist * "License"); you may not use this file except in compliance 95b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 115b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 135b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 145b190011SAndrew Rist * software distributed under the License is distributed on an 155b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 165b190011SAndrew Rist * KIND, either express or implied. See the License for the 175b190011SAndrew Rist * specific language governing permissions and limitations 185b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 205b190011SAndrew Rist *************************************************************/ 215b190011SAndrew Rist 225b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentation2.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 30cdf0e10cSrcweir #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> 31cdf0e10cSrcweir #include <com/sun/star/lang/Locale.hpp> 32cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp> 33cdf0e10cSrcweir #include <com/sun/star/awt/XDevice.hpp> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <com/sun/star/embed/Aspects.hpp> 36cdf0e10cSrcweir #include <com/sun/star/presentation/XPresentation2.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <osl/mutex.hxx> 39cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir #include <comphelper/sequence.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <rtl/uuid.h> 44cdf0e10cSrcweir #include <rtl/memory.h> 45cdf0e10cSrcweir #include <editeng/unofield.hxx> 46cdf0e10cSrcweir #include <unomodel.hxx> 47cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 48*61066e41SArrigo Marchiori #include <sfx2/docfile.hxx> 49cdf0e10cSrcweir #include <sfx2/bindings.hxx> 50*61066e41SArrigo Marchiori #include <sfx2/linkmgr.hxx> 51cdf0e10cSrcweir #include <vcl/svapp.hxx> 52cdf0e10cSrcweir #include <editeng/UnoForbiddenCharsTable.hxx> 53cdf0e10cSrcweir #include <svx/svdoutl.hxx> 54cdf0e10cSrcweir #include <editeng/forbiddencharacterstable.hxx> 55cdf0e10cSrcweir #include <svx/UnoNamespaceMap.hxx> 56cdf0e10cSrcweir #include <svx/svdlayer.hxx> 57cdf0e10cSrcweir #include <svx/svdsob.hxx> 58cdf0e10cSrcweir #include <svx/unoapi.hxx> 59cdf0e10cSrcweir #include <svx/unofill.hxx> 60cdf0e10cSrcweir #include <svx/unopool.hxx> 61cdf0e10cSrcweir #include <svx/svdorect.hxx> 62cdf0e10cSrcweir #include <editeng/flditem.hxx> 63cdf0e10cSrcweir #include <vos/mutex.hxx> 64cdf0e10cSrcweir #include <toolkit/awt/vclxdevice.hxx> 65cdf0e10cSrcweir #include <svx/svdpool.hxx> 66cdf0e10cSrcweir #include <editeng/unolingu.hxx> 67cdf0e10cSrcweir #include <svx/svdpagv.hxx> 68cdf0e10cSrcweir #include <svtools/unoimap.hxx> 69cdf0e10cSrcweir #include <svx/unoshape.hxx> 70cdf0e10cSrcweir #include <editeng/unonrule.hxx> 71cdf0e10cSrcweir #include <editeng/eeitem.hxx> 72cdf0e10cSrcweir 73cdf0e10cSrcweir // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver 74cdf0e10cSrcweir #include <svx/xmleohlp.hxx> 75cdf0e10cSrcweir #include <svx/xmlgrhlp.hxx> 76cdf0e10cSrcweir #include "DrawDocShell.hxx" 77cdf0e10cSrcweir #include "ViewShellBase.hxx" 78cdf0e10cSrcweir #include <UnoDocumentSettings.hxx> 79cdf0e10cSrcweir 80cdf0e10cSrcweir #include <drawdoc.hxx> 81cdf0e10cSrcweir #include <glob.hrc> 82cdf0e10cSrcweir #include <sdresid.hxx> 83cdf0e10cSrcweir #include <sdpage.hxx> 84cdf0e10cSrcweir 85cdf0e10cSrcweir #include <strings.hrc> 86cdf0e10cSrcweir #include "unohelp.hxx" 87cdf0e10cSrcweir #include <unolayer.hxx> 88cdf0e10cSrcweir #include <unoprnms.hxx> 89cdf0e10cSrcweir #include <unopage.hxx> 90cdf0e10cSrcweir #include <unocpres.hxx> 91cdf0e10cSrcweir #include <unoobj.hxx> 92cdf0e10cSrcweir #include <stlpool.hxx> 93cdf0e10cSrcweir #include <unopback.hxx> 94cdf0e10cSrcweir #include <unokywds.hxx> 95cdf0e10cSrcweir #include "FrameView.hxx" 96cdf0e10cSrcweir #include "ClientView.hxx" 97cdf0e10cSrcweir #include "ViewShell.hxx" 98cdf0e10cSrcweir #include "app.hrc" 99cdf0e10cSrcweir #include <vcl/pdfextoutdevdata.hxx> 100cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationEffect.hpp> 101cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp> 102cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp> 103cdf0e10cSrcweir #include <tools/urlobj.hxx> 104cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontact.hxx> 105cdf0e10cSrcweir #include <svx/sdr/contact/viewcontact.hxx> 106cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx> 107cdf0e10cSrcweir 108cdf0e10cSrcweir #include <com/sun/star/office/XAnnotation.hpp> 109cdf0e10cSrcweir #include <com/sun/star/office/XAnnotationAccess.hpp> 110cdf0e10cSrcweir #include <com/sun/star/office/XAnnotationEnumeration.hpp> 111cdf0e10cSrcweir #include <com/sun/star/geometry/RealPoint2D.hpp> 112cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp> 113cdf0e10cSrcweir 114cdf0e10cSrcweir using ::rtl::OUString; 115cdf0e10cSrcweir 116cdf0e10cSrcweir #include <drawinglayer/primitive2d/structuretagprimitive2d.hxx> 117cdf0e10cSrcweir 118cdf0e10cSrcweir using namespace ::osl; 119cdf0e10cSrcweir using namespace ::vos; 120cdf0e10cSrcweir using namespace ::cppu; 121cdf0e10cSrcweir using namespace ::com::sun::star; 122cdf0e10cSrcweir 123cdf0e10cSrcweir extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable, 126cdf0e10cSrcweir public SfxListener 127cdf0e10cSrcweir { 128cdf0e10cSrcweir public: 129cdf0e10cSrcweir SdUnoForbiddenCharsTable( SdrModel* pModel ); 130cdf0e10cSrcweir ~SdUnoForbiddenCharsTable(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // SfxListener 133cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw (); 134cdf0e10cSrcweir protected: 135cdf0e10cSrcweir virtual void onChange(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir private: 138cdf0e10cSrcweir SdrModel* mpModel; 139cdf0e10cSrcweir }; 140cdf0e10cSrcweir 141cdf0e10cSrcweir SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel ) 142cdf0e10cSrcweir : SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir StartListening( *pModel ); 145cdf0e10cSrcweir } 146cdf0e10cSrcweir 147cdf0e10cSrcweir void SdUnoForbiddenCharsTable::onChange() 148cdf0e10cSrcweir { 149cdf0e10cSrcweir if( mpModel ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir mpModel->ReformatAllTextObjects(); 152cdf0e10cSrcweir } 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir SdUnoForbiddenCharsTable::~SdUnoForbiddenCharsTable() 156cdf0e10cSrcweir { 157cdf0e10cSrcweir if( mpModel ) 158cdf0e10cSrcweir EndListening( *mpModel ); 159cdf0e10cSrcweir } 160cdf0e10cSrcweir 161cdf0e10cSrcweir void SdUnoForbiddenCharsTable::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw() 162cdf0e10cSrcweir { 163cdf0e10cSrcweir const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir if( pSdrHint ) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir if( HINT_MODELCLEARED == pSdrHint->GetKind() ) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir mpModel = NULL; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir } 172cdf0e10cSrcweir } 173cdf0e10cSrcweir 174cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 175cdf0e10cSrcweir 176cdf0e10cSrcweir const sal_Int32 WID_MODEL_LANGUAGE = 1; 177cdf0e10cSrcweir const sal_Int32 WID_MODEL_TABSTOP = 2; 178cdf0e10cSrcweir const sal_Int32 WID_MODEL_VISAREA = 3; 179cdf0e10cSrcweir const sal_Int32 WID_MODEL_MAPUNIT = 4; 180cdf0e10cSrcweir const sal_Int32 WID_MODEL_FORBCHARS= 5; 181cdf0e10cSrcweir const sal_Int32 WID_MODEL_CONTFOCUS = 6; 182cdf0e10cSrcweir const sal_Int32 WID_MODEL_DSGNMODE = 7; 183cdf0e10cSrcweir const sal_Int32 WID_MODEL_BASICLIBS = 8; 184cdf0e10cSrcweir const sal_Int32 WID_MODEL_RUNTIMEUID = 9; 185cdf0e10cSrcweir const sal_Int32 WID_MODEL_BUILDID = 10; 186cdf0e10cSrcweir const sal_Int32 WID_MODEL_HASVALIDSIGNATURES = 11; 187cdf0e10cSrcweir const sal_Int32 WID_MODEL_DIALOGLIBS = 12; 188cdf0e10cSrcweir 189cdf0e10cSrcweir const SvxItemPropertySet* ImplGetDrawModelPropertySet() 190cdf0e10cSrcweir { 191cdf0e10cSrcweir // Achtung: Der erste Parameter MUSS sortiert vorliegen !!! 192cdf0e10cSrcweir const static SfxItemPropertyMapEntry aDrawModelPropertyMap_Impl[] = 193cdf0e10cSrcweir { 194cdf0e10cSrcweir { MAP_CHAR_LEN("BuildId"), WID_MODEL_BUILDID, &::getCppuType(static_cast< const rtl::OUString * >(0)), 0, 0}, 195cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_CharLocale), WID_MODEL_LANGUAGE, &::getCppuType((const lang::Locale*)0), 0, 0}, 196cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_TabStop), WID_MODEL_TABSTOP, &::getCppuType((const sal_Int32*)0), 0, 0}, 197cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_VisibleArea), WID_MODEL_VISAREA, &::getCppuType((const awt::Rectangle*)0), 0, 0}, 198cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_MapUnit), WID_MODEL_MAPUNIT, &::getCppuType((const sal_Int16*)0), beans::PropertyAttribute::READONLY, 0}, 199cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_ForbiddenCharacters), WID_MODEL_FORBCHARS,&::getCppuType((const uno::Reference< i18n::XForbiddenCharacters > *)0), beans::PropertyAttribute::READONLY, 0 }, 200cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_AutomContFocus ), WID_MODEL_CONTFOCUS, &::getBooleanCppuType(), 0, 0}, 201cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_ApplyFrmDsgnMode), WID_MODEL_DSGNMODE, &::getBooleanCppuType(), 0, 0}, 202cdf0e10cSrcweir { MAP_CHAR_LEN("BasicLibraries"), WID_MODEL_BASICLIBS,&::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 }, 203cdf0e10cSrcweir { MAP_CHAR_LEN("DialogLibraries"), WID_MODEL_DIALOGLIBS, &::getCppuType((const uno::Reference< script::XLibraryContainer > *)0), beans::PropertyAttribute::READONLY, 0 }, 204cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_RuntimeUID), WID_MODEL_RUNTIMEUID, &::getCppuType(static_cast< const rtl::OUString * >(0)), beans::PropertyAttribute::READONLY, 0 }, 205cdf0e10cSrcweir { MAP_CHAR_LEN(sUNO_Prop_HasValidSignatures), WID_MODEL_HASVALIDSIGNATURES, &::getCppuType(static_cast< const sal_Bool * >(0)), beans::PropertyAttribute::READONLY, 0 }, 206cdf0e10cSrcweir { 0,0,0,0,0,0 } 207cdf0e10cSrcweir }; 208cdf0e10cSrcweir static SvxItemPropertySet aDrawModelPropertySet_Impl( aDrawModelPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() ); 209cdf0e10cSrcweir return &aDrawModelPropertySet_Impl; 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir // this ctor is used from the DocShell 213cdf0e10cSrcweir SdXImpressDocument::SdXImpressDocument (::sd::DrawDocShell* pShell, bool bClipBoard ) throw() 214cdf0e10cSrcweir : SfxBaseModel( pShell ), 215cdf0e10cSrcweir mpDocShell( pShell ), 216cdf0e10cSrcweir mpDoc( pShell ? pShell->GetDoc() : NULL ), 217cdf0e10cSrcweir mbDisposed(false), 218cdf0e10cSrcweir mbImpressDoc( pShell && pShell->GetDoc() && pShell->GetDoc()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ), 219cdf0e10cSrcweir mbClipBoard( bClipBoard ), 220cdf0e10cSrcweir mpPropSet( ImplGetDrawModelPropertySet() ) 221cdf0e10cSrcweir { 222cdf0e10cSrcweir if( mpDoc ) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir StartListening( *mpDoc ); 225cdf0e10cSrcweir } 226cdf0e10cSrcweir else 227cdf0e10cSrcweir { 228cdf0e10cSrcweir DBG_ERROR("DocShell is invalid"); 229cdf0e10cSrcweir } 230cdf0e10cSrcweir } 231cdf0e10cSrcweir 232cdf0e10cSrcweir SdXImpressDocument::SdXImpressDocument( SdDrawDocument* pDoc, bool bClipBoard ) throw() 233cdf0e10cSrcweir : SfxBaseModel( NULL ), 234cdf0e10cSrcweir mpDocShell( NULL ), 235cdf0e10cSrcweir mpDoc( pDoc ), 236cdf0e10cSrcweir mbDisposed(false), 237cdf0e10cSrcweir mbImpressDoc( pDoc && pDoc->GetDocumentType() == DOCUMENT_TYPE_IMPRESS ), 238cdf0e10cSrcweir mbClipBoard( bClipBoard ), 239cdf0e10cSrcweir mpPropSet( ImplGetDrawModelPropertySet() ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir if( mpDoc ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir StartListening( *mpDoc ); 244cdf0e10cSrcweir } 245cdf0e10cSrcweir else 246cdf0e10cSrcweir { 247cdf0e10cSrcweir DBG_ERROR("SdDrawDocument is invalid"); 248cdf0e10cSrcweir } 249cdf0e10cSrcweir } 250cdf0e10cSrcweir 251cdf0e10cSrcweir /*********************************************************************** 252cdf0e10cSrcweir * * 253cdf0e10cSrcweir ***********************************************************************/ 254cdf0e10cSrcweir SdXImpressDocument::~SdXImpressDocument() throw() 255cdf0e10cSrcweir { 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir // uno helper 259cdf0e10cSrcweir 260cdf0e10cSrcweir 261cdf0e10cSrcweir /****************************************************************************** 262cdf0e10cSrcweir * Erzeugt anhand der uebergebennen SdPage eine SdDrawPage. Wurde fuer diese * 263cdf0e10cSrcweir * SdPage bereits eine SdDrawPage erzeugt, wird keine neue SdDrawPage erzeug. * 264cdf0e10cSrcweir ******************************************************************************/ 265cdf0e10cSrcweir /* 266cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SdXImpressDocument::CreateXDrawPage( SdPage* pPage ) throw() 267cdf0e10cSrcweir { 268cdf0e10cSrcweir DBG_ASSERT(pPage,"SdXImpressDocument::CreateXDrawPage( NULL? )"); 269cdf0e10cSrcweir 270cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage; 271cdf0e10cSrcweir 272cdf0e10cSrcweir if(pPage) 273cdf0e10cSrcweir { 274cdf0e10cSrcweir xDrawPage = SvxDrawPage::GetPageForSdrPage(pPage); 275cdf0e10cSrcweir 276cdf0e10cSrcweir if(!xDrawPage.is()) 277cdf0e10cSrcweir { 278cdf0e10cSrcweir if(pPage->IsMasterPage()) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir xDrawPage = (presentation::XPresentationPage*)new SdMasterPage( this, pPage ); 281cdf0e10cSrcweir } 282cdf0e10cSrcweir else 283cdf0e10cSrcweir { 284cdf0e10cSrcweir xDrawPage = (SvxDrawPage*)new SdDrawPage( this, pPage ); 285cdf0e10cSrcweir } 286cdf0e10cSrcweir } 287cdf0e10cSrcweir } 288cdf0e10cSrcweir 289cdf0e10cSrcweir return xDrawPage; 290cdf0e10cSrcweir } 291cdf0e10cSrcweir */ 292cdf0e10cSrcweir 293cdf0e10cSrcweir // XInterface 294cdf0e10cSrcweir uno::Any SAL_CALL SdXImpressDocument::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir uno::Any aAny; 297cdf0e10cSrcweir 298cdf0e10cSrcweir QUERYINT(lang::XServiceInfo); 299cdf0e10cSrcweir else QUERYINT(beans::XPropertySet); 300cdf0e10cSrcweir else QUERYINT(lang::XMultiServiceFactory); 301cdf0e10cSrcweir else QUERYINT(drawing::XDrawPageDuplicator); 302cdf0e10cSrcweir else QUERYINT(drawing::XLayerSupplier); 303cdf0e10cSrcweir else QUERYINT(drawing::XMasterPagesSupplier); 304cdf0e10cSrcweir else QUERYINT(drawing::XDrawPagesSupplier); 305cdf0e10cSrcweir else QUERYINT(presentation::XHandoutMasterSupplier); 306*61066e41SArrigo Marchiori else QUERYINT(document::XLinkAuthorizer); 307cdf0e10cSrcweir else QUERYINT(document::XLinkTargetSupplier); 308cdf0e10cSrcweir else QUERYINT(style::XStyleFamiliesSupplier); 309cdf0e10cSrcweir else QUERYINT(com::sun::star::ucb::XAnyCompareFactory); 310cdf0e10cSrcweir else QUERYINT(view::XRenderable); 311cdf0e10cSrcweir else if( mbImpressDoc && rType == ITYPE(presentation::XPresentationSupplier) ) 312cdf0e10cSrcweir aAny <<= uno::Reference< presentation::XPresentationSupplier >(this); 313cdf0e10cSrcweir else if( mbImpressDoc && rType == ITYPE(presentation::XCustomPresentationSupplier) ) 314cdf0e10cSrcweir aAny <<= uno::Reference< presentation::XCustomPresentationSupplier >(this); 315cdf0e10cSrcweir else 316cdf0e10cSrcweir return SfxBaseModel::queryInterface( rType ); 317cdf0e10cSrcweir 318cdf0e10cSrcweir return aAny; 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::acquire() throw ( ) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir SfxBaseModel::acquire(); 324cdf0e10cSrcweir } 325cdf0e10cSrcweir 326cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::release() throw ( ) 327cdf0e10cSrcweir { 328cdf0e10cSrcweir if (osl_decrementInterlockedCount( &m_refCount ) == 0) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir // restore reference count: 331cdf0e10cSrcweir osl_incrementInterlockedCount( &m_refCount ); 332cdf0e10cSrcweir if(!mbDisposed) 333cdf0e10cSrcweir { 334cdf0e10cSrcweir try 335cdf0e10cSrcweir { 336cdf0e10cSrcweir dispose(); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir catch (uno::RuntimeException const& exc) 339cdf0e10cSrcweir { // don't break throw () 340cdf0e10cSrcweir OSL_ENSURE( 341cdf0e10cSrcweir false, OUStringToOString( 342cdf0e10cSrcweir exc.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); 343cdf0e10cSrcweir static_cast<void>(exc); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir } 346cdf0e10cSrcweir SfxBaseModel::release(); 347cdf0e10cSrcweir } 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir // XUnoTunnel 351cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< sal_Int8 > & SdXImpressDocument::getUnoTunnelId() throw() 352cdf0e10cSrcweir { 353cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0; 354cdf0e10cSrcweir if( !pSeq ) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); 357cdf0e10cSrcweir if( !pSeq ) 358cdf0e10cSrcweir { 359cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); 360cdf0e10cSrcweir rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); 361cdf0e10cSrcweir pSeq = &aSeq; 362cdf0e10cSrcweir } 363cdf0e10cSrcweir } 364cdf0e10cSrcweir return *pSeq; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir 367cdf0e10cSrcweir SdXImpressDocument* SdXImpressDocument::getImplementation( const uno::Reference< uno::XInterface >& xInt ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); 370cdf0e10cSrcweir if( xUT.is() ) 371cdf0e10cSrcweir return reinterpret_cast<SdXImpressDocument*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( SdXImpressDocument::getUnoTunnelId() ))); 372cdf0e10cSrcweir else 373cdf0e10cSrcweir return NULL; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir 376cdf0e10cSrcweir sal_Int64 SAL_CALL SdXImpressDocument::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir if( rIdentifier.getLength() == 16 ) 379cdf0e10cSrcweir { 380cdf0e10cSrcweir if( (0 == rtl_compareMemory( SdXImpressDocument::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 )) ) 381cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); 382cdf0e10cSrcweir 383cdf0e10cSrcweir if( (0 == rtl_compareMemory( SdrModel::getUnoTunnelImplementationId().getConstArray(), rIdentifier.getConstArray(), 16 )) ) 384cdf0e10cSrcweir return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(mpDoc)); 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir return SfxBaseModel::getSomething( rIdentifier ); 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir // XTypeProvider 391cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SdXImpressDocument::getTypes( ) throw(uno::RuntimeException) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 394cdf0e10cSrcweir 395cdf0e10cSrcweir if( maTypeSequence.getLength() == 0 ) 396cdf0e10cSrcweir { 397cdf0e10cSrcweir const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() ); 398cdf0e10cSrcweir const sal_Int32 nBaseTypes = aBaseTypes.getLength(); 399cdf0e10cSrcweir const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); 400cdf0e10cSrcweir 401*61066e41SArrigo Marchiori const sal_Int32 nOwnTypes = mbImpressDoc ? 15 : 12; // !DANGER! Keep this updated! 402cdf0e10cSrcweir 403cdf0e10cSrcweir maTypeSequence.realloc( nBaseTypes + nOwnTypes ); 404cdf0e10cSrcweir uno::Type* pTypes = maTypeSequence.getArray(); 405cdf0e10cSrcweir 406cdf0e10cSrcweir *pTypes++ = ITYPE(beans::XPropertySet); 407cdf0e10cSrcweir *pTypes++ = ITYPE(lang::XServiceInfo); 408cdf0e10cSrcweir *pTypes++ = ITYPE(lang::XMultiServiceFactory); 409cdf0e10cSrcweir *pTypes++ = ITYPE(drawing::XDrawPageDuplicator); 410cdf0e10cSrcweir *pTypes++ = ITYPE(drawing::XLayerSupplier); 411cdf0e10cSrcweir *pTypes++ = ITYPE(drawing::XMasterPagesSupplier); 412cdf0e10cSrcweir *pTypes++ = ITYPE(drawing::XDrawPagesSupplier); 413*61066e41SArrigo Marchiori *pTypes++ = ITYPE(document::XLinkAuthorizer); 414cdf0e10cSrcweir *pTypes++ = ITYPE(document::XLinkTargetSupplier); 415cdf0e10cSrcweir *pTypes++ = ITYPE(style::XStyleFamiliesSupplier); 416cdf0e10cSrcweir *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory); 417cdf0e10cSrcweir *pTypes++ = ITYPE(view::XRenderable); 418cdf0e10cSrcweir if( mbImpressDoc ) 419cdf0e10cSrcweir { 420cdf0e10cSrcweir *pTypes++ = ITYPE(presentation::XPresentationSupplier); 421cdf0e10cSrcweir *pTypes++ = ITYPE(presentation::XCustomPresentationSupplier); 422cdf0e10cSrcweir *pTypes++ = ITYPE(presentation::XHandoutMasterSupplier); 423cdf0e10cSrcweir } 424cdf0e10cSrcweir 425cdf0e10cSrcweir for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) 426cdf0e10cSrcweir *pTypes++ = *pBaseTypes++; 427cdf0e10cSrcweir } 428cdf0e10cSrcweir 429cdf0e10cSrcweir return maTypeSequence; 430cdf0e10cSrcweir } 431cdf0e10cSrcweir 432cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SdXImpressDocument::getImplementationId( ) throw(uno::RuntimeException) 433cdf0e10cSrcweir { 434cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 435cdf0e10cSrcweir 436cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId; 437cdf0e10cSrcweir if( aId.getLength() == 0 ) 438cdf0e10cSrcweir { 439cdf0e10cSrcweir aId.realloc( 16 ); 440cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); 441cdf0e10cSrcweir } 442cdf0e10cSrcweir return aId; 443cdf0e10cSrcweir } 444cdf0e10cSrcweir 445cdf0e10cSrcweir /*********************************************************************** 446cdf0e10cSrcweir * * 447cdf0e10cSrcweir ***********************************************************************/ 448cdf0e10cSrcweir void SdXImpressDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) 449cdf0e10cSrcweir { 450cdf0e10cSrcweir if( mpDoc ) 451cdf0e10cSrcweir { 452cdf0e10cSrcweir const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint ); 453cdf0e10cSrcweir 454cdf0e10cSrcweir if( pSdrHint ) 455cdf0e10cSrcweir { 456cdf0e10cSrcweir if( hasEventListeners() ) 457cdf0e10cSrcweir { 458cdf0e10cSrcweir document::EventObject aEvent; 459cdf0e10cSrcweir if( SvxUnoDrawMSFactory::createEvent( mpDoc, pSdrHint, aEvent ) ) 460cdf0e10cSrcweir notifyEvent( aEvent ); 461cdf0e10cSrcweir } 462cdf0e10cSrcweir 463cdf0e10cSrcweir if( pSdrHint->GetKind() == HINT_MODELCLEARED ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir if( mpDoc ) 466cdf0e10cSrcweir EndListening( *mpDoc ); 467cdf0e10cSrcweir mpDoc = NULL; 468cdf0e10cSrcweir mpDocShell = NULL; 469cdf0e10cSrcweir } 470cdf0e10cSrcweir } 471cdf0e10cSrcweir else 472cdf0e10cSrcweir { 473cdf0e10cSrcweir const SfxSimpleHint* pSfxHint = PTR_CAST(SfxSimpleHint, &rHint ); 474cdf0e10cSrcweir 475cdf0e10cSrcweir // ist unser SdDrawDocument gerade gestorben? 476cdf0e10cSrcweir if(pSfxHint && pSfxHint->GetId() == SFX_HINT_DYING) 477cdf0e10cSrcweir { 478cdf0e10cSrcweir // yup, also schnell ein neues erfragen 479cdf0e10cSrcweir if( mpDocShell ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir SdDrawDocument *pNewDoc = mpDocShell->GetDoc(); 482cdf0e10cSrcweir 483cdf0e10cSrcweir // ist ueberhaupt ein neues da? 484cdf0e10cSrcweir if( pNewDoc != mpDoc ) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir mpDoc = pNewDoc; 487cdf0e10cSrcweir if(mpDoc) 488cdf0e10cSrcweir StartListening( *mpDoc ); 489cdf0e10cSrcweir } 490cdf0e10cSrcweir } 491cdf0e10cSrcweir } 492cdf0e10cSrcweir } 493cdf0e10cSrcweir } 494cdf0e10cSrcweir SfxBaseModel::Notify( rBC, rHint ); 495cdf0e10cSrcweir } 496cdf0e10cSrcweir 497cdf0e10cSrcweir /****************************************************************************** 498cdf0e10cSrcweir * * 499cdf0e10cSrcweir ******************************************************************************/ 500cdf0e10cSrcweir SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, sal_Bool bDuplicate ) throw() 501cdf0e10cSrcweir { 502cdf0e10cSrcweir sal_uInt16 nPageCount = mpDoc->GetSdPageCount( PK_STANDARD ); 503cdf0e10cSrcweir SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin(); 504cdf0e10cSrcweir sal_uInt8 aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False); 505cdf0e10cSrcweir sal_uInt8 aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False); 506cdf0e10cSrcweir 507cdf0e10cSrcweir SdPage* pStandardPage = NULL; 508cdf0e10cSrcweir 509cdf0e10cSrcweir if( 0 == nPageCount ) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir // this is only used for clipboard where we only have one page 512cdf0e10cSrcweir pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False); 513cdf0e10cSrcweir 514cdf0e10cSrcweir Size aDefSize(21000, 29700); // A4-Hochformat 515cdf0e10cSrcweir pStandardPage->SetSize( aDefSize ); 516cdf0e10cSrcweir mpDoc->InsertPage(pStandardPage, 0); 517cdf0e10cSrcweir } 518cdf0e10cSrcweir else 519cdf0e10cSrcweir { 520cdf0e10cSrcweir // Hier wird die Seite ermittelt, hinter der eingefuegt werden soll 521cdf0e10cSrcweir SdPage* pPreviousStandardPage = mpDoc->GetSdPage( Min( (sal_uInt16)(nPageCount - 1), nPage ), PK_STANDARD ); 522cdf0e10cSrcweir SetOfByte aVisibleLayers = pPreviousStandardPage->TRG_GetMasterPageVisibleLayers(); 523cdf0e10cSrcweir sal_Bool bIsPageBack = aVisibleLayers.IsSet( aBckgrnd ); 524cdf0e10cSrcweir sal_Bool bIsPageObj = aVisibleLayers.IsSet( aBckgrndObj ); 525cdf0e10cSrcweir 526cdf0e10cSrcweir // AutoLayouts muessen fertig sein 527cdf0e10cSrcweir mpDoc->StopWorkStartupDelay(); 528cdf0e10cSrcweir 529cdf0e10cSrcweir /************************************************************** 530cdf0e10cSrcweir * Es wird stets zuerst eine Standardseite und dann eine 531cdf0e10cSrcweir * Notizseite erzeugt. Es ist sichergestellt, dass auf eine 532cdf0e10cSrcweir * Standardseite stets die zugehoerige Notizseite folgt. 533cdf0e10cSrcweir **************************************************************/ 534cdf0e10cSrcweir 535cdf0e10cSrcweir sal_uInt16 nStandardPageNum = pPreviousStandardPage->GetPageNum() + 2; 536cdf0e10cSrcweir SdPage* pPreviousNotesPage = (SdPage*) mpDoc->GetPage( nStandardPageNum - 1 ); 537cdf0e10cSrcweir sal_uInt16 nNotesPageNum = nStandardPageNum + 1; 538cdf0e10cSrcweir String aStandardPageName; 539cdf0e10cSrcweir String aNotesPageName; 540cdf0e10cSrcweir 541cdf0e10cSrcweir /************************************************************** 542cdf0e10cSrcweir * Standardseite 543cdf0e10cSrcweir **************************************************************/ 544cdf0e10cSrcweir if( bDuplicate ) 545cdf0e10cSrcweir pStandardPage = (SdPage*) pPreviousStandardPage->Clone(); 546cdf0e10cSrcweir else 547cdf0e10cSrcweir pStandardPage = (SdPage*) mpDoc->AllocPage(sal_False); 548cdf0e10cSrcweir 549cdf0e10cSrcweir pStandardPage->SetSize( pPreviousStandardPage->GetSize() ); 550cdf0e10cSrcweir pStandardPage->SetBorder( pPreviousStandardPage->GetLftBorder(), 551cdf0e10cSrcweir pPreviousStandardPage->GetUppBorder(), 552cdf0e10cSrcweir pPreviousStandardPage->GetRgtBorder(), 553cdf0e10cSrcweir pPreviousStandardPage->GetLwrBorder() ); 554cdf0e10cSrcweir pStandardPage->SetOrientation( pPreviousStandardPage->GetOrientation() ); 555cdf0e10cSrcweir pStandardPage->SetName(aStandardPageName); 556cdf0e10cSrcweir 557cdf0e10cSrcweir // Seite hinter aktueller Seite einfuegen 558cdf0e10cSrcweir mpDoc->InsertPage(pStandardPage, nStandardPageNum); 559cdf0e10cSrcweir 560cdf0e10cSrcweir if( !bDuplicate ) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir // MasterPage der aktuellen Seite verwenden 563cdf0e10cSrcweir pStandardPage->TRG_SetMasterPage(pPreviousStandardPage->TRG_GetMasterPage()); 564cdf0e10cSrcweir pStandardPage->SetLayoutName( pPreviousStandardPage->GetLayoutName() ); 565cdf0e10cSrcweir pStandardPage->SetAutoLayout(AUTOLAYOUT_NONE, sal_True ); 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir aBckgrnd = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRND)), sal_False); 569cdf0e10cSrcweir aBckgrndObj = rLayerAdmin.GetLayerID(String(SdResId(STR_LAYER_BCKGRNDOBJ)), sal_False); 570cdf0e10cSrcweir aVisibleLayers.Set(aBckgrnd, bIsPageBack); 571cdf0e10cSrcweir aVisibleLayers.Set(aBckgrndObj, bIsPageObj); 572cdf0e10cSrcweir pStandardPage->TRG_SetMasterPageVisibleLayers(aVisibleLayers); 573cdf0e10cSrcweir 574cdf0e10cSrcweir /************************************************************** 575cdf0e10cSrcweir * Notizseite 576cdf0e10cSrcweir **************************************************************/ 577cdf0e10cSrcweir SdPage* pNotesPage = NULL; 578cdf0e10cSrcweir 579cdf0e10cSrcweir if( bDuplicate ) 580cdf0e10cSrcweir pNotesPage = (SdPage*) pPreviousNotesPage->Clone(); 581cdf0e10cSrcweir else 582cdf0e10cSrcweir pNotesPage = (SdPage*) mpDoc->AllocPage(sal_False); 583cdf0e10cSrcweir 584cdf0e10cSrcweir pNotesPage->SetSize( pPreviousNotesPage->GetSize() ); 585cdf0e10cSrcweir pNotesPage->SetBorder( pPreviousNotesPage->GetLftBorder(), 586cdf0e10cSrcweir pPreviousNotesPage->GetUppBorder(), 587cdf0e10cSrcweir pPreviousNotesPage->GetRgtBorder(), 588cdf0e10cSrcweir pPreviousNotesPage->GetLwrBorder() ); 589cdf0e10cSrcweir pNotesPage->SetOrientation( pPreviousNotesPage->GetOrientation() ); 590cdf0e10cSrcweir pNotesPage->SetName(aNotesPageName); 591cdf0e10cSrcweir pNotesPage->SetPageKind(PK_NOTES); 592cdf0e10cSrcweir 593cdf0e10cSrcweir // Seite hinter aktueller Seite einfuegen 594cdf0e10cSrcweir mpDoc->InsertPage(pNotesPage, nNotesPageNum); 595cdf0e10cSrcweir 596cdf0e10cSrcweir if( !bDuplicate ) 597cdf0e10cSrcweir { 598cdf0e10cSrcweir // MasterPage der aktuellen Seite verwenden 599cdf0e10cSrcweir pNotesPage->TRG_SetMasterPage(pPreviousNotesPage->TRG_GetMasterPage()); 600cdf0e10cSrcweir pNotesPage->SetLayoutName( pPreviousNotesPage->GetLayoutName() ); 601cdf0e10cSrcweir pNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True ); 602cdf0e10cSrcweir } 603cdf0e10cSrcweir } 604cdf0e10cSrcweir 605cdf0e10cSrcweir SetModified(); 606cdf0e10cSrcweir 607cdf0e10cSrcweir return( pStandardPage ); 608cdf0e10cSrcweir } 609cdf0e10cSrcweir 610cdf0e10cSrcweir void SdXImpressDocument::SetModified( sal_Bool bModified /* = sal_True */ ) throw() 611cdf0e10cSrcweir { 612cdf0e10cSrcweir if( mpDoc ) 613cdf0e10cSrcweir mpDoc->SetChanged( bModified ); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir 616cdf0e10cSrcweir // XModel 617cdf0e10cSrcweir void SAL_CALL SdXImpressDocument ::lockControllers( ) 618cdf0e10cSrcweir throw(uno::RuntimeException) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 621cdf0e10cSrcweir 622cdf0e10cSrcweir if( NULL == mpDoc ) 623cdf0e10cSrcweir throw lang::DisposedException(); 624cdf0e10cSrcweir 625cdf0e10cSrcweir mpDoc->setLock( sal_True ); 626cdf0e10cSrcweir } 627cdf0e10cSrcweir 628cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::unlockControllers( ) 629cdf0e10cSrcweir throw(uno::RuntimeException) 630cdf0e10cSrcweir { 631cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 632cdf0e10cSrcweir 633cdf0e10cSrcweir if( NULL == mpDoc ) 634cdf0e10cSrcweir throw lang::DisposedException(); 635cdf0e10cSrcweir 636cdf0e10cSrcweir if( mpDoc->isLocked() ) 637cdf0e10cSrcweir { 638cdf0e10cSrcweir mpDoc->setLock( sal_False ); 639cdf0e10cSrcweir } 640cdf0e10cSrcweir } 641cdf0e10cSrcweir 642cdf0e10cSrcweir sal_Bool SAL_CALL SdXImpressDocument::hasControllersLocked( ) 643cdf0e10cSrcweir throw(uno::RuntimeException) 644cdf0e10cSrcweir { 645cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 646cdf0e10cSrcweir 647cdf0e10cSrcweir if( NULL == mpDoc ) 648cdf0e10cSrcweir throw lang::DisposedException(); 649cdf0e10cSrcweir 650cdf0e10cSrcweir return mpDoc && mpDoc->isLocked(); 651cdf0e10cSrcweir } 652cdf0e10cSrcweir 653cdf0e10cSrcweir #ifndef _UNOTOOLS_PROCESSFACTORY_HXX 654cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 655cdf0e10cSrcweir #endif 656cdf0e10cSrcweir 657cdf0e10cSrcweir uno::Reference < container::XIndexAccess > SAL_CALL SdXImpressDocument::getViewData() throw( uno::RuntimeException ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 660cdf0e10cSrcweir 661cdf0e10cSrcweir if( NULL == mpDoc ) 662cdf0e10cSrcweir throw lang::DisposedException(); 663cdf0e10cSrcweir 664cdf0e10cSrcweir uno::Reference < container::XIndexAccess > xRet( SfxBaseModel::getViewData() ); 665cdf0e10cSrcweir 666cdf0e10cSrcweir if( !xRet.is() ) 667cdf0e10cSrcweir { 668cdf0e10cSrcweir List* pFrameViewList = mpDoc->GetFrameViewList(); 669cdf0e10cSrcweir 670cdf0e10cSrcweir if( pFrameViewList && pFrameViewList->Count() ) 671cdf0e10cSrcweir { 672cdf0e10cSrcweir xRet = uno::Reference < container::XIndexAccess >::query(::comphelper::getProcessServiceFactory()->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.IndexedPropertyValues")))); 673cdf0e10cSrcweir 674cdf0e10cSrcweir 675cdf0e10cSrcweir uno::Reference < container::XIndexContainer > xCont( xRet, uno::UNO_QUERY ); 676cdf0e10cSrcweir DBG_ASSERT( xCont.is(), "SdXImpressDocument::getViewData() failed for OLE object" ); 677cdf0e10cSrcweir if( xCont.is() ) 678cdf0e10cSrcweir { 679cdf0e10cSrcweir sal_uInt32 i; 680cdf0e10cSrcweir for( i = 0; i < pFrameViewList->Count(); i++ ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir ::sd::FrameView* pFrameView = 683cdf0e10cSrcweir static_cast< ::sd::FrameView*>( 684cdf0e10cSrcweir pFrameViewList->GetObject(i)); 685cdf0e10cSrcweir 686cdf0e10cSrcweir if(pFrameView) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aSeq; 689cdf0e10cSrcweir pFrameView->WriteUserDataSequence( aSeq ); 690cdf0e10cSrcweir xCont->insertByIndex( i, uno::makeAny( aSeq ) ); 691cdf0e10cSrcweir } 692cdf0e10cSrcweir } 693cdf0e10cSrcweir } 694cdf0e10cSrcweir } 695cdf0e10cSrcweir } 696cdf0e10cSrcweir 697cdf0e10cSrcweir return xRet; 698cdf0e10cSrcweir } 699cdf0e10cSrcweir 700cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::setViewData( const uno::Reference < container::XIndexAccess >& xData ) throw(::com::sun::star::uno::RuntimeException) 701cdf0e10cSrcweir { 702cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 703cdf0e10cSrcweir 704cdf0e10cSrcweir if( NULL == mpDoc ) 705cdf0e10cSrcweir throw lang::DisposedException(); 706cdf0e10cSrcweir 707cdf0e10cSrcweir SfxBaseModel::setViewData( xData ); 708cdf0e10cSrcweir if( mpDocShell && (mpDocShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED) && xData.is() ) 709cdf0e10cSrcweir { 710cdf0e10cSrcweir const sal_Int32 nCount = xData->getCount(); 711cdf0e10cSrcweir 712cdf0e10cSrcweir List* pFrameViewList = mpDoc->GetFrameViewList(); 713cdf0e10cSrcweir 714cdf0e10cSrcweir DBG_ASSERT( pFrameViewList, "No FrameViewList?" ); 715cdf0e10cSrcweir if( pFrameViewList ) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir ::sd::FrameView* pFrameView; 718cdf0e10cSrcweir 719cdf0e10cSrcweir sal_uInt32 i; 720cdf0e10cSrcweir for ( i = 0; i < pFrameViewList->Count(); i++) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir // Ggf. FrameViews loeschen 723cdf0e10cSrcweir pFrameView = static_cast< ::sd::FrameView*>( 724cdf0e10cSrcweir pFrameViewList->GetObject(i)); 725cdf0e10cSrcweir 726cdf0e10cSrcweir if (pFrameView) 727cdf0e10cSrcweir delete pFrameView; 728cdf0e10cSrcweir } 729cdf0e10cSrcweir 730cdf0e10cSrcweir pFrameViewList->Clear(); 731cdf0e10cSrcweir 732cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aSeq; 733cdf0e10cSrcweir sal_Int32 nIndex; 734cdf0e10cSrcweir for( nIndex = 0; nIndex < nCount; nIndex++ ) 735cdf0e10cSrcweir { 736cdf0e10cSrcweir if( xData->getByIndex( nIndex ) >>= aSeq ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir pFrameView = new ::sd::FrameView( mpDoc ); 739cdf0e10cSrcweir pFrameView->ReadUserDataSequence( aSeq ); 740cdf0e10cSrcweir pFrameViewList->Insert( pFrameView ); 741cdf0e10cSrcweir } 742cdf0e10cSrcweir } 743cdf0e10cSrcweir } 744cdf0e10cSrcweir } 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir // XDrawPageDuplicator 748cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::duplicate( const uno::Reference< drawing::XDrawPage >& xPage ) 749cdf0e10cSrcweir throw(uno::RuntimeException) 750cdf0e10cSrcweir { 751cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 752cdf0e10cSrcweir 753cdf0e10cSrcweir if( NULL == mpDoc ) 754cdf0e10cSrcweir throw lang::DisposedException(); 755cdf0e10cSrcweir 756cdf0e10cSrcweir // pPage von xPage besorgen und dann die Id (nPos )ermitteln 757cdf0e10cSrcweir SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage ); 758cdf0e10cSrcweir if( pSvxPage ) 759cdf0e10cSrcweir { 760cdf0e10cSrcweir SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage(); 761cdf0e10cSrcweir sal_uInt16 nPos = pPage->GetPageNum(); 762cdf0e10cSrcweir nPos = ( nPos - 1 ) / 2; 763cdf0e10cSrcweir pPage = InsertSdPage( nPos, sal_True ); 764cdf0e10cSrcweir if( pPage ) 765cdf0e10cSrcweir { 766cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); 767cdf0e10cSrcweir return xDrawPage; 768cdf0e10cSrcweir } 769cdf0e10cSrcweir } 770cdf0e10cSrcweir 771cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage; 772cdf0e10cSrcweir return xDrawPage; 773cdf0e10cSrcweir } 774cdf0e10cSrcweir 775cdf0e10cSrcweir 776cdf0e10cSrcweir // XDrawPagesSupplier 777cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages() 778cdf0e10cSrcweir throw(uno::RuntimeException) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 781cdf0e10cSrcweir 782cdf0e10cSrcweir if( NULL == mpDoc ) 783cdf0e10cSrcweir throw lang::DisposedException(); 784cdf0e10cSrcweir 785cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess ); 786cdf0e10cSrcweir 787cdf0e10cSrcweir if( !xDrawPages.is() ) 788cdf0e10cSrcweir { 789cdf0e10cSrcweir initializeDocument(); 790cdf0e10cSrcweir mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SdDrawPagesAccess(*this); 791cdf0e10cSrcweir } 792cdf0e10cSrcweir 793cdf0e10cSrcweir return xDrawPages; 794cdf0e10cSrcweir } 795cdf0e10cSrcweir 796cdf0e10cSrcweir // XMasterPagesSupplier 797cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getMasterPages() 798cdf0e10cSrcweir throw(uno::RuntimeException) 799cdf0e10cSrcweir { 800cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 801cdf0e10cSrcweir 802cdf0e10cSrcweir if( NULL == mpDoc ) 803cdf0e10cSrcweir throw lang::DisposedException(); 804cdf0e10cSrcweir 805cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > xMasterPages( mxMasterPagesAccess ); 806cdf0e10cSrcweir 807cdf0e10cSrcweir if( !xMasterPages.is() ) 808cdf0e10cSrcweir { 8099a5efb21SZhe Wang if ( !hasControllersLocked() ) 810cdf0e10cSrcweir initializeDocument(); 811cdf0e10cSrcweir mxMasterPagesAccess = xMasterPages = new SdMasterPagesAccess(*this); 812cdf0e10cSrcweir } 813cdf0e10cSrcweir 814cdf0e10cSrcweir return xMasterPages; 815cdf0e10cSrcweir } 816cdf0e10cSrcweir 817cdf0e10cSrcweir // XLayerManagerSupplier 818cdf0e10cSrcweir uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLayerManager( ) 819cdf0e10cSrcweir throw(uno::RuntimeException) 820cdf0e10cSrcweir { 821cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 822cdf0e10cSrcweir 823cdf0e10cSrcweir if( NULL == mpDoc ) 824cdf0e10cSrcweir throw lang::DisposedException(); 825cdf0e10cSrcweir 826cdf0e10cSrcweir uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager ); 827cdf0e10cSrcweir 828cdf0e10cSrcweir if( !xLayerManager.is() ) 829cdf0e10cSrcweir mxLayerManager = xLayerManager = new SdLayerManager(*this); 830cdf0e10cSrcweir 831cdf0e10cSrcweir return xLayerManager; 832cdf0e10cSrcweir } 833cdf0e10cSrcweir 834cdf0e10cSrcweir // XCustomPresentationSupplier 835cdf0e10cSrcweir uno::Reference< container::XNameContainer > SAL_CALL SdXImpressDocument::getCustomPresentations() 836cdf0e10cSrcweir throw(uno::RuntimeException) 837cdf0e10cSrcweir { 838cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 839cdf0e10cSrcweir 840cdf0e10cSrcweir if( NULL == mpDoc ) 841cdf0e10cSrcweir throw lang::DisposedException(); 842cdf0e10cSrcweir 843cdf0e10cSrcweir uno::Reference< container::XNameContainer > xCustomPres( mxCustomPresentationAccess ); 844cdf0e10cSrcweir 845cdf0e10cSrcweir if( !xCustomPres.is() ) 846cdf0e10cSrcweir mxCustomPresentationAccess = xCustomPres = new SdXCustomPresentationAccess(*this); 847cdf0e10cSrcweir 848cdf0e10cSrcweir return xCustomPres; 849cdf0e10cSrcweir } 850cdf0e10cSrcweir 851cdf0e10cSrcweir extern uno::Reference< presentation::XPresentation > createPresentation( SdXImpressDocument& rModel ); 852cdf0e10cSrcweir 853cdf0e10cSrcweir // XPresentationSupplier 854cdf0e10cSrcweir uno::Reference< presentation::XPresentation > SAL_CALL SdXImpressDocument::getPresentation() 855cdf0e10cSrcweir throw(uno::RuntimeException) 856cdf0e10cSrcweir { 857cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 858cdf0e10cSrcweir 859cdf0e10cSrcweir if( NULL == mpDoc ) 860cdf0e10cSrcweir throw lang::DisposedException(); 861cdf0e10cSrcweir 862cdf0e10cSrcweir return uno::Reference< presentation::XPresentation >( mpDoc->getPresentation().get() ); 863cdf0e10cSrcweir } 864cdf0e10cSrcweir 865cdf0e10cSrcweir // XHandoutMasterSupplier 866cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMasterPage() 867cdf0e10cSrcweir throw (uno::RuntimeException) 868cdf0e10cSrcweir { 869cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 870cdf0e10cSrcweir 871cdf0e10cSrcweir if( NULL == mpDoc ) 872cdf0e10cSrcweir throw lang::DisposedException(); 873cdf0e10cSrcweir 874cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xPage; 875cdf0e10cSrcweir 876cdf0e10cSrcweir if( mpDoc ) 877cdf0e10cSrcweir { 878cdf0e10cSrcweir initializeDocument(); 879cdf0e10cSrcweir SdPage* pPage = mpDoc->GetMasterSdPage( 0, PK_HANDOUT ); 880cdf0e10cSrcweir if( pPage ) 881cdf0e10cSrcweir xPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ); 882cdf0e10cSrcweir } 883cdf0e10cSrcweir return xPage; 884cdf0e10cSrcweir } 885cdf0e10cSrcweir 886cdf0e10cSrcweir // XMultiServiceFactory ( SvxFmMSFactory ) 887cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SdXImpressDocument::createInstance( const OUString& aServiceSpecifier ) 888cdf0e10cSrcweir throw(uno::Exception, uno::RuntimeException) 889cdf0e10cSrcweir { 890cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 891cdf0e10cSrcweir 892cdf0e10cSrcweir if( NULL == mpDoc ) 893cdf0e10cSrcweir throw lang::DisposedException(); 894cdf0e10cSrcweir 895cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) ) 896cdf0e10cSrcweir { 897cdf0e10cSrcweir if( !mxDashTable.is() ) 898cdf0e10cSrcweir mxDashTable = SvxUnoDashTable_createInstance( mpDoc ); 899cdf0e10cSrcweir 900cdf0e10cSrcweir return mxDashTable; 901cdf0e10cSrcweir } 902cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) ) 903cdf0e10cSrcweir { 904cdf0e10cSrcweir if( !mxGradientTable.is() ) 905cdf0e10cSrcweir mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc ); 906cdf0e10cSrcweir 907cdf0e10cSrcweir return mxGradientTable; 908cdf0e10cSrcweir } 909cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) ) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir if( !mxHatchTable.is() ) 912cdf0e10cSrcweir mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc ); 913cdf0e10cSrcweir 914cdf0e10cSrcweir return mxHatchTable; 915cdf0e10cSrcweir } 916cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) ) 917cdf0e10cSrcweir { 918cdf0e10cSrcweir if( !mxBitmapTable.is() ) 919cdf0e10cSrcweir mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc ); 920cdf0e10cSrcweir 921cdf0e10cSrcweir return mxBitmapTable; 922cdf0e10cSrcweir } 923cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ) 924cdf0e10cSrcweir { 925cdf0e10cSrcweir if( !mxTransGradientTable.is() ) 926cdf0e10cSrcweir mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc ); 927cdf0e10cSrcweir 928cdf0e10cSrcweir return mxTransGradientTable; 929cdf0e10cSrcweir } 930cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) ) 931cdf0e10cSrcweir { 932cdf0e10cSrcweir if( !mxMarkerTable.is() ) 933cdf0e10cSrcweir mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc ); 934cdf0e10cSrcweir 935cdf0e10cSrcweir return mxMarkerTable; 936cdf0e10cSrcweir } 937cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) ) 938cdf0e10cSrcweir { 939cdf0e10cSrcweir return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY ); 940cdf0e10cSrcweir } 941cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Background" ) ) ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir return uno::Reference< uno::XInterface >( 944cdf0e10cSrcweir static_cast<uno::XWeak*>(new SdUnoPageBackground( mpDoc ))); 945cdf0e10cSrcweir } 946cdf0e10cSrcweir 947cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Defaults") ) ) 948cdf0e10cSrcweir { 949cdf0e10cSrcweir if( !mxDrawingPool.is() ) 950cdf0e10cSrcweir mxDrawingPool = SdUnoCreatePool( mpDoc ); 951cdf0e10cSrcweir 952cdf0e10cSrcweir return mxDrawingPool; 953cdf0e10cSrcweir 954cdf0e10cSrcweir } 955cdf0e10cSrcweir 956cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapRectangleObject) ) ) 957cdf0e10cSrcweir { 958cdf0e10cSrcweir return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() ); 959cdf0e10cSrcweir } 960cdf0e10cSrcweir 961cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapCircleObject) ) ) 962cdf0e10cSrcweir { 963cdf0e10cSrcweir return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() ); 964cdf0e10cSrcweir } 965cdf0e10cSrcweir 966cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sUNO_Service_ImageMapPolygonObject) ) ) 967cdf0e10cSrcweir { 968cdf0e10cSrcweir return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() ); 969cdf0e10cSrcweir } 970cdf0e10cSrcweir 971cdf0e10cSrcweir if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.Settings") ) ) || 972cdf0e10cSrcweir ( !mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DocumentSettings") ) ) ) || 973cdf0e10cSrcweir ( mbImpressDoc && ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.DocumentSettings") ) ) ) ) 974cdf0e10cSrcweir { 975cdf0e10cSrcweir return sd::DocumentSettings_createInstance( this ); 976cdf0e10cSrcweir } 977cdf0e10cSrcweir 978cdf0e10cSrcweir if( ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) || 979cdf0e10cSrcweir ( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.textfield.DateTime") ) ) ) 980cdf0e10cSrcweir { 981cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD ); 982cdf0e10cSrcweir } 983cdf0e10cSrcweir 984cdf0e10cSrcweir if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Header"))) || 985cdf0e10cSrcweir (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Header"))) ) 986cdf0e10cSrcweir { 987cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvxUnoTextField( ID_HEADERFIELD ); 988cdf0e10cSrcweir } 989cdf0e10cSrcweir 990cdf0e10cSrcweir if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.Footer"))) || 991cdf0e10cSrcweir (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.Footer"))) ) 992cdf0e10cSrcweir { 993cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvxUnoTextField( ID_FOOTERFIELD ); 994cdf0e10cSrcweir } 995cdf0e10cSrcweir 996cdf0e10cSrcweir if( (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.TextField.DateTime"))) || 997cdf0e10cSrcweir (0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.presentation.textfield.DateTime"))) ) 998cdf0e10cSrcweir { 999cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvxUnoTextField( ID_DATETIMEFIELD ); 1000cdf0e10cSrcweir } 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.xml.NamespaceMap") ) ) 1003cdf0e10cSrcweir { 1004cdf0e10cSrcweir static sal_uInt16 aWhichIds[] = { SDRATTR_XMLATTRIBUTES, EE_CHAR_XMLATTRIBS, EE_PARA_XMLATTRIBS, 0 }; 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir return svx::NamespaceMap_createInstance( aWhichIds, &mpDoc->GetItemPool() ); 1007cdf0e10cSrcweir } 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver 1010cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver") ) ) 1011cdf0e10cSrcweir { 1012cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE ); 1013cdf0e10cSrcweir } 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver") ) ) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ ); 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir 1020cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver") ) ) 1021cdf0e10cSrcweir { 1022cdf0e10cSrcweir ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL; 1023cdf0e10cSrcweir if( NULL == pPersist ) 1024cdf0e10cSrcweir throw lang::DisposedException(); 1025cdf0e10cSrcweir 1026cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_WRITE ); 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver") ) ) 1030cdf0e10cSrcweir { 1031cdf0e10cSrcweir ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : NULL; 1032cdf0e10cSrcweir if( NULL == pPersist ) 1033cdf0e10cSrcweir throw lang::DisposedException(); 1034cdf0e10cSrcweir 1035cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvXMLEmbeddedObjectHelper( *pPersist, EMBEDDEDOBJECTHELPER_MODE_READ ); 1036cdf0e10cSrcweir } 1037cdf0e10cSrcweir 1038cdf0e10cSrcweir uno::Reference< uno::XInterface > xRet; 1039cdf0e10cSrcweir 1040cdf0e10cSrcweir const String aType( aServiceSpecifier ); 1041cdf0e10cSrcweir if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) ) 1042cdf0e10cSrcweir { 1043cdf0e10cSrcweir SvxShape* pShape = NULL; 1044cdf0e10cSrcweir 1045cdf0e10cSrcweir sal_uInt16 nType = OBJ_TEXT; 1046cdf0e10cSrcweir // create a shape wrapper 1047cdf0e10cSrcweir if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) ) 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir nType = OBJ_TEXT; 1050cdf0e10cSrcweir } 1051cdf0e10cSrcweir else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) ) 1052cdf0e10cSrcweir { 1053cdf0e10cSrcweir nType = OBJ_TEXT; 1054cdf0e10cSrcweir } 1055cdf0e10cSrcweir else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) ) 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir nType = OBJ_TEXT; 1058cdf0e10cSrcweir } 1059cdf0e10cSrcweir else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) ) 1060cdf0e10cSrcweir { 1061cdf0e10cSrcweir nType = OBJ_GRAF; 1062cdf0e10cSrcweir } 1063cdf0e10cSrcweir else if( aType.EqualsAscii( "PageShape", 26, 9 ) ) 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir nType = OBJ_PAGE; 1066cdf0e10cSrcweir } 1067cdf0e10cSrcweir else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) ) 1068cdf0e10cSrcweir { 1069cdf0e10cSrcweir nType = OBJ_OLE2; 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir else if( aType.EqualsAscii( "ChartShape", 26, 10 ) ) 1072cdf0e10cSrcweir { 1073cdf0e10cSrcweir nType = OBJ_OLE2; 1074cdf0e10cSrcweir } 1075cdf0e10cSrcweir else if( aType.EqualsAscii( "CalcShape", 26, 9 ) ) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir nType = OBJ_OLE2; 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) 1080cdf0e10cSrcweir { 1081cdf0e10cSrcweir nType = OBJ_TABLE; 1082cdf0e10cSrcweir } 1083cdf0e10cSrcweir else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) ) 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir nType = OBJ_OLE2; 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir else if( aType.EqualsAscii( "NotesShape", 26, 13 ) ) 1088cdf0e10cSrcweir { 1089cdf0e10cSrcweir nType = OBJ_TEXT; 1090cdf0e10cSrcweir } 1091cdf0e10cSrcweir else if( aType.EqualsAscii( "HandoutShape", 26, 13 ) ) 1092cdf0e10cSrcweir { 1093cdf0e10cSrcweir nType = OBJ_PAGE; 1094cdf0e10cSrcweir } 1095cdf0e10cSrcweir else if( aType.EqualsAscii( "FooterShape", 26, 12 ) ) 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir nType = OBJ_TEXT; 1098cdf0e10cSrcweir } 1099cdf0e10cSrcweir else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) ) 1100cdf0e10cSrcweir { 1101cdf0e10cSrcweir nType = OBJ_TEXT; 1102cdf0e10cSrcweir } 1103cdf0e10cSrcweir else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) ) 1104cdf0e10cSrcweir { 1105cdf0e10cSrcweir nType = OBJ_TEXT; 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) ) 1108cdf0e10cSrcweir { 1109cdf0e10cSrcweir nType = OBJ_TEXT; 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir else if( aType.EqualsAscii( "MediaShape", 26, 10 ) ) 1112cdf0e10cSrcweir { 1113cdf0e10cSrcweir nType = OBJ_MEDIA; 1114cdf0e10cSrcweir } 1115cdf0e10cSrcweir else 1116cdf0e10cSrcweir { 1117cdf0e10cSrcweir throw lang::ServiceNotRegisteredException(); 1118cdf0e10cSrcweir } 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir // create the API wrapper 1121cdf0e10cSrcweir pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor ); 1122cdf0e10cSrcweir 1123cdf0e10cSrcweir // set shape type 1124cdf0e10cSrcweir if( pShape && !mbClipBoard ) 1125cdf0e10cSrcweir pShape->SetShapeType(aServiceSpecifier); 1126cdf0e10cSrcweir 1127cdf0e10cSrcweir xRet = (uno::XWeak*)pShape; 1128cdf0e10cSrcweir } 1129cdf0e10cSrcweir else if( aServiceSpecifier.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TableShape") ) ) 1130cdf0e10cSrcweir { 1131cdf0e10cSrcweir SvxShape* pShape = CreateSvxShapeByTypeAndInventor( OBJ_TABLE, SdrInventor ); 1132cdf0e10cSrcweir if( pShape && !mbClipBoard ) 1133cdf0e10cSrcweir pShape->SetShapeType(aServiceSpecifier); 1134cdf0e10cSrcweir 1135cdf0e10cSrcweir xRet = (uno::XWeak*)pShape; 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir else 1138cdf0e10cSrcweir { 1139cdf0e10cSrcweir xRet = SvxFmMSFactory::createInstance( aServiceSpecifier ); 1140cdf0e10cSrcweir } 1141cdf0e10cSrcweir 1142cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( xRet, uno::UNO_QUERY ); 1143cdf0e10cSrcweir if( xShape.is() ) 1144cdf0e10cSrcweir { 1145cdf0e10cSrcweir xRet.clear(); 1146cdf0e10cSrcweir new SdXShape( SvxShape::getImplementation( xShape ), (SdXImpressDocument*)this ); 1147cdf0e10cSrcweir xRet = xShape; 1148cdf0e10cSrcweir xShape.clear(); 1149cdf0e10cSrcweir } 1150cdf0e10cSrcweir 1151cdf0e10cSrcweir return xRet; 1152cdf0e10cSrcweir } 1153cdf0e10cSrcweir 1154cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames() 1155cdf0e10cSrcweir throw(uno::RuntimeException) 1156cdf0e10cSrcweir { 1157cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir if( NULL == mpDoc ) 1160cdf0e10cSrcweir throw lang::DisposedException(); 1161cdf0e10cSrcweir 1162cdf0e10cSrcweir const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); 1163cdf0e10cSrcweir 1164cdf0e10cSrcweir uno::Sequence< OUString > aSNS( mbImpressDoc ? (36) : (19) ); 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir sal_uInt16 i(0); 1167cdf0e10cSrcweir 1168cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")); 1169cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")); 1170cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")); 1171cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")); 1172cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")); 1173cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable")); 1174cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules")); 1175cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Background")); 1176cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.Settings")); 1177cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapRectangleObject)); 1178cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapCircleObject)); 1179cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM(sUNO_Service_ImageMapPolygonObject)); 1180cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.NamespaceMap")); 1181cdf0e10cSrcweir 1182cdf0e10cSrcweir // #99870# Support creation of GraphicObjectResolver and EmbeddedObjectResolver 1183cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportGraphicObjectResolver")); 1184cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportGraphicObjectResolver")); 1185cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ExportEmbeddedObjectResolver")); 1186cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")); 1187cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TableShape")); 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir if(mbImpressDoc) 1190cdf0e10cSrcweir { 1191cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")); 1192cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")); 1193cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape")); 1194cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape")); 1195cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape")); 1196cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")); 1197cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape")); 1198cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape")); 1199cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape")); 1200cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape")); 1201cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape")); 1202cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DocumentSettings")); 1203cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.FooterShape")); 1204cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HeaderShape")); 1205cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SlideNumberShape")); 1206cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.DateTimeShape")); 1207cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.CalcShape")); 1208cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.MediaShape")); 1209cdf0e10cSrcweir } 1210cdf0e10cSrcweir else 1211cdf0e10cSrcweir { 1212cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DocumentSettings")); 1213cdf0e10cSrcweir } 1214cdf0e10cSrcweir 1215cdf0e10cSrcweir DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" ); 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir return comphelper::concatSequences( aSNS_ORG, aSNS ); 1218cdf0e10cSrcweir } 1219cdf0e10cSrcweir 1220cdf0e10cSrcweir // lang::XServiceInfo 1221cdf0e10cSrcweir OUString SAL_CALL SdXImpressDocument::getImplementationName() 1222cdf0e10cSrcweir throw(uno::RuntimeException) 1223cdf0e10cSrcweir { 1224cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("SdXImpressDocument")); 1225cdf0e10cSrcweir } 1226cdf0e10cSrcweir 1227cdf0e10cSrcweir sal_Bool SAL_CALL SdXImpressDocument::supportsService( const OUString& ServiceName ) 1228cdf0e10cSrcweir throw(uno::RuntimeException) 1229cdf0e10cSrcweir { 1230cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1231cdf0e10cSrcweir 1232cdf0e10cSrcweir if ( 1233cdf0e10cSrcweir (ServiceName.equalsAscii("com.sun.star.document.OfficeDocument" )) || 1234cdf0e10cSrcweir (ServiceName.equalsAscii("com.sun.star.drawing.GenericDrawingDocument")) || 1235cdf0e10cSrcweir (ServiceName.equalsAscii("com.sun.star.drawing.DrawingDocumentFactory")) 1236cdf0e10cSrcweir ) 1237cdf0e10cSrcweir { 1238cdf0e10cSrcweir return sal_True; 1239cdf0e10cSrcweir } 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir return ( 1242cdf0e10cSrcweir ( mbImpressDoc && ServiceName.equalsAscii("com.sun.star.presentation.PresentationDocument")) || 1243cdf0e10cSrcweir (!mbImpressDoc && ServiceName.equalsAscii("com.sun.star.drawing.DrawingDocument" )) 1244cdf0e10cSrcweir ); 1245cdf0e10cSrcweir } 1246cdf0e10cSrcweir 1247cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getSupportedServiceNames() throw(uno::RuntimeException) 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1250cdf0e10cSrcweir 1251cdf0e10cSrcweir uno::Sequence< OUString > aSeq( 4 ); 1252cdf0e10cSrcweir OUString* pServices = aSeq.getArray(); 1253cdf0e10cSrcweir 1254cdf0e10cSrcweir *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.OfficeDocument")); 1255cdf0e10cSrcweir *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GenericDrawingDocument")); 1256cdf0e10cSrcweir *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocumentFactory")); 1257cdf0e10cSrcweir 1258cdf0e10cSrcweir if( mbImpressDoc ) 1259cdf0e10cSrcweir *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument")); 1260cdf0e10cSrcweir else 1261cdf0e10cSrcweir *pServices++ = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument")); 1262cdf0e10cSrcweir 1263cdf0e10cSrcweir return aSeq; 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir 1266cdf0e10cSrcweir // XPropertySet 1267cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > SAL_CALL SdXImpressDocument::getPropertySetInfo( ) 1268cdf0e10cSrcweir throw(uno::RuntimeException) 1269cdf0e10cSrcweir { 1270cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1271cdf0e10cSrcweir return mpPropSet->getPropertySetInfo(); 1272cdf0e10cSrcweir } 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue ) 1275cdf0e10cSrcweir throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) 1276cdf0e10cSrcweir { 1277cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1278cdf0e10cSrcweir 1279cdf0e10cSrcweir if( NULL == mpDoc ) 1280cdf0e10cSrcweir throw lang::DisposedException(); 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(aPropertyName); 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 ) 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir case WID_MODEL_LANGUAGE: 1287cdf0e10cSrcweir { 1288cdf0e10cSrcweir lang::Locale aLocale; 1289cdf0e10cSrcweir if(!(aValue >>= aLocale)) 1290cdf0e10cSrcweir throw lang::IllegalArgumentException(); 1291cdf0e10cSrcweir 1292cdf0e10cSrcweir mpDoc->SetLanguage( SvxLocaleToLanguage(aLocale), EE_CHAR_LANGUAGE ); 1293cdf0e10cSrcweir break; 1294cdf0e10cSrcweir } 1295cdf0e10cSrcweir case WID_MODEL_TABSTOP: 1296cdf0e10cSrcweir { 1297cdf0e10cSrcweir sal_Int32 nValue = 0; 1298cdf0e10cSrcweir if(!(aValue >>= nValue) || nValue < 0 ) 1299cdf0e10cSrcweir throw lang::IllegalArgumentException(); 1300cdf0e10cSrcweir 1301cdf0e10cSrcweir mpDoc->SetDefaultTabulator((sal_uInt16)nValue); 1302cdf0e10cSrcweir break; 1303cdf0e10cSrcweir } 1304cdf0e10cSrcweir case WID_MODEL_VISAREA: 1305cdf0e10cSrcweir { 1306cdf0e10cSrcweir SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh(); 1307cdf0e10cSrcweir if( !pEmbeddedObj ) 1308cdf0e10cSrcweir break; 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir awt::Rectangle aVisArea; 1311cdf0e10cSrcweir if( !(aValue >>= aVisArea) || (aVisArea.Width < 0) || (aVisArea.Height < 0) ) 1312cdf0e10cSrcweir throw lang::IllegalArgumentException(); 1313cdf0e10cSrcweir 1314cdf0e10cSrcweir pEmbeddedObj->SetVisArea( Rectangle( aVisArea.X, aVisArea.Y, aVisArea.X + aVisArea.Width - 1, aVisArea.Y + aVisArea.Height - 1 ) ); 1315cdf0e10cSrcweir } 1316cdf0e10cSrcweir break; 1317cdf0e10cSrcweir case WID_MODEL_CONTFOCUS: 1318cdf0e10cSrcweir { 1319cdf0e10cSrcweir sal_Bool bFocus = sal_False; 1320cdf0e10cSrcweir if( !(aValue >>= bFocus ) ) 1321cdf0e10cSrcweir throw lang::IllegalArgumentException(); 1322cdf0e10cSrcweir mpDoc->SetAutoControlFocus( bFocus ); 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir break; 1325cdf0e10cSrcweir case WID_MODEL_DSGNMODE: 1326cdf0e10cSrcweir { 1327cdf0e10cSrcweir sal_Bool bMode = sal_False; 1328cdf0e10cSrcweir if( !(aValue >>= bMode ) ) 1329cdf0e10cSrcweir throw lang::IllegalArgumentException(); 1330cdf0e10cSrcweir mpDoc->SetOpenInDesignMode( bMode ); 1331cdf0e10cSrcweir } 1332cdf0e10cSrcweir break; 1333cdf0e10cSrcweir case WID_MODEL_BUILDID: 1334cdf0e10cSrcweir aValue >>= maBuildId; 1335cdf0e10cSrcweir return; 1336cdf0e10cSrcweir case WID_MODEL_MAPUNIT: 1337cdf0e10cSrcweir case WID_MODEL_BASICLIBS: 1338cdf0e10cSrcweir case WID_MODEL_RUNTIMEUID: // is read-only 1339cdf0e10cSrcweir case WID_MODEL_DIALOGLIBS: 1340cdf0e10cSrcweir throw beans::PropertyVetoException(); 1341cdf0e10cSrcweir default: 1342cdf0e10cSrcweir throw beans::UnknownPropertyException(); 1343cdf0e10cSrcweir } 1344cdf0e10cSrcweir 1345cdf0e10cSrcweir SetModified(); 1346cdf0e10cSrcweir } 1347cdf0e10cSrcweir 1348cdf0e10cSrcweir uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& PropertyName ) 1349cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) 1350cdf0e10cSrcweir { 1351cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1352cdf0e10cSrcweir 1353cdf0e10cSrcweir uno::Any aAny; 1354cdf0e10cSrcweir if( NULL == mpDoc ) 1355cdf0e10cSrcweir throw lang::DisposedException(); 1356cdf0e10cSrcweir 1357cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = mpPropSet->getPropertyMapEntry(PropertyName); 1358cdf0e10cSrcweir 1359cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 ) 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir case WID_MODEL_LANGUAGE: 1362cdf0e10cSrcweir { 1363cdf0e10cSrcweir LanguageType eLang = mpDoc->GetLanguage( EE_CHAR_LANGUAGE ); 1364cdf0e10cSrcweir lang::Locale aLocale; 1365cdf0e10cSrcweir SvxLanguageToLocale( aLocale, eLang ); 1366cdf0e10cSrcweir aAny <<= aLocale; 1367cdf0e10cSrcweir break; 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir case WID_MODEL_TABSTOP: 1370cdf0e10cSrcweir aAny <<= (sal_Int32)mpDoc->GetDefaultTabulator(); 1371cdf0e10cSrcweir break; 1372cdf0e10cSrcweir case WID_MODEL_VISAREA: 1373cdf0e10cSrcweir { 1374cdf0e10cSrcweir SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh(); 1375cdf0e10cSrcweir if( !pEmbeddedObj ) 1376cdf0e10cSrcweir break; 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir const Rectangle& aRect = pEmbeddedObj->GetVisArea(); 1379cdf0e10cSrcweir awt::Rectangle aVisArea( aRect.nLeft, aRect.nTop, aRect.getWidth(), aRect.getHeight() ); 1380cdf0e10cSrcweir aAny <<= aVisArea; 1381cdf0e10cSrcweir } 1382cdf0e10cSrcweir break; 1383cdf0e10cSrcweir case WID_MODEL_MAPUNIT: 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir SfxObjectShell* pEmbeddedObj = mpDoc->GetDocSh(); 1386cdf0e10cSrcweir if( !pEmbeddedObj ) 1387cdf0e10cSrcweir break; 1388cdf0e10cSrcweir 1389cdf0e10cSrcweir sal_Int16 nMeasureUnit = 0; 1390cdf0e10cSrcweir SvxMapUnitToMeasureUnit( (const short)pEmbeddedObj->GetMapUnit(), nMeasureUnit ); 1391cdf0e10cSrcweir aAny <<= (sal_Int16)nMeasureUnit; 1392cdf0e10cSrcweir } 1393cdf0e10cSrcweir break; 1394cdf0e10cSrcweir case WID_MODEL_FORBCHARS: 1395cdf0e10cSrcweir { 1396cdf0e10cSrcweir aAny <<= getForbiddenCharsTable(); 1397cdf0e10cSrcweir } 1398cdf0e10cSrcweir break; 1399cdf0e10cSrcweir case WID_MODEL_CONTFOCUS: 1400cdf0e10cSrcweir aAny <<= (sal_Bool)mpDoc->GetAutoControlFocus(); 1401cdf0e10cSrcweir break; 1402cdf0e10cSrcweir case WID_MODEL_DSGNMODE: 1403cdf0e10cSrcweir aAny <<= mpDoc->GetOpenInDesignMode(); 1404cdf0e10cSrcweir break; 1405cdf0e10cSrcweir case WID_MODEL_BASICLIBS: 1406cdf0e10cSrcweir aAny <<= mpDocShell->GetBasicContainer(); 1407cdf0e10cSrcweir break; 1408cdf0e10cSrcweir case WID_MODEL_DIALOGLIBS: 1409cdf0e10cSrcweir aAny <<= mpDocShell->GetDialogContainer(); 1410cdf0e10cSrcweir break; 1411cdf0e10cSrcweir case WID_MODEL_RUNTIMEUID: 1412cdf0e10cSrcweir aAny <<= getRuntimeUID(); 1413cdf0e10cSrcweir break; 1414cdf0e10cSrcweir case WID_MODEL_BUILDID: 1415cdf0e10cSrcweir return uno::Any( maBuildId ); 1416cdf0e10cSrcweir case WID_MODEL_HASVALIDSIGNATURES: 1417cdf0e10cSrcweir aAny <<= hasValidSignatures(); 1418cdf0e10cSrcweir break; 1419cdf0e10cSrcweir default: 1420cdf0e10cSrcweir throw beans::UnknownPropertyException(); 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir 1423cdf0e10cSrcweir return aAny; 1424cdf0e10cSrcweir } 1425cdf0e10cSrcweir 1426cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} 1427cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} 1428cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} 1429cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {} 1430cdf0e10cSrcweir 1431*61066e41SArrigo Marchiori // XLinkAuthorizer 1432*61066e41SArrigo Marchiori sal_Bool SAL_CALL SdXImpressDocument::authorizeLinks( const ::rtl::OUString &url ) 1433*61066e41SArrigo Marchiori throw(uno::RuntimeException) 1434*61066e41SArrigo Marchiori { 1435*61066e41SArrigo Marchiori OGuard aGuard( Application::GetSolarMutex() ); 1436*61066e41SArrigo Marchiori if ( mpDoc ) { 1437*61066e41SArrigo Marchiori // The following access to the window is copied from SwDoc::UpdateLinks() 1438*61066e41SArrigo Marchiori SfxMedium* pMedium = mpDocShell->GetMedium(); 1439*61066e41SArrigo Marchiori SfxFrame* pFrm = pMedium ? pMedium->GetLoadTargetFrame() : 0; 1440*61066e41SArrigo Marchiori sfx2::LinkManager *pLinkMgr = mpDoc->GetLinkManager(); 1441*61066e41SArrigo Marchiori if ( pLinkMgr->urlIsSafe( url ) ) { 1442*61066e41SArrigo Marchiori return sal_True; 1443*61066e41SArrigo Marchiori } 1444*61066e41SArrigo Marchiori Window* pDlgParent = 0; 1445*61066e41SArrigo Marchiori if ( pFrm ) 1446*61066e41SArrigo Marchiori pDlgParent = &pFrm->GetWindow(); 1447*61066e41SArrigo Marchiori if ( !pDlgParent ) 1448*61066e41SArrigo Marchiori pDlgParent = mpDocShell->GetDialogParent( pMedium ); 1449*61066e41SArrigo Marchiori if ( pDlgParent ) 1450*61066e41SArrigo Marchiori return pLinkMgr->GetUserAllowsLinkUpdate( pDlgParent ); 1451*61066e41SArrigo Marchiori } 1452*61066e41SArrigo Marchiori return sal_False; 1453*61066e41SArrigo Marchiori } 1454*61066e41SArrigo Marchiori 1455cdf0e10cSrcweir // XLinkTargetSupplier 1456cdf0e10cSrcweir uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getLinks() 1457cdf0e10cSrcweir throw(uno::RuntimeException) 1458cdf0e10cSrcweir { 1459cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1460cdf0e10cSrcweir 1461cdf0e10cSrcweir if( NULL == mpDoc ) 1462cdf0e10cSrcweir throw lang::DisposedException(); 1463cdf0e10cSrcweir 1464cdf0e10cSrcweir uno::Reference< container::XNameAccess > xLinks( mxLinks ); 1465cdf0e10cSrcweir if( !xLinks.is() ) 1466cdf0e10cSrcweir mxLinks = xLinks = new SdDocLinkTargets( *this ); 1467cdf0e10cSrcweir return xLinks; 1468cdf0e10cSrcweir } 1469cdf0e10cSrcweir 1470cdf0e10cSrcweir // XStyleFamiliesSupplier 1471cdf0e10cSrcweir uno::Reference< container::XNameAccess > SAL_CALL SdXImpressDocument::getStyleFamilies( ) 1472cdf0e10cSrcweir throw(uno::RuntimeException) 1473cdf0e10cSrcweir { 1474cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1475cdf0e10cSrcweir 1476cdf0e10cSrcweir if( NULL == mpDoc ) 1477cdf0e10cSrcweir throw lang::DisposedException(); 1478cdf0e10cSrcweir 1479cdf0e10cSrcweir uno::Reference< container::XNameAccess > xStyles( dynamic_cast< container::XNameAccess* >( mpDoc->GetStyleSheetPool()) ); 1480cdf0e10cSrcweir return xStyles; 1481cdf0e10cSrcweir } 1482cdf0e10cSrcweir 1483cdf0e10cSrcweir // XAnyCompareFactory 1484cdf0e10cSrcweir uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SdXImpressDocument::createAnyCompareByName( const OUString& ) 1485cdf0e10cSrcweir throw (uno::RuntimeException) 1486cdf0e10cSrcweir { 1487cdf0e10cSrcweir return SvxCreateNumRuleCompare(); 1488cdf0e10cSrcweir } 1489cdf0e10cSrcweir 1490cdf0e10cSrcweir // XRenderable 1491cdf0e10cSrcweir sal_Int32 SAL_CALL SdXImpressDocument::getRendererCount( const uno::Any& rSelection, 1492cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& ) 1493cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 1494cdf0e10cSrcweir { 1495cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1496cdf0e10cSrcweir sal_Int32 nRet = 0; 1497cdf0e10cSrcweir 1498cdf0e10cSrcweir if( NULL == mpDoc ) 1499cdf0e10cSrcweir throw lang::DisposedException(); 1500cdf0e10cSrcweir 1501cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aRenderer; 1502cdf0e10cSrcweir 1503cdf0e10cSrcweir if( mpDocShell && mpDoc ) 1504cdf0e10cSrcweir { 1505cdf0e10cSrcweir uno::Reference< frame::XModel > xModel; 1506cdf0e10cSrcweir 1507cdf0e10cSrcweir rSelection >>= xModel; 1508cdf0e10cSrcweir 1509cdf0e10cSrcweir if( xModel == mpDocShell->GetModel() ) 1510cdf0e10cSrcweir nRet = mpDoc->GetSdPageCount( PK_STANDARD ); 1511cdf0e10cSrcweir else 1512cdf0e10cSrcweir { 1513cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes; 1514cdf0e10cSrcweir 1515cdf0e10cSrcweir rSelection >>= xShapes; 1516cdf0e10cSrcweir 1517cdf0e10cSrcweir if( xShapes.is() && xShapes->getCount() ) 1518cdf0e10cSrcweir nRet = 1; 1519cdf0e10cSrcweir } 1520cdf0e10cSrcweir } 1521cdf0e10cSrcweir return nRet; 1522cdf0e10cSrcweir } 1523cdf0e10cSrcweir 1524cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( sal_Int32 , const uno::Any& , 1525cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rxOptions ) 1526cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 1527cdf0e10cSrcweir { 1528cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1529cdf0e10cSrcweir 1530cdf0e10cSrcweir if( NULL == mpDoc ) 1531cdf0e10cSrcweir throw lang::DisposedException(); 1532cdf0e10cSrcweir 1533cdf0e10cSrcweir sal_Bool bExportNotesPages = sal_False; 1534cdf0e10cSrcweir for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) 1535cdf0e10cSrcweir { 1536cdf0e10cSrcweir if( rxOptions[ nProperty ].Name.equalsAscii( "ExportNotesPages" ) ) 1537cdf0e10cSrcweir rxOptions[ nProperty].Value >>= bExportNotesPages; 1538cdf0e10cSrcweir } 1539cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aRenderer; 1540cdf0e10cSrcweir if( mpDocShell && mpDoc ) 1541cdf0e10cSrcweir { 1542cdf0e10cSrcweir awt::Size aPageSize; 1543cdf0e10cSrcweir if ( bExportNotesPages ) 1544cdf0e10cSrcweir { 1545cdf0e10cSrcweir Size aNotesPageSize = mpDoc->GetSdPage( 0, PK_NOTES )->GetSize(); 1546cdf0e10cSrcweir aPageSize = awt::Size( aNotesPageSize.Width(), aNotesPageSize.Height() ); 1547cdf0e10cSrcweir } 1548cdf0e10cSrcweir else 1549cdf0e10cSrcweir { 1550cdf0e10cSrcweir const Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) ); 1551cdf0e10cSrcweir aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() ); 1552cdf0e10cSrcweir } 1553cdf0e10cSrcweir aRenderer.realloc( 1 ); 1554cdf0e10cSrcweir 1555cdf0e10cSrcweir aRenderer[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ); 1556cdf0e10cSrcweir aRenderer[ 0 ].Value <<= aPageSize; 1557cdf0e10cSrcweir } 1558cdf0e10cSrcweir return aRenderer; 1559cdf0e10cSrcweir } 1560cdf0e10cSrcweir 1561cdf0e10cSrcweir class ImplRenderPaintProc : public ::sdr::contact::ViewObjectContactRedirector 1562cdf0e10cSrcweir { 1563cdf0e10cSrcweir const SdrLayerAdmin& rLayerAdmin; 1564cdf0e10cSrcweir SdrPageView* pSdrPageView; 1565cdf0e10cSrcweir vcl::PDFExtOutDevData* pPDFExtOutDevData; 1566cdf0e10cSrcweir 1567cdf0e10cSrcweir vcl::PDFWriter::StructElement ImplBegStructureTag( SdrObject& rObject ); 1568cdf0e10cSrcweir 1569cdf0e10cSrcweir public: 1570cdf0e10cSrcweir sal_Bool IsVisible ( const SdrObject* pObj ) const; 1571cdf0e10cSrcweir sal_Bool IsPrintable( const SdrObject* pObj ) const; 1572cdf0e10cSrcweir 1573cdf0e10cSrcweir ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData ); 1574cdf0e10cSrcweir virtual ~ImplRenderPaintProc(); 1575cdf0e10cSrcweir 1576cdf0e10cSrcweir // all default implementations just call the same methods at the original. To do something 1577cdf0e10cSrcweir // different, overload the method and at least do what the method does. 1578cdf0e10cSrcweir virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence( 1579cdf0e10cSrcweir const sdr::contact::ViewObjectContact& rOriginal, 1580cdf0e10cSrcweir const sdr::contact::DisplayInfo& rDisplayInfo); 1581cdf0e10cSrcweir }; 1582cdf0e10cSrcweir 1583cdf0e10cSrcweir ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData ) 1584cdf0e10cSrcweir : ViewObjectContactRedirector(), 1585cdf0e10cSrcweir rLayerAdmin ( rLA ), 1586cdf0e10cSrcweir pSdrPageView ( pView ), 1587cdf0e10cSrcweir pPDFExtOutDevData ( pData ) 1588cdf0e10cSrcweir { 1589cdf0e10cSrcweir } 1590cdf0e10cSrcweir 1591cdf0e10cSrcweir ImplRenderPaintProc::~ImplRenderPaintProc() 1592cdf0e10cSrcweir { 1593cdf0e10cSrcweir } 1594cdf0e10cSrcweir 1595cdf0e10cSrcweir sal_Int32 ImplPDFGetBookmarkPage( const String& rBookmark, SdDrawDocument& rDoc ) 1596cdf0e10cSrcweir { 1597cdf0e10cSrcweir sal_Int32 nPage = -1; 1598cdf0e10cSrcweir 1599cdf0e10cSrcweir OSL_TRACE("GotoBookmark %s", 1600cdf0e10cSrcweir ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr()); 1601cdf0e10cSrcweir 1602cdf0e10cSrcweir String aBookmark( rBookmark ); 1603cdf0e10cSrcweir 1604cdf0e10cSrcweir if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') ) 1605cdf0e10cSrcweir aBookmark = rBookmark.Copy( 1 ); 1606cdf0e10cSrcweir 1607cdf0e10cSrcweir // is the bookmark a page ? 1608cdf0e10cSrcweir sal_Bool bIsMasterPage; 1609cdf0e10cSrcweir sal_uInt16 nPgNum = rDoc.GetPageByName( aBookmark, bIsMasterPage ); 1610cdf0e10cSrcweir SdrObject* pObj = NULL; 1611cdf0e10cSrcweir 1612cdf0e10cSrcweir if ( nPgNum == SDRPAGE_NOTFOUND ) 1613cdf0e10cSrcweir { 1614cdf0e10cSrcweir // is the bookmark a object ? 1615cdf0e10cSrcweir pObj = rDoc.GetObj( aBookmark ); 1616cdf0e10cSrcweir if (pObj) 1617cdf0e10cSrcweir nPgNum = pObj->GetPage()->GetPageNum(); 1618cdf0e10cSrcweir } 1619cdf0e10cSrcweir if ( nPgNum != SDRPAGE_NOTFOUND ) 1620cdf0e10cSrcweir nPage = ( nPgNum - 1 ) / 2; 1621cdf0e10cSrcweir return nPage; 1622cdf0e10cSrcweir } 1623cdf0e10cSrcweir 1624cdf0e10cSrcweir void ImplPDFExportComments( uno::Reference< drawing::XDrawPage > xPage, vcl::PDFExtOutDevData& rPDFExtOutDevData ) 1625cdf0e10cSrcweir { 1626cdf0e10cSrcweir try 1627cdf0e10cSrcweir { 1628cdf0e10cSrcweir uno::Reference< office::XAnnotationAccess > xAnnotationAccess( xPage, uno::UNO_QUERY_THROW ); 1629cdf0e10cSrcweir uno::Reference< office::XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); 1630cdf0e10cSrcweir 1631cdf0e10cSrcweir LanguageType eLanguage = Application::GetSettings().GetLanguage(); 1632cdf0e10cSrcweir while( xAnnotationEnumeration->hasMoreElements() ) 1633cdf0e10cSrcweir { 1634cdf0e10cSrcweir uno::Reference< office::XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement() ); 1635cdf0e10cSrcweir 1636cdf0e10cSrcweir geometry::RealPoint2D aRealPoint2D( xAnnotation->getPosition() ); 1637cdf0e10cSrcweir uno::Reference< text::XText > xText( xAnnotation->getTextRange() ); 1638cdf0e10cSrcweir // rtl::OUString sInitials( getInitials( sAuthor ) ); 1639cdf0e10cSrcweir util::DateTime aDateTime( xAnnotation->getDateTime() ); 1640cdf0e10cSrcweir 1641cdf0e10cSrcweir Date aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year ); 1642cdf0e10cSrcweir Time aTime; 1643cdf0e10cSrcweir String aStr( SvxDateTimeField::GetFormatted( aDate, aTime, SVXDATEFORMAT_B, *(SD_MOD()->GetNumberFormatter()), eLanguage ) ); 1644cdf0e10cSrcweir 1645cdf0e10cSrcweir vcl::PDFNote aNote; 1646cdf0e10cSrcweir String sTitle( xAnnotation->getAuthor() ); 1647cdf0e10cSrcweir sTitle.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", " ) ); 1648cdf0e10cSrcweir sTitle += aStr; 1649cdf0e10cSrcweir aNote.Title = sTitle; 1650cdf0e10cSrcweir aNote.Contents = xText->getString(); 1651cdf0e10cSrcweir rPDFExtOutDevData.CreateNote( Rectangle( Point( static_cast< long >( aRealPoint2D.X * 100 ), 1652cdf0e10cSrcweir static_cast< long >( aRealPoint2D.Y * 100 ) ), Size( 1000, 1000 ) ), aNote ); 1653cdf0e10cSrcweir } 1654cdf0e10cSrcweir } 1655cdf0e10cSrcweir catch( uno::Exception& ) 1656cdf0e10cSrcweir { 1657cdf0e10cSrcweir } 1658cdf0e10cSrcweir } 1659cdf0e10cSrcweir 1660cdf0e10cSrcweir void ImplPDFExportShapeInteraction( uno::Reference< drawing::XShape > xShape, SdDrawDocument& rDoc, vcl::PDFExtOutDevData& rPDFExtOutDevData ) 1661cdf0e10cSrcweir { 1662cdf0e10cSrcweir const rtl::OUString sGroup ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GroupShape" ) ); 1663cdf0e10cSrcweir const rtl::OUString sOnClick ( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ); 1664cdf0e10cSrcweir const rtl::OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) ); 1665cdf0e10cSrcweir 1666cdf0e10cSrcweir if ( xShape->getShapeType().equals( sGroup ) ) 1667cdf0e10cSrcweir { 1668cdf0e10cSrcweir uno::Reference< container::XIndexAccess > xIndexAccess( xShape, uno::UNO_QUERY ); 1669cdf0e10cSrcweir if ( xIndexAccess.is() ) 1670cdf0e10cSrcweir { 1671cdf0e10cSrcweir sal_Int32 i, nCount = xIndexAccess->getCount(); 1672cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 1673cdf0e10cSrcweir { 1674cdf0e10cSrcweir uno::Reference< drawing::XShape > xSubShape( xIndexAccess->getByIndex( i ), uno::UNO_QUERY ); 1675cdf0e10cSrcweir if ( xSubShape.is() ) 1676cdf0e10cSrcweir ImplPDFExportShapeInteraction( xSubShape, rDoc, rPDFExtOutDevData ); 1677cdf0e10cSrcweir } 1678cdf0e10cSrcweir } 1679cdf0e10cSrcweir } 1680cdf0e10cSrcweir else 1681cdf0e10cSrcweir { 1682cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xShapePropSet( xShape, uno::UNO_QUERY ); 1683cdf0e10cSrcweir if( xShapePropSet.is() ) 1684cdf0e10cSrcweir { 1685cdf0e10cSrcweir Size aPageSize( rDoc.GetSdPage( 0, PK_STANDARD )->GetSize() ); 1686cdf0e10cSrcweir Point aPoint( 0, 0 ); 1687cdf0e10cSrcweir Rectangle aPageRect( aPoint, aPageSize ); 1688cdf0e10cSrcweir 1689cdf0e10cSrcweir awt::Point aShapePos( xShape->getPosition() ); 1690cdf0e10cSrcweir awt::Size aShapeSize( xShape->getSize() ); 1691cdf0e10cSrcweir Rectangle aLinkRect( Point( aShapePos.X, aShapePos.Y ), Size( aShapeSize.Width, aShapeSize.Height ) ); 1692cdf0e10cSrcweir 1693cdf0e10cSrcweir presentation::ClickAction eCa; 1694cdf0e10cSrcweir uno::Any aAny( xShapePropSet->getPropertyValue( sOnClick ) ); 1695cdf0e10cSrcweir if ( aAny >>= eCa ) 1696cdf0e10cSrcweir { 1697cdf0e10cSrcweir switch ( eCa ) 1698cdf0e10cSrcweir { 1699cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE : 1700cdf0e10cSrcweir { 1701cdf0e10cSrcweir sal_Int32 nCount = rDoc.GetSdPageCount( PK_STANDARD ); 1702cdf0e10cSrcweir sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nCount - 1, vcl::PDFWriter::FitRectangle ); 1703cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1704cdf0e10cSrcweir rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); 1705cdf0e10cSrcweir } 1706cdf0e10cSrcweir break; 1707cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE : 1708cdf0e10cSrcweir { 1709cdf0e10cSrcweir sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, 0, vcl::PDFWriter::FitRectangle ); 1710cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1711cdf0e10cSrcweir rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); 1712cdf0e10cSrcweir } 1713cdf0e10cSrcweir break; 1714cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE : 1715cdf0e10cSrcweir { 1716cdf0e10cSrcweir sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber(); 1717cdf0e10cSrcweir if ( nDestPage ) 1718cdf0e10cSrcweir nDestPage--; 1719cdf0e10cSrcweir sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle ); 1720cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1721cdf0e10cSrcweir rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); 1722cdf0e10cSrcweir } 1723cdf0e10cSrcweir break; 1724cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE : 1725cdf0e10cSrcweir { 1726cdf0e10cSrcweir sal_Int32 nDestPage = rPDFExtOutDevData.GetCurrentPageNumber() + 1; 1727cdf0e10cSrcweir sal_Int32 nLastPage = rDoc.GetSdPageCount( PK_STANDARD ) - 1; 1728cdf0e10cSrcweir if ( nDestPage > nLastPage ) 1729cdf0e10cSrcweir nDestPage = nLastPage; 1730cdf0e10cSrcweir sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nDestPage, vcl::PDFWriter::FitRectangle ); 1731cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1732cdf0e10cSrcweir rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); 1733cdf0e10cSrcweir } 1734cdf0e10cSrcweir break; 1735cdf0e10cSrcweir 1736cdf0e10cSrcweir case presentation::ClickAction_PROGRAM : 1737cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK : 1738cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT : 1739cdf0e10cSrcweir { 1740cdf0e10cSrcweir rtl::OUString aBookmark; 1741cdf0e10cSrcweir xShapePropSet->getPropertyValue( sBookmark ) >>= aBookmark; 1742cdf0e10cSrcweir if( aBookmark.getLength() ) 1743cdf0e10cSrcweir { 1744cdf0e10cSrcweir switch( eCa ) 1745cdf0e10cSrcweir { 1746cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT : 1747cdf0e10cSrcweir case presentation::ClickAction_PROGRAM : 1748cdf0e10cSrcweir { 1749cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1750cdf0e10cSrcweir rPDFExtOutDevData.SetLinkURL( nLinkId, aBookmark ); 1751cdf0e10cSrcweir } 1752cdf0e10cSrcweir break; 1753cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK : 1754cdf0e10cSrcweir { 1755cdf0e10cSrcweir sal_Int32 nPage = ImplPDFGetBookmarkPage( aBookmark, rDoc ); 1756cdf0e10cSrcweir if ( nPage != -1 ) 1757cdf0e10cSrcweir { 1758cdf0e10cSrcweir sal_Int32 nDestId = rPDFExtOutDevData.CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ); 1759cdf0e10cSrcweir sal_Int32 nLinkId = rPDFExtOutDevData.CreateLink( aLinkRect, -1 ); 1760cdf0e10cSrcweir rPDFExtOutDevData.SetLinkDest( nLinkId, nDestId ); 1761cdf0e10cSrcweir } 1762cdf0e10cSrcweir } 1763cdf0e10cSrcweir break; 1764cdf0e10cSrcweir default: 1765cdf0e10cSrcweir break; 1766cdf0e10cSrcweir } 1767cdf0e10cSrcweir } 1768cdf0e10cSrcweir } 1769cdf0e10cSrcweir break; 1770cdf0e10cSrcweir 1771cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION : 1772cdf0e10cSrcweir case presentation::ClickAction_SOUND : 1773cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE : 1774cdf0e10cSrcweir case presentation::ClickAction_VERB : 1775cdf0e10cSrcweir case presentation::ClickAction_VANISH : 1776cdf0e10cSrcweir case presentation::ClickAction_MACRO : 1777cdf0e10cSrcweir default : 1778cdf0e10cSrcweir break; 1779cdf0e10cSrcweir } 1780cdf0e10cSrcweir } 1781cdf0e10cSrcweir } 1782cdf0e10cSrcweir } 1783cdf0e10cSrcweir } 1784cdf0e10cSrcweir 1785cdf0e10cSrcweir vcl::PDFWriter::StructElement ImplRenderPaintProc::ImplBegStructureTag( SdrObject& rObject ) 1786cdf0e10cSrcweir { 1787cdf0e10cSrcweir vcl::PDFWriter::StructElement eElement(vcl::PDFWriter::NonStructElement); 1788cdf0e10cSrcweir 1789cdf0e10cSrcweir if ( pPDFExtOutDevData && pPDFExtOutDevData->GetIsExportTaggedPDF() ) 1790cdf0e10cSrcweir { 1791cdf0e10cSrcweir sal_uInt32 nInventor = rObject.GetObjInventor(); 1792cdf0e10cSrcweir sal_uInt16 nIdentifier = rObject.GetObjIdentifier(); 1793cdf0e10cSrcweir sal_Bool bIsTextObj = rObject.ISA( SdrTextObj ); 1794cdf0e10cSrcweir 1795cdf0e10cSrcweir if ( nInventor == SdrInventor ) 1796cdf0e10cSrcweir { 1797cdf0e10cSrcweir if ( nIdentifier == OBJ_GRUP ) 1798cdf0e10cSrcweir eElement = vcl::PDFWriter::Section; 1799cdf0e10cSrcweir else if ( nIdentifier == OBJ_TITLETEXT ) 1800cdf0e10cSrcweir eElement = vcl::PDFWriter::Heading; 1801cdf0e10cSrcweir else if ( nIdentifier == OBJ_OUTLINETEXT ) 1802cdf0e10cSrcweir eElement = vcl::PDFWriter::Division; 1803cdf0e10cSrcweir else if ( !bIsTextObj || !((SdrTextObj&)rObject).HasText() ) 1804cdf0e10cSrcweir eElement = vcl::PDFWriter::Figure; 1805cdf0e10cSrcweir } 1806cdf0e10cSrcweir } 1807cdf0e10cSrcweir 1808cdf0e10cSrcweir return eElement; 1809cdf0e10cSrcweir } 1810cdf0e10cSrcweir 1811cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence ImplRenderPaintProc::createRedirectedPrimitive2DSequence( 1812cdf0e10cSrcweir const sdr::contact::ViewObjectContact& rOriginal, 1813cdf0e10cSrcweir const sdr::contact::DisplayInfo& rDisplayInfo) 1814cdf0e10cSrcweir { 1815cdf0e10cSrcweir SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject(); 1816cdf0e10cSrcweir 1817cdf0e10cSrcweir if(pObject) 1818cdf0e10cSrcweir { 1819cdf0e10cSrcweir drawinglayer::primitive2d::Primitive2DSequence xRetval; 1820cdf0e10cSrcweir 1821cdf0e10cSrcweir if(pObject->GetPage()) 1822cdf0e10cSrcweir { 1823cdf0e10cSrcweir if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false)) 1824cdf0e10cSrcweir { 1825cdf0e10cSrcweir if(IsVisible(pObject) && IsPrintable(pObject)) 1826cdf0e10cSrcweir { 1827cdf0e10cSrcweir const vcl::PDFWriter::StructElement eElement(ImplBegStructureTag( *pObject )); 1828cdf0e10cSrcweir const bool bTagUsed(vcl::PDFWriter::NonStructElement != eElement); 1829cdf0e10cSrcweir 1830cdf0e10cSrcweir xRetval = ::sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo); 1831cdf0e10cSrcweir 1832cdf0e10cSrcweir if(xRetval.hasElements() && bTagUsed) 1833cdf0e10cSrcweir { 1834cdf0e10cSrcweir // embed Primitive2DSequence in a structure tag element for 1835cdf0e10cSrcweir // exactly this purpose (StructureTagPrimitive2D) 1836cdf0e10cSrcweir const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::StructureTagPrimitive2D(eElement, xRetval)); 1837cdf0e10cSrcweir xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); 1838cdf0e10cSrcweir } 1839cdf0e10cSrcweir } 1840cdf0e10cSrcweir } 1841cdf0e10cSrcweir } 1842cdf0e10cSrcweir 1843cdf0e10cSrcweir return xRetval; 1844cdf0e10cSrcweir } 1845cdf0e10cSrcweir else 1846cdf0e10cSrcweir { 1847cdf0e10cSrcweir // not an object, maybe a page 1848cdf0e10cSrcweir return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(rOriginal, rDisplayInfo); 1849cdf0e10cSrcweir } 1850cdf0e10cSrcweir } 1851cdf0e10cSrcweir 1852cdf0e10cSrcweir sal_Bool ImplRenderPaintProc::IsVisible( const SdrObject* pObj ) const 1853cdf0e10cSrcweir { 1854cdf0e10cSrcweir sal_Bool bVisible = sal_True; 1855cdf0e10cSrcweir SdrLayerID nLayerId = pObj->GetLayer(); 1856cdf0e10cSrcweir if( pSdrPageView ) 1857cdf0e10cSrcweir { 1858cdf0e10cSrcweir const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId ); 1859cdf0e10cSrcweir if ( pSdrLayer ) 1860cdf0e10cSrcweir { 1861cdf0e10cSrcweir String aLayerName = pSdrLayer->GetName(); 1862cdf0e10cSrcweir bVisible = pSdrPageView->IsLayerVisible( aLayerName ); 1863cdf0e10cSrcweir } 1864cdf0e10cSrcweir } 1865cdf0e10cSrcweir return bVisible; 1866cdf0e10cSrcweir } 1867cdf0e10cSrcweir sal_Bool ImplRenderPaintProc::IsPrintable( const SdrObject* pObj ) const 1868cdf0e10cSrcweir { 1869cdf0e10cSrcweir sal_Bool bPrintable = sal_True; 1870cdf0e10cSrcweir SdrLayerID nLayerId = pObj->GetLayer(); 1871cdf0e10cSrcweir if( pSdrPageView ) 1872cdf0e10cSrcweir { 1873cdf0e10cSrcweir const SdrLayer* pSdrLayer = rLayerAdmin.GetLayer( nLayerId ); 1874cdf0e10cSrcweir if ( pSdrLayer ) 1875cdf0e10cSrcweir { 1876cdf0e10cSrcweir String aLayerName = pSdrLayer->GetName(); 1877cdf0e10cSrcweir bPrintable = pSdrPageView->IsLayerPrintable( aLayerName ); 1878cdf0e10cSrcweir } 1879cdf0e10cSrcweir } 1880cdf0e10cSrcweir return bPrintable; 1881cdf0e10cSrcweir 1882cdf0e10cSrcweir } 1883cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& rSelection, 1884cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rxOptions ) 1885cdf0e10cSrcweir throw (lang::IllegalArgumentException, uno::RuntimeException) 1886cdf0e10cSrcweir { 1887cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 1888cdf0e10cSrcweir 1889cdf0e10cSrcweir if( NULL == mpDoc ) 1890cdf0e10cSrcweir throw lang::DisposedException(); 1891cdf0e10cSrcweir 1892cdf0e10cSrcweir if( mpDocShell && mpDoc ) 1893cdf0e10cSrcweir { 1894cdf0e10cSrcweir uno::Reference< awt::XDevice > xRenderDevice; 1895cdf0e10cSrcweir const sal_Int32 nPageNumber = nRenderer + 1; 1896cdf0e10cSrcweir PageKind ePageKind = PK_STANDARD; 1897cdf0e10cSrcweir sal_Bool bExportNotesPages = sal_False; 1898cdf0e10cSrcweir 1899cdf0e10cSrcweir for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty ) 1900cdf0e10cSrcweir { 1901cdf0e10cSrcweir if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) 1902cdf0e10cSrcweir rxOptions[ nProperty ].Value >>= xRenderDevice; 1903cdf0e10cSrcweir else if ( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) ) 1904cdf0e10cSrcweir { 1905cdf0e10cSrcweir rxOptions[ nProperty].Value >>= bExportNotesPages; 1906cdf0e10cSrcweir if ( bExportNotesPages ) 1907cdf0e10cSrcweir ePageKind = PK_NOTES; 1908cdf0e10cSrcweir } 1909cdf0e10cSrcweir } 1910cdf0e10cSrcweir 1911cdf0e10cSrcweir if( xRenderDevice.is() && nPageNumber && ( nPageNumber <= mpDoc->GetSdPageCount( ePageKind ) ) ) 1912cdf0e10cSrcweir { 1913cdf0e10cSrcweir VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice ); 1914cdf0e10cSrcweir OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL; 1915cdf0e10cSrcweir 1916cdf0e10cSrcweir if( pOut ) 1917cdf0e10cSrcweir { 1918cdf0e10cSrcweir vcl::PDFExtOutDevData* pPDFExtOutDevData = PTR_CAST( vcl::PDFExtOutDevData, pOut->GetExtOutDevData() ); 1919cdf0e10cSrcweir 1920cdf0e10cSrcweir ::sd::ClientView* pView = new ::sd::ClientView( mpDocShell, pOut, NULL ); 1921cdf0e10cSrcweir Rectangle aVisArea = Rectangle( Point(), mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind )->GetSize() ); 1922cdf0e10cSrcweir Region aRegion( aVisArea ); 1923cdf0e10cSrcweir Point aOrigin; 1924cdf0e10cSrcweir 1925cdf0e10cSrcweir ::sd::ViewShell* pOldViewSh = mpDocShell->GetViewShell(); 1926cdf0e10cSrcweir ::sd::View* pOldSdView = pOldViewSh ? pOldViewSh->GetView() : NULL; 1927cdf0e10cSrcweir 1928cdf0e10cSrcweir if ( pOldSdView ) 1929cdf0e10cSrcweir pOldSdView->SdrEndTextEdit(); 1930cdf0e10cSrcweir 1931cdf0e10cSrcweir pView->SetHlplVisible( sal_False ); 1932cdf0e10cSrcweir pView->SetGridVisible( sal_False ); 1933cdf0e10cSrcweir pView->SetBordVisible( sal_False ); 1934cdf0e10cSrcweir pView->SetPageVisible( sal_False ); 1935cdf0e10cSrcweir pView->SetGlueVisible( sal_False ); 1936cdf0e10cSrcweir 1937cdf0e10cSrcweir pOut->SetMapMode( MAP_100TH_MM ); 1938cdf0e10cSrcweir pOut->IntersectClipRegion( aVisArea ); 1939cdf0e10cSrcweir 1940cdf0e10cSrcweir 1941cdf0e10cSrcweir 1942cdf0e10cSrcweir uno::Reference< frame::XModel > xModel; 1943cdf0e10cSrcweir rSelection >>= xModel; 1944cdf0e10cSrcweir 1945cdf0e10cSrcweir if( xModel == mpDocShell->GetModel() ) 1946cdf0e10cSrcweir { 1947cdf0e10cSrcweir pView->ShowSdrPage( mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1, ePageKind )); 1948cdf0e10cSrcweir SdrPageView* pPV = pView->GetSdrPageView(); 1949cdf0e10cSrcweir 1950cdf0e10cSrcweir if( pOldSdView ) 1951cdf0e10cSrcweir { 1952cdf0e10cSrcweir SdrPageView* pOldPV = pOldSdView->GetSdrPageView(); 1953cdf0e10cSrcweir if( pPV && pOldPV ) 1954cdf0e10cSrcweir { 1955cdf0e10cSrcweir pPV->SetVisibleLayers( pOldPV->GetVisibleLayers() ); 1956cdf0e10cSrcweir pPV->SetPrintableLayers( pOldPV->GetPrintableLayers() ); 1957cdf0e10cSrcweir } 1958cdf0e10cSrcweir } 1959cdf0e10cSrcweir 1960cdf0e10cSrcweir ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), 1961cdf0e10cSrcweir pPV, pPDFExtOutDevData ); 1962cdf0e10cSrcweir 1963cdf0e10cSrcweir // background color for outliner :o 1964cdf0e10cSrcweir SdPage* pPage = (SdPage*)pPV->GetPage(); 1965cdf0e10cSrcweir if( pPage ) 1966cdf0e10cSrcweir { 1967cdf0e10cSrcweir SdrOutliner& rOutl = mpDoc->GetDrawOutliner( NULL ); 1968cdf0e10cSrcweir bool bScreenDisplay(true); 1969cdf0e10cSrcweir 1970cdf0e10cSrcweir if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType()) 1971cdf0e10cSrcweir { 1972cdf0e10cSrcweir // #i75566# printing; suppress AutoColor BackgroundColor generation 1973cdf0e10cSrcweir // for visibility reasons by giving GetPageBackgroundColor() 1974cdf0e10cSrcweir // the needed hint 1975cdf0e10cSrcweir bScreenDisplay = false; 1976cdf0e10cSrcweir } 1977cdf0e10cSrcweir 1978cdf0e10cSrcweir if(bScreenDisplay && pOut && pOut->GetPDFWriter()) 1979cdf0e10cSrcweir { 1980cdf0e10cSrcweir // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above) 1981cdf0e10cSrcweir bScreenDisplay = false; 1982cdf0e10cSrcweir } 1983cdf0e10cSrcweir 1984cdf0e10cSrcweir // #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and 1985cdf0e10cSrcweir // hint value if screen display. Only then the AutoColor mechanisms shall be applied 1986cdf0e10cSrcweir rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor( pPV, bScreenDisplay ) ); 1987cdf0e10cSrcweir } 1988cdf0e10cSrcweir pView->SdrPaintView::CompleteRedraw( pOut, aRegion, &aImplRenderPaintProc ); 1989cdf0e10cSrcweir 1990cdf0e10cSrcweir if ( pPDFExtOutDevData ) 1991cdf0e10cSrcweir { 1992cdf0e10cSrcweir try 1993cdf0e10cSrcweir { 1994cdf0e10cSrcweir uno::Any aAny; 1995cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xPage( uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ) ); 1996cdf0e10cSrcweir if ( xPage.is() ) 1997cdf0e10cSrcweir { 1998cdf0e10cSrcweir if ( pPDFExtOutDevData->GetIsExportNotes() ) 1999cdf0e10cSrcweir ImplPDFExportComments( xPage, *pPDFExtOutDevData ); 2000cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPagePropSet( xPage, uno::UNO_QUERY ); 2001cdf0e10cSrcweir if( xPagePropSet.is() ) 2002cdf0e10cSrcweir { 2003cdf0e10cSrcweir // exporting object interactions to pdf 2004cdf0e10cSrcweir 2005cdf0e10cSrcweir // if necessary, the master page interactions will be exported first 2006cdf0e10cSrcweir sal_Bool bIsBackgroundObjectsVisible = sal_False; // SJ: #i39428# IsBackgroundObjectsVisible not available for Draw 2007cdf0e10cSrcweir const rtl::OUString sIsBackgroundObjectsVisible( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ); 200854744b05SEike Rathke if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && ( xPagePropSet->getPropertyValue( sIsBackgroundObjectsVisible ) >>= bIsBackgroundObjectsVisible ) && bIsBackgroundObjectsVisible ) 2009cdf0e10cSrcweir { 2010cdf0e10cSrcweir uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( xPage, uno::UNO_QUERY ); 2011cdf0e10cSrcweir if ( xMasterPageTarget.is() ) 2012cdf0e10cSrcweir { 2013cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xMasterPage = xMasterPageTarget->getMasterPage(); 2014cdf0e10cSrcweir if ( xMasterPage.is() ) 2015cdf0e10cSrcweir { 2016cdf0e10cSrcweir uno::Reference< drawing::XShapes> xShapes( xMasterPage, uno::UNO_QUERY ); 2017cdf0e10cSrcweir sal_Int32 i, nCount = xShapes->getCount(); 2018cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 2019cdf0e10cSrcweir { 2020cdf0e10cSrcweir aAny = xShapes->getByIndex( i ); 2021cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 2022cdf0e10cSrcweir if ( aAny >>= xShape ) 2023cdf0e10cSrcweir ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); 2024cdf0e10cSrcweir } 2025cdf0e10cSrcweir } 2026cdf0e10cSrcweir } 2027cdf0e10cSrcweir } 2028cdf0e10cSrcweir 2029cdf0e10cSrcweir // exporting slide page object interactions 2030cdf0e10cSrcweir uno::Reference< drawing::XShapes> xShapes( xPage, uno::UNO_QUERY ); 2031cdf0e10cSrcweir sal_Int32 i, nCount = xShapes->getCount(); 2032cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 2033cdf0e10cSrcweir { 2034cdf0e10cSrcweir aAny = xShapes->getByIndex( i ); 2035cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 2036cdf0e10cSrcweir if ( aAny >>= xShape ) 2037cdf0e10cSrcweir ImplPDFExportShapeInteraction( xShape, *mpDoc, *pPDFExtOutDevData ); 2038cdf0e10cSrcweir } 2039cdf0e10cSrcweir 2040cdf0e10cSrcweir // exporting transition effects to pdf 204154744b05SEike Rathke if ( mbImpressDoc && !pPDFExtOutDevData->GetIsExportNotesPages() && pPDFExtOutDevData->GetIsExportTransitionEffects() ) 2042cdf0e10cSrcweir { 2043cdf0e10cSrcweir const rtl::OUString sEffect( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ); 2044cdf0e10cSrcweir const rtl::OUString sSpeed ( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ); 2045cdf0e10cSrcweir sal_Int32 nTime = 800; 2046cdf0e10cSrcweir presentation::AnimationSpeed aAs; 2047cdf0e10cSrcweir aAny = xPagePropSet->getPropertyValue( sSpeed ); 2048cdf0e10cSrcweir if ( aAny >>= aAs ) 2049cdf0e10cSrcweir { 2050cdf0e10cSrcweir switch( aAs ) 2051cdf0e10cSrcweir { 2052cdf0e10cSrcweir case presentation::AnimationSpeed_SLOW : nTime = 1500; break; 2053cdf0e10cSrcweir case presentation::AnimationSpeed_FAST : nTime = 300; break; 2054cdf0e10cSrcweir default: 2055cdf0e10cSrcweir case presentation::AnimationSpeed_MEDIUM : nTime = 800; 2056cdf0e10cSrcweir } 2057cdf0e10cSrcweir } 2058cdf0e10cSrcweir presentation::FadeEffect eFe; 2059cdf0e10cSrcweir aAny = xPagePropSet->getPropertyValue( sEffect ); 2060cdf0e10cSrcweir vcl::PDFWriter::PageTransition eType = vcl::PDFWriter::Regular; 2061cdf0e10cSrcweir if ( aAny >>= eFe ) 2062cdf0e10cSrcweir { 2063cdf0e10cSrcweir switch( eFe ) 2064cdf0e10cSrcweir { 2065cdf0e10cSrcweir case presentation::FadeEffect_HORIZONTAL_LINES : 2066cdf0e10cSrcweir case presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : 2067cdf0e10cSrcweir case presentation::FadeEffect_HORIZONTAL_STRIPES : eType = vcl::PDFWriter::BlindsHorizontal; break; 2068cdf0e10cSrcweir 2069cdf0e10cSrcweir case presentation::FadeEffect_VERTICAL_LINES : 2070cdf0e10cSrcweir case presentation::FadeEffect_VERTICAL_CHECKERBOARD : 2071cdf0e10cSrcweir case presentation::FadeEffect_VERTICAL_STRIPES : eType = vcl::PDFWriter::BlindsVertical; break; 2072cdf0e10cSrcweir 2073cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_RIGHT : 2074cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : 2075cdf0e10cSrcweir case presentation::FadeEffect_ROLL_FROM_LEFT : 2076cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_UPPERLEFT : 2077cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_UPPERLEFT : 2078cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_LEFT : 2079cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_LEFT : eType = vcl::PDFWriter::WipeLeftToRight; break; 2080cdf0e10cSrcweir 2081cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_BOTTOM : 2082cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : 2083cdf0e10cSrcweir case presentation::FadeEffect_ROLL_FROM_TOP : 2084cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_UPPERRIGHT : 2085cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_UPPERRIGHT : 2086cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_TOP : 2087cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_TOP : eType = vcl::PDFWriter::WipeTopToBottom; break; 2088cdf0e10cSrcweir 2089cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_LEFT : 2090cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_LOWERLEFT : 2091cdf0e10cSrcweir case presentation::FadeEffect_ROLL_FROM_RIGHT : 2092cdf0e10cSrcweir 2093cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_LOWERRIGHT : 2094cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_LOWERRIGHT : 2095cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_RIGHT : 2096cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_RIGHT : eType = vcl::PDFWriter::WipeRightToLeft; break; 2097cdf0e10cSrcweir 2098cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_TOP : 2099cdf0e10cSrcweir case presentation::FadeEffect_UNCOVER_TO_UPPERLEFT : 2100cdf0e10cSrcweir case presentation::FadeEffect_ROLL_FROM_BOTTOM : 2101cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_LOWERLEFT : 2102cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_LOWERLEFT : 2103cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_BOTTOM : 2104cdf0e10cSrcweir case presentation::FadeEffect_MOVE_FROM_BOTTOM : eType = vcl::PDFWriter::WipeBottomToTop; break; 2105cdf0e10cSrcweir 2106cdf0e10cSrcweir case presentation::FadeEffect_OPEN_VERTICAL : eType = vcl::PDFWriter::SplitHorizontalInward; break; 2107cdf0e10cSrcweir case presentation::FadeEffect_CLOSE_HORIZONTAL : eType = vcl::PDFWriter::SplitHorizontalOutward; break; 2108cdf0e10cSrcweir 2109cdf0e10cSrcweir case presentation::FadeEffect_OPEN_HORIZONTAL : eType = vcl::PDFWriter::SplitVerticalInward; break; 2110cdf0e10cSrcweir case presentation::FadeEffect_CLOSE_VERTICAL : eType = vcl::PDFWriter::SplitVerticalOutward; break; 2111cdf0e10cSrcweir 2112cdf0e10cSrcweir case presentation::FadeEffect_FADE_TO_CENTER : eType = vcl::PDFWriter::BoxInward; break; 2113cdf0e10cSrcweir case presentation::FadeEffect_FADE_FROM_CENTER : eType = vcl::PDFWriter::BoxOutward; break; 2114cdf0e10cSrcweir 2115cdf0e10cSrcweir case presentation::FadeEffect_NONE : eType = vcl::PDFWriter::Regular; break; 2116cdf0e10cSrcweir 2117cdf0e10cSrcweir case presentation::FadeEffect_RANDOM : 2118cdf0e10cSrcweir case presentation::FadeEffect_DISSOLVE : 2119cdf0e10cSrcweir default: eType = vcl::PDFWriter::Dissolve; break; 2120cdf0e10cSrcweir } 2121cdf0e10cSrcweir } 2122cdf0e10cSrcweir pPDFExtOutDevData->SetPageTransition( eType, nTime, -1 ); 2123cdf0e10cSrcweir } 2124cdf0e10cSrcweir } 2125cdf0e10cSrcweir } 2126cdf0e10cSrcweir Size aPageSize( mpDoc->GetSdPage( 0, PK_STANDARD )->GetSize() ); 2127cdf0e10cSrcweir Point aPoint( 0, 0 ); 2128cdf0e10cSrcweir Rectangle aPageRect( aPoint, aPageSize ); 2129cdf0e10cSrcweir 2130cdf0e10cSrcweir // resolving links found in this page by the method ImpEditEngine::Paint 2131cdf0e10cSrcweir std::vector< vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = pPDFExtOutDevData->GetBookmarks(); 2132cdf0e10cSrcweir std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIBeg = rBookmarks.begin(); 2133cdf0e10cSrcweir std::vector< vcl::PDFExtOutDevBookmarkEntry >::iterator aIEnd = rBookmarks.end(); 2134cdf0e10cSrcweir while ( aIBeg != aIEnd ) 2135cdf0e10cSrcweir { 2136cdf0e10cSrcweir sal_Int32 nPage = ImplPDFGetBookmarkPage( aIBeg->aBookmark, *mpDoc ); 2137cdf0e10cSrcweir if ( nPage != -1 ) 2138cdf0e10cSrcweir { 2139cdf0e10cSrcweir if ( aIBeg->nLinkId != -1 ) 2140cdf0e10cSrcweir pPDFExtOutDevData->SetLinkDest( aIBeg->nLinkId, pPDFExtOutDevData->CreateDest( aPageRect, nPage, vcl::PDFWriter::FitRectangle ) ); 2141cdf0e10cSrcweir else 2142cdf0e10cSrcweir pPDFExtOutDevData->DescribeRegisteredDest( aIBeg->nDestId, aPageRect, nPage, vcl::PDFWriter::FitRectangle ); 2143cdf0e10cSrcweir } 2144cdf0e10cSrcweir else 2145cdf0e10cSrcweir pPDFExtOutDevData->SetLinkURL( aIBeg->nLinkId, aIBeg->aBookmark ); 2146cdf0e10cSrcweir aIBeg++; 2147cdf0e10cSrcweir } 2148cdf0e10cSrcweir rBookmarks.clear(); 2149cdf0e10cSrcweir //---> i56629, i40318 2150cdf0e10cSrcweir //get the page name, will be used as outline element in PDF bookmark pane 2151cdf0e10cSrcweir String aPageName = mpDoc->GetSdPage( (sal_uInt16)nPageNumber - 1 , PK_STANDARD )->GetName(); 2152cdf0e10cSrcweir if( aPageName.Len() > 0 ) 2153cdf0e10cSrcweir { 2154cdf0e10cSrcweir // insert the bookmark to this page into the NamedDestinations 2155cdf0e10cSrcweir if( pPDFExtOutDevData->GetIsExportNamedDestinations() ) 2156cdf0e10cSrcweir pPDFExtOutDevData->CreateNamedDest( aPageName, aPageRect, nPageNumber - 1 ); 2157cdf0e10cSrcweir // 2158cdf0e10cSrcweir // add the name to the outline, (almost) same code as in sc/source/ui/unoobj/docuno.cxx 2159cdf0e10cSrcweir // issue i40318. 2160cdf0e10cSrcweir // 2161cdf0e10cSrcweir if( pPDFExtOutDevData->GetIsExportBookmarks() ) 2162cdf0e10cSrcweir { 2163cdf0e10cSrcweir // Destination Export 2164cdf0e10cSrcweir const sal_Int32 nDestId = 2165cdf0e10cSrcweir pPDFExtOutDevData->CreateDest( aPageRect , nPageNumber - 1 ); 2166cdf0e10cSrcweir 2167cdf0e10cSrcweir // Create a new outline item: 2168cdf0e10cSrcweir pPDFExtOutDevData->CreateOutlineItem( -1 , aPageName, nDestId ); 2169cdf0e10cSrcweir } 2170cdf0e10cSrcweir } 2171cdf0e10cSrcweir //<--- i56629, i40318 2172cdf0e10cSrcweir } 2173cdf0e10cSrcweir catch( uno::Exception& ) 2174cdf0e10cSrcweir { 2175cdf0e10cSrcweir } 2176cdf0e10cSrcweir 2177cdf0e10cSrcweir } 2178cdf0e10cSrcweir } 2179cdf0e10cSrcweir else 2180cdf0e10cSrcweir { 2181cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes; 2182cdf0e10cSrcweir rSelection >>= xShapes; 2183cdf0e10cSrcweir 2184cdf0e10cSrcweir if( xShapes.is() && xShapes->getCount() ) 2185cdf0e10cSrcweir { 2186cdf0e10cSrcweir SdrPageView* pPV = NULL; 2187cdf0e10cSrcweir 2188cdf0e10cSrcweir ImplRenderPaintProc aImplRenderPaintProc( mpDoc->GetLayerAdmin(), 2189cdf0e10cSrcweir pOldSdView ? pOldSdView->GetSdrPageView() : NULL, pPDFExtOutDevData ); 2190cdf0e10cSrcweir 2191cdf0e10cSrcweir for( sal_uInt32 i = 0, nCount = xShapes->getCount(); i < nCount; i++ ) 2192cdf0e10cSrcweir { 2193cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 2194cdf0e10cSrcweir xShapes->getByIndex( i ) >>= xShape; 2195cdf0e10cSrcweir 2196cdf0e10cSrcweir if( xShape.is() ) 2197cdf0e10cSrcweir { 2198cdf0e10cSrcweir SvxShape* pShape = SvxShape::getImplementation( xShape ); 2199cdf0e10cSrcweir 2200cdf0e10cSrcweir if( pShape ) 2201cdf0e10cSrcweir { 2202cdf0e10cSrcweir SdrObject* pObj = pShape->GetSdrObject(); 2203cdf0e10cSrcweir if( pObj && pObj->GetPage() 2204cdf0e10cSrcweir && aImplRenderPaintProc.IsVisible( pObj ) 2205cdf0e10cSrcweir && aImplRenderPaintProc.IsPrintable( pObj ) ) 2206cdf0e10cSrcweir { 2207cdf0e10cSrcweir if( !pPV ) 2208cdf0e10cSrcweir pPV = pView->ShowSdrPage( pObj->GetPage() ); 2209cdf0e10cSrcweir 2210cdf0e10cSrcweir if( pPV ) 2211cdf0e10cSrcweir pView->MarkObj( pObj, pPV ); 2212cdf0e10cSrcweir } 2213cdf0e10cSrcweir } 2214cdf0e10cSrcweir } 2215cdf0e10cSrcweir } 2216cdf0e10cSrcweir pView->DrawMarkedObj(*pOut); 2217cdf0e10cSrcweir } 2218cdf0e10cSrcweir } 2219cdf0e10cSrcweir 2220cdf0e10cSrcweir delete pView; 2221cdf0e10cSrcweir } 2222cdf0e10cSrcweir } 2223cdf0e10cSrcweir } 2224cdf0e10cSrcweir } 2225cdf0e10cSrcweir 2226cdf0e10cSrcweir uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() 2227cdf0e10cSrcweir { 2228cdf0e10cSrcweir uno::Reference< i18n::XForbiddenCharacters > xForb(mxForbidenCharacters); 2229cdf0e10cSrcweir 2230cdf0e10cSrcweir if( !xForb.is() ) 2231cdf0e10cSrcweir mxForbidenCharacters = xForb = new SdUnoForbiddenCharsTable( mpDoc ); 2232cdf0e10cSrcweir 2233cdf0e10cSrcweir return xForb; 2234cdf0e10cSrcweir } 2235cdf0e10cSrcweir 2236cdf0e10cSrcweir void SdXImpressDocument::initializeDocument() 2237cdf0e10cSrcweir { 2238cdf0e10cSrcweir if( !mbClipBoard ) 2239cdf0e10cSrcweir { 2240cdf0e10cSrcweir switch( mpDoc->GetPageCount() ) 2241cdf0e10cSrcweir { 2242cdf0e10cSrcweir case 1: 2243cdf0e10cSrcweir { 2244cdf0e10cSrcweir // nasty hack to detect clipboard document 2245cdf0e10cSrcweir mbClipBoard = true; 2246cdf0e10cSrcweir break; 2247cdf0e10cSrcweir } 2248cdf0e10cSrcweir case 0: 2249cdf0e10cSrcweir { 2250cdf0e10cSrcweir mpDoc->CreateFirstPages(); 2251cdf0e10cSrcweir mpDoc->StopWorkStartupDelay(); 2252cdf0e10cSrcweir break; 2253cdf0e10cSrcweir } 2254cdf0e10cSrcweir } 2255cdf0e10cSrcweir } 2256cdf0e10cSrcweir } 2257cdf0e10cSrcweir 2258cdf0e10cSrcweir void SAL_CALL SdXImpressDocument::dispose() throw (::com::sun::star::uno::RuntimeException) 2259cdf0e10cSrcweir { 2260cdf0e10cSrcweir if( !mbDisposed ) 2261cdf0e10cSrcweir { 2262cdf0e10cSrcweir { 2263cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2264cdf0e10cSrcweir 2265cdf0e10cSrcweir if( mpDoc ) 2266cdf0e10cSrcweir { 2267cdf0e10cSrcweir EndListening( *mpDoc ); 2268cdf0e10cSrcweir mpDoc = NULL; 2269cdf0e10cSrcweir } 2270cdf0e10cSrcweir 2271cdf0e10cSrcweir // Call the base class dispose() before setting the mbDisposed flag 2272cdf0e10cSrcweir // to true. The reason for this is that if close() has not yet been 2273cdf0e10cSrcweir // called this is done in SfxBaseModel::dispose(). At the end of 2274cdf0e10cSrcweir // that dispose() is called again. It is important to forward this 2275cdf0e10cSrcweir // second dispose() to the base class, too. 2276cdf0e10cSrcweir // As a consequence the following code has to be able to be run twice. 2277cdf0e10cSrcweir SfxBaseModel::dispose(); 2278cdf0e10cSrcweir mbDisposed = true; 2279cdf0e10cSrcweir 2280cdf0e10cSrcweir uno::Reference< container::XNameAccess > xStyles(mxStyleFamilies); 2281cdf0e10cSrcweir if( xStyles.is() ) 2282cdf0e10cSrcweir { 2283cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xStyles, uno::UNO_QUERY ); 2284cdf0e10cSrcweir if( xComp.is() ) 2285cdf0e10cSrcweir xComp->dispose(); 2286cdf0e10cSrcweir 2287cdf0e10cSrcweir xStyles = 0; 2288cdf0e10cSrcweir } 2289cdf0e10cSrcweir 2290cdf0e10cSrcweir uno::Reference< presentation::XPresentation > xPresentation( mxPresentation ); 2291cdf0e10cSrcweir if( xPresentation.is() ) 2292cdf0e10cSrcweir { 2293cdf0e10cSrcweir uno::Reference< ::com::sun::star::presentation::XPresentation2 > xPres( mpDoc->getPresentation().get() ); 2294cdf0e10cSrcweir uno::Reference< lang::XComponent > xPresComp( xPres, uno::UNO_QUERY ); 2295cdf0e10cSrcweir if( xPresComp.is() ) 2296cdf0e10cSrcweir xPresComp->dispose(); 2297cdf0e10cSrcweir } 2298cdf0e10cSrcweir 2299cdf0e10cSrcweir uno::Reference< container::XNameAccess > xLinks( mxLinks ); 2300cdf0e10cSrcweir if( xLinks.is() ) 2301cdf0e10cSrcweir { 2302cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xLinks, uno::UNO_QUERY ); 2303cdf0e10cSrcweir if( xComp.is() ) 2304cdf0e10cSrcweir xComp->dispose(); 2305cdf0e10cSrcweir 2306cdf0e10cSrcweir xLinks = 0; 2307cdf0e10cSrcweir } 2308cdf0e10cSrcweir 2309cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > xDrawPagesAccess( mxDrawPagesAccess ); 2310cdf0e10cSrcweir if( xDrawPagesAccess.is() ) 2311cdf0e10cSrcweir { 2312cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xDrawPagesAccess, uno::UNO_QUERY ); 2313cdf0e10cSrcweir if( xComp.is() ) 2314cdf0e10cSrcweir xComp->dispose(); 2315cdf0e10cSrcweir 2316cdf0e10cSrcweir xDrawPagesAccess = 0; 2317cdf0e10cSrcweir } 2318cdf0e10cSrcweir 2319cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > xMasterPagesAccess( mxMasterPagesAccess ); 2320cdf0e10cSrcweir if( xDrawPagesAccess.is() ) 2321cdf0e10cSrcweir { 2322cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xMasterPagesAccess, uno::UNO_QUERY ); 2323cdf0e10cSrcweir if( xComp.is() ) 2324cdf0e10cSrcweir xComp->dispose(); 2325cdf0e10cSrcweir 2326cdf0e10cSrcweir xDrawPagesAccess = 0; 2327cdf0e10cSrcweir } 2328cdf0e10cSrcweir 2329cdf0e10cSrcweir uno::Reference< container::XNameAccess > xLayerManager( mxLayerManager ); 2330cdf0e10cSrcweir if( xLayerManager.is() ) 2331cdf0e10cSrcweir { 2332cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xLayerManager, uno::UNO_QUERY ); 2333cdf0e10cSrcweir if( xComp.is() ) 2334cdf0e10cSrcweir xComp->dispose(); 2335cdf0e10cSrcweir 2336cdf0e10cSrcweir xLayerManager = 0; 2337cdf0e10cSrcweir } 2338cdf0e10cSrcweir 2339cdf0e10cSrcweir uno::Reference< container::XNameContainer > xCustomPresentationAccess( mxCustomPresentationAccess ); 2340cdf0e10cSrcweir if( xCustomPresentationAccess.is() ) 2341cdf0e10cSrcweir { 2342cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp( xCustomPresentationAccess, uno::UNO_QUERY ); 2343cdf0e10cSrcweir if( xComp.is() ) 2344cdf0e10cSrcweir xComp->dispose(); 2345cdf0e10cSrcweir 2346cdf0e10cSrcweir xCustomPresentationAccess = 0; 2347cdf0e10cSrcweir } 2348cdf0e10cSrcweir 2349cdf0e10cSrcweir mxDashTable = 0; 2350cdf0e10cSrcweir mxGradientTable = 0; 2351cdf0e10cSrcweir mxHatchTable = 0; 2352cdf0e10cSrcweir mxBitmapTable = 0; 2353cdf0e10cSrcweir mxTransGradientTable = 0; 2354cdf0e10cSrcweir mxMarkerTable = 0; 2355cdf0e10cSrcweir mxDrawingPool = 0; 2356cdf0e10cSrcweir } 2357cdf0e10cSrcweir } 2358cdf0e10cSrcweir } 2359cdf0e10cSrcweir 2360cdf0e10cSrcweir //============================================================================= 2361cdf0e10cSrcweir // class SdDrawPagesAccess 2362cdf0e10cSrcweir //============================================================================= 2363cdf0e10cSrcweir 2364cdf0e10cSrcweir SdDrawPagesAccess::SdDrawPagesAccess( SdXImpressDocument& rMyModel ) throw() 2365cdf0e10cSrcweir : mpModel( &rMyModel) 2366cdf0e10cSrcweir { 2367cdf0e10cSrcweir } 2368cdf0e10cSrcweir 2369cdf0e10cSrcweir SdDrawPagesAccess::~SdDrawPagesAccess() throw() 2370cdf0e10cSrcweir { 2371cdf0e10cSrcweir } 2372cdf0e10cSrcweir 2373cdf0e10cSrcweir // XIndexAccess 2374cdf0e10cSrcweir sal_Int32 SAL_CALL SdDrawPagesAccess::getCount() 2375cdf0e10cSrcweir throw(uno::RuntimeException) 2376cdf0e10cSrcweir { 2377cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2378cdf0e10cSrcweir 2379cdf0e10cSrcweir if( NULL == mpModel ) 2380cdf0e10cSrcweir throw lang::DisposedException(); 2381cdf0e10cSrcweir 2382cdf0e10cSrcweir return mpModel->mpDoc->GetSdPageCount( PK_STANDARD ); 2383cdf0e10cSrcweir } 2384cdf0e10cSrcweir 2385cdf0e10cSrcweir uno::Any SAL_CALL SdDrawPagesAccess::getByIndex( sal_Int32 Index ) 2386cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 2387cdf0e10cSrcweir { 2388cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2389cdf0e10cSrcweir 2390cdf0e10cSrcweir if( NULL == mpModel ) 2391cdf0e10cSrcweir throw lang::DisposedException(); 2392cdf0e10cSrcweir 2393cdf0e10cSrcweir uno::Any aAny; 2394cdf0e10cSrcweir 2395cdf0e10cSrcweir if( (Index < 0) || (Index >= mpModel->mpDoc->GetSdPageCount( PK_STANDARD ) ) ) 2396cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 2397cdf0e10cSrcweir 2398cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)Index, PK_STANDARD ); 2399cdf0e10cSrcweir if( pPage ) 2400cdf0e10cSrcweir { 2401cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); 2402cdf0e10cSrcweir aAny <<= xDrawPage; 2403cdf0e10cSrcweir } 2404cdf0e10cSrcweir 2405cdf0e10cSrcweir return aAny; 2406cdf0e10cSrcweir } 2407cdf0e10cSrcweir 2408cdf0e10cSrcweir // XNameAccess 2409cdf0e10cSrcweir uno::Any SAL_CALL SdDrawPagesAccess::getByName( const OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 2410cdf0e10cSrcweir { 2411cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2412cdf0e10cSrcweir 2413cdf0e10cSrcweir if( NULL == mpModel ) 2414cdf0e10cSrcweir throw lang::DisposedException(); 2415cdf0e10cSrcweir 2416cdf0e10cSrcweir if( aName.getLength() != 0 ) 2417cdf0e10cSrcweir { 2418cdf0e10cSrcweir const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD ); 2419cdf0e10cSrcweir sal_uInt16 nPage; 2420cdf0e10cSrcweir for( nPage = 0; nPage < nCount; nPage++ ) 2421cdf0e10cSrcweir { 2422cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD ); 2423cdf0e10cSrcweir if(NULL == pPage) 2424cdf0e10cSrcweir continue; 2425cdf0e10cSrcweir 2426cdf0e10cSrcweir if( aName == SdDrawPage::getPageApiName( pPage ) ) 2427cdf0e10cSrcweir { 2428cdf0e10cSrcweir uno::Any aAny; 2429cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); 2430cdf0e10cSrcweir aAny <<= xDrawPage; 2431cdf0e10cSrcweir return aAny; 2432cdf0e10cSrcweir } 2433cdf0e10cSrcweir } 2434cdf0e10cSrcweir } 2435cdf0e10cSrcweir 2436cdf0e10cSrcweir throw container::NoSuchElementException(); 2437cdf0e10cSrcweir } 2438cdf0e10cSrcweir 2439cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getElementNames() throw(uno::RuntimeException) 2440cdf0e10cSrcweir { 2441cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2442cdf0e10cSrcweir 2443cdf0e10cSrcweir if( NULL == mpModel ) 2444cdf0e10cSrcweir throw lang::DisposedException(); 2445cdf0e10cSrcweir 2446cdf0e10cSrcweir const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD ); 2447cdf0e10cSrcweir uno::Sequence< OUString > aNames( nCount ); 2448cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 2449cdf0e10cSrcweir 2450cdf0e10cSrcweir sal_uInt16 nPage; 2451cdf0e10cSrcweir for( nPage = 0; nPage < nCount; nPage++ ) 2452cdf0e10cSrcweir { 2453cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD ); 2454cdf0e10cSrcweir *pNames++ = SdDrawPage::getPageApiName( pPage ); 2455cdf0e10cSrcweir } 2456cdf0e10cSrcweir 2457cdf0e10cSrcweir return aNames; 2458cdf0e10cSrcweir } 2459cdf0e10cSrcweir 2460cdf0e10cSrcweir sal_Bool SAL_CALL SdDrawPagesAccess::hasByName( const OUString& aName ) throw(uno::RuntimeException) 2461cdf0e10cSrcweir { 2462cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2463cdf0e10cSrcweir 2464cdf0e10cSrcweir if( NULL == mpModel ) 2465cdf0e10cSrcweir throw lang::DisposedException(); 2466cdf0e10cSrcweir 2467cdf0e10cSrcweir const sal_uInt16 nCount = mpModel->mpDoc->GetSdPageCount( PK_STANDARD ); 2468cdf0e10cSrcweir sal_uInt16 nPage; 2469cdf0e10cSrcweir for( nPage = 0; nPage < nCount; nPage++ ) 2470cdf0e10cSrcweir { 2471cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetSdPage( nPage, PK_STANDARD ); 2472cdf0e10cSrcweir if(NULL == pPage) 2473cdf0e10cSrcweir continue; 2474cdf0e10cSrcweir 2475cdf0e10cSrcweir if( aName == SdDrawPage::getPageApiName( pPage ) ) 2476cdf0e10cSrcweir return sal_True; 2477cdf0e10cSrcweir } 2478cdf0e10cSrcweir 2479cdf0e10cSrcweir return sal_False; 2480cdf0e10cSrcweir } 2481cdf0e10cSrcweir 2482cdf0e10cSrcweir // XElementAccess 2483cdf0e10cSrcweir uno::Type SAL_CALL SdDrawPagesAccess::getElementType() 2484cdf0e10cSrcweir throw(uno::RuntimeException) 2485cdf0e10cSrcweir { 2486cdf0e10cSrcweir return ITYPE( drawing::XDrawPage ); 2487cdf0e10cSrcweir } 2488cdf0e10cSrcweir 2489cdf0e10cSrcweir sal_Bool SAL_CALL SdDrawPagesAccess::hasElements() 2490cdf0e10cSrcweir throw(uno::RuntimeException) 2491cdf0e10cSrcweir { 2492cdf0e10cSrcweir return getCount() > 0; 2493cdf0e10cSrcweir } 2494cdf0e10cSrcweir 2495cdf0e10cSrcweir // XDrawPages 2496cdf0e10cSrcweir 2497cdf0e10cSrcweir /****************************************************************************** 2498cdf0e10cSrcweir * Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die * 2499cdf0e10cSrcweir * dazugehoerige SdDrawPage zurueck. * 2500cdf0e10cSrcweir ******************************************************************************/ 2501cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL SdDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex ) 2502cdf0e10cSrcweir throw(uno::RuntimeException) 2503cdf0e10cSrcweir { 2504cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2505cdf0e10cSrcweir 2506cdf0e10cSrcweir if( NULL == mpModel ) 2507cdf0e10cSrcweir throw lang::DisposedException(); 2508cdf0e10cSrcweir 2509cdf0e10cSrcweir if( mpModel->mpDoc ) 2510cdf0e10cSrcweir { 2511cdf0e10cSrcweir SdPage* pPage = mpModel->InsertSdPage( (sal_uInt16)nIndex ); 2512cdf0e10cSrcweir if( pPage ) 2513cdf0e10cSrcweir { 2514cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); 2515cdf0e10cSrcweir return xDrawPage; 2516cdf0e10cSrcweir } 2517cdf0e10cSrcweir } 2518cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage; 2519cdf0e10cSrcweir return xDrawPage; 2520cdf0e10cSrcweir } 2521cdf0e10cSrcweir 2522cdf0e10cSrcweir /****************************************************************************** 2523cdf0e10cSrcweir * Entfernt die angegebenne SdDrawPage aus dem Model und aus der internen * 2524cdf0e10cSrcweir * Liste. Dies funktioniert nur, wenn mindestens eine *normale* Seite im Model * 2525cdf0e10cSrcweir * nach dem entfernen dieser Seite vorhanden ist. * 2526cdf0e10cSrcweir ******************************************************************************/ 2527cdf0e10cSrcweir void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage ) 2528cdf0e10cSrcweir throw(uno::RuntimeException) 2529cdf0e10cSrcweir { 2530cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2531cdf0e10cSrcweir 2532cdf0e10cSrcweir if( NULL == mpModel || mpModel->mpDoc == NULL ) 2533cdf0e10cSrcweir throw lang::DisposedException(); 2534cdf0e10cSrcweir 2535cdf0e10cSrcweir SdDrawDocument& rDoc = *mpModel->mpDoc; 2536cdf0e10cSrcweir 2537cdf0e10cSrcweir sal_uInt16 nPageCount = rDoc.GetSdPageCount( PK_STANDARD ); 2538cdf0e10cSrcweir if( nPageCount > 1 ) 2539cdf0e10cSrcweir { 2540cdf0e10cSrcweir // pPage von xPage besorgen und dann die Id (nPos )ermitteln 2541cdf0e10cSrcweir SdDrawPage* pSvxPage = SdDrawPage::getImplementation( xPage ); 2542cdf0e10cSrcweir if( pSvxPage ) 2543cdf0e10cSrcweir { 2544cdf0e10cSrcweir SdPage* pPage = (SdPage*) pSvxPage->GetSdrPage(); 2545cdf0e10cSrcweir if(pPage && ( pPage->GetPageKind() == PK_STANDARD ) ) 2546cdf0e10cSrcweir { 2547cdf0e10cSrcweir sal_uInt16 nPage = pPage->GetPageNum(); 2548cdf0e10cSrcweir 2549cdf0e10cSrcweir SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetPage( nPage+1 ) ); 2550cdf0e10cSrcweir 2551cdf0e10cSrcweir bool bUndo = rDoc.IsUndoEnabled(); 2552cdf0e10cSrcweir if( bUndo ) 2553cdf0e10cSrcweir { 2554cdf0e10cSrcweir // Add undo actions and delete the pages. The order of adding 2555cdf0e10cSrcweir // the undo actions is important. 2556cdf0e10cSrcweir rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) ); 2557cdf0e10cSrcweir rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); 2558cdf0e10cSrcweir rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); 2559cdf0e10cSrcweir } 2560cdf0e10cSrcweir 2561cdf0e10cSrcweir rDoc.RemovePage( nPage ); // the page 2562cdf0e10cSrcweir rDoc.RemovePage( nPage ); // the notes page 2563cdf0e10cSrcweir 2564cdf0e10cSrcweir if( bUndo ) 2565cdf0e10cSrcweir { 2566cdf0e10cSrcweir rDoc.EndUndo(); 2567cdf0e10cSrcweir } 2568cdf0e10cSrcweir else 2569cdf0e10cSrcweir { 2570cdf0e10cSrcweir delete pNotesPage; 2571cdf0e10cSrcweir delete pPage; 2572cdf0e10cSrcweir } 2573cdf0e10cSrcweir } 2574cdf0e10cSrcweir } 2575cdf0e10cSrcweir } 2576cdf0e10cSrcweir 2577cdf0e10cSrcweir mpModel->SetModified(); 2578cdf0e10cSrcweir } 2579cdf0e10cSrcweir 2580cdf0e10cSrcweir // XServiceInfo 2581cdf0e10cSrcweir sal_Char pSdDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages"; 2582cdf0e10cSrcweir 2583cdf0e10cSrcweir OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException) 2584cdf0e10cSrcweir { 2585cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdDrawPagesAccess" ) ); 2586cdf0e10cSrcweir } 2587cdf0e10cSrcweir 2588cdf0e10cSrcweir sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) 2589cdf0e10cSrcweir { 2590cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdDrawPagesAccessService ) ); 2591cdf0e10cSrcweir } 2592cdf0e10cSrcweir 2593cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) 2594cdf0e10cSrcweir { 2595cdf0e10cSrcweir OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdDrawPagesAccessService ) ); 2596cdf0e10cSrcweir uno::Sequence< OUString > aSeq( &aService, 1 ); 2597cdf0e10cSrcweir return aSeq; 2598cdf0e10cSrcweir } 2599cdf0e10cSrcweir 2600cdf0e10cSrcweir // XComponent 2601cdf0e10cSrcweir void SAL_CALL SdDrawPagesAccess::dispose( ) throw (uno::RuntimeException) 2602cdf0e10cSrcweir { 2603cdf0e10cSrcweir mpModel = NULL; 2604cdf0e10cSrcweir } 2605cdf0e10cSrcweir 2606cdf0e10cSrcweir void SAL_CALL SdDrawPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2607cdf0e10cSrcweir { 2608cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2609cdf0e10cSrcweir } 2610cdf0e10cSrcweir 2611cdf0e10cSrcweir void SAL_CALL SdDrawPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2612cdf0e10cSrcweir { 2613cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2614cdf0e10cSrcweir } 2615cdf0e10cSrcweir 2616cdf0e10cSrcweir //============================================================================= 2617cdf0e10cSrcweir // class SdMasterPagesAccess 2618cdf0e10cSrcweir //============================================================================= 2619cdf0e10cSrcweir 2620cdf0e10cSrcweir SdMasterPagesAccess::SdMasterPagesAccess( SdXImpressDocument& rMyModel ) throw() 2621cdf0e10cSrcweir : mpModel(&rMyModel) 2622cdf0e10cSrcweir { 2623cdf0e10cSrcweir } 2624cdf0e10cSrcweir 2625cdf0e10cSrcweir SdMasterPagesAccess::~SdMasterPagesAccess() throw() 2626cdf0e10cSrcweir { 2627cdf0e10cSrcweir } 2628cdf0e10cSrcweir 2629cdf0e10cSrcweir // XComponent 2630cdf0e10cSrcweir void SAL_CALL SdMasterPagesAccess::dispose( ) throw (uno::RuntimeException) 2631cdf0e10cSrcweir { 2632cdf0e10cSrcweir mpModel = NULL; 2633cdf0e10cSrcweir } 2634cdf0e10cSrcweir 2635cdf0e10cSrcweir void SAL_CALL SdMasterPagesAccess::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2636cdf0e10cSrcweir { 2637cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2638cdf0e10cSrcweir } 2639cdf0e10cSrcweir 2640cdf0e10cSrcweir void SAL_CALL SdMasterPagesAccess::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2641cdf0e10cSrcweir { 2642cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2643cdf0e10cSrcweir } 2644cdf0e10cSrcweir 2645cdf0e10cSrcweir // XIndexAccess 2646cdf0e10cSrcweir sal_Int32 SAL_CALL SdMasterPagesAccess::getCount() 2647cdf0e10cSrcweir throw(uno::RuntimeException) 2648cdf0e10cSrcweir { 2649cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2650cdf0e10cSrcweir 2651cdf0e10cSrcweir if( NULL == mpModel->mpDoc ) 2652cdf0e10cSrcweir throw lang::DisposedException(); 2653cdf0e10cSrcweir 2654cdf0e10cSrcweir return mpModel->mpDoc->GetMasterSdPageCount(PK_STANDARD); 2655cdf0e10cSrcweir } 2656cdf0e10cSrcweir 2657cdf0e10cSrcweir /****************************************************************************** 2658cdf0e10cSrcweir * Liefert ein drawing::XDrawPage Interface fuer den Zugriff auf die Masterpage and der * 2659cdf0e10cSrcweir * angegebennen Position im Model. * 2660cdf0e10cSrcweir ******************************************************************************/ 2661cdf0e10cSrcweir uno::Any SAL_CALL SdMasterPagesAccess::getByIndex( sal_Int32 Index ) 2662cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 2663cdf0e10cSrcweir { 2664cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2665cdf0e10cSrcweir 2666cdf0e10cSrcweir if( NULL == mpModel ) 2667cdf0e10cSrcweir throw lang::DisposedException(); 2668cdf0e10cSrcweir 2669cdf0e10cSrcweir uno::Any aAny; 2670cdf0e10cSrcweir 2671cdf0e10cSrcweir if( (Index < 0) || (Index >= mpModel->mpDoc->GetMasterSdPageCount( PK_STANDARD ) ) ) 2672cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 2673cdf0e10cSrcweir 2674cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetMasterSdPage( (sal_uInt16)Index, PK_STANDARD ); 2675cdf0e10cSrcweir if( pPage ) 2676cdf0e10cSrcweir { 2677cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage( pPage->getUnoPage(), uno::UNO_QUERY ); 2678cdf0e10cSrcweir aAny <<= xDrawPage; 2679cdf0e10cSrcweir } 2680cdf0e10cSrcweir 2681cdf0e10cSrcweir return aAny; 2682cdf0e10cSrcweir } 2683cdf0e10cSrcweir 2684cdf0e10cSrcweir // XElementAccess 2685cdf0e10cSrcweir uno::Type SAL_CALL SdMasterPagesAccess::getElementType() 2686cdf0e10cSrcweir throw(uno::RuntimeException) 2687cdf0e10cSrcweir { 2688cdf0e10cSrcweir return ITYPE(drawing::XDrawPage); 2689cdf0e10cSrcweir } 2690cdf0e10cSrcweir 2691cdf0e10cSrcweir sal_Bool SAL_CALL SdMasterPagesAccess::hasElements() 2692cdf0e10cSrcweir throw(uno::RuntimeException) 2693cdf0e10cSrcweir { 2694cdf0e10cSrcweir return getCount() > 0; 2695cdf0e10cSrcweir } 2696cdf0e10cSrcweir 2697cdf0e10cSrcweir // XDrawPages 2698cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL SdMasterPagesAccess::insertNewByIndex( sal_Int32 nInsertPos ) 2699cdf0e10cSrcweir throw(uno::RuntimeException) 2700cdf0e10cSrcweir { 2701cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2702cdf0e10cSrcweir 2703cdf0e10cSrcweir if( NULL == mpModel ) 2704cdf0e10cSrcweir throw lang::DisposedException(); 2705cdf0e10cSrcweir 2706cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage; 2707cdf0e10cSrcweir 2708cdf0e10cSrcweir SdDrawDocument* mpDoc = mpModel->mpDoc; 2709cdf0e10cSrcweir if( mpDoc ) 2710cdf0e10cSrcweir { 2711cdf0e10cSrcweir // calculate internal index and check for range errors 2712cdf0e10cSrcweir const sal_Int32 nMPageCount = mpDoc->GetMasterPageCount(); 2713cdf0e10cSrcweir nInsertPos = nInsertPos * 2 + 1; 2714cdf0e10cSrcweir if( nInsertPos < 0 || nInsertPos > nMPageCount ) 2715cdf0e10cSrcweir nInsertPos = nMPageCount; 2716cdf0e10cSrcweir 2717cdf0e10cSrcweir // now generate a unique name for the new masterpage 2718cdf0e10cSrcweir const String aStdPrefix( SdResId(STR_LAYOUT_DEFAULT_NAME) ); 2719cdf0e10cSrcweir String aPrefix( aStdPrefix ); 2720cdf0e10cSrcweir 2721cdf0e10cSrcweir sal_Bool bUnique = sal_True; 2722cdf0e10cSrcweir sal_Int32 i = 0; 2723cdf0e10cSrcweir do 2724cdf0e10cSrcweir { 2725cdf0e10cSrcweir bUnique = sal_True; 2726cdf0e10cSrcweir for( sal_Int32 nMaster = 1; nMaster < nMPageCount; nMaster++ ) 2727cdf0e10cSrcweir { 2728cdf0e10cSrcweir SdPage* pPage = (SdPage*)mpDoc->GetMasterPage((sal_uInt16)nMaster); 2729cdf0e10cSrcweir if( pPage && pPage->GetName() == aPrefix ) 2730cdf0e10cSrcweir { 2731cdf0e10cSrcweir bUnique = sal_False; 2732cdf0e10cSrcweir break; 2733cdf0e10cSrcweir } 2734cdf0e10cSrcweir } 2735cdf0e10cSrcweir 2736cdf0e10cSrcweir if( !bUnique ) 2737cdf0e10cSrcweir { 2738cdf0e10cSrcweir i++; 2739cdf0e10cSrcweir aPrefix = aStdPrefix; 2740cdf0e10cSrcweir aPrefix += sal_Unicode( ' ' ); 2741cdf0e10cSrcweir aPrefix += String::CreateFromInt32( i ); 2742cdf0e10cSrcweir } 2743cdf0e10cSrcweir 2744cdf0e10cSrcweir } while( !bUnique ); 2745cdf0e10cSrcweir 2746cdf0e10cSrcweir String aLayoutName( aPrefix ); 2747cdf0e10cSrcweir aLayoutName.AppendAscii( RTL_CONSTASCII_STRINGPARAM( SD_LT_SEPARATOR )); 2748cdf0e10cSrcweir aLayoutName += String(SdResId(STR_LAYOUT_OUTLINE)); 2749cdf0e10cSrcweir 2750cdf0e10cSrcweir // create styles 2751cdf0e10cSrcweir ((SdStyleSheetPool*)mpDoc->GetStyleSheetPool())->CreateLayoutStyleSheets( aPrefix ); 2752cdf0e10cSrcweir 2753cdf0e10cSrcweir // get the first page for initial size and border settings 2754cdf0e10cSrcweir SdPage* pPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_STANDARD ); 2755cdf0e10cSrcweir SdPage* pRefNotesPage = mpModel->mpDoc->GetSdPage( (sal_uInt16)0, PK_NOTES); 2756cdf0e10cSrcweir 2757cdf0e10cSrcweir // create and instert new draw masterpage 2758cdf0e10cSrcweir SdPage* pMPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True); 2759cdf0e10cSrcweir pMPage->SetSize( pPage->GetSize() ); 2760cdf0e10cSrcweir pMPage->SetBorder( pPage->GetLftBorder(), 2761cdf0e10cSrcweir pPage->GetUppBorder(), 2762cdf0e10cSrcweir pPage->GetRgtBorder(), 2763cdf0e10cSrcweir pPage->GetLwrBorder() ); 2764cdf0e10cSrcweir pMPage->SetLayoutName( aLayoutName ); 2765cdf0e10cSrcweir mpDoc->InsertMasterPage(pMPage, (sal_uInt16)nInsertPos); 2766cdf0e10cSrcweir 2767cdf0e10cSrcweir { 2768cdf0e10cSrcweir // ensure default MasterPage fill 2769cdf0e10cSrcweir pMPage->EnsureMasterPageDefaultBackground(); 2770cdf0e10cSrcweir } 2771cdf0e10cSrcweir 2772cdf0e10cSrcweir xDrawPage = uno::Reference< drawing::XDrawPage >::query( pMPage->getUnoPage() ); 2773cdf0e10cSrcweir 2774cdf0e10cSrcweir // create and instert new notes masterpage 2775cdf0e10cSrcweir SdPage* pMNotesPage = (SdPage*)mpModel->mpDoc->AllocPage(sal_True); 2776cdf0e10cSrcweir pMNotesPage->SetSize( pRefNotesPage->GetSize() ); 2777cdf0e10cSrcweir pMNotesPage->SetPageKind(PK_NOTES); 2778cdf0e10cSrcweir pMNotesPage->SetBorder( pRefNotesPage->GetLftBorder(), 2779cdf0e10cSrcweir pRefNotesPage->GetUppBorder(), 2780cdf0e10cSrcweir pRefNotesPage->GetRgtBorder(), 2781cdf0e10cSrcweir pRefNotesPage->GetLwrBorder() ); 2782cdf0e10cSrcweir pMNotesPage->SetLayoutName( aLayoutName ); 2783cdf0e10cSrcweir mpDoc->InsertMasterPage(pMNotesPage, (sal_uInt16)nInsertPos + 1); 2784cdf0e10cSrcweir // pMNotesPage->InsertMasterPage( pMPage->GetPageNum() ); 2785cdf0e10cSrcweir pMNotesPage->SetAutoLayout(AUTOLAYOUT_NOTES, sal_True, sal_True); 2786cdf0e10cSrcweir mpModel->SetModified(); 2787cdf0e10cSrcweir } 2788cdf0e10cSrcweir 2789cdf0e10cSrcweir return( xDrawPage ); 2790cdf0e10cSrcweir } 2791cdf0e10cSrcweir 2792cdf0e10cSrcweir /****************************************************************************** 2793cdf0e10cSrcweir * Entfernt die angegebenne SdMasterPage aus dem Model und aus der internen * 2794cdf0e10cSrcweir * Liste. Dies funktioniert nur, wenn keine *normale* Seite im Model diese * 2795cdf0e10cSrcweir * Seite als Masterpage benutzt. * 2796cdf0e10cSrcweir ******************************************************************************/ 2797cdf0e10cSrcweir void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage ) 2798cdf0e10cSrcweir throw(uno::RuntimeException) 2799cdf0e10cSrcweir { 2800cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2801cdf0e10cSrcweir 2802cdf0e10cSrcweir if( NULL == mpModel || mpModel->mpDoc == NULL ) 2803cdf0e10cSrcweir throw lang::DisposedException(); 2804cdf0e10cSrcweir 2805cdf0e10cSrcweir SdDrawDocument& rDoc = *mpModel->mpDoc; 2806cdf0e10cSrcweir 2807cdf0e10cSrcweir SdMasterPage* pSdPage = SdMasterPage::getImplementation( xPage ); 2808cdf0e10cSrcweir if(pSdPage == NULL) 2809cdf0e10cSrcweir return; 2810cdf0e10cSrcweir 2811cdf0e10cSrcweir SdPage* pPage = dynamic_cast< SdPage* > (pSdPage->GetSdrPage()); 2812cdf0e10cSrcweir 2813cdf0e10cSrcweir DBG_ASSERT( pPage && pPage->IsMasterPage(), "SdMasterPage is not masterpage?"); 2814cdf0e10cSrcweir 2815cdf0e10cSrcweir if( !pPage || !pPage->IsMasterPage() || (mpModel->mpDoc->GetMasterPageUserCount(pPage) > 0)) 2816cdf0e10cSrcweir return; //Todo: this should be excepted 2817cdf0e10cSrcweir 2818cdf0e10cSrcweir // only standard pages can be removed directly 2819cdf0e10cSrcweir if( pPage->GetPageKind() == PK_STANDARD ) 2820cdf0e10cSrcweir { 2821cdf0e10cSrcweir sal_uInt16 nPage = pPage->GetPageNum(); 2822cdf0e10cSrcweir 2823cdf0e10cSrcweir SdPage* pNotesPage = static_cast< SdPage* >( rDoc.GetMasterPage( nPage+1 ) ); 2824cdf0e10cSrcweir 2825cdf0e10cSrcweir bool bUndo = rDoc.IsUndoEnabled(); 2826cdf0e10cSrcweir if( bUndo ) 2827cdf0e10cSrcweir { 2828cdf0e10cSrcweir // Add undo actions and delete the pages. The order of adding 2829cdf0e10cSrcweir // the undo actions is important. 2830cdf0e10cSrcweir rDoc.BegUndo( SdResId( STR_UNDO_DELETEPAGES ) ); 2831cdf0e10cSrcweir rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pNotesPage)); 2832cdf0e10cSrcweir rDoc.AddUndo(rDoc.GetSdrUndoFactory().CreateUndoDeletePage(*pPage)); 2833cdf0e10cSrcweir } 2834cdf0e10cSrcweir 2835cdf0e10cSrcweir rDoc.RemoveMasterPage( nPage ); 2836cdf0e10cSrcweir rDoc.RemoveMasterPage( nPage ); 2837cdf0e10cSrcweir 2838cdf0e10cSrcweir if( bUndo ) 2839cdf0e10cSrcweir { 2840cdf0e10cSrcweir rDoc.EndUndo(); 2841cdf0e10cSrcweir } 2842cdf0e10cSrcweir else 2843cdf0e10cSrcweir { 2844cdf0e10cSrcweir delete pNotesPage; 2845cdf0e10cSrcweir delete pPage; 2846cdf0e10cSrcweir } 2847cdf0e10cSrcweir } 2848cdf0e10cSrcweir } 2849cdf0e10cSrcweir 2850cdf0e10cSrcweir // XServiceInfo 2851cdf0e10cSrcweir sal_Char pSdMasterPagesAccessService[sizeof("com.sun.star.drawing.MasterPages")] = "com.sun.star.drawing.MasterPages"; 2852cdf0e10cSrcweir 2853cdf0e10cSrcweir OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException) 2854cdf0e10cSrcweir { 2855cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SdMasterPagesAccess" ) ); 2856cdf0e10cSrcweir } 2857cdf0e10cSrcweir 2858cdf0e10cSrcweir sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) 2859cdf0e10cSrcweir { 2860cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSdMasterPagesAccessService ) ); 2861cdf0e10cSrcweir } 2862cdf0e10cSrcweir 2863cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) 2864cdf0e10cSrcweir { 2865cdf0e10cSrcweir OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSdMasterPagesAccessService ) ); 2866cdf0e10cSrcweir uno::Sequence< OUString > aSeq( &aService, 1 ); 2867cdf0e10cSrcweir return aSeq; 2868cdf0e10cSrcweir } 2869cdf0e10cSrcweir 2870cdf0e10cSrcweir //============================================================================= 2871cdf0e10cSrcweir // class SdDocLinkTargets 2872cdf0e10cSrcweir //============================================================================= 2873cdf0e10cSrcweir 2874cdf0e10cSrcweir SdDocLinkTargets::SdDocLinkTargets( SdXImpressDocument& rMyModel ) throw() 2875cdf0e10cSrcweir : mpModel( &rMyModel ) 2876cdf0e10cSrcweir { 2877cdf0e10cSrcweir } 2878cdf0e10cSrcweir 2879cdf0e10cSrcweir SdDocLinkTargets::~SdDocLinkTargets() throw() 2880cdf0e10cSrcweir { 2881cdf0e10cSrcweir } 2882cdf0e10cSrcweir 2883cdf0e10cSrcweir // XComponent 2884cdf0e10cSrcweir void SAL_CALL SdDocLinkTargets::dispose( ) throw (uno::RuntimeException) 2885cdf0e10cSrcweir { 2886cdf0e10cSrcweir mpModel = NULL; 2887cdf0e10cSrcweir } 2888cdf0e10cSrcweir 2889cdf0e10cSrcweir void SAL_CALL SdDocLinkTargets::addEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2890cdf0e10cSrcweir { 2891cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2892cdf0e10cSrcweir } 2893cdf0e10cSrcweir 2894cdf0e10cSrcweir void SAL_CALL SdDocLinkTargets::removeEventListener( const uno::Reference< lang::XEventListener >& ) throw (uno::RuntimeException) 2895cdf0e10cSrcweir { 2896cdf0e10cSrcweir DBG_ERROR( "not implemented!" ); 2897cdf0e10cSrcweir } 2898cdf0e10cSrcweir 2899cdf0e10cSrcweir // XNameAccess 2900cdf0e10cSrcweir uno::Any SAL_CALL SdDocLinkTargets::getByName( const OUString& aName ) 2901cdf0e10cSrcweir throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 2902cdf0e10cSrcweir { 2903cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2904cdf0e10cSrcweir 2905cdf0e10cSrcweir if( NULL == mpModel ) 2906cdf0e10cSrcweir throw lang::DisposedException(); 2907cdf0e10cSrcweir 2908cdf0e10cSrcweir SdPage* pPage = FindPage( aName ); 2909cdf0e10cSrcweir 2910cdf0e10cSrcweir if( pPage == NULL ) 2911cdf0e10cSrcweir throw container::NoSuchElementException(); 2912cdf0e10cSrcweir 2913cdf0e10cSrcweir uno::Any aAny; 2914cdf0e10cSrcweir 2915cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( pPage->getUnoPage(), uno::UNO_QUERY ); 2916cdf0e10cSrcweir if( xProps.is() ) 2917cdf0e10cSrcweir aAny <<= xProps; 2918cdf0e10cSrcweir 2919cdf0e10cSrcweir return aAny; 2920cdf0e10cSrcweir } 2921cdf0e10cSrcweir 2922cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getElementNames() 2923cdf0e10cSrcweir throw(uno::RuntimeException) 2924cdf0e10cSrcweir { 2925cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2926cdf0e10cSrcweir 2927cdf0e10cSrcweir if( NULL == mpModel ) 2928cdf0e10cSrcweir throw lang::DisposedException(); 2929cdf0e10cSrcweir 2930cdf0e10cSrcweir SdDrawDocument* mpDoc = mpModel->GetDoc(); 2931cdf0e10cSrcweir if( mpDoc == NULL ) 2932cdf0e10cSrcweir { 2933cdf0e10cSrcweir uno::Sequence< OUString > aSeq; 2934cdf0e10cSrcweir return aSeq; 2935cdf0e10cSrcweir } 2936cdf0e10cSrcweir 2937cdf0e10cSrcweir if( mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW ) 2938cdf0e10cSrcweir { 2939cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetSdPageCount( PK_STANDARD ); 2940cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterSdPageCount( PK_STANDARD ); 2941cdf0e10cSrcweir 2942cdf0e10cSrcweir uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages ); 2943cdf0e10cSrcweir OUString* pStr = aSeq.getArray(); 2944cdf0e10cSrcweir 2945cdf0e10cSrcweir sal_uInt16 nPage; 2946cdf0e10cSrcweir // standard pages 2947cdf0e10cSrcweir for( nPage = 0; nPage < nMaxPages; nPage++ ) 2948cdf0e10cSrcweir *pStr++ = mpDoc->GetSdPage( nPage, PK_STANDARD )->GetName(); 2949cdf0e10cSrcweir 2950cdf0e10cSrcweir // master pages 2951cdf0e10cSrcweir for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) 2952cdf0e10cSrcweir *pStr++ = mpDoc->GetMasterSdPage( nPage, PK_STANDARD )->GetName(); 2953cdf0e10cSrcweir return aSeq; 2954cdf0e10cSrcweir } 2955cdf0e10cSrcweir else 2956cdf0e10cSrcweir { 2957cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); 2958cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount(); 2959cdf0e10cSrcweir 2960cdf0e10cSrcweir uno::Sequence< OUString > aSeq( nMaxPages + nMaxMasterPages ); 2961cdf0e10cSrcweir OUString* pStr = aSeq.getArray(); 2962cdf0e10cSrcweir 2963cdf0e10cSrcweir sal_uInt16 nPage; 2964cdf0e10cSrcweir // standard pages 2965cdf0e10cSrcweir for( nPage = 0; nPage < nMaxPages; nPage++ ) 2966cdf0e10cSrcweir *pStr++ = ((SdPage*)mpDoc->GetPage( nPage ))->GetName(); 2967cdf0e10cSrcweir 2968cdf0e10cSrcweir // master pages 2969cdf0e10cSrcweir for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) 2970cdf0e10cSrcweir *pStr++ = ((SdPage*)mpDoc->GetMasterPage( nPage ))->GetName(); 2971cdf0e10cSrcweir return aSeq; 2972cdf0e10cSrcweir } 2973cdf0e10cSrcweir } 2974cdf0e10cSrcweir 2975cdf0e10cSrcweir sal_Bool SAL_CALL SdDocLinkTargets::hasByName( const OUString& aName ) 2976cdf0e10cSrcweir throw(uno::RuntimeException) 2977cdf0e10cSrcweir { 2978cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2979cdf0e10cSrcweir 2980cdf0e10cSrcweir if( NULL == mpModel ) 2981cdf0e10cSrcweir throw lang::DisposedException(); 2982cdf0e10cSrcweir 2983cdf0e10cSrcweir return FindPage( aName ) != NULL; 2984cdf0e10cSrcweir } 2985cdf0e10cSrcweir 2986cdf0e10cSrcweir // container::XElementAccess 2987cdf0e10cSrcweir uno::Type SAL_CALL SdDocLinkTargets::getElementType() 2988cdf0e10cSrcweir throw(uno::RuntimeException) 2989cdf0e10cSrcweir { 2990cdf0e10cSrcweir return ITYPE(beans::XPropertySet); 2991cdf0e10cSrcweir } 2992cdf0e10cSrcweir 2993cdf0e10cSrcweir sal_Bool SAL_CALL SdDocLinkTargets::hasElements() 2994cdf0e10cSrcweir throw(uno::RuntimeException) 2995cdf0e10cSrcweir { 2996cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 2997cdf0e10cSrcweir 2998cdf0e10cSrcweir if( NULL == mpModel ) 2999cdf0e10cSrcweir throw lang::DisposedException(); 3000cdf0e10cSrcweir 3001cdf0e10cSrcweir return mpModel->GetDoc() != NULL; 3002cdf0e10cSrcweir } 3003cdf0e10cSrcweir 3004cdf0e10cSrcweir SdPage* SdDocLinkTargets::FindPage( const OUString& rName ) const throw() 3005cdf0e10cSrcweir { 3006cdf0e10cSrcweir SdDrawDocument* mpDoc = mpModel->GetDoc(); 3007cdf0e10cSrcweir if( mpDoc == NULL ) 3008cdf0e10cSrcweir return NULL; 3009cdf0e10cSrcweir 3010cdf0e10cSrcweir const sal_uInt16 nMaxPages = mpDoc->GetPageCount(); 3011cdf0e10cSrcweir const sal_uInt16 nMaxMasterPages = mpDoc->GetMasterPageCount(); 3012cdf0e10cSrcweir 3013cdf0e10cSrcweir sal_uInt16 nPage; 3014cdf0e10cSrcweir SdPage* pPage; 3015cdf0e10cSrcweir 3016cdf0e10cSrcweir const String aName( rName ); 3017cdf0e10cSrcweir 3018cdf0e10cSrcweir const bool bDraw = mpDoc->GetDocumentType() == DOCUMENT_TYPE_DRAW; 3019cdf0e10cSrcweir 3020cdf0e10cSrcweir // standard pages 3021cdf0e10cSrcweir for( nPage = 0; nPage < nMaxPages; nPage++ ) 3022cdf0e10cSrcweir { 3023cdf0e10cSrcweir pPage = (SdPage*)mpDoc->GetPage( nPage ); 3024cdf0e10cSrcweir if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) 3025cdf0e10cSrcweir return pPage; 3026cdf0e10cSrcweir } 3027cdf0e10cSrcweir 3028cdf0e10cSrcweir // master pages 3029cdf0e10cSrcweir for( nPage = 0; nPage < nMaxMasterPages; nPage++ ) 3030cdf0e10cSrcweir { 3031cdf0e10cSrcweir pPage = (SdPage*)mpDoc->GetMasterPage( nPage ); 3032cdf0e10cSrcweir if( (pPage->GetName() == aName) && (!bDraw || (pPage->GetPageKind() == PK_STANDARD)) ) 3033cdf0e10cSrcweir return pPage; 3034cdf0e10cSrcweir } 3035cdf0e10cSrcweir 3036cdf0e10cSrcweir return NULL; 3037cdf0e10cSrcweir } 3038cdf0e10cSrcweir 3039cdf0e10cSrcweir // XServiceInfo 3040cdf0e10cSrcweir OUString SAL_CALL SdDocLinkTargets::getImplementationName() 3041cdf0e10cSrcweir throw(uno::RuntimeException) 3042cdf0e10cSrcweir { 3043cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("SdDocLinkTargets") ); 3044cdf0e10cSrcweir } 3045cdf0e10cSrcweir 3046cdf0e10cSrcweir sal_Bool SAL_CALL SdDocLinkTargets::supportsService( const OUString& ServiceName ) 3047cdf0e10cSrcweir throw(uno::RuntimeException) 3048cdf0e10cSrcweir { 3049cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 3050cdf0e10cSrcweir } 3051cdf0e10cSrcweir 3052cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SdDocLinkTargets::getSupportedServiceNames() 3053cdf0e10cSrcweir throw(uno::RuntimeException) 3054cdf0e10cSrcweir { 3055cdf0e10cSrcweir const OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.LinkTargets") ); 3056cdf0e10cSrcweir uno::Sequence< OUString > aSeq( &aSN, 1 ); 3057cdf0e10cSrcweir return aSeq; 3058cdf0e10cSrcweir } 3059cdf0e10cSrcweir 3060cdf0e10cSrcweir rtl::Reference< SdXImpressDocument > SdXImpressDocument::GetModel( SdDrawDocument* pDocument ) 3061cdf0e10cSrcweir { 3062cdf0e10cSrcweir rtl::Reference< SdXImpressDocument > xRet; 3063cdf0e10cSrcweir if( pDocument ) 3064cdf0e10cSrcweir { 3065cdf0e10cSrcweir ::sd::DrawDocShell* pDocShell = pDocument->GetDocSh(); 3066cdf0e10cSrcweir if( pDocShell ) 3067cdf0e10cSrcweir { 3068cdf0e10cSrcweir uno::Reference<frame::XModel> xModel(pDocShell->GetModel()); 3069cdf0e10cSrcweir 3070cdf0e10cSrcweir xRet.set( dynamic_cast< SdXImpressDocument* >( xModel.get() ) ); 3071cdf0e10cSrcweir } 3072cdf0e10cSrcweir } 3073cdf0e10cSrcweir 3074cdf0e10cSrcweir return xRet; 3075cdf0e10cSrcweir } 3076cdf0e10cSrcweir 3077cdf0e10cSrcweir void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName ) 3078cdf0e10cSrcweir { 3079cdf0e10cSrcweir rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) ); 3080cdf0e10cSrcweir 3081cdf0e10cSrcweir if( xModel.is() ) 3082cdf0e10cSrcweir { 3083cdf0e10cSrcweir uno::Reference< uno::XInterface > xSource( static_cast<uno::XWeak*>( xModel.get() ) ); 3084cdf0e10cSrcweir ::com::sun::star::document::EventObject aEvent( xSource, rEventName ); 3085cdf0e10cSrcweir xModel->notifyEvent(aEvent ); 3086cdf0e10cSrcweir } 3087cdf0e10cSrcweir } 3088cdf0e10cSrcweir 3089cdf0e10cSrcweir void NotifyDocumentEvent( SdDrawDocument* pDocument, const rtl::OUString& rEventName, const uno::Reference< uno::XInterface >& xSource ) 3090cdf0e10cSrcweir { 3091cdf0e10cSrcweir rtl::Reference< SdXImpressDocument > xModel( SdXImpressDocument::GetModel( pDocument ) ); 3092cdf0e10cSrcweir 3093cdf0e10cSrcweir if( xModel.is() ) 3094cdf0e10cSrcweir { 3095cdf0e10cSrcweir ::com::sun::star::document::EventObject aEvent( xSource, rEventName ); 3096cdf0e10cSrcweir xModel->notifyEvent(aEvent ); 3097cdf0e10cSrcweir } 3098cdf0e10cSrcweir } 3099