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/XServiceInfo.hpp>
25 #include <com/sun/star/style/HorizontalAlignment.hpp>
27 #include <comphelper/compbase.hxx>
28 #include <comphelper/interfacecontainer4.hxx>
33 typedef comphelper::WeakComponentImplHelper
< css::awt::grid::XGridColumn
34 , css::lang::XServiceInfo
36 class GridColumn final
: public GridColumn_Base
40 GridColumn( GridColumn
const & i_copySource
);
41 virtual ~GridColumn() override
;
43 // css::awt::grid::XGridColumn
44 virtual css::uno::Any SAL_CALL
getIdentifier() override
;
45 virtual void SAL_CALL
setIdentifier(const css::uno::Any
& value
) override
;
46 virtual ::sal_Int32 SAL_CALL
getColumnWidth() override
;
47 virtual void SAL_CALL
setColumnWidth(::sal_Int32 the_value
) override
;
48 virtual ::sal_Int32 SAL_CALL
getMaxWidth() override
;
49 virtual void SAL_CALL
setMaxWidth(::sal_Int32 the_value
) override
;
50 virtual ::sal_Int32 SAL_CALL
getMinWidth() override
;
51 virtual void SAL_CALL
setMinWidth(::sal_Int32 the_value
) override
;
52 virtual sal_Bool SAL_CALL
getResizeable() override
;
53 virtual void SAL_CALL
setResizeable(sal_Bool the_value
) override
;
54 virtual ::sal_Int32 SAL_CALL
getFlexibility() override
;
55 virtual void SAL_CALL
setFlexibility( ::sal_Int32 _flexibility
) override
;
56 virtual OUString SAL_CALL
getTitle() override
;
57 virtual void SAL_CALL
setTitle(const OUString
& value
) override
;
58 virtual OUString SAL_CALL
getHelpText() override
;
59 virtual void SAL_CALL
setHelpText(const OUString
& value
) override
;
60 virtual ::sal_Int32 SAL_CALL
getIndex() override
;
61 virtual ::sal_Int32 SAL_CALL
getDataColumnIndex() override
;
62 virtual void SAL_CALL
setDataColumnIndex( ::sal_Int32 i_dataColumnIndex
) override
;
63 virtual css::style::HorizontalAlignment SAL_CALL
getHorizontalAlign() override
;
64 virtual void SAL_CALL
setHorizontalAlign(css::style::HorizontalAlignment align
) override
;
65 virtual void SAL_CALL
addGridColumnListener( const css::uno::Reference
< css::awt::grid::XGridColumnListener
>& xListener
) override
;
66 virtual void SAL_CALL
removeGridColumnListener( const css::uno::Reference
< css::awt::grid::XGridColumnListener
>& xListener
) override
;
69 virtual void disposing(std::unique_lock
<std::mutex
>&) override
;
71 // XCloneable (base of XGridColumn)
72 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
75 virtual OUString SAL_CALL
getImplementationName( ) override
;
76 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
77 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
80 void setIndex( sal_Int32
const i_index
);
83 void broadcast_changed(
84 const OUString
& i_asciiAttributeName
,
85 const css::uno::Any
& i_oldValue
,
86 const css::uno::Any
& i_newValue
,
87 std::unique_lock
<std::mutex
>& i_Guard
90 template< class TYPE
>
91 void impl_set( TYPE
& io_attribute
, TYPE
const & i_newValue
, const OUString
& i_attributeName
)
93 std::unique_lock
aGuard(m_aMutex
);
95 throw css::lang::DisposedException( OUString(), getXWeak() );
96 if ( io_attribute
== i_newValue
)
99 TYPE
const aOldValue( io_attribute
);
100 io_attribute
= i_newValue
;
101 broadcast_changed( i_attributeName
, css::uno::Any( aOldValue
), css::uno::Any( io_attribute
), aGuard
);
104 css::uno::Any m_aIdentifier
;
106 sal_Int32 m_nDataColumnIndex
;
107 sal_Int32 m_nColumnWidth
;
108 sal_Int32 m_nMaxWidth
;
109 sal_Int32 m_nMinWidth
;
110 sal_Int32 m_nFlexibility
;
113 OUString m_sHelpText
;
114 css::style::HorizontalAlignment m_eHorizontalAlign
;
115 comphelper::OInterfaceContainerHelper4
<css::awt::grid::XGridColumnListener
> maGridColumnListeners
;
120 #endif // INCLUDED_TOOLKIT_SOURCE_CONTROLS_GRID_GRIDCOLUMN_HXX
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */