summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-01-07 16:42:59 -0900
committerJim Raykowski <raykowj@gmail.com>2020-01-09 10:29:09 +0100
commitf31accb05a1c7064a7e586ffec8f283b6ff4787e (patch)
tree3e69b5153775997615c2c7f5ce29fb1cd53b11f1 /sw
parentbb362ca226a0089a1b036366e9ffc45ab5c90d8d (diff)
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@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/cmdid.h2
-rw-r--r--sw/sdi/_textsh.sdi6
-rw-r--r--sw/sdi/swriter.sdi18
-rw-r--r--sw/source/uibase/inc/navipi.hxx2
-rw-r--r--sw/source/uibase/shells/textsh1.cxx32
-rw-r--r--sw/source/uibase/utlui/navipi.cxx33
6 files changed, 58 insertions, 35 deletions
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)