summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Deep <akshaydeepiitr@gmail.com>2016-03-29 03:41:05 +0530
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2016-04-04 09:07:44 +0000
commite099c5bdaa458105148059228ec11c98b9d13029 (patch)
tree2aecedc6780a6f95552095bca50ab64c98967139
parentd69c03a3520205db549b2c84e7825967c8ea3ac5 (diff)
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 <Samuel.Mehrbrodt@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r--cui/UIConfig_cui.mk1
-rw-r--r--cui/source/inc/cuires.hrc1
-rw-r--r--cui/source/options/optjava.cxx85
-rw-r--r--cui/source/options/optjava.hxx21
-rw-r--r--cui/source/options/optjava.src5
-rw-r--r--cui/uiconfig/ui/javastartparameterseditdialog.ui107
-rw-r--r--include/sfx2/inputdlg.hxx (renamed from sfx2/source/inc/inputdlg.hxx)8
-rw-r--r--sfx2/source/dialog/backingwindow.cxx2
-rw-r--r--sfx2/source/dialog/inputdlg.cxx17
-rw-r--r--sfx2/source/doc/templatedlg.cxx12
10 files changed, 47 insertions, 212 deletions
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 697c701cdea1..b0f72cb6a9ea 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -90,7 +90,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/insertrowcolumn \
cui/uiconfig/ui/javaclasspathdialog \
cui/uiconfig/ui/javastartparametersdialog \
- cui/uiconfig/ui/javastartparameterseditdialog \
cui/uiconfig/ui/linedialog \
cui/uiconfig/ui/linetabpage \
cui/uiconfig/ui/lineendstabpage \
diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index de91c471a379..658401d8c640 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -136,6 +136,7 @@
#define RID_SVXSTR_OPT_PROXYPORTS (RID_SVX_START + 224)
#define RID_SVXSTR_JRE_NOT_RECOGNIZED (RID_SVX_START + 256)
#define RID_SVXSTR_JRE_FAILED_VERSION (RID_SVX_START + 257)
+#define RID_SVXSTR_JAVA_START_PARAM (RID_SVX_START + 258)
#define RID_SVXSTR_PATH_NAME_START (RID_SVX_START + 1003)
#define RID_SVXBMP_LOCK (RID_SVX_START + 118)
#define RID_SVXSTR_READONLY_CONFIG_TIP (RID_SVX_START + 1026)
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 6ab367aad345..b954b3077708 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -38,6 +38,7 @@
#include "svtools/restartdialog.hxx"
#include "svtools/treelistentry.hxx"
#include <sfx2/filedlghelper.hxx>
+#include <sfx2/inputdlg.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -888,45 +889,25 @@ void SvxJavaParameterDlg::EditParameter()
{
sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
m_pParameterEdit->SetText( OUString() );
- OUString editedClassPath;
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
{
- if ( !m_pParamEditDlg )
- {
- m_pParamEditDlg = VclPtr<SvxJavaParameterEditDlg>::Create( this );
- editedClassPath = m_pAssignedList->GetSelectEntry();
- m_pParamEditDlg->SetParameter( editedClassPath );
- }
- else{
- editedClassPath = m_pAssignedList->GetSelectEntry();
- m_pParamEditDlg->SetParameter( editedClassPath );
- }
- }
- else
- {
- if(m_pParamEditDlg)
- {
- editedClassPath = m_pParamEditDlg->GetParameter();
- }
- }
+ ScopedVclPtrInstance< InputDialog > m_pParamEditDlg( CUI_RES( RID_SVXSTR_JAVA_START_PARAM ).toString(), this);
+ OUString editableClassPath = m_pAssignedList->GetSelectEntry();
+ m_pParamEditDlg->SetEntryText( editableClassPath );
+ m_pParamEditDlg->HideHelpBtn();
- if ( m_pParamEditDlg->Execute() == RET_OK )
- {
- if (!( editedClassPath == m_pParamEditDlg->GetParameter() ) )
+ if(!m_pParamEditDlg->Execute())
+ return;
+ OUString editedClassPath = comphelper::string::strip( m_pParamEditDlg->GetEntryText(), ' ');
+
+ if ( !editedClassPath.isEmpty() && editableClassPath != editedClassPath )
{
- editedClassPath = m_pParamEditDlg->GetParameter();
- if( !editedClassPath.isEmpty() ){
- m_pAssignedList->RemoveEntry( nPos );
- m_pAssignedList->InsertEntry( editedClassPath, nPos );
- m_pAssignedList->SelectEntryPos( nPos );
- }
+ m_pAssignedList->RemoveEntry( nPos );
+ m_pAssignedList->InsertEntry( editedClassPath, nPos );
+ m_pAssignedList->SelectEntryPos( nPos );
}
}
- else
- {
- m_pParamEditDlg->SetParameter( editedClassPath );
- }
}
short SvxJavaParameterDlg::Execute()
@@ -969,46 +950,6 @@ void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
DisableRemoveButton();
}
-// class SvxJavaParameterEditDlg ---------------------------------------------
-
-SvxJavaParameterEditDlg::SvxJavaParameterEditDlg( vcl::Window* pParent ) :
-
- ModalDialog( pParent, "JavaStartParametersEdit",
- "cui/ui/javastartparameterseditdialog.ui" )
-{
- get( m_pParameterEditField, "parametereditfield");
-}
-
-SvxJavaParameterEditDlg::~SvxJavaParameterEditDlg()
-{
- disposeOnce();
-}
-
-void SvxJavaParameterEditDlg::dispose()
-{
- m_pParameterEditField.clear();
- ModalDialog::dispose();
-}
-
-
-short SvxJavaParameterEditDlg::Execute()
-{
- m_pParameterEditField->GrabFocus();
- return ModalDialog::Execute();
-}
-
-OUString SvxJavaParameterEditDlg::GetParameter() const
-{
- OUString sParamEdit = comphelper::string::strip(m_pParameterEditField->GetText(), ' ');
- return sParamEdit;
-}
-
-
-void SvxJavaParameterEditDlg::SetParameter( OUString const & strParams )
-{
- m_pParameterEditField->SetText( strParams );
- m_pParameterEditField->SetCursorAtLast();
-}
// class SvxJavaClassPathDlg ---------------------------------------------
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index ca5ac45688d1..85905df10641 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -43,7 +43,6 @@ typedef void* JavaInfo;
#endif
class SvxJavaParameterDlg;
-class SvxJavaParameterEditDlg;
class SvxJavaClassPathDlg;
class SvxJavaListBox;
@@ -130,8 +129,6 @@ private:
VclPtr<PushButton> m_pEditBtn;
- VclPtr<SvxJavaParameterEditDlg> m_pParamEditDlg;
-
DECL_LINK_TYPED(ModifyHdl_Impl, Edit&, void);
DECL_LINK_TYPED(AssignHdl_Impl, Button*, void);
DECL_LINK_TYPED(SelectHdl_Impl, ListBox&, void);
@@ -177,24 +174,6 @@ public:
void EditParameter();
};
-// class SvxJavaParameterEditDlg ---------------------------------------------
-
-class SvxJavaParameterEditDlg : public ModalDialog
-{
-private:
- VclPtr<Edit> m_pParameterEditField;
-
-public:
- explicit SvxJavaParameterEditDlg( vcl::Window* pParent );
- virtual ~SvxJavaParameterEditDlg();
- virtual void dispose() override;
-
- virtual short Execute() override;
-
- OUString GetParameter() const;
- void SetParameter( OUString const & rParams );
-};
-
// class SvxJavaClassPathDlg ---------------------------------------------
class SvxJavaClassPathDlg : public ModalDialog
diff --git a/cui/source/options/optjava.src b/cui/source/options/optjava.src
index 807cedc94423..f4e931a9fbd8 100644
--- a/cui/source/options/optjava.src
+++ b/cui/source/options/optjava.src
@@ -35,4 +35,9 @@ String RID_SVXSTR_OPTIONS_RESTART
Text [ en-US ] = "Please restart %PRODUCTNAME now so the new or modified values can take effect." ;
};
+String RID_SVXSTR_JAVA_START_PARAM
+{
+ Text [ en-US ] = "Edit Parameter" ;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/javastartparameterseditdialog.ui b/cui/uiconfig/ui/javastartparameterseditdialog.ui
deleted file mode 100644
index 73ebe23e5f69..000000000000
--- a/cui/uiconfig/ui/javastartparameterseditdialog.ui
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <object class="GtkDialog" id="JavaStartParametersEdit">
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <property name="title" translatable="yes">Edit Parameter</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkEntry" id="parametereditfield">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="invisible_char">‚óŹ</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="0">ok</action-widget>
- <action-widget response="0">cancel</action-widget>
- </action-widgets>
- </object>
-</interface> \ No newline at end of file
diff --git a/sfx2/source/inc/inputdlg.hxx b/include/sfx2/inputdlg.hxx
index fb199a842fd2..a2a1423fe9e8 100644
--- a/sfx2/source/inc/inputdlg.hxx
+++ b/include/sfx2/inputdlg.hxx
@@ -11,17 +11,20 @@
#define INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
#include <vcl/dialog.hxx>
+#include <sfx2/dllapi.h>
class Edit;
class FixedText;
class PushButton;
class Button;
-class InputDialog : public ModalDialog
+class SFX2_DLLPUBLIC InputDialog : public ModalDialog
{
public:
InputDialog (const OUString &labelText, vcl::Window *pParent = nullptr);
- OUString getEntryText () const;
+ OUString GetEntryText () const;
+ void SetEntryText( OUString const & sStr );
+ void HideHelpBtn();
virtual ~InputDialog();
virtual void dispose() override;
@@ -35,6 +38,7 @@ private:
VclPtr<FixedText> m_pLabel;
VclPtr<PushButton> m_pOK;
VclPtr<PushButton> m_pCancel;
+ VclPtr<PushButton> m_pHelp;
};
#endif // INCLUDED_SFX2_SOURCE_INC_INPUTDLG_HXX
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 <sfx2/inputdlg.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
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 <sfx2/inputdlg.hxx>
#include <sfx2/sfxresid.hxx>
#include <vcl/button.hxx>
@@ -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 <sfx2/templatedlg.hxx>
-#include "inputdlg.hxx"
+#include <sfx2/inputdlg.hxx>
#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);