Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / indexfieldscontrol.hxx
blob892a32cdbbee80c93ba7c058d8a740739551918f
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 #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
23 #include "moduledbu.hxx"
24 #include <svtools/editbrowsebox.hxx>
25 #include "indexcollection.hxx"
26 #include <com/sun/star/uno/Sequence.hxx>
28 namespace dbaui
31 class DbaMouseDownListBoxController;
33 // IndexFieldsControl
34 class IndexFieldsControl : public ::svt::EditBrowseBox
36 OModuleClient m_aModuleClient;
37 protected:
38 IndexFields m_aSavedValue;
40 IndexFields m_aFields; // !! order matters !!
41 IndexFields::const_iterator m_aSeekRow; // !!
43 Link<IndexFieldsControl&,void> m_aModifyHdl;
45 VclPtr< ::svt::ListBoxControl> m_pSortingCell;
46 VclPtr< ::svt::ListBoxControl> m_pFieldNameCell;
48 OUString m_sAscendingText;
49 OUString m_sDescendingText;
51 sal_Int32 m_nMaxColumnsInIndex;
52 bool m_bAddIndexAppendix;
54 public:
55 IndexFieldsControl( vcl::Window* _pParent, WinBits nWinStyle);
56 virtual ~IndexFieldsControl();
57 virtual void dispose() override;
59 void Init(const css::uno::Sequence< OUString >& _rAvailableFields, sal_Int32 _nMaxColumnsInIndex,bool _bAddIndexAppendix);
61 void initializeFrom(const IndexFields& _rFields);
62 void commitTo(IndexFields& _rFields);
64 bool SaveModified() override;
65 bool IsModified() const override;
67 const IndexFields& GetSavedValue() const { return m_aSavedValue; }
68 void SaveValue() { m_aSavedValue = m_aFields; }
70 void SetModifyHdl(const Link<IndexFieldsControl&,void>& _rHdl) { m_aModifyHdl = _rHdl; }
71 virtual OUString GetCellText(long _nRow,sal_uInt16 nColId) const override;
73 protected:
74 // EditBrowseBox overridables
75 virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect, sal_uInt16 _nColumnId ) const override;
76 virtual bool SeekRow(long nRow) override;
77 virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) override;
78 virtual bool IsTabAllowed(bool bForward) const override;
80 ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId) override;
81 void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId) override;
83 protected:
84 OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
85 bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos);
87 bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
89 DECL_LINK_TYPED( OnListEntrySelected, DbaMouseDownListBoxController&, void );
91 private:
92 using ::svt::EditBrowseBox::Init;
95 } // namespace dbaui
97 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */