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: framecontrol.hxx,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 #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
32 #define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
34 //______________________________________________________________________________________________________________
35 // includes of other projects
36 //______________________________________________________________________________________________________________
38 #include <com/sun/star/frame/XFrameActionListener.hpp>
39 #include <com/sun/star/frame/XComponentLoader.hpp>
40 #include <com/sun/star/frame/XFrame.hpp>
41 #include <com/sun/star/frame/FrameActionEvent.hpp>
42 #include <com/sun/star/frame/FrameAction.hpp>
43 #include <com/sun/star/lang/XServiceName.hpp>
44 #include <com/sun/star/lang/XServiceInfo.hpp>
45 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
46 #include <cppuhelper/propshlp.hxx>
48 //______________________________________________________________________________________________________________
49 // includes of my own project
50 //______________________________________________________________________________________________________________
51 #include "basecontrol.hxx"
52 #include "OConnectionPointContainerHelper.hxx"
54 //______________________________________________________________________________________________________________
56 //______________________________________________________________________________________________________________
58 namespace unocontrols
{
60 #define UNO3_ANY ::com::sun::star::uno::Any
61 #define UNO3_ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException
62 #define UNO3_IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper
63 #define UNO3_OBROADCASTHELPER ::cppu::OBroadcastHelper
64 #define UNO3_OCONNECTIONPOINTCONTAINERHELPER OConnectionPointContainerHelper
65 #define UNO3_OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper
66 #define UNO3_OPROPERTYSETHELPER ::cppu::OPropertySetHelper
67 #define UNO3_OUSTRING ::rtl::OUString
68 #define UNO3_PROPERTY ::com::sun::star::beans::Property
69 #define UNO3_PROPERTYVALUE ::com::sun::star::beans::PropertyValue
70 #define UNO3_REFERENCE ::com::sun::star::uno::Reference
71 #define UNO3_RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException
72 #define UNO3_SEQUENCE ::com::sun::star::uno::Sequence
73 #define UNO3_TYPE ::com::sun::star::uno::Type
74 #define UNO3_WINDOWDESCRIPTOR ::com::sun::star::awt::WindowDescriptor
75 #define UNO3_XCONNECTIONPOINT ::com::sun::star::lang::XConnectionPoint
76 #define UNO3_XCONNECTIONPOINTCONTAINER ::com::sun::star::lang::XConnectionPointContainer
77 #define UNO3_XCONTROLMODEL ::com::sun::star::awt::XControlModel
78 #define UNO3_XFRAME ::com::sun::star::frame::XFrame
79 #define UNO3_XGRAPHICS ::com::sun::star::awt::XGraphics
80 #define UNO3_XINTERFACE ::com::sun::star::uno::XInterface
81 #define UNO3_XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory
82 #define UNO3_XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo
83 #define UNO3_XTOOLKIT ::com::sun::star::awt::XToolkit
84 #define UNO3_XWINDOWPEER ::com::sun::star::awt::XWindowPeer
86 //______________________________________________________________________________________________________________
88 //______________________________________________________________________________________________________________
90 #define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
91 #define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
92 #define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
93 #define PROPERTYNAME_COMPONENTURL "ComponentURL"
94 #define PROPERTYNAME_FRAME "Frame"
95 #define ERRORTEXT_VOSENSHURE "This is an invalid property handle."
96 #define PROPERTY_COUNT 3 // you must count the propertys
97 #define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
98 #define PROPERTYHANDLE_FRAME 1
99 #define PROPERTYHANDLE_LOADERARGUMENTS 2
101 //______________________________________________________________________________________________________________
103 //______________________________________________________________________________________________________________
105 class FrameControl
: public UNO3_XCONTROLMODEL
106 , public UNO3_XCONNECTIONPOINTCONTAINER
107 , public BaseControl
// This order is neccessary for right initialization of m_aMutex!
108 , public UNO3_OBROADCASTHELPER
109 , public UNO3_OPROPERTYSETHELPER
112 //______________________________________________________________________________________________________________
114 //______________________________________________________________________________________________________________
118 //__________________________________________________________________________________________________________
119 // construct/destruct
120 //__________________________________________________________________________________________________________
122 /**_________________________________________________________________________________________________________
135 FrameControl( const UNO3_REFERENCE
< UNO3_XMULTISERVICEFACTORY
>& xFactory
);
137 /**_________________________________________________________________________________________________________
150 virtual ~FrameControl();
152 //__________________________________________________________________________________________________________
154 //__________________________________________________________________________________________________________
156 /**_________________________________________________________________________________________________________
169 virtual UNO3_ANY SAL_CALL
queryInterface( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
171 /**_______________________________________________________________________________________________________
172 @short increment refcount
182 @onerror A RuntimeException is thrown.
185 virtual void SAL_CALL
acquire() throw();
187 /**_______________________________________________________________________________________________________
188 @short decrement refcount
198 @onerror A RuntimeException is thrown.
201 virtual void SAL_CALL
release() throw();
203 //__________________________________________________________________________________________________________
205 //__________________________________________________________________________________________________________
207 /**_________________________________________________________________________________________________________
220 virtual UNO3_SEQUENCE
< UNO3_TYPE
> SAL_CALL
getTypes() throw( UNO3_RUNTIMEEXCEPTION
);
222 //__________________________________________________________________________________________________________
224 //__________________________________________________________________________________________________________
226 /**_________________________________________________________________________________________________________
239 UNO3_ANY SAL_CALL
queryAggregation( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
241 //__________________________________________________________________________________________________________
243 //__________________________________________________________________________________________________________
245 /**_________________________________________________________________________________________________________
258 virtual void SAL_CALL
createPeer( const UNO3_REFERENCE
< UNO3_XTOOLKIT
>& xToolkit
,
259 const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xParent
) throw( UNO3_RUNTIMEEXCEPTION
);
261 /**_________________________________________________________________________________________________________
274 virtual sal_Bool SAL_CALL
setModel( const UNO3_REFERENCE
< UNO3_XCONTROLMODEL
>& xModel
) throw( UNO3_RUNTIMEEXCEPTION
);
276 /**_________________________________________________________________________________________________________
289 virtual UNO3_REFERENCE
< UNO3_XCONTROLMODEL
> SAL_CALL
getModel() throw( UNO3_RUNTIMEEXCEPTION
);
291 //__________________________________________________________________________________________________________
293 //__________________________________________________________________________________________________________
295 /**_________________________________________________________________________________________________________
308 virtual void SAL_CALL
dispose() throw( UNO3_RUNTIMEEXCEPTION
);
310 //__________________________________________________________________________________________________________
312 //__________________________________________________________________________________________________________
314 /**_________________________________________________________________________________________________________
327 virtual sal_Bool SAL_CALL
setGraphics( const UNO3_REFERENCE
< UNO3_XGRAPHICS
>& xDevice
) throw( UNO3_RUNTIMEEXCEPTION
);
329 /**_________________________________________________________________________________________________________
342 virtual UNO3_REFERENCE
< UNO3_XGRAPHICS
> SAL_CALL
getGraphics() throw( UNO3_RUNTIMEEXCEPTION
);
344 //__________________________________________________________________________________________________________
345 // XConnectionPointContainer
346 //__________________________________________________________________________________________________________
348 /**_________________________________________________________________________________________________________
361 virtual UNO3_SEQUENCE
< UNO3_TYPE
> SAL_CALL
getConnectionPointTypes() throw( UNO3_RUNTIMEEXCEPTION
);
363 /**_________________________________________________________________________________________________________
376 virtual UNO3_REFERENCE
< UNO3_XCONNECTIONPOINT
> SAL_CALL
queryConnectionPoint( const UNO3_TYPE
& aType
) throw( UNO3_RUNTIMEEXCEPTION
);
378 /**_________________________________________________________________________________________________________
391 virtual void SAL_CALL
advise( const UNO3_TYPE
& aType
,
392 const UNO3_REFERENCE
< UNO3_XINTERFACE
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
394 /**_________________________________________________________________________________________________________
407 virtual void SAL_CALL
unadvise( const UNO3_TYPE
& aType
,
408 const UNO3_REFERENCE
< UNO3_XINTERFACE
>& xListener
) throw( UNO3_RUNTIMEEXCEPTION
);
410 //__________________________________________________________________________________________________________
411 // impl but public methods to register service!
412 //__________________________________________________________________________________________________________
414 /**_________________________________________________________________________________________________________
427 static const UNO3_SEQUENCE
< UNO3_OUSTRING
> impl_getStaticSupportedServiceNames();
429 /**_________________________________________________________________________________________________________
442 static const UNO3_OUSTRING
impl_getStaticImplementationName();
444 //______________________________________________________________________________________________________________
446 //______________________________________________________________________________________________________________
449 using OPropertySetHelper::getFastPropertyValue
;
450 //__________________________________________________________________________________________________________
451 // OPropertySetHelper
452 //__________________________________________________________________________________________________________
454 /**_________________________________________________________________________________________________________
467 virtual sal_Bool SAL_CALL
convertFastPropertyValue( UNO3_ANY
& rConvertedValue
,
468 UNO3_ANY
& rOldValue
,
470 const UNO3_ANY
& rValue
) throw( UNO3_ILLEGALARGUMENTEXCEPTION
);
472 /**_________________________________________________________________________________________________________
485 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
,
486 const UNO3_ANY
& rValue
) throw ( ::com::sun::star::uno::Exception
);
488 /**_________________________________________________________________________________________________________
501 virtual void SAL_CALL
getFastPropertyValue( UNO3_ANY
& rValue
,
502 sal_Int32 nHandle
) const ;
504 /**_________________________________________________________________________________________________________
517 virtual UNO3_IPROPERTYARRAYHELPER
& SAL_CALL
getInfoHelper();
519 //__________________________________________________________________________________________________________
521 //__________________________________________________________________________________________________________
523 /**_________________________________________________________________________________________________________
536 UNO3_REFERENCE
< UNO3_XPROPERTYSETINFO
> SAL_CALL
getPropertySetInfo() throw( UNO3_RUNTIMEEXCEPTION
);
538 //__________________________________________________________________________________________________________
540 //__________________________________________________________________________________________________________
542 /**_________________________________________________________________________________________________________
555 virtual UNO3_WINDOWDESCRIPTOR
* impl_getWindowDescriptor( const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xParentPeer
);
557 //______________________________________________________________________________________________________________
559 //______________________________________________________________________________________________________________
563 /**_________________________________________________________________________________________________________
576 void impl_createFrame( const UNO3_REFERENCE
< UNO3_XWINDOWPEER
>& xPeer
,
577 const UNO3_OUSTRING
& sURL
,
578 const UNO3_SEQUENCE
< UNO3_PROPERTYVALUE
>& seqArguments
);
580 /**_________________________________________________________________________________________________________
593 void impl_deleteFrame();
595 /**_________________________________________________________________________________________________________
608 static const UNO3_SEQUENCE
< UNO3_PROPERTY
> impl_getStaticPropertyDescriptor();
611 //______________________________________________________________________________________________________________
613 //______________________________________________________________________________________________________________
617 UNO3_REFERENCE
< UNO3_XFRAME
> m_xFrame
;
618 UNO3_OUSTRING m_sComponentURL
;
619 UNO3_SEQUENCE
< UNO3_PROPERTYVALUE
> m_seqLoaderArguments
;
620 UNO3_OMULTITYPEINTERFACECONTAINERHELPER m_aInterfaceContainer
;
621 UNO3_OCONNECTIONPOINTCONTAINERHELPER m_aConnectionPointContainer
;
623 }; // class FrameControl
625 } // namespace unocontrols
627 #endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX