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 INCLUDED_FRAMEWORK_INC_TABWIN_TABWINDOW_HXX
21 #define INCLUDED_FRAMEWORK_INC_TABWIN_TABWINDOW_HXX
24 #include <macros/generic.hxx>
25 #include <macros/xinterface.hxx>
26 #include <macros/xtypeprovider.hxx>
27 #include <macros/xserviceinfo.hxx>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/lang/XTypeProvider.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/beans/PropertyValue.hpp>
35 #include <com/sun/star/awt/XWindow.hpp>
36 #include <com/sun/star/awt/XTopWindow.hpp>
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/awt/XSimpleTabController.hpp>
39 #include <com/sun/star/awt/XTabListener.hpp>
41 #include <cppuhelper/basemutex.hxx>
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>
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 private cppu::BaseMutex
,
59 public ::cppu::OBroadcastHelper
,
60 public ::cppu::OPropertySetHelper
, // => XPropertySet / XFastPropertySet / XMultiPropertySet
61 public ::cppu::OWeakObject
64 TabWindow( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& xContext
);
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
;
76 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
, std::exception
) SAL_OVERRIDE
;
79 virtual void SAL_CALL
dispose() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
80 virtual void SAL_CALL
addEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual void SAL_CALL
removeEventListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XEventListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 // XSimpleTabController
84 virtual ::sal_Int32 SAL_CALL
insertTab() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual void SAL_CALL
removeTab( ::sal_Int32 ID
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 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
, std::exception
) SAL_OVERRIDE
;
87 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
, std::exception
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
activateTab( ::sal_Int32 ID
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual ::sal_Int32 SAL_CALL
getActiveTabID( ) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual void SAL_CALL
addTabListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabListener
>& Listener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
91 virtual void SAL_CALL
removeTabListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTabListener
>& Listener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual void SAL_CALL
windowOpened( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
98 virtual void SAL_CALL
windowClosing( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual void SAL_CALL
windowClosed( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
100 virtual void SAL_CALL
windowMinimized( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
windowNormalized( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 virtual void SAL_CALL
windowActivated( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 virtual void SAL_CALL
windowDeactivated( const ::com::sun::star::lang::EventObject
& e
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual void SAL_CALL
windowResized( const css::awt::WindowEvent
& aEvent
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
107 virtual void SAL_CALL
windowMoved( const css::awt::WindowEvent
& aEvent
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
108 virtual void SAL_CALL
windowShown( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual void SAL_CALL
windowHidden( const css::lang::EventObject
& aEvent
) throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 DECL_LINK( Activate
, TabControl
* );
113 DECL_LINK_TYPED( Deactivate
, TabControl
*, bool );
117 // OPropertySetHelper
119 virtual sal_Bool SAL_CALL
convertFastPropertyValue( com::sun::star::uno::Any
& aConvertedValue
,
120 com::sun::star::uno::Any
& aOldValue
,
122 const com::sun::star::uno::Any
& aValue
) throw( com::sun::star::lang::IllegalArgumentException
) SAL_OVERRIDE
;
123 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
,
124 const com::sun::star::uno::Any
& aValue
) throw( com::sun::star::uno::Exception
, std::exception
) SAL_OVERRIDE
;
125 virtual void SAL_CALL
getFastPropertyValue( com::sun::star::uno::Any
& aValue
,
126 sal_Int32 nHandle
) const SAL_OVERRIDE
;
127 virtual ::cppu::IPropertyArrayHelper
& SAL_CALL
getInfoHelper() SAL_OVERRIDE
;
128 virtual ::com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 static const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> impl_getStaticPropertyDescriptor();
142 sal_Int32
impl_GetPageIdFromIndex( ::sal_Int32 nIndex
) const;
143 bool impl_CheckIndex( ::sal_Int32 nIndex
) const;
144 void implts_LayoutWindows() const;
145 void impl_SetTitle( const OUString
& rTitle
);
146 TabControl
* impl_GetTabControl( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
>& xTabControlWindow
) const;
147 void implts_SendNotification( Notification eNotify
, sal_Int32 ID
) const;
148 void implts_SendNotification( Notification eNotify
, sal_Int32 ID
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& rSeq
) const;
150 typedef std::vector
< sal_uInt16
> PageIdVector
;
152 bool m_bInitialized
: 1,
154 sal_Int32 m_nNextTabID
;
155 OUString m_aTitlePropName
;
156 OUString m_aPosPropName
;
157 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
158 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XTopWindow
> m_xTopWindow
;
159 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> m_xContainerWindow
;
160 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindow
> m_xTabControlWindow
;
161 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer
; // container for ALL Listener
166 #endif // INCLUDED_FRAMEWORK_INC_TABWIN_TABWINDOW_HXX
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */