Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / sd / qa / unit / sdmodeltestbase.hxx
blob8fef3182ee3e788026f5984615327dd5c542b24a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_SD_QA_UNIT_SDMODELTESTBASE_HXX
11 #define INCLUDED_SD_QA_UNIT_SDMODELTESTBASE_HXX
13 #include <memory>
14 #include <test/bootstrapfixture.hxx>
15 #include <test/xmldiff.hxx>
16 #include <test/xmltesttools.hxx>
18 #include <unotest/filters-test.hxx>
19 #include <unotest/macros_test.hxx>
21 #include <drawdoc.hxx>
22 #include <DrawDocShell.hxx>
23 #include <GraphicDocShell.hxx>
24 #include <unotools/tempfile.hxx>
25 #include <unotools/ucbstreamhelper.hxx>
26 #include <tools/color.hxx>
27 #include <comphelper/fileformat.h>
28 #include <comphelper/processfactory.hxx>
30 #include <rtl/strbuf.hxx>
31 #include <sfx2/docfile.hxx>
32 #include <sfx2/docfilt.hxx>
33 #include <svl/itemset.hxx>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
37 #include <com/sun/star/packages/zip/ZipFileAccess.hpp>
38 #include <drawinglayer/XShapeDumper.hxx>
39 #include <com/sun/star/text/XTextField.hpp>
41 using namespace ::com::sun::star;
43 struct FileFormat
45 const char* pName;
46 const char* pFilterName;
47 const char* pTypeName;
48 const char* pUserData;
49 SfxFilterFlags nFormatType;
52 // These values are taken from "Flags" in filter/source/config/fragments/filters/*
53 // You need to turn value of oor:name="Flags" to SfxFilterFlags::*, see
54 // include/comphelper/documentconstants.hxx for the possible values.
55 // Note: 3RDPARTYFILTER == SfxFilterFlags::STARONEFILTER
56 #define ODP_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT | SfxFilterFlags::ENCRYPTION | SfxFilterFlags::PREFERED )
57 #define PPT_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
58 #define PPTX_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED )
59 #define HTML_FORMAT_TYPE ( SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
60 #define PDF_FORMAT_TYPE ( SfxFilterFlags::STARONEFILTER | SfxFilterFlags::ALIEN | SfxFilterFlags::IMPORT | SfxFilterFlags::PREFERED )
61 #define FODG_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
62 #define FODP_FORMAT_TYPE (SfxFilterFlags::STARONEFILTER | SfxFilterFlags::OWN | SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT)
63 #define SXI_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::ALIEN | SfxFilterFlags::PREFERED | SfxFilterFlags::ENCRYPTION)
64 #define ODG_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE | SfxFilterFlags::OWN | SfxFilterFlags::DEFAULT | SfxFilterFlags::ENCRYPTION | SfxFilterFlags::PREFERED )
65 #define PPTM_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED )
66 #define POTX_FORMAT_TYPE ( SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::TEMPLATE | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED )
68 /** List of file formats we support in Impress unit tests.
70 Taken from filter/source/config/fragments/filters/ too:
71 pName: The file extension.
72 pFilterName: <node oor:Name="...">
73 pTypeName: <prop oor:Name="Type">...</prop>
74 nFormatType: <prop oor:name="Flags">...</prop>
76 FileFormat aFileFormats[] =
78 { "odp", "impress8", "impress8", "", ODP_FORMAT_TYPE },
79 { "ppt", "MS PowerPoint 97", "impress_MS_PowerPoint_97", "sdfilt", PPT_FORMAT_TYPE },
80 { "pptx", "Impress Office Open XML", "Office Open XML Presentation", "", PPTX_FORMAT_TYPE },
81 { "html", "graphic_HTML", "graphic_HTML", "", HTML_FORMAT_TYPE },
82 { "pdf", "draw_pdf_import", "pdf_Portable_Document_Format", "", PDF_FORMAT_TYPE },
83 { "fodg", "OpenDocument Drawing Flat XML", "draw_ODG_FlatXML", "", FODG_FORMAT_TYPE },
84 { "fodp", "OpenDocument Presentation Flat XML", "impress_ODP_FlatXML", "", FODP_FORMAT_TYPE },
85 { "sxi", "StarOffice XML (Impress)", "impress_StarOffice_XML_Impress", "", SXI_FORMAT_TYPE },
86 { "odg", "draw8", "draw8", "", ODG_FORMAT_TYPE },
87 { "pptm", "Impress MS PowerPoint 2007 XML VBA", "MS PowerPoint 2007 XML VBA", "", PPTM_FORMAT_TYPE },
88 { "potx", "Impress Office Open XML Template", "Office Open XML Presentation Template", "", POTX_FORMAT_TYPE },
89 { nullptr, nullptr, nullptr, nullptr, SfxFilterFlags::NONE }
92 #define ODP 0
93 #define PPT 1
94 #define PPTX 2
95 #define HTML 3
96 #define PDF 4
97 #define FODG 5
98 #define FODP 6
99 #define SXI 7
100 #define ODG 8
101 #define PPTM 9
102 #define POTX 10
104 /// Base class for filter tests loading or roundtriping a document, and asserting the document model.
105 class SdModelTestBase : public test::BootstrapFixture, public unotest::MacrosTest
107 private:
108 uno::Reference<uno::XInterface> mxDrawComponent;
109 uno::Reference<uno::XInterface> mxImpressComponent;
111 public:
112 SdModelTestBase()
115 virtual void setUp() override
117 test::BootstrapFixture::setUp();
119 // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
120 // which is a private symbol to us, gets called
121 mxImpressComponent = getMultiServiceFactory()->createInstance("com.sun.star.comp.Draw.PresentationDocument");
122 CPPUNIT_ASSERT_MESSAGE("no impress component!", mxImpressComponent.is());
123 mxDrawComponent = getMultiServiceFactory()->createInstance("com.sun.star.comp.Draw.DrawingDocument");
124 CPPUNIT_ASSERT_MESSAGE("no draw component!", mxDrawComponent.is());
127 virtual void tearDown() override
129 uno::Reference<lang::XComponent>(mxImpressComponent, uno::UNO_QUERY_THROW)->dispose();
130 uno::Reference<lang::XComponent>(mxDrawComponent, uno::UNO_QUERY_THROW)->dispose();
131 test::BootstrapFixture::tearDown();
134 protected:
135 /// Load the document.
136 sd::DrawDocShellRef loadURL( const OUString &rURL, sal_Int32 nFormat, std::unique_ptr<SfxAllItemSet> pParams = nullptr )
138 FileFormat *pFmt = getFormat(nFormat);
139 CPPUNIT_ASSERT_MESSAGE( "missing filter info", pFmt->pName != nullptr );
140 if ( std::strcmp(pFmt->pName, "odg") == 0)
141 { // Draw
142 SotClipboardFormatId nOptions = SotClipboardFormatId::NONE;
143 if (pFmt->nFormatType != SfxFilterFlags::NONE)
144 nOptions = SotClipboardFormatId::STARDRAW_8;
145 SfxFilter* pFilter = new SfxFilter(
146 OUString::createFromAscii( pFmt->pFilterName ),
147 OUString(), pFmt->nFormatType, nOptions,
148 OUString::createFromAscii( pFmt->pTypeName ),
149 OUString(),
150 OUString::createFromAscii( pFmt->pUserData ),
151 "private:factory/sdraw*" );
152 pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
153 std::shared_ptr<const SfxFilter> pFilt(pFilter);
155 ::sd::DrawDocShellRef xDocShRef = new ::sd::GraphicDocShell(SfxObjectCreateMode::EMBEDDED);
156 SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ, pFilt, std::move(pParams));
157 if ( !xDocShRef->DoLoad(pSrcMed) || !xDocShRef.is() )
159 if (xDocShRef.is())
160 xDocShRef->DoClose();
161 CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "failed to load Draw doc" + rURL, RTL_TEXTENCODING_UTF8 ).getStr(), false );
163 CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
164 return xDocShRef;
166 else // Impress
168 SotClipboardFormatId nOptions = SotClipboardFormatId::NONE;
169 if (pFmt->nFormatType != SfxFilterFlags::NONE)
170 nOptions = SotClipboardFormatId::STARIMPRESS_8;
171 SfxFilter* pFilter = new SfxFilter(
172 OUString::createFromAscii( pFmt->pFilterName ),
173 OUString(), pFmt->nFormatType, nOptions,
174 OUString::createFromAscii( pFmt->pTypeName ),
175 OUString(),
176 OUString::createFromAscii( pFmt->pUserData ),
177 "private:factory/simpress*" );
178 pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
179 std::shared_ptr<const SfxFilter> pFilt(pFilter);
181 ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell(SfxObjectCreateMode::EMBEDDED, false, DocumentType::Impress);
182 SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ, pFilt, std::move(pParams));
183 if ( !xDocShRef->DoLoad(pSrcMed) || !xDocShRef.is() )
185 if (xDocShRef.is())
186 xDocShRef->DoClose();
187 CPPUNIT_ASSERT_MESSAGE( OUStringToOString( "failed to load " + rURL, RTL_TEXTENCODING_UTF8 ).getStr(), false );
189 CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
190 return xDocShRef;
194 FileFormat* getFormat(sal_Int32 nExportType)
196 FileFormat* pFormat = &aFileFormats[0];
197 if (static_cast<sal_uInt32>(nExportType) < SAL_N_ELEMENTS(aFileFormats))
198 pFormat = &aFileFormats[nExportType];
199 return pFormat;
202 void exportTo(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile)
204 SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE);
205 if ( std::strcmp(pFormat->pName, "odg") == 0)
206 { // Draw
207 SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
208 if (pFormat->nFormatType == ODG_FORMAT_TYPE)
209 nExportFormat = SotClipboardFormatId::STARDRAW_8;
210 std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
211 OUString::createFromAscii(pFormat->pFilterName),
212 OUString(), pFormat->nFormatType, nExportFormat,
213 OUString::createFromAscii(pFormat->pTypeName),
214 OUString(),
215 OUString::createFromAscii(pFormat->pUserData),
216 "private:factory/sdraw*" ));
218 const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
219 aStoreMedium.SetFilter(pExportFilter);
221 else // Impress
223 SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
224 if (pFormat->nFormatType == ODP_FORMAT_TYPE)
225 nExportFormat = SotClipboardFormatId::STARIMPRESS_8;
226 std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
227 OUString::createFromAscii(pFormat->pFilterName),
228 OUString(), pFormat->nFormatType, nExportFormat,
229 OUString::createFromAscii(pFormat->pTypeName),
230 OUString(),
231 OUString::createFromAscii(pFormat->pUserData),
232 "private:factory/simpress*" ));
234 const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
235 aStoreMedium.SetFilter(pExportFilter);
237 pShell->ConvertTo(aStoreMedium);
238 pShell->DoClose();
242 void save(sd::DrawDocShell* pShell, FileFormat const * pFormat, utl::TempFile const & rTempFile)
244 SfxMedium aStoreMedium(rTempFile.GetURL(), StreamMode::STD_WRITE);
245 if ( std::strcmp(pFormat->pName, "odg") == 0 )
246 { // Draw
247 SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
248 if (pFormat->nFormatType == ODG_FORMAT_TYPE)
249 nExportFormat = SotClipboardFormatId::STARDRAW_8;
250 std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
251 OUString::createFromAscii(pFormat->pFilterName),
252 OUString(), pFormat->nFormatType, nExportFormat,
253 OUString::createFromAscii(pFormat->pTypeName),
254 OUString(),
255 OUString::createFromAscii(pFormat->pUserData),
256 "private:factory/sdraw*" ));
257 const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
258 aStoreMedium.SetFilter(pExportFilter);
260 else // Impress
262 SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
263 if (pFormat->nFormatType == ODP_FORMAT_TYPE)
264 nExportFormat = SotClipboardFormatId::STARCHART_8;
265 std::shared_ptr<const SfxFilter> pExportFilter(new SfxFilter(
266 OUString::createFromAscii(pFormat->pFilterName),
267 OUString(), pFormat->nFormatType, nExportFormat,
268 OUString::createFromAscii(pFormat->pTypeName),
269 OUString(),
270 OUString::createFromAscii(pFormat->pUserData),
271 "private:factory/simpress*" ));
272 const_cast<SfxFilter*>(pExportFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
273 aStoreMedium.SetFilter(pExportFilter);
275 pShell->DoSaveAs(aStoreMedium);
276 pShell->DoClose();
279 sd::DrawDocShellRef saveAndReload(sd::DrawDocShell *pShell, sal_Int32 nExportType,
280 utl::TempFile * pTempFile = nullptr)
282 FileFormat* pFormat = getFormat(nExportType);
283 std::unique_ptr<utl::TempFile> pNewTempFile;
284 if (!pTempFile)
286 pNewTempFile.reset(new utl::TempFile);
287 pTempFile = pNewTempFile.get();
289 save(pShell, pFormat, *pTempFile);
290 if (nExportType == ODP || nExportType == ODG)
292 BootstrapFixture::validate(pTempFile->GetFileName(), test::ODF);
294 else if(nExportType == PPTX)
296 BootstrapFixture::validate(pTempFile->GetFileName(), test::OOXML);
298 else if(nExportType == PPT)
300 BootstrapFixture::validate(pTempFile->GetFileName(), test::MSBINARY);
302 pTempFile->EnableKillingFile();
303 return loadURL(pTempFile->GetURL(), nExportType);
306 /** Dump shapes in xDocShRef, and compare the dump against content of pShapesDumpFileNameBase<number>.xml.
308 @param bCreate Instead of comparing to the reference file(s), create it/them.
310 void compareWithShapesDump( ::sd::DrawDocShellRef xDocShRef, const OUString &rShapesDumpFileNameBase, bool bCreate )
312 CPPUNIT_ASSERT_MESSAGE( "failed to load", xDocShRef.is() );
313 CPPUNIT_ASSERT_MESSAGE( "not in destruction", !xDocShRef->IsInDestruction() );
315 uno::Reference<frame::XModel> xTempModel(xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
316 uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier (xTempModel, uno::UNO_QUERY_THROW);
317 uno::Reference< drawing::XDrawPages > xDrawPages = xDrawPagesSupplier->getDrawPages();
318 CPPUNIT_ASSERT(xDrawPages.is());
320 sal_Int32 nLength = xDrawPages->getCount();
321 for (sal_Int32 i = 0; i < nLength; ++i)
323 uno::Reference<drawing::XDrawPage> xDrawPage;
324 uno::Any aAny = xDrawPages->getByIndex(i);
325 aAny >>= xDrawPage;
326 uno::Reference< drawing::XShapes > xShapes(xDrawPage, uno::UNO_QUERY_THROW);
327 OUString aString = XShapeDumper::dump(xShapes);
329 OString aFileName = OUStringToOString( rShapesDumpFileNameBase, RTL_TEXTENCODING_UTF8 ) +
330 OString::number(i) + ".xml";
332 if ( bCreate )
334 std::ofstream aStream( aFileName.getStr(), std::ofstream::out | std::ofstream::binary );
335 aStream << aString;
336 aStream.close();
338 else
340 doXMLDiff(aFileName.getStr(),
341 OUStringToOString(aString, RTL_TEXTENCODING_UTF8).getStr(),
342 static_cast<int>(aString.getLength()),
343 OUStringToOString(
344 m_directories.getPathFromSrc("/sd/qa/unit/data/tolerance.xml"),
345 RTL_TEXTENCODING_UTF8).getStr());
348 xDocShRef->DoClose();
351 uno::Reference< drawing::XDrawPagesSupplier > getDoc( sd::DrawDocShellRef xDocShRef )
353 uno::Reference< drawing::XDrawPagesSupplier > xDoc (
354 xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW );
355 return xDoc;
358 uno::Reference< drawing::XDrawPage > getPage( int nPage, sd::DrawDocShellRef xDocShRef )
360 uno::Reference< drawing::XDrawPagesSupplier > xDoc( getDoc( xDocShRef ) );
361 uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex( nPage ), uno::UNO_QUERY_THROW );
362 return xPage;
365 // very confusing ... UNO index-based access to pages is 0-based. This one is 1-based
366 const SdrPage* GetPage( int nPage, sd::DrawDocShellRef xDocShRef )
368 SdDrawDocument* pDoc = xDocShRef->GetDoc() ;
369 CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != nullptr );
371 const SdrPage* pPage = pDoc->GetPage( nPage );
372 CPPUNIT_ASSERT_MESSAGE( "no page", pPage != nullptr );
373 return pPage;
376 uno::Reference< beans::XPropertySet > getShape( int nShape, uno::Reference< drawing::XDrawPage > const & xPage )
378 uno::Reference< beans::XPropertySet > xShape( xPage->getByIndex( nShape ), uno::UNO_QUERY );
379 CPPUNIT_ASSERT_MESSAGE( "Failed to load shape", xShape.is() );
380 return xShape;
383 // Nth shape on Mth page
384 uno::Reference< beans::XPropertySet > getShapeFromPage( int nShape, int nPage, sd::DrawDocShellRef xDocShRef )
386 uno::Reference< drawing::XDrawPage > xPage ( getPage( nPage, xDocShRef ) );
387 uno::Reference< beans::XPropertySet > xShape( getShape( nShape, xPage ) );
388 CPPUNIT_ASSERT_MESSAGE( "Failed to load shape", xShape.is() );
390 return xShape;
393 // Nth paragraph of text in given text shape
394 uno::Reference< text::XTextRange > getParagraphFromShape( int nPara, uno::Reference< beans::XPropertySet > const & xShape )
396 uno::Reference< text::XText > xText = uno::Reference< text::XTextRange>( xShape, uno::UNO_QUERY_THROW )->getText();
397 CPPUNIT_ASSERT_MESSAGE( "Not a text shape", xText.is() );
399 uno::Reference< container::XEnumerationAccess > paraEnumAccess( xText, uno::UNO_QUERY );
400 uno::Reference< container::XEnumeration > paraEnum( paraEnumAccess->createEnumeration() );
402 for ( int i = 0; i < nPara; ++i )
403 paraEnum->nextElement();
405 uno::Reference< text::XTextRange > xParagraph( paraEnum->nextElement(), uno::UNO_QUERY_THROW );
407 return xParagraph;
410 uno::Reference< text::XTextRange > getRunFromParagraph( int nRun, uno::Reference< text::XTextRange > const & xParagraph )
412 uno::Reference< container::XEnumerationAccess > runEnumAccess(xParagraph, uno::UNO_QUERY);
413 uno::Reference< container::XEnumeration > runEnum = runEnumAccess->createEnumeration();
415 for ( int i = 0; i < nRun; ++i )
416 runEnum->nextElement();
418 uno::Reference< text::XTextRange > xRun( runEnum->nextElement(), uno::UNO_QUERY);
420 return xRun;
423 uno::Reference<text::XTextField> getTextFieldFromPage(int nRun, int nPara, int nShape, int nPage, sd::DrawDocShellRef xDocShRef)
425 // get TextShape 1 from the first page
426 uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( nShape, nPage, xDocShRef ) );
428 // Get first paragraph
429 uno::Reference<text::XTextRange> xParagraph( getParagraphFromShape( nPara, xShape ) );
431 // first chunk of text
432 uno::Reference<text::XTextRange> xRun( getRunFromParagraph( nRun, xParagraph ) );
434 uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
436 uno::Reference<text::XTextField> xField;
437 xPropSet->getPropertyValue("TextField") >>= xField;
438 return xField;
443 class SdModelTestBaseXML
444 : public SdModelTestBase, public XmlTestTools
447 public:
448 std::shared_ptr<SvStream> parseExportStream(utl::TempFile const & rTempFile, const OUString& rStreamName)
450 // Read the stream we're interested in.
451 OUString const url(rTempFile.GetURL());
452 uno::Reference<packages::zip::XZipFileAccess2> const xZipNames(packages::zip::ZipFileAccess::createWithURL(
453 comphelper::getComponentContext(m_xSFactory), url));
454 uno::Reference<io::XInputStream> const xInputStream(xZipNames->getByName(rStreamName), uno::UNO_QUERY);
455 std::shared_ptr<SvStream> const pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true));
456 return pStream;
459 xmlDocPtr parseExport(utl::TempFile const & rTempFile, OUString const& rStreamName)
461 std::shared_ptr<SvStream> const pStream(parseExportStream(rTempFile, rStreamName));
462 xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get());
463 OUString const url(rTempFile.GetURL());
464 pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup(
465 reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr())));
466 return pXmlDoc;
471 CPPUNIT_NS_BEGIN
473 template<> struct assertion_traits<Color>
475 static bool equal( const Color& c1, const Color& c2 )
477 return c1 == c2;
480 static std::string toString( const Color& c )
482 OStringStream ost;
483 ost << static_cast<sal_uInt32>(c);
484 return ost.str();
488 CPPUNIT_NS_END
490 #endif
492 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */