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 /**_________________________________________________________________________________________________________
87 FrameControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
);
89 /**_________________________________________________________________________________________________________
102 virtual ~FrameControl();
104 //__________________________________________________________________________________________________________
106 //__________________________________________________________________________________________________________
108 /**_________________________________________________________________________________________________________
121 virtual ::com::sun::star::uno::Any SAL_CALL
queryInterface(
122 const ::com::sun::star::uno::Type
& aType
123 ) throw( ::com::sun::star::uno::RuntimeException
);
125 /**_______________________________________________________________________________________________________
126 @short increment refcount
136 @onerror A RuntimeException is thrown.
139 virtual void SAL_CALL
acquire() throw();
141 /**_______________________________________________________________________________________________________
142 @short decrement refcount
152 @onerror A RuntimeException is thrown.
155 virtual void SAL_CALL
release() throw();
157 //__________________________________________________________________________________________________________
159 //__________________________________________________________________________________________________________
161 /**_________________________________________________________________________________________________________
174 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getTypes()
175 throw( ::com::sun::star::uno::RuntimeException
);
177 //__________________________________________________________________________________________________________
179 //__________________________________________________________________________________________________________
181 /**_________________________________________________________________________________________________________
194 ::com::sun::star::uno::Any SAL_CALL
queryAggregation(
195 const ::com::sun::star::uno::Type
& aType
196 ) throw( ::com::sun::star::uno::RuntimeException
);
198 //__________________________________________________________________________________________________________
200 //__________________________________________________________________________________________________________
202 /**_________________________________________________________________________________________________________
215 virtual void SAL_CALL
createPeer(
216 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& xToolkit
,
217 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParent
218 ) throw ( ::com::sun::star::uno::RuntimeException
);
220 /**_________________________________________________________________________________________________________
233 virtual sal_Bool SAL_CALL
setModel(
234 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& xModel
235 ) throw( ::com::sun::star::uno::RuntimeException
);
237 /**_________________________________________________________________________________________________________
250 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
> SAL_CALL
getModel()
251 throw( ::com::sun::star::uno::RuntimeException
);
253 //__________________________________________________________________________________________________________
255 //__________________________________________________________________________________________________________
257 /**_________________________________________________________________________________________________________
270 virtual void SAL_CALL
dispose() throw( ::com::sun::star::uno::RuntimeException
);
272 //__________________________________________________________________________________________________________
274 //__________________________________________________________________________________________________________
276 /**_________________________________________________________________________________________________________
289 virtual sal_Bool SAL_CALL
setGraphics(
290 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
>& xDevice
291 ) throw( ::com::sun::star::uno::RuntimeException
);
293 /**_________________________________________________________________________________________________________
306 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XGraphics
> SAL_CALL
getGraphics()
307 throw( ::com::sun::star::uno::RuntimeException
);
309 //__________________________________________________________________________________________________________
310 // XConnectionPointContainer
311 //__________________________________________________________________________________________________________
313 /**_________________________________________________________________________________________________________
326 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Type
> SAL_CALL
getConnectionPointTypes()
327 throw( ::com::sun::star::uno::RuntimeException
);
329 /**_________________________________________________________________________________________________________
342 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XConnectionPoint
> SAL_CALL
queryConnectionPoint(
343 const ::com::sun::star::uno::Type
& aType
344 ) throw ( ::com::sun::star::uno::RuntimeException
);
346 /**_________________________________________________________________________________________________________
359 virtual void SAL_CALL
advise(
360 const ::com::sun::star::uno::Type
& aType
,
361 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
362 ) throw( ::com::sun::star::uno::RuntimeException
);
364 /**_________________________________________________________________________________________________________
377 virtual void SAL_CALL
unadvise(
378 const ::com::sun::star::uno::Type
& aType
,
379 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>& xListener
380 ) throw( ::com::sun::star::uno::RuntimeException
);
382 //__________________________________________________________________________________________________________
383 // impl but public methods to register service!
384 //__________________________________________________________________________________________________________
386 /**_________________________________________________________________________________________________________
399 static const ::com::sun::star::uno::Sequence
< OUString
> impl_getStaticSupportedServiceNames();
401 /**_________________________________________________________________________________________________________
414 static const OUString
impl_getStaticImplementationName();
416 //______________________________________________________________________________________________________________
418 //______________________________________________________________________________________________________________
421 using OPropertySetHelper::getFastPropertyValue
;
422 //__________________________________________________________________________________________________________
423 // OPropertySetHelper
424 //__________________________________________________________________________________________________________
426 /**_________________________________________________________________________________________________________
439 virtual sal_Bool SAL_CALL
convertFastPropertyValue(
440 ::com::sun::star::uno::Any
& rConvertedValue
,
441 ::com::sun::star::uno::Any
& rOldValue
,
443 const ::com::sun::star::uno::Any
& rValue
444 ) throw( ::com::sun::star::lang::IllegalArgumentException
);
446 /**_________________________________________________________________________________________________________
459 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(
461 const ::com::sun::star::uno::Any
& rValue
462 ) throw ( ::com::sun::star::uno::Exception
);
464 /**_________________________________________________________________________________________________________
477 virtual void SAL_CALL
getFastPropertyValue( ::com::sun::star::uno::Any
& rValue
,
478 sal_Int32 nHandle
) const ;
480 /**_________________________________________________________________________________________________________
493 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper();
495 //__________________________________________________________________________________________________________
497 //__________________________________________________________________________________________________________
499 /**_________________________________________________________________________________________________________
512 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo()
513 throw( ::com::sun::star::uno::RuntimeException
);
515 //__________________________________________________________________________________________________________
517 //__________________________________________________________________________________________________________
519 /**_________________________________________________________________________________________________________
532 virtual ::com::sun::star::awt::WindowDescriptor
* impl_getWindowDescriptor(
533 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xParentPeer
536 //______________________________________________________________________________________________________________
538 //______________________________________________________________________________________________________________
542 /**_________________________________________________________________________________________________________
555 void impl_createFrame( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& xPeer
,
556 const OUString
& sURL
,
557 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& seqArguments
);
559 /**_________________________________________________________________________________________________________
572 void impl_deleteFrame();
574 /**_________________________________________________________________________________________________________
587 static const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> impl_getStaticPropertyDescriptor();
590 //______________________________________________________________________________________________________________
592 //______________________________________________________________________________________________________________
596 ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame2
> m_xFrame
;
597 OUString m_sComponentURL
;
598 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> m_seqLoaderArguments
;
599 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer
;
600 OConnectionPointContainerHelper m_aConnectionPointContainer
;
602 }; // class FrameControl
604 } // namespace unocontrols
606 #endif // #ifndef _UNOCONTROLS_FRAMECONTROL_CTRL_HXX
608 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */