1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: urltransformer.hxx,v $
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_SERVICES_TABWINDOWSERVICE_HXX_
32 #define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
34 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
35 with solaris headers ...
39 //_________________________________________________________________________________________________________________
41 //_________________________________________________________________________________________________________________
43 #include <classes/fwktabwindow.hxx>
44 #include <classes/propertysethelper.hxx>
45 #include <threadhelp/threadhelpbase.hxx>
46 #include <macros/generic.hxx>
47 #include <macros/debug.hxx>
48 #include <macros/xinterface.hxx>
49 #include <macros/xtypeprovider.hxx>
50 #include <macros/xserviceinfo.hxx>
54 //_________________________________________________________________________________________________________________
56 //_________________________________________________________________________________________________________________
58 #include <com/sun/star/awt/XSimpleTabController.hpp>
59 #include <com/sun/star/awt/XWindow.hpp>
60 #include <com/sun/star/beans/XPropertySet.hpp>
62 //_________________________________________________________________________________________________________________
64 //_________________________________________________________________________________________________________________
66 #include <cppuhelper/weak.hxx>
67 #include <vcl/window.hxx>
69 //_________________________________________________________________________________________________________________
71 //_________________________________________________________________________________________________________________
75 //_________________________________________________________________________________________________________________
77 //_________________________________________________________________________________________________________________
79 //_________________________________________________________________________________________________________________
80 // exported definitions
81 //_________________________________________________________________________________________________________________
89 , m_bCreated (sal_False
)
94 TTabPageInfo(::sal_Int32 nID
)
96 , m_bCreated (sal_False
)
103 ::sal_Int32 m_nIndex
;
104 ::sal_Bool m_bCreated
;
106 css::uno::Sequence
< css::beans::NamedValue
> m_lProperties
;
109 typedef ::std::hash_map
< ::sal_Int32
,
112 ::std::equal_to
< ::sal_Int32
> > TTabPageInfoHash
;
114 /*-************************************************************************************************************//**
115 @short implements a helper service providing a dockable tab control window
116 *//*-*************************************************************************************************************/
118 class TabWindowService
: public css::lang::XTypeProvider
119 , public css::lang::XServiceInfo
120 , public css::awt::XSimpleTabController
121 , public ThreadHelpBase
122 , public TransactionBase
123 , public PropertySetHelper
124 , public ::cppu::OWeakObject
126 //-------------------------------------------------------------------------------------------------------------
128 //-------------------------------------------------------------------------------------------------------------
132 //---------------------------------------------------------------------------------------------------------
133 // constructor / destructor
134 //---------------------------------------------------------------------------------------------------------
136 TabWindowService( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xFactory
);
137 virtual ~TabWindowService();
139 //---------------------------------------------------------------------------------------------------------
140 // XInterface, XTypeProvider, XServiceInfo
141 //---------------------------------------------------------------------------------------------------------
143 FWK_DECLARE_XINTERFACE
144 FWK_DECLARE_XTYPEPROVIDER
147 //---------------------------------------------------------------------------------------------------------
148 // XSimpleTabController
149 //---------------------------------------------------------------------------------------------------------
151 virtual sal_Int32 SAL_CALL
insertTab() throw ( css::uno::RuntimeException
);
152 virtual void SAL_CALL
removeTab( sal_Int32 nID
) throw ( css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
);
153 virtual void SAL_CALL
setTabProps( sal_Int32 nID
, const css::uno::Sequence
< css::beans::NamedValue
>& aProperties
) throw ( css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
);
154 virtual css::uno::Sequence
< css::beans::NamedValue
> SAL_CALL
getTabProps( sal_Int32 nID
) throw ( css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
);
155 virtual void SAL_CALL
activateTab( sal_Int32 nID
) throw ( css::lang::IndexOutOfBoundsException
, css::uno::RuntimeException
);
156 virtual sal_Int32 SAL_CALL
getActiveTabID() throw ( css::uno::RuntimeException
);
157 virtual void SAL_CALL
addTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) throw ( css::uno::RuntimeException
);
158 virtual void SAL_CALL
removeTabListener( const css::uno::Reference
< css::awt::XTabListener
>& Listener
) throw ( css::uno::RuntimeException
);
160 //---------------------------------------------------------------------------------------------------------
162 //---------------------------------------------------------------------------------------------------------
164 virtual void SAL_CALL
dispose() throw ( css::uno::RuntimeException
);
165 virtual void SAL_CALL
addEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw ( css::uno::RuntimeException
);
166 virtual void SAL_CALL
removeEventListener( const css::uno::Reference
< css::lang::XEventListener
>& xListener
) throw ( css::uno::RuntimeException
);
168 //-------------------------------------------------------------------------------------------------------------
170 //-------------------------------------------------------------------------------------------------------------
174 //-------------------------------------------------------------------------------------------------------------
176 //-------------------------------------------------------------------------------------------------------------
180 void impl_initializePropInfo();
181 virtual void SAL_CALL
impl_setPropertyValue(const ::rtl::OUString
& sProperty
,
183 const css::uno::Any
& aValue
);
184 virtual css::uno::Any SAL_CALL
impl_getPropertyValue(const ::rtl::OUString
& sProperty
,
187 DECL_DLLPRIVATE_LINK( EventListener
, VclSimpleEvent
* );
189 void impl_checkTabIndex (::sal_Int32 nID
) throw (css::lang::IndexOutOfBoundsException
);
190 TTabPageInfoHash::iterator
impl_getTabPageInfo(::sal_Int32 nID
) throw (css::lang::IndexOutOfBoundsException
);
191 FwkTabWindow
* mem_TabWin ();
193 ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
194 const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
195 static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL
196 createPropertySetInfo( ::cppu::IPropertyArrayHelper& rProperties ) SAL_THROW( () );
198 //-------------------------------------------------------------------------------------------------------------
200 // (should be private everyway!)
201 //-------------------------------------------------------------------------------------------------------------
205 /// reference to factory, which has created this instance
206 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xFactory
;
208 /// the tab window as XWindow ( to hold window* alive !)
209 css::uno::Reference
< css::awt::XWindow
> m_xTabWin
;
211 /// the VCL tab window
212 FwkTabWindow
* m_pTabWin
;
214 /// container of inserted tab pages
215 TTabPageInfoHash m_lTabPageInfos
;
217 /// container of the added TabListener
218 ::cppu::OMultiTypeInterfaceContainerHelper m_lListener
;
220 /// counter of the tabpage indexes
221 ::sal_Int32 m_nPageIndexCounter
;
223 /// index of the current active page
224 ::sal_Int32 m_nCurrentPageIndex
;
226 /// title of the tabcontrolled window
227 ::rtl::OUString m_sTitle
;
229 }; // class TabWindowService
231 } // namespace framework
233 #endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_