[Libreoffice-commits] core.git: Branch 'private/Rosemary/change-tracking' - 2 commits - include/xmloff sw/source xmloff/source

Rosemary Sebastian rosemaryseb8 at gmail.com
Mon Jun 6 15:39:57 UTC 2016


Rebased ref, commits from common ancestor:
commit 28e1d02543b437e54c6dfa06141758ff8fe78baf
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Mon Jun 6 21:04:49 2016 +0530

    Export addition of format
    
    All the values are hardcoded currently.
    
    Change-Id: I56ddfaa7f7facfc9c2359cd50031e6531ed05120

diff --git a/include/xmloff/xmlnmspe.hxx b/include/xmloff/xmlnmspe.hxx
index ae588d2..da467d1 100644
--- a/include/xmloff/xmlnmspe.hxx
+++ b/include/xmloff/xmlnmspe.hxx
@@ -70,6 +70,8 @@ XML_NAMESPACE( REPORT,          33U )
 XML_NAMESPACE( OF,              34U )       // OpenFormula aka ODFF
 XML_NAMESPACE( XHTML,           35U )
 XML_NAMESPACE( GRDDL,           36U )
+XML_NAMESPACE( ADD,             37U )
+XML_NAMESPACE( DEL,             38U )
 
 // namespaces for odf extended formats
 
@@ -77,14 +79,14 @@ XML_NAMESPACE( GRDDL,           36U )
 const sal_uInt16 XML_NAMESPACE_##prefix##_EXT       = key; \
 const sal_uInt16 XML_NAMESPACE_##prefix##_EXT_IDX   = key;
 
-XML_NAMESPACE_EXT( OFFICE,      37U )
-XML_NAMESPACE_EXT( TABLE,       38U )
-XML_NAMESPACE_EXT( CHART,       39U )
-XML_NAMESPACE_EXT( DRAW,        40U )
-XML_NAMESPACE_EXT( CALC,        41U )
-XML_NAMESPACE_EXT( LO,          42U )
+XML_NAMESPACE_EXT( OFFICE,      39U )
+XML_NAMESPACE_EXT( TABLE,       40U )
+XML_NAMESPACE_EXT( CHART,       41U )
+XML_NAMESPACE_EXT( DRAW,        42U )
+XML_NAMESPACE_EXT( CALC,        43U )
+XML_NAMESPACE_EXT( LO,          44U )
 
-#define XML_OLD_NAMESPACE_BASE 43U
+#define XML_OLD_NAMESPACE_BASE 45U
 
 // namespaces used in the technical preview (SO 5.2)
 XML_OLD_NAMESPACE( FO,      0U )
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx
index f7b38ef..c59fae5 100644
--- a/xmloff/source/text/XMLRedlineExport.cxx
+++ b/xmloff/source/text/XMLRedlineExport.cxx
@@ -487,6 +487,25 @@ void XMLRedlineExport::ExportChangeInfo(
         rExport.Characters(sBuf.makeStringAndClear());
     }
 
+    aAny = rPropSet->getPropertyValue(sRedlineType);
+    OUString sType;
+    aAny >>= sType;
+    if(sType == sFormat) // TODO: Find out if the style is inserted or deleted to give the proper namespace
+    {
+        SvXMLElementExport aTypeElem( rExport, XML_NAMESPACE_DEL,
+                                          XML_TYPE, true, false );
+        rExport.Characters("style");
+        SvXMLElementExport aNameElem( rExport, XML_NAMESPACE_DEL,
+                                          XML_NAME, true, false );
+        rExport.Characters("bold"); // TODO: Get the correct style name
+        SvXMLElementExport aStartElem( rExport, XML_NAMESPACE_DEL,
+                                          XML_START, true, false );
+        rExport.Characters("start"); // TODO: Get the correct start position
+        SvXMLElementExport aEndElem( rExport, XML_NAMESPACE_DEL,
+                                          XML_END, true, false );
+        rExport.Characters("end"); // TODO: Get the correct end position
+    }
+
     // comment as <text:p> sequence
     aAny = rPropSet->getPropertyValue(sRedlineComment);
     aAny >>= sTmp;
diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx
index 5ef3d2e..08e8973 100644
--- a/xmloff/source/text/XMLRedlineExport.hxx
+++ b/xmloff/source/text/XMLRedlineExport.hxx
@@ -66,6 +66,10 @@ class XMLRedlineExport
     const OUString sRedlineSuccessorData;
     const OUString sRedlineText;
     const OUString sRedlineType;
+    const OUString sRedlineUndoType;
+    const OUString sRedlineUndoName;
+    const OUString sRedlineUndoStart;
+    const OUString sRedlineUndoEnd;
     const OUString sUnknownChange;
     const OUString sStartRedline;
     const OUString sEndRedline;
commit 49fa48961b58bae09b7872f8ff536b73d2a88f82
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Fri Jun 3 20:45:24 2016 +0530

    WIP Save tracked changes in undo.xml
    
    Change-Id: I41326b89788ad85646b777d2a8df81f03619ae9f

diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 87993a2..4213eb5 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -132,7 +132,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
     SwDoc *pDoc = getDoc();
 
     if( getExportFlags() & (SvXMLExportFlags::FONTDECLS|SvXMLExportFlags::STYLES|
-                            SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT))
+                            SvXMLExportFlags::MASTERSTYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::UNDO))
     {
         if( getDefaultVersion() > SvtSaveOptions::ODFVER_012 )
         {
@@ -268,7 +268,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
     // set redline mode if we export STYLES or CONTENT, unless redline
     // mode is taken care of outside (through info XPropertySet)
     bool bSaveRedline =
-        bool( getExportFlags() & (SvXMLExportFlags::CONTENT|SvXMLExportFlags::STYLES) );
+        bool( getExportFlags() & (SvXMLExportFlags::UNDO|SvXMLExportFlags::STYLES) );
     if( bSaveRedline )
     {
         // if the info property set has a ShowChanges property,
@@ -483,7 +483,6 @@ void SwXMLExport::ExportContent_()
         }
     }
 
-    GetTextParagraphExport()->exportTrackedChanges( false );
     GetTextParagraphExport()->exportTextDeclarations();
     Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
     Reference < XText > xText = xTextDoc->getText();
@@ -496,6 +495,7 @@ void SwXMLExport::ExportUndo_()
 {
     SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_UNDO,
                                 true, true );
+    GetTextParagraphExport()->exportTrackedChanges( false );
 }
 
 namespace
@@ -572,7 +572,7 @@ com_sun_star_comp_Writer_XMLUndoExporter_get_implementation(css::uno::XComponent
         css::uno::Sequence<css::uno::Any> const &)
 {
     return cppu::acquire(new SwXMLExport(context, OUString("com.sun.star.comp.Writer.XMLUndoExporter"),
-                SvXMLExportFlags::UNDO));
+                SvXMLExportFlags::UNDO | SvXMLExportFlags::AUTOSTYLES));
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
@@ -622,7 +622,7 @@ com_sun_star_comp_Writer_XMLOasisUndoExporter_get_implementation(css::uno::XComp
         css::uno::Sequence<css::uno::Any> const &)
 {
     return cppu::acquire(new SwXMLExport(context, OUString("com.sun.star.comp.Writer.XMLOasisUndoExporter"),
-                SvXMLExportFlags::UNDO | SvXMLExportFlags::OASIS));
+                SvXMLExportFlags::UNDO | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::OASIS));
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx
index f50e8e2..312b8b2 100644
--- a/sw/source/filter/xml/xmlfmte.cxx
+++ b/sw/source/filter/xml/xmlfmte.cxx
@@ -201,10 +201,12 @@ void SwXMLExport::ExportAutoStyles_()
     if( !(getExportFlags() & SvXMLExportFlags::STYLES) )
         GetTextParagraphExport()->exportUsedDeclarations();
 
+    if( getExportFlags() & SvXMLExportFlags::UNDO )
+        GetTextParagraphExport()->exportTrackedChanges( true );
+
     // exported in ExportContent_
     if( getExportFlags() & SvXMLExportFlags::CONTENT )
     {
-        GetTextParagraphExport()->exportTrackedChanges( true );
         Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
         Reference < XText > xText = xTextDoc->getText();
 


More information about the Libreoffice-commits mailing list