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: griddatamodel.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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_toolkit.hxx"
33 #include <com/sun/star/awt/grid/XGridColumnModel.hpp>
34 #include <com/sun/star/awt/grid/XGridColumn.hpp>
35 #include <com/sun/star/awt/grid/GridColumnEvent.hpp>
36 #include <com/sun/star/lang/XEventListener.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #include <cppuhelper/implbase2.hxx>
40 #include <cppuhelper/implbase3.hxx>
41 #include <rtl/ref.hxx>
43 #include <toolkit/helper/mutexandbroadcasthelper.hxx>
45 using ::rtl::OUString
;
46 using namespace ::com::sun::star
;
47 using namespace ::com::sun::star::uno
;
48 using namespace ::com::sun::star::awt
;
49 using namespace ::com::sun::star::awt::grid
;
50 using namespace ::com::sun::star::lang
;
55 enum broadcast_type
{ column_added
, column_removed
, column_changed
};
57 class DefaultGridColumnModel
: public ::cppu::WeakImplHelper2
< XGridColumnModel
, XServiceInfo
>,
58 public MutexAndBroadcastHelper
61 DefaultGridColumnModel();
62 virtual ~DefaultGridColumnModel();
66 virtual ::sal_Bool SAL_CALL
getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException
);
67 virtual void SAL_CALL
setColumnSelectionAllowed(::sal_Bool the_value
) throw (::com::sun::star::uno::RuntimeException
);
68 virtual ::sal_Int32 SAL_CALL
getColumnCount() throw (::com::sun::star::uno::RuntimeException
);
69 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
);
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::uno::RuntimeException
);
72 virtual void SAL_CALL
addColumnListener( const Reference
< XGridColumnListener
>& xListener
) throw (RuntimeException
);
73 virtual void SAL_CALL
removeColumnListener( const Reference
< XGridColumnListener
>& xListener
) throw (RuntimeException
);
76 virtual void SAL_CALL
dispose( ) throw (RuntimeException
);
77 virtual void SAL_CALL
addEventListener( const Reference
< XEventListener
>& xListener
) throw (RuntimeException
);
78 virtual void SAL_CALL
removeEventListener( const Reference
< XEventListener
>& aListener
) throw (RuntimeException
);
81 virtual ::rtl::OUString SAL_CALL
getImplementationName( ) throw (RuntimeException
);
82 virtual ::sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
) throw (RuntimeException
);
83 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( ) throw (RuntimeException
);
87 void broadcast( broadcast_type eType
, const GridColumnEvent
& aEvent
);
88 void broadcast_changed( ::rtl::OUString name
, Any oldValue
, Any newValue
);
89 void broadcast_add( sal_Int32 index
,const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridColumn
> & rColumn
);
90 void broadcast_remove( sal_Int32 index
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridColumn
> & rColumn
);
92 std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::awt::grid::XGridColumn
> > columns
;
93 sal_Bool selectionAllowed
;