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 _DBAUI_INDEXFIELDSCONTROL_HXX_
21 : #define _DBAUI_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 : //......................................................................
29 : namespace dbaui
30 : {
31 : //......................................................................
32 :
33 : //==================================================================
34 : // IndexFieldsControl
35 : //==================================================================
36 : class IndexFieldsControl : public ::svt::EditBrowseBox
37 : {
38 : OModuleClient m_aModuleClient;
39 : protected:
40 : IndexFields m_aSavedValue;
41 :
42 : IndexFields m_aFields; // !! order matters !!
43 : ConstIndexFieldsIterator m_aSeekRow; // !!
44 :
45 : Link m_aModifyHdl;
46 :
47 : ::svt::ListBoxControl* m_pSortingCell;
48 : ::svt::ListBoxControl* m_pFieldNameCell;
49 :
50 : String m_sAscendingText;
51 : String m_sDescendingText;
52 :
53 : sal_Int32 m_nMaxColumnsInIndex;
54 : sal_Bool m_bAddIndexAppendix;
55 :
56 : public:
57 : IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex,sal_Bool _bAddIndexAppendix);
58 : ~IndexFieldsControl();
59 :
60 : void Init(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rAvailableFields);
61 :
62 : void initializeFrom(const IndexFields& _rFields);
63 : void commitTo(IndexFields& _rFields);
64 :
65 : sal_Bool SaveModified();
66 : sal_Bool IsModified() const;
67 :
68 0 : const IndexFields& GetSavedValue() const { return m_aSavedValue; }
69 0 : void SaveValue() { m_aSavedValue = m_aFields; }
70 :
71 0 : void SetModifyHdl(const Link& _rHdl) { m_aModifyHdl = _rHdl; }
72 : Link GetModifyHdl() const { return m_aModifyHdl; }
73 : virtual String GetCellText(long _nRow,sal_uInt16 nColId) const;
74 :
75 : protected:
76 : // EditBrowseBox overridables
77 : virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect, sal_uInt16 _nColumnId ) const;
78 : virtual sal_Bool SeekRow(long nRow);
79 : virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
80 : virtual sal_Bool IsTabAllowed(sal_Bool bForward) const;
81 :
82 : ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId);
83 : void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId);
84 :
85 : protected:
86 : String GetRowCellText(const ConstIndexFieldsIterator& _rRow,sal_uInt16 nColId) const;
87 : sal_Bool implGetFieldDesc(long _nRow, ConstIndexFieldsIterator& _rPos);
88 :
89 0 : sal_Bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
90 :
91 : DECL_LINK( OnListEntrySelected, ListBox* );
92 :
93 : private:
94 : using ::svt::EditBrowseBox::Init;
95 : };
96 :
97 : //......................................................................
98 : } // namespace dbaui
99 : //......................................................................
100 :
101 : #endif // _DBAUI_INDEXFIELDSCONTROL_HXX_
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|