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