sw/inc/IDocumentRedlineAccess.hxx | 4 ++ sw/inc/doc.hxx | 1 sw/inc/redline.hxx | 23 +++++++++++++ sw/source/core/doc/docredln.cxx | 64 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+)
New commits: commit 06a887ca92f35b4e44dfc638a9a444fc636bc9d0 Author: Adam Co <rattles2...@gmail.com> Date: Wed Feb 5 13:37:45 2014 +0200 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 <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 144eb4a..48320be 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 10159a1..e0eec09 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 a4e0a29..02ff2e0 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 ca12ab2..15cc351 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: */ + _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits