1f8e07b45SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f8e07b45SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f8e07b45SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f8e07b45SAndrew Rist * distributed with this work for additional information 6f8e07b45SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f8e07b45SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f8e07b45SAndrew Rist * "License"); you may not use this file except in compliance 9f8e07b45SAndrew Rist * with the License. You may obtain a copy of the License at 10f8e07b45SAndrew Rist * 11f8e07b45SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f8e07b45SAndrew Rist * 13f8e07b45SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f8e07b45SAndrew Rist * software distributed under the License is distributed on an 15f8e07b45SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f8e07b45SAndrew Rist * KIND, either express or implied. See the License for the 17f8e07b45SAndrew Rist * specific language governing permissions and limitations 18f8e07b45SAndrew Rist * under the License. 19f8e07b45SAndrew Rist * 20f8e07b45SAndrew Rist *************************************************************/ 21f8e07b45SAndrew Rist 22f8e07b45SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ 25cdf0e10cSrcweir #define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ 26cdf0e10cSrcweir 27*4e7d57d8Smseidel /** Attention: stl headers must(!) be included at first. Otherwise it can make trouble 28cdf0e10cSrcweir with solaris headers ... 29cdf0e10cSrcweir */ 30cdf0e10cSrcweir #include <vector> 31cdf0e10cSrcweir 32cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 33cdf0e10cSrcweir // my own includes 34cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <classes/fwktabwindow.hxx> 37cdf0e10cSrcweir #include <classes/propertysethelper.hxx> 38cdf0e10cSrcweir #include <threadhelp/threadhelpbase.hxx> 39cdf0e10cSrcweir #include <macros/generic.hxx> 40cdf0e10cSrcweir #include <macros/debug.hxx> 41cdf0e10cSrcweir #include <macros/xinterface.hxx> 42cdf0e10cSrcweir #include <macros/xtypeprovider.hxx> 43cdf0e10cSrcweir #include <macros/xserviceinfo.hxx> 44cdf0e10cSrcweir #include <general.h> 45cdf0e10cSrcweir #include <stdtypes.h> 46cdf0e10cSrcweir 47cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 48cdf0e10cSrcweir // interface includes 49cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <com/sun/star/awt/XSimpleTabController.hpp> 52cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 53cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 54cdf0e10cSrcweir 55cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 56cdf0e10cSrcweir // other includes 57cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 58cdf0e10cSrcweir 59cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 60cdf0e10cSrcweir #include <vcl/window.hxx> 61cdf0e10cSrcweir 62cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 63cdf0e10cSrcweir // namespace 64cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 65cdf0e10cSrcweir 66cdf0e10cSrcweir namespace framework{ 67cdf0e10cSrcweir 68cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 69cdf0e10cSrcweir // exported const 70cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 71cdf0e10cSrcweir 72cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 73cdf0e10cSrcweir // exported definitions 74cdf0e10cSrcweir //_________________________________________________________________________________________________________________ 75cdf0e10cSrcweir 76cdf0e10cSrcweir struct TTabPageInfo 77cdf0e10cSrcweir { 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir TTabPageInfoframework::TTabPageInfo80cdf0e10cSrcweir TTabPageInfo() 81cdf0e10cSrcweir : m_nIndex ( -1 ) 82cdf0e10cSrcweir , m_bCreated (sal_False) 83cdf0e10cSrcweir , m_pPage ( NULL ) 84cdf0e10cSrcweir , m_lProperties ( ) 85cdf0e10cSrcweir {} 86cdf0e10cSrcweir TTabPageInfoframework::TTabPageInfo87cdf0e10cSrcweir TTabPageInfo(::sal_Int32 nID) 88cdf0e10cSrcweir : m_nIndex ( nID ) 89cdf0e10cSrcweir , m_bCreated (sal_False) 90cdf0e10cSrcweir , m_pPage ( NULL ) 91cdf0e10cSrcweir , m_lProperties ( ) 92cdf0e10cSrcweir {} 93cdf0e10cSrcweir 94cdf0e10cSrcweir public: 95cdf0e10cSrcweir 96cdf0e10cSrcweir ::sal_Int32 m_nIndex; 97cdf0e10cSrcweir ::sal_Bool m_bCreated; 98cdf0e10cSrcweir FwkTabPage* m_pPage; 99cdf0e10cSrcweir css::uno::Sequence< css::beans::NamedValue > m_lProperties; 100cdf0e10cSrcweir }; 101cdf0e10cSrcweir 102cdf0e10cSrcweir typedef ::std::hash_map< ::sal_Int32 , 103cdf0e10cSrcweir TTabPageInfo , 104cdf0e10cSrcweir Int32HashCode , 105cdf0e10cSrcweir ::std::equal_to< ::sal_Int32 > > TTabPageInfoHash; 106cdf0e10cSrcweir 107cdf0e10cSrcweir /*-************************************************************************************************************//** 108cdf0e10cSrcweir @short implements a helper service providing a dockable tab control window 109cdf0e10cSrcweir *//*-*************************************************************************************************************/ 110cdf0e10cSrcweir 111cdf0e10cSrcweir class TabWindowService : public css::lang::XTypeProvider 112cdf0e10cSrcweir , public css::lang::XServiceInfo 113cdf0e10cSrcweir , public css::awt::XSimpleTabController 114cdf0e10cSrcweir , public css::lang::XComponent 115cdf0e10cSrcweir , public ThreadHelpBase 116cdf0e10cSrcweir , public TransactionBase 117cdf0e10cSrcweir , public PropertySetHelper 118cdf0e10cSrcweir , public ::cppu::OWeakObject 119cdf0e10cSrcweir { 120cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 121cdf0e10cSrcweir // public methods 122cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 123cdf0e10cSrcweir 124cdf0e10cSrcweir public: 125cdf0e10cSrcweir 126cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 127cdf0e10cSrcweir // constructor / destructor 128cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 129cdf0e10cSrcweir 130cdf0e10cSrcweir TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); 131cdf0e10cSrcweir virtual ~TabWindowService(); 132cdf0e10cSrcweir 133cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 134cdf0e10cSrcweir // XInterface, XTypeProvider, XServiceInfo 135cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 136cdf0e10cSrcweir 137cdf0e10cSrcweir FWK_DECLARE_XINTERFACE 138cdf0e10cSrcweir FWK_DECLARE_XTYPEPROVIDER 139cdf0e10cSrcweir DECLARE_XSERVICEINFO 140cdf0e10cSrcweir 141cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 142cdf0e10cSrcweir // XSimpleTabController 143cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 144cdf0e10cSrcweir 145cdf0e10cSrcweir virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException ); 146cdf0e10cSrcweir virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); 147cdf0e10cSrcweir virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); 148cdf0e10cSrcweir virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); 149cdf0e10cSrcweir virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); 150cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException ); 151cdf0e10cSrcweir virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); 152cdf0e10cSrcweir virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); 153cdf0e10cSrcweir 154cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 155cdf0e10cSrcweir // XComponent 156cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------------- 157cdf0e10cSrcweir 158cdf0e10cSrcweir virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); 159cdf0e10cSrcweir virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); 160cdf0e10cSrcweir virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 163cdf0e10cSrcweir // protected methods 164cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 165cdf0e10cSrcweir 166cdf0e10cSrcweir protected: 167cdf0e10cSrcweir 168cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 169cdf0e10cSrcweir // private methods 170cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 171cdf0e10cSrcweir 172cdf0e10cSrcweir private: 173cdf0e10cSrcweir 174cdf0e10cSrcweir void impl_initializePropInfo(); 175cdf0e10cSrcweir virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, 176cdf0e10cSrcweir sal_Int32 nHandle , 177cdf0e10cSrcweir const css::uno::Any& aValue ); 178cdf0e10cSrcweir virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, 179cdf0e10cSrcweir sal_Int32 nHandle ); 180cdf0e10cSrcweir 181cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * ); 182cdf0e10cSrcweir 183cdf0e10cSrcweir void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException); 184cdf0e10cSrcweir TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException); 185cdf0e10cSrcweir FwkTabWindow* mem_TabWin (); 186cdf0e10cSrcweir /* 187cdf0e10cSrcweir ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 188cdf0e10cSrcweir const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); 189cdf0e10cSrcweir static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL 190cdf0e10cSrcweir createPropertySetInfo( ::cppu::IPropertyArrayHelper& rProperties ) SAL_THROW( () ); 191cdf0e10cSrcweir */ 192cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 193cdf0e10cSrcweir // variables 194cdf0e10cSrcweir // (should be private everyway!) 195cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------- 196cdf0e10cSrcweir 197cdf0e10cSrcweir private: 198cdf0e10cSrcweir 199cdf0e10cSrcweir /// reference to factory, which has created this instance 200cdf0e10cSrcweir css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; 201cdf0e10cSrcweir 202cdf0e10cSrcweir /// the tab window as XWindow ( to hold window* alive !) 203cdf0e10cSrcweir css::uno::Reference< css::awt::XWindow > m_xTabWin; 204cdf0e10cSrcweir 205cdf0e10cSrcweir /// the VCL tab window 206cdf0e10cSrcweir FwkTabWindow* m_pTabWin; 207cdf0e10cSrcweir 208cdf0e10cSrcweir /// container of inserted tab pages 209cdf0e10cSrcweir TTabPageInfoHash m_lTabPageInfos; 210cdf0e10cSrcweir 211cdf0e10cSrcweir /// container of the added TabListener 212cdf0e10cSrcweir ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; 213cdf0e10cSrcweir 214cdf0e10cSrcweir /// counter of the tabpage indexes 215cdf0e10cSrcweir ::sal_Int32 m_nPageIndexCounter; 216cdf0e10cSrcweir 217cdf0e10cSrcweir /// index of the current active page 218cdf0e10cSrcweir ::sal_Int32 m_nCurrentPageIndex; 219cdf0e10cSrcweir 220cdf0e10cSrcweir /// title of the tabcontrolled window 221cdf0e10cSrcweir ::rtl::OUString m_sTitle; 222cdf0e10cSrcweir 223cdf0e10cSrcweir }; // class TabWindowService 224cdf0e10cSrcweir 225cdf0e10cSrcweir } // namespace framework 226cdf0e10cSrcweir 227cdf0e10cSrcweir #endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ 228cdf0e10cSrcweir 229