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 .
20 #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
21 #define _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
23 #include <com/sun/star/frame/XFrameActionListener.hpp>
24 #include <com/sun/star/frame/XComponentLoader.hpp>
25 #include <com/sun/star/frame/XFrame2.hpp>
26 #include <com/sun/star/frame/FrameActionEvent.hpp>
27 #include <com/sun/star/frame/FrameAction.hpp>
28 #include <com/sun/star/lang/XServiceName.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
31 #include <cppuhelper/propshlp.hxx>
33 #include "basecontrol.hxx"
34 #include "OConnectionPointContainerHelper.hxx"
36 //______________________________________________________________________________________________________________
38 //______________________________________________________________________________________________________________
40 namespace unocontrols
{
42 #define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
43 #define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
44 #define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
45 #define PROPERTYNAME_COMPONENTURL "ComponentURL"
46 #define PROPERTYNAME_FRAME "Frame"
47 #define ERRORTEXT_VOSENSHURE "This is an invalid property handle."
48 #define PROPERTY_COUNT 3 // you must count the propertys
49 #define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
50 #define PROPERTYHANDLE_FRAME 1
51 #define PROPERTYHANDLE_LOADERARGUMENTS 2
53 //______________________________________________________________________________________________________________
55 //______________________________________________________________________________________________________________
57 class FrameControl
: public ::com::sun::star::awt::XControlModel
58 , public ::com::sun::star::lang::XConnectionPointContainer
59 , public BaseControl
// This order is necessary for right initialization of m_aMutex!
60 , public ::cppu::OBroadcastHelper
61 , public ::cppu::OPropertySetHelper
64 //______________________________________________________________________________________________________________
66 //______________________________________________________________________________________________________________
70 //__________________________________________________________________________________________________________
72 //__________________________________________________________________________________________________________
74 FrameControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
76 virtual ~FrameControl();
78 //__________________________________________________________________________________________________________
80 //__________________________________________________________________________________________________________
82 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
83 const ::com::sun::star::uno::Type
& aType
84 ) throw( ::com::sun::star::uno::RuntimeException
);
86 /**_______________________________________________________________________________________________________
87 @short increment refcount
97 @onerror A RuntimeException is thrown.
100 virtual void SAL_CALL
acquire() throw();
102 /**_______________________________________________________________________________________________________
103 @short decrement refcount
113 @onerror A RuntimeException is thrown.
116 virtual void SAL_CALL
release() throw();
118 //__________________________________________________________________________________________________________
120 //__________________________________________________________________________________________________________
122 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
123 throw( ::com::sun::star::uno::RuntimeException
);
125 //__________________________________________________________________________________________________________
127 //__________________________________________________________________________________________________________
129 ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
130 const ::com::sun::star::uno::Type
& aType
131 ) throw( ::com::sun::star::uno::RuntimeException
);
133 //__________________________________________________________________________________________________________
135 //__________________________________________________________________________________________________________
137 virtual void SAL_CALL
createPeer(
138 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& xToolkit
,
139 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
140 ) throw ( ::com::sun::star::uno::RuntimeException
);
142 virtual sal_Bool SAL_CALL
setModel(
143 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
144 ) throw( ::com::sun::star::uno::RuntimeException
);
146 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
147 throw( ::com::sun::star::uno::RuntimeException
);
149 //__________________________________________________________________________________________________________
151 //__________________________________________________________________________________________________________
153 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
155 //__________________________________________________________________________________________________________
157 //__________________________________________________________________________________________________________
159 virtual sal_Bool SAL_CALL
setGraphics(
160 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xDevice
161 ) throw( ::com::sun::star::uno::RuntimeException
);
163 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> SAL_CALL
getGraphics()
164 throw( ::com::sun::star::uno::RuntimeException
);
166 //__________________________________________________________________________________________________________
167 // XConnectionPointContainer
168 //__________________________________________________________________________________________________________
170 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getConnectionPointTypes()
171 throw( ::com::sun::star::uno::RuntimeException
);
173 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XConnectionPoint
> SAL_CALL
queryConnectionPoint(
174 const ::com::sun::star::uno::Type
& aType
175 ) throw ( ::com::sun::star::uno::RuntimeException
);
177 virtual void SAL_CALL
advise(
178 const ::com::sun::star::uno::Type
& aType
,
179 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
180 ) throw( ::com::sun::star::uno::RuntimeException
);
182 virtual void SAL_CALL
unadvise(
183 const ::com::sun::star::uno::Type
& aType
,
184 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
185 ) throw( ::com::sun::star::uno::RuntimeException
);
187 //__________________________________________________________________________________________________________
188 // impl but public methods to register service!
189 //__________________________________________________________________________________________________________
191 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
193 static const OUString
impl_getStaticImplementationName();
195 //______________________________________________________________________________________________________________
197 //______________________________________________________________________________________________________________
200 using OPropertySetHelper::getFastPropertyValue
;
201 //__________________________________________________________________________________________________________
202 // OPropertySetHelper
203 //__________________________________________________________________________________________________________
205 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
206 ::com::sun::star::uno::Any
& rConvertedValue
,
207 ::com::sun::star::uno::Any
& rOldValue
,
209 const ::com::sun::star::uno::Any
& rValue
210 ) throw( ::com::sun::star::lang::IllegalArgumentException
);
212 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
214 const ::com::sun::star::uno::Any
& rValue
215 ) throw ( ::com::sun::star::uno::Exception
);
217 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& rValue
,
218 sal_Int32 nHandle
) const ;
220 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
222 //__________________________________________________________________________________________________________
224 //__________________________________________________________________________________________________________
226 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
227 throw( ::com::sun::star::uno::RuntimeException
);
229 //__________________________________________________________________________________________________________
231 //__________________________________________________________________________________________________________
233 virtual ::com::sun::star::awt::WindowDescriptor
* impl_getWindowDescriptor(
234 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParentPeer
237 //______________________________________________________________________________________________________________
239 //______________________________________________________________________________________________________________
243 void impl_createFrame( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xPeer
,
244 const OUString
& sURL
,
245 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& seqArguments
);
247 void impl_deleteFrame();
249 static const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> impl_getStaticPropertyDescriptor();
252 //______________________________________________________________________________________________________________
254 //______________________________________________________________________________________________________________
258 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame2
> m_xFrame
;
259 OUString m_sComponentURL
;
260 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> m_seqLoaderArguments
;
261 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer
;
262 OConnectionPointContainerHelper m_aConnectionPointContainer
;
264 }; // class FrameControl
266 } // namespace unocontrols
268 #endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */