[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/sdi sw/source

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 9 09:29:41 UTC 2020


 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu |   11 +++
 sw/inc/cmdid.h                                                      |    2 
 sw/sdi/_textsh.sdi                                                  |    6 +
 sw/sdi/swriter.sdi                                                  |   18 +++++
 sw/source/uibase/inc/navipi.hxx                                     |    2 
 sw/source/uibase/shells/textsh1.cxx                                 |   32 +++++++++
 sw/source/uibase/utlui/navipi.cxx                                   |   33 ----------
 7 files changed, 69 insertions(+), 35 deletions(-)

New commits:
commit f31accb05a1c7064a7e586ffec8f283b6ff4787e
Author:     Jim Raykowski <raykowj at gmail.com>
AuthorDate: Tue Jan 7 16:42:59 2020 -0900
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Jan 9 10:29:09 2020 +0100

    tdf#129468 Add uno command .uno:SetReminder to set a reminder bookmark
    
    Replaces code in SwNavigationPI to set a reminder with call to uno
    command
    
    Change-Id: I2f14d88c99488b1dbfdecb9831f6716c95da7438
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86389
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 584c0d0b7146..7cc090ceeed0 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -479,6 +479,17 @@
           <value>1</value>
         </prop>
       </node>
+      <node oor:name=".uno:SetReminder" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Set Reminder</value>
+        </prop>
+        <prop oor:name="TooltipLabel" oor:type="xs:string">
+          <value xml:lang="en-US">Set Reminder</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:InsertAnchor" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">Anc~hor...</value>
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 30663dbbe670..68f640199c0f 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -256,6 +256,8 @@
 #define FN_INSERT_FLD_AUTHOR    (FN_INSERT + 98)
 #define FN_INSERT_FOOTNOTE      (FN_INSERT + 99)
 
+#define FN_SET_REMINDER         (FN_INSERT + 100)
+
 // Region: Paste (Part 2)
 #define FN_MAILMERGE_SENDMAIL_CHILDWINDOW (FN_INSERT2 + 5)  /* child window provided by mailmerge */
 
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 102699cbad19..b91292dea316 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -140,6 +140,12 @@ interface BaseText
         StateMethod = GetState ;
         DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
     ]
+    FN_SET_REMINDER
+    [
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
+        DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+    ]
     FN_DELETE_BOOKMARK // status(final|play)
     [
         ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 489b6b698336..524018f1b90c 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -2555,6 +2555,24 @@ SfxVoidItem InsertBookmark FN_INSERT_BOOKMARK
     GroupId = SfxGroupId::Insert;
 ]
 
+SfxVoidItem SetReminder FN_SET_REMINDER
+
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Asynchron;
+
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    ToolBoxConfig = TRUE,
+    GroupId = SfxGroupId::Insert;
+]
+
 SfxVoidItem InsertBreak FN_INSERT_BREAK_DLG
 (SfxInt16Item Kind FN_INSERT_BREAK_DLG,SfxStringItem TemplateName FN_PARAM_1,SfxUInt16Item PageNumber FN_PARAM_2,SfxBoolItem PageNumberFilled FN_PARAM_3)
 [
diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx
index 95025b428ad9..967bdc805161 100644
--- a/sw/source/uibase/inc/navipi.hxx
+++ b/sw/source/uibase/inc/navipi.hxx
@@ -92,7 +92,6 @@ class SwNavigationPI : public PanelLayout,
     SwNavigationConfig  *m_pConfig;
     SfxBindings         &m_rBindings;
 
-    sal_uInt16  m_nAutoMarkIdx;
     RegionMode  m_nRegionMode; // 0 - URL, 1 - region with link 2 - region without link
     Size        m_aExpandedSize;
 
@@ -104,7 +103,6 @@ class SwNavigationPI : public PanelLayout,
     void ZoomIn();
 
     void FillBox();
-    void MakeMark();
 
     DECL_LINK( DocListBoxSelectHdl, ListBox&, void );
     DECL_LINK( ToolBoxSelectHdl, ToolBox *, void );
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 104bd7dbf999..2b063cee3caa 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -684,6 +684,36 @@ void SwTextShell::Execute(SfxRequest &rReq)
             }
             break;
         }
+        case FN_SET_REMINDER:
+        {
+            static sal_uInt16 m_nAutoMarkIdx = 0;
+
+            // collect and sort navigator reminder names
+            IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
+            std::vector< OUString > vNavMarkNames;
+            for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
+                ppMark != pMarkAccess->getAllMarksEnd();
+                ++ppMark)
+            {
+                if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER )
+                    vNavMarkNames.push_back((*ppMark)->GetName());
+            }
+            std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
+
+            // we are maxed out and delete one
+            // nAutoMarkIdx rotates through the available MarkNames
+            // this assumes that IDocumentMarkAccess generates Names in ascending order
+            if(vNavMarkNames.size() == MAX_MARKS)
+                pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[m_nAutoMarkIdx]));
+
+            rWrtSh.SetBookmark(vcl::KeyCode(), OUString(), IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER);
+            SwView::SetActMark( m_nAutoMarkIdx );
+
+            if(++m_nAutoMarkIdx == MAX_MARKS)
+                m_nAutoMarkIdx = 0;
+
+            break;
+        }
         case FN_AUTOFORMAT_REDLINE_APPLY:
         {
             SvxSwAutoFormatFlags aFlags(SvxAutoCorrCfg::Get().GetAutoCorrect()->GetSwFlags());
@@ -1796,7 +1826,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
                 rSet.Put(SfxBoolItem(nWhich, pApply && pApply->nColor == nWhich));
             }
             break;
-
+        case FN_SET_REMINDER:
         case FN_INSERT_BOOKMARK:
             if( rSh.IsTableMode()
                 || rSh.CursorInsideInputField() )
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index fa97463ef822..061550ad5b35 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -308,7 +308,7 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox, void )
     }
     else if (sCommand == "reminder")
     {
-        MakeMark();
+        rSh.GetView().GetViewFrame()->GetDispatcher()->Execute(FN_SET_REMINDER, SfxCallMode::ASYNCHRON);
     }
     else if (sCommand == "down" ||
              sCommand == "up" ||
@@ -491,36 +491,6 @@ IMPL_LINK( SwNavigationPI, EditGetFocus, Control&, rControl, void )
     pEdit->SetLast(nPageCnt);
 }
 
-// Setting of an automatic mark
-void SwNavigationPI::MakeMark()
-{
-    SwView *pView = GetCreateView();
-    if (!pView) return;
-    SwWrtShell &rSh = pView->GetWrtShell();
-    IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
-
-    // collect and sort navigator reminder names
-    std::vector< OUString > vNavMarkNames;
-    for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
-        ppMark != pMarkAccess->getAllMarksEnd();
-        ++ppMark)
-        if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER )
-            vNavMarkNames.push_back((*ppMark)->GetName());
-    std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
-
-    // we are maxed out and delete one
-    // nAutoMarkIdx rotates through the available MarkNames
-    // this assumes that IDocumentMarkAccess generates Names in ascending order
-    if(vNavMarkNames.size() == MAX_MARKS)
-        pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[m_nAutoMarkIdx]));
-
-    rSh.SetBookmark(vcl::KeyCode(), OUString(), IDocumentMarkAccess::MarkType::NAVIGATOR_REMINDER);
-    SwView::SetActMark( m_nAutoMarkIdx );
-
-    if(++m_nAutoMarkIdx == MAX_MARKS)
-        m_nAutoMarkIdx = 0;
-}
-
 void SwNavigationPI::ZoomOut()
 {
     if (!IsZoomedIn())
@@ -608,7 +578,6 @@ SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
     , m_pFloatingWindow(nullptr)
     , m_pConfig(SW_MOD()->GetNavigationConfig())
     , m_rBindings(*_pBindings)
-    , m_nAutoMarkIdx(1)
     , m_nRegionMode(RegionMode::NONE)
     , m_bIsZoomedIn(false)
     , m_bGlobalMode(false)


More information about the Libreoffice-commits mailing list