diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-06-10 18:15:55 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-06-10 19:33:12 +0200 |
commit | 2a649539b723a01649102ff7be3cab2bbdff834d (patch) | |
tree | 1876b69bd6d9ccf92f46fa41b4412ecbae0d5b5c /test | |
parent | 0048709ce4d86ce5aca116474b43d9f1c5c50de5 (diff) |
MetafileXmlDump: No need to specify the stream, simplify the API.
Change-Id: Ia08f67e359bbd26cefdba8661f0b0c4ae2147382
Diffstat (limited to 'test')
-rw-r--r-- | test/source/mtfxmldump.cxx | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/test/source/mtfxmldump.cxx b/test/source/mtfxmldump.cxx index e1a6abdff0f3..5e329a3b85a2 100644 --- a/test/source/mtfxmldump.cxx +++ b/test/source/mtfxmldump.cxx @@ -8,6 +8,7 @@ */ #include <test/mtfxmldump.hxx> +#include <test/xmltesttools.hxx> #include <test/xmlwriter.hxx> #include <vcl/metaact.hxx> @@ -137,9 +138,8 @@ OUString convertLineStyleToString(LineStyle eAlign) } // anonymous namespace -MetafileXmlDump::MetafileXmlDump(SvStream& rStream) : - maFilter(512, false), - mrStream(rStream) +MetafileXmlDump::MetafileXmlDump() : + maFilter(512, false) {} MetafileXmlDump::~MetafileXmlDump() @@ -160,9 +160,16 @@ void MetafileXmlDump::filterNoneActionTypes() maFilter.assign(512, false); } -void MetafileXmlDump::dump(GDIMetaFile& rMetaFile) +xmlDocPtr MetafileXmlDump::dumpAndParse(GDIMetaFile& rMetaFile, const OUString& rTempStreamName) { - xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(lclWriteCallback, lclCloseCallback, &mrStream, NULL); + SvStream *pStream = NULL; + + if (rTempStreamName.isEmpty()) + pStream = new SvMemoryStream(); + else + pStream = new SvFileStream(rTempStreamName, STREAM_STD_READWRITE); + + xmlOutputBufferPtr xmlOutBuffer = xmlOutputBufferCreateIO(lclWriteCallback, lclCloseCallback, pStream, NULL); xmlTextWriterPtr xmlWriter = xmlNewTextWriter( xmlOutBuffer ); xmlTextWriterSetIndent( xmlWriter, 1 ); @@ -392,6 +399,14 @@ void MetafileXmlDump::dump(GDIMetaFile& rMetaFile) aWriter.endElement(); aWriter.endDocument(); + + pStream->Seek(STREAM_SEEK_TO_BEGIN); + + xmlDocPtr pDoc = XmlTestTools::parseXmlStream(pStream); + + delete pStream; + + return pDoc; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |