1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: indexfieldscontrol.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DBAUI_INDEXFIELDSCONTROL_HXX_
32 #define _DBAUI_INDEXFIELDSCONTROL_HXX_
34 #ifndef _DBAUI_MODULE_DBU_HXX_
35 #include "moduledbu.hxx"
37 #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
38 #include <svtools/editbrowsebox.hxx>
40 #ifndef _DBAUI_INDEXCOLLECTION_HXX_
41 #include "indexcollection.hxx"
43 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
44 #include <com/sun/star/uno/Sequence.hxx>
47 //......................................................................
50 //......................................................................
52 //==================================================================
54 //==================================================================
55 class IndexFieldsControl
: public ::svt::EditBrowseBox
57 OModuleClient m_aModuleClient
;
59 IndexFields m_aSavedValue
;
61 IndexFields m_aFields
; // !! order matters !!
62 ConstIndexFieldsIterator m_aSeekRow
; // !!
66 ::svt::ListBoxControl
* m_pSortingCell
;
67 ::svt::ListBoxControl
* m_pFieldNameCell
;
69 String m_sAscendingText
;
70 String m_sDescendingText
;
72 sal_Int32 m_nMaxColumnsInIndex
;
75 IndexFieldsControl( Window
* _pParent
, const ResId
& _rId
,sal_Int32 _nMaxColumnsInIndex
);
76 ~IndexFieldsControl();
78 void Init(const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rAvailableFields
);
80 void initializeFrom(const IndexFields
& _rFields
);
81 void commitTo(IndexFields
& _rFields
);
83 sal_Bool
SaveModified();
84 sal_Bool
IsModified() const;
86 const IndexFields
& GetSavedValue() const { return m_aSavedValue
; }
87 void SaveValue() { m_aSavedValue
= m_aFields
; }
89 void SetModifyHdl(const Link
& _rHdl
) { m_aModifyHdl
= _rHdl
; }
90 Link
GetModifyHdl() const { return m_aModifyHdl
; }
91 virtual String
GetCellText(long _nRow
,sal_uInt16 nColId
) const;
94 // EditBrowseBox overridables
95 virtual void PaintCell( OutputDevice
& _rDev
, const Rectangle
& _rRect
, sal_uInt16 _nColumnId
) const;
96 virtual sal_Bool
SeekRow(long nRow
);
97 virtual sal_uInt32
GetTotalCellWidth(long nRow
, sal_uInt16 nColId
);
98 virtual sal_Bool
IsTabAllowed(sal_Bool bForward
) const;
100 ::svt::CellController
* GetController(long _nRow
, sal_uInt16 _nColumnId
);
101 void InitController(::svt::CellControllerRef
&, long _nRow
, sal_uInt16 _nColumnId
);
104 String
GetRowCellText(const ConstIndexFieldsIterator
& _rRow
,sal_uInt16 nColId
) const;
105 sal_Bool
implGetFieldDesc(long _nRow
, ConstIndexFieldsIterator
& _rPos
);
107 sal_Bool
isNewField() const { return GetCurRow() >= (sal_Int32
)m_aFields
.size(); }
109 DECL_LINK( OnListEntrySelected
, ListBox
* );
112 using ::svt::EditBrowseBox::Init
;
115 //......................................................................
117 //......................................................................
119 #endif // _DBAUI_INDEXFIELDSCONTROL_HXX_