1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
21 #define INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
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>
29 #include <cppuhelper/basemutex.hxx>
30 #include <cppuhelper/compbase.hxx>
31 #include <comphelper/componentguard.hxx>
32 #include <rtl/ref.hxx>
33 #include <toolkit/helper/mutexandbroadcasthelper.hxx>
40 typedef ::cppu::WeakComponentImplHelper
< css::awt::grid::XGridColumn
41 , css::lang::XServiceInfo
42 , css::lang::XUnoTunnel
44 class GridColumn
:public ::cppu::BaseMutex
45 ,public GridColumn_Base
49 GridColumn( GridColumn
const & i_copySource
);
50 virtual ~GridColumn() override
;
52 // css::awt::grid::XGridColumn
53 virtual css::uno::Any SAL_CALL
getIdentifier() override
;
54 virtual void SAL_CALL
setIdentifier(const css::uno::Any
& value
) override
;
55 virtual ::sal_Int32 SAL_CALL
getColumnWidth() override
;
56 virtual void SAL_CALL
setColumnWidth(::sal_Int32 the_value
) override
;
57 virtual ::sal_Int32 SAL_CALL
getMaxWidth() override
;
58 virtual void SAL_CALL
setMaxWidth(::sal_Int32 the_value
) override
;
59 virtual ::sal_Int32 SAL_CALL
getMinWidth() override
;
60 virtual void SAL_CALL
setMinWidth(::sal_Int32 the_value
) override
;
61 virtual sal_Bool SAL_CALL
getResizeable() override
;
62 virtual void SAL_CALL
setResizeable(sal_Bool the_value
) override
;
63 virtual ::sal_Int32 SAL_CALL
getFlexibility() override
;
64 virtual void SAL_CALL
setFlexibility( ::sal_Int32 _flexibility
) override
;
65 virtual OUString SAL_CALL
getTitle() override
;
66 virtual void SAL_CALL
setTitle(const OUString
& value
) override
;
67 virtual OUString SAL_CALL
getHelpText() override
;
68 virtual void SAL_CALL
setHelpText(const OUString
& value
) override
;
69 virtual ::sal_Int32 SAL_CALL
getIndex() override
;
70 virtual ::sal_Int32 SAL_CALL
getDataColumnIndex() override
;
71 virtual void SAL_CALL
setDataColumnIndex( ::sal_Int32 i_dataColumnIndex
) override
;
72 virtual css::style::HorizontalAlignment SAL_CALL
getHorizontalAlign() override
;
73 virtual void SAL_CALL
setHorizontalAlign(css::style::HorizontalAlignment align
) override
;
74 virtual void SAL_CALL
addGridColumnListener( const css::uno::Reference
< css::awt::grid::XGridColumnListener
>& xListener
) override
;
75 virtual void SAL_CALL
removeGridColumnListener( const css::uno::Reference
< css::awt::grid::XGridColumnListener
>& xListener
) override
;
78 virtual void SAL_CALL
disposing() override
;
80 // XCloneable (base of XGridColumn)
81 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
84 virtual OUString SAL_CALL
getImplementationName( ) override
;
85 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
86 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
88 // XUnoTunnel and friends
89 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& i_identifier
) override
;
90 static css::uno::Sequence
< sal_Int8
> getUnoTunnelId() throw();
91 static GridColumn
* getImplementation( const css::uno::Reference
< css::uno::XInterface
>& i_component
);
94 void setIndex( sal_Int32
const i_index
);
97 void broadcast_changed(
98 sal_Char
const * const i_asciiAttributeName
,
99 const css::uno::Any
& i_oldValue
,
100 const css::uno::Any
& i_newValue
,
101 ::comphelper::ComponentGuard
& i_Guard
104 template< class TYPE
>
105 void impl_set( TYPE
& io_attribute
, TYPE
const & i_newValue
, sal_Char
const * i_attributeName
)
107 ::comphelper::ComponentGuard
aGuard( *this, rBHelper
);
108 if ( io_attribute
== i_newValue
)
111 TYPE
const aOldValue( io_attribute
);
112 io_attribute
= i_newValue
;
113 broadcast_changed( i_attributeName
, css::uno::makeAny( aOldValue
), css::uno::makeAny( io_attribute
), aGuard
);
116 css::uno::Any m_aIdentifier
;
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
;
125 OUString m_sHelpText
;
126 css::style::HorizontalAlignment m_eHorizontalAlign
;
131 #endif // INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */