summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cui/UIConfig_cui.mk1
-rw-r--r--cui/source/options/optjava.cxx119
-rw-r--r--cui/source/options/optjava.hxx26
-rw-r--r--cui/uiconfig/ui/javastartparametersdialog.ui57
-rw-r--r--cui/uiconfig/ui/javastartparameterseditdialog.ui107
-rw-r--r--include/vcl/edit.hxx2
-rw-r--r--vcl/source/control/edit.cxx6
7 files changed, 282 insertions, 36 deletions
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index b0f72cb6a9ea..697c701cdea1 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -90,6 +90,7 @@ $(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/options/optjava.cxx b/cui/source/options/optjava.cxx
index 5568cdc89d8c..29a2c5faa286 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -311,7 +311,10 @@ IMPL_LINK_NOARG_TYPED(SvxJavaOptionsPage, ParameterHdl_Impl, Button*, void)
}
}
else
+ {
aParameterList = m_pParamDlg->GetParameters();
+ m_pParamDlg->DisableButtons(); //disable add, edit and remove button when dialog is reopened
+ }
if ( m_pParamDlg->Execute() == RET_OK )
{
@@ -844,17 +847,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, AssignHdl_Impl, Button*, void)
IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, EditHdl_Impl, Button*, void)
{
- sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
-
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- {
- OUString eVal = m_pAssignedList->GetSelectEntry();
- m_pAssignedList->RemoveEntry( nPos );
- m_pParameterEdit->SetText( eVal );
- }
- DisableRemoveButton();
- DisableEditButton();
- EnableAssignButton();
+ EditParameter();
}
@@ -867,9 +860,7 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, SelectHdl_Impl, ListBox&, void)
IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, DblClickHdl_Impl, ListBox&, void)
{
- sal_Int32 nPos = m_pAssignedList->GetSelectEntryPos();
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- m_pParameterEdit->SetText( m_pAssignedList->GetEntry( nPos ) );
+ EditParameter();
}
@@ -886,10 +877,58 @@ IMPL_LINK_NOARG_TYPED(SvxJavaParameterDlg, RemoveHdl_Impl, Button*, void)
nPos = ( nCount - 1 );
m_pAssignedList->SelectEntryPos( nPos );
}
+ else
+ {
+ DisableEditButton();
+ }
}
EnableRemoveButton();
}
+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();
+ }
+ }
+
+ if ( m_pParamEditDlg->Execute() == RET_OK )
+ {
+ if (!( editedClassPath == m_pParamEditDlg->GetParameter() ) )
+ {
+ editedClassPath = m_pParamEditDlg->GetParameter();
+ if( !editedClassPath.isEmpty() ){
+ m_pAssignedList->RemoveEntry( nPos );
+ m_pAssignedList->InsertEntry( editedClassPath, nPos );
+ m_pAssignedList->SelectEntryPos( nPos );
+ }
+ }
+ }
+ else
+ {
+ m_pParamEditDlg->SetParameter( editedClassPath );
+ }
+}
short SvxJavaParameterDlg::Execute()
{
@@ -905,11 +944,18 @@ Sequence< OUString > SvxJavaParameterDlg::GetParameters() const
Sequence< OUString > aParamList( nCount );
OUString* pArray = aParamList.getArray();
for ( sal_Int32 i = 0; i < nCount; ++i )
- pArray[i] = m_pAssignedList->GetEntry(i);
+ pArray[i] = OUString( m_pAssignedList->GetEntry(i) );
return aParamList;
}
+void SvxJavaParameterDlg::DisableButtons()
+{
+ DisableAssignButton();
+ DisableEditButton();
+ DisableRemoveButton();
+}
+
void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
{
m_pAssignedList->Clear();
@@ -920,6 +966,49 @@ void SvxJavaParameterDlg::SetParameters( Sequence< OUString >& rParams )
OUString sParam = OUString( *pArray++ );
m_pAssignedList->InsertEntry( sParam );
}
+ DisableEditButton();
+ 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 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 b887093011e5..049915969743 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -43,6 +43,7 @@ typedef void* JavaInfo;
#endif
class SvxJavaParameterDlg;
+class SvxJavaParameterEditDlg;
class SvxJavaClassPathDlg;
class SvxJavaListBox;
@@ -129,6 +130,8 @@ 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);
@@ -151,6 +154,9 @@ private:
inline void EnableAssignButton()
{ m_pAssignBtn->Enable(); }
+ inline void DisableAssignButton()
+ { m_pAssignBtn->Disable(); }
+
inline void DisableRemoveButton()
{ m_pRemoveBtn->Disable(); }
@@ -167,6 +173,26 @@ public:
css::uno::Sequence< OUString > GetParameters() const;
void SetParameters( css::uno::Sequence< OUString >& rParams );
+ void DisableButtons();
+ 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 rParams );
};
// class SvxJavaClassPathDlg ---------------------------------------------
diff --git a/cui/uiconfig/ui/javastartparametersdialog.ui b/cui/uiconfig/ui/javastartparametersdialog.ui
index e1237ca77afb..bba3f96c4607 100644
--- a/cui/uiconfig/ui/javastartparametersdialog.ui
+++ b/cui/uiconfig/ui/javastartparametersdialog.ui
@@ -165,11 +165,13 @@
</child>
<child>
<object class="GtkButton" id="assignbtn">
- <property name="label" translatable="yes">_Assign</property>
+ <property name="label" translatable="yes">_Add</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
+ <property name="xalign">0.49000000953674316</property>
+ <property name="yalign">0.49000000953674316</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -177,13 +179,40 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="removebtn">
- <property name="label" translatable="yes">_Remove</property>
+ <object class="GtkBox" id="box2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">start</property>
- <property name="use_underline">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="editbtn">
+ <property name="label" translatable="yes">_Edit</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="valign">start</property>
+ <property name="use_underline">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="removebtn">
+ <property name="label" translatable="yes">_Remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="valign">start</property>
+ <property name="use_underline">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="left_attach">1</property>
@@ -191,20 +220,6 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="editbtn">
- <property name="label" translatable="yes">_Edit</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">start</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
<placeholder/>
</child>
<child>
diff --git a/cui/uiconfig/ui/javastartparameterseditdialog.ui b/cui/uiconfig/ui/javastartparameterseditdialog.ui
new file mode 100644
index 000000000000..73ebe23e5f69
--- /dev/null
+++ b/cui/uiconfig/ui/javastartparameterseditdialog.ui
@@ -0,0 +1,107 @@
+<?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/include/vcl/edit.hxx b/include/vcl/edit.hxx
index ec947b672db0..30741d517d33 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -237,6 +237,8 @@ public:
virtual void SetText( const OUString& rStr, const Selection& rNewSelection );
virtual OUString GetText() const override;
+ void SetCursorAtLast();
+
void SetPlaceholderText( const OUString& rStr );
OUString GetPlaceholderText() const;
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 55acf9f1415a..7520cb416d0d 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2699,6 +2699,12 @@ OUString Edit::GetText() const
return maText.toString();
}
+void Edit::SetCursorAtLast(){
+ OUString str = GetText();
+ sal_Int32 len = str.getLength();
+ ImplSetCursorPos( len, false );
+}
+
void Edit::SetPlaceholderText( const OUString& rStr )
{
if ( mpSubEdit )