summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorScott Clarke <scott.clarke@codethink.co.uk>2019-06-11 13:07:20 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-08-28 09:07:38 +0200
commit6498a896796a229a6b580782676cd06978b1cc0e (patch)
tree5b7f8c8304eaa00baa13bfa68238c7c56666f235 /sw
parent78172b81a4cabdd39bea4dd037c3cd8309d6c57a (diff)
tdf#119228 Add 'Resolved Comments' option to the View menu.
Co-authored-by: Jim MacArthur <jim.macarthur@codethink.co.uk> (cherry picked from commit fb3a0b084701ee1089a76568b3b110ac5b0df460) Conflicts: sw/uiconfig/swriter/menubar/menubar.xml sw/uiconfig/swxform/menubar/menubar.xml Change-Id: Ib4554b77857992959a386c71e99e424579196ded Reviewed-on: https://gerrit.libreoffice.org/78185 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/PostItMgr.hxx1
-rw-r--r--sw/inc/viewopt.hxx11
-rw-r--r--sw/sdi/_viewsh.sdi8
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx6
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx15
-rw-r--r--sw/source/uibase/uiview/view0.cxx25
-rw-r--r--sw/uiconfig/swriter/menubar/menubar.xml1
-rw-r--r--sw/uiconfig/swriter/ui/viewoptionspage.ui22
-rw-r--r--sw/uiconfig/swxform/menubar/menubar.xml1
9 files changed, 84 insertions, 6 deletions
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
index 4a241dfcbb8a..c660abef9385 100644
--- a/sw/inc/PostItMgr.hxx
+++ b/sw/inc/PostItMgr.hxx
@@ -214,6 +214,7 @@ class SwPostItMgr: public SfxListener
void Hide();
void Show();
void UpdateResolvedStatus(sw::annotation::SwAnnotationWin* topNote);
+ void ShowHideResolvedNotes(bool visible);
void Rescale();
diff --git a/sw/inc/viewopt.hxx b/sw/inc/viewopt.hxx
index 2f9332789451..7ce49c27bf51 100644
--- a/sw/inc/viewopt.hxx
+++ b/sw/inc/viewopt.hxx
@@ -91,10 +91,11 @@ enum class ViewOptFlags2 {
ScrollbarTips = 0x00400000,
PrintFormat = 0x00800000,
ShadowCursor = 0x01000000,
- VRulerRight = 0x02000000
+ VRulerRight = 0x02000000,
+ ResolvedPostits = 0x04000000,
};
namespace o3tl {
- template<> struct typed_flags<ViewOptFlags2> : is_typed_flags<ViewOptFlags2, 0x03d7dc00> {};
+ template<> struct typed_flags<ViewOptFlags2> : is_typed_flags<ViewOptFlags2, 0x07d7dc00> {};
};
// Table background.
@@ -258,6 +259,12 @@ public:
{ return bool(m_nCoreOptions & ViewOptFlags1::Postits); }
void SetPostIts( bool b )
{ SetCoreOption(b, ViewOptFlags1::Postits); }
+
+ bool IsResolvedPostIts() const
+ { return bool(m_nUIOptions & ViewOptFlags2::ResolvedPostits); }
+ void SetResolvedPostIts( bool b )
+ { SetUIOption(b, ViewOptFlags2::ResolvedPostits); }
+
static void PaintPostIts( OutputDevice *pOut, const SwRect &rRect,
bool bIsScript );
static sal_uInt16 GetPostItsWidth( const OutputDevice *pOut );
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 19b15226dac7..824eb2f0e6e3 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -805,6 +805,14 @@ interface BaseTextEditView
StateMethod = StateViewOptions ;
Export = FALSE;
]
+
+ SID_TOGGLE_RESOLVED_NOTES
+ [
+ ExecMethod = ExecViewOptions ;
+ StateMethod = StateViewOptions ;
+ Export = FALSE;
+ ]
+
// Everything from here can be removed (Export = FALSE;), if the previous works
FN_RULER // status()
[
diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx
index 1bef5a9d8740..420c350fce26 100644
--- a/sw/source/uibase/docvw/AnnotationWin.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin.cxx
@@ -46,6 +46,7 @@
#include <txtfld.hxx>
#include <ndtxt.hxx>
#include <view.hxx>
+#include <viewopt.hxx>
#include <wrtsh.hxx>
#include <docsh.hxx>
#include <doc.hxx>
@@ -220,7 +221,10 @@ void SwAnnotationWin::SetPostItText()
void SwAnnotationWin::SetResolved(bool resolved)
{
static_cast<SwPostItField*>(mpFormatField->GetField())->SetResolved(resolved);
- mrSidebarItem.bShow = !IsResolved();
+ const SwViewOption* pVOpt = mrView.GetWrtShellPtr()->GetViewOptions();
+ mrSidebarItem.bShow = !IsResolved() || (pVOpt->IsResolvedPostIts());
+
+ mpTextRangeOverlay.reset();
if(IsResolved())
mpMetadataResolved->Show();
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a3015ddfcae8..25066fa32d07 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -2446,6 +2446,21 @@ void SwPostItMgr::GetAllSidebarWinForFrame( const SwFrame& rFrame,
}
}
+void SwPostItMgr::ShowHideResolvedNotes(bool visible) {
+ for (auto const& pPage : mPages)
+ {
+ for(auto b = pPage->mvSidebarItems.begin(); b!= pPage->mvSidebarItems.end(); ++b)
+ {
+ if ((*b)->pPostIt->IsThreadResolved())
+ {
+ (*b)->pPostIt->SetResolved(true);
+ (*b)->pPostIt->GetSidebarItem().bShow = visible;
+ }
+ }
+ }
+ LayoutPostIts();
+}
+
void SwPostItMgr::UpdateResolvedStatus(sw::annotation::SwAnnotationWin* topNote) {
// Given the topmost note as an argument, scans over all notes and sets the
// 'resolved' state of each descendant of the top notes to the resolved state
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index a47b720dcbcb..c17996a4ee7c 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -181,9 +181,10 @@ void SwView::RecheckBrowseMode()
SID_RULER_BORDERS, SID_RULER_PAGE_POS,
//SID_ATTR_LONG_LRSPACE,
SID_HTML_MODE,
- SID_RULER_PROTECT,
+ SID_RULER_PROTECT, /* 10915 */
//SID_AUTOSPELL_CHECK,
//SID_AUTOSPELL_MARKOFF,
+ SID_TOGGLE_RESOLVED_NOTES, /* 11672*/
FN_RULER, /*20211*/
FN_VIEW_GRAPHIC, /*20213*/
FN_VIEW_BOUNDS, /**/
@@ -275,6 +276,17 @@ void SwView::StateViewOptions(SfxItemSet &rSet)
aBool.SetValue( pOpt->IsPostIts());
break;
}
+ case SID_TOGGLE_RESOLVED_NOTES:
+ {
+ if (!GetPostItMgr()->HasNotes())
+ {
+ rSet.DisableItem(nWhich);
+ nWhich = 0;
+ }
+ else
+ aBool.SetValue( pOpt->IsResolvedPostIts());
+ break;
+ }
case FN_VIEW_HIDDEN_PARA:
aBool.SetValue( pOpt->IsShowHiddenPara()); break;
case FN_VIEW_HIDE_WHITESPACE:
@@ -423,6 +435,17 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
GetPostItMgr()->CheckMetaText();
break;
+ case SID_TOGGLE_RESOLVED_NOTES:
+ if ( STATE_TOGGLE == eState )
+ bFlag = pOpt->IsResolvedPostIts();
+
+ GetPostItMgr()->ShowHideResolvedNotes(!bFlag);
+
+ GetPostItMgr()->SetLayout();
+ pOpt->SetResolvedPostIts( !bFlag );
+
+ break;
+
case FN_VIEW_HIDDEN_PARA:
if ( STATE_TOGGLE == eState )
bFlag = !pOpt->IsShowHiddenPara();
diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml
index c26df564b5ff..7c6ac205475b 100644
--- a/sw/uiconfig/swriter/menubar/menubar.xml
+++ b/sw/uiconfig/swriter/menubar/menubar.xml
@@ -204,6 +204,7 @@
</menu:menu>
<menu:menuitem menu:id=".uno:HideWhitespace"/>
<menu:menuitem menu:id=".uno:ViewTrackChanges"/>
+ <menu:menuitem menu:id=".uno:ShowResolvedAnnotations"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Marks"/>
<menu:menuitem menu:id=".uno:Fieldnames"/>
diff --git a/sw/uiconfig/swriter/ui/viewoptionspage.ui b/sw/uiconfig/swriter/ui/viewoptionspage.ui
index b5d64b2031c0..1e7580404d06 100644
--- a/sw/uiconfig/swriter/ui/viewoptionspage.ui
+++ b/sw/uiconfig/swriter/ui/viewoptionspage.ui
@@ -166,12 +166,13 @@
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="changestooltip">
- <property name="label" translatable="yes" context="viewoptionspage|changestooltip">_Tooltips on tracked changes</property>
+ <object class="GtkCheckButton" id="resolvedcomments">
+ <property name="label" translatable="yes" context="viewoptionspage|resolvedcomments">_Resolved comments</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
+ <property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
@@ -179,6 +180,23 @@
<property name="top_attach">5</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="changestooltip">
+ <property name="label" translatable="yes" context="viewoptionspage|changestooltip">_Tooltips on tracked changes</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ <property name="xalign">0</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml
index c09dc4b2c694..cff4f1bce069 100644
--- a/sw/uiconfig/swxform/menubar/menubar.xml
+++ b/sw/uiconfig/swxform/menubar/menubar.xml
@@ -203,6 +203,7 @@
</menu:menu>
<menu:menuitem menu:id=".uno:HideWhitespace"/>
<menu:menuitem menu:id=".uno:ViewTrackChanges"/>
+ <menu:menuitem menu:id=".uno:ShowResolvedAnnotations"/>
<menu:menuseparator/>
<menu:menuitem menu:id=".uno:Marks"/>
<menu:menuitem menu:id=".uno:Fieldnames"/>