xref: /trunk/main/dbaccess/source/ui/inc/indexfieldscontrol.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _DBAUI_INDEXFIELDSCONTROL_HXX_
25cdf0e10cSrcweir #define _DBAUI_INDEXFIELDSCONTROL_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _DBAUI_MODULE_DBU_HXX_
28cdf0e10cSrcweir #include "moduledbu.hxx"
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #ifndef _SVTOOLS_EDITBROWSEBOX_HXX_
31cdf0e10cSrcweir #include <svtools/editbrowsebox.hxx>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir #ifndef _DBAUI_INDEXCOLLECTION_HXX_
34cdf0e10cSrcweir #include "indexcollection.hxx"
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
37cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
38cdf0e10cSrcweir #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir //......................................................................
41cdf0e10cSrcweir namespace dbaui
42cdf0e10cSrcweir {
43cdf0e10cSrcweir //......................................................................
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     //==================================================================
46cdf0e10cSrcweir     // IndexFieldsControl
47cdf0e10cSrcweir     //==================================================================
48cdf0e10cSrcweir     class IndexFieldsControl : public ::svt::EditBrowseBox
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         OModuleClient        m_aModuleClient;
51cdf0e10cSrcweir     protected:
52cdf0e10cSrcweir         IndexFields                 m_aSavedValue;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir         IndexFields                 m_aFields;          // !! order matters !!
55cdf0e10cSrcweir         ConstIndexFieldsIterator    m_aSeekRow;         // !!
56cdf0e10cSrcweir 
57cdf0e10cSrcweir         Link                        m_aModifyHdl;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir         ::svt::ListBoxControl*      m_pSortingCell;
60cdf0e10cSrcweir         ::svt::ListBoxControl*      m_pFieldNameCell;
61cdf0e10cSrcweir 
62cdf0e10cSrcweir         String                      m_sAscendingText;
63cdf0e10cSrcweir         String                      m_sDescendingText;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir         sal_Int32                   m_nMaxColumnsInIndex;
66cdf0e10cSrcweir         sal_Bool                    m_bAddIndexAppendix;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     public:
69cdf0e10cSrcweir         IndexFieldsControl( Window* _pParent, const ResId& _rId ,sal_Int32 _nMaxColumnsInIndex,sal_Bool _bAddIndexAppendix);
70cdf0e10cSrcweir         ~IndexFieldsControl();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         void Init(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rAvailableFields);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir         void initializeFrom(const IndexFields& _rFields);
75cdf0e10cSrcweir         void commitTo(IndexFields& _rFields);
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         sal_Bool SaveModified();
78cdf0e10cSrcweir         sal_Bool IsModified() const;
79cdf0e10cSrcweir 
GetSavedValue() const80cdf0e10cSrcweir         const IndexFields&  GetSavedValue() const { return m_aSavedValue; }
SaveValue()81cdf0e10cSrcweir         void                SaveValue() { m_aSavedValue = m_aFields; }
82cdf0e10cSrcweir 
SetModifyHdl(const Link & _rHdl)83cdf0e10cSrcweir         void SetModifyHdl(const Link& _rHdl) { m_aModifyHdl = _rHdl; }
GetModifyHdl() const84cdf0e10cSrcweir         Link GetModifyHdl() const { return m_aModifyHdl; }
85cdf0e10cSrcweir         virtual String GetCellText(long _nRow,sal_uInt16 nColId) const;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir     protected:
88cdf0e10cSrcweir         // EditBrowseBox overridables
89cdf0e10cSrcweir         virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect, sal_uInt16 _nColumnId ) const;
90cdf0e10cSrcweir         virtual sal_Bool SeekRow(long nRow);
91cdf0e10cSrcweir         virtual sal_uInt32 GetTotalCellWidth(long nRow, sal_uInt16 nColId);
92cdf0e10cSrcweir         virtual sal_Bool IsTabAllowed(sal_Bool bForward) const;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         ::svt::CellController*  GetController(long _nRow, sal_uInt16 _nColumnId);
95cdf0e10cSrcweir         void                InitController(::svt::CellControllerRef&, long _nRow, sal_uInt16 _nColumnId);
96cdf0e10cSrcweir 
97cdf0e10cSrcweir     protected:
98cdf0e10cSrcweir         String GetRowCellText(const ConstIndexFieldsIterator& _rRow,sal_uInt16 nColId) const;
99cdf0e10cSrcweir         sal_Bool implGetFieldDesc(long _nRow, ConstIndexFieldsIterator& _rPos);
100cdf0e10cSrcweir 
isNewField() const101cdf0e10cSrcweir         sal_Bool isNewField() const { return GetCurRow() >= (sal_Int32)m_aFields.size(); }
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         DECL_LINK( OnListEntrySelected, ListBox* );
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     private:
106cdf0e10cSrcweir         using ::svt::EditBrowseBox::Init;
107cdf0e10cSrcweir     };
108cdf0e10cSrcweir 
109cdf0e10cSrcweir //......................................................................
110cdf0e10cSrcweir }   // namespace dbaui
111cdf0e10cSrcweir //......................................................................
112cdf0e10cSrcweir 
113cdf0e10cSrcweir #endif // _DBAUI_INDEXFIELDSCONTROL_HXX_
114