1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 /** === begin UNO includes === **/ 29 #include <com/sun/star/awt/grid/XGridColumnModel.hpp> 30 #include <com/sun/star/awt/grid/XGridColumn.hpp> 31 #include <com/sun/star/lang/XEventListener.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <com/sun/star/lang/XUnoTunnel.hpp> 34 #include <com/sun/star/style/VerticalAlignment.hpp> 35 #include <com/sun/star/util/Color.hpp> 36 /** === end UNO includes === **/ 37 38 #include <cppuhelper/basemutex.hxx> 39 #include <cppuhelper/compbase2.hxx> 40 #include <comphelper/componentcontext.hxx> 41 #include <vector> 42 43 namespace comphelper 44 { 45 class ComponentGuard; 46 } 47 48 namespace toolkit 49 { 50 51 //enum broadcast_type { column_added, column_removed, column_changed}; 52 53 typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::awt::grid::XGridColumnModel 54 , ::com::sun::star::lang::XServiceInfo 55 > DefaultGridColumnModel_Base; 56 57 class DefaultGridColumnModel :public ::cppu::BaseMutex 58 ,public DefaultGridColumnModel_Base 59 { 60 public: 61 DefaultGridColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory ); 62 DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource ); 63 virtual ~DefaultGridColumnModel(); 64 65 // XGridColumnModel 66 virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); 67 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL createColumn( ) throw (::com::sun::star::uno::RuntimeException); 68 virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException); 69 virtual void SAL_CALL removeColumn( ::sal_Int32 i_columnIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); 70 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException); 71 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 72 virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException); 73 74 // XServiceInfo 75 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); 76 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 77 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); 78 79 // XContainer 80 virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 81 virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 82 83 // XCloneable 84 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); 85 86 // OComponentHelper 87 virtual void SAL_CALL disposing(); 88 89 private: 90 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > Columns; 91 92 ::comphelper::ComponentContext m_aContext; 93 ::cppu::OInterfaceContainerHelper m_aContainerListeners; 94 Columns m_aColumns; 95 }; 96 97 } 98