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 :
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>
26 :
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>
32 :
33 : #include <vector>
34 :
35 : namespace toolkit
36 : {
37 :
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
44 : {
45 : public:
46 : GridColumn();
47 : GridColumn( GridColumn const & i_copySource );
48 : virtual ~GridColumn();
49 :
50 : // ::com::sun::star::awt::grid::XGridColumn
51 : virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
52 : virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 : virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 : virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 : virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
56 : virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 : virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
58 : virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
59 : virtual sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 : virtual void SAL_CALL setResizeable(sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
61 : virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
62 : virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 : virtual OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 : virtual void SAL_CALL setTitle(const OUString & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 : virtual OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
66 : virtual void SAL_CALL setHelpText(const OUString & value) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
67 : virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 : virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
74 :
75 : // OComponentHelper
76 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
77 :
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, std::exception) SAL_OVERRIDE;
80 :
81 : // XServiceInfo
82 : virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 :
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, std::exception) SAL_OVERRIDE;
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 );
90 :
91 : // attribute access
92 : void setIndex( sal_Int32 const i_index );
93 :
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
100 : );
101 :
102 : template< class TYPE >
103 0 : void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
104 : {
105 0 : ::comphelper::ComponentGuard aGuard( *this, rBHelper );
106 0 : if ( io_attribute == i_newValue )
107 0 : return;
108 :
109 0 : TYPE const aOldValue( io_attribute );
110 0 : io_attribute = i_newValue;
111 0 : broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
112 : }
113 :
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 : bool m_bResizeable;
122 : OUString m_sTitle;
123 : OUString m_sHelpText;
124 : ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
125 : };
126 :
127 : }
128 :
129 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|