Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / dbaccess / source / ui / inc / indexfieldscontrol.hxx
blob90ae7172e3dff10383cf8fc085b6989e71bfbae2
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 <svtools/editbrowsebox.hxx>
23 #include <com/sun/star/awt/XWindow.hpp>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include "indexes.hxx"
27 namespace dbaui
30 class DbaMouseDownListBoxController;
32 // IndexFieldsControl
33 class IndexFieldsControl final : public ::svt::EditBrowseBox
35 IndexFields m_aSavedValue;
37 IndexFields m_aFields; // !! order matters !!
38 IndexFields::const_iterator m_aSeekRow; // !!
40 Link<IndexFieldsControl&,void> m_aModifyHdl;
42 VclPtr< ::svt::ListBoxControl> m_pSortingCell;
43 VclPtr< ::svt::ListBoxControl> m_pFieldNameCell;
45 OUString m_sAscendingText;
46 OUString m_sDescendingText;
48 bool m_bAddIndexAppendix;
50 public:
51 IndexFieldsControl(const css::uno::Reference<css::awt::XWindow> &rParent);
52 virtual ~IndexFieldsControl() override;
53 virtual void dispose() override;
55 void Init(const css::uno::Sequence< OUString >& _rAvailableFields, bool _bAddIndexAppendix);
57 void initializeFrom(IndexFields&& _rFields);
58 void commitTo(IndexFields& _rFields);
60 bool SaveModified() override;
61 using EditBrowseBox::IsModified;
63 const IndexFields& GetSavedValue() const { return m_aSavedValue; }
64 void SaveValue() { m_aSavedValue = m_aFields; }
66 void SetModifyHdl(const Link<IndexFieldsControl&,void>& _rHdl) { m_aModifyHdl = _rHdl; }
67 virtual OUString GetCellText(sal_Int32 _nRow,sal_uInt16 nColId) const override;
69 private:
70 // EditBrowseBox overridables
71 virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect, sal_uInt16 _nColumnId ) const override;
72 virtual bool SeekRow(sal_Int32 nRow) override;
73 virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId) override;
74 virtual bool IsTabAllowed(bool bForward) const override;
76 ::svt::CellController* GetController(sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
77 void InitController(::svt::CellControllerRef&, sal_Int32 _nRow, sal_uInt16 _nColumnId) override;
79 OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
80 bool implGetFieldDesc(sal_Int32 _nRow, IndexFields::const_iterator& _rPos);
82 bool isNewField() const { return GetCurRow() >= static_cast<sal_Int32>(m_aFields.size()); }
84 DECL_LINK( OnListEntrySelected, DbaMouseDownListBoxController&, void );
86 using ::svt::EditBrowseBox::Init;
89 } // namespace dbaui
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */