1*50e6b072SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*50e6b072SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*50e6b072SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*50e6b072SAndrew Rist  * distributed with this work for additional information
6*50e6b072SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*50e6b072SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*50e6b072SAndrew Rist  * "License"); you may not use this file except in compliance
9*50e6b072SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*50e6b072SAndrew Rist  *
11*50e6b072SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*50e6b072SAndrew Rist  *
13*50e6b072SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*50e6b072SAndrew Rist  * software distributed under the License is distributed on an
15*50e6b072SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*50e6b072SAndrew Rist  * KIND, either express or implied.  See the License for the
17*50e6b072SAndrew Rist  * specific language governing permissions and limitations
18*50e6b072SAndrew Rist  * under the License.
19*50e6b072SAndrew Rist  *
20*50e6b072SAndrew Rist  *************************************************************/
21*50e6b072SAndrew Rist 
22*50e6b072SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <com/sun/star/awt/grid/XGridColumn.hpp>
26cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
27cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
28cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
29cdf0e10cSrcweir #include <com/sun/star/style/HorizontalAlignment.hpp>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx>
32cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx>
33cdf0e10cSrcweir #include <comphelper/componentguard.hxx>
34cdf0e10cSrcweir #include <rtl/ref.hxx>
35cdf0e10cSrcweir #include <toolkit/helper/mutexandbroadcasthelper.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <vector>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace toolkit
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 
42cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper3    <   ::com::sun::star::awt::grid::XGridColumn
43cdf0e10cSrcweir                                             ,   ::com::sun::star::lang::XServiceInfo
44cdf0e10cSrcweir                                             ,   ::com::sun::star::lang::XUnoTunnel
45cdf0e10cSrcweir                                             >   GridColumn_Base;
46cdf0e10cSrcweir class GridColumn    :public ::cppu::BaseMutex
47cdf0e10cSrcweir                     ,public GridColumn_Base
48cdf0e10cSrcweir {
49cdf0e10cSrcweir public:
50cdf0e10cSrcweir 	GridColumn();
51cdf0e10cSrcweir     GridColumn( GridColumn const & i_copySource );
52cdf0e10cSrcweir 	virtual ~GridColumn();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	// ::com::sun::star::awt::grid::XGridColumn
55cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
56cdf0e10cSrcweir 	virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
57cdf0e10cSrcweir 	virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
58cdf0e10cSrcweir 	virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
59cdf0e10cSrcweir 	virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
60cdf0e10cSrcweir 	virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
61cdf0e10cSrcweir 	virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
62cdf0e10cSrcweir 	virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
63cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
64cdf0e10cSrcweir 	virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
65cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
66cdf0e10cSrcweir     virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
67cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
68cdf0e10cSrcweir 	virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
69cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
70cdf0e10cSrcweir 	virtual void SAL_CALL setHelpText(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException);
72cdf0e10cSrcweir     virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException);
73cdf0e10cSrcweir     virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException);
74cdf0e10cSrcweir 	virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
75cdf0e10cSrcweir 	virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
76cdf0e10cSrcweir     virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir 	virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     // OComponentHelper
80cdf0e10cSrcweir     virtual void SAL_CALL disposing();
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     // XCloneable (base of XGridColumn)
83cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone(  ) throw (::com::sun::star::uno::RuntimeException);
84cdf0e10cSrcweir 
85cdf0e10cSrcweir     // XServiceInfo
86cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
87cdf0e10cSrcweir 	virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
88cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     // XUnoTunnel and friends
91cdf0e10cSrcweir     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException);
92cdf0e10cSrcweir 	static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
93cdf0e10cSrcweir 	static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     // attribute access
96cdf0e10cSrcweir     void setIndex( sal_Int32 const i_index );
97cdf0e10cSrcweir 
98cdf0e10cSrcweir private:
99cdf0e10cSrcweir     void broadcast_changed(
100cdf0e10cSrcweir             sal_Char const * const i_asciiAttributeName,
101cdf0e10cSrcweir             ::com::sun::star::uno::Any i_oldValue,
102cdf0e10cSrcweir             ::com::sun::star::uno::Any i_newValue,
103cdf0e10cSrcweir             ::comphelper::ComponentGuard& i_Guard
104cdf0e10cSrcweir         );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     template< class TYPE >
impl_set(TYPE & io_attribute,TYPE const & i_newValue,sal_Char const * i_attributeName)107cdf0e10cSrcweir     void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
108cdf0e10cSrcweir     {
109cdf0e10cSrcweir         ::comphelper::ComponentGuard aGuard( *this, rBHelper );
110cdf0e10cSrcweir         if ( io_attribute == i_newValue )
111cdf0e10cSrcweir             return;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         TYPE const aOldValue( io_attribute );
114cdf0e10cSrcweir 	    io_attribute = i_newValue;
115cdf0e10cSrcweir         broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     ::com::sun::star::uno::Any                      m_aIdentifier;
119cdf0e10cSrcweir 	sal_Int32                                       m_nIndex;
120cdf0e10cSrcweir     sal_Int32                                       m_nDataColumnIndex;
121cdf0e10cSrcweir 	sal_Int32                                       m_nColumnWidth;
122cdf0e10cSrcweir 	sal_Int32                                       m_nMaxWidth;
123cdf0e10cSrcweir 	sal_Int32                                       m_nMinWidth;
124cdf0e10cSrcweir     sal_Int32                                       m_nFlexibility;
125cdf0e10cSrcweir 	sal_Bool                                        m_bResizeable;
126cdf0e10cSrcweir 	::rtl::OUString                                 m_sTitle;
127cdf0e10cSrcweir 	::rtl::OUString                                 m_sHelpText;
128cdf0e10cSrcweir 	::com::sun::star::style::HorizontalAlignment    m_eHorizontalAlign;
129cdf0e10cSrcweir };
130cdf0e10cSrcweir 
131cdf0e10cSrcweir }
132