Add support for 'Table Cell Redlines' in SW core
This patch adds support for 'Table Cell Redlines' (such as 'table cell inserted' or 'table cell deleted' in SW core). It adds the 'SwTableCellRedline' object, and adds a function for adding objects of that type to the 'SwExtraRedlineTbl', which is the object that holds all the redlines which are not 'Ranged' redlines. Change-Id: Ic2e410be58683f171ea07d430b7544600780711e Reviewed-on: https://gerrit.libreoffice.org/7873 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
class SwRangeRedline;
|
||||
class SwTableRowRedline;
|
||||
class SwTableCellRedline;
|
||||
class SwRedlineTbl;
|
||||
class SwExtraRedlineTbl;
|
||||
class SwPaM;
|
||||
@@ -69,6 +70,8 @@ namespace nsRedlineType_t
|
||||
const RedlineType_t REDLINE_PARAGRAPH_FORMAT = 0x5;// Paragraph attributes have been changed.
|
||||
const RedlineType_t REDLINE_TABLE_ROW_INSERT = 0x6;// Table row has been inserted.
|
||||
const RedlineType_t REDLINE_TABLE_ROW_DELETE = 0x7;// Table row has been deleted.
|
||||
const RedlineType_t REDLINE_TABLE_CELL_INSERT = 0x8;// Table cell has been inserted.
|
||||
const RedlineType_t REDLINE_TABLE_CELL_DELETE = 0x9;// Table cell has been deleted.
|
||||
|
||||
// When larger than 128, flags can be inserted.
|
||||
const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
|
||||
@@ -149,6 +152,7 @@ public:
|
||||
virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
||||
|
||||
virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
||||
virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
|
||||
|
||||
virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
|
||||
|
||||
|
@@ -772,6 +772,7 @@ public:
|
||||
virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const;
|
||||
virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete);
|
||||
virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete);
|
||||
virtual bool AppendTableCellRedline(/*[in]*/SwTableCellRedline* pPtr, /*[in]*/bool bCallDelete);
|
||||
virtual bool SplitRedline(const SwPaM& rPam);
|
||||
virtual bool DeleteRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
|
||||
virtual bool DeleteRedline(/*[in]*/const SwStartNode& rSection, /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType);
|
||||
|
@@ -333,6 +333,29 @@ public:
|
||||
{ return *pRedlineData; }
|
||||
};
|
||||
|
||||
/// Redline that holds information about a table-cell that had some change
|
||||
class SW_DLLPUBLIC SwTableCellRedline : public SwExtraRedline
|
||||
{
|
||||
private:
|
||||
SwRedlineData* pRedlineData;
|
||||
const SwTableBox* pTableBox;
|
||||
|
||||
public:
|
||||
SwTableCellRedline( const SwRedlineData& rData, SwTableBox& aTableBox );
|
||||
SwTableCellRedline( const SwTableCellRedline& );
|
||||
virtual ~SwTableCellRedline();
|
||||
|
||||
/** ExtraData gets copied, the pointer is therefor not taken over by
|
||||
* the RedLineObject.*/
|
||||
void SetExtraData( const SwRedlineExtraData* pData )
|
||||
{ pRedlineData->SetExtraData( pData ); }
|
||||
const SwRedlineExtraData* GetExtraData() const
|
||||
{ return pRedlineData->GetExtraData(); }
|
||||
const SwTableBox* GetTableBox() const
|
||||
{ return pTableBox; }
|
||||
const SwRedlineData& GetRedlineData() const
|
||||
{ return *pRedlineData; }
|
||||
};
|
||||
|
||||
class SW_DLLPUBLIC SwRedlineHint : public SfxHint
|
||||
{
|
||||
|
@@ -4058,4 +4058,68 @@ bool SwDoc::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool bCallDelete
|
||||
return ( 0 != pNewRedl ) || bMerged;
|
||||
}
|
||||
|
||||
SwTableCellRedline::SwTableCellRedline( const SwRedlineData& rData, SwTableBox& aTableBox )
|
||||
: pRedlineData( new SwRedlineData( rData ))
|
||||
{
|
||||
pTableBox = &aTableBox;
|
||||
}
|
||||
|
||||
SwTableCellRedline::SwTableCellRedline( const SwTableCellRedline& rCpy )
|
||||
: SwExtraRedline( rCpy )
|
||||
{
|
||||
pTableBox = rCpy.pTableBox;
|
||||
}
|
||||
|
||||
SwTableCellRedline::~SwTableCellRedline()
|
||||
{
|
||||
}
|
||||
|
||||
bool SwDoc::AppendTableCellRedline( SwTableCellRedline* pNewRedl, bool bCallDelete )
|
||||
{
|
||||
(void)bCallDelete;
|
||||
|
||||
// TO-DO - equivelant for 'SwTableCellRedline'
|
||||
bool bMerged = false;
|
||||
/*
|
||||
_CHECK_REDLINE( this )
|
||||
*/
|
||||
|
||||
if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
|
||||
{
|
||||
// TO-DO - equivelant for 'SwTableCellRedline'
|
||||
/*
|
||||
pNewRedl->InvalidateRange();
|
||||
*/
|
||||
|
||||
// ===========================================================
|
||||
// Make equivelant of 'AppendRedline' checks inside here too
|
||||
// ===========================================================
|
||||
|
||||
mpExtraRedlineTbl->Insert( pNewRedl );
|
||||
}
|
||||
else
|
||||
{
|
||||
// TO DO - equivelant for 'SwTableCellRedline'
|
||||
/*
|
||||
if( bCallDelete && nsRedlineType_t::REDLINE_DELETE == pNewRedl->GetType() )
|
||||
{
|
||||
RedlineMode_t eOld = meRedlineMode;
|
||||
// Set to NONE, so that the Delete::Redo merges the Redline data correctly!
|
||||
// The ShowMode needs to be retained!
|
||||
meRedlineMode = (RedlineMode_t)(eOld & ~(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_IGNORE));
|
||||
DeleteAndJoin( *pNewRedl );
|
||||
meRedlineMode = eOld;
|
||||
}
|
||||
delete pNewRedl, pNewRedl = 0;
|
||||
*/
|
||||
}
|
||||
// TO-DO - equivelant for 'SwTableCellRedline'
|
||||
/*
|
||||
_CHECK_REDLINE( this )
|
||||
*/
|
||||
|
||||
return ( 0 != pNewRedl ) || bMerged;
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
|
Reference in New Issue
Block a user