Avoid potential negative array index access to cached text.
[LibreOffice.git] / toolkit / source / controls / unogridcolumnfacade.hxx
blob580aee52bc89de14c6b236f2dd2fa8248a4f2ddc
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 .
20 #pragma once
22 #include <controls/table/tablemodel.hxx>
24 #include <com/sun/star/awt/grid/XGridColumn.hpp>
25 #include <com/sun/star/style/HorizontalAlignment.hpp>
27 #include <rtl/ref.hxx>
30 namespace svt::table
34 //= UnoGridColumnFacade
36 class ColumnChangeMultiplexer;
37 class UnoControlTableModel;
38 class UnoGridColumnFacade :public IColumnModel
40 public:
41 UnoGridColumnFacade(
42 UnoControlTableModel const & i_owner,
43 css::uno::Reference< css::awt::grid::XGridColumn > const & i_gridColumn
45 virtual ~UnoGridColumnFacade() override;
46 UnoGridColumnFacade(const UnoGridColumnFacade&) = delete;
47 UnoGridColumnFacade& operator=(const UnoGridColumnFacade&) = delete;
49 // IColumnModel overridables
50 virtual OUString getName() const override;
51 virtual OUString getHelpText() const override;
52 virtual bool isResizable() const override;
53 virtual sal_Int32 getFlexibility() const override;
54 virtual TableMetrics getWidth() const override;
55 virtual void setWidth( TableMetrics _nWidth ) override;
56 virtual TableMetrics getMinWidth() const override;
57 virtual TableMetrics getMaxWidth() const override;
58 virtual css::style::HorizontalAlignment getHorizontalAlign() override;
60 /** disposes the column wrapper
62 Note that the XGridColumn which is wrapped by the instance is <strong>not</strong> disposed, as we
63 do not own it.
65 void dispose();
67 sal_Int32
68 getDataColumnIndex() const { return m_nDataColumnIndex; }
70 // callbacks for the XGridColumnListener
71 void columnChanged( ColumnAttributeGroup const i_attributeGroup );
72 void dataColumnIndexChanged();
74 private:
75 void impl_updateDataColumnIndex_nothrow();
77 private:
78 UnoControlTableModel const * m_pOwner;
79 sal_Int32 m_nDataColumnIndex;
80 css::uno::Reference< css::awt::grid::XGridColumn > m_xGridColumn;
81 ::rtl::Reference< ColumnChangeMultiplexer > m_pChangeMultiplexer;
85 } // svt::table
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */