Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
21 : #define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
22 :
23 : #include "moduledbu.hxx"
24 : #include <svtools/editbrowsebox.hxx>
25 : #include "indexcollection.hxx"
26 : #include <com/sun/star/uno/Sequence.hxx>
27 :
28 : namespace dbaui
29 : {
30 :
31 : // IndexFieldsControl
32 : class IndexFieldsControl : public ::svt::EditBrowseBox
33 : {
34 : OModuleClient m_aModuleClient;
35 : protected:
36 : IndexFields m_aSavedValue;
37 :
38 : IndexFields m_aFields; // !! order matters !!
39 : IndexFields::const_iterator m_aSeekRow; // !!
40 :
41 : Link m_aModifyHdl;
42 :
43 : ::svt::ListBoxControl* m_pSortingCell;
44 : ::svt::ListBoxControl* m_pFieldNameCell;
45 :
46 : OUString m_sAscendingText;
47 : OUString m_sDescendingText;
48 :
49 : sal_Int32 m_nMaxColumnsInIndex;
50 : sal_Bool m_bAddIndexAppendix;
51 :
52 : public:
53 : IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex,sal_Bool _bAddIndexAppendix);
54 : virtual ~IndexFieldsControl();
55 :
56 : void Init(const ::com::sun::star::uno::Sequence< OUString >& _rAvailableFields);
57 :
58 : void initializeFrom(const IndexFields& _rFields);
59 : void commitTo(IndexFields& _rFields);
60 :
61 : bool SaveModified() SAL_OVERRIDE;
62 : bool IsModified() const SAL_OVERRIDE;
63 :
64 0 : const IndexFields& GetSavedValue() const { return m_aSavedValue; }
65 0 : void SaveValue() { m_aSavedValue = m_aFields; }
66 :
67 0 : void SetModifyHdl(const Link& _rHdl) { m_aModifyHdl = _rHdl; }
68 : Link GetModifyHdl() const { return m_aModifyHdl; }
69 : virtual OUString GetCellText(long _nRow,sal_uInt16 nColId) const SAL_OVERRIDE;
70 :
71 : protected:
72 : // EditBrowseBox overridables
73 : virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect, sal_uInt16 _nColumnId ) const SAL_OVERRIDE;
74 : virtual bool SeekRow(long nRow) SAL_OVERRIDE;
75 : virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId) SAL_OVERRIDE;
76 : virtual bool IsTabAllowed(bool bForward) const SAL_OVERRIDE;
77 :
78 : ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
79 : void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
80 :
81 : protected:
82 : OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
83 : sal_Bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos);
84 :
85 0 : sal_Bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
86 :
87 : DECL_LINK( OnListEntrySelected, ListBox* );
88 :
89 : private:
90 : using ::svt::EditBrowseBox::Init;
91 : };
92 :
93 : } // namespace dbaui
94 :
95 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
96 :
97 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|