summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Co <rattles2013@gmail.com>2014-02-03 17:44:22 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-11 14:18:34 +0000
commitd688069023959ab97d14eb1dbfd5bf6ad3c1b160 (patch)
tree18eec4c66e6e5a2177a5b008ae8ebf64688993cb
parent6cab3069caf9fd5c1ce938d2891e14e6eec7850b (diff)
Add support for 'Table Row Redlines' in SW core
This patch adds support for 'Table Row Redlines' (such as 'table row inserted' or 'table row deleted' in SW core). This is done by adding a new object called 'SwExtraRedlineTbl' that holds all the redlines that are not of type 'SwRangedRedline'. Also this patch adds a function for adding these types of redlines to the 'SwExtraRedlineTbl' object. It also further develops the 'SwTableRowRedline' object. Change-Id: Ic285f33e4f5af8f197d8fc24c2a8a3777755afad Reviewed-on: https://gerrit.libreoffice.org/7821 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/inc/IDocumentRedlineAccess.hxx9
-rw-r--r--sw/inc/doc.hxx8
-rw-r--r--sw/inc/redline.hxx19
-rw-r--r--sw/source/core/doc/docnew.cxx3
-rw-r--r--sw/source/core/doc/docredln.cxx63
5 files changed, 91 insertions, 11 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx
index 8125717feb5e..144eb4a4b131 100644
--- a/sw/inc/IDocumentRedlineAccess.hxx
+++ b/sw/inc/IDocumentRedlineAccess.hxx
@@ -28,7 +28,9 @@
#include <com/sun/star/uno/Sequence.hxx>
class SwRangeRedline;
+ class SwTableRowRedline;
class SwRedlineTbl;
+ class SwExtraRedlineTbl;
class SwPaM;
struct SwPosition;
class SwStartNode;
@@ -64,7 +66,9 @@ namespace nsRedlineType_t
const RedlineType_t REDLINE_FORMAT = 0x2;// Attributes have been applied.
const RedlineType_t REDLINE_TABLE = 0x3;// Table structure has been altered.
const RedlineType_t REDLINE_FMTCOLL = 0x4;// Style has been altered (Autoformat!).
- const RedlineType_t REDLINE_PARAGRAPH_FORMAT = 0x5;// Paragraph attributes have been changed
+ 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.
// When larger than 128, flags can be inserted.
const RedlineType_t REDLINE_NO_FLAG_MASK = 0x7F;
@@ -126,6 +130,7 @@ public:
virtual bool IsIgnoreRedline() const = 0;
virtual const SwRedlineTbl& GetRedlineTbl() const = 0;
+ virtual const SwExtraRedlineTbl& GetExtraRedlineTbl() const = 0;
virtual bool IsInRedlines(const SwNode& rNode) const = 0;
@@ -143,6 +148,8 @@ public:
*/
virtual bool AppendRedline(/*[in]*/SwRangeRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
+ virtual bool AppendTableRowRedline(/*[in]*/SwTableRowRedline* pPtr, /*[in]*/bool bCallDelete) = 0;
+
virtual bool SplitRedline(/*[in]*/const SwPaM& rPam) = 0;
virtual bool DeleteRedline(
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 2450a811f620..10159a1cf424 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -144,6 +144,7 @@ class SwPageDesc;
class SwPagePreviewPrtData;
class SwRangeRedline;
class SwRedlineTbl;
+class SwExtraRedlineTbl;
class SwRootFrm;
class SwRubyList;
class SwRubyListEntry;
@@ -356,8 +357,9 @@ class SW_DLLPUBLIC SwDoc :
/// relation between list style and its default list
tHashMapForLists maListStyleLists;
- SwRedlineTbl *mpRedlineTbl; ///< List of all Redlines.
- OUString *mpAutoFmtRedlnComment; ///< Comment for Redlines inserted via AutoFormat.
+ SwRedlineTbl *mpRedlineTbl; ///< List of all Ranged Redlines.
+ SwExtraRedlineTbl *mpExtraRedlineTbl; ///< List of all Extra Redlines.
+ OUString *mpAutoFmtRedlnComment; ///< Comment for Redlines inserted via AutoFormat.
SwUnoCrsrTbl *mpUnoCrsrTbl;
@@ -767,7 +769,9 @@ public:
virtual bool IsIgnoreRedline() const;
virtual bool IsInRedlines(const SwNode& rNode) const;
virtual const SwRedlineTbl& GetRedlineTbl() const;
+ 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 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 3dc9dea3e587..a4e0a29e05ca 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -304,7 +304,7 @@ public:
class SW_DLLPUBLIC SwExtraRedline
{
public:
- SwExtraRedline( RedlineType_t eType );
+ SwExtraRedline( );
SwExtraRedline( const SwExtraRedline& );
virtual ~SwExtraRedline();
};
@@ -312,10 +312,25 @@ public:
/// Redline that holds information about a table-row that had some change
class SW_DLLPUBLIC SwTableRowRedline : public SwExtraRedline
{
+private:
+ SwRedlineData* pRedlineData;
+ const SwTableLine* pTableLine;
+
public:
- SwTableRowRedline( RedlineType_t eType, SwTableLine* pTableLine );
+ SwTableRowRedline( const SwRedlineData& rData, SwTableLine& aTableLine );
SwTableRowRedline( const SwTableRowRedline& );
virtual ~SwTableRowRedline();
+
+ /** 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 SwTableLine* GetTableLine() const
+ { return pTableLine; }
+ const SwRedlineData& GetRedlineData() const
+ { return *pRedlineData; }
};
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 86f43cba78e1..4b37bc1ba01f 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -225,6 +225,7 @@ SwDoc::SwDoc()
maLists(),
maListStyleLists(),
mpRedlineTbl( new SwRedlineTbl ),
+ mpExtraRedlineTbl ( new SwExtraRedlineTbl ),
mpAutoFmtRedlnComment( 0 ),
mpUnoCrsrTbl( new SwUnoCrsrTbl() ),
mpPgPViewPrtData( 0 ),
@@ -529,6 +530,7 @@ SwDoc::~SwDoc()
mbDtor = true;
delete mpRedlineTbl;
+ delete mpExtraRedlineTbl;
delete mpUnoCrsrTbl;
delete mpAutoFmtRedlnComment;
delete mpUpdtFlds;
@@ -804,6 +806,7 @@ void SwDoc::ClearDoc()
"not all DrawObjects removed from the page" );
mpRedlineTbl->DeleteAndDestroyAll();
+ mpExtraRedlineTbl->DeleteAndDestroyAll();
delete mpACEWord;
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8d599da170a5..7bfef2cdc7da 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -210,6 +210,11 @@ const SwRedlineTbl& SwDoc::GetRedlineTbl() const
return *mpRedlineTbl;
}
+const SwExtraRedlineTbl& SwDoc::GetExtraRedlineTbl() const
+{
+ return *mpExtraRedlineTbl;
+}
+
bool SwDoc::IsRedlineMove() const
{
return mbIsRedlineMove;
@@ -3949,9 +3954,8 @@ void SwExtraRedlineTbl::DeleteAndDestroyAll()
}
-SwExtraRedline::SwExtraRedline( RedlineType_t eTyp )
+SwExtraRedline::SwExtraRedline( )
{
- (void)eTyp;
}
SwExtraRedline::SwExtraRedline( const SwExtraRedline& rCpy )
@@ -3963,20 +3967,67 @@ SwExtraRedline::~SwExtraRedline()
{
}
-SwTableRowRedline::SwTableRowRedline( RedlineType_t eTyp, SwTableLine* pTableLine )
-:SwExtraRedline( eTyp )
+SwTableRowRedline::SwTableRowRedline( const SwRedlineData& rData, SwTableLine& aTableLine )
+: pRedlineData( new SwRedlineData( rData ))
{
- (void)pTableLine;
+ pTableLine = &aTableLine;
}
SwTableRowRedline::SwTableRowRedline( const SwTableRowRedline& rCpy )
: SwExtraRedline( rCpy )
{
- (void)rCpy;
+ pTableLine = rCpy.pTableLine;
}
SwTableRowRedline::~SwTableRowRedline()
{
}
+bool SwDoc::AppendTableRowRedline( SwTableRowRedline* pNewRedl, bool bCallDelete )
+{
+ (void)bCallDelete;
+
+ // TO-DO - equivelant for 'SwTableRowRedline'
+ bool bMerged = false;
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ if (IsRedlineOn() && !IsShowOriginal(meRedlineMode))
+ {
+ // TO-DO - equivelant for 'SwTableRowRedline'
+ /*
+ pNewRedl->InvalidateRange();
+ */
+
+ // ===========================================================
+ // Make equivelant of 'AppendRedline' checks inside here too
+ // ===========================================================
+
+ mpExtraRedlineTbl->Insert( pNewRedl );
+ }
+ else
+ {
+ // TO DO - equivelant for 'SwTableRowRedline'
+ /*
+ 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 'SwTableRowRedline'
+ /*
+ _CHECK_REDLINE( this )
+ */
+
+ return ( 0 != pNewRedl ) || bMerged;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */