summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-08-12 14:37:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-08-12 14:42:05 +0100
commitb7060e96dfef8e672ae954eb435a9513400c4ea9 (patch)
tree4b85185a5f91a675339ebffe7be311b76ae12b18
parentb9898f03eb05411c508b1b02588812074d40417a (diff)
Resolves: tdf#87686 don't refresh index entry from selection on regain focus
Remain populating it from the initial selection on popup, but on losing focus and regaining it, leave the contents alone. Provide a refresh button to provide access to optionally updating the contents from the document selection. Change-Id: Ifcde5fac341655f1219f4d2a7057e788d3bb0b18
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx42
-rw-r--r--sw/source/uibase/inc/swuiidxmrk.hxx2
-rw-r--r--sw/uiconfig/swriter/ui/indexentry.ui44
3 files changed, 53 insertions, 35 deletions
diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index a6a180d67ba9..cc82dbfa5d3c 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -97,6 +97,8 @@ SwIndexMarkPane::SwIndexMarkPane(Dialog &rDialog, bool bNewDlg,
rDialog.get(m_pTypeDCB, "typecb");
rDialog.get(m_pNewBT, "new");
rDialog.get(m_pEntryED, "entryed");
+ rDialog.get(m_pSyncED, "sync");
+ m_pSyncED->Show();
rDialog.get(m_pPhoneticFT0, "phonetic0ft");
rDialog.get(m_pPhoneticED0, "phonetic0ed");
rDialog.get(m_pKey1FT, "key1ft");
@@ -151,6 +153,7 @@ SwIndexMarkPane::SwIndexMarkPane(Dialog &rDialog, bool bNewDlg,
m_pPhoneticED0->SetModifyHdl(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
m_pPhoneticED1->SetModifyHdl(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
m_pPhoneticED2->SetModifyHdl(LINK(this,SwIndexMarkPane, PhoneticEDModifyHdl));
+ m_pSyncED->SetClickHdl(LINK(this, SwIndexMarkPane, SyncSelectionHdl));
if(bNewMark)
{
@@ -359,32 +362,33 @@ OUString SwIndexMarkPane::GetDefaultPhoneticReading( const OUString& rText )
return xExtendedIndexEntrySupplier->getPhoneticCandidate(rText, LanguageTag::convertToLocale( nLangForPhoneticReading ));
}
-// Change the content of m_pEntryED if text is selected
void SwIndexMarkPane::Activate()
{
// display current selection (first element) ????
- if(bNewMark)
+ if (bNewMark)
{
- if (pSh->GetCursorCnt() < 2)
- {
- bSelected = !pSh->HasSelection();
- aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
- m_pEntryED->SetText(aOrgStr);
-
- //to include all equal entries may only be allowed in the body and even there
- //only when a simple selection exists
- const FrameTypeFlags nFrameType = pSh->GetFrameType(nullptr,true);
- m_pApplyToAllCB->Show();
- m_pSearchCaseSensitiveCB->Show();
- m_pSearchCaseWordOnlyCB->Show();
- m_pApplyToAllCB->Enable(!aOrgStr.isEmpty() &&
- !(nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER | FrameTypeFlags::FLY_ANY )));
- SearchTypeHdl(m_pApplyToAllCB);
- }
- ModifyHdl(m_pTypeDCB);
+ m_pSyncED->Enable(pSh->GetCursorCnt() < 2);
}
}
+IMPL_LINK_NOARG_TYPED(SwIndexMarkPane, SyncSelectionHdl, Button*, void)
+{
+ bSelected = !pSh->HasSelection();
+ aOrgStr = pSh->GetView().GetSelectionTextParam(true, false);
+ m_pEntryED->SetText(aOrgStr);
+
+ //to include all equal entries may only be allowed in the body and even there
+ //only when a simple selection exists
+ const FrameTypeFlags nFrameType = pSh->GetFrameType(nullptr,true);
+ m_pApplyToAllCB->Show();
+ m_pSearchCaseSensitiveCB->Show();
+ m_pSearchCaseWordOnlyCB->Show();
+ m_pApplyToAllCB->Enable(!aOrgStr.isEmpty() &&
+ !(nFrameType & ( FrameTypeFlags::HEADER | FrameTypeFlags::FOOTER | FrameTypeFlags::FLY_ANY )));
+ SearchTypeHdl(m_pApplyToAllCB);
+ ModifyHdl(m_pTypeDCB);
+}
+
// evaluate Ok-Button
void SwIndexMarkPane::Apply()
{
diff --git a/sw/source/uibase/inc/swuiidxmrk.hxx b/sw/source/uibase/inc/swuiidxmrk.hxx
index 90d49fe10485..862c845d0b2d 100644
--- a/sw/source/uibase/inc/swuiidxmrk.hxx
+++ b/sw/source/uibase/inc/swuiidxmrk.hxx
@@ -57,6 +57,7 @@ class SwIndexMarkPane
VclPtr<PushButton> m_pNewBT;
VclPtr<Edit> m_pEntryED;
+ VclPtr<PushButton> m_pSyncED;
VclPtr<FixedText> m_pPhoneticFT0;
VclPtr<Edit> m_pPhoneticED0;
@@ -109,6 +110,7 @@ class SwIndexMarkPane
DECL_LINK_TYPED( InsertHdl, Button *, void );
DECL_LINK_TYPED( CloseHdl, Button*, void );
+ DECL_LINK_TYPED( SyncSelectionHdl, Button*, void );
DECL_LINK_TYPED( DelHdl, Button*, void );
DECL_LINK_TYPED( NextHdl, Button*, void );
DECL_LINK_TYPED( NextSameHdl, Button*, void );
diff --git a/sw/uiconfig/swriter/ui/indexentry.ui b/sw/uiconfig/swriter/ui/indexentry.ui
index 0c21605c39d0..ff439e3f7184 100644
--- a/sw/uiconfig/swriter/ui/indexentry.ui
+++ b/sw/uiconfig/swriter/ui/indexentry.ui
@@ -35,6 +35,11 @@
<property name="can_focus">False</property>
<property name="stock">gtk-goto-last</property>
</object>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-refresh</property>
+ </object>
<object class="GtkDialog" id="IndexEntryDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -280,18 +285,6 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="entryed">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">2</property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="key1ft">
<property name="visible">True</property>
<property name="sensitive">False</property>
@@ -501,8 +494,6 @@
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry">
<property name="sensitive">False</property>
@@ -522,8 +513,6 @@
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="has_entry">True</property>
- <property name="entry_text_column">0</property>
- <property name="id_column">1</property>
<child internal-child="entry">
<object class="GtkEntry" id="comboboxtext-entry2">
<property name="sensitive">False</property>
@@ -539,6 +528,29 @@
</packing>
</child>
<child>
+ <object class="GtkButton" id="sync">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Update entry from selection</property>
+ <property name="image">image6</property>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entryed">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
<child>