diff options
author | Adam Co <rattles2013@gmail.com> | 2014-02-05 13:37:45 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-12 09:38:50 +0000 |
commit | 06a887ca92f35b4e44dfc638a9a444fc636bc9d0 (patch) | |
tree | 23f0263e85e41d4686b9d3e683e953b1914481fc | |
parent | 8805a3b77bd6777154d5ce3826f211c53b4f7603 (diff) |
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>
-rw-r--r-- | sw/inc/IDocumentRedlineAccess.hxx | 4 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 1 | ||||
-rw-r--r-- | sw/inc/redline.hxx | 23 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 64 |
4 files changed, 92 insertions, 0 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 144eb4a4b131..48320be8374a 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -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; diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 10159a1cf424..e0eec09dc0eb 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -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); diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index a4e0a29e05ca..02ff2e084ea9 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -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 { diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ca12ab23398d..15cc3515a70f 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -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: */ + |