1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unomod.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #define _SVX_USE_UNOGLOBALS_
35 #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
36 #include <com/sun/star/lang/NoSupportException.hpp>
37 #include <com/sun/star/drawing/XShape.hpp>
38 #include <vos/mutex.hxx>
39 #include <vcl/svapp.hxx>
40 #include <tools/list.hxx>
41 #include <svtools/itemprop.hxx>
42 #include <svtools/unoevent.hxx>
43 #include <comphelper/sequence.hxx>
45 #include <cppuhelper/implbase2.hxx>
46 #include <unofill.hxx>
47 #include <unonrule.hxx>
48 #include <svtools/unoimap.hxx>
49 #include <svx/fmdpage.hxx>
50 #include <svx/fmmodel.hxx>
51 #include <svx/fmpage.hxx>
52 #include <sfx2/sfx.hrc>
55 #include <svx/svdmodel.hxx>
56 #include "globl3d.hxx"
57 #include <svx/svdtypes.hxx>
58 #include <svx/unoprov.hxx>
59 #include <svx/unopage.hxx>
60 #include <svx/unofield.hxx>
61 #include <svx/unomod.hxx>
62 #include <svx/unomodel.hxx>
63 #include <svx/svdobj.hxx>
64 #include <svx/svdpage.hxx>
65 #include <svx/unoshape.hxx>
67 extern UHashMapEntry pSdrShapeIdentifierMap
[];
69 //-////////////////////////////////////////////////////////////////////
71 using namespace ::rtl
;
72 using namespace ::osl
;
73 using namespace ::vos
;
74 using namespace ::com::sun::star
;
76 //-////////////////////////////////////////////////////////////////////
78 #define QUERYINT( xint ) \
79 if( rType == ::getCppuType((const uno::Reference< xint >*)0) ) \
80 aAny <<= uno::Reference< xint >(this)
82 #define ITYPE( xint ) \
83 ::getCppuType((const uno::Reference< xint >*)0)
85 //-////////////////////////////////////////////////////////////////////
89 class SvxUnoDrawPagesAccess
: public ::cppu::WeakImplHelper2
< ::com::sun::star::drawing::XDrawPages
, ::com::sun::star::lang::XServiceInfo
>
92 SvxUnoDrawingModel
& mrModel
;
95 SvxUnoDrawPagesAccess( SvxUnoDrawingModel
& rMyModel
) throw();
96 virtual ~SvxUnoDrawPagesAccess() throw();
99 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
> SAL_CALL
insertNewByIndex( sal_Int32 nIndex
) throw(::com::sun::star::uno::RuntimeException
);
100 virtual void SAL_CALL
remove( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XDrawPage
>& xPage
) throw(::com::sun::star::uno::RuntimeException
);
103 virtual sal_Int32 SAL_CALL
getCount() throw(::com::sun::star::uno::RuntimeException
) ;
104 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
);
107 virtual ::com::sun::star::uno::Type SAL_CALL
getElementType() throw(::com::sun::star::uno::RuntimeException
);
108 virtual sal_Bool SAL_CALL
hasElements() throw(::com::sun::star::uno::RuntimeException
);
111 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw(::com::sun::star::uno::RuntimeException
);
112 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw(::com::sun::star::uno::RuntimeException
);
113 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException
);
116 //-////////////////////////////////////////////////////////////////////
119 const SvEventDescription
* ImplGetSupportedMacroItems()
121 static const SvEventDescription aMacroDescriptionsImpl
[] =
123 { SFX_EVENT_MOUSEOVER_OBJECT
, "OnMouseOver" },
124 { SFX_EVENT_MOUSEOUT_OBJECT
, "OnMouseOut" },
128 return aMacroDescriptionsImpl
;
132 //-////////////////////////////////////////////////////////////////////
134 /** fills the given EventObject from the given SdrHint.
136 true if the SdrHint could be translated to an EventObject<br>
139 sal_Bool
SvxUnoDrawMSFactory::createEvent( const SdrModel
* pDoc
, const SdrHint
* pSdrHint
, ::com::sun::star::document::EventObject
& aEvent
)
141 const SdrObject
* pObj
= NULL
;
142 const SdrPage
* pPage
= NULL
;
144 switch( pSdrHint
->GetKind() )
146 // case HINT_LAYERCHG: // Layerdefinition geaendert
147 // case HINT_LAYERORDERCHG: // Layerreihenfolge geaendert (Insert/Remove/ChangePos)
148 // case HINT_LAYERSETCHG: // Layerset geaendert
149 // case HINT_LAYERSETORDERCHG: // Layersetreihenfolge geaendert (Insert/Remove/ChangePos)
152 // case HINT_PAGECHG: // Page geaendert
153 // aEvent.EventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageModified" ) );
154 // pPage = pSdrHint->GetPage();
156 case HINT_PAGEORDERCHG
: // Reihenfolge der Seiten (Zeichenseiten oder Masterpages) geaendert (Insert/Remove/ChangePos)
157 aEvent
.EventName
= OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOrderModified" ) );
158 pPage
= pSdrHint
->GetPage();
160 case HINT_OBJCHG
: // Objekt geaendert
161 aEvent
.EventName
= OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeModified" ) );
162 pObj
= pSdrHint
->GetObject();
164 case HINT_OBJINSERTED
: // Neues Zeichenobjekt eingefuegt
165 aEvent
.EventName
= OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeInserted" ) );
166 pObj
= pSdrHint
->GetObject();
168 case HINT_OBJREMOVED
: // Zeichenobjekt aus Liste entfernt
169 aEvent
.EventName
= OUString( RTL_CONSTASCII_USTRINGPARAM( "ShapeRemoved" ) );
170 pObj
= pSdrHint
->GetObject();
172 // HINT_DEFAULTTABCHG, // Default Tabulatorweite geaendert
173 // HINT_DEFFONTHGTCHG, // Default FontHeight geaendert
174 // HINT_SWITCHTOPAGE, // #94278# UNDO/REDO at an object evtl. on another page
175 // HINT_OBJLISTCLEAR // Is called before an SdrObjList will be cleared
181 aEvent
.Source
= const_cast<SdrObject
*>(pObj
)->getUnoShape();
183 aEvent
.Source
= const_cast<SdrPage
*>(pPage
)->getUnoPage();
185 aEvent
.Source
= (const_cast<SdrModel
*>(pDoc
))->getUnoModel();
190 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoDrawMSFactory::createInstance( const OUString
& ServiceSpecifier
)
191 throw( uno::Exception
, uno::RuntimeException
)
193 const OUString
aDrawingPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.") );
195 if( ServiceSpecifier
.compareTo( aDrawingPrefix
, aDrawingPrefix
.getLength() ) == 0 )
197 UINT32 nType
= aSdrShapeIdentifierMap
.getId( ServiceSpecifier
);
198 if( nType
!= UHASHMAP_NOTFOUND
)
200 UINT16 nT
= (UINT16
)(nType
& ~E3D_INVENTOR_FLAG
);
201 UINT32 nI
= (nType
& E3D_INVENTOR_FLAG
)?E3dInventor
:SdrInventor
;
203 return uno::Reference
< uno::XInterface
>( (drawing::XShape
*) SvxDrawPage::CreateShapeByTypeAndInventor( nT
, nI
) );
207 uno::Reference
< uno::XInterface
> xRet( createTextField( ServiceSpecifier
) );
209 throw lang::ServiceNotRegisteredException();
214 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoDrawMSFactory::createTextField( const ::rtl::OUString
& ServiceSpecifier
) throw(::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
216 uno::Reference
< uno::XInterface
> xRet
;
218 const OUString
aTextFieldPrexit( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.textfield.") );
220 // #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
221 // fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
222 const OUString
aTextFieldPrexit2( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField.") );
224 if( (ServiceSpecifier
.compareTo( aTextFieldPrexit
, aTextFieldPrexit
.getLength() ) == 0) ||
225 (ServiceSpecifier
.compareTo( aTextFieldPrexit2
, aTextFieldPrexit2
.getLength() ) == 0) )
227 OUString
aFieldType( ServiceSpecifier
.copy( aTextFieldPrexit
.getLength() ) );
229 sal_Int32 nId
= ID_UNKNOWN
;
231 if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("DateTime") ) )
235 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("URL") ) )
239 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageNumber") ) )
243 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("PageCount") ) )
247 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("SheetName") ) )
251 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("FileName") ) )
253 nId
= ID_EXT_FILEFIELD
;
255 else if (aFieldType
.equalsAsciiL(
256 RTL_CONSTASCII_STRINGPARAM("docinfo.Title") ) ||
257 aFieldType
.equalsAsciiL(
258 RTL_CONSTASCII_STRINGPARAM("DocInfo.Title") ) )
262 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Author") ) )
264 nId
= ID_AUTHORFIELD
;
266 else if( aFieldType
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("Measure") ) )
268 nId
= ID_MEASUREFIELD
;
271 if( nId
!= ID_UNKNOWN
)
272 xRet
= (::cppu::OWeakObject
* )new SvxUnoTextField( nId
);
278 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoDrawMSFactory::createInstanceWithArguments( const OUString
&, const uno::Sequence
< ::com::sun::star::uno::Any
>& )
279 throw( uno::Exception
, uno::RuntimeException
)
281 throw lang::NoSupportException();
284 uno::Sequence
< OUString
> SAL_CALL
SvxUnoDrawMSFactory::getAvailableServiceNames()
285 throw( uno::RuntimeException
)
287 UHashMapEntry
* pMap
= pSdrShapeIdentifierMap
;
290 while (pMap
->aIdentifier
.getLength())
296 uno::Sequence
< OUString
> aSeq( nCount
);
297 OUString
* pStrings
= aSeq
.getArray();
299 pMap
= pSdrShapeIdentifierMap
;
301 while(pMap
->aIdentifier
.getLength())
303 pStrings
[nIdx
] = pMap
->aIdentifier
;
311 uno::Sequence
< OUString
> SvxUnoDrawMSFactory::concatServiceNames( uno::Sequence
< OUString
>& rServices1
, uno::Sequence
< OUString
>& rServices2
) throw()
313 const sal_Int32 nLen1
= rServices1
.getLength();
314 const sal_Int32 nLen2
= rServices2
.getLength();
316 uno::Sequence
< OUString
> aSeq( nLen1
+nLen2
);
317 OUString
* pStrings
= aSeq
.getArray();
320 OUString
* pStringDst
= pStrings
;
321 const OUString
* pStringSrc
= rServices1
.getArray();
323 for( nIdx
= 0; nIdx
< nLen1
; nIdx
++ )
324 *pStringDst
++ = *pStringSrc
++;
326 pStringSrc
= rServices2
.getArray();
328 for( nIdx
= 0; nIdx
< nLen2
; nIdx
++ )
329 *pStringDst
++ = *pStringSrc
++;
338 SvxUnoDrawingModel::SvxUnoDrawingModel( SdrModel
* pDoc
) throw()
343 SvxUnoDrawingModel::~SvxUnoDrawingModel() throw()
347 uno::Any SAL_CALL
SvxUnoDrawingModel::queryInterface( const uno::Type
& rType
) throw(uno::RuntimeException
)
351 QUERYINT(lang::XServiceInfo
);
352 else QUERYINT(lang::XMultiServiceFactory
);
353 else QUERYINT(drawing::XDrawPagesSupplier
);
354 else QUERYINT(com::sun::star::ucb::XAnyCompareFactory
);
356 return SfxBaseModel::queryInterface( rType
);
361 void SAL_CALL
SvxUnoDrawingModel::acquire() throw ( )
363 SfxBaseModel::acquire();
366 void SAL_CALL
SvxUnoDrawingModel::release() throw ( )
368 SfxBaseModel::release();
372 uno::Sequence
< uno::Type
> SAL_CALL
SvxUnoDrawingModel::getTypes( ) throw(uno::RuntimeException
)
374 if( maTypeSequence
.getLength() == 0 )
376 const uno::Sequence
< uno::Type
> aBaseTypes( SfxBaseModel::getTypes() );
377 const sal_Int32 nBaseTypes
= aBaseTypes
.getLength();
378 const uno::Type
* pBaseTypes
= aBaseTypes
.getConstArray();
380 const sal_Int32 nOwnTypes
= 4; // !DANGER! Keep this updated!
382 maTypeSequence
.realloc( nBaseTypes
+ nOwnTypes
);
383 uno::Type
* pTypes
= maTypeSequence
.getArray();
385 *pTypes
++ = ITYPE(lang::XServiceInfo
);
386 *pTypes
++ = ITYPE(lang::XMultiServiceFactory
);
387 *pTypes
++ = ITYPE(drawing::XDrawPagesSupplier
);
388 *pTypes
++ = ITYPE(com::sun::star::ucb::XAnyCompareFactory
);
390 for( sal_Int32 nType
= 0; nType
< nBaseTypes
; nType
++ )
391 *pTypes
++ = *pBaseTypes
++;
394 return maTypeSequence
;
397 uno::Sequence
< sal_Int8
> SAL_CALL
SvxUnoDrawingModel::getImplementationId( ) throw(uno::RuntimeException
)
399 static uno::Sequence
< sal_Int8
> aId
;
400 if( aId
.getLength() == 0 )
403 rtl_createUuid( (sal_uInt8
*)aId
.getArray(), 0, sal_True
);
408 void SAL_CALL
SvxUnoDrawingModel::lockControllers( )
409 throw(uno::RuntimeException
)
412 mpDoc
->setLock( sal_True
);
415 void SAL_CALL
SvxUnoDrawingModel::unlockControllers( )
416 throw(uno::RuntimeException
)
418 if( mpDoc
&& mpDoc
->isLocked() )
420 mpDoc
->setLock( sal_False
);
424 sal_Bool SAL_CALL
SvxUnoDrawingModel::hasControllersLocked( )
425 throw(uno::RuntimeException
)
427 return mpDoc
&& mpDoc
->isLocked();
430 // XDrawPagesSupplier
431 uno::Reference
< drawing::XDrawPages
> SAL_CALL
SvxUnoDrawingModel::getDrawPages()
432 throw(uno::RuntimeException
)
434 OGuard
aGuard( Application::GetSolarMutex() );
436 uno::Reference
< drawing::XDrawPages
> xDrawPages( mxDrawPagesAccess
);
438 if( !xDrawPages
.is() )
439 mxDrawPagesAccess
= xDrawPages
= (drawing::XDrawPages
*)new SvxUnoDrawPagesAccess(*this);
444 // XMultiServiceFactory ( SvxFmMSFactory )
445 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoDrawingModel::createInstance( const OUString
& aServiceSpecifier
)
446 throw(uno::Exception
, uno::RuntimeException
)
448 OGuard
aGuard( Application::GetSolarMutex() );
450 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.DashTable") ) )
452 if( !mxDashTable
.is() )
453 mxDashTable
= SvxUnoDashTable_createInstance( mpDoc
);
456 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.GradientTable") ) )
458 if( !mxGradientTable
.is() )
459 mxGradientTable
= SvxUnoGradientTable_createInstance( mpDoc
);
460 return mxGradientTable
;
462 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.HatchTable") ) )
464 if( !mxHatchTable
.is() )
465 mxHatchTable
= SvxUnoHatchTable_createInstance( mpDoc
);
468 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.BitmapTable") ) )
470 if( !mxBitmapTable
.is() )
471 mxBitmapTable
= SvxUnoBitmapTable_createInstance( mpDoc
);
472 return mxBitmapTable
;
474 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) )
476 if( !mxTransGradientTable
.is() )
477 mxTransGradientTable
= SvxUnoTransGradientTable_createInstance( mpDoc
);
478 return mxTransGradientTable
;
480 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.MarkerTable") ) )
482 if( !mxMarkerTable
.is() )
483 mxMarkerTable
= SvxUnoMarkerTable_createInstance( mpDoc
);
484 return mxMarkerTable
;
486 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.NumberingRules" ) ) )
488 return uno::Reference
< uno::XInterface
>( SvxCreateNumRule( mpDoc
), uno::UNO_QUERY
);
491 if( aServiceSpecifier
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapRectangleObject") ) )
493 return SvUnoImageMapRectangleObject_createInstance( ImplGetSupportedMacroItems() );
496 if( aServiceSpecifier
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapCircleObject") ) )
498 return SvUnoImageMapCircleObject_createInstance( ImplGetSupportedMacroItems() );
501 if( aServiceSpecifier
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.image.ImageMapPolygonObject") ) )
503 return SvUnoImageMapPolygonObject_createInstance( ImplGetSupportedMacroItems() );
506 if( 0 == aServiceSpecifier
.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextField.DateTime") ) )
508 return (::cppu::OWeakObject
* )new SvxUnoTextField( ID_EXT_DATEFIELD
);
511 uno::Reference
< uno::XInterface
> xRet
;
513 const String
aType( aServiceSpecifier
);
514 if( aType
.EqualsAscii( "com.sun.star.presentation.", 0, 26 ) )
516 SvxShape
* pShape
= NULL
;
518 sal_uInt16 nType
= OBJ_TEXT
;
519 // create a shape wrapper
520 if( aType
.EqualsAscii( "TitleTextShape", 26, 14 ) )
524 else if( aType
.EqualsAscii( "OutlinerShape", 26, 13 ) )
528 else if( aType
.EqualsAscii( "SubtitleShape", 26, 13 ) )
532 else if( aType
.EqualsAscii( "GraphicObjectShape", 26, 18 ) )
536 else if( aType
.EqualsAscii( "PageShape", 26, 9 ) )
540 else if( aType
.EqualsAscii( "OLE2Shape", 26, 9 ) )
544 else if( aType
.EqualsAscii( "ChartShape", 26, 10 ) )
548 else if( aType
.EqualsAscii( "TableShape", 26, 10 ) )
552 else if( aType
.EqualsAscii( "OrgChartShape", 26, 13 ) )
556 else if( aType
.EqualsAscii( "NotesShape", 26, 10 ) )
560 else if( aType
.EqualsAscii( "HandoutShape", 26, 12 ) )
564 else if( aType
.EqualsAscii( "FooterShape", 26, 12 ) )
568 else if( aType
.EqualsAscii( "HeaderShape", 26, 12 ) )
572 else if( aType
.EqualsAscii( "SlideNumberShape", 26, 17 ) )
576 else if( aType
.EqualsAscii( "DateTimeShape", 26, 17 ) )
580 else if( aType
.EqualsAscii( "TableShape", 26, 10 ) )
586 throw lang::ServiceNotRegisteredException();
589 // create the API wrapper
590 pShape
= CreateSvxShapeByTypeAndInventor( nType
, SdrInventor
);
594 pShape
->SetShapeType(aServiceSpecifier
);
596 xRet
= (uno::XWeak
*)pShape
;
600 xRet
= SvxFmMSFactory::createInstance( aServiceSpecifier
);
606 uno::Sequence
< OUString
> SAL_CALL
SvxUnoDrawingModel::getAvailableServiceNames()
607 throw(uno::RuntimeException
)
609 const uno::Sequence
< OUString
> aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
611 uno::Sequence
< OUString
> aSNS( 21 );
615 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable"));
616 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable"));
617 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable"));
618 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable"));
619 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable"));
620 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable"));
621 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.NumberingRules"));
622 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapRectangleObject"));
623 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapCircleObject"));
624 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.image.ImageMapPolygonObject"));
626 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape"));
627 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape"));
628 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape"));
629 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape"));
630 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape"));
631 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PageShape"));
632 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OLE2Shape"));
633 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TableShape"));
634 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OrgChartShape"));
635 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape"));
636 aSNS
[i
++] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.HandoutShape"));
638 DBG_ASSERT( i
== aSNS
.getLength(), "Sequence overrun!" );
640 return comphelper::concatSequences( aSNS_ORG
, aSNS
);
643 // lang::XServiceInfo
644 OUString SAL_CALL
SvxUnoDrawingModel::getImplementationName()
645 throw(uno::RuntimeException
)
647 return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDrawingModel"));
650 sal_Bool SAL_CALL
SvxUnoDrawingModel::supportsService( const OUString
& ServiceName
)
651 throw(uno::RuntimeException
)
653 return SvxServiceInfoHelper::supportsService( ServiceName
, getSupportedServiceNames() );
656 uno::Sequence
< OUString
> SAL_CALL
SvxUnoDrawingModel::getSupportedServiceNames() throw(uno::RuntimeException
)
658 OUString
aSN( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument"));
659 uno::Sequence
< OUString
> aSeq( &aSN
, 1 );
663 // XAnyCompareFactory
664 uno::Reference
< com::sun::star::ucb::XAnyCompare
> SAL_CALL
SvxUnoDrawingModel::createAnyCompareByName( const OUString
& )
665 throw(uno::RuntimeException
)
667 return SvxCreateNumRuleCompare();
670 //=============================================================================
671 // class SvxUnoDrawPagesAccess
672 //=============================================================================
674 SvxUnoDrawPagesAccess::SvxUnoDrawPagesAccess( SvxUnoDrawingModel
& rMyModel
) throw()
679 SvxUnoDrawPagesAccess::~SvxUnoDrawPagesAccess() throw()
684 sal_Int32 SAL_CALL
SvxUnoDrawPagesAccess::getCount()
685 throw(uno::RuntimeException
)
687 OGuard
aGuard( Application::GetSolarMutex() );
689 sal_Int32 nCount
= 0;
692 nCount
= mrModel
.mpDoc
->GetPageCount();
697 uno::Any SAL_CALL
SvxUnoDrawPagesAccess::getByIndex( sal_Int32 Index
)
698 throw(lang::IndexOutOfBoundsException
, lang::WrappedTargetException
, uno::RuntimeException
)
700 OGuard
aGuard( Application::GetSolarMutex() );
706 if( (Index
< 0) || (Index
>= mrModel
.mpDoc
->GetPageCount() ) )
707 throw lang::IndexOutOfBoundsException();
709 SdrPage
* pPage
= mrModel
.mpDoc
->GetPage( (sal_uInt16
)Index
);
712 uno::Reference
< uno::XInterface
> xPage( pPage
->mxUnoPage
);
716 if( PTR_CAST( FmFormModel
, mrModel
.mpDoc
) )
717 xPage
= (drawing::XDrawPage
*)new SvxFmDrawPage( pPage
);
719 xPage
= (drawing::XDrawPage
*)new SvxDrawPage( pPage
);
721 pPage
->mxUnoPage
= xPage
;
731 uno::Type SAL_CALL
SvxUnoDrawPagesAccess::getElementType()
732 throw(uno::RuntimeException
)
734 return ITYPE( drawing::XDrawPage
);
737 sal_Bool SAL_CALL
SvxUnoDrawPagesAccess::hasElements()
738 throw(uno::RuntimeException
)
740 return getCount() > 0;
745 /******************************************************************************
746 * Erzeugt eine neue Seite mit Model an der angegebennen Position und gibt die *
747 * dazugehoerige SdDrawPage zurueck. *
748 ******************************************************************************/
749 uno::Reference
< drawing::XDrawPage
> SAL_CALL
SvxUnoDrawPagesAccess::insertNewByIndex( sal_Int32 nIndex
)
750 throw(uno::RuntimeException
)
752 OGuard
aGuard( Application::GetSolarMutex() );
754 uno::Reference
< drawing::XDrawPage
> xDrawPage
;
760 if( PTR_CAST( FmFormModel
, mrModel
.mpDoc
) )
761 pPage
= new FmFormPage(*(FmFormModel
*)mrModel
.mpDoc
, NULL
);
763 pPage
= new SdrPage(*mrModel
.mpDoc
);
765 mrModel
.mpDoc
->InsertPage( pPage
, (sal_uInt16
)nIndex
);
766 xDrawPage
= uno::Reference
< drawing::XDrawPage
>::query( pPage
->getUnoPage() );
772 void SAL_CALL
SvxUnoDrawPagesAccess::remove( const uno::Reference
< drawing::XDrawPage
>& xPage
)
773 throw(uno::RuntimeException
)
775 OGuard
aGuard( Application::GetSolarMutex() );
777 sal_uInt16 nPageCount
= mrModel
.mpDoc
->GetPageCount();
780 // pPage von xPage besorgen und dann die Id (nPos )ermitteln
781 SvxDrawPage
* pSvxPage
= SvxDrawPage::getImplementation( xPage
);
784 SdrPage
* pPage
= pSvxPage
->GetSdrPage();
787 sal_uInt16 nPage
= pPage
->GetPageNum();
788 mrModel
.mpDoc
->DeletePage( nPage
);
795 sal_Char pSvxUnoDrawPagesAccessService
[sizeof("com.sun.star.drawing.DrawPages")] = "com.sun.star.drawing.DrawPages";
797 OUString SAL_CALL
SvxUnoDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException
)
799 return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoDrawPagesAccess" ) );
802 sal_Bool SAL_CALL
SvxUnoDrawPagesAccess::supportsService( const OUString
& ServiceName
) throw(uno::RuntimeException
)
804 return ServiceName
.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( pSvxUnoDrawPagesAccessService
) );
807 uno::Sequence
< OUString
> SAL_CALL
SvxUnoDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException
)
809 OUString
aService( RTL_CONSTASCII_USTRINGPARAM( pSvxUnoDrawPagesAccessService
) );
810 uno::Sequence
< OUString
> aSeq( &aService
, 1 );