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
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#ifndef INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
|
|
|
|
#define INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
#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>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2001-03-16 15:22:00 +00:00
|
|
|
#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:
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
|
2015-09-17 08:43:56 +02:00
|
|
|
Link<DbaIndexList&,void> m_aSelectHdl;
|
|
|
|
Link<SvTreeListEntry*,bool> m_aEndEditHdl;
|
|
|
|
bool m_bSuspendSelectHdl;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
|
|
|
public:
|
2014-09-23 11:20:40 +02:00
|
|
|
DbaIndexList(vcl::Window* _pParent, WinBits nWinBits);
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-09-17 08:43:56 +02:00
|
|
|
void SetSelectHdl(const Link<DbaIndexList&,void>& _rHdl) { m_aSelectHdl = _rHdl; }
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-09-17 08:43:56 +02:00
|
|
|
void SetEndEditHdl(const Link<SvTreeListEntry*,bool>& _rHdl) { m_aEndEditHdl = _rHdl; }
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2016-07-22 14:35:27 +02:00
|
|
|
virtual bool Select(SvTreeListEntry* pEntry, bool bSelect = true) override;
|
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
|
|
|
|
2017-03-03 20:57:02 +01:00
|
|
|
void setConnection(const css::uno::Reference< css::sdbc::XConnection >& _rxConnection)
|
2002-07-30 08:45:49 +00:00
|
|
|
{
|
|
|
|
m_xConnection = _rxConnection;
|
|
|
|
}
|
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
protected:
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText ) override;
|
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:
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::sdbc::XConnection > m_xConnection;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-03-09 14:29:30 +02:00
|
|
|
VclPtr<ToolBox> m_pActions;
|
|
|
|
VclPtr<DbaIndexList> m_pIndexList;
|
|
|
|
VclPtr<FixedText> m_pIndexDetails;
|
|
|
|
VclPtr<FixedText> m_pDescriptionLabel;
|
|
|
|
VclPtr<FixedText> m_pDescription;
|
|
|
|
VclPtr<CheckBox> m_pUnique;
|
|
|
|
VclPtr<FixedText> m_pFieldsLabel;
|
|
|
|
VclPtr<IndexFieldsControl> m_pFields;
|
|
|
|
VclPtr<PushButton> m_pClose;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
OIndexCollection* m_pIndexes;
|
|
|
|
SvTreeListEntry* m_pPreviousSelection;
|
|
|
|
bool m_bEditAgain;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-08-03 09:14:58 +02:00
|
|
|
css::uno::Reference< css::uno::XComponentContext >
|
|
|
|
m_xContext;
|
2001-03-16 15:22:00 +00:00
|
|
|
public:
|
|
|
|
DbaIndexDialog(
|
2014-09-23 11:20:40 +02:00
|
|
|
vcl::Window* _pParent,
|
2015-08-03 09:14:58 +02:00
|
|
|
const css::uno::Sequence< OUString >& _rFieldNames,
|
|
|
|
const css::uno::Reference< css::container::XNameAccess >& _rxIndexes,
|
|
|
|
const css::uno::Reference< css::sdbc::XConnection >& _rxConnection,
|
2017-06-22 13:39:17 +02:00
|
|
|
const css::uno::Reference< css::uno::XComponentContext >& _rxContext
|
2001-03-16 15:22:00 +00:00
|
|
|
);
|
2016-09-13 13:09:01 +02:00
|
|
|
virtual ~DbaIndexDialog() override;
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void dispose() override;
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void StateChanged( StateChangedType nStateChange ) override;
|
|
|
|
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
|
2002-04-29 07:08:41 +00:00
|
|
|
|
2014-06-10 12:32:03 +01:00
|
|
|
//TO-DO, remove when all other OToolBoxHelper are converted to .ui
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void resizeControls(const Size&) override;
|
2014-06-10 12:32:03 +01:00
|
|
|
|
|
|
|
/** will be called when the id of the image list needs to change
|
2002-04-29 07:08:41 +00:00
|
|
|
@param _eBitmapSet
|
|
|
|
<svtools/imgdef.hxx>
|
|
|
|
*/
|
2015-10-12 16:04:04 +02:00
|
|
|
virtual void setImageList(sal_Int16 _eBitmapSet) override;
|
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:
|
2016-10-05 07:56:12 +02:00
|
|
|
DECL_LINK( OnIndexSelected, DbaIndexList&, void );
|
|
|
|
DECL_LINK( OnIndexAction, ToolBox*, void );
|
|
|
|
DECL_LINK( OnEntryEdited, SvTreeListEntry*, bool );
|
|
|
|
DECL_LINK( OnModifiedClick, Button*, void );
|
|
|
|
DECL_LINK( OnModified, IndexFieldsControl&, void );
|
|
|
|
DECL_LINK( OnCloseDialog, Button*, void );
|
|
|
|
|
|
|
|
DECL_LINK( OnEditIndexAgain, void*, void );
|
2001-05-02 10:45:08 +00:00
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
private:
|
2014-06-10 12:32:03 +01:00
|
|
|
sal_uInt16 mnNewCmdId;
|
|
|
|
sal_uInt16 mnDropCmdId;
|
|
|
|
sal_uInt16 mnRenameCmdId;
|
|
|
|
sal_uInt16 mnSaveCmdId;
|
|
|
|
sal_uInt16 mnResetCmdId;
|
|
|
|
|
|
|
|
Image maScNewCmdImg;
|
|
|
|
Image maScDropCmdImg;
|
|
|
|
Image maScRenameCmdImg;
|
|
|
|
Image maScSaveCmdImg;
|
|
|
|
Image maScResetCmdImg;
|
|
|
|
Image maLcNewCmdImg;
|
|
|
|
Image maLcDropCmdImg;
|
|
|
|
Image maLcRenameCmdImg;
|
|
|
|
Image maLcSaveCmdImg;
|
|
|
|
Image maLcResetCmdImg;
|
|
|
|
|
2001-03-16 15:22:00 +00:00
|
|
|
void OnNewIndex();
|
2014-04-17 11:16:55 +02:00
|
|
|
void OnDropIndex(bool _bConfirm = true);
|
2001-03-16 15:22:00 +00:00
|
|
|
void OnRenameIndex();
|
|
|
|
void OnSaveIndex();
|
|
|
|
void OnResetIndex();
|
|
|
|
|
2017-07-31 12:26:12 +02:00
|
|
|
bool implCommit(SvTreeListEntry const * _pEntry);
|
2014-04-17 11:16:55 +02:00
|
|
|
bool implSaveModified(bool _bPlausibility = true);
|
|
|
|
bool implCommitPreviouslySelected();
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2017-07-31 12:26:12 +02:00
|
|
|
bool implDropIndex(SvTreeListEntry const * _pEntry, bool _bRemoveFromCollection);
|
2001-03-19 05:02:09 +00:00
|
|
|
|
2014-04-17 11:16:55 +02:00
|
|
|
bool implCheckPlausibility(const Indexes::const_iterator& _rPos);
|
2001-03-16 15:22:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dbaui
|
|
|
|
|
2013-11-05 02:18:53 +01:00
|
|
|
#endif // INCLUDED_DBACCESS_SOURCE_UI_INC_INDEXDIALOG_HXX
|
2001-03-16 15:22:00 +00:00
|
|
|
|
2010-10-27 12:33:13 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|