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 __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 ...
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>
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>
54 , m_bCreated (sal_False
)
59 TTabPageInfo(::sal_Int32 nID
)
61 , m_bCreated (sal_False
)
69 ::sal_Bool m_bCreated
;
71 css::uno::Sequence
< css::beans::NamedValue
> m_lProperties
;
74 typedef ::boost::unordered_map
< ::sal_Int32
,
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 //-------------------------------------------------------------------------------------------------------------
94 //-------------------------------------------------------------------------------------------------------------
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
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 //---------------------------------------------------------------------------------------------------------
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 //-------------------------------------------------------------------------------------------------------------
136 //-------------------------------------------------------------------------------------------------------------
140 //-------------------------------------------------------------------------------------------------------------
142 //-------------------------------------------------------------------------------------------------------------
146 void impl_initializePropInfo();
147 virtual void SAL_CALL
impl_setPropertyValue(const OUString
& sProperty
,
149 const css::uno::Any
& aValue
);
150 virtual css::uno::Any SAL_CALL
impl_getPropertyValue(const OUString
& sProperty
,
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 //-------------------------------------------------------------------------------------------------------------
160 // (should be private everyway!)
161 //-------------------------------------------------------------------------------------------------------------
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
189 }; // class TabWindowService
191 } // namespace framework
193 #endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */