bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / tabwin / tabwindow.hxx
blobe2bf729a153b6a1f480aab3c7be52344a7d0c2e0
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 __FRAMEWORK_TABWIN_TABWINDOW_HXX_
21 #define __FRAMEWORK_TABWIN_TABWINDOW_HXX_
23 #include <stdtypes.h>
24 #include <threadhelp/threadhelpbase.hxx>
25 #include <macros/generic.hxx>
26 #include <macros/xinterface.hxx>
27 #include <macros/xtypeprovider.hxx>
28 #include <macros/xserviceinfo.hxx>
29 #include <services.h>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XTypeProvider.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/lang/XInitialization.hpp>
35 #include <com/sun/star/beans/PropertyValue.hpp>
36 #include <com/sun/star/awt/XWindow.hpp>
37 #include <com/sun/star/awt/XTopWindow.hpp>
38 #include <com/sun/star/lang/XComponent.hpp>
39 #include <com/sun/star/awt/XSimpleTabController.hpp>
40 #include <com/sun/star/awt/XTabListener.hpp>
42 #include <cppuhelper/propshlp.hxx>
43 #include <cppuhelper/interfacecontainer.hxx>
44 #include <cppuhelper/weak.hxx>
45 #include <rtl/ustring.hxx>
46 #include <vcl/tabctrl.hxx>
48 namespace framework
51 class TabWindow : public ::com::sun::star::lang::XTypeProvider ,
52 public ::com::sun::star::lang::XServiceInfo ,
53 public ::com::sun::star::lang::XInitialization ,
54 public ::com::sun::star::lang::XComponent ,
55 public ::com::sun::star::awt::XWindowListener ,
56 public ::com::sun::star::awt::XTopWindowListener ,
57 public ::com::sun::star::awt::XSimpleTabController ,
58 protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
59 public ::cppu::OBroadcastHelper ,
60 public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet
61 public ::cppu::OWeakObject
63 public:
64 TabWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
65 virtual ~TabWindow();
67 // XInterface, XTypeProvider, XServiceInfo
68 FWK_DECLARE_XINTERFACE
69 DECLARE_XSERVICEINFO_NOFACTORY
70 FWK_DECLARE_XTYPEPROVIDER
72 using ::cppu::OPropertySetHelper::disposing;
73 using ::cppu::OPropertySetHelper::getFastPropertyValue;
75 //---------------------------------------------------------------------------------------------------------
76 // XInitialization
77 //---------------------------------------------------------------------------------------------------------
78 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);
80 //---------------------------------------------------------------------------------------------------------
81 // XComponent
82 //---------------------------------------------------------------------------------------------------------
83 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
84 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
85 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
87 //---------------------------------------------------------------------------------------------------------
88 // XSimpleTabController
89 //---------------------------------------------------------------------------------------------------------
90 virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
91 virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
92 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);
93 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);
94 virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
95 virtual ::sal_Int32 SAL_CALL getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
97 virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
99 //---------------------------------------------------------------------------------------------------------
100 // XEventListener
101 //---------------------------------------------------------------------------------------------------------
102 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
104 //---------------------------------------------------------------------------------------------------------
105 // XTopWindowListener
106 //---------------------------------------------------------------------------------------------------------
107 virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
108 virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
109 virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
110 virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
111 virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
112 virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
113 virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
115 //---------------------------------------------------------------------------------------------------------
116 // XWindowListener
117 //---------------------------------------------------------------------------------------------------------
118 virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
119 virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
120 virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
121 virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
123 protected:
124 DECL_LINK( Activate, TabControl* );
125 DECL_LINK( Deactivate, TabControl* );
127 private:
128 //---------------------------------------------------------------------------------------------------------
129 // OPropertySetHelper
130 //---------------------------------------------------------------------------------------------------------
131 virtual sal_Bool SAL_CALL convertFastPropertyValue( com::sun::star::uno::Any& aConvertedValue ,
132 com::sun::star::uno::Any& aOldValue ,
133 sal_Int32 nHandle ,
134 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException );
135 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
136 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception );
137 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
138 sal_Int32 nHandle ) const;
139 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
140 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
142 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
144 private:
145 enum Notification
147 NOTIFY_INSERTED,
148 NOTIFY_REMOVED,
149 NOTIFY_CHANGED,
150 NOTIFY_ACTIVATED,
151 NOTIFY_DEACTIVATED
154 sal_Int32 impl_GetPageIdFromIndex( ::sal_Int32 nIndex ) const;
155 sal_Bool impl_CheckIndex( ::sal_Int32 nIndex ) const;
156 void implts_LayoutWindows() const;
157 void impl_SetTitle( const OUString& rTitle );
158 TabControl* impl_GetTabControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xTabControlWindow ) const;
159 void implts_SendNotification( Notification eNotify, sal_Int32 ID ) const;
160 void implts_SendNotification( Notification eNotify, sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSeq ) const;
162 typedef std::vector< sal_uInt16 > PageIdVector;
164 sal_Bool m_bInitialized : 1,
165 m_bDisposed : 1;
166 sal_Int32 m_nNextTabID;
167 OUString m_aTitlePropName;
168 OUString m_aPosPropName;
169 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
170 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow > m_xTopWindow;
171 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xContainerWindow;
172 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xTabControlWindow;
173 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
178 #endif // __FRAMEWORK_TABWIN_TABWINDOW_HXX_
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */