1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <vcl/svapp.hxx>
22 #include <vcl/window.hxx>
23 #include <vcl/wall.hxx>
24 #include <osl/mutex.hxx>
25 #include <toolkit/controls/dialogcontrol.hxx>
26 #include <toolkit/helper/property.hxx>
27 #include <toolkit/helper/unopropertyarrayhelper.hxx>
28 #include <toolkit/controls/stdtabcontroller.hxx>
29 #include <com/sun/star/awt/PosSize.hpp>
30 #include <com/sun/star/awt/WindowAttribute.hpp>
31 #include <com/sun/star/resource/XStringResourceResolver.hpp>
32 #include <com/sun/star/graphic/XGraphicProvider.hpp>
33 #include <cppuhelper/typeprovider.hxx>
34 #include <tools/debug.hxx>
35 #include <tools/diagnose_ex.h>
36 #include <comphelper/sequence.hxx>
37 #include <vcl/outdev.hxx>
39 #include <toolkit/helper/vclunohelper.hxx>
40 #include <unotools/ucbstreamhelper.hxx>
41 #include <vcl/graph.hxx>
42 #include <vcl/image.hxx>
44 #include <boost/unordered_map.hpp>
45 #include <cppuhelper/implbase1.hxx>
48 #include "osl/file.hxx"
50 #include <vcl/tabctrl.hxx>
51 #include <toolkit/awt/vclxwindows.hxx>
52 #include "toolkit/controls/unocontrols.hxx"
54 using namespace ::com::sun::star
;
55 using namespace ::com::sun::star::uno
;
56 using namespace ::com::sun::star::awt
;
57 using namespace ::com::sun::star::lang
;
58 using namespace ::com::sun::star::container
;
59 using namespace ::com::sun::star::beans
;
60 using namespace ::com::sun::star::util
;
62 #define PROPERTY_DIALOGSOURCEURL OUString( "DialogSourceURL" )
63 #define PROPERTY_IMAGEURL OUString( "ImageURL" )
64 #define PROPERTY_GRAPHIC OUString( "Graphic" )
67 // we probably will need both a hash of control models and hash of controls
68 // => use some template magic
70 typedef ::cppu::WeakImplHelper1
< container::XNameContainer
> SimpleNameContainer_BASE
;
72 template< typename T
>
73 class SimpleNamedThingContainer
: public SimpleNameContainer_BASE
75 typedef boost::unordered_map
< OUString
, Reference
< T
>, OUStringHash
,
76 ::std::equal_to
< OUString
> > NamedThingsHash
;
77 NamedThingsHash things
;
78 ::osl::Mutex m_aMutex
;
80 // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
81 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
83 ::osl::MutexGuard
aGuard( m_aMutex
);
84 if ( !hasByName( aName
) )
85 throw NoSuchElementException();
86 Reference
< T
> xElement
;
87 if ( ! ( aElement
>>= xElement
) )
88 throw IllegalArgumentException();
89 things
[ aName
] = xElement
;
91 virtual Any SAL_CALL
getByName( const OUString
& aName
) throw(NoSuchElementException
, WrappedTargetException
, RuntimeException
)
93 ::osl::MutexGuard
aGuard( m_aMutex
);
94 if ( !hasByName( aName
) )
95 throw NoSuchElementException();
96 return uno::makeAny( things
[ aName
] );
98 virtual Sequence
< OUString
> SAL_CALL
getElementNames( ) throw(RuntimeException
)
100 ::osl::MutexGuard
aGuard( m_aMutex
);
101 Sequence
< OUString
> aResult( things
.size() );
102 typename
NamedThingsHash::iterator it
= things
.begin();
103 typename
NamedThingsHash::iterator it_end
= things
.end();
104 OUString
* pName
= aResult
.getArray();
105 for (; it
!= it_end
; ++it
, ++pName
)
109 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw(RuntimeException
)
111 ::osl::MutexGuard
aGuard( m_aMutex
);
112 return ( things
.find( aName
) != things
.end() );
114 virtual void SAL_CALL
insertByName( const OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
116 ::osl::MutexGuard
aGuard( m_aMutex
);
117 if ( hasByName( aName
) )
118 throw ElementExistException();
119 Reference
< T
> xElement
;
120 if ( ! ( aElement
>>= xElement
) )
121 throw IllegalArgumentException();
122 things
[ aName
] = xElement
;
124 virtual void SAL_CALL
removeByName( const OUString
& aName
) throw(NoSuchElementException
, WrappedTargetException
, RuntimeException
)
126 ::osl::MutexGuard
aGuard( m_aMutex
);
127 if ( !hasByName( aName
) )
128 throw NoSuchElementException();
129 things
.erase( things
.find( aName
) );
131 virtual Type SAL_CALL
getElementType( ) throw (RuntimeException
)
133 return T::static_type( NULL
);
135 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (RuntimeException
)
137 ::osl::MutexGuard
aGuard( m_aMutex
);
138 return ( things
.size() > 0 );
143 OUString
getPhysicalLocation( const ::com::sun::star::uno::Any
& rbase
, const ::com::sun::star::uno::Any
& rUrl
);
145 // ----------------------------------------------------
146 // class UnoControlDialogModel
147 // ----------------------------------------------------
148 UnoControlDialogModel::UnoControlDialogModel( const Reference
< XComponentContext
>& rxContext
)
149 :ControlModelContainerBase( rxContext
)
151 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
152 // ImplRegisterProperty( BASEPROPERTY_BORDER );
153 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
154 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
155 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
156 // ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
157 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
158 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
159 ImplRegisterProperty( BASEPROPERTY_TITLE
);
160 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
161 ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT
);
162 ImplRegisterProperty( BASEPROPERTY_DECORATION
);
163 ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL
);
164 ImplRegisterProperty( BASEPROPERTY_GRAPHIC
);
165 ImplRegisterProperty( BASEPROPERTY_IMAGEURL
);
166 ImplRegisterProperty( BASEPROPERTY_HSCROLL
);
167 ImplRegisterProperty( BASEPROPERTY_VSCROLL
);
168 ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH
);
169 ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT
);
170 ImplRegisterProperty( BASEPROPERTY_SCROLLTOP
);
171 ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT
);
174 aBool
<<= (sal_Bool
) sal_True
;
175 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
176 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
177 // #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
178 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
179 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
182 UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel
& rModel
)
183 : ControlModelContainerBase( rModel
)
185 // need to clone BASEPROPERTY_USERFORMCONTAINEES too
186 Reference
< XNameContainer
> xSrcNameCont( const_cast< UnoControlDialogModel
& >(rModel
).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES
) ), UNO_QUERY
);
187 Reference
<XNameContainer
> xNameCont( new SimpleNamedThingContainer
< XControlModel
>() );
189 uno::Sequence
< OUString
> sNames
= xSrcNameCont
->getElementNames();
190 OUString
* pName
= sNames
.getArray();
191 OUString
* pNamesEnd
= pName
+ sNames
.getLength();
192 for ( ; pName
!= pNamesEnd
; ++pName
)
194 if ( xSrcNameCont
->hasByName( *pName
) )
195 xNameCont
->insertByName( *pName
, xSrcNameCont
->getByName( *pName
) );
197 setFastPropertyValue_NoBroadcast( BASEPROPERTY_USERFORMCONTAINEES
, makeAny( xNameCont
) );
200 UnoControlDialogModel::~UnoControlDialogModel()
204 UnoControlModel
* UnoControlDialogModel::Clone() const
206 // clone the container itself
207 UnoControlDialogModel
* pClone
= new UnoControlDialogModel( *this );
215 OUString
UnoControlDialogModel::getServiceName( ) throw(RuntimeException
)
217 return OUString::createFromAscii( szServiceName_UnoControlDialogModel
);
220 Any
UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
226 case BASEPROPERTY_DEFAULTCONTROL
:
227 aAny
<<= OUString::createFromAscii( szServiceName_UnoControlDialog
);
229 case BASEPROPERTY_SCROLLWIDTH
:
230 case BASEPROPERTY_SCROLLHEIGHT
:
231 case BASEPROPERTY_SCROLLTOP
:
232 case BASEPROPERTY_SCROLLLEFT
:
233 aAny
<<= sal_Int32(0);
236 aAny
= UnoControlModel::ImplGetDefaultValue( nPropId
);
242 ::cppu::IPropertyArrayHelper
& UnoControlDialogModel::getInfoHelper()
244 static UnoPropertyArrayHelper
* pHelper
= NULL
;
247 Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
248 pHelper
= new UnoPropertyArrayHelper( aIDs
);
254 Reference
< XPropertySetInfo
> UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException
)
256 static Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
260 void SAL_CALL
UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
) throw (::com::sun::star::uno::Exception
)
262 ControlModelContainerBase::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
265 if ( nHandle
== BASEPROPERTY_IMAGEURL
&& ImplHasProperty( BASEPROPERTY_GRAPHIC
) )
268 OSL_VERIFY( rValue
>>= sImageURL
);
269 setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC
), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj
, sImageURL
) ) );
272 catch( const ::com::sun::star::uno::Exception
& )
274 OSL_ENSURE( sal_False
, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting ImageURL properties!" );
277 // ============================================================================
278 // = class UnoDialogControl
279 // ============================================================================
281 UnoDialogControl::UnoDialogControl( const uno::Reference
< uno::XComponentContext
>& rxContext
)
282 :UnoDialogControl_Base( rxContext
)
283 ,maTopWindowListeners( *this )
284 ,mbWindowListener(false)
286 maComponentInfos
.nWidth
= 300;
287 maComponentInfos
.nHeight
= 450;
290 UnoDialogControl::~UnoDialogControl()
294 OUString
UnoDialogControl::GetComponentServiceName()
297 sal_Bool
bDecoration( sal_True
);
298 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
300 return OUString("Dialog");
302 return OUString("TabPage");
305 void UnoDialogControl::dispose() throw(RuntimeException
)
307 SolarMutexGuard aGuard
;
310 aEvt
.Source
= static_cast< ::cppu::OWeakObject
* >( this );
311 maTopWindowListeners
.disposeAndClear( aEvt
);
312 ControlContainerBase::dispose();
315 void SAL_CALL
UnoDialogControl::disposing(
316 const EventObject
& Source
)
317 throw(RuntimeException
)
319 ControlContainerBase::disposing( Source
);
322 sal_Bool
UnoDialogControl::setModel( const Reference
< XControlModel
>& rxModel
) throw(RuntimeException
)
324 // #Can we move all the Resource stuff to the ControlContainerBase ?
325 SolarMutexGuard aGuard
;
326 sal_Bool bRet
= ControlContainerBase::setModel( rxModel
);
327 ImplStartListingForResourceEvents();
331 void UnoDialogControl::createPeer( const Reference
< XToolkit
> & rxToolkit
, const Reference
< XWindowPeer
> & rParentPeer
) throw(RuntimeException
)
333 SolarMutexGuard aGuard
;
335 UnoControlContainer::createPeer( rxToolkit
, rParentPeer
);
337 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
340 xTW
->setMenuBar( mxMenuBar
);
342 if ( !mbWindowListener
)
344 Reference
< XWindowListener
> xWL( static_cast< cppu::OWeakObject
*>( this ), UNO_QUERY
);
345 addWindowListener( xWL
);
346 mbWindowListener
= true;
349 if ( maTopWindowListeners
.getLength() )
350 xTW
->addTopWindowListener( &maTopWindowListeners
);
351 // there must be a better way than doing this, we can't
352 // process the scrolltop & scrollleft in XDialog because
353 // the children haven't been added when those props are applied
354 ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP
), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP
) ) );
355 ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT
), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT
) ) );
360 void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor
& rDesc
)
362 UnoControlContainer::PrepareWindowDescriptor( rDesc
);
363 sal_Bool
bDecoration( sal_True
);
364 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
367 // Now we have to manipulate the WindowDescriptor
368 rDesc
.WindowAttributes
= rDesc
.WindowAttributes
| ::com::sun::star::awt::WindowAttribute::NODECORATION
;
371 // We have to set the graphic property before the peer
372 // will be created. Otherwise the properties will be copied
373 // into the peer via propertiesChangeEvents. As the order of
374 // can lead to overwrites we have to set the graphic property
375 // before the propertiesChangeEvents are sent!
377 Reference
< graphic::XGraphic
> xGraphic
;
378 if (( ImplGetPropertyValue( PROPERTY_IMAGEURL
) >>= aImageURL
) &&
379 ( !aImageURL
.isEmpty() ))
381 OUString absoluteUrl
= aImageURL
;
382 if ( !aImageURL
.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX
) )
383 absoluteUrl
= getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL
),
384 uno::makeAny( aImageURL
) );
386 xGraphic
= ImageHelper::getGraphicFromURL_nothrow( absoluteUrl
);
387 ImplSetPropertyValue( PROPERTY_GRAPHIC
, uno::makeAny( xGraphic
), sal_True
);
391 void UnoDialogControl::addTopWindowListener( const Reference
< XTopWindowListener
>& rxListener
) throw (RuntimeException
)
393 maTopWindowListeners
.addInterface( rxListener
);
394 if( getPeer().is() && maTopWindowListeners
.getLength() == 1 )
396 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
397 xTW
->addTopWindowListener( &maTopWindowListeners
);
401 void UnoDialogControl::removeTopWindowListener( const Reference
< XTopWindowListener
>& rxListener
) throw (RuntimeException
)
403 if( getPeer().is() && maTopWindowListeners
.getLength() == 1 )
405 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
406 xTW
->removeTopWindowListener( &maTopWindowListeners
);
408 maTopWindowListeners
.removeInterface( rxListener
);
411 void UnoDialogControl::toFront( ) throw (RuntimeException
)
413 SolarMutexGuard aGuard
;
414 if ( getPeer().is() )
416 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
422 void UnoDialogControl::toBack( ) throw (RuntimeException
)
424 SolarMutexGuard aGuard
;
425 if ( getPeer().is() )
427 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
433 void UnoDialogControl::setMenuBar( const Reference
< XMenuBar
>& rxMenuBar
) throw (RuntimeException
)
435 SolarMutexGuard aGuard
;
436 mxMenuBar
= rxMenuBar
;
437 if ( getPeer().is() )
439 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
441 xTW
->setMenuBar( mxMenuBar
);
444 static ::Size
ImplMapPixelToAppFont( OutputDevice
* pOutDev
, const ::Size
& aSize
)
446 ::Size aTmp
= pOutDev
->PixelToLogic( aSize
, MAP_APPFONT
);
449 // ::com::sun::star::awt::XWindowListener
450 void SAL_CALL
UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent
& e
)
451 throw (::com::sun::star::uno::RuntimeException
)
453 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
454 DBG_ASSERT( pOutDev
, "Missing Default Device!" );
455 if ( pOutDev
&& !mbSizeModified
)
457 // Currentley we are simply using MAP_APPFONT
458 ::Size
aAppFontSize( e
.Width
, e
.Height
);
460 Reference
< XControl
> xDialogControl( *this, UNO_QUERY_THROW
);
461 Reference
< XDevice
> xDialogDevice( xDialogControl
->getPeer(), UNO_QUERY
);
462 OSL_ENSURE( xDialogDevice
.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
464 // #i87592 In design mode the drawing layer works with sizes with decoration.
465 // Therefore we have to substract them before writing back to the properties (model).
466 if ( xDialogDevice
.is() && mbDesignMode
)
468 DeviceInfo
aDeviceInfo( xDialogDevice
->getInfo() );
469 aAppFontSize
.Width() -= aDeviceInfo
.LeftInset
+ aDeviceInfo
.RightInset
;
470 aAppFontSize
.Height() -= aDeviceInfo
.TopInset
+ aDeviceInfo
.BottomInset
;
473 aAppFontSize
= ImplMapPixelToAppFont( pOutDev
, aAppFontSize
);
475 // Remember that changes have been done by listener. No need to
476 // update the position because of property change event.
477 mbSizeModified
= true;
478 Sequence
< OUString
> aProps( 2 );
479 Sequence
< Any
> aValues( 2 );
480 // Properties in a sequence must be sorted!
481 aProps
[0] = OUString( "Height" );
482 aProps
[1] = OUString( "Width" );
483 aValues
[0] <<= aAppFontSize
.Height();
484 aValues
[1] <<= aAppFontSize
.Width();
486 ImplSetPropertyValues( aProps
, aValues
, true );
487 mbSizeModified
= false;
491 void SAL_CALL
UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent
& e
)
492 throw (::com::sun::star::uno::RuntimeException
)
494 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
495 DBG_ASSERT( pOutDev
, "Missing Default Device!" );
496 if ( pOutDev
&& !mbPosModified
)
498 // Currentley we are simply using MAP_APPFONT
500 ::Size
aTmp( e
.X
, e
.Y
);
501 aTmp
= ImplMapPixelToAppFont( pOutDev
, aTmp
);
503 // Remember that changes have been done by listener. No need to
504 // update the position because of property change event.
505 mbPosModified
= true;
506 Sequence
< OUString
> aProps( 2 );
507 Sequence
< Any
> aValues( 2 );
508 aProps
[0] = OUString( "PositionX" );
509 aProps
[1] = OUString( "PositionY" );
510 aValues
[0] <<= aTmp
.Width();
511 aValues
[1] <<= aTmp
.Height();
513 ImplSetPropertyValues( aProps
, aValues
, true );
514 mbPosModified
= false;
518 void SAL_CALL
UnoDialogControl::windowShown( const EventObject
& e
) throw (RuntimeException
)
523 void SAL_CALL
UnoDialogControl::windowHidden( const EventObject
& e
) throw (RuntimeException
)
528 void SAL_CALL
UnoDialogControl::endDialog( ::sal_Int32 i_result
) throw (RuntimeException
)
530 Reference
< XDialog2
> xPeerDialog( getPeer(), UNO_QUERY
);
531 if ( xPeerDialog
.is() )
532 xPeerDialog
->endDialog( i_result
);
535 void SAL_CALL
UnoDialogControl::setHelpId( const OUString
& i_id
) throw (RuntimeException
)
537 Reference
< XDialog2
> xPeerDialog( getPeer(), UNO_QUERY
);
538 if ( xPeerDialog
.is() )
539 xPeerDialog
->setHelpId( i_id
);
542 void UnoDialogControl::setTitle( const OUString
& Title
) throw(RuntimeException
)
544 SolarMutexGuard aGuard
;
547 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE
), aAny
, sal_True
);
550 OUString
UnoDialogControl::getTitle() throw(RuntimeException
)
552 SolarMutexGuard aGuard
;
553 return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE
);
556 sal_Int16
UnoDialogControl::execute() throw(RuntimeException
)
558 SolarMutexGuard aGuard
;
559 sal_Int16 nDone
= -1;
560 if ( getPeer().is() )
562 Reference
< XDialog
> xDlg( getPeer(), UNO_QUERY
);
565 GetComponentInfos().bVisible
= sal_True
;
566 nDone
= xDlg
->execute();
567 GetComponentInfos().bVisible
= sal_False
;
573 void UnoDialogControl::endExecute() throw(RuntimeException
)
575 SolarMutexGuard aGuard
;
576 if ( getPeer().is() )
578 Reference
< XDialog
> xDlg( getPeer(), UNO_QUERY
);
582 GetComponentInfos().bVisible
= sal_False
;
588 void SAL_CALL
UnoDialogControl::modified(
589 const lang::EventObject
& /*rEvent*/ )
590 throw (RuntimeException
)
592 ImplUpdateResourceResolver();
595 void UnoDialogControl::ImplModelPropertiesChanged( const Sequence
< PropertyChangeEvent
>& rEvents
) throw(RuntimeException
)
597 sal_Int32 nLen
= rEvents
.getLength();
598 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
600 const PropertyChangeEvent
& rEvt
= rEvents
.getConstArray()[i
];
601 Reference
< XControlModel
> xModel( rEvt
.Source
, UNO_QUERY
);
602 sal_Bool bOwnModel
= (XControlModel
*)xModel
.get() == (XControlModel
*)getModel().get();
603 if ( bOwnModel
&& rEvt
.PropertyName
.equalsAsciiL( "ImageURL", 8 ))
606 Reference
< graphic::XGraphic
> xGraphic
;
607 if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL
) ) >>= aImageURL
) &&
608 ( !aImageURL
.isEmpty() ))
610 OUString absoluteUrl
= aImageURL
;
611 if ( !aImageURL
.startsWith( UNO_NAME_GRAPHOBJ_URLPREFIX
) )
613 absoluteUrl
= getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL
)),
614 uno::makeAny(aImageURL
));
616 xGraphic
= ImageHelper::getGraphicFromURL_nothrow( absoluteUrl
);
618 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC
), uno::makeAny( xGraphic
), sal_True
);
622 ControlContainerBase::ImplModelPropertiesChanged(rEvents
);
625 // ----------------------------------------------------
626 // class MultiPageControl
627 // ----------------------------------------------------
628 UnoMultiPageControl::UnoMultiPageControl( const uno::Reference
< uno::XComponentContext
>& rxContext
) : ControlContainerBase(rxContext
), maTabListeners( *this )
630 maComponentInfos
.nWidth
= 280;
631 maComponentInfos
.nHeight
= 400;
634 UnoMultiPageControl::~UnoMultiPageControl()
639 void SAL_CALL
UnoMultiPageControl::inserted( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
642 void SAL_CALL
UnoMultiPageControl::removed( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
645 void SAL_CALL
UnoMultiPageControl::changed( SAL_UNUSED_PARAMETER ::sal_Int32
,
646 SAL_UNUSED_PARAMETER
const Sequence
< NamedValue
>& ) throw (RuntimeException
)
649 void SAL_CALL
UnoMultiPageControl::activated( ::sal_Int32 ID
) throw (RuntimeException
)
651 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( ID
), sal_False
);
654 void SAL_CALL
UnoMultiPageControl::deactivated( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
657 void SAL_CALL
UnoMultiPageControl::disposing(const EventObject
&) throw (RuntimeException
)
661 void SAL_CALL
UnoMultiPageControl::dispose() throw (RuntimeException
)
663 lang::EventObject aEvt
;
664 aEvt
.Source
= (::cppu::OWeakObject
*)this;
665 maTabListeners
.disposeAndClear( aEvt
);
666 ControlContainerBase::dispose();
669 // com::sun::star::awt::XSimpleTabController
670 ::sal_Int32 SAL_CALL
UnoMultiPageControl::insertTab() throw (RuntimeException
)
672 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
673 if ( !xMultiPage
.is() )
674 throw RuntimeException();
675 return xMultiPage
->insertTab();
678 void SAL_CALL
UnoMultiPageControl::removeTab( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
680 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
681 if ( !xMultiPage
.is() )
682 throw RuntimeException();
683 xMultiPage
->removeTab( ID
);
686 void SAL_CALL
UnoMultiPageControl::setTabProps( ::sal_Int32 ID
, const Sequence
< NamedValue
>& Properties
) throw (IndexOutOfBoundsException
, RuntimeException
)
688 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
689 if ( !xMultiPage
.is() )
690 throw RuntimeException();
691 xMultiPage
->setTabProps( ID
, Properties
);
694 Sequence
< NamedValue
> SAL_CALL
UnoMultiPageControl::getTabProps( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
696 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
697 if ( !xMultiPage
.is() )
698 throw RuntimeException();
699 return xMultiPage
->getTabProps( ID
);
702 void SAL_CALL
UnoMultiPageControl::activateTab( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
704 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
705 if ( !xMultiPage
.is() )
706 throw RuntimeException();
707 xMultiPage
->activateTab( ID
);
708 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( ID
), sal_True
);
712 ::sal_Int32 SAL_CALL
UnoMultiPageControl::getActiveTabID() throw (RuntimeException
)
714 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
715 if ( !xMultiPage
.is() )
716 throw RuntimeException();
717 return xMultiPage
->getActiveTabID();
720 void SAL_CALL
UnoMultiPageControl::addTabListener( const Reference
< XTabListener
>& Listener
) throw (RuntimeException
)
722 maTabListeners
.addInterface( Listener
);
723 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
724 if ( xMultiPage
.is() && maTabListeners
.getLength() == 1 )
725 xMultiPage
->addTabListener( &maTabListeners
);
728 void SAL_CALL
UnoMultiPageControl::removeTabListener( const Reference
< XTabListener
>& Listener
) throw (RuntimeException
)
730 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
731 if ( xMultiPage
.is() && maTabListeners
.getLength() == 1 )
732 xMultiPage
->removeTabListener( &maTabListeners
);
733 maTabListeners
.removeInterface( Listener
);
737 // lang::XTypeProvider
738 IMPL_XTYPEPROVIDER_START( UnoMultiPageControl
)
739 getCppuType( ( uno::Reference
< awt::XSimpleTabController
>* ) NULL
),
740 getCppuType( ( uno::Reference
< awt::XTabListener
>* ) NULL
),
741 ControlContainerBase::getTypes()
742 IMPL_XTYPEPROVIDER_END
745 uno::Any
UnoMultiPageControl::queryAggregation( const uno::Type
& rType
) throw(uno::RuntimeException
)
747 uno::Any aRet
= ::cppu::queryInterface( rType
,
748 (static_cast< awt::XTabListener
* >(this)), (static_cast< awt::XSimpleTabController
* >(this)) );
749 return (aRet
.hasValue() ? aRet
: ControlContainerBase::queryAggregation( rType
));
752 OUString
UnoMultiPageControl::GetComponentServiceName()
754 sal_Bool
bDecoration( sal_True
);
755 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
757 return OUString("tabcontrol");
758 // Hopefully we can tweak the tabcontrol to display without tabs
759 return OUString("tabcontrolnotabs");
762 void UnoMultiPageControl::bindPage( const uno::Reference
< awt::XControl
>& _rxControl
)
764 uno::Reference
< awt::XWindowPeer
> xPage( _rxControl
->getPeer() );
765 uno::Reference
< awt::XSimpleTabController
> xTabCntrl( getPeer(), uno::UNO_QUERY
);
766 uno::Reference
< beans::XPropertySet
> xProps( _rxControl
->getModel(), uno::UNO_QUERY
);
768 VCLXTabPage
* pXPage
= dynamic_cast< VCLXTabPage
* >( xPage
.get() );
769 TabPage
* pPage
= pXPage
? pXPage
->getTabPage() : NULL
;
770 if ( xTabCntrl
.is() && pPage
)
772 VCLXMultiPage
* pXTab
= dynamic_cast< VCLXMultiPage
* >( xTabCntrl
.get() );
776 xProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE
) ) >>= sTitle
;
777 pXTab
->insertTab( pPage
, sTitle
);
783 void UnoMultiPageControl::createPeer( const Reference
< XToolkit
> & rxToolkit
, const Reference
< XWindowPeer
> & rParentPeer
) throw(RuntimeException
)
785 SolarMutexGuard aSolarGuard
;
787 UnoControlContainer::createPeer( rxToolkit
, rParentPeer
);
789 uno::Sequence
< uno::Reference
< awt::XControl
> > aCtrls
= getControls();
790 sal_uInt32 nCtrls
= aCtrls
.getLength();
791 for( sal_uInt32 n
= 0; n
< nCtrls
; n
++ )
792 bindPage( aCtrls
[ n
] );
793 sal_Int32
nActiveTab(0);
794 Reference
< XPropertySet
> xMultiProps( getModel(), UNO_QUERY
);
795 xMultiProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
) ) >>= nActiveTab
;
797 uno::Reference
< awt::XSimpleTabController
> xTabCntrl( getPeer(), uno::UNO_QUERY
);
798 if ( xTabCntrl
.is() )
800 xTabCntrl
->addTabListener( this );
801 if ( nActiveTab
&& nCtrls
) // Ensure peer is initialise with correct activated tab
803 xTabCntrl
->activateTab( nActiveTab
);
804 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( nActiveTab
), sal_True
);
809 void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference
< awt::XControl
>& _rxControl
)
811 OSL_PRECOND( _rxControl
.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
813 // if the container already has a peer, then also create a peer for the control
814 uno::Reference
< awt::XWindowPeer
> xMyPeer( getPeer() );
818 _rxControl
->createPeer( NULL
, xMyPeer
);
819 bindPage( _rxControl
);
820 ImplActivateTabControllers();
825 // ------------- UnoMultiPageModel -----------------
827 UnoMultiPageModel::UnoMultiPageModel( const Reference
< XComponentContext
>& rxContext
) : ControlModelContainerBase( rxContext
)
829 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
830 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
831 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
832 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
834 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
835 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
836 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
837 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
838 //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
839 ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE
);
840 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
841 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
844 aBool
<<= (sal_Bool
) sal_True
;
845 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
846 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
847 ImplRegisterProperty( BASEPROPERTY_DECORATION
, aBool
);
848 // MultiPage Control has the tab stop property. And the default value is True.
849 ImplRegisterProperty( BASEPROPERTY_TABSTOP
, aBool
);
851 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
852 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
855 UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel
& rModel
)
856 : ControlModelContainerBase( rModel
)
860 UnoMultiPageModel::~UnoMultiPageModel()
865 UnoMultiPageModel::Clone() const
867 // clone the container itself
868 UnoMultiPageModel
* pClone
= new UnoMultiPageModel( *this );
869 Clone_Impl( *pClone
);
873 OUString
UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
875 return OUString::createFromAscii( szServiceName_UnoMultiPageModel
);
878 uno::Any
UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
880 if ( nPropId
== BASEPROPERTY_DEFAULTCONTROL
)
883 aAny
<<= OUString::createFromAscii( szServiceName_UnoMultiPageControl
);
886 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
889 ::cppu::IPropertyArrayHelper
& UnoMultiPageModel::getInfoHelper()
891 static UnoPropertyArrayHelper
* pHelper
= NULL
;
894 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
895 pHelper
= new UnoPropertyArrayHelper( aIDs
);
900 // beans::XMultiPropertySet
901 uno::Reference
< beans::XPropertySetInfo
> UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
903 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
907 void UnoMultiPageModel::insertByName( const OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
909 Reference
< XServiceInfo
> xInfo
;
913 throw IllegalArgumentException();
915 // Only a Page model can be inserted into the multipage
916 if ( !xInfo
->supportsService( OUString::createFromAscii( szServiceName_UnoPageModel
) ) )
917 throw IllegalArgumentException();
919 return ControlModelContainerBase::insertByName( aName
, aElement
);
922 // ----------------------------------------------------------------------------
923 sal_Bool SAL_CALL
UnoMultiPageModel::getGroupControl( ) throw (RuntimeException
)
928 // ----------------------------------------------------
929 // class UnoPageControl
930 // ----------------------------------------------------
931 UnoPageControl::UnoPageControl( const uno::Reference
< uno::XComponentContext
>& rxContext
) : ControlContainerBase(rxContext
)
933 maComponentInfos
.nWidth
= 280;
934 maComponentInfos
.nHeight
= 400;
937 UnoPageControl::~UnoPageControl()
941 OUString
UnoPageControl::GetComponentServiceName()
943 return OUString("tabpage");
947 // ------------- UnoPageModel -----------------
949 UnoPageModel::UnoPageModel( const Reference
< XComponentContext
>& rxContext
) : ControlModelContainerBase( rxContext
)
951 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
952 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
953 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
954 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
956 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
957 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
958 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
959 ImplRegisterProperty( BASEPROPERTY_TITLE
);
960 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
961 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
962 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
963 // ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
966 aBool
<<= (sal_Bool
) sal_True
;
967 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
968 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
969 //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
971 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
972 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
975 UnoPageModel::UnoPageModel( const UnoPageModel
& rModel
)
976 : ControlModelContainerBase( rModel
)
980 UnoPageModel::~UnoPageModel()
985 UnoPageModel::Clone() const
987 // clone the container itself
988 UnoPageModel
* pClone
= new UnoPageModel( *this );
989 Clone_Impl( *pClone
);
993 OUString
UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
995 return OUString::createFromAscii( szServiceName_UnoPageModel
);
998 uno::Any
UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
1000 if ( nPropId
== BASEPROPERTY_DEFAULTCONTROL
)
1003 aAny
<<= OUString::createFromAscii( szServiceName_UnoPageControl
);
1006 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
1009 ::cppu::IPropertyArrayHelper
& UnoPageModel::getInfoHelper()
1011 static UnoPropertyArrayHelper
* pHelper
= NULL
;
1014 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
1015 pHelper
= new UnoPropertyArrayHelper( aIDs
);
1020 // beans::XMultiPropertySet
1021 uno::Reference
< beans::XPropertySetInfo
> UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
1023 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
1027 // ----------------------------------------------------------------------------
1028 sal_Bool SAL_CALL
UnoPageModel::getGroupControl( ) throw (RuntimeException
)
1035 // ----------------------------------------------------
1036 // class UnoFrameControl
1037 // ----------------------------------------------------
1038 UnoFrameControl::UnoFrameControl( const uno::Reference
< uno::XComponentContext
>& rxContext
) : ControlContainerBase(rxContext
)
1040 maComponentInfos
.nWidth
= 280;
1041 maComponentInfos
.nHeight
= 400;
1044 UnoFrameControl::~UnoFrameControl()
1048 OUString
UnoFrameControl::GetComponentServiceName()
1050 return OUString("frame");
1053 void UnoFrameControl::ImplSetPosSize( Reference
< XControl
>& rxCtrl
)
1055 bool bOwnCtrl
= false;
1057 if ( rxCtrl
.get() == Reference
<XControl
>( this ).get() )
1059 Reference
< XPropertySet
> xProps( getModel(), UNO_QUERY
);
1060 //xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
1061 xProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL
) ) >>= sTitle
;
1063 ControlContainerBase::ImplSetPosSize( rxCtrl
);
1064 Reference
< XWindow
> xW( rxCtrl
, UNO_QUERY
);
1065 if ( !bOwnCtrl
&& xW
.is() && !sTitle
.isEmpty() )
1067 awt::Rectangle aSizePos
= xW
->getPosSize();
1069 sal_Int32 nX
= aSizePos
.X
, nY
= aSizePos
.Y
, nWidth
= aSizePos
.Width
, nHeight
= aSizePos
.Height
;
1070 // Retrieve the values set by the base class
1071 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
1074 if ( !bOwnCtrl
&& !sTitle
.isEmpty() )
1076 // Adjust Y based on height of Title
1078 aRect
= pOutDev
->GetTextRect( aRect
, sTitle
);
1079 nY
= nY
+ ( aRect
.GetHeight() / 2 );
1084 Reference
< XWindowPeer
> xPeer
= ImplGetCompatiblePeer( sal_True
);
1085 Reference
< XDevice
> xD( xPeer
, UNO_QUERY
);
1087 SimpleFontMetric aFM
;
1089 Any aVal
= ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR
) );
1092 if ( !aFD
.StyleName
.isEmpty() )
1094 Reference
< XFont
> xFont
= xD
->getFont( aFD
);
1095 aFM
= xFont
->getFontMetric();
1099 Reference
< XGraphics
> xG
= xD
->createGraphics();
1100 aFM
= xG
->getFontMetric();
1103 sal_Int16 nH
= aFM
.Ascent
+ aFM
.Descent
;
1104 if ( !bOwnCtrl
&& !sTitle
.isEmpty() )
1105 // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
1106 nY
= nY
+ ( nH
/ 8); // how do I test this
1108 xW
->setPosSize( nX
, nY
, nWidth
, nHeight
, PosSize::POSSIZE
);
1112 // ------------- UnoFrameModel -----------------
1114 UnoFrameModel::UnoFrameModel( const Reference
< XComponentContext
>& rxContext
) : ControlModelContainerBase( rxContext
)
1116 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
1117 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
1118 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
1119 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
1120 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
1121 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
1122 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
1123 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
1124 ImplRegisterProperty( BASEPROPERTY_LABEL
);
1125 ImplRegisterProperty( BASEPROPERTY_WRITING_MODE
);
1126 ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE
);
1127 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
1128 ImplRegisterProperty( BASEPROPERTY_HSCROLL
);
1129 ImplRegisterProperty( BASEPROPERTY_VSCROLL
);
1130 ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH
);
1131 ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT
);
1132 ImplRegisterProperty( BASEPROPERTY_SCROLLTOP
);
1133 ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT
);
1136 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
1137 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
1140 UnoFrameModel::UnoFrameModel( const UnoFrameModel
& rModel
)
1141 : ControlModelContainerBase( rModel
)
1145 UnoFrameModel::~UnoFrameModel()
1150 UnoFrameModel::Clone() const
1152 // clone the container itself
1153 UnoFrameModel
* pClone
= new UnoFrameModel( *this );
1154 Clone_Impl( *pClone
);
1158 OUString
UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
1160 return OUString::createFromAscii( szServiceName_UnoFrameModel
);
1163 uno::Any
UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
1168 case BASEPROPERTY_DEFAULTCONTROL
:
1170 aAny
<<= OUString::createFromAscii( szServiceName_UnoFrameControl
);
1173 case BASEPROPERTY_SCROLLWIDTH
:
1174 case BASEPROPERTY_SCROLLHEIGHT
:
1175 case BASEPROPERTY_SCROLLTOP
:
1176 case BASEPROPERTY_SCROLLLEFT
:
1177 aAny
<<= sal_Int32(0);
1179 case BASEPROPERTY_USERFORMCONTAINEES
:
1181 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
1182 return makeAny( xNameCont
);
1185 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
1188 ::cppu::IPropertyArrayHelper
& UnoFrameModel::getInfoHelper()
1190 static UnoPropertyArrayHelper
* pHelper
= NULL
;
1193 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
1194 pHelper
= new UnoPropertyArrayHelper( aIDs
);
1199 // beans::XMultiPropertySet
1200 uno::Reference
< beans::XPropertySetInfo
> UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
1202 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
1206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */