1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define _SVX_USE_UNOGLOBALS_ 32*cdf0e10cSrcweir #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/lang/NoSupportException.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp> 35*cdf0e10cSrcweir #include <vos/mutex.hxx> 36*cdf0e10cSrcweir #include <vcl/svapp.hxx> 37*cdf0e10cSrcweir #include <tools/list.hxx> 38*cdf0e10cSrcweir #include <svl/itemprop.hxx> 39*cdf0e10cSrcweir #include <svtools/unoevent.hxx> 40*cdf0e10cSrcweir #include <comphelper/sequence.hxx> 41*cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 44*cdf0e10cSrcweir #include <svx/unofill.hxx> 45*cdf0e10cSrcweir #include <editeng/unonrule.hxx> 46*cdf0e10cSrcweir #include <svtools/unoimap.hxx> 47*cdf0e10cSrcweir #include <svx/fmdpage.hxx> 48*cdf0e10cSrcweir #include <svx/fmmodel.hxx> 49*cdf0e10cSrcweir #include <svx/fmpage.hxx> 50*cdf0e10cSrcweir #include <sfx2/sfx.hrc> 51*cdf0e10cSrcweir #include <svx/unoapi.hxx> 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir #include <svx/svdmodel.hxx> 54*cdf0e10cSrcweir #include "svx/globl3d.hxx" 55*cdf0e10cSrcweir #include <svx/svdtypes.hxx> 56*cdf0e10cSrcweir #include <svx/unoprov.hxx> 57*cdf0e10cSrcweir #include <svx/unopage.hxx> 58*cdf0e10cSrcweir #include <editeng/unofield.hxx> 59*cdf0e10cSrcweir #include <svx/unomod.hxx> 60*cdf0e10cSrcweir #include <svx/unomodel.hxx> 61*cdf0e10cSrcweir #include <svx/svdobj.hxx> 62*cdf0e10cSrcweir #include <svx/svdpage.hxx> 63*cdf0e10cSrcweir #include <svx/unoshape.hxx> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir extern UHashMapEntry pSdrShapeIdentifierMap[]; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir //-//////////////////////////////////////////////////////////////////// 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir using namespace ::rtl; 70*cdf0e10cSrcweir using namespace ::osl; 71*cdf0e10cSrcweir using namespace ::vos; 72*cdf0e10cSrcweir using namespace ::com::sun::star; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir //-//////////////////////////////////////////////////////////////////// 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir #define QUERYINT( xint ) \ 77*cdf0e10cSrcweir if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \ 78*cdf0e10cSrcweir aAny <<= uno::Reference< xint >(this) 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir #define ITYPE( xint ) \ 81*cdf0e10cSrcweir ::getCppuType((const uno::Reference< xint >*)0) 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir //-//////////////////////////////////////////////////////////////////// 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir #ifndef SVX_LIGHT 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir class SvxUnoDrawPagesAccess : public ::cppu::WeakImplHelper2< ::com::sun::star::drawing::XDrawPages, ::com::sun::star::lang::XServiceInfo > 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir private: 90*cdf0e10cSrcweir SvxUnoDrawingModel& mrModel; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir public: 93*cdf0e10cSrcweir SvxUnoDrawPagesAccess( SvxUnoDrawingModel& rMyModel ) throw(); 94*cdf0e10cSrcweir virtual ~SvxUnoDrawPagesAccess() throw(); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir // XDrawPages 97*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL insertNewByIndex( sal_Int32 nIndex ) throw(::com::sun::star::uno::RuntimeException); 98*cdf0e10cSrcweir virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage ) throw(::com::sun::star::uno::RuntimeException); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir // XIndexAccess 101*cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ; 102*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir // XElementAccess 105*cdf0e10cSrcweir virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException); 106*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir // XServiceInfo 109*cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 110*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 111*cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 112*cdf0e10cSrcweir }; 113*cdf0e10cSrcweir #endif 114*cdf0e10cSrcweir //-//////////////////////////////////////////////////////////////////// 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir #ifndef SVX_LIGHT 117*cdf0e10cSrcweir const SvEventDescription* ImplGetSupportedMacroItems() 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir static const SvEventDescription aMacroDescriptionsImpl[] = 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir { SFX_EVENT_MOUSEOVER_OBJECT, "OnMouseOver" }, 122*cdf0e10cSrcweir { SFX_EVENT_MOUSEOUT_OBJECT, "OnMouseOut" }, 123*cdf0e10cSrcweir { 0, NULL } 124*cdf0e10cSrcweir }; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir return aMacroDescriptionsImpl; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir #endif 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir //-//////////////////////////////////////////////////////////////////// 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir /** fills the given EventObject from the given SdrHint. 133*cdf0e10cSrcweir @returns 134*cdf0e10cSrcweir true if the SdrHint could be translated to an EventObject<br> 135*cdf0e10cSrcweir false if not 136*cdf0e10cSrcweir */ 137*cdf0e10cSrcweir sal_Bool SvxUnoDrawMSFactory::createEvent( const SdrModel* pDoc, const SdrHint* pSdrHint, ::com::sun::star::document::EventObject& aEvent ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir const SdrObject* pObj = NULL; 140*cdf0e10cSrcweir const SdrPage* pPage = NULL; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir switch( pSdrHint->GetKind() ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // case HINT_LAYERCHG: // Layerdefinition geaendert 145*cdf0e10cSrcweir // case HINT_LAYERORDERCHG: // Layerreihenfolge geaendert (Insert/Remove/ChangePos) 146*cdf0e10cSrcweir // case HINT_LAYERSETCHG: // Layerset geaendert 147*cdf0e10cSrcweir // case HINT_LAYERSETORDERCHG: // Layersetreihenfolge geaendert (Insert/Remove/ChangePos) 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir // #115423# 150*cdf0e10cSrcweir // case HINT_PAGECHG: // Page geaendert 151*cdf0e10cSrcweir // aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageModified" ) ); 152*cdf0e10cSrcweir // pPage = pSdrHint->GetPage(); 153*cdf0e10cSrcweir // break; 154*cdf0e10cSrcweir case HINT_PAGEORDERCHG: // Reihenfolge der Seiten (Zeichenseiten oder Masterpages) geaendert (Insert/Remove/ChangePos) 155*cdf0e10cSrcweir aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOrderModified" ) ); 156*cdf0e10cSrcweir pPage = pSdrHint->GetPage(); 157*cdf0e10cSrcweir break; 158*cdf0e10cSrcweir case HINT_OBJCHG: // Objekt geaendert 159*cdf0e10cSrcweir aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeModified" ) ); 160*cdf0e10cSrcweir pObj = pSdrHint->GetObject(); 161*cdf0e10cSrcweir break; 162*cdf0e10cSrcweir case HINT_OBJINSERTED: // Neues Zeichenobjekt eingefuegt 163*cdf0e10cSrcweir aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeInserted" ) ); 164*cdf0e10cSrcweir pObj = pSdrHint->GetObject(); 165*cdf0e10cSrcweir break; 166*cdf0e10cSrcweir case HINT_OBJREMOVED: // Zeichenobjekt aus Liste entfernt 167*cdf0e10cSrcweir aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeRemoved" ) ); 168*cdf0e10cSrcweir pObj = pSdrHint->GetObject(); 169*cdf0e10cSrcweir break; 170*cdf0e10cSrcweir // HINT_DEFAULTTABCHG, // Default Tabulatorweite geaendert 171*cdf0e10cSrcweir // HINT_DEFFONTHGTCHG, // Default FontHeight geaendert 172*cdf0e10cSrcweir // HINT_SWITCHTOPAGE, // #94278# UNDO/REDO at an object evtl. on another page 173*cdf0e10cSrcweir // HINT_OBJLISTCLEAR // Is called before an SdrObjList will be cleared 174*cdf0e10cSrcweir default: 175*cdf0e10cSrcweir return sal_False; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir if( pObj ) 179*cdf0e10cSrcweir aEvent.Source = const_cast<SdrObject*>(pObj)->getUnoShape(); 180*cdf0e10cSrcweir else if( pPage ) 181*cdf0e10cSrcweir aEvent.Source = const_cast<SdrPage*>(pPage)->getUnoPage(); 182*cdf0e10cSrcweir else 183*cdf0e10cSrcweir aEvent.Source = (const_cast<SdrModel*>(pDoc))->getUnoModel(); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir return sal_True; 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstance( const OUString& ServiceSpecifier ) 189*cdf0e10cSrcweir throw( uno::Exception, uno::RuntimeException ) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir const OUString aDrawingPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.") ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir if( ServiceSpecifier.compareTo( aDrawingPrefix, aDrawingPrefix.getLength() ) == 0 ) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir sal_uInt32 nType = aSdrShapeIdentifierMap.getId( ServiceSpecifier ); 196*cdf0e10cSrcweir if( nType != UHASHMAP_NOTFOUND ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir sal_uInt16 nT = (sal_uInt16)(nType & ~E3D_INVENTOR_FLAG); 199*cdf0e10cSrcweir sal_uInt32 nI = (nType & E3D_INVENTOR_FLAG)?E3dInventor:SdrInventor; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir return uno::Reference< uno::XInterface >( (drawing::XShape*) SvxDrawPage::CreateShapeByTypeAndInventor( nT, nI ) ); 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRet( createTextField( ServiceSpecifier ) ); 206*cdf0e10cSrcweir if( !xRet.is() ) 207*cdf0e10cSrcweir throw lang::ServiceNotRegisteredException(); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir return xRet; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createTextField( const ::rtl::OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir return SvxUnoTextCreateTextField( ServiceSpecifier ); 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawMSFactory::createInstanceWithArguments( const OUString&, const uno::Sequence< ::com::sun::star::uno::Any >& ) 218*cdf0e10cSrcweir throw( uno::Exception, uno::RuntimeException ) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir throw lang::NoSupportException(); 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoDrawMSFactory::getAvailableServiceNames() 224*cdf0e10cSrcweir throw( uno::RuntimeException ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir UHashMapEntry* pMap = pSdrShapeIdentifierMap; 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir sal_uInt32 nCount = 0; 229*cdf0e10cSrcweir while (pMap->aIdentifier.getLength()) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir pMap++; 232*cdf0e10cSrcweir nCount++; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir uno::Sequence< OUString > aSeq( nCount ); 236*cdf0e10cSrcweir OUString* pStrings = aSeq.getArray(); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir pMap = pSdrShapeIdentifierMap; 239*cdf0e10cSrcweir sal_uInt32 nIdx = 0; 240*cdf0e10cSrcweir while(pMap->aIdentifier.getLength()) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir pStrings[nIdx] = pMap->aIdentifier; 243*cdf0e10cSrcweir pMap++; 244*cdf0e10cSrcweir nIdx++; 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir return aSeq; 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir uno::Sequence< OUString > SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence< OUString >& rServices1, uno::Sequence< OUString >& rServices2 ) throw() 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir const sal_Int32 nLen1 = rServices1.getLength(); 253*cdf0e10cSrcweir const sal_Int32 nLen2 = rServices2.getLength(); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir uno::Sequence< OUString > aSeq( nLen1+nLen2 ); 256*cdf0e10cSrcweir OUString* pStrings = aSeq.getArray(); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir sal_Int32 nIdx; 259*cdf0e10cSrcweir OUString* pStringDst = pStrings; 260*cdf0e10cSrcweir const OUString* pStringSrc = rServices1.getArray(); 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir for( nIdx = 0; nIdx < nLen1; nIdx++ ) 263*cdf0e10cSrcweir *pStringDst++ = *pStringSrc++; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir pStringSrc = rServices2.getArray(); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir for( nIdx = 0; nIdx < nLen2; nIdx++ ) 268*cdf0e10cSrcweir *pStringDst++ = *pStringSrc++; 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir return aSeq; 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir #ifndef SVX_LIGHT 275*cdf0e10cSrcweir 276*cdf0e10cSrcweir /// 277*cdf0e10cSrcweir SvxUnoDrawingModel::SvxUnoDrawingModel( SdrModel* pDoc ) throw() 278*cdf0e10cSrcweir : mpDoc( pDoc ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir SvxUnoDrawingModel::~SvxUnoDrawingModel() throw() 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir uno::Any SAL_CALL SvxUnoDrawingModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir uno::Any aAny; 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir QUERYINT(lang::XServiceInfo); 291*cdf0e10cSrcweir else QUERYINT(lang::XMultiServiceFactory); 292*cdf0e10cSrcweir else QUERYINT(drawing::XDrawPagesSupplier); 293*cdf0e10cSrcweir else QUERYINT(com::sun::star::ucb::XAnyCompareFactory); 294*cdf0e10cSrcweir else 295*cdf0e10cSrcweir return SfxBaseModel::queryInterface( rType ); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir return aAny; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir void SAL_CALL SvxUnoDrawingModel::acquire() throw ( ) 301*cdf0e10cSrcweir { 302*cdf0e10cSrcweir SfxBaseModel::acquire(); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir void SAL_CALL SvxUnoDrawingModel::release() throw ( ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir SfxBaseModel::release(); 308*cdf0e10cSrcweir } 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir // XTypeProvider 311*cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawingModel::getTypes( ) throw(uno::RuntimeException) 312*cdf0e10cSrcweir { 313*cdf0e10cSrcweir if( maTypeSequence.getLength() == 0 ) 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir const uno::Sequence< uno::Type > aBaseTypes( SfxBaseModel::getTypes() ); 316*cdf0e10cSrcweir const sal_Int32 nBaseTypes = aBaseTypes.getLength(); 317*cdf0e10cSrcweir const uno::Type* pBaseTypes = aBaseTypes.getConstArray(); 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir const sal_Int32 nOwnTypes = 4; // !DANGER! Keep this updated! 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir maTypeSequence.realloc( nBaseTypes + nOwnTypes ); 322*cdf0e10cSrcweir uno::Type* pTypes = maTypeSequence.getArray(); 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir *pTypes++ = ITYPE(lang::XServiceInfo); 325*cdf0e10cSrcweir *pTypes++ = ITYPE(lang::XMultiServiceFactory); 326*cdf0e10cSrcweir *pTypes++ = ITYPE(drawing::XDrawPagesSupplier); 327*cdf0e10cSrcweir *pTypes++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir for( sal_Int32 nType = 0; nType < nBaseTypes; nType++ ) 330*cdf0e10cSrcweir *pTypes++ = *pBaseTypes++; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir return maTypeSequence; 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawingModel::getImplementationId( ) throw(uno::RuntimeException) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId; 339*cdf0e10cSrcweir if( aId.getLength() == 0 ) 340*cdf0e10cSrcweir { 341*cdf0e10cSrcweir aId.realloc( 16 ); 342*cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir return aId; 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir void SAL_CALL SvxUnoDrawingModel::lockControllers( ) 348*cdf0e10cSrcweir throw(uno::RuntimeException) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir if( mpDoc ) 351*cdf0e10cSrcweir mpDoc->setLock( sal_True ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir void SAL_CALL SvxUnoDrawingModel::unlockControllers( ) 355*cdf0e10cSrcweir throw(uno::RuntimeException) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir if( mpDoc && mpDoc->isLocked() ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir mpDoc->setLock( sal_False ); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoDrawingModel::hasControllersLocked( ) 364*cdf0e10cSrcweir throw(uno::RuntimeException) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir return mpDoc && mpDoc->isLocked(); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir // XDrawPagesSupplier 370*cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages() 371*cdf0e10cSrcweir throw(uno::RuntimeException) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir uno::Reference< drawing::XDrawPages > xDrawPages( mxDrawPagesAccess ); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir if( !xDrawPages.is() ) 378*cdf0e10cSrcweir mxDrawPagesAccess = xDrawPages = (drawing::XDrawPages*)new SvxUnoDrawPagesAccess(*this); 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir return xDrawPages; 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir // XMultiServiceFactory ( SvxFmMSFactory ) 384*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( const OUString& aServiceSpecifier ) 385*cdf0e10cSrcweir throw(uno::Exception, uno::RuntimeException) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) ) 390*cdf0e10cSrcweir { 391*cdf0e10cSrcweir if( !mxDashTable.is() ) 392*cdf0e10cSrcweir mxDashTable = SvxUnoDashTable_createInstance( mpDoc ); 393*cdf0e10cSrcweir return mxDashTable; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) ) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir if( !mxGradientTable.is() ) 398*cdf0e10cSrcweir mxGradientTable = SvxUnoGradientTable_createInstance( mpDoc ); 399*cdf0e10cSrcweir return mxGradientTable; 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) ) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir if( !mxHatchTable.is() ) 404*cdf0e10cSrcweir mxHatchTable = SvxUnoHatchTable_createInstance( mpDoc ); 405*cdf0e10cSrcweir return mxHatchTable; 406*cdf0e10cSrcweir } 407*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) ) 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir if( !mxBitmapTable.is() ) 410*cdf0e10cSrcweir mxBitmapTable = SvxUnoBitmapTable_createInstance( mpDoc ); 411*cdf0e10cSrcweir return mxBitmapTable; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir if( !mxTransGradientTable.is() ) 416*cdf0e10cSrcweir mxTransGradientTable = SvxUnoTransGradientTable_createInstance( mpDoc ); 417*cdf0e10cSrcweir return mxTransGradientTable; 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) ) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir if( !mxMarkerTable.is() ) 422*cdf0e10cSrcweir mxMarkerTable = SvxUnoMarkerTable_createInstance( mpDoc ); 423*cdf0e10cSrcweir return mxMarkerTable; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) ) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir return uno::Reference< uno::XInterface >( SvxCreateNumRule( mpDoc ), uno::UNO_QUERY ); 428*cdf0e10cSrcweir } 429*cdf0e10cSrcweir 430*cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapRectangleObject") ) ) 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() ); 433*cdf0e10cSrcweir } 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapCircleObject") ) ) 436*cdf0e10cSrcweir { 437*cdf0e10cSrcweir return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() ); 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir if( aServiceSpecifier.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapPolygonObject") ) ) 441*cdf0e10cSrcweir { 442*cdf0e10cSrcweir return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() ); 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir if( 0 == aServiceSpecifier.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) ) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir return (::cppu::OWeakObject * )new SvxUnoTextField( ID_EXT_DATEFIELD ); 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRet; 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir const String aType( aServiceSpecifier ); 453*cdf0e10cSrcweir if( aType.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) ) 454*cdf0e10cSrcweir { 455*cdf0e10cSrcweir SvxShape* pShape = NULL; 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir sal_uInt16 nType = OBJ_TEXT; 458*cdf0e10cSrcweir // create a shape wrapper 459*cdf0e10cSrcweir if( aType.EqualsAscii( "TitleTextShape", 26, 14 ) ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir nType = OBJ_TEXT; 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir else if( aType.EqualsAscii( "OutlinerShape", 26, 13 ) ) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir nType = OBJ_TEXT; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir else if( aType.EqualsAscii( "SubtitleShape", 26, 13 ) ) 468*cdf0e10cSrcweir { 469*cdf0e10cSrcweir nType = OBJ_TEXT; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir else if( aType.EqualsAscii( "GraphicObjectShape", 26, 18 ) ) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir nType = OBJ_GRAF; 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir else if( aType.EqualsAscii( "PageShape", 26, 9 ) ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir nType = OBJ_PAGE; 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir else if( aType.EqualsAscii( "OLE2Shape", 26, 9 ) ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir nType = OBJ_OLE2; 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir else if( aType.EqualsAscii( "ChartShape", 26, 10 ) ) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir nType = OBJ_OLE2; 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir nType = OBJ_OLE2; 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir else if( aType.EqualsAscii( "OrgChartShape", 26, 13 ) ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir nType = OBJ_OLE2; 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir else if( aType.EqualsAscii( "NotesShape", 26, 10 ) ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir nType = OBJ_TEXT; 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir else if( aType.EqualsAscii( "HandoutShape", 26, 12 ) ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir nType = OBJ_PAGE; 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir else if( aType.EqualsAscii( "FooterShape", 26, 12 ) ) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir nType = OBJ_TEXT; 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir else if( aType.EqualsAscii( "HeaderShape", 26, 12 ) ) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir nType = OBJ_TEXT; 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir else if( aType.EqualsAscii( "SlideNumberShape", 26, 17 ) ) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir nType = OBJ_TEXT; 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir else if( aType.EqualsAscii( "DateTimeShape", 26, 17 ) ) 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir nType = OBJ_TEXT; 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir else if( aType.EqualsAscii( "TableShape", 26, 10 ) ) 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir nType = OBJ_TABLE; 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir else 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir throw lang::ServiceNotRegisteredException(); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir 528*cdf0e10cSrcweir // create the API wrapper 529*cdf0e10cSrcweir pShape = CreateSvxShapeByTypeAndInventor( nType, SdrInventor ); 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir // set shape type 532*cdf0e10cSrcweir if( pShape ) 533*cdf0e10cSrcweir pShape->SetShapeType(aServiceSpecifier); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir xRet = (uno::XWeak*)pShape; 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir else 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir xRet = SvxFmMSFactory::createInstance( aServiceSpecifier ); 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir return xRet; 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getAvailableServiceNames() 546*cdf0e10cSrcweir throw(uno::RuntimeException) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir uno::Sequence< OUString > aSNS( 21 ); 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir sal_uInt16 i = 0; 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable")); 555*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable")); 556*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable")); 557*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable")); 558*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable")); 559*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable")); 560*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules")); 561*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapRectangleObject")); 562*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapCircleObject")); 563*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapPolygonObject")); 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape")); 566*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape")); 567*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape")); 568*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape")); 569*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape")); 570*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape")); 571*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape")); 572*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape")); 573*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape")); 574*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape")); 575*cdf0e10cSrcweir aSNS[i++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape")); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" ); 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir return comphelper::concatSequences( aSNS_ORG, aSNS ); 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir // lang::XServiceInfo 583*cdf0e10cSrcweir OUString SAL_CALL SvxUnoDrawingModel::getImplementationName() 584*cdf0e10cSrcweir throw(uno::RuntimeException) 585*cdf0e10cSrcweir { 586*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDrawingModel")); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir 589*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoDrawingModel::supportsService( const OUString& ServiceName ) 590*cdf0e10cSrcweir throw(uno::RuntimeException) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() ); 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getSupportedServiceNames() throw(uno::RuntimeException) 596*cdf0e10cSrcweir { 597*cdf0e10cSrcweir OUString aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument")); 598*cdf0e10cSrcweir uno::Sequence< OUString > aSeq( &aSN, 1 ); 599*cdf0e10cSrcweir return aSeq; 600*cdf0e10cSrcweir } 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir // XAnyCompareFactory 603*cdf0e10cSrcweir uno::Reference< com::sun::star::ucb::XAnyCompare > SAL_CALL SvxUnoDrawingModel::createAnyCompareByName( const OUString& ) 604*cdf0e10cSrcweir throw(uno::RuntimeException) 605*cdf0e10cSrcweir { 606*cdf0e10cSrcweir return SvxCreateNumRuleCompare(); 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir //============================================================================= 610*cdf0e10cSrcweir // class SvxUnoDrawPagesAccess 611*cdf0e10cSrcweir //============================================================================= 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir SvxUnoDrawPagesAccess::SvxUnoDrawPagesAccess( SvxUnoDrawingModel& rMyModel ) throw() 614*cdf0e10cSrcweir : mrModel(rMyModel) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir SvxUnoDrawPagesAccess::~SvxUnoDrawPagesAccess() throw() 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir // XIndexAccess 623*cdf0e10cSrcweir sal_Int32 SAL_CALL SvxUnoDrawPagesAccess::getCount() 624*cdf0e10cSrcweir throw(uno::RuntimeException) 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir sal_Int32 nCount = 0; 629*cdf0e10cSrcweir 630*cdf0e10cSrcweir if( mrModel.mpDoc ) 631*cdf0e10cSrcweir nCount = mrModel.mpDoc->GetPageCount(); 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir return( nCount ); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir uno::Any SAL_CALL SvxUnoDrawPagesAccess::getByIndex( sal_Int32 Index ) 637*cdf0e10cSrcweir throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) 638*cdf0e10cSrcweir { 639*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir uno::Any aAny; 642*cdf0e10cSrcweir 643*cdf0e10cSrcweir if( mrModel.mpDoc ) 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir if( (Index < 0) || (Index >= mrModel.mpDoc->GetPageCount() ) ) 646*cdf0e10cSrcweir throw lang::IndexOutOfBoundsException(); 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir SdrPage* pPage = mrModel.mpDoc->GetPage( (sal_uInt16)Index ); 649*cdf0e10cSrcweir if( pPage ) 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir uno::Reference< uno::XInterface > xPage( pPage->mxUnoPage ); 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir if( !xPage.is() ) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir if( PTR_CAST( FmFormModel, mrModel.mpDoc ) ) 656*cdf0e10cSrcweir xPage = (drawing::XDrawPage*)new SvxFmDrawPage( pPage ); 657*cdf0e10cSrcweir else 658*cdf0e10cSrcweir xPage = (drawing::XDrawPage*)new SvxDrawPage( pPage ); 659*cdf0e10cSrcweir 660*cdf0e10cSrcweir pPage->mxUnoPage = xPage; 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir aAny <<= xPage; 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir return aAny; 667*cdf0e10cSrcweir } 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir // XElementAccess 670*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoDrawPagesAccess::getElementType() 671*cdf0e10cSrcweir throw(uno::RuntimeException) 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir return ITYPE( drawing::XDrawPage ); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoDrawPagesAccess::hasElements() 677*cdf0e10cSrcweir throw(uno::RuntimeException) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir return getCount() > 0; 680*cdf0e10cSrcweir } 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir // XDrawPages 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir /****************************************************************************** 685*cdf0e10cSrcweir * Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die * 686*cdf0e10cSrcweir * dazugehoerige SdDrawPage zurueck. * 687*cdf0e10cSrcweir ******************************************************************************/ 688*cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL SvxUnoDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex ) 689*cdf0e10cSrcweir throw(uno::RuntimeException) 690*cdf0e10cSrcweir { 691*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > xDrawPage; 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir if( mrModel.mpDoc ) 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir SdrPage* pPage; 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir if( PTR_CAST( FmFormModel, mrModel.mpDoc ) ) 700*cdf0e10cSrcweir pPage = new FmFormPage(*(FmFormModel*)mrModel.mpDoc, NULL); 701*cdf0e10cSrcweir else 702*cdf0e10cSrcweir pPage = new SdrPage(*mrModel.mpDoc); 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir mrModel.mpDoc->InsertPage( pPage, (sal_uInt16)nIndex ); 705*cdf0e10cSrcweir xDrawPage = uno::Reference< drawing::XDrawPage >::query( pPage->getUnoPage() ); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir 708*cdf0e10cSrcweir return xDrawPage; 709*cdf0e10cSrcweir } 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir void SAL_CALL SvxUnoDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPage >& xPage ) 712*cdf0e10cSrcweir throw(uno::RuntimeException) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir sal_uInt16 nPageCount = mrModel.mpDoc->GetPageCount(); 717*cdf0e10cSrcweir if( nPageCount > 1 ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir // pPage von xPage besorgen und dann die Id (nPos )ermitteln 720*cdf0e10cSrcweir SvxDrawPage* pSvxPage = SvxDrawPage::getImplementation( xPage ); 721*cdf0e10cSrcweir if( pSvxPage ) 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir SdrPage* pPage = pSvxPage->GetSdrPage(); 724*cdf0e10cSrcweir if(pPage) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir sal_uInt16 nPage = pPage->GetPageNum(); 727*cdf0e10cSrcweir mrModel.mpDoc->DeletePage( nPage ); 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir // XServiceInfo 734*cdf0e10cSrcweir sal_Char pSvxUnoDrawPagesAccessService[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages"; 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir OUString SAL_CALL SvxUnoDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoDrawPagesAccess" ) ); 739*cdf0e10cSrcweir } 740*cdf0e10cSrcweir 741*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoDrawPagesAccess::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) 742*cdf0e10cSrcweir { 743*cdf0e10cSrcweir return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSvxUnoDrawPagesAccessService ) ); 744*cdf0e10cSrcweir } 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException) 747*cdf0e10cSrcweir { 748*cdf0e10cSrcweir OUString aService( RTL_CONSTASCII_USTRINGPARAM( pSvxUnoDrawPagesAccessService ) ); 749*cdf0e10cSrcweir uno::Sequence< OUString > aSeq( &aService, 1 ); 750*cdf0e10cSrcweir return aSeq; 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir #include <editeng/unonrule.hxx> 753*cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::container::XIndexReplace > SvxCreateNumRule( SdrModel* pModel ) throw() 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir SvxNumRule* pDefaultRule = NULL; 756*cdf0e10cSrcweir if( pModel ) 757*cdf0e10cSrcweir { 758*cdf0e10cSrcweir SvxNumBulletItem* pItem = (SvxNumBulletItem*) pModel->GetItemPool().GetSecondaryPool()->GetPoolDefaultItem(EE_PARA_NUMBULLET); 759*cdf0e10cSrcweir if( pItem ) 760*cdf0e10cSrcweir { 761*cdf0e10cSrcweir pDefaultRule = pItem->GetNumRule(); 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir } 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir if( pDefaultRule ) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir return SvxCreateNumRule( pDefaultRule ); 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir else 770*cdf0e10cSrcweir { 771*cdf0e10cSrcweir SvxNumRule aTempRule( 0, 10, false ); 772*cdf0e10cSrcweir return SvxCreateNumRule( &aTempRule ); 773*cdf0e10cSrcweir } 774*cdf0e10cSrcweir } 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir #endif 779