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