update credits
[LibreOffice.git] / UnoControls / source / inc / framecontrol.hxx
blobe1b48b7f96db6fde1c5a4f614f061dd43c702ba8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_UNOCONTROLS_SOURCE_INC_FRAMECONTROL_HXX
21 #define INCLUDED_UNOCONTROLS_SOURCE_INC_FRAMECONTROL_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 // namespaces
38 namespace unocontrols{
40 #define SERVICENAME_FRAMECONTROL "com.sun.star.frame.FrameControl"
41 #define IMPLEMENTATIONNAME_FRAMECONTROL "stardiv.UnoControls.FrameControl"
42 #define PROPERTYNAME_LOADERARGUMENTS "LoaderArguments"
43 #define PROPERTYNAME_COMPONENTURL "ComponentURL"
44 #define PROPERTYNAME_FRAME "Frame"
45 #define PROPERTY_COUNT 3 // you must count the properties
46 #define PROPERTYHANDLE_COMPONENTURL 0 // Id must be the index into the array
47 #define PROPERTYHANDLE_FRAME 1
48 #define PROPERTYHANDLE_LOADERARGUMENTS 2
50 // class
52 class FrameControl : public ::com::sun::star::awt::XControlModel
53 , public ::com::sun::star::lang::XConnectionPointContainer
54 , public BaseControl // This order is necessary for right initialization of m_aMutex!
55 , public ::cppu::OBroadcastHelper
56 , public ::cppu::OPropertySetHelper
59 // public methods
61 public:
63 // construct/destruct
65 FrameControl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
67 virtual ~FrameControl();
69 // XInterface
71 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
72 const ::com::sun::star::uno::Type& aType
73 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
75 /**_______________________________________________________________________________________________________
76 @short increment refcount
77 @seealso XInterface
78 @seealso release()
79 @onerror A RuntimeException is thrown.
82 virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
84 /**_______________________________________________________________________________________________________
85 @short decrement refcount
86 @seealso XInterface
87 @seealso acquire()
88 @onerror A RuntimeException is thrown.
91 virtual void SAL_CALL release() throw() SAL_OVERRIDE;
93 // XTypeProvider
95 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
96 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
98 // XAggregation
100 ::com::sun::star::uno::Any SAL_CALL queryAggregation(
101 const ::com::sun::star::uno::Type& aType
102 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
104 OUString SAL_CALL getImplementationName()
105 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
107 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
108 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
110 // XControl
112 virtual void SAL_CALL createPeer(
113 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& xToolkit ,
114 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent
115 ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
117 virtual sal_Bool SAL_CALL setModel(
118 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel
119 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
121 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel()
122 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
124 // XComponent
126 virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
128 // XView
130 virtual sal_Bool SAL_CALL setGraphics(
131 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xDevice
132 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
134 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics()
135 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
137 // XConnectionPointContainer
139 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getConnectionPointTypes()
140 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
142 virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XConnectionPoint > SAL_CALL queryConnectionPoint(
143 const ::com::sun::star::uno::Type& aType
144 ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
146 virtual void SAL_CALL advise(
147 const ::com::sun::star::uno::Type& aType ,
148 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xListener
149 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
151 virtual void SAL_CALL unadvise(
152 const ::com::sun::star::uno::Type& aType ,
153 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xListener
154 ) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
156 // impl but public methods to register service!
158 static const ::com::sun::star::uno::Sequence< OUString > impl_getStaticSupportedServiceNames();
160 static const OUString impl_getStaticImplementationName();
162 // protected methods
164 protected:
165 using OPropertySetHelper::getFastPropertyValue;
167 // OPropertySetHelper
169 virtual sal_Bool SAL_CALL convertFastPropertyValue(
170 ::com::sun::star::uno::Any& rConvertedValue ,
171 ::com::sun::star::uno::Any& rOldValue ,
172 sal_Int32 nHandle ,
173 const ::com::sun::star::uno::Any& rValue
174 ) throw( ::com::sun::star::lang::IllegalArgumentException ) SAL_OVERRIDE;
176 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
177 sal_Int32 nHandle ,
178 const ::com::sun::star::uno::Any& rValue
179 ) throw ( ::com::sun::star::uno::Exception, std::exception ) SAL_OVERRIDE;
181 virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue ,
182 sal_Int32 nHandle ) const SAL_OVERRIDE;
184 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
186 // XPropertySet
188 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
189 throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
191 // BaseControl
193 virtual ::com::sun::star::awt::WindowDescriptor* impl_getWindowDescriptor(
194 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParentPeer
195 ) SAL_OVERRIDE;
197 // private methods
199 private:
201 void impl_createFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xPeer ,
202 const OUString& sURL ,
203 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& seqArguments );
205 void impl_deleteFrame();
207 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
209 // private variables
211 private:
213 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame2 > m_xFrame;
214 OUString m_sComponentURL;
215 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_seqLoaderArguments;
216 ::cppu::OMultiTypeInterfaceContainerHelper m_aInterfaceContainer;
217 OConnectionPointContainerHelper m_aConnectionPointContainer;
219 }; // class FrameControl
221 } // namespace unocontrols
223 #endif // INCLUDED_UNOCONTROLS_SOURCE_INC_FRAMECONTROL_HXX
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */