summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-12-09 10:13:39 +0100
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2022-01-26 15:12:32 +0100
commita8b4f6629d4f22d702b8f3b0e8f08d467d9bf7ca (patch)
treedb5c5454e7744fb6f1d5ddef93f0f8ab02a04385
parentd8b1321955907ca906a46eda7848dc1e7683e147 (diff)
tdf#146144 sw: add tooltip to table rows with change tracking
Showing "Row Deleted" and "Row Inserted" with Author and Date (of the associated SwRangeRedline: latest tracked deletion in deleted rows, and first tracked insertion in inserted rows). Follow-up to commit c6af542a31e167e5a01908d049e399ce06a5e4e4 "tdf#146120 sw: show tracked table changes with different color" and Change-Id: I913e234de1a60311306fbebdfb1ae16dcea7cd8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126575 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 84fbb3398f7486f00e7b7dea415e1ea2510a9535) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128684 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--sw/inc/crsrsh.hxx9
-rw-r--r--sw/source/core/crsr/crstrvl.cxx24
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx28
3 files changed, 47 insertions, 14 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 4ff84bff5d93..dc633a7bc9f2 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -80,14 +80,15 @@ enum class IsAttrAtPos
NumLabel = 0x0200,
ContentCheck = 0x0400,
SmartTag = 0x0800,
- FormControl = 0x1000
+ FormControl = 0x1000,
+ TableRedline = 0x2000
#ifdef DBG_UTIL
- ,CurrAttrs = 0x2000 ///< only for debugging
- ,TableBoxValue = 0x4000 ///< only for debugging
+ ,CurrAttrs = 0x4000 ///< only for debugging
+ ,TableBoxValue = 0x8000 ///< only for debugging
#endif
};
namespace o3tl {
- template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7fff> {};
+ template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0xffff> {};
}
struct SwContentAtPos
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index b7ec27fcb6a2..da22013cc31f 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1708,6 +1708,30 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
}
}
+ if( !bRet && ( IsAttrAtPos::TableRedline & rContentAtPos.eContentAtPos ) )
+ {
+ const SwTableNode* pTableNd;
+ const SwTableBox* pBox;
+ const SwTableLine* pTableLine;
+ const SwStartNode* pSttNd = pTextNd->FindTableBoxStartNode();
+ if( pSttNd && nullptr != ( pTableNd = pTextNd->FindTableNode()) &&
+ nullptr != ( pBox = pTableNd->GetTable().GetTableBox(
+ pSttNd->GetIndex() )) &&
+ nullptr != ( pTableLine = pBox->GetUpper() ) &&
+ RedlineType::None != pTableLine->GetRedlineType() )
+ {
+ SwRedlineTable::size_type nPos = 0;
+ nPos = pTableLine->UpdateTextChangesOnly(nPos);
+ if ( nPos != SwRedlineTable::npos )
+ {
+ rContentAtPos.aFnd.pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[nPos];
+ rContentAtPos.eContentAtPos = IsAttrAtPos::TableRedline;
+ bRet = true;
+ }
+
+ }
+ }
+
if( !bRet
&& ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos
#ifdef DBG_UTIL
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index 8117db026e92..a87ae42d45e3 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -55,18 +55,22 @@
#include <comphelper/lok.hxx>
#include <authfld.hxx>
-static OUString lcl_GetRedlineHelp( const SwRangeRedline& rRedl, bool bBalloon )
+static OUString lcl_GetRedlineHelp( const SwRangeRedline& rRedl, bool bBalloon, bool bTableChange )
{
TranslateId pResId;
switch( rRedl.GetType() )
{
- case RedlineType::Insert: pResId = rRedl.IsMoved()
- ? STR_REDLINE_INSERT_MOVED
- : STR_REDLINE_INSERT;
+ case RedlineType::Insert: pResId = bTableChange
+ ? STR_REDLINE_TABLE_ROW_INSERT
+ : rRedl.IsMoved()
+ ? STR_REDLINE_INSERT_MOVED
+ : STR_REDLINE_INSERT;
break;
- case RedlineType::Delete: pResId = rRedl.IsMoved()
- ? STR_REDLINE_DELETE_MOVED
- : STR_REDLINE_DELETE;
+ case RedlineType::Delete: pResId = bTableChange
+ ? STR_REDLINE_TABLE_ROW_DELETE
+ : rRedl.IsMoved()
+ ? STR_REDLINE_DELETE_MOVED
+ : STR_REDLINE_DELETE;
break;
case RedlineType::Format: pResId = STR_REDLINE_FORMAT; break;
case RedlineType::Table: pResId = STR_REDLINE_TABLE; break;
@@ -139,7 +143,8 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
IsAttrAtPos::TableBoxValue |
( bBalloon ? IsAttrAtPos::CurrAttrs : IsAttrAtPos::NONE) |
#endif
- IsAttrAtPos::TableBoxFml );
+ IsAttrAtPos::TableBoxFml |
+ IsAttrAtPos::TableRedline );
if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) )
{
@@ -246,12 +251,15 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
break;
+ case IsAttrAtPos::TableRedline:
case IsAttrAtPos::Redline:
{
const bool bShowTrackChanges = IDocumentRedlineAccess::IsShowChanges( m_rView.GetDocShell()->GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() );
const bool bShowInlineTooltips = rSh.GetViewOptions()->IsShowInlineTooltips();
if ( bShowTrackChanges && bShowInlineTooltips )
- sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon);
+ {
+ sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon, IsAttrAtPos::TableRedline == aContentAtPos.eContentAtPos );
+ }
break;
}
@@ -376,7 +384,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
{
aContentAtPos.eContentAtPos = IsAttrAtPos::Redline;
if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) )
- sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon);
+ sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon, /*bTableChange=*/false);
}
}
}