Bump version to 5.0-14
[LibreOffice.git] / dbaccess / source / ui / inc / indexfieldscontrol.hxx
blob2a0519872e605b14aea51b508c46d0111feb6534
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 // IndexFieldsControl
32 class IndexFieldsControl : public ::svt::EditBrowseBox
34 OModuleClient m_aModuleClient;
35 protected:
36 IndexFields m_aSavedValue;
38 IndexFields m_aFields; // !! order matters !!
39 IndexFields::const_iterator m_aSeekRow; // !!
41 Link<> m_aModifyHdl;
43 VclPtr< ::svt::ListBoxControl> m_pSortingCell;
44 VclPtr< ::svt::ListBoxControl> m_pFieldNameCell;
46 OUString m_sAscendingText;
47 OUString m_sDescendingText;
49 sal_Int32 m_nMaxColumnsInIndex;
50 bool m_bAddIndexAppendix;
52 public:
53 IndexFieldsControl( vcl::Window* _pParent, WinBits nWinStyle);
54 virtual ~IndexFieldsControl();
55 virtual void dispose() SAL_OVERRIDE;
57 void Init(const ::com::sun::star::uno::Sequence< OUString >& _rAvailableFields, sal_Int32 _nMaxColumnsInIndex,bool _bAddIndexAppendix);
59 void initializeFrom(const IndexFields& _rFields);
60 void commitTo(IndexFields& _rFields);
62 bool SaveModified() SAL_OVERRIDE;
63 bool IsModified() const SAL_OVERRIDE;
65 const IndexFields& GetSavedValue() const { return m_aSavedValue; }
66 void SaveValue() { m_aSavedValue = m_aFields; }
68 void SetModifyHdl(const Link<>& _rHdl) { m_aModifyHdl = _rHdl; }
69 Link<> GetModifyHdl() const { return m_aModifyHdl; }
70 virtual OUString GetCellText(long _nRow,sal_uInt16 nColId) const SAL_OVERRIDE;
72 protected:
73 // EditBrowseBox overridables
74 virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect, sal_uInt16 _nColumnId ) const SAL_OVERRIDE;
75 virtual bool SeekRow(long nRow) SAL_OVERRIDE;
76 virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
77 virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE;
79 ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
80 void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
82 protected:
83 OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
84 bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos);
86 bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
88 DECL_LINK( OnListEntrySelected, ListBox* );
90 private:
91 using ::svt::EditBrowseBox::Init;
94 } // namespace dbaui
96 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */