bump product version to 4.1.6.2
[LibreOffice.git] / framework / inc / services / tabwindowservice.hxx
blobb7ab2d0e5dcd80ef474142f31935b6061d41707b
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_SERVICES_TABWINDOWSERVICE_HXX_
21 #define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
23 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
24 with solaris headers ...
26 #include <vector>
28 #include <classes/fwktabwindow.hxx>
29 #include <classes/propertysethelper.hxx>
30 #include <threadhelp/threadhelpbase.hxx>
31 #include <macros/generic.hxx>
32 #include <macros/debug.hxx>
33 #include <macros/xinterface.hxx>
34 #include <macros/xtypeprovider.hxx>
35 #include <macros/xserviceinfo.hxx>
36 #include <general.h>
37 #include <stdtypes.h>
39 #include <com/sun/star/awt/XSimpleTabController.hpp>
40 #include <com/sun/star/awt/XWindow.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
43 #include <cppuhelper/weak.hxx>
44 #include <vcl/window.hxx>
46 namespace framework{
48 struct TTabPageInfo
50 public:
52 TTabPageInfo()
53 : m_nIndex ( -1 )
54 , m_bCreated (sal_False)
55 , m_pPage ( NULL )
56 , m_lProperties ( )
59 TTabPageInfo(::sal_Int32 nID)
60 : m_nIndex ( nID )
61 , m_bCreated (sal_False)
62 , m_pPage ( NULL )
63 , m_lProperties ( )
66 public:
68 ::sal_Int32 m_nIndex;
69 ::sal_Bool m_bCreated;
70 FwkTabPage* m_pPage;
71 css::uno::Sequence< css::beans::NamedValue > m_lProperties;
74 typedef ::boost::unordered_map< ::sal_Int32 ,
75 TTabPageInfo ,
76 Int32HashCode ,
77 ::std::equal_to< ::sal_Int32 > > TTabPageInfoHash;
79 /*-************************************************************************************************************//**
80 @short implements a helper service providing a dockable tab control window
81 *//*-*************************************************************************************************************/
83 class TabWindowService : public css::lang::XTypeProvider
84 , public css::lang::XServiceInfo
85 , public css::awt::XSimpleTabController
86 , public css::lang::XComponent
87 , public ThreadHelpBase
88 , public TransactionBase
89 , public PropertySetHelper
90 , public ::cppu::OWeakObject
92 //-------------------------------------------------------------------------------------------------------------
93 // public methods
94 //-------------------------------------------------------------------------------------------------------------
96 public:
98 //---------------------------------------------------------------------------------------------------------
99 // constructor / destructor
100 //---------------------------------------------------------------------------------------------------------
102 TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
103 virtual ~TabWindowService();
105 //---------------------------------------------------------------------------------------------------------
106 // XInterface, XTypeProvider, XServiceInfo
107 //---------------------------------------------------------------------------------------------------------
109 FWK_DECLARE_XINTERFACE
110 FWK_DECLARE_XTYPEPROVIDER
111 DECLARE_XSERVICEINFO
113 //---------------------------------------------------------------------------------------------------------
114 // XSimpleTabController
115 //---------------------------------------------------------------------------------------------------------
117 virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException );
118 virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
119 virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
120 virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
121 virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
122 virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException );
123 virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
124 virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
126 //---------------------------------------------------------------------------------------------------------
127 // XComponent
128 //---------------------------------------------------------------------------------------------------------
130 virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
131 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
132 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
134 //-------------------------------------------------------------------------------------------------------------
135 // protected methods
136 //-------------------------------------------------------------------------------------------------------------
138 protected:
140 //-------------------------------------------------------------------------------------------------------------
141 // private methods
142 //-------------------------------------------------------------------------------------------------------------
144 private:
146 void impl_initializePropInfo();
147 virtual void SAL_CALL impl_setPropertyValue(const OUString& sProperty,
148 sal_Int32 nHandle ,
149 const css::uno::Any& aValue );
150 virtual css::uno::Any SAL_CALL impl_getPropertyValue(const OUString& sProperty,
151 sal_Int32 nHandle );
153 DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * );
155 void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
156 TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
157 FwkTabWindow* mem_TabWin ();
158 //-------------------------------------------------------------------------------------------------------------
159 // variables
160 // (should be private everyway!)
161 //-------------------------------------------------------------------------------------------------------------
163 private:
165 /// reference to factory, which has created this instance
166 css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
168 /// the tab window as XWindow ( to hold window* alive !)
169 css::uno::Reference< css::awt::XWindow > m_xTabWin;
171 /// the VCL tab window
172 FwkTabWindow* m_pTabWin;
174 /// container of inserted tab pages
175 TTabPageInfoHash m_lTabPageInfos;
177 /// container of the added TabListener
178 ::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
180 /// counter of the tabpage indexes
181 ::sal_Int32 m_nPageIndexCounter;
183 /// index of the current active page
184 ::sal_Int32 m_nCurrentPageIndex;
186 /// title of the tabcontrolled window
187 OUString m_sTitle;
189 }; // class TabWindowService
191 } // namespace framework
193 #endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */