Update ooo320-m1
[ooovba.git] / framework / inc / tabwin / tabwindow.hxx
blob8e62e6fd3fbc6b34339bf477ea9c9077c28636f0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: tabwindow.hxx,v $
10 * $Revision: 1.4 $
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 __FRAMEWORK_TABWIN_TABWINDOW_HXX_
32 #define __FRAMEWORK_TABWIN_TABWINDOW_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <stdtypes.h>
39 #include <threadhelp/threadhelpbase.hxx>
40 #include <macros/generic.hxx>
41 #include <macros/xinterface.hxx>
42 #include <macros/xtypeprovider.hxx>
43 #include <macros/xserviceinfo.hxx>
44 #include <services.h>
46 //_________________________________________________________________________________________________________________
47 // interface includes
48 //_________________________________________________________________________________________________________________
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <com/sun/star/lang/XTypeProvider.hpp>
51 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 #include <com/sun/star/lang/XInitialization.hpp>
53 #include <com/sun/star/beans/PropertyValue.hpp>
54 #ifndef _COM_SUN_STAR_LANG_XWINDOW_HPP_
55 #include <com/sun/star/awt/XWindow.hpp>
56 #endif
57 #ifndef _COM_SUN_STAR_LANG_XTOPWINDOW_HPP_
58 #include <com/sun/star/awt/XTopWindow.hpp>
59 #endif
60 #include <com/sun/star/lang/XComponent.hpp>
61 #include <com/sun/star/awt/XSimpleTabController.hpp>
62 #include <com/sun/star/awt/XTabListener.hpp>
64 //_________________________________________________________________________________________________________________
65 // includes of other projects
66 //_________________________________________________________________________________________________________________
67 #include <cppuhelper/propshlp.hxx>
68 #include <cppuhelper/interfacecontainer.hxx>
69 #include <cppuhelper/weak.hxx>
70 #include <rtl/ustring.hxx>
71 #include <vcl/tabctrl.hxx>
73 namespace framework
76 class TabWindow : public ::com::sun::star::lang::XTypeProvider ,
77 public ::com::sun::star::lang::XServiceInfo ,
78 public ::com::sun::star::lang::XInitialization ,
79 public ::com::sun::star::lang::XComponent ,
80 public ::com::sun::star::awt::XWindowListener ,
81 public ::com::sun::star::awt::XTopWindowListener ,
82 public ::com::sun::star::awt::XSimpleTabController ,
83 protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
84 public ::cppu::OBroadcastHelper ,
85 public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet
86 public ::cppu::OWeakObject
88 public:
89 TabWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
90 virtual ~TabWindow();
92 // XInterface, XTypeProvider, XServiceInfo
93 FWK_DECLARE_XINTERFACE
94 DECLARE_XSERVICEINFO
95 FWK_DECLARE_XTYPEPROVIDER
97 using ::cppu::OPropertySetHelper::disposing;
98 using ::cppu::OPropertySetHelper::getFastPropertyValue;
100 //---------------------------------------------------------------------------------------------------------
101 // XInitialization
102 //---------------------------------------------------------------------------------------------------------
103 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
105 //---------------------------------------------------------------------------------------------------------
106 // XComponent
107 //---------------------------------------------------------------------------------------------------------
108 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
109 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
110 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
112 //---------------------------------------------------------------------------------------------------------
113 // XSimpleTabController
114 //---------------------------------------------------------------------------------------------------------
115 virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
116 virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
117 virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
118 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
119 virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
120 virtual ::sal_Int32 SAL_CALL getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException);
121 virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
122 virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
124 //---------------------------------------------------------------------------------------------------------
125 // XEventListener
126 //---------------------------------------------------------------------------------------------------------
127 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
129 //---------------------------------------------------------------------------------------------------------
130 // XTopWindowListener
131 //---------------------------------------------------------------------------------------------------------
132 virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
133 virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
134 virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
135 virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
136 virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
137 virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
138 virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
140 //---------------------------------------------------------------------------------------------------------
141 // XWindowListener
142 //---------------------------------------------------------------------------------------------------------
143 virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
144 virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
145 virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
146 virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
148 protected:
149 DECL_LINK( Activate, TabControl* );
150 DECL_LINK( Deactivate, TabControl* );
152 private:
153 //---------------------------------------------------------------------------------------------------------
154 // OPropertySetHelper
155 //---------------------------------------------------------------------------------------------------------
156 virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue ,
157 com::sun::star::uno::Any& aOldValue ,
158 sal_Int32 nHandle ,
159 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException );
160 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
161 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception );
162 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
163 sal_Int32 nHandle ) const;
164 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
165 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
167 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
169 private:
170 enum Notification
172 NOTIFY_INSERTED,
173 NOTIFY_REMOVED,
174 NOTIFY_CHANGED,
175 NOTIFY_ACTIVATED,
176 NOTIFY_DEACTIVATED
179 sal_Int32 impl_GetPageIdFromIndex( ::sal_Int32 nIndex ) const;
180 sal_Bool impl_CheckIndex( ::sal_Int32 nIndex ) const;
181 void implts_LayoutWindows() const;
182 void impl_SetTitle( const ::rtl::OUString& rTitle );
183 TabControl* impl_GetTabControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xTabControlWindow ) const;
184 void implts_SendNotification( Notification eNotify, sal_Int32 ID ) const;
185 void implts_SendNotification( Notification eNotify, sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSeq ) const;
187 typedef std::vector< sal_uInt16 > PageIdVector;
189 sal_Bool m_bInitialized : 1,
190 m_bDisposed : 1;
191 sal_Int32 m_nNextTabID;
192 ::rtl::OUString m_aTitlePropName;
193 ::rtl::OUString m_aPosPropName;
194 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
195 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow > m_xTopWindow;
196 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xContainerWindow;
197 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xTabControlWindow;
198 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
203 #endif // __FRAMEWORK_TABWIN_TABWINDOW_HXX_