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/svapp.hxx>
38 #include <vcl/outdev.hxx>
40 #include <toolkit/helper/vclunohelper.hxx>
41 #include <unotools/ucbstreamhelper.hxx>
42 #include <vcl/graph.hxx>
43 #include <vcl/image.hxx>
45 #include <boost/unordered_map.hpp>
46 #include <cppuhelper/implbase1.hxx>
49 #include "osl/file.hxx"
51 #include <vcl/tabctrl.hxx>
52 #include <toolkit/awt/vclxwindows.hxx>
53 #include "toolkit/controls/unocontrols.hxx"
55 using namespace ::com::sun::star
;
56 using namespace ::com::sun::star::uno
;
57 using namespace ::com::sun::star::awt
;
58 using namespace ::com::sun::star::lang
;
59 using namespace ::com::sun::star::container
;
60 using namespace ::com::sun::star::beans
;
61 using namespace ::com::sun::star::util
;
63 #define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( "DialogSourceURL" )
64 #define PROPERTY_IMAGEURL ::rtl::OUString( "ImageURL" )
65 #define PROPERTY_GRAPHIC ::rtl::OUString( "Graphic" )
68 // we probably will need both a hash of control models and hash of controls
69 // => use some template magic
71 typedef ::cppu::WeakImplHelper1
< container::XNameContainer
> SimpleNameContainer_BASE
;
73 template< typename T
>
74 class SimpleNamedThingContainer
: public SimpleNameContainer_BASE
76 typedef boost::unordered_map
< rtl::OUString
, Reference
< T
>, ::rtl::OUStringHash
,
77 ::std::equal_to
< ::rtl::OUString
> > NamedThingsHash
;
78 NamedThingsHash things
;
79 ::osl::Mutex m_aMutex
;
81 // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
82 virtual void SAL_CALL
replaceByName( const ::rtl::OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
84 ::osl::MutexGuard
aGuard( m_aMutex
);
85 if ( !hasByName( aName
) )
86 throw NoSuchElementException();
87 Reference
< T
> xElement
;
88 if ( ! ( aElement
>>= xElement
) )
89 throw IllegalArgumentException();
90 things
[ aName
] = xElement
;
92 virtual Any SAL_CALL
getByName( const ::rtl::OUString
& aName
) throw(NoSuchElementException
, WrappedTargetException
, RuntimeException
)
94 ::osl::MutexGuard
aGuard( m_aMutex
);
95 if ( !hasByName( aName
) )
96 throw NoSuchElementException();
97 return uno::makeAny( things
[ aName
] );
99 virtual Sequence
< ::rtl::OUString
> SAL_CALL
getElementNames( ) throw(RuntimeException
)
101 ::osl::MutexGuard
aGuard( m_aMutex
);
102 Sequence
< ::rtl::OUString
> aResult( things
.size() );
103 typename
NamedThingsHash::iterator it
= things
.begin();
104 typename
NamedThingsHash::iterator it_end
= things
.end();
105 rtl::OUString
* pName
= aResult
.getArray();
106 for (; it
!= it_end
; ++it
, ++pName
)
110 virtual sal_Bool SAL_CALL
hasByName( const ::rtl::OUString
& aName
) throw(RuntimeException
)
112 ::osl::MutexGuard
aGuard( m_aMutex
);
113 return ( things
.find( aName
) != things
.end() );
115 virtual void SAL_CALL
insertByName( const ::rtl::OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
117 ::osl::MutexGuard
aGuard( m_aMutex
);
118 if ( hasByName( aName
) )
119 throw ElementExistException();
120 Reference
< T
> xElement
;
121 if ( ! ( aElement
>>= xElement
) )
122 throw IllegalArgumentException();
123 things
[ aName
] = xElement
;
125 virtual void SAL_CALL
removeByName( const ::rtl::OUString
& aName
) throw(NoSuchElementException
, WrappedTargetException
, RuntimeException
)
127 ::osl::MutexGuard
aGuard( m_aMutex
);
128 if ( !hasByName( aName
) )
129 throw NoSuchElementException();
130 things
.erase( things
.find( aName
) );
132 virtual Type SAL_CALL
getElementType( ) throw (RuntimeException
)
134 return T::static_type( NULL
);
136 virtual ::sal_Bool SAL_CALL
hasElements( ) throw (RuntimeException
)
138 ::osl::MutexGuard
aGuard( m_aMutex
);
139 return ( things
.size() > 0 );
144 ::rtl::OUString
getPhysicalLocation( const ::com::sun::star::uno::Any
& rbase
, const ::com::sun::star::uno::Any
& rUrl
);
146 // ----------------------------------------------------
147 // class UnoControlDialogModel
148 // ----------------------------------------------------
149 UnoControlDialogModel::UnoControlDialogModel( const Reference
< XMultiServiceFactory
>& i_factory
)
150 :ControlModelContainerBase( i_factory
)
152 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
153 // ImplRegisterProperty( BASEPROPERTY_BORDER );
154 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
155 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
156 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
157 // ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
158 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
159 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
160 ImplRegisterProperty( BASEPROPERTY_TITLE
);
161 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
162 ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT
);
163 ImplRegisterProperty( BASEPROPERTY_DECORATION
);
164 ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL
);
165 ImplRegisterProperty( BASEPROPERTY_GRAPHIC
);
166 ImplRegisterProperty( BASEPROPERTY_IMAGEURL
);
167 ImplRegisterProperty( BASEPROPERTY_HSCROLL
);
168 ImplRegisterProperty( BASEPROPERTY_VSCROLL
);
169 ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH
);
170 ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT
);
171 ImplRegisterProperty( BASEPROPERTY_SCROLLTOP
);
172 ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT
);
175 aBool
<<= (sal_Bool
) sal_True
;
176 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
177 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
178 // #TODO separate class for 'UserForm' ( instead of re-using Dialog ? )
179 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
180 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
183 UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel
& rModel
)
184 : ControlModelContainerBase( rModel
)
186 // need to clone BASEPROPERTY_USERFORMCONTAINEES too
187 Reference
< XNameContainer
> xSrcNameCont( const_cast< UnoControlDialogModel
& >(rModel
).getPropertyValue( GetPropertyName( BASEPROPERTY_USERFORMCONTAINEES
) ), UNO_QUERY
);
188 Reference
<XNameContainer
> xNameCont( new SimpleNamedThingContainer
< XControlModel
>() );
190 uno::Sequence
< rtl::OUString
> sNames
= xSrcNameCont
->getElementNames();
191 rtl::OUString
* pName
= sNames
.getArray();
192 rtl::OUString
* pNamesEnd
= pName
+ sNames
.getLength();
193 for ( ; pName
!= pNamesEnd
; ++pName
)
195 if ( xSrcNameCont
->hasByName( *pName
) )
196 xNameCont
->insertByName( *pName
, xSrcNameCont
->getByName( *pName
) );
198 setFastPropertyValue_NoBroadcast( BASEPROPERTY_USERFORMCONTAINEES
, makeAny( xNameCont
) );
201 UnoControlDialogModel::~UnoControlDialogModel()
205 UnoControlModel
* UnoControlDialogModel::Clone() const
207 // clone the container itself
208 UnoControlDialogModel
* pClone
= new UnoControlDialogModel( *this );
216 ::rtl::OUString
UnoControlDialogModel::getServiceName( ) throw(RuntimeException
)
218 return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel
);
221 Any
UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
227 case BASEPROPERTY_DEFAULTCONTROL
:
228 aAny
<<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog
);
230 case BASEPROPERTY_SCROLLWIDTH
:
231 case BASEPROPERTY_SCROLLHEIGHT
:
232 case BASEPROPERTY_SCROLLTOP
:
233 case BASEPROPERTY_SCROLLLEFT
:
234 aAny
<<= sal_Int32(0);
237 aAny
= UnoControlModel::ImplGetDefaultValue( nPropId
);
243 ::cppu::IPropertyArrayHelper
& UnoControlDialogModel::getInfoHelper()
245 static UnoPropertyArrayHelper
* pHelper
= NULL
;
248 Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
249 pHelper
= new UnoPropertyArrayHelper( aIDs
);
255 Reference
< XPropertySetInfo
> UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException
)
257 static Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
261 void SAL_CALL
UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
) throw (::com::sun::star::uno::Exception
)
263 ControlModelContainerBase::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
266 if ( nHandle
== BASEPROPERTY_IMAGEURL
&& ImplHasProperty( BASEPROPERTY_GRAPHIC
) )
268 ::rtl::OUString sImageURL
;
269 OSL_VERIFY( rValue
>>= sImageURL
);
270 setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC
), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj
, sImageURL
) ) );
273 catch( const ::com::sun::star::uno::Exception
& )
275 OSL_ENSURE( sal_False
, "UnoControlDialogModel::setFastPropertyValue_NoBroadcast: caught an exception while setting ImageURL properties!" );
278 // ============================================================================
279 // = class UnoDialogControl
280 // ============================================================================
282 UnoDialogControl::UnoDialogControl( const uno::Reference
< lang::XMultiServiceFactory
>& i_factory
)
283 :UnoDialogControl_Base( i_factory
)
284 ,maTopWindowListeners( *this )
285 ,mbWindowListener(false)
287 maComponentInfos
.nWidth
= 300;
288 maComponentInfos
.nHeight
= 450;
291 UnoDialogControl::~UnoDialogControl()
295 ::rtl::OUString
UnoDialogControl::GetComponentServiceName()
298 sal_Bool
bDecoration( sal_True
);
299 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
301 return ::rtl::OUString("Dialog");
303 return ::rtl::OUString("TabPage");
306 void UnoDialogControl::dispose() throw(RuntimeException
)
308 SolarMutexGuard aGuard
;
311 aEvt
.Source
= static_cast< ::cppu::OWeakObject
* >( this );
312 maTopWindowListeners
.disposeAndClear( aEvt
);
313 ControlContainerBase::dispose();
316 void SAL_CALL
UnoDialogControl::disposing(
317 const EventObject
& Source
)
318 throw(RuntimeException
)
320 ControlContainerBase::disposing( Source
);
323 sal_Bool
UnoDialogControl::setModel( const Reference
< XControlModel
>& rxModel
) throw(RuntimeException
)
325 // #Can we move all the Resource stuff to the ControlContainerBase ?
326 SolarMutexGuard aGuard
;
327 sal_Bool bRet
= ControlContainerBase::setModel( rxModel
);
328 ImplStartListingForResourceEvents();
332 void UnoDialogControl::createPeer( const Reference
< XToolkit
> & rxToolkit
, const Reference
< XWindowPeer
> & rParentPeer
) throw(RuntimeException
)
334 SolarMutexGuard aGuard
;
336 UnoControlContainer::createPeer( rxToolkit
, rParentPeer
);
338 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
341 xTW
->setMenuBar( mxMenuBar
);
343 if ( !mbWindowListener
)
345 Reference
< XWindowListener
> xWL( static_cast< cppu::OWeakObject
*>( this ), UNO_QUERY
);
346 addWindowListener( xWL
);
347 mbWindowListener
= true;
350 if ( maTopWindowListeners
.getLength() )
351 xTW
->addTopWindowListener( &maTopWindowListeners
);
352 // there must be a better way than doing this, we can't
353 // process the scrolltop & scrollleft in XDialog because
354 // the children haven't been added when those props are applied
355 ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP
), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP
) ) );
356 ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT
), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT
) ) );
361 void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor
& rDesc
)
363 UnoControlContainer::PrepareWindowDescriptor( rDesc
);
364 sal_Bool
bDecoration( sal_True
);
365 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
368 // Now we have to manipulate the WindowDescriptor
369 rDesc
.WindowAttributes
= rDesc
.WindowAttributes
| ::com::sun::star::awt::WindowAttribute::NODECORATION
;
372 // We have to set the graphic property before the peer
373 // will be created. Otherwise the properties will be copied
374 // into the peer via propertiesChangeEvents. As the order of
375 // can lead to overwrites we have to set the graphic property
376 // before the propertiesChangeEvents are sent!
377 ::rtl::OUString aImageURL
;
378 Reference
< graphic::XGraphic
> xGraphic
;
379 if (( ImplGetPropertyValue( PROPERTY_IMAGEURL
) >>= aImageURL
) &&
380 ( !aImageURL
.isEmpty() ))
382 ::rtl::OUString absoluteUrl
= aImageURL
;
383 if ( aImageURL
.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX
, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX
) ) != 0 )
384 absoluteUrl
= getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL
),
385 uno::makeAny( aImageURL
) );
387 xGraphic
= ImageHelper::getGraphicFromURL_nothrow( absoluteUrl
);
388 ImplSetPropertyValue( PROPERTY_GRAPHIC
, uno::makeAny( xGraphic
), sal_True
);
392 void UnoDialogControl::addTopWindowListener( const Reference
< XTopWindowListener
>& rxListener
) throw (RuntimeException
)
394 maTopWindowListeners
.addInterface( rxListener
);
395 if( getPeer().is() && maTopWindowListeners
.getLength() == 1 )
397 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
398 xTW
->addTopWindowListener( &maTopWindowListeners
);
402 void UnoDialogControl::removeTopWindowListener( const Reference
< XTopWindowListener
>& rxListener
) throw (RuntimeException
)
404 if( getPeer().is() && maTopWindowListeners
.getLength() == 1 )
406 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
407 xTW
->removeTopWindowListener( &maTopWindowListeners
);
409 maTopWindowListeners
.removeInterface( rxListener
);
412 void UnoDialogControl::toFront( ) throw (RuntimeException
)
414 SolarMutexGuard aGuard
;
415 if ( getPeer().is() )
417 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
423 void UnoDialogControl::toBack( ) throw (RuntimeException
)
425 SolarMutexGuard aGuard
;
426 if ( getPeer().is() )
428 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
434 void UnoDialogControl::setMenuBar( const Reference
< XMenuBar
>& rxMenuBar
) throw (RuntimeException
)
436 SolarMutexGuard aGuard
;
437 mxMenuBar
= rxMenuBar
;
438 if ( getPeer().is() )
440 Reference
< XTopWindow
> xTW( getPeer(), UNO_QUERY
);
442 xTW
->setMenuBar( mxMenuBar
);
445 static ::Size
ImplMapPixelToAppFont( OutputDevice
* pOutDev
, const ::Size
& aSize
)
447 ::Size aTmp
= pOutDev
->PixelToLogic( aSize
, MAP_APPFONT
);
450 // ::com::sun::star::awt::XWindowListener
451 void SAL_CALL
UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent
& e
)
452 throw (::com::sun::star::uno::RuntimeException
)
454 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
455 DBG_ASSERT( pOutDev
, "Missing Default Device!" );
456 if ( pOutDev
&& !mbSizeModified
)
458 // Currentley we are simply using MAP_APPFONT
459 ::Size
aAppFontSize( e
.Width
, e
.Height
);
461 Reference
< XControl
> xDialogControl( *this, UNO_QUERY_THROW
);
462 Reference
< XDevice
> xDialogDevice( xDialogControl
->getPeer(), UNO_QUERY
);
463 OSL_ENSURE( xDialogDevice
.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
465 // #i87592 In design mode the drawing layer works with sizes with decoration.
466 // Therefore we have to substract them before writing back to the properties (model).
467 if ( xDialogDevice
.is() && mbDesignMode
)
469 DeviceInfo
aDeviceInfo( xDialogDevice
->getInfo() );
470 aAppFontSize
.Width() -= aDeviceInfo
.LeftInset
+ aDeviceInfo
.RightInset
;
471 aAppFontSize
.Height() -= aDeviceInfo
.TopInset
+ aDeviceInfo
.BottomInset
;
474 aAppFontSize
= ImplMapPixelToAppFont( pOutDev
, aAppFontSize
);
476 // Remember that changes have been done by listener. No need to
477 // update the position because of property change event.
478 mbSizeModified
= true;
479 Sequence
< rtl::OUString
> aProps( 2 );
480 Sequence
< Any
> aValues( 2 );
481 // Properties in a sequence must be sorted!
482 aProps
[0] = rtl::OUString( "Height" );
483 aProps
[1] = rtl::OUString( "Width" );
484 aValues
[0] <<= aAppFontSize
.Height();
485 aValues
[1] <<= aAppFontSize
.Width();
487 ImplSetPropertyValues( aProps
, aValues
, true );
488 mbSizeModified
= false;
492 void SAL_CALL
UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent
& e
)
493 throw (::com::sun::star::uno::RuntimeException
)
495 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
496 DBG_ASSERT( pOutDev
, "Missing Default Device!" );
497 if ( pOutDev
&& !mbPosModified
)
499 // Currentley we are simply using MAP_APPFONT
501 ::Size
aTmp( e
.X
, e
.Y
);
502 aTmp
= ImplMapPixelToAppFont( pOutDev
, aTmp
);
504 // Remember that changes have been done by listener. No need to
505 // update the position because of property change event.
506 mbPosModified
= true;
507 Sequence
< rtl::OUString
> aProps( 2 );
508 Sequence
< Any
> aValues( 2 );
509 aProps
[0] = rtl::OUString( "PositionX" );
510 aProps
[1] = rtl::OUString( "PositionY" );
511 aValues
[0] <<= aTmp
.Width();
512 aValues
[1] <<= aTmp
.Height();
514 ImplSetPropertyValues( aProps
, aValues
, true );
515 mbPosModified
= false;
519 void SAL_CALL
UnoDialogControl::windowShown( const EventObject
& e
) throw (RuntimeException
)
524 void SAL_CALL
UnoDialogControl::windowHidden( const EventObject
& e
) throw (RuntimeException
)
529 void SAL_CALL
UnoDialogControl::endDialog( ::sal_Int32 i_result
) throw (RuntimeException
)
531 Reference
< XDialog2
> xPeerDialog( getPeer(), UNO_QUERY
);
532 if ( xPeerDialog
.is() )
533 xPeerDialog
->endDialog( i_result
);
536 void SAL_CALL
UnoDialogControl::setHelpId( const rtl::OUString
& i_id
) throw (RuntimeException
)
538 Reference
< XDialog2
> xPeerDialog( getPeer(), UNO_QUERY
);
539 if ( xPeerDialog
.is() )
540 xPeerDialog
->setHelpId( i_id
);
543 void UnoDialogControl::setTitle( const ::rtl::OUString
& Title
) throw(RuntimeException
)
545 SolarMutexGuard aGuard
;
548 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE
), aAny
, sal_True
);
551 ::rtl::OUString
UnoDialogControl::getTitle() throw(RuntimeException
)
553 SolarMutexGuard aGuard
;
554 return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE
);
557 sal_Int16
UnoDialogControl::execute() throw(RuntimeException
)
559 SolarMutexGuard aGuard
;
560 sal_Int16 nDone
= -1;
561 if ( getPeer().is() )
563 Reference
< XDialog
> xDlg( getPeer(), UNO_QUERY
);
566 GetComponentInfos().bVisible
= sal_True
;
567 nDone
= xDlg
->execute();
568 GetComponentInfos().bVisible
= sal_False
;
574 void UnoDialogControl::endExecute() throw(RuntimeException
)
576 SolarMutexGuard aGuard
;
577 if ( getPeer().is() )
579 Reference
< XDialog
> xDlg( getPeer(), UNO_QUERY
);
583 GetComponentInfos().bVisible
= sal_False
;
589 void SAL_CALL
UnoDialogControl::modified(
590 const lang::EventObject
& /*rEvent*/ )
591 throw (RuntimeException
)
593 ImplUpdateResourceResolver();
596 void UnoDialogControl::ImplModelPropertiesChanged( const Sequence
< PropertyChangeEvent
>& rEvents
) throw(RuntimeException
)
598 sal_Int32 nLen
= rEvents
.getLength();
599 for( sal_Int32 i
= 0; i
< nLen
; i
++ )
601 const PropertyChangeEvent
& rEvt
= rEvents
.getConstArray()[i
];
602 Reference
< XControlModel
> xModel( rEvt
.Source
, UNO_QUERY
);
603 sal_Bool bOwnModel
= (XControlModel
*)xModel
.get() == (XControlModel
*)getModel().get();
604 if ( bOwnModel
&& rEvt
.PropertyName
.equalsAsciiL( "ImageURL", 8 ))
606 ::rtl::OUString aImageURL
;
607 Reference
< graphic::XGraphic
> xGraphic
;
608 if (( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL
) ) >>= aImageURL
) &&
609 ( !aImageURL
.isEmpty() ))
611 ::rtl::OUString absoluteUrl
= aImageURL
;
612 if ( aImageURL
.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX
, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX
) ) != 0 )
614 absoluteUrl
= getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL
)),
615 uno::makeAny(aImageURL
));
617 xGraphic
= ImageHelper::getGraphicFromURL_nothrow( absoluteUrl
);
619 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC
), uno::makeAny( xGraphic
), sal_True
);
623 ControlContainerBase::ImplModelPropertiesChanged(rEvents
);
626 // ----------------------------------------------------
627 // class MultiPageControl
628 // ----------------------------------------------------
629 UnoMultiPageControl::UnoMultiPageControl( const uno::Reference
< lang::XMultiServiceFactory
>& i_factory
) : ControlContainerBase( i_factory
), maTabListeners( *this )
631 maComponentInfos
.nWidth
= 280;
632 maComponentInfos
.nHeight
= 400;
635 UnoMultiPageControl::~UnoMultiPageControl()
640 void SAL_CALL
UnoMultiPageControl::inserted( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
643 void SAL_CALL
UnoMultiPageControl::removed( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
646 void SAL_CALL
UnoMultiPageControl::changed( SAL_UNUSED_PARAMETER ::sal_Int32
,
647 SAL_UNUSED_PARAMETER
const Sequence
< NamedValue
>& ) throw (RuntimeException
)
650 void SAL_CALL
UnoMultiPageControl::activated( ::sal_Int32 ID
) throw (RuntimeException
)
652 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( ID
), sal_False
);
655 void SAL_CALL
UnoMultiPageControl::deactivated( SAL_UNUSED_PARAMETER ::sal_Int32
) throw (RuntimeException
)
658 void SAL_CALL
UnoMultiPageControl::disposing(const EventObject
&) throw (RuntimeException
)
662 void SAL_CALL
UnoMultiPageControl::dispose() throw (RuntimeException
)
664 lang::EventObject aEvt
;
665 aEvt
.Source
= (::cppu::OWeakObject
*)this;
666 maTabListeners
.disposeAndClear( aEvt
);
667 ControlContainerBase::dispose();
670 // com::sun::star::awt::XSimpleTabController
671 ::sal_Int32 SAL_CALL
UnoMultiPageControl::insertTab() throw (RuntimeException
)
673 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
674 if ( !xMultiPage
.is() )
675 throw RuntimeException();
676 return xMultiPage
->insertTab();
679 void SAL_CALL
UnoMultiPageControl::removeTab( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
681 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
682 if ( !xMultiPage
.is() )
683 throw RuntimeException();
684 xMultiPage
->removeTab( ID
);
687 void SAL_CALL
UnoMultiPageControl::setTabProps( ::sal_Int32 ID
, const Sequence
< NamedValue
>& Properties
) throw (IndexOutOfBoundsException
, RuntimeException
)
689 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
690 if ( !xMultiPage
.is() )
691 throw RuntimeException();
692 xMultiPage
->setTabProps( ID
, Properties
);
695 Sequence
< NamedValue
> SAL_CALL
UnoMultiPageControl::getTabProps( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
697 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
698 if ( !xMultiPage
.is() )
699 throw RuntimeException();
700 return xMultiPage
->getTabProps( ID
);
703 void SAL_CALL
UnoMultiPageControl::activateTab( ::sal_Int32 ID
) throw (IndexOutOfBoundsException
, RuntimeException
)
705 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
706 if ( !xMultiPage
.is() )
707 throw RuntimeException();
708 xMultiPage
->activateTab( ID
);
709 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( ID
), sal_True
);
713 ::sal_Int32 SAL_CALL
UnoMultiPageControl::getActiveTabID() throw (RuntimeException
)
715 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
716 if ( !xMultiPage
.is() )
717 throw RuntimeException();
718 return xMultiPage
->getActiveTabID();
721 void SAL_CALL
UnoMultiPageControl::addTabListener( const Reference
< XTabListener
>& Listener
) throw (RuntimeException
)
723 maTabListeners
.addInterface( Listener
);
724 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
725 if ( xMultiPage
.is() && maTabListeners
.getLength() == 1 )
726 xMultiPage
->addTabListener( &maTabListeners
);
729 void SAL_CALL
UnoMultiPageControl::removeTabListener( const Reference
< XTabListener
>& Listener
) throw (RuntimeException
)
731 Reference
< XSimpleTabController
> xMultiPage( getPeer(), UNO_QUERY
);
732 if ( xMultiPage
.is() && maTabListeners
.getLength() == 1 )
733 xMultiPage
->removeTabListener( &maTabListeners
);
734 maTabListeners
.removeInterface( Listener
);
738 // lang::XTypeProvider
739 IMPL_XTYPEPROVIDER_START( UnoMultiPageControl
)
740 getCppuType( ( uno::Reference
< awt::XSimpleTabController
>* ) NULL
),
741 getCppuType( ( uno::Reference
< awt::XTabListener
>* ) NULL
),
742 ControlContainerBase::getTypes()
743 IMPL_XTYPEPROVIDER_END
746 uno::Any
UnoMultiPageControl::queryAggregation( const uno::Type
& rType
) throw(uno::RuntimeException
)
748 uno::Any aRet
= ::cppu::queryInterface( rType
,
749 (static_cast< awt::XTabListener
* >(this)), (static_cast< awt::XSimpleTabController
* >(this)) );
750 return (aRet
.hasValue() ? aRet
: ControlContainerBase::queryAggregation( rType
));
753 ::rtl::OUString
UnoMultiPageControl::GetComponentServiceName()
755 sal_Bool
bDecoration( sal_True
);
756 ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION
)) >>= bDecoration
;
758 return ::rtl::OUString("tabcontrol");
759 // Hopefully we can tweak the tabcontrol to display without tabs
760 return ::rtl::OUString("tabcontrolnotabs");
763 void UnoMultiPageControl::bindPage( const uno::Reference
< awt::XControl
>& _rxControl
)
765 uno::Reference
< awt::XWindowPeer
> xPage( _rxControl
->getPeer() );
766 uno::Reference
< awt::XSimpleTabController
> xTabCntrl( getPeer(), uno::UNO_QUERY
);
767 uno::Reference
< beans::XPropertySet
> xProps( _rxControl
->getModel(), uno::UNO_QUERY
);
769 VCLXTabPage
* pXPage
= dynamic_cast< VCLXTabPage
* >( xPage
.get() );
770 TabPage
* pPage
= pXPage
? pXPage
->getTabPage() : NULL
;
771 if ( xTabCntrl
.is() && pPage
)
773 VCLXMultiPage
* pXTab
= dynamic_cast< VCLXMultiPage
* >( xTabCntrl
.get() );
776 rtl::OUString sTitle
;
777 xProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE
) ) >>= sTitle
;
778 pXTab
->insertTab( pPage
, sTitle
);
784 void UnoMultiPageControl::createPeer( const Reference
< XToolkit
> & rxToolkit
, const Reference
< XWindowPeer
> & rParentPeer
) throw(RuntimeException
)
786 SolarMutexGuard aSolarGuard
;
788 UnoControlContainer::createPeer( rxToolkit
, rParentPeer
);
790 uno::Sequence
< uno::Reference
< awt::XControl
> > aCtrls
= getControls();
791 sal_uInt32 nCtrls
= aCtrls
.getLength();
792 for( sal_uInt32 n
= 0; n
< nCtrls
; n
++ )
793 bindPage( aCtrls
[ n
] );
794 sal_Int32
nActiveTab(0);
795 Reference
< XPropertySet
> xMultiProps( getModel(), UNO_QUERY
);
796 xMultiProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
) ) >>= nActiveTab
;
798 uno::Reference
< awt::XSimpleTabController
> xTabCntrl( getPeer(), uno::UNO_QUERY
);
799 if ( xTabCntrl
.is() )
801 xTabCntrl
->addTabListener( this );
802 if ( nActiveTab
&& nCtrls
) // Ensure peer is initialise with correct activated tab
804 xTabCntrl
->activateTab( nActiveTab
);
805 ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTIPAGEVALUE
), uno::makeAny( nActiveTab
), sal_True
);
810 void UnoMultiPageControl::impl_createControlPeerIfNecessary( const uno::Reference
< awt::XControl
>& _rxControl
)
812 OSL_PRECOND( _rxControl
.is(), "UnoMultiPageControl::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
814 // if the container already has a peer, then also create a peer for the control
815 uno::Reference
< awt::XWindowPeer
> xMyPeer( getPeer() );
819 _rxControl
->createPeer( NULL
, xMyPeer
);
820 bindPage( _rxControl
);
821 ImplActivateTabControllers();
826 // ------------- UnoMultiPageModel -----------------
828 UnoMultiPageModel::UnoMultiPageModel( const Reference
< XMultiServiceFactory
>& i_factory
) : ControlModelContainerBase( i_factory
)
830 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
831 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
832 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
833 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
835 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
836 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
837 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
838 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
839 //ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
840 ImplRegisterProperty( BASEPROPERTY_MULTIPAGEVALUE
);
841 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
842 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
845 aBool
<<= (sal_Bool
) sal_True
;
846 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
847 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
848 ImplRegisterProperty( BASEPROPERTY_DECORATION
, aBool
);
849 // MultiPage Control has the tab stop property. And the default value is True.
850 ImplRegisterProperty( BASEPROPERTY_TABSTOP
, aBool
);
852 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
853 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
856 UnoMultiPageModel::UnoMultiPageModel( const UnoMultiPageModel
& rModel
)
857 : ControlModelContainerBase( rModel
)
861 UnoMultiPageModel::~UnoMultiPageModel()
866 UnoMultiPageModel::Clone() const
868 // clone the container itself
869 UnoMultiPageModel
* pClone
= new UnoMultiPageModel( *this );
870 Clone_Impl( *pClone
);
874 ::rtl::OUString
UnoMultiPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
876 return ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageModel
);
879 uno::Any
UnoMultiPageModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
881 if ( nPropId
== BASEPROPERTY_DEFAULTCONTROL
)
884 aAny
<<= ::rtl::OUString::createFromAscii( szServiceName_UnoMultiPageControl
);
887 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
890 ::cppu::IPropertyArrayHelper
& UnoMultiPageModel::getInfoHelper()
892 static UnoPropertyArrayHelper
* pHelper
= NULL
;
895 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
896 pHelper
= new UnoPropertyArrayHelper( aIDs
);
901 // beans::XMultiPropertySet
902 uno::Reference
< beans::XPropertySetInfo
> UnoMultiPageModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
904 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
908 void UnoMultiPageModel::insertByName( const ::rtl::OUString
& aName
, const Any
& aElement
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
910 Reference
< XServiceInfo
> xInfo
;
914 throw IllegalArgumentException();
916 // Only a Page model can be inserted into the multipage
917 if ( !xInfo
->supportsService( rtl::OUString::createFromAscii( szServiceName_UnoPageModel
) ) )
918 throw IllegalArgumentException();
920 return ControlModelContainerBase::insertByName( aName
, aElement
);
923 // ----------------------------------------------------------------------------
924 sal_Bool SAL_CALL
UnoMultiPageModel::getGroupControl( ) throw (RuntimeException
)
929 // ----------------------------------------------------
930 // class UnoPageControl
931 // ----------------------------------------------------
932 UnoPageControl::UnoPageControl( const uno::Reference
< lang::XMultiServiceFactory
>& i_factory
) : ControlContainerBase( i_factory
)
934 maComponentInfos
.nWidth
= 280;
935 maComponentInfos
.nHeight
= 400;
938 UnoPageControl::~UnoPageControl()
942 ::rtl::OUString
UnoPageControl::GetComponentServiceName()
944 return ::rtl::OUString("tabpage");
948 // ------------- UnoPageModel -----------------
950 UnoPageModel::UnoPageModel( const Reference
< XMultiServiceFactory
>& i_factory
) : ControlModelContainerBase( i_factory
)
952 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
953 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
954 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
955 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
957 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
958 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
959 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
960 ImplRegisterProperty( BASEPROPERTY_TITLE
);
961 ImplRegisterProperty( BASEPROPERTY_SIZEABLE
);
962 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
963 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
964 // ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
967 aBool
<<= (sal_Bool
) sal_True
;
968 ImplRegisterProperty( BASEPROPERTY_MOVEABLE
, aBool
);
969 ImplRegisterProperty( BASEPROPERTY_CLOSEABLE
, aBool
);
970 //ImplRegisterProperty( BASEPROPERTY_TABSTOP, aBool );
972 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
973 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
976 UnoPageModel::UnoPageModel( const UnoPageModel
& rModel
)
977 : ControlModelContainerBase( rModel
)
981 UnoPageModel::~UnoPageModel()
986 UnoPageModel::Clone() const
988 // clone the container itself
989 UnoPageModel
* pClone
= new UnoPageModel( *this );
990 Clone_Impl( *pClone
);
994 ::rtl::OUString
UnoPageModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
996 return ::rtl::OUString::createFromAscii( szServiceName_UnoPageModel
);
999 uno::Any
UnoPageModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
1001 if ( nPropId
== BASEPROPERTY_DEFAULTCONTROL
)
1004 aAny
<<= ::rtl::OUString::createFromAscii( szServiceName_UnoPageControl
);
1007 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
1010 ::cppu::IPropertyArrayHelper
& UnoPageModel::getInfoHelper()
1012 static UnoPropertyArrayHelper
* pHelper
= NULL
;
1015 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
1016 pHelper
= new UnoPropertyArrayHelper( aIDs
);
1021 // beans::XMultiPropertySet
1022 uno::Reference
< beans::XPropertySetInfo
> UnoPageModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
1024 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
1028 // ----------------------------------------------------------------------------
1029 sal_Bool SAL_CALL
UnoPageModel::getGroupControl( ) throw (RuntimeException
)
1036 // ----------------------------------------------------
1037 // class UnoFrameControl
1038 // ----------------------------------------------------
1039 UnoFrameControl::UnoFrameControl( const uno::Reference
< lang::XMultiServiceFactory
>& i_factory
) : ControlContainerBase( i_factory
)
1041 maComponentInfos
.nWidth
= 280;
1042 maComponentInfos
.nHeight
= 400;
1045 UnoFrameControl::~UnoFrameControl()
1049 ::rtl::OUString
UnoFrameControl::GetComponentServiceName()
1051 return ::rtl::OUString("frame");
1054 void UnoFrameControl::ImplSetPosSize( Reference
< XControl
>& rxCtrl
)
1056 bool bOwnCtrl
= false;
1057 rtl::OUString sTitle
;
1058 if ( rxCtrl
.get() == Reference
<XControl
>( this ).get() )
1060 Reference
< XPropertySet
> xProps( getModel(), UNO_QUERY
);
1061 //xProps->getPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ) ) >>= sTitle;
1062 xProps
->getPropertyValue( GetPropertyName( BASEPROPERTY_LABEL
) ) >>= sTitle
;
1064 ControlContainerBase::ImplSetPosSize( rxCtrl
);
1065 Reference
< XWindow
> xW( rxCtrl
, UNO_QUERY
);
1066 if ( !bOwnCtrl
&& xW
.is() && !sTitle
.isEmpty() )
1068 awt::Rectangle aSizePos
= xW
->getPosSize();
1070 sal_Int32 nX
= aSizePos
.X
, nY
= aSizePos
.Y
, nWidth
= aSizePos
.Width
, nHeight
= aSizePos
.Height
;
1071 // Retrieve the values set by the base class
1072 OutputDevice
*pOutDev
= Application::GetDefaultDevice();
1075 if ( !bOwnCtrl
&& !sTitle
.isEmpty() )
1077 // Adjust Y based on height of Title
1079 aRect
= pOutDev
->GetTextRect( aRect
, sTitle
);
1080 nY
= nY
+ ( aRect
.GetHeight() / 2 );
1085 Reference
< XWindowPeer
> xPeer
= ImplGetCompatiblePeer( sal_True
);
1086 Reference
< XDevice
> xD( xPeer
, UNO_QUERY
);
1088 SimpleFontMetric aFM
;
1090 Any aVal
= ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR
) );
1093 if ( !aFD
.StyleName
.isEmpty() )
1095 Reference
< XFont
> xFont
= xD
->getFont( aFD
);
1096 aFM
= xFont
->getFontMetric();
1100 Reference
< XGraphics
> xG
= xD
->createGraphics();
1101 aFM
= xG
->getFontMetric();
1104 sal_Int16 nH
= aFM
.Ascent
+ aFM
.Descent
;
1105 if ( !bOwnCtrl
&& !sTitle
.isEmpty() )
1106 // offset y based on height of font ( not sure if my guess at the correct calculation is correct here )
1107 nY
= nY
+ ( nH
/ 8); // how do I test this
1109 xW
->setPosSize( nX
, nY
, nWidth
, nHeight
, PosSize::POSSIZE
);
1113 // ------------- UnoFrameModel -----------------
1115 UnoFrameModel::UnoFrameModel( const Reference
< XMultiServiceFactory
>& i_factory
) : ControlModelContainerBase( i_factory
)
1117 ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL
);
1118 ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR
);
1119 ImplRegisterProperty( BASEPROPERTY_ENABLED
);
1120 ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE
);
1121 ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR
);
1122 ImplRegisterProperty( BASEPROPERTY_HELPTEXT
);
1123 ImplRegisterProperty( BASEPROPERTY_HELPURL
);
1124 ImplRegisterProperty( BASEPROPERTY_PRINTABLE
);
1125 ImplRegisterProperty( BASEPROPERTY_LABEL
);
1126 ImplRegisterProperty( BASEPROPERTY_WRITING_MODE
);
1127 ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE
);
1128 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
);
1129 ImplRegisterProperty( BASEPROPERTY_HSCROLL
);
1130 ImplRegisterProperty( BASEPROPERTY_VSCROLL
);
1131 ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH
);
1132 ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT
);
1133 ImplRegisterProperty( BASEPROPERTY_SCROLLTOP
);
1134 ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT
);
1137 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
1138 ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES
, uno::makeAny( xNameCont
) );
1141 UnoFrameModel::UnoFrameModel( const UnoFrameModel
& rModel
)
1142 : ControlModelContainerBase( rModel
)
1146 UnoFrameModel::~UnoFrameModel()
1151 UnoFrameModel::Clone() const
1153 // clone the container itself
1154 UnoFrameModel
* pClone
= new UnoFrameModel( *this );
1155 Clone_Impl( *pClone
);
1159 ::rtl::OUString
UnoFrameModel::getServiceName() throw(::com::sun::star::uno::RuntimeException
)
1161 return ::rtl::OUString::createFromAscii( szServiceName_UnoFrameModel
);
1164 uno::Any
UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId
) const
1169 case BASEPROPERTY_DEFAULTCONTROL
:
1171 aAny
<<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl
);
1174 case BASEPROPERTY_SCROLLWIDTH
:
1175 case BASEPROPERTY_SCROLLHEIGHT
:
1176 case BASEPROPERTY_SCROLLTOP
:
1177 case BASEPROPERTY_SCROLLLEFT
:
1178 aAny
<<= sal_Int32(0);
1180 case BASEPROPERTY_USERFORMCONTAINEES
:
1182 uno::Reference
< XNameContainer
> xNameCont
= new SimpleNamedThingContainer
< XControlModel
>();
1183 return makeAny( xNameCont
);
1186 return ControlModelContainerBase::ImplGetDefaultValue( nPropId
);
1189 ::cppu::IPropertyArrayHelper
& UnoFrameModel::getInfoHelper()
1191 static UnoPropertyArrayHelper
* pHelper
= NULL
;
1194 uno::Sequence
<sal_Int32
> aIDs
= ImplGetPropertyIds();
1195 pHelper
= new UnoPropertyArrayHelper( aIDs
);
1200 // beans::XMultiPropertySet
1201 uno::Reference
< beans::XPropertySetInfo
> UnoFrameModel::getPropertySetInfo( ) throw(uno::RuntimeException
)
1203 static uno::Reference
< beans::XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
1207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */