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: indexdialog.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_INDEXDIALOG_HXX_
32 #define _DBAUI_INDEXDIALOG_HXX_
34 #ifndef _SV_DIALOG_HXX
35 #include <vcl/dialog.hxx>
38 #include <vcl/fixed.hxx>
40 #ifndef _SV_LSTBOX_HXX
41 #include <vcl/lstbox.hxx>
43 #ifndef _SV_BUTTON_HXX
44 #include <vcl/button.hxx>
46 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
47 #include <com/sun/star/container/XNameAccess.hpp>
49 #ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
50 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
52 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
53 #include <com/sun/star/sdbc/XConnection.hpp>
55 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
56 #include <com/sun/star/uno/Sequence.hxx>
58 #ifndef _SV_TOOLBOX_HXX
59 #include <vcl/toolbox.hxx>
61 #ifndef _SVTREEBOX_HXX
62 #include <svtools/svtreebx.hxx>
64 #ifndef INCLUDED_SVTOOLS_VIEWOPTIONS_HXX
65 #include <svtools/viewoptions.hxx>
67 #ifndef _DBAUI_INDEXES_HXX_
68 #include "indexes.hxx"
70 #ifndef DBAUI_TOOLBOXHELPER_HXX
71 #include "ToolBoxHelper.hxx"
74 //......................................................................
77 //......................................................................
79 //==================================================================
81 //==================================================================
82 class DbaIndexList
: public SvTreeListBox
85 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
88 sal_Bool m_bSuspendSelectHdl
;
91 DbaIndexList(Window
* _pParent
, const ResId
& _rId
);
93 void SetSelectHdl(const Link
& _rHdl
) { m_aSelectHdl
= _rHdl
; }
94 Link
GetSelectHdl() const { return m_aSelectHdl
; }
96 void SetEndEditHdl(const Link
& _rHdl
) { m_aEndEditHdl
= _rHdl
; }
97 Link
GetEndEditHdl() const { return m_aEndEditHdl
; }
99 virtual sal_Bool
Select( SvLBoxEntry
* pEntry
, sal_Bool bSelect
);
101 void enableSelectHandler();
102 void disableSelectHandler();
104 void SelectNoHandlerCall( SvLBoxEntry
* pEntry
);
106 inline void setConnection(const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
)
108 m_xConnection
= _rxConnection
;
112 virtual sal_Bool
EditedEntry( SvLBoxEntry
* pEntry
, const XubString
& rNewText
);
115 using SvTreeListBox::Select
;
118 //==================================================================
120 //==================================================================
121 class IndexFieldsControl
;
122 class OIndexCollection
;
123 class DbaIndexDialog
: public ModalDialog
,
124 public OToolBoxHelper
127 ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
> m_xConnection
;
128 SvtViewOptions m_aGeometrySettings
;
131 DbaIndexList m_aIndexes
;
132 FixedLine m_aIndexDetails
;
133 FixedText m_aDescriptionLabel
;
134 FixedText m_aDescription
;
136 FixedText m_aFieldsLabel
;
137 IndexFieldsControl
* m_pFields
;
141 OIndexCollection
* m_pIndexes
;
142 SvLBoxEntry
* m_pPreviousSelection
;
143 sal_Bool m_bEditAgain
;
145 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
150 const ::com::sun::star::uno::Sequence
< ::rtl::OUString
>& _rFieldNames
,
151 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
>& _rxIndexes
,
152 const ::com::sun::star::uno::Reference
< ::com::sun::star::sdbc::XConnection
>& _rxConnection
,
153 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
,
154 sal_Int32 _nMaxColumnsInIndex
156 virtual ~DbaIndexDialog();
158 virtual void StateChanged( StateChangedType nStateChange
);
159 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
161 /** will be called whenthe id of the image list is needed.
165 <TRUE/> when in high contrast mode.
167 virtual ImageList
getImageList(sal_Int16 _eBitmapSet
,sal_Bool _bHiContast
) const;
169 /** will be called when the controls need to be resized.
171 virtual void resizeControls(const Size
& _rDiff
);
174 void fillIndexList();
175 void updateToolbox();
176 void updateControls(const SvLBoxEntry
* _pEntry
);
179 DECL_LINK( OnIndexSelected
, DbaIndexList
* );
180 DECL_LINK( OnIndexAction
, ToolBox
* );
181 DECL_LINK( OnEntryEdited
, SvLBoxEntry
* );
182 DECL_LINK( OnModified
, void* );
183 DECL_LINK( OnCloseDialog
, void* );
185 DECL_LINK( OnEditIndexAgain
, SvLBoxEntry
* );
189 void OnDropIndex(sal_Bool _bConfirm
= sal_True
);
190 void OnRenameIndex();
194 sal_Bool
implCommit(SvLBoxEntry
* _pEntry
);
195 sal_Bool
implSaveModified(sal_Bool _bPlausibility
= sal_True
);
196 sal_Bool
implCommitPreviouslySelected();
198 sal_Bool
implDropIndex(SvLBoxEntry
* _pEntry
, sal_Bool _bRemoveFromCollection
);
200 sal_Bool
implCheckPlausibility(const ConstIndexesIterator
& _rPos
);
202 /** checks if the controls have to be replaced and moved.
204 void checkControls();
207 //......................................................................
209 //......................................................................
211 #endif // _DBAUI_INDEXDIALOG_HXX_