1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SVTOOLS_GRIDCOLUMNFACADE_HXX
25 #define SVTOOLS_GRIDCOLUMNFACADE_HXX
26 
27 #include "svtools/table/tablemodel.hxx"
28 #include "svtools/table/tablecontrol.hxx"
29 
30 /** === begin UNO includes === **/
31 #include <com/sun/star/awt/grid/XGridColumn.hpp>
32 #include <com/sun/star/style/VerticalAlignment.hpp>
33 #include <com/sun/star/style/HorizontalAlignment.hpp>
34 /** === end UNO includes === **/
35 
36 #include <cppuhelper/implbase2.hxx>
37 #include <rtl/ref.hxx>
38 
39 #include <boost/noncopyable.hpp>
40 
41 // .....................................................................................................................
42 namespace svt { namespace table
43 {
44 // .....................................................................................................................
45 
46 	//==================================================================================================================
47 	//= UnoGridColumnFacade
48 	//==================================================================================================================
49     class ColumnChangeMultiplexer;
50     class UnoControlTableModel;
51     class UnoGridColumnFacade   :public IColumnModel
52                                 ,public ::boost::noncopyable
53     {
54     public:
55         UnoGridColumnFacade(
56             UnoControlTableModel const & i_owner,
57             ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_gridColumn
58         );
59         ~UnoGridColumnFacade();
60 
61         // IColumnModel overridables
62         virtual ::com::sun::star::uno::Any
63                                 getID() const;
64         virtual void            setID( const ::com::sun::star::uno::Any& i_ID );
65         virtual String          getName() const;
66         virtual void            setName( const String& _rName );
67         virtual String          getHelpText() const;
68         virtual void            setHelpText( const String& i_helpText );
69         virtual bool            isResizable() const;
70         virtual void            setResizable( bool _bResizable );
71         virtual sal_Int32       getFlexibility() const;
72         virtual void            setFlexibility( sal_Int32 const i_flexibility );
73         virtual TableMetrics    getWidth() const;
74         virtual void            setWidth( TableMetrics _nWidth );
75         virtual TableMetrics    getMinWidth() const;
76         virtual void            setMinWidth( TableMetrics _nMinWidth );
77         virtual TableMetrics    getMaxWidth() const;
78         virtual void            setMaxWidth( TableMetrics _nMaxWidth );
79         virtual ::com::sun::star::style::HorizontalAlignment getHorizontalAlign();
80         virtual void setHorizontalAlign(::com::sun::star::style::HorizontalAlignment _xAlign);
81 
82         /** disposes the column wrapper
83 
84             Note that the XGridColumn which is wrapped by the instance is <strong>not</strong> disposed, as we
85             do not own it.
86         */
87         void    dispose();
88 
89         sal_Int32
getDataColumnIndex() const90                 getDataColumnIndex() const { return m_nDataColumnIndex; }
91 
92         // callbacks for the XGridColumnListener
93         void    columnChanged( ColumnAttributeGroup const i_attributeGroup );
94         void    dataColumnIndexChanged();
95 
96     private:
97         void    impl_updateDataColumnIndex_nothrow();
98 
99     private:
100         UnoControlTableModel const *                                                    m_pOwner;
101         sal_Int32                                                                       m_nDataColumnIndex;
102         ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn >    m_xGridColumn;
103         ::rtl::Reference< ColumnChangeMultiplexer >                                     m_pChangeMultiplexer;
104     };
105 
106 // .....................................................................................................................
107 } } // svt::table
108 // .....................................................................................................................
109 
110 #endif // SVTOOLS_GRIDCOLUMNFACADE_HXX
111