2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-06-14 17:39:53 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
#ifndef _DBAUI_INDEXDIALOG_HXX_
|
|
|
|
#define _DBAUI_INDEXDIALOG_HXX_
|
|
|
|
|
|
|
|
#include <vcl/dialog.hxx>
|
|
|
|
#include <vcl/fixed.hxx>
|
|
|
|
#include <vcl/lstbox.hxx>
|
|
|
|
#include <vcl/button.hxx>
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2002-07-30 08:45:49 +00:00
|
|
|
#include <com/sun/star/sdbc/XConnection.hpp>
|
2001-03-16 15:22:00 +00:00
|
|
|
#include <com/sun/star/uno/Sequence.hxx>
|
|
|
|
#include <vcl/toolbox.hxx>
|
2012-10-11 16:13:12 -04:00
|
|
|
#include <svtools/treelistbox.hxx>
|
2009-10-06 07:38:24 +02:00
|
|
|
#include <unotools/viewoptions.hxx>
|
2001-03-19 05:02:09 +00:00
|
|
|
#include "indexes.hxx"
|
2013-05-06 17:19:41 +02:00
|
|
|
#include <dbaccess/ToolBoxHelper.hxx>
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
namespace dbaui
|
|
|
|
{
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// DbaIndexList
|
2001-03-16 15:22:00 +00:00
|
|
|
class DbaIndexList : public SvTreeListBox
|
|
|
|
{
|
|
|
|
protected:
|
2002-07-30 08:45:49 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
|
2001-03-16 15:22:00 +00:00
|
|
|
Link m_aSelectHdl;
|
|
|
|
Link m_aEndEditHdl;
|
|
|
|
sal_Bool m_bSuspendSelectHdl;
|
|
|
|
|
|
|
|
public:
|
|
|
|
DbaIndexList(Window* _pParent, const ResId& _rId);
|
|
|
|
|
|
|
|
void SetSelectHdl(const Link& _rHdl) { m_aSelectHdl = _rHdl; }
|
|
|
|
Link GetSelectHdl() const { return m_aSelectHdl; }
|
|
|
|
|
|
|
|
void SetEndEditHdl(const Link& _rHdl) { m_aEndEditHdl = _rHdl; }
|
|
|
|
Link GetEndEditHdl() const { return m_aEndEditHdl; }
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
virtual sal_Bool Select( SvTreeListEntry* pEntry, sal_Bool bSelect );
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
void enableSelectHandler();
|
|
|
|
void disableSelectHandler();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
void SelectNoHandlerCall( SvTreeListEntry* pEntry );
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2002-07-30 08:45:49 +00:00
|
|
|
inline void setConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection)
|
|
|
|
{
|
|
|
|
m_xConnection = _rxConnection;
|
|
|
|
}
|
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
protected:
|
2013-04-07 12:06:47 +02:00
|
|
|
virtual sal_Bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
|
2006-06-20 02:17:28 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
using SvTreeListBox::Select;
|
2001-03-16 15:22:00 +00:00
|
|
|
};
|
|
|
|
|
2013-08-17 23:43:14 +02:00
|
|
|
// DbaIndexDialog
|
2001-03-16 15:22:00 +00:00
|
|
|
class IndexFieldsControl;
|
|
|
|
class OIndexCollection;
|
2002-04-29 07:08:41 +00:00
|
|
|
class DbaIndexDialog : public ModalDialog,
|
|
|
|
public OToolBoxHelper
|
2001-03-16 15:22:00 +00:00
|
|
|
{
|
|
|
|
protected:
|
2002-07-30 08:45:49 +00:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
|
2001-03-16 15:22:00 +00:00
|
|
|
SvtViewOptions m_aGeometrySettings;
|
|
|
|
|
|
|
|
ToolBox m_aActions;
|
|
|
|
DbaIndexList m_aIndexes;
|
|
|
|
FixedLine m_aIndexDetails;
|
|
|
|
FixedText m_aDescriptionLabel;
|
|
|
|
FixedText m_aDescription;
|
|
|
|
CheckBox m_aUnique;
|
|
|
|
FixedText m_aFieldsLabel;
|
|
|
|
IndexFieldsControl* m_pFields;
|
|
|
|
PushButton m_aClose;
|
2001-04-02 11:05:06 +00:00
|
|
|
HelpButton m_aHelp;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
OIndexCollection* m_pIndexes;
|
2012-10-18 16:28:20 +02:00
|
|
|
SvTreeListEntry* m_pPreviousSelection;
|
2001-05-11 15:24:08 +00:00
|
|
|
sal_Bool m_bEditAgain;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2012-12-06 14:15:55 +02:00
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
|
|
|
|
m_xContext;
|
2001-03-16 15:22:00 +00:00
|
|
|
public:
|
|
|
|
DbaIndexDialog(
|
|
|
|
Window* _pParent,
|
2013-04-07 12:06:47 +02:00
|
|
|
const ::com::sun::star::uno::Sequence< OUString >& _rFieldNames,
|
2001-03-16 15:22:00 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxIndexes,
|
2002-07-30 08:45:49 +00:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
|
2012-12-06 14:15:55 +02:00
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
|
2001-03-30 13:12:19 +00:00
|
|
|
sal_Int32 _nMaxColumnsInIndex
|
2001-03-16 15:22:00 +00:00
|
|
|
);
|
2002-07-30 08:45:49 +00:00
|
|
|
virtual ~DbaIndexDialog();
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2002-04-29 07:08:41 +00:00
|
|
|
virtual void StateChanged( StateChangedType nStateChange );
|
|
|
|
virtual void DataChanged( const DataChangedEvent& rDCEvt );
|
|
|
|
|
|
|
|
/** will be called whenthe id of the image list is needed.
|
|
|
|
@param _eBitmapSet
|
|
|
|
<svtools/imgdef.hxx>
|
2010-11-16 18:43:28 +01:00
|
|
|
@param _bHiContast
|
|
|
|
<TRUE/> when in high contrast mode.
|
2002-04-29 07:08:41 +00:00
|
|
|
*/
|
2010-11-16 23:23:02 -05:00
|
|
|
virtual ImageList getImageList(sal_Int16 _eBitmapSet) const;
|
2002-04-29 07:08:41 +00:00
|
|
|
|
|
|
|
/** will be called when the controls need to be resized.
|
|
|
|
*/
|
|
|
|
virtual void resizeControls(const Size& _rDiff);
|
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
protected:
|
|
|
|
void fillIndexList();
|
|
|
|
void updateToolbox();
|
2012-10-18 16:28:20 +02:00
|
|
|
void updateControls(const SvTreeListEntry* _pEntry);
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
DECL_LINK( OnIndexSelected, DbaIndexList* );
|
|
|
|
DECL_LINK( OnIndexAction, ToolBox* );
|
2012-10-18 16:28:20 +02:00
|
|
|
DECL_LINK( OnEntryEdited, SvTreeListEntry* );
|
2001-03-16 15:22:00 +00:00
|
|
|
DECL_LINK( OnModified, void* );
|
|
|
|
DECL_LINK( OnCloseDialog, void* );
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
DECL_LINK( OnEditIndexAgain, SvTreeListEntry* );
|
2001-05-02 10:45:08 +00:00
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
private:
|
|
|
|
void OnNewIndex();
|
2001-05-11 15:24:08 +00:00
|
|
|
void OnDropIndex(sal_Bool _bConfirm = sal_True);
|
2001-03-16 15:22:00 +00:00
|
|
|
void OnRenameIndex();
|
|
|
|
void OnSaveIndex();
|
|
|
|
void OnResetIndex();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
sal_Bool implCommit(SvTreeListEntry* _pEntry);
|
2001-03-19 05:02:09 +00:00
|
|
|
sal_Bool implSaveModified(sal_Bool _bPlausibility = sal_True);
|
2001-03-16 15:22:00 +00:00
|
|
|
sal_Bool implCommitPreviouslySelected();
|
|
|
|
|
2012-10-18 16:28:20 +02:00
|
|
|
sal_Bool implDropIndex(SvTreeListEntry* _pEntry, sal_Bool _bRemoveFromCollection);
|
2001-03-19 05:02:09 +00:00
|
|
|
|
|
|
|
sal_Bool implCheckPlausibility(const ConstIndexesIterator& _rPos);
|
2002-04-29 07:08:41 +00:00
|
|
|
|
|
|
|
/** checks if the controls have to be replaced and moved.
|
|
|
|
*/
|
|
|
|
void checkControls();
|
2001-03-16 15:22:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
|
|
|
#endif // _DBAUI_INDEXDIALOG_HXX_
|
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|