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>
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 4ff84bf..dc633a7 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 b7ec27f..da22013 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 8117db0..a87ae42 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);
}
}
}