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

Rosemary Sebastian rosemaryseb8 at gmail.com
Thu Jun 2 06:48:06 UTC 2016


 include/xmloff/xmlexp.hxx                          |    7 +++++-
 include/xmloff/xmltoken.hxx                        |    2 +
 sw/source/core/inc/SwXMLBlockExport.hxx            |    2 +
 sw/source/filter/xml/wrtxml.cxx                    |   13 +++++++++++
 sw/source/filter/xml/xmlexp.cxx                    |   22 ++++++++++++++++++++
 sw/source/filter/xml/xmlexp.hxx                    |    1 
 sw/source/uibase/config/StoredChapterNumbering.cxx |    1 
 sw/util/sw.component                               |    8 +++++++
 xmloff/source/core/xmlexp.cxx                      |   23 ++++++++++++++++++++-
 xmloff/source/core/xmltoken.cxx                    |    2 +
 10 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 2aa542764ff6816b14d500945666f72a4b3f7881
Author: Rosemary Sebastian <rosemaryseb8 at gmail.com>
Date:   Tue May 24 17:52:41 2016 +0530

    Create undo.xml for change-tracking
    
    Change-Id: I41a6de97b5c377e9a5c528c920d5c6e0195b7a10
    Reviewed-on: https://gerrit.libreoffice.org/25404
    Reviewed-by: Rosemary Sebastian <rosemaryseb8 at gmail.com>
    Tested-by: Rosemary Sebastian <rosemaryseb8 at gmail.com>

diff --git a/include/xmloff/xmlexp.hxx b/include/xmloff/xmlexp.hxx
index 41e8ddd..c8adc64 100644
--- a/include/xmloff/xmlexp.hxx
+++ b/include/xmloff/xmlexp.hxx
@@ -100,12 +100,13 @@ enum class SvXMLExportFlags {
     NODOCTYPE                = 0x0200,
     PRETTY                   = 0x0400,
     SAVEBACKWARDCOMPATIBLE   = 0x0800,
+    UNDO                     = 0x1000,
     OASIS                    = 0x8000,
     ALL                      = 0x0fff
 };
 namespace o3tl
 {
-    template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x8fff> {};
+    template<> struct typed_flags<SvXMLExportFlags> : is_typed_flags<SvXMLExportFlags, 0x9fff> {};
 }
 
 class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6<
@@ -178,6 +179,7 @@ private:
     SAL_DLLPRIVATE void ImplExportMasterStyles();
         // <office:master-styles>
     SAL_DLLPRIVATE void ImplExportContent(); // <office:body>
+    SAL_DLLPRIVATE void ImplExportUndo(); // <office:undo>
     virtual void SetBodyAttributes();
     void GetViewSettingsAndViews(css::uno::Sequence<css::beans::PropertyValue>& rProps);
 
@@ -217,6 +219,9 @@ protected:
     /// Override this method to export the content of <office:body>.
     virtual void ExportContent_() = 0;
 
+    /// Export the content of <office:undo> in writer.
+    virtual void ExportUndo_();
+
     OUString GetSourceShellID() const;
     OUString GetDestinationShellID() const;
 
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index ccbb8cf..4ddc061 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -644,6 +644,7 @@ namespace xmloff { namespace token {
         XML_DOCUMENT_SETTINGS,
         XML_DOCUMENT_STATISTIC,
         XML_DOCUMENT_STYLES,
+        XML_DOCUMENT_UNDO,
         XML_DOMAIN,
         XML_DOT,
         XML_DOTS1,
@@ -1922,6 +1923,7 @@ namespace xmloff { namespace token {
         XML_SINGLE,
         XML_SMALL_WAVE,
         XML_WAVE,
+        XML_UNDO,
         XML_UNFORMATTED_TEXT,
         XML_UNION,
         XML_UNIT,
diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx
index cbafb30..36515a0 100644
--- a/sw/source/core/inc/SwXMLBlockExport.hxx
+++ b/sw/source/core/inc/SwXMLBlockExport.hxx
@@ -41,6 +41,7 @@ public:
     void ExportAutoStyles_() override {}
     void ExportMasterStyles_ () override {}
     void ExportContent_() override {}
+    void ExportUndo_() override {}
 };
 
 class SwXMLTextBlockExport : public SvXMLExport
@@ -61,6 +62,7 @@ public:
     void ExportAutoStyles_() override {}
     void ExportMasterStyles_ () override {}
     void ExportContent_() override {}
+    void ExportUndo_() override {}
 };
 
 #endif
diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx
index 2fbdd81..735f973 100644
--- a/sw/source/filter/xml/wrtxml.cxx
+++ b/sw/source/filter/xml/wrtxml.cxx
@@ -366,6 +366,19 @@ sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >&
         }
     }
 
+    if( !bOrganizerMode && !bErr )
+    {
+        if( !WriteThroughComponent(
+                xModelComp, "undo.xml", xContext,
+                (bOASIS ? "com.sun.star.comp.Writer.XMLOasisUndoExporter"
+                        : "com.sun.star.comp.Writer.XMLUndoExporter"),
+                aFilterArgs, aProps ) )
+        {
+            bErr = true;
+            sErrFile = "undo.xml";
+        }
+    }
+
     if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pDoc->getIDocumentStatistics().GetDocStat().nPage > 1 &&
         !(bOrganizerMode || bBlock || bErr) )
     {
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 5865662..87993a2 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -492,6 +492,12 @@ void SwXMLExport::ExportContent_()
     GetTextParagraphExport()->exportText( xText, bShowProgress );
 }
 
+void SwXMLExport::ExportUndo_()
+{
+    SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_UNDO,
+                                true, true );
+}
+
 namespace
 {
     class theSwXMLExportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXMLExportUnoTunnelId > {};
@@ -562,6 +568,14 @@ com_sun_star_comp_Writer_XMLContentExporter_get_implementation(css::uno::XCompon
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+com_sun_star_comp_Writer_XMLUndoExporter_get_implementation(css::uno::XComponentContext* context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new SwXMLExport(context, OUString("com.sun.star.comp.Writer.XMLUndoExporter"),
+                SvXMLExportFlags::UNDO));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
 com_sun_star_comp_Writer_XMLMetaExporter_get_implementation(css::uno::XComponentContext* context,
         css::uno::Sequence<css::uno::Any> const &)
 {
@@ -604,6 +618,14 @@ com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation(css::uno::XC
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
+com_sun_star_comp_Writer_XMLOasisUndoExporter_get_implementation(css::uno::XComponentContext* context,
+        css::uno::Sequence<css::uno::Any> const &)
+{
+    return cppu::acquire(new SwXMLExport(context, OUString("com.sun.star.comp.Writer.XMLOasisUndoExporter"),
+                SvXMLExportFlags::UNDO | SvXMLExportFlags::OASIS));
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
 com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation(css::uno::XComponentContext* context,
         css::uno::Sequence<css::uno::Any> const &)
 {
diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx
index b1bd141..3f6ec7c 100644
--- a/sw/source/filter/xml/xmlexp.hxx
+++ b/sw/source/filter/xml/xmlexp.hxx
@@ -93,6 +93,7 @@ class SwXMLExport : public SvXMLExport
     virtual void ExportMasterStyles_() override;
     virtual void SetBodyAttributes() override;
     virtual void ExportContent_() override;
+    virtual void ExportUndo_() override;
     virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
     virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override;
     virtual sal_Int32 GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings ) override;
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index 75b49a2..000a0c2 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -192,6 +192,7 @@ public:
     virtual void ExportAutoStyles_() override {}
     virtual void ExportMasterStyles_() override {}
     virtual void ExportContent_() override {}
+    virtual void ExportUndo_() override {}
 
     void ExportRule(SvxXMLNumRuleExport & rExport,
             uno::Reference<container::XIndexReplace> const& xRule)
diff --git a/sw/util/sw.component b/sw/util/sw.component
index c069d63..a76d30a 100644
--- a/sw/util/sw.component
+++ b/sw/util/sw.component
@@ -60,6 +60,10 @@
       constructor="com_sun_star_comp_Writer_XMLContentExporter_get_implementation">
     <service name="com.sun.star.comp.Writer.XMLContentExporter"/>
   </implementation>
+  <implementation name="com.sun.star.comp.Writer.XMLUndoExporter"
+      constructor="com_sun_star_comp_Writer_XMLUndoExporter_get_implementation">
+    <service name="com.sun.star.comp.Writer.XMLUndoExporter"/>
+  </implementation>
   <implementation name="com.sun.star.comp.Writer.XMLExporter"
       constructor="com_sun_star_comp_Writer_XMLExporter_get_implementation">
     <service name="com.sun.star.comp.Writer.XMLExporter"/>
@@ -72,6 +76,10 @@
       constructor="com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation">
     <service name="com.sun.star.comp.Writer.XMLOasisContentExporter"/>
   </implementation>
+  <implementation name="com.sun.star.comp.Writer.XMLOasisUndoExporter"
+      constructor="com_sun_star_comp_Writer_XMLOasisUndoExporter_get_implementation">
+    <service name="com.sun.star.comp.Writer.XMLOasisUndoExporter"/>
+  </implementation>
   <implementation name="com.sun.star.comp.Writer.XMLOasisContentImporter"
       constructor="com_sun_star_comp_Writer_XMLOasisContentImporter_get_implementation">
     <service name="com.sun.star.comp.Writer.XMLOasisContentImporter"/>
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 8ed2118..059bbd0 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -1232,6 +1232,13 @@ void SvXMLExport::SetBodyAttributes()
 {
 }
 
+void SvXMLExport::ImplExportUndo()
+{
+    CheckAttrList();
+
+    ExportUndo_();
+}
+
 static void
 lcl_AddGrddl(SvXMLExport & rExport, const SvXMLExportFlags /*nExportMode*/)
 {
@@ -1378,7 +1385,8 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
 
     {
         enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
-        const SvXMLExportFlags nExportMode = mnExportFlags & (SvXMLExportFlags::META|SvXMLExportFlags::STYLES|SvXMLExportFlags::CONTENT|SvXMLExportFlags::SETTINGS);
+        const SvXMLExportFlags nExportMode = mnExportFlags & (SvXMLExportFlags::META|SvXMLExportFlags::STYLES|
+                          SvXMLExportFlags::CONTENT|SvXMLExportFlags::SETTINGS|SvXMLExportFlags::UNDO);
 
         lcl_AddGrddl(*this, nExportMode);
 
@@ -1402,6 +1410,11 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
             // export only content
             eRootService = XML_DOCUMENT_CONTENT;
         }
+        else if( SvXMLExportFlags::UNDO == nExportMode )
+        {
+            // export only undo
+            eRootService = XML_DOCUMENT_UNDO;
+        }
         else
         {
             // the god'ol one4all element
@@ -1448,6 +1461,10 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
         // content
         if( mnExportFlags & SvXMLExportFlags::CONTENT )
             ImplExportContent();
+
+        // undo
+        if( mnExportFlags & SvXMLExportFlags::UNDO )
+            ImplExportUndo();
     }
 
     mxHandler->endDocument();
@@ -1510,6 +1527,10 @@ void SvXMLExport::ExportMeta_()
     }
 }
 
+void SvXMLExport::ExportUndo_()
+{
+}
+
 void SvXMLExport::ExportScripts_()
 {
     SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_SCRIPTS, true, true );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 77ff93c..50920fd 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -646,6 +646,7 @@ namespace xmloff { namespace token {
         TOKEN( "document-settings",               XML_DOCUMENT_SETTINGS ),
         TOKEN( "document-statistic",              XML_DOCUMENT_STATISTIC ),
         TOKEN( "document-styles",                 XML_DOCUMENT_STYLES ),
+        TOKEN( "document-undo",                   XML_DOCUMENT_UNDO ),
         TOKEN( "domain",                          XML_DOMAIN ),
         TOKEN( "dot",                             XML_DOT ),
         TOKEN( "dots1",                           XML_DOTS1 ),
@@ -1925,6 +1926,7 @@ namespace xmloff { namespace token {
         TOKEN( "single",                          XML_SINGLE ),
         TOKEN( "small-wave",                      XML_SMALL_WAVE ),
         TOKEN( "wave",                            XML_WAVE ),
+        TOKEN( "undo",                            XML_UNDO ),
         TOKEN( "unformatted-text",                XML_UNFORMATTED_TEXT ),
         TOKEN( "union",                           XML_UNION ),
         TOKEN( "unit",                            XML_UNIT ),


More information about the Libreoffice-commits mailing list