Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
21 : #define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
22 :
23 : #include <com/sun/star/awt/grid/XGridColumn.hpp>
24 : #include <com/sun/star/lang/XEventListener.hpp>
25 : #include <com/sun/star/lang/XServiceInfo.hpp>
26 : #include <com/sun/star/lang/XUnoTunnel.hpp>
27 : #include <com/sun/star/style/HorizontalAlignment.hpp>
28 :
29 : #include <cppuhelper/basemutex.hxx>
30 : #include <cppuhelper/compbase3.hxx>
31 : #include <comphelper/componentguard.hxx>
32 : #include <rtl/ref.hxx>
33 : #include <toolkit/helper/mutexandbroadcasthelper.hxx>
34 :
35 : #include <vector>
36 :
37 : namespace toolkit
38 : {
39 :
40 : typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn
41 : , ::com::sun::star::lang::XServiceInfo
42 : , ::com::sun::star::lang::XUnoTunnel
43 : > GridColumn_Base;
44 : class GridColumn :public ::cppu::BaseMutex
45 : ,public GridColumn_Base
46 : {
47 : public:
48 : GridColumn();
49 : GridColumn( GridColumn const & i_copySource );
50 : virtual ~GridColumn();
51 :
52 : // ::com::sun::star::awt::grid::XGridColumn
53 : virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 : virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 : virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 : virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 : virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
58 : virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 : virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 : virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 : virtual sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 : virtual void SAL_CALL setResizeable(sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 : virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 : virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 : virtual OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 : virtual void SAL_CALL setTitle(const OUString & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 : virtual OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 : virtual void SAL_CALL setHelpText(const OUString & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 : virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 : virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 : virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 :
77 : // OComponentHelper
78 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
79 :
80 : // XCloneable (base of XGridColumn)
81 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 :
83 : // XServiceInfo
84 : virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 :
88 : // XUnoTunnel and friends
89 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
91 : static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
92 :
93 : // attribute access
94 : void setIndex( sal_Int32 const i_index );
95 :
96 : private:
97 : void broadcast_changed(
98 : sal_Char const * const i_asciiAttributeName,
99 : ::com::sun::star::uno::Any i_oldValue,
100 : ::com::sun::star::uno::Any i_newValue,
101 : ::comphelper::ComponentGuard& i_Guard
102 : );
103 :
104 : template< class TYPE >
105 272 : void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
106 : {
107 272 : ::comphelper::ComponentGuard aGuard( *this, rBHelper );
108 272 : if ( io_attribute == i_newValue )
109 384 : return;
110 :
111 208 : TYPE const aOldValue( io_attribute );
112 160 : io_attribute = i_newValue;
113 208 : broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
114 : }
115 :
116 : ::com::sun::star::uno::Any m_aIdentifier;
117 : sal_Int32 m_nIndex;
118 : sal_Int32 m_nDataColumnIndex;
119 : sal_Int32 m_nColumnWidth;
120 : sal_Int32 m_nMaxWidth;
121 : sal_Int32 m_nMinWidth;
122 : sal_Int32 m_nFlexibility;
123 : bool m_bResizeable;
124 : OUString m_sTitle;
125 : OUString m_sHelpText;
126 : ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
127 : };
128 :
129 : }
130 :
131 : #endif // INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|