[Libreoffice-commits] core.git: editeng/source include/sot sot/source

Varun Dhall varun.dhall at studentpartner.com
Wed Jun 7 12:40:27 UTC 2017


 editeng/source/editeng/eeobj.cxx |    9 +++++----
 include/sot/formats.hxx          |    3 ++-
 sot/source/base/exchange.cxx     |    3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 223a04e77fe9702eb167e69165ec57c46512a845
Author: Varun Dhall <varun.dhall at studentpartner.com>
Date:   Tue May 30 23:35:57 2017 +0530

    EditEngine Exporting flat XML from actual clipboard
    
    Allowing export of EditEngine document into flat XML from actual clipboard
    by modifying SotClipboardFormatId
    
    Change-Id: I9c7dfd3ca428d0fa355bd3dfb7bfa0f0e30dada6
    Reviewed-on: https://gerrit.libreoffice.org/38226
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/editeng/source/editeng/eeobj.cxx b/editeng/source/editeng/eeobj.cxx
index 0c6bd1246c7c..1daac5eb10ed 100644
--- a/editeng/source/editeng/eeobj.cxx
+++ b/editeng/source/editeng/eeobj.cxx
@@ -53,13 +53,13 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo
     {
         aAny <<= GetString();
     }
-    else if ( ( nT == SotClipboardFormatId::EDITENGINE ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::RICHTEXT ) )
+    else if ( ( nT == SotClipboardFormatId::EDITENGINE ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::RICHTEXT ) || ( nT == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) )
     {
         // No RTF on demand any more:
         // 1) Was not working, because I had to flush() the clipboard immediately anyway
         // 2) Don't have the old pool defaults and the StyleSheetPool here.
 
-        SvMemoryStream* pStream = ( nT == SotClipboardFormatId::EDITENGINE ) ? &GetStream() : &GetRTFStream();
+        SvMemoryStream* pStream = ( nT == SotClipboardFormatId::EDITENGINE ) ? &GetStream() : ( (nT == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) ? &GetODFStream() : &GetRTFStream() );
         pStream->Seek( STREAM_SEEK_TO_END );
         sal_Int32 nLen = pStream->Tell();
         if (nLen < 0) { abort(); }
@@ -80,11 +80,12 @@ uno::Any EditDataObject::getTransferData( const datatransfer::DataFlavor& rFlavo
 
 uno::Sequence< datatransfer::DataFlavor > EditDataObject::getTransferDataFlavors(  )
 {
-    uno::Sequence< datatransfer::DataFlavor > aDataFlavors(4);
+    uno::Sequence< datatransfer::DataFlavor > aDataFlavors(5);
     SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aDataFlavors.getArray()[0] );
     SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aDataFlavors.getArray()[1] );
     SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aDataFlavors.getArray()[2] );
     SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RICHTEXT, aDataFlavors.getArray()[3] );
+    SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT, aDataFlavors.getArray()[4] );
 
     return aDataFlavors;
 }
@@ -95,7 +96,7 @@ sal_Bool EditDataObject::isDataFlavorSupported( const datatransfer::DataFlavor&
 
     SotClipboardFormatId nT = SotExchange::GetFormat( rFlavor );
     if ( ( nT == SotClipboardFormatId::STRING ) || ( nT == SotClipboardFormatId::RTF ) || ( nT == SotClipboardFormatId::RICHTEXT )
-        || ( nT == SotClipboardFormatId::EDITENGINE ) )
+        || ( nT == SotClipboardFormatId::EDITENGINE ) || ( nT == SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ) )
         bSupported = true;
 
     return bSupported;
diff --git a/include/sot/formats.hxx b/include/sot/formats.hxx
index 482f65bad44f..17a9adb5d11a 100644
--- a/include/sot/formats.hxx
+++ b/include/sot/formats.hxx
@@ -173,8 +173,9 @@ enum class SotClipboardFormatId : sal_uLong
     MATHML                 = 143,
     JPEG                   = 144,
     RICHTEXT               = 145,
+    EDITENGINE_ODF_TEXT_FLAT = 146,
     // the point at which we start allocating "runtime" format IDs
-    USER_END  = RICHTEXT
+    USER_END  = EDITENGINE_ODF_TEXT_FLAT
 };
 
 /** Make it easier to iterate over format IDs */
diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx
index 943fbbe7c303..286f4c7e49e2 100644
--- a/sot/source/base/exchange.cxx
+++ b/sot/source/base/exchange.cxx
@@ -203,7 +203,8 @@ namespace
             /*142 SotClipboardFormatId::STARWRITERGLOB_8_TEMPLATE*/      { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE_ASCII, "Writer/Global 8 Template", &cppu::UnoType<Sequence<sal_Int8>>::get() },
             /*143 SotClipboardFormatId::MATHML*/   { "application/mathml+xml", "MathML", &::cppu::UnoType<const Sequence< sal_Int8 >>::get() },
             /*144 SotClipboardFormatId::JPEG*/ { "image/jpeg", "JPEG Bitmap", &cppu::UnoType<Sequence<sal_Int8>>::get() },
-            /*145 SotClipboardFormatId::RICHTEXT*/ { "text/richtext", "Richtext Format", &cppu::UnoType<Sequence<sal_Int8>>::get() }
+            /*145 SotClipboardFormatId::RICHTEXT*/ { "text/richtext", "Richtext Format", &cppu::UnoType<Sequence<sal_Int8>>::get() },
+            /*146 SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT*/ { "application/vnd.oasis.opendocument.text-flat-xml", "EditEngine ODF", &cppu::UnoType<Sequence<sal_Int8>>::get() }
             };
         return &aInstance[0];
         }


More information about the Libreoffice-commits mailing list