Updated core
[LibreOffice.git] / toolkit / source / controls / grid / gridcolumn.hxx
blob8a287608a389f776a5de8bee965ca1f4c36af5cd
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/awt/grid/XGridColumn.hpp>
22 #include <com/sun/star/lang/XEventListener.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/lang/XUnoTunnel.hpp>
25 #include <com/sun/star/style/HorizontalAlignment.hpp>
27 #include <cppuhelper/basemutex.hxx>
28 #include <cppuhelper/compbase3.hxx>
29 #include <comphelper/componentguard.hxx>
30 #include <rtl/ref.hxx>
31 #include <toolkit/helper/mutexandbroadcasthelper.hxx>
33 #include <vector>
35 namespace toolkit
38 typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn
39 , ::com::sun::star::lang::XServiceInfo
40 , ::com::sun::star::lang::XUnoTunnel
41 > GridColumn_Base;
42 class GridColumn :public ::cppu::BaseMutex
43 ,public GridColumn_Base
45 public:
46 GridColumn();
47 GridColumn( GridColumn const & i_copySource );
48 virtual ~GridColumn();
50 // ::com::sun::star::awt::grid::XGridColumn
51 virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
52 virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
53 virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
54 virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
55 virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
56 virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
57 virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
58 virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
59 virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
60 virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
61 virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
62 virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
63 virtual OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL setTitle(const OUString & value) throw (::com::sun::star::uno::RuntimeException);
65 virtual OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
66 virtual void SAL_CALL setHelpText(const OUString & value) throw (::com::sun::star::uno::RuntimeException);
67 virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException);
68 virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException);
69 virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException);
70 virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
71 virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
72 virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
73 virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
75 // OComponentHelper
76 virtual void SAL_CALL disposing();
78 // XCloneable (base of XGridColumn)
79 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
81 // XServiceInfo
82 virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
83 virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
84 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
86 // XUnoTunnel and friends
87 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException);
88 static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
89 static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
91 // attribute access
92 void setIndex( sal_Int32 const i_index );
94 private:
95 void broadcast_changed(
96 sal_Char const * const i_asciiAttributeName,
97 ::com::sun::star::uno::Any i_oldValue,
98 ::com::sun::star::uno::Any i_newValue,
99 ::comphelper::ComponentGuard& i_Guard
102 template< class TYPE >
103 void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
105 ::comphelper::ComponentGuard aGuard( *this, rBHelper );
106 if ( io_attribute == i_newValue )
107 return;
109 TYPE const aOldValue( io_attribute );
110 io_attribute = i_newValue;
111 broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
114 ::com::sun::star::uno::Any m_aIdentifier;
115 sal_Int32 m_nIndex;
116 sal_Int32 m_nDataColumnIndex;
117 sal_Int32 m_nColumnWidth;
118 sal_Int32 m_nMaxWidth;
119 sal_Int32 m_nMinWidth;
120 sal_Int32 m_nFlexibility;
121 sal_Bool m_bResizeable;
122 OUString m_sTitle;
123 OUString m_sHelpText;
124 ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */