[Libreoffice-commits] core.git: sw/source
sushil_shinde
sushil.shinde at synerzip.com
Fri Jan 10 04:21:39 PST 2014
sw/source/filter/ww8/docxexport.cxx | 62 ++++++++++++++++++++++++++++++++++++
sw/source/filter/ww8/docxexport.hxx | 3 +
2 files changed, 65 insertions(+)
New commits:
commit a37043b8d1508b3a3a2844e9092e4af05d726f28
Author: sushil_shinde <sushil.shinde at synerzip.com>
Date: Fri Dec 27 14:34:03 2013 +0530
fdo#72520 : Exporting embedding data folder from grab bag.
Change-Id: I3eeff18f0f39f97c2d0fc95eba427b478c95e80d
Reviewed-on: https://gerrit.libreoffice.org/7213
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index ece1c41..e67b538 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -400,6 +400,8 @@ void DocxExport::ExportDocument_Impl()
WriteActiveX();
+ WriteEmbeddings();
+
delete pStyles, pStyles = NULL;
delete m_pSections, m_pSections = NULL;
}
@@ -1105,6 +1107,66 @@ void DocxExport::WriteActiveX()
}
}
+void DocxExport::WriteEmbeddings()
+{
+ uno::Reference< beans::XPropertySet > xPropSet( pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+ OUString pName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
+ if ( !xPropSetInfo->hasPropertyByName( pName ) )
+ return;
+
+ uno::Sequence< beans::PropertyValue > embeddingsList;
+ uno::Sequence< beans::PropertyValue > propList;
+ xPropSet->getPropertyValue( pName ) >>= propList;
+ for ( sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp )
+ {
+ OUString propName = propList[nProp].Name;
+ if ( propName == "OOXEmbeddings" )
+ {
+ propList[nProp].Value >>= embeddingsList;
+ break;
+ }
+ }
+ for (sal_Int32 j = 0; j < embeddingsList.getLength(); j++)
+ {
+ OUString embeddingPath = embeddingsList[j].Name;
+ uno::Reference<io::XInputStream> embeddingsStream;
+ embeddingsList[j].Value >>= embeddingsStream;
+ if ( embeddingsStream.is() )
+ {
+ uno::Reference< io::XOutputStream > xOutStream = GetFilter().openFragmentStream(embeddingPath,
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ try
+ {
+ sal_Int32 nBufferSize = 512;
+ uno::Sequence< sal_Int8 > aDataBuffer(nBufferSize);
+ sal_Int32 nRead;
+ do
+ {
+ nRead = embeddingsStream->readBytes( aDataBuffer, nBufferSize );
+ if( nRead )
+ {
+ if( nRead < nBufferSize )
+ {
+ nBufferSize = nRead;
+ aDataBuffer.realloc(nRead);
+ }
+ xOutStream->writeBytes( aDataBuffer );
+ }
+ }
+ while( nRead );
+ xOutStream->flush();
+ }
+ catch(const uno::Exception&)
+ {
+ SAL_WARN("sw.ww8", "WriteEmbeddings() ::Failed to copy Inputstream to outputstream exception catched!");
+ }
+ xOutStream->closeOutput();
+ }
+ }
+}
+
VMLExport& DocxExport::VMLExporter()
{
return *m_pVMLExport;
diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx
index abf22eb..d371fa1 100644
--- a/sw/source/filter/ww8/docxexport.hxx
+++ b/sw/source/filter/ww8/docxexport.hxx
@@ -227,6 +227,9 @@ private:
/// Write word/activeX/activeX[n].xml
void WriteActiveX();
+ /// Write word/embeddings/Worksheet[n].xlsx
+ void WriteEmbeddings();
+
/// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...)
sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer );
More information about the Libreoffice-commits
mailing list