From e099c5bdaa458105148059228ec11c98b9d13029 Mon Sep 17 00:00:00 2001 From: Akshay Deep Date: Tue, 29 Mar 2016 03:41:05 +0530 Subject: Make InputDialog class global to reuse it's code and tdf#97425 tdf#97425 -> Use InputDialog to edit Java Class Parameter Change-Id: I41ac9ffbc660c4bbb9d4fd3335e95d64ccdd2842 Reviewed-on: https://gerrit.libreoffice.org/23580 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt --- sfx2/source/dialog/backingwindow.cxx | 2 +- sfx2/source/dialog/inputdlg.cxx | 17 +++++++++++++-- sfx2/source/doc/templatedlg.cxx | 12 +++++------ sfx2/source/inc/inputdlg.hxx | 42 ------------------------------------ 4 files changed, 22 insertions(+), 51 deletions(-) delete mode 100644 sfx2/source/inc/inputdlg.hxx (limited to 'sfx2') diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index f2c448e9feb2..bb3ec7735b01 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -18,7 +18,7 @@ */ #include "backingwindow.hxx" -#include "inputdlg.hxx" +#include #include #include diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx index 8aa717d4a56e..427f2862ed5b 100644 --- a/sfx2/source/dialog/inputdlg.cxx +++ b/sfx2/source/dialog/inputdlg.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "inputdlg.hxx" +#include #include #include @@ -21,6 +21,7 @@ InputDialog::InputDialog(const OUString &rLabelText, vcl::Window *pParent) get(m_pLabel, "label"); get(m_pOK, "ok"); get(m_pCancel, "cancel"); + get(m_pHelp, "help"); m_pLabel->SetText(rLabelText); m_pOK->SetClickHdl(LINK(this,InputDialog,ClickHdl)); m_pCancel->SetClickHdl(LINK(this,InputDialog,ClickHdl)); @@ -37,14 +38,26 @@ void InputDialog::dispose() m_pLabel.clear(); m_pOK.clear(); m_pCancel.clear(); + m_pHelp.clear(); ModalDialog::dispose(); } -OUString InputDialog::getEntryText() const +void InputDialog::HideHelpBtn() +{ + m_pHelp->Hide(); +} + +OUString InputDialog::GetEntryText() const { return m_pEntry->GetText(); } +void InputDialog::SetEntryText( OUString const & sStr) +{ + m_pEntry->SetText(sStr); + m_pEntry->SetCursorAtLast(); +} + IMPL_LINK_TYPED(InputDialog,ClickHdl, Button*, pButton, void) { EndDialog(pButton == m_pOK ? RET_OK : RET_CANCEL); diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index e008e95f7ab4..c959c029d9eb 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -9,7 +9,7 @@ #include -#include "inputdlg.hxx" +#include #include "templatesearchview.hxx" #include "templatesearchviewitem.hxx" @@ -1266,7 +1266,7 @@ void SfxTemplateManagerDlg::OnFolderNew() if (ret) { - OUString aName = dlg->getEntryText(); + OUString aName = dlg->GetEntryText(); mpCurView->createRegion(aName); } @@ -1331,7 +1331,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() if (aDlg->Execute()) { - OUString aName = aDlg->getEntryText(); + OUString aName = aDlg->GetEntryText(); if (!aName.isEmpty()) { @@ -1471,7 +1471,7 @@ void SfxTemplateManagerDlg::localMoveTo(sal_uInt16 nMenuId) if (ret) { - OUString aName = dlg->getEntryText(); + OUString aName = dlg->GetEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); @@ -1519,7 +1519,7 @@ void SfxTemplateManagerDlg::remoteMoveTo(const sal_uInt16 nMenuId) if (ret) { - OUString aName = dlg->getEntryText(); + OUString aName = dlg->GetEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); @@ -1573,7 +1573,7 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nMenuId) if (ret) { - OUString aName = dlg->getEntryText(); + OUString aName = dlg->GetEntryText(); if (!aName.isEmpty()) nItemId = mpLocalView->createRegion(aName); diff --git a/sfx2/source/inc/inputdlg.hxx b/sfx2/source/inc/inputdlg.hxx deleted file mode 100644 index fb199a842fd2..000000000000 --- a/sfx2/source/inc/inputdlg.hxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * 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/. - */ - -#ifndef INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX -#define INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX - -#include - -class Edit; -class FixedText; -class PushButton; -class Button; - -class InputDialog : public ModalDialog -{ -public: - InputDialog (const OUString &labelText, vcl::Window *pParent = nullptr); - OUString getEntryText () const; - virtual ~InputDialog(); - virtual void dispose() override; - -private: - - DECL_LINK_TYPED(ClickHdl, Button*, void); - -private: - - VclPtr m_pEntry; - VclPtr m_pLabel; - VclPtr m_pOK; - VclPtr m_pCancel; -}; - -#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit