From 86e3f95cff4d3dad48d64e50e0c4b05034fa7064 Mon Sep 17 00:00:00 2001 From: heiko tietze Date: Fri, 22 Dec 2017 13:00:31 +0100 Subject: tdf#114523 Make inline tooltips for changes optional Tooltips on tracked changes are not shown when Show track changes is switched off; additional property introduced at Tools > Option > Writer > Changes to disable the inline tooltip completely Change-Id: I5b54895bb22d167a383b06627c69326c3c2f5b02 Reviewed-on: https://gerrit.libreoffice.org/46971 Reviewed-by: Mike Kaganski Tested-by: Heiko Tietze --- .../schema/org/openoffice/Office/Writer.xcs | 8 +++++++ sw/inc/IDocumentRedlineAccess.hxx | 3 +++ sw/inc/modcfg.hxx | 21 ++++++++++------- sw/source/core/crsr/crstrvl.cxx | 5 ++++ sw/source/core/doc/DocumentRedlineManager.cxx | 10 ++++++++ sw/source/core/edit/edredln.cxx | 11 ++++++++- sw/source/core/inc/DocumentRedlineManager.hxx | 4 ++++ sw/source/ui/config/optpage.cxx | 13 +++++++++-- sw/source/uibase/config/modcfg.cxx | 27 +++++++++++----------- sw/source/uibase/inc/optpage.hxx | 2 ++ sw/uiconfig/swriter/ui/optredlinepage.ui | 16 +++++++++++++ 11 files changed, 96 insertions(+), 24 deletions(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 7a21b5bbd344..2b6465cdee93 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -2650,6 +2650,14 @@ 0 + + + + Specifies whether tooltips for track changes are shown in the document. + + + true + diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index de115fac77e0..7ff58d456ca4 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -239,6 +239,9 @@ public: virtual void SetRedlinePassword( /*[in]*/const css::uno::Sequence & rNewPassword) = 0; + virtual bool IsHideInlineTooltips() = 0; + virtual void SetHideInlineTooltips(bool bSet) = 0; + protected: virtual ~IDocumentRedlineAccess() {}; }; diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx index 2091957eedf4..bd9fa3b25c70 100644 --- a/sw/inc/modcfg.hxx +++ b/sw/inc/modcfg.hxx @@ -65,14 +65,15 @@ class SwRevisionConfig : public utl::ConfigItem { friend class SwModuleOptions; - AuthorCharAttr aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: author character attributes - //Revision/TextDisplay/Insert/Color - AuthorCharAttr aDeletedAttr; //Revision/TextDisplay/Delete/Attribute - //Revision/TextDisplay/Delete/Color - AuthorCharAttr aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute - //Revision/TextDisplay/ChangeAttribute/Color - sal_uInt16 nMarkAlign; //Revision/LinesChanged/Mark - Color aMarkColor; //Revision/LinesChanged/Color + AuthorCharAttr aInsertAttr; //Revision/TextDisplay/Insert/Attribute // Redlining: author character attributes + //Revision/TextDisplay/Insert/Color + AuthorCharAttr aDeletedAttr; //Revision/TextDisplay/Delete/Attribute + //Revision/TextDisplay/Delete/Color + AuthorCharAttr aFormatAttr; //Revision/TextDisplay/ChangeAttribute/Attribute + //Revision/TextDisplay/ChangeAttribute/Color + sal_uInt16 nMarkAlign; //Revision/LinesChanged/Mark + Color aMarkColor; //Revision/LinesChanged/Color + bool bShowInlineTooltip; //ShowInlineTooltip static const css::uno::Sequence& GetPropertyNames(); @@ -254,6 +255,10 @@ public: void SetFormatAuthorAttr( AuthorCharAttr const &rAttr ) { aRevisionConfig.aFormatAttr = rAttr; aRevisionConfig.SetModified();} + bool IsShowInlineTooltip() const { return aRevisionConfig.bShowInlineTooltip; } + void SetShowInlineTooltip( bool bSet ) { aRevisionConfig.bShowInlineTooltip = bSet; + aRevisionConfig.SetModified(); } + sal_uInt16 GetMarkAlignMode() const { return aRevisionConfig.nMarkAlign; } void SetMarkAlignMode(sal_uInt16 nMode) { aRevisionConfig.nMarkAlign = nMode; aRevisionConfig.SetModified();} diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index c55970bdfe1e..6f8b26f55c19 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1116,6 +1116,11 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, SET_CURR_SHELL( this ); bool bRet = false; + const bool bHideInlineTooltips = GetDoc()->getIDocumentRedlineAccess().IsHideInlineTooltips(); + const bool bShowTrackChanges = IDocumentRedlineAccess::IsShowChanges( GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() ); + + if (bHideInlineTooltips || !bShowTrackChanges) return bRet; + if( !IsTableMode() ) { Point aPt( rPt ); diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 6aad179ab11e..d43b5f1cb855 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2717,6 +2717,16 @@ void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode) } } +bool DocumentRedlineManager::IsHideInlineTooltips() +{ + return bHideInlineTooltips; +} + +void DocumentRedlineManager::SetHideInlineTooltips(bool bSet) +{ + bHideInlineTooltips = bSet; +} + DocumentRedlineManager::~DocumentRedlineManager() { } diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx index e99aa5c36ae3..eb1db63666e7 100644 --- a/sw/source/core/edit/edredln.cxx +++ b/sw/source/core/edit/edredln.cxx @@ -25,6 +25,7 @@ #include #include #include +#include RedlineFlags SwEditShell::GetRedlineFlags() const { @@ -130,7 +131,15 @@ void SwEditShell::UpdateRedlineAttr() SET_CURR_SHELL( this ); StartAllAction(); - GetDoc()->getIDocumentRedlineAccess().UpdateRedlineAttr(); + // issue when the changes the inline option when IsShow is off + SwDoc& rDoc = *GetDoc(); + bool bShowInlineTooltip = officecfg::Office::Writer::Revision::ShowInlineTooltip::get(); + if (bShowInlineTooltip != rDoc.getIDocumentRedlineAccess().IsHideInlineTooltips() ) + { + rDoc.getIDocumentRedlineAccess().SetHideInlineTooltips( bShowInlineTooltip ); + } + + rDoc.getIDocumentRedlineAccess().UpdateRedlineAttr(); EndAllAction(); } diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx index 88487f8dbdc6..26c8050dbb2c 100644 --- a/sw/source/core/inc/DocumentRedlineManager.hxx +++ b/sw/source/core/inc/DocumentRedlineManager.hxx @@ -30,6 +30,8 @@ namespace sw class DocumentRedlineManager : public IDocumentRedlineAccess { + bool bHideInlineTooltips : 1; + public: DocumentRedlineManager( SwDoc& i_rSwdoc ); @@ -111,6 +113,8 @@ public: virtual void SetRedlinePassword( /*[in]*/const css::uno::Sequence & rNewPassword) override; + virtual bool IsHideInlineTooltips() override; + virtual void SetHideInlineTooltips(bool bSet) override; //Non Interface methods; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 9c856f4a8f55..e929ebf10901 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -32,6 +32,8 @@ #include #include #include +#include + #include #include #include @@ -1752,6 +1754,7 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage( vcl::Window* pParent, get(m_pMarkPosLB,"markpos"); get(m_pMarkColorLB,"markcolor"); get(m_pMarkPreviewWN,"markpreview"); + get(m_pShowChangesTooltip,"changestooltip"); m_pInsertedPreviewWN->set_height_request(aPreviewSize.Height()); m_pDeletedPreviewWN->set_height_request(aPreviewSize.Height()); @@ -1810,6 +1813,7 @@ void SwRedlineOptionsTabPage::dispose() m_pMarkPosLB.clear(); m_pMarkColorLB.clear(); m_pMarkPreviewWN.clear(); + m_pShowChangesTooltip.clear(); SfxTabPage::dispose(); } @@ -1831,6 +1835,8 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) AuthorCharAttr aOldDeletedAttr(pOpt->GetDeletedAuthorAttr()); AuthorCharAttr aOldChangedAttr(pOpt->GetFormatAuthorAttr()); + const bool bOldShowInlineTooltips = pOpt->IsShowInlineTooltip(); + ColorData nOldMarkColor = pOpt->GetMarkAlignColor().GetColor(); sal_uInt16 nOldMarkMode = pOpt->GetMarkAlignMode(); @@ -1874,14 +1880,15 @@ bool SwRedlineOptionsTabPage::FillItemSet( SfxItemSet* ) case 4: nPos = text::HoriOrientation::INSIDE; break; } pOpt->SetMarkAlignMode(nPos); - pOpt->SetMarkAlignColor(m_pMarkColorLB->GetSelectEntryColor()); + pOpt->SetShowInlineTooltip( m_pShowChangesTooltip->IsChecked() ); if (!(aInsertedAttr == aOldInsertAttr) || !(aDeletedAttr == aOldDeletedAttr) || !(aChangedAttr == aOldChangedAttr) || nOldMarkColor != pOpt->GetMarkAlignColor().GetColor() || - nOldMarkMode != pOpt->GetMarkAlignMode()) + nOldMarkMode != pOpt->GetMarkAlignMode() || + bOldShowInlineTooltips != pOpt->IsShowInlineTooltip() ) { // update all documents SwDocShell* pDocShell = static_cast(SfxObjectShell::GetFirst(checkSfxObjectShell)); @@ -1920,6 +1927,8 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet* ) m_pMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor()); + m_pShowChangesTooltip->Check( pOpt->IsShowInlineTooltip() ); + m_pInsertLB->SelectEntryPos(0); m_pDeletedLB->SelectEntryPos(0); m_pChangedLB->SelectEntryPos(0); diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx index 3b7e19a82206..97ec5719c6bc 100644 --- a/sw/source/uibase/config/modcfg.cxx +++ b/sw/source/uibase/config/modcfg.cxx @@ -224,7 +224,7 @@ const Sequence& SwRevisionConfig::GetPropertyNames() static Sequence aNames; if(!aNames.getLength()) { - const int nCount = 8; + const int nCount = 9; aNames.realloc(nCount); static const char* aPropNames[] = { @@ -235,7 +235,8 @@ const Sequence& SwRevisionConfig::GetPropertyNames() "TextDisplay/ChangedAttribute/Attribute", // 4 "TextDisplay/ChangedAttribute/Color", // 5 "LinesChanged/Mark", // 6 - "LinesChanged/Color" // 7 + "LinesChanged/Color", // 7 + "ShowInlineTooltip" // 8 }; OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -257,7 +258,7 @@ SwRevisionConfig::SwRevisionConfig() : aFormatAttr.m_nItemId = SID_ATTR_CHAR_WEIGHT; aFormatAttr.m_nAttr = WEIGHT_BOLD; aFormatAttr.m_nColor = COL_BLACK; - + bShowInlineTooltip = true; Load(); } @@ -301,19 +302,18 @@ void SwRevisionConfig::ImplCommit() for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - sal_Int32 nVal = -1; switch(nProp) { - case 0 : nVal = lcl_ConvertAttrToCfg(aInsertAttr); break; - case 1 : nVal = aInsertAttr.m_nColor ; break; - case 2 : nVal = lcl_ConvertAttrToCfg(aDeletedAttr); break; - case 3 : nVal = aDeletedAttr.m_nColor ; break; - case 4 : nVal = lcl_ConvertAttrToCfg(aFormatAttr); break; - case 5 : nVal = aFormatAttr.m_nColor ; break; - case 6 : nVal = nMarkAlign ; break; - case 7 : nVal = aMarkColor.GetColor(); break; + case 0 : pValues[nProp] <<= lcl_ConvertAttrToCfg(aInsertAttr); break; + case 1 : pValues[nProp] <<= aInsertAttr.m_nColor; break; + case 2 : pValues[nProp] <<= lcl_ConvertAttrToCfg(aDeletedAttr); break; + case 3 : pValues[nProp] <<= aDeletedAttr.m_nColor; break; + case 4 : pValues[nProp] <<= lcl_ConvertAttrToCfg(aFormatAttr); break; + case 5 : pValues[nProp] <<= aFormatAttr.m_nColor; break; + case 6 : pValues[nProp] <<= nMarkAlign; break; + case 7 : pValues[nProp] <<= aMarkColor.GetColor(); break; + case 8 : pValues[nProp] <<= bShowInlineTooltip; break; } - pValues[nProp] <<= nVal; } PutProperties(aNames, aValues); } @@ -366,6 +366,7 @@ void SwRevisionConfig::Load() case 5 : aFormatAttr.m_nColor = nVal; break; case 6 : nMarkAlign = sal::static_int_cast< sal_uInt16, sal_Int32>(nVal); break; case 7 : aMarkColor.SetColor(nVal); break; + case 8 : bShowInlineTooltip = *o3tl::doAccess(pValues[nProp]); } } } diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx index 85dc244aed38..cd6552ea108e 100644 --- a/sw/source/uibase/inc/optpage.hxx +++ b/sw/source/uibase/inc/optpage.hxx @@ -328,6 +328,8 @@ class SwRedlineOptionsTabPage : public SfxTabPage VclPtr m_pMarkColorLB; VclPtr m_pMarkPreviewWN; + VclPtr m_pShowChangesTooltip; + DECL_LINK(AttribHdl, ListBox&, void); void ChangedMaskPrev(); DECL_LINK(ChangedMaskPrevHdl, ListBox&, void); diff --git a/sw/uiconfig/swriter/ui/optredlinepage.ui b/sw/uiconfig/swriter/ui/optredlinepage.ui index 4962e493af86..5c9896213e1e 100644 --- a/sw/uiconfig/swriter/ui/optredlinepage.ui +++ b/sw/uiconfig/swriter/ui/optredlinepage.ui @@ -472,6 +472,22 @@ 3 + + + Show _tooltips on changes + True + True + False + start + True + True + True + + + 0 + 4 + + -- cgit v1.2.3