[Libreoffice-commits] core.git: sw/source sw/uiconfig

Caolán McNamara caolanm at redhat.com
Fri Aug 12 13:42:35 UTC 2016


 sw/source/ui/index/swuiidxmrk.cxx    |   42 ++++++++++++++++++---------------
 sw/source/uibase/inc/swuiidxmrk.hxx  |    2 +
 sw/uiconfig/swriter/ui/indexentry.ui |   44 ++++++++++++++++++++++-------------
 3 files changed, 53 insertions(+), 35 deletions(-)

New commits:
commit b7060e96dfef8e672ae954eb435a9513400c4ea9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Aug 12 14:37:24 2016 +0100

    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

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index a6a180d..cc82dbf 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 90d49fe..862c845 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 0c21605..ff439e3 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>


More information about the Libreoffice-commits mailing list