summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-06 17:32:45 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-07 18:17:44 +0200
commit0593afe5606b6388a705f3e8b19e427fcbf7555b (patch)
treea3e95f1bedb3fa25a6809da1e5f19203af43d5b8 /sfx2
parentda8617d69a7b27a3eeb3f26e207ddf1b4de3eeb3 (diff)
just edit Entry to readonly, instead of a shadow ro widget
Change-Id: I28d6d3cceec5224a6b38bd44ec380974cd3bae12 Reviewed-on: https://gerrit.libreoffice.org/60104 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/mgetempl.cxx39
-rw-r--r--sfx2/uiconfig/ui/managestylepage.ui67
2 files changed, 35 insertions, 71 deletions
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 86cbaef7b9f5..b878329bcf63 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -54,8 +54,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
, aFollow(pStyle->GetFollow())
, aParent(pStyle->GetParent())
, nFlags(pStyle->GetMask())
- , m_xNameRo(m_xBuilder->weld_text_view("namero"))
- , m_xNameRw(m_xBuilder->weld_entry("namerw"))
+ , m_xName(m_xBuilder->weld_entry("name"))
, m_xAutoCB(m_xBuilder->weld_check_button("autoupdate"))
, m_xFollowFt(m_xBuilder->weld_label("nextstyleft"))
, m_xFollowLb(m_xBuilder->weld_combo_box_text("nextstyle"))
@@ -68,7 +67,6 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
, m_xDescFt(m_xBuilder->weld_label("desc"))
, m_xNameFt(m_xBuilder->weld_label("nameft"))
{
- m_xNameRo->set_size_request(m_xNameRw->get_preferred_size().Width(), -1);
m_xFollowLb->make_sorted();
const int nMaxWidth(m_xFollowLb->get_approximate_digit_width() * 50);
m_xFollowLb->set_size_request(nMaxWidth , -1);
@@ -117,16 +115,14 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
aFollow = pStyle->GetFollow();
aParent = pStyle->GetParent();
}
- m_xNameRw->set_text(pStyle->GetName());
+ m_xName->set_text(pStyle->GetName());
// Set the field read-only if it is NOT an user-defined style
// but allow selecting and copying
- if (!pStyle->IsUserDefined())
+ if (pStyle->IsUserDefined())
{
- m_xNameRo->set_text(m_xNameRw->get_text());
- m_xNameRw->hide();
- m_xNameRo->show();
- m_xNameFt->set_mnemonic_widget(m_xNameRo.get());
+ m_xName->set_can_focus(true);
+ m_xName->set_editable(true);
}
if ( pStyle->HasFollowSupport() && pPool )
@@ -227,9 +223,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
if (m_xFollowLb->get_sensitive() || m_xBaseLb->get_sensitive())
{
- m_xNameRw->connect_focus_in(
+ m_xName->connect_focus_in(
LINK( this, SfxManageStyleSheetPage, GetFocusHdl ) );
- m_xNameRw->connect_focus_out(
+ m_xName->connect_focus_out(
LINK( this, SfxManageStyleSheetPage, LoseFocusHdl ) );
}
// It is a style with auto update? (SW only)
@@ -319,7 +315,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl()
IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, weld::ComboBoxText&, void)
{
OUString aTemplName(m_xFollowLb->get_active_text());
- OUString aEditTemplName(m_xNameRo->get_text());
+ OUString aEditTemplName(m_xName->get_text());
if (!( aTemplName == aEditTemplName))
m_xEditStyleBtn->set_sensitive(true);
else
@@ -468,8 +464,9 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
if ( sCmp != aName )
pStyle->SetName( aName );
- m_xNameRw->set_text( aName );
- m_xNameRw->select_region(0, -1);
+ m_xName->set_text( aName );
+ if (m_xName->get_editable())
+ m_xName->select_region(0, -1);
if ( m_xFollowLb->get_sensitive() )
{
@@ -547,7 +544,7 @@ void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet)
rSet.GetItemState( SID_ATTR_AUTO_STYLE_UPDATE, false, &pPoolItem ) )
m_xAutoCB->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
m_xAutoCB->save_state();
- m_xNameRw->save_value();
+ m_xName->save_value();
}
DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
@@ -569,20 +566,20 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
{
DeactivateRC nRet = DeactivateRC::LeavePage;
- if (m_xNameRw->get_value_changed_from_saved())
+ if (m_xName->get_value_changed_from_saved())
{
// By pressing <Enter> LoseFocus() is not triggered through StarView
- if (m_xNameRw->has_focus())
- LoseFocusHdl( *m_xNameRw );
+ if (m_xName->has_focus())
+ LoseFocusHdl( *m_xName );
- if (!pStyle->SetName(comphelper::string::stripStart(m_xNameRw->get_text(), ' ')))
+ if (!pStyle->SetName(comphelper::string::stripStart(m_xName->get_text(), ' ')))
{
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
VclMessageType::Info, VclButtonsType::Ok,
SfxResId(STR_TABPAGE_INVALIDNAME)));
xBox->run();
- m_xNameRw->grab_focus();
- m_xNameRw->select_region(0, -1);
+ m_xName->grab_focus();
+ m_xName->select_region(0, -1);
return DeactivateRC::KeepPage;
}
bModified = true;
diff --git a/sfx2/uiconfig/ui/managestylepage.ui b/sfx2/uiconfig/ui/managestylepage.ui
index 30dbb6ddf707..54841c9c0c07 100644
--- a/sfx2/uiconfig/ui/managestylepage.ui
+++ b/sfx2/uiconfig/ui/managestylepage.ui
@@ -36,7 +36,7 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="managestylepage|nameft">_Name:</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">namerw</property>
+ <property name="mnemonic_widget">name</property>
<property name="xalign">1</property>
</object>
<packing>
@@ -102,7 +102,7 @@
<object class="GtkButton" id="editstyle">
<property name="label" translatable="yes" context="managestylepage|editstyle">Edit Style</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="receives_default">False</property>
</object>
<packing>
@@ -126,7 +126,7 @@
<object class="GtkButton" id="editlinkstyle">
<property name="label" translatable="yes" context="managestylepage|editlinkstyle">Edit Style</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="receives_default">False</property>
</object>
<packing>
@@ -147,53 +147,6 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkEntry" id="namerw">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="width_chars">52</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
- <property name="vscrollbar_policy">never</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkTextView" id="namero">
- <property name="can_focus">True</property>
- <property name="no_show_all">True</property>
- <property name="valign">center</property>
- <property name="hexpand">True</property>
- <property name="editable">False</property>
- <property name="cursor_visible">False</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
<object class="GtkCheckButton" id="autoupdate">
<property name="label" translatable="yes" context="managestylepage|autoupdate">_AutoUpdate</property>
<property name="can_focus">True</property>
@@ -209,6 +162,20 @@
</packing>
</child>
<child>
+ <object class="GtkEntry" id="name">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">center</property>
+ <property name="hexpand">True</property>
+ <property name="editable">False</property>
+ <property name="width_chars">52</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
<child>