[Libreoffice-commits] core.git: sw/inc sw/source
Adam Co
rattles2013 at gmail.com
Thu Dec 12 00:08:04 PST 2013
sw/inc/redline.hxx | 25 ++++++++++++++++
sw/source/core/doc/docredln.cxx | 60 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 84 insertions(+), 1 deletion(-)
New commits:
commit fb0dad9b276e019992310faeaefd1a19384fa024
Author: Adam Co <rattles2013 at gmail.com>
Date: Mon Dec 2 18:20:38 2013 +0200
Add new 'SwRedlineExtraData_FormattingChanges' class for formatting changes
This class is for use in the 1st step with the DOCX importer\exporter,
to hold information about 'track changes' that relate to formatting of
text portions.
Change-Id: I3f5231d0e49e0b493ec22efaac1c90b0d415f3ea
Reviewed-on: https://gerrit.libreoffice.org/6901
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 3256bb3..ff84272 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -32,7 +32,7 @@
class SfxItemSet;
class SwView;
-class SwRedlineExtraData
+class SW_DLLPUBLIC SwRedlineExtraData
{
SwRedlineExtraData( const SwRedlineExtraData& );
SwRedlineExtraData& operator=( const SwRedlineExtraData& );
@@ -79,6 +79,29 @@ public:
virtual int operator == ( const SwRedlineExtraData& ) const;
};
+/*
+ * This class is used to store 'redline' data regarding formatting changes,
+ * e.g. - a text portion *was* italic and now is not italic,
+ * e.g. - a text portion got a hightlight to it
+ *
+ * The way the information is stored is in an 'SfxItemSet' that holds all
+ * the WhichIds with their values.
+ */
+class SW_DLLPUBLIC SwRedlineExtraData_FormattingChanges : public SwRedlineExtraData
+{
+ SfxItemSet* pSet;
+
+ SwRedlineExtraData_FormattingChanges( const SwRedlineExtraData_FormattingChanges& rCpy );
+
+public:
+ SwRedlineExtraData_FormattingChanges( const SfxItemSet* pItemSet );
+ virtual ~SwRedlineExtraData_FormattingChanges();
+ virtual SwRedlineExtraData* CreateNew() const;
+ virtual void Reject( SwPaM& rPam ) const;
+ virtual int operator == ( const SwRedlineExtraData& ) const;
+ SfxItemSet* GetItemSet( ) const;
+};
+
class SW_DLLPUBLIC SwRedlineData
{
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 2e606aa..f6c7b01 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -2978,6 +2978,65 @@ int SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) co
return nRet;
}
+SwRedlineExtraData_FormattingChanges::SwRedlineExtraData_FormattingChanges( const SfxItemSet* pItemSet )
+ : pSet(0)
+{
+ if( pItemSet && pItemSet->Count() )
+ pSet = new SfxItemSet( *pItemSet );
+}
+
+SwRedlineExtraData_FormattingChanges::SwRedlineExtraData_FormattingChanges( const SwRedlineExtraData_FormattingChanges& rCpy )
+ : SwRedlineExtraData()
+{
+ if( rCpy.pSet->Count() )
+ {
+ pSet = new SfxItemSet( *(rCpy.pSet) );
+ }
+ else
+ {
+ pSet = 0;
+ }
+}
+
+SwRedlineExtraData_FormattingChanges::~SwRedlineExtraData_FormattingChanges()
+{
+ delete pSet;
+}
+
+SwRedlineExtraData* SwRedlineExtraData_FormattingChanges::CreateNew() const
+{
+ return new SwRedlineExtraData_FormattingChanges( *this );
+}
+
+void SwRedlineExtraData_FormattingChanges::Reject( SwPaM& rPam ) const
+{
+ rPam.GetDoc(); // This is here just to prevent build 'warning'
+
+ // ToDo: Add 'Reject' logic
+}
+
+int SwRedlineExtraData_FormattingChanges::operator == ( const SwRedlineExtraData& rExtraData ) const
+{
+ const SwRedlineExtraData_FormattingChanges& rCmp = (SwRedlineExtraData_FormattingChanges&)rExtraData;
+
+ if ( !pSet && !rCmp.pSet )
+ {
+ // Both SfxItemSet are null
+ return 1;
+ }
+ else if ( pSet && rCmp.pSet && *pSet == *rCmp.pSet )
+ {
+ // Both SfxItemSet exist and are equal
+ return 1;
+ }
+ return 0;
+}
+
+SfxItemSet* SwRedlineExtraData_FormattingChanges::GetItemSet( ) const
+{
+ return pSet;
+}
+
SwRedlineData::SwRedlineData( RedlineType_t eT, sal_uInt16 nAut )
: pNext( 0 ), pExtraData( 0 ),
aStamp( DateTime::SYSTEM ),
@@ -3016,6 +3075,7 @@ void SwRedlineData::SetExtraData( const SwRedlineExtraData* pData )
{
delete pExtraData;
+ // Check if there is data - and if so - delete it
if( pData )
pExtraData = pData->CreateNew();
else
More information about the Libreoffice-commits
mailing list