1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _DBAUI_INDEXDIALOG_HXX_
21 #define _DBAUI_INDEXDIALOG_HXX_
23 #include <vcl/dialog.hxx>
24 #include <vcl/fixed.hxx>
25 #include <vcl/lstbox.hxx>
26 #include <vcl/button.hxx>
27 #include <com/sun/star/container/XNameAccess.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/sdbc/XConnection.hpp>
30 #include <com/sun/star/uno/Sequence.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <svtools/treelistbox.hxx>
33 #include <unotools/viewoptions.hxx>
34 #include "indexes.hxx"
35 #include <dbaccess/ToolBoxHelper.hxx>
37 //......................................................................
40 //......................................................................
42 //==================================================================
44 //==================================================================
45 class DbaIndexList
: public SvTreeListBox
48 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
51 sal_Bool m_bSuspendSelectHdl
;
54 DbaIndexList(Window
* _pParent
, const ResId
& _rId
);
56 void SetSelectHdl(const Link
& _rHdl
) { m_aSelectHdl
= _rHdl
; }
57 Link
GetSelectHdl() const { return m_aSelectHdl
; }
59 void SetEndEditHdl(const Link
& _rHdl
) { m_aEndEditHdl
= _rHdl
; }
60 Link
GetEndEditHdl() const { return m_aEndEditHdl
; }
62 virtual sal_Bool
Select( SvTreeListEntry
* pEntry
, sal_Bool bSelect
);
64 void enableSelectHandler();
65 void disableSelectHandler();
67 void SelectNoHandlerCall( SvTreeListEntry
* pEntry
);
69 inline void setConnection(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
)
71 m_xConnection
= _rxConnection
;
75 virtual sal_Bool
EditedEntry( SvTreeListEntry
* pEntry
, const OUString
& rNewText
);
78 using SvTreeListBox::Select
;
81 //==================================================================
83 //==================================================================
84 class IndexFieldsControl
;
85 class OIndexCollection
;
86 class DbaIndexDialog
: public ModalDialog
,
90 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
91 SvtViewOptions m_aGeometrySettings
;
94 DbaIndexList m_aIndexes
;
95 FixedLine m_aIndexDetails
;
96 FixedText m_aDescriptionLabel
;
97 FixedText m_aDescription
;
99 FixedText m_aFieldsLabel
;
100 IndexFieldsControl
* m_pFields
;
104 OIndexCollection
* m_pIndexes
;
105 SvTreeListEntry
* m_pPreviousSelection
;
106 sal_Bool m_bEditAgain
;
108 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>
113 const ::com::sun::star::uno::Sequence
< OUString
>& _rFieldNames
,
114 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxIndexes
,
115 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
116 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& _rxContext
,
117 sal_Int32 _nMaxColumnsInIndex
119 virtual ~DbaIndexDialog();
121 virtual void StateChanged( StateChangedType nStateChange
);
122 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
124 /** will be called whenthe id of the image list is needed.
128 <TRUE/> when in high contrast mode.
130 virtual ImageList
getImageList(sal_Int16 _eBitmapSet
) const;
132 /** will be called when the controls need to be resized.
134 virtual void resizeControls(const Size
& _rDiff
);
137 void fillIndexList();
138 void updateToolbox();
139 void updateControls(const SvTreeListEntry
* _pEntry
);
142 DECL_LINK( OnIndexSelected
, DbaIndexList
* );
143 DECL_LINK( OnIndexAction
, ToolBox
* );
144 DECL_LINK( OnEntryEdited
, SvTreeListEntry
* );
145 DECL_LINK( OnModified
, void* );
146 DECL_LINK( OnCloseDialog
, void* );
148 DECL_LINK( OnEditIndexAgain
, SvTreeListEntry
* );
152 void OnDropIndex(sal_Bool _bConfirm
= sal_True
);
153 void OnRenameIndex();
157 sal_Bool
implCommit(SvTreeListEntry
* _pEntry
);
158 sal_Bool
implSaveModified(sal_Bool _bPlausibility
= sal_True
);
159 sal_Bool
implCommitPreviouslySelected();
161 sal_Bool
implDropIndex(SvTreeListEntry
* _pEntry
, sal_Bool _bRemoveFromCollection
);
163 sal_Bool
implCheckPlausibility(const ConstIndexesIterator
& _rPos
);
165 /** checks if the controls have to be replaced and moved.
167 void checkControls();
170 //......................................................................
172 //......................................................................
174 #endif // _DBAUI_INDEXDIALOG_HXX_
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */