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 #ifndef SVTOOLS_GRIDCOLUMNFACADE_HXX
29 #define SVTOOLS_GRIDCOLUMNFACADE_HXX
30 
31 #include "svtools/table/tablemodel.hxx"
32 #include "svtools/table/tablecontrol.hxx"
33 
34 /** === begin UNO includes === **/
35 #include <com/sun/star/awt/grid/XGridColumn.hpp>
36 #include <com/sun/star/style/VerticalAlignment.hpp>
37 #include <com/sun/star/style/HorizontalAlignment.hpp>
38 /** === end UNO includes === **/
39 
40 #include <cppuhelper/implbase2.hxx>
41 #include <rtl/ref.hxx>
42 
43 #include <boost/noncopyable.hpp>
44 
45 // .....................................................................................................................
46 namespace svt { namespace table
47 {
48 // .....................................................................................................................
49 
50 	//==================================================================================================================
51 	//= UnoGridColumnFacade
52 	//==================================================================================================================
53     class ColumnChangeMultiplexer;
54     class UnoControlTableModel;
55     class UnoGridColumnFacade   :public IColumnModel
56                                 ,public ::boost::noncopyable
57     {
58     public:
59         UnoGridColumnFacade(
60             UnoControlTableModel const & i_owner,
61             ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_gridColumn
62         );
63         ~UnoGridColumnFacade();
64 
65         // IColumnModel overridables
66         virtual ::com::sun::star::uno::Any
67                                 getID() const;
68         virtual void            setID( const ::com::sun::star::uno::Any& i_ID );
69         virtual String          getName() const;
70         virtual void            setName( const String& _rName );
71         virtual String          getHelpText() const;
72         virtual void            setHelpText( const String& i_helpText );
73         virtual bool            isResizable() const;
74         virtual void            setResizable( bool _bResizable );
75         virtual sal_Int32       getFlexibility() const;
76         virtual void            setFlexibility( sal_Int32 const i_flexibility );
77         virtual TableMetrics    getWidth() const;
78         virtual void            setWidth( TableMetrics _nWidth );
79         virtual TableMetrics    getMinWidth() const;
80         virtual void            setMinWidth( TableMetrics _nMinWidth );
81         virtual TableMetrics    getMaxWidth() const;
82         virtual void            setMaxWidth( TableMetrics _nMaxWidth );
83         virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
84         virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
85 
86         /** disposes the column wrapper
87 
88             Note that the XGridColumn which is wrapped by the instance is <strong>not</strong> disposed, as we
89             do not own it.
90         */
91         void    dispose();
92 
93         sal_Int32
94                 getDataColumnIndex() const { return m_nDataColumnIndex; }
95 
96         // callbacks for the XGridColumnListener
97         void    columnChanged( ColumnAttributeGroup const i_attributeGroup );
98         void    dataColumnIndexChanged();
99 
100     private:
101         void    impl_updateDataColumnIndex_nothrow();
102 
103     private:
104         UnoControlTableModel const *                                                    m_pOwner;
105         sal_Int32                                                                       m_nDataColumnIndex;
106         ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn >    m_xGridColumn;
107         ::rtl::Reference< ColumnChangeMultiplexer >                                     m_pChangeMultiplexer;
108     };
109 
110 // .....................................................................................................................
111 } } // svt::table
112 // .....................................................................................................................
113 
114 #endif // SVTOOLS_GRIDCOLUMNFACADE_HXX
115