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 : VclPtr< ::svt::ListBoxControl> m_pSortingCell;
44 : VclPtr< ::svt::ListBoxControl> m_pFieldNameCell;
45 :
46 : OUString m_sAscendingText;
47 : OUString m_sDescendingText;
48 :
49 : sal_Int32 m_nMaxColumnsInIndex;
50 : bool m_bAddIndexAppendix;
51 :
52 : public:
53 : IndexFieldsControl( vcl::Window* _pParent, WinBits nWinStyle);
54 : virtual ~IndexFieldsControl();
55 : virtual void dispose() SAL_OVERRIDE;
56 :
57 : void Init(const ::com::sun::star::uno::Sequence< OUString >& _rAvailableFields, sal_Int32 _nMaxColumnsInIndex,bool _bAddIndexAppendix);
58 :
59 : void initializeFrom(const IndexFields& _rFields);
60 : void commitTo(IndexFields& _rFields);
61 :
62 : bool SaveModified() SAL_OVERRIDE;
63 : bool IsModified() const SAL_OVERRIDE;
64 :
65 0 : const IndexFields& GetSavedValue() const { return m_aSavedValue; }
66 0 : void SaveValue() { m_aSavedValue = m_aFields; }
67 :
68 0 : 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;
71 :
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;
78 :
79 : ::svt::CellController* GetController(long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
80 : void InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId) SAL_OVERRIDE;
81 :
82 : protected:
83 : OUString GetRowCellText(const IndexFields::const_iterator& _rRow,sal_uInt16 nColId) const;
84 : bool implGetFieldDesc(long _nRow, IndexFields::const_iterator& _rPos);
85 :
86 0 : bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
87 :
88 : DECL_LINK( OnListEntrySelected, ListBox* );
89 :
90 : private:
91 : using ::svt::EditBrowseBox::Init;
92 : };
93 :
94 : } // namespace dbaui
95 :
96 : #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXFIELDSCONTROL_HXX
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|