LibreOffice Module sw (master) 1
htmlreqifreader.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#include "htmlreqifreader.hxx"
11
14#include <rtl/strbuf.hxx>
15#include <sot/storage.hxx>
16#include <svtools/parrtf.hxx>
17#include <svtools/rtfkeywd.hxx>
18#include <svtools/rtftoken.h>
19#include <tools/stream.hxx>
21#include <vcl/cvtgrf.hxx>
22#include <ndole.hxx>
23#include <sal/log.hxx>
25#include <vcl/wmf.hxx>
27#include <fmtfsize.hxx>
28#include <frmfmt.hxx>
29
30using namespace com::sun::star;
31
32namespace
33{
35class ReqIfRtfReader : public SvRTFParser
36{
37public:
38 ReqIfRtfReader(SvStream& rStream);
39 void NextToken(int nToken) override;
40 bool WriteObjectData(SvStream& rOLE);
41
42private:
43 bool m_bInObjData = false;
44 OStringBuffer m_aHex;
45};
46
47ReqIfRtfReader::ReqIfRtfReader(SvStream& rStream)
48 : SvRTFParser(rStream)
49{
50}
51
52void ReqIfRtfReader::NextToken(int nToken)
53{
54 switch (nToken)
55 {
56 case '}':
57 m_bInObjData = false;
58 break;
59 case RTF_TEXTTOKEN:
60 if (m_bInObjData)
61 m_aHex.append(OUStringToOString(aToken, RTL_TEXTENCODING_ASCII_US));
62 break;
63 case RTF_OBJDATA:
64 m_bInObjData = true;
65 break;
66 }
67}
68
69bool ReqIfRtfReader::WriteObjectData(SvStream& rOLE)
70{
71 return msfilter::rtfutil::ExtractOLE2FromObjdata(m_aHex.makeStringAndClear(), rOLE);
72}
73
75OString ExtractOLEClassName(const tools::SvRef<SotStorage>& xStorage)
76{
77 OString aRet;
78
79 tools::SvRef<SotStorageStream> pCompObj = xStorage->OpenSotStream("\1CompObj");
80 if (!pCompObj)
81 return aRet;
82
83 pCompObj->Seek(0);
84 pCompObj->SeekRel(28); // Header
85 if (!pCompObj->good())
86 return aRet;
87
88 sal_uInt32 nData;
89 pCompObj->ReadUInt32(nData); // AnsiUserType
90 pCompObj->SeekRel(nData);
91 if (!pCompObj->good())
92 return aRet;
93
94 pCompObj->ReadUInt32(nData); // AnsiClipboardFormat
95 pCompObj->SeekRel(nData);
96 if (!pCompObj->good())
97 return aRet;
98
99 pCompObj->ReadUInt32(nData); // Reserved1
100 return read_uInt8s_ToOString(*pCompObj, nData - 1); // -1 because it is null-terminated
101}
102
104bool ParseOLE2Presentation(SvStream& rOle2, sal_uInt32& nWidth, sal_uInt32& nHeight,
105 SvStream& rPresentationData)
106{
107 // See [MS-OLEDS] 2.3.4, OLEPresentationStream
108 rOle2.Seek(0);
109 tools::SvRef<SotStorage> pStorage = new SotStorage(rOle2);
110 tools::SvRef<SotStorageStream> xOle2Presentation
111 = pStorage->OpenSotStream("\002OlePres000", StreamMode::STD_READ);
112
113 // Read AnsiClipboardFormat.
114 sal_uInt32 nMarkerOrLength = 0;
115 xOle2Presentation->ReadUInt32(nMarkerOrLength);
116 if (nMarkerOrLength != 0xffffffff)
117 // FormatOrAnsiString is not present
118 return false;
119 sal_uInt32 nFormatOrAnsiLength = 0;
120 xOle2Presentation->ReadUInt32(nFormatOrAnsiLength);
121 if (nFormatOrAnsiLength != 0x00000003) // CF_METAFILEPICT
122 return false;
123
124 // Read TargetDeviceSize.
125 sal_uInt32 nTargetDeviceSize = 0;
126 xOle2Presentation->ReadUInt32(nTargetDeviceSize);
127 if (nTargetDeviceSize != 0x00000004)
128 // TargetDevice is present
129 return false;
130
131 sal_uInt32 nAspect = 0;
132 xOle2Presentation->ReadUInt32(nAspect);
133 sal_uInt32 nLindex = 0;
134 xOle2Presentation->ReadUInt32(nLindex);
135 sal_uInt32 nAdvf = 0;
136 xOle2Presentation->ReadUInt32(nAdvf);
137 sal_uInt32 nReserved1 = 0;
138 xOle2Presentation->ReadUInt32(nReserved1);
139 xOle2Presentation->ReadUInt32(nWidth);
140 xOle2Presentation->ReadUInt32(nHeight);
141 sal_uInt32 nSize = 0;
142 xOle2Presentation->ReadUInt32(nSize);
143
144 // Read Data.
145 if (nSize > xOle2Presentation->remainingSize())
146 return false;
147
148 if (nSize <= 64)
149 {
150 SAL_WARN("sw.html",
151 "ParseOLE2Presentation: ignoring potentially broken small preview: size is "
152 << nSize);
153 return false;
154 }
155
156 std::vector<char> aBuffer(nSize);
157 xOle2Presentation->ReadBytes(aBuffer.data(), aBuffer.size());
158 rPresentationData.WriteBytes(aBuffer.data(), aBuffer.size());
159
160 return true;
161}
162
167OString InsertOLE1HeaderFromOle10NativeStream(const tools::SvRef<SotStorage>& xStorage,
168 SwOLENode& rOLENode, SvStream& rOle1)
169{
171 = xStorage->OpenSotStream("\1Ole10Native", StreamMode::STD_READ);
172 sal_uInt32 nOle1Size = 0;
173 xOle1Stream->ReadUInt32(nOle1Size);
174
175 OString aClassName;
176 if (xStorage->GetClassName() == SvGlobalName(0x0003000A, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46))
177 {
178 aClassName = "PBrush";
179 }
180 else
181 {
182 if (xStorage->GetClassName()
183 != SvGlobalName(0x0003000C, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46))
184 {
185 SAL_WARN("sw.html", "InsertOLE1HeaderFromOle10NativeStream: unexpected class id: "
186 << xStorage->GetClassName().GetHexName());
187 }
188 aClassName = "Package";
189 }
190
191 // Write ObjectHeader, see [MS-OLEDS] 2.2.4.
192 rOle1.Seek(0);
193 // OLEVersion.
194 rOle1.WriteUInt32(0x00000501);
195
196 // FormatID is EmbeddedObject.
197 rOle1.WriteUInt32(0x00000002);
198
199 // ClassName
200 rOle1.WriteUInt32(aClassName.isEmpty() ? 0 : aClassName.getLength() + 1);
201 if (!aClassName.isEmpty())
202 {
203 rOle1.WriteOString(aClassName);
204 // Null terminated pascal string.
205 rOle1.WriteChar(0);
206 }
207
208 // TopicName.
209 rOle1.WriteUInt32(0);
210
211 // ItemName.
212 rOle1.WriteUInt32(0);
213
214 // NativeDataSize
215 rOle1.WriteUInt32(nOle1Size);
216
217 // Write the actual native data.
218 rOle1.WriteStream(*xOle1Stream, nOle1Size);
219
220 // Write Presentation.
221 if (!rOLENode.GetGraphic())
222 {
223 return aClassName;
224 }
225
226 const Graphic& rGraphic = *rOLENode.GetGraphic();
227 Size aSize = rOLENode.GetTwipSize();
228 SvMemoryStream aGraphicStream;
229 if (GraphicConverter::Export(aGraphicStream, rGraphic, ConvertDataFormat::WMF) != ERRCODE_NONE)
230 {
231 return aClassName;
232 }
233
234 auto pGraphicAry = static_cast<const sal_uInt8*>(aGraphicStream.GetData());
235 sal_uInt64 nPresentationData = aGraphicStream.TellEnd();
236 msfilter::rtfutil::StripMetafileHeader(pGraphicAry, nPresentationData);
237
238 // OLEVersion.
239 rOle1.WriteUInt32(0x00000501);
240 // FormatID: constant means the ClassName field is present.
241 rOle1.WriteUInt32(0x00000005);
242 // ClassName: null terminated pascal string.
243 OString aPresentationClassName("METAFILEPICT");
244 rOle1.WriteUInt32(aPresentationClassName.getLength() + 1);
245 rOle1.WriteOString(aPresentationClassName);
246 rOle1.WriteChar(0);
247 // Width.
248 rOle1.WriteUInt32(aSize.getWidth());
249 // Height.
250 rOle1.WriteUInt32(aSize.getHeight() * -1);
251 // PresentationDataSize
252 rOle1.WriteUInt32(8 + nPresentationData);
253 // Reserved1-4.
254 rOle1.WriteUInt16(0x0008);
255 rOle1.WriteUInt16(0x31b1);
256 rOle1.WriteUInt16(0x1dd9);
257 rOle1.WriteUInt16(0x0000);
258 rOle1.WriteBytes(pGraphicAry, nPresentationData);
259
260 return aClassName;
261}
262
269OString InsertOLE1Header(SvStream& rOle2, SvStream& rOle1, sal_uInt32& nWidth, sal_uInt32& nHeight,
270 SwOLENode& rOLENode, const sal_uInt8* pPresentationData,
271 sal_uInt64 nPresentationData)
272{
273 rOle2.Seek(0);
274 tools::SvRef<SotStorage> xStorage(new SotStorage(rOle2));
275 if (xStorage->GetError() != ERRCODE_NONE)
276 return {};
277
278 if (xStorage->IsStream("\1Ole10Native"))
279 {
280 return InsertOLE1HeaderFromOle10NativeStream(xStorage, rOLENode, rOle1);
281 }
282
283 OString aClassName = ExtractOLEClassName(xStorage);
284
285 // Write ObjectHeader, see [MS-OLEDS] 2.2.4.
286 rOle1.Seek(0);
287 // OLEVersion.
288 rOle1.WriteUInt32(0x00000501);
289
290 // FormatID is EmbeddedObject.
291 rOle1.WriteUInt32(0x00000002);
292
293 // ClassName
294 rOle1.WriteUInt32(aClassName.isEmpty() ? 0 : aClassName.getLength() + 1);
295 if (!aClassName.isEmpty())
296 {
297 rOle1.WriteOString(aClassName);
298 // Null terminated pascal string.
299 rOle1.WriteChar(0);
300 }
301
302 // TopicName.
303 rOle1.WriteUInt32(0);
304
305 // ItemName.
306 rOle1.WriteUInt32(0);
307
308 // NativeDataSize
309 rOle1.WriteUInt32(rOle2.TellEnd());
310
311 // Write the actual native data.
312 rOle2.Seek(0);
313 rOle1.WriteStream(rOle2);
314
315 // Write Presentation.
316 SvMemoryStream aPresentationData;
317 // OLEVersion.
318 rOle1.WriteUInt32(0x00000501);
319 // FormatID: constant means the ClassName field is present.
320 rOle1.WriteUInt32(0x00000005);
321 // ClassName: null terminated pascal string.
322 OString aPresentationClassName("METAFILEPICT");
323 rOle1.WriteUInt32(aPresentationClassName.getLength() + 1);
324 rOle1.WriteOString(aPresentationClassName);
325 rOle1.WriteChar(0);
326 const sal_uInt8* pBytes = nullptr;
327 sal_uInt64 nBytes = 0;
328 if (ParseOLE2Presentation(rOle2, nWidth, nHeight, aPresentationData))
329 {
330 // Take presentation data for OLE1 from OLE2.
331 pBytes = static_cast<const sal_uInt8*>(aPresentationData.GetData());
332 nBytes = aPresentationData.Tell();
333 }
334 else
335 {
336 // Take presentation data for OLE1 from RTF.
337 pBytes = pPresentationData;
338 nBytes = nPresentationData;
339 }
340 // Width.
341 rOle1.WriteUInt32(nWidth);
342 // Height.
343 rOle1.WriteUInt32(nHeight * -1);
344 // PresentationDataSize: size of (reserved fields + pBytes).
345 rOle1.WriteUInt32(8 + nBytes);
346 // Reserved1-4.
347 rOle1.WriteUInt16(0x0008);
348 rOle1.WriteUInt16(0x31b1);
349 rOle1.WriteUInt16(0x1dd9);
350 rOle1.WriteUInt16(0x0000);
351 rOle1.WriteBytes(pBytes, nBytes);
352
353 return aClassName;
354}
355
357void WrapOleGraphicInRtf(SvStream& rRtf, sal_uInt32 nWidth, sal_uInt32 nHeight,
358 const sal_uInt8* pPresentationData, sal_uInt64 nPresentationData)
359{
360 // Start result.
361 rRtf.WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_RESULT);
362
363 // Start pict.
364 rRtf.WriteCharPtr("{" OOO_STRING_SVTOOLS_RTF_PICT);
365
366 rRtf.WriteCharPtr(OOO_STRING_SVTOOLS_RTF_WMETAFILE "8");
367 rRtf.WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PICW);
368 rRtf.WriteOString(OString::number(nWidth));
369 rRtf.WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PICH);
370 rRtf.WriteOString(OString::number(nHeight));
371 rRtf.WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PICWGOAL);
372 rRtf.WriteOString(OString::number(nWidth));
373 rRtf.WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PICHGOAL);
374 rRtf.WriteOString(OString::number(nHeight));
375 if (pPresentationData)
376 {
377 rRtf.WriteCharPtr(SAL_NEWLINE_STRING);
378 msfilter::rtfutil::WriteHex(pPresentationData, nPresentationData, &rRtf);
379 }
380
381 // End pict.
382 rRtf.WriteCharPtr("}");
383
384 // End result.
385 rRtf.WriteCharPtr("}");
386}
387}
388
390{
391bool ExtractOleFromRtf(SvStream& rRtf, SvStream& rOle, bool& bOwnFormat)
392{
393 // Add missing header/footer.
394 SvMemoryStream aRtf;
395 aRtf.WriteOString("{\\rtf1");
396 aRtf.WriteStream(rRtf);
397 aRtf.WriteOString("}");
398 aRtf.Seek(0);
399
400 // Read the RTF markup.
401 tools::SvRef<ReqIfRtfReader> xReader(new ReqIfRtfReader(aRtf));
402 SvParserState eState = xReader->CallParser();
403 if (eState == SvParserState::Error)
404 return false;
405
406 // Write the OLE2 data.
407 if (!xReader->WriteObjectData(rOle))
408 return false;
409
410 tools::SvRef<SotStorage> pStorage = new SotStorage(rOle);
411 OUString aFilterName = SvxMSDffManager::GetFilterNameFromClassID(pStorage->GetClassName());
412 bOwnFormat = !aFilterName.isEmpty();
413 if (!bOwnFormat)
414 {
415 // Real OLE2 data, we're done.
416 rOle.Seek(0);
417 return true;
418 }
419
420 // ODF-in-OLE2 case, extract actual data.
421 SvMemoryStream aMemory;
422 SvxMSDffManager::ExtractOwnStream(*pStorage, aMemory);
423 rOle.Seek(0);
424 aMemory.Seek(0);
425 rOle.WriteStream(aMemory);
426 // Stream length is current position + 1.
427 rOle.SetStreamSize(aMemory.GetSize() + 1);
428 rOle.Seek(0);
429 return true;
430}
431
432bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode,
433 const SwFrameFormat& rFormat)
434{
435 sal_uInt64 nPos = rOle2.Tell();
436 comphelper::ScopeGuard g([&rOle2, nPos] { rOle2.Seek(nPos); });
437
438 // Write OLE1 header, then the RTF wrapper.
439 SvMemoryStream aOLE1;
440
441 // Prepare presentation data early, so it's available to both OLE1 and RTF.
442 Size aSize = rFormat.GetFrameSize().GetSize();
443 sal_uInt32 nWidth = aSize.getWidth();
444 sal_uInt32 nHeight = aSize.getHeight();
445 const Graphic* pGraphic = rOLENode.GetGraphic();
446 const sal_uInt8* pPresentationData = nullptr;
447 sal_uInt64 nPresentationData = 0;
448 SvMemoryStream aGraphicStream;
449 if (pGraphic)
450 {
451 uno::Sequence<beans::PropertyValue> aFilterData
452 = { comphelper::makePropertyValue("EmbedEMF", false) };
453 FilterConfigItem aConfigItem(&aFilterData);
454 if (ConvertGraphicToWMF(*pGraphic, aGraphicStream, &aConfigItem))
455 {
456 pPresentationData = static_cast<const sal_uInt8*>(aGraphicStream.GetData());
457 nPresentationData = aGraphicStream.TellEnd();
458 msfilter::rtfutil::StripMetafileHeader(pPresentationData, nPresentationData);
459 }
460 }
461 OString aClassName = InsertOLE1Header(rOle2, aOLE1, nWidth, nHeight, rOLENode,
462 pPresentationData, nPresentationData);
463
464 // Start object.
467
468 // Start objclass.
470 rRtf.WriteOString(aClassName);
471 // End objclass.
472 rRtf.WriteCharPtr("}");
473
474 // Object size.
476 rRtf.WriteOString(OString::number(nWidth));
478 rRtf.WriteOString(OString::number(nHeight));
479
480 // Start objdata.
481 rRtf.WriteCharPtr(
483 msfilter::rtfutil::WriteHex(static_cast<const sal_uInt8*>(aOLE1.GetData()), aOLE1.GetSize(),
484 &rRtf);
485 // End objdata.
486 rRtf.WriteCharPtr("}");
487
488 if (pPresentationData)
489 {
490 WrapOleGraphicInRtf(rRtf, nWidth, nHeight, pPresentationData, nPresentationData);
491 }
492
493 // End object.
494 rRtf.WriteCharPtr("}");
495
496 return true;
497}
498
499bool WrapGraphicInRtf(const Graphic& rGraphic, const SwFrameFormat& rFormat, SvStream& rRtf)
500{
501 // Start object.
504
505 // Object size: as used in the document model (not pixel size)
506 Size aSize = rFormat.GetFrameSize().GetSize();
507 sal_uInt32 nWidth = aSize.getWidth();
508 sal_uInt32 nHeight = aSize.getHeight();
510 rRtf.WriteOString(OString::number(nWidth));
512 rRtf.WriteOString(OString::number(nHeight));
514
515 // Start objclass.
517 OString aClassName("PBrush");
518 rRtf.WriteOString(aClassName);
519 // End objclass.
520 rRtf.WriteCharPtr("}");
522
523 // Start objdata.
525
526 SvMemoryStream aOle1;
527 // Write ObjectHeader, see [MS-OLEDS] 2.2.4.
528 // OLEVersion.
529 aOle1.WriteUInt32(0x00000501);
530
531 // FormatID is EmbeddedObject.
532 aOle1.WriteUInt32(0x00000002);
533
534 // ClassName
535 aOle1.WriteUInt32(aClassName.getLength() + 1);
536 aOle1.WriteOString(aClassName);
537 // Null terminated pascal string.
538 aOle1.WriteChar(0);
539
540 // TopicName.
541 aOle1.WriteUInt32(0);
542
543 // ItemName.
544 aOle1.WriteUInt32(0);
545
546 // NativeDataSize
547 SvMemoryStream aNativeData;
548
549 // Set white background for the semi-transparent pixels.
550 BitmapEx aBitmapEx = rGraphic.GetBitmapEx();
551 Bitmap aBitmap = aBitmapEx.GetBitmap(/*aTransparentReplaceColor=*/COL_WHITE);
552
553 if (GraphicConverter::Export(aNativeData, BitmapEx(aBitmap), ConvertDataFormat::BMP)
554 != ERRCODE_NONE)
555 {
556 SAL_WARN("sw.html", "WrapGraphicInRtf: bmp conversion failed");
557 }
558 aOle1.WriteUInt32(aNativeData.TellEnd());
559
560 // Write the actual native data.
561 aNativeData.Seek(0);
562 aOle1.WriteStream(aNativeData);
563
564 // Prepare presentation data.
565 const sal_uInt8* pPresentationData = nullptr;
566 sal_uInt64 nPresentationData = 0;
567 SvMemoryStream aGraphicStream;
568 uno::Sequence<beans::PropertyValue> aFilterData
569 = { comphelper::makePropertyValue("EmbedEMF", false) };
570 FilterConfigItem aConfigItem(&aFilterData);
571 if (ConvertGraphicToWMF(rGraphic, aGraphicStream, &aConfigItem))
572 {
573 pPresentationData = static_cast<const sal_uInt8*>(aGraphicStream.GetData());
574 nPresentationData = aGraphicStream.TellEnd();
575 msfilter::rtfutil::StripMetafileHeader(pPresentationData, nPresentationData);
576 }
577
578 // Write Presentation.
579 // OLEVersion.
580 aOle1.WriteUInt32(0x00000501);
581 // FormatID: constant means the ClassName field is present.
582 aOle1.WriteUInt32(0x00000005);
583 // ClassName: null terminated pascal string.
584 OString aPresentationClassName("METAFILEPICT");
585 aOle1.WriteUInt32(aPresentationClassName.getLength() + 1);
586 aOle1.WriteOString(aPresentationClassName);
587 aOle1.WriteChar(0);
588 const sal_uInt8* pBytes = nullptr;
589 sal_uInt64 nBytes = 0;
590 // Take presentation data for OLE1 from RTF.
591 pBytes = pPresentationData;
592 nBytes = nPresentationData;
593 // Width.
594 aOle1.WriteUInt32(nWidth);
595 // Height.
596 aOle1.WriteUInt32(nHeight * -1);
597 // PresentationDataSize: size of (reserved fields + pBytes).
598 aOle1.WriteUInt32(8 + nBytes);
599 // Reserved1-4.
600 aOle1.WriteUInt16(0x0008);
601 aOle1.WriteUInt16(0x31b1);
602 aOle1.WriteUInt16(0x1dd9);
603 aOle1.WriteUInt16(0x0000);
604 aOle1.WriteBytes(pBytes, nBytes);
605
606 // End objdata.
607 msfilter::rtfutil::WriteHex(static_cast<const sal_uInt8*>(aOle1.GetData()), aOle1.GetSize(),
608 &rRtf);
609 rRtf.WriteCharPtr("}");
611
614
615 Size aMapped(rGraphic.GetPrefSize());
617 rRtf.WriteOString(OString::number(aMapped.Width()));
619 rRtf.WriteOString(OString::number(aMapped.Height()));
620
622 rRtf.WriteOString(OString::number(nWidth));
624 rRtf.WriteOString(OString::number(nHeight));
627
628 if (pPresentationData)
629 {
630 msfilter::rtfutil::WriteHex(pPresentationData, nPresentationData, &rRtf);
632 }
633
634 // End pict.
635 rRtf.WriteCharPtr("}");
636
637 // End result.
638 rRtf.WriteCharPtr("}");
639
640 // End object.
641 rRtf.WriteCharPtr("}");
642 return true;
643}
644}
645
646/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Bitmap GetBitmap(Color aTransparentReplaceColor) const
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
Size GetPrefSize() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
const void * GetData()
sal_uInt64 GetSize()
virtual sal_uInt64 TellEnd() override
virtual void NextToken(T nToken)=0
sal_uInt64 Tell() const
virtual sal_uInt64 TellEnd()
std::size_t WriteBytes(const void *pData, std::size_t nSize)
bool SetStreamSize(sal_uInt64 nSize)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & WriteOString(std::string_view rStr)
SvStream & WriteUInt32(sal_uInt32 nUInt32)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & WriteChar(char nChar)
SvStream & WriteCharPtr(const char *pBuf)
SvStream & WriteStream(SvStream &rStream)
static OUString GetFilterNameFromClassID(const SvGlobalName &aGlobName)
static void ExtractOwnStream(SotStorage &rSrcStg, SvMemoryStream &rMemStream)
const Size & GetSize() const
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
Style of a layout element.
Definition: frmfmt.hxx:61
virtual Size GetTwipSize() const override
Definition: ndole.cxx:423
const Graphic * GetGraphic()
Definition: ndole.cxx:245
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
#define SAL_NEWLINE_STRING
#define ERRCODE_NONE
sal_uInt16 nPos
#define SAL_WARN(area, stream)
bool WrapOleInRtf(SvStream &rOle2, SvStream &rRtf, SwOLENode &rOLENode, const SwFrameFormat &rFormat)
Wraps an OLE2 container binary in an RTF fragment.
bool ExtractOleFromRtf(SvStream &rRtf, SvStream &rOle, bool &bOwnFormat)
Extracts an OLE2 container binary from an RTF fragment.
bool WrapGraphicInRtf(const Graphic &rGraphic, const SwFrameFormat &rFormat, SvStream &rRtf)
Wraps an image in an RTF fragment.
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
bool StripMetafileHeader(const sal_uInt8 *&rpGraphicAry, sal_uInt64 &rSize)
bool ExtractOLE2FromObjdata(const OString &rObjdata, SvStream &rOle2)
OString WriteHex(const sal_uInt8 *pData, sal_uInt32 nSize, SvStream *pStream=nullptr, sal_uInt32 nLimit=64)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define OOO_STRING_SVTOOLS_RTF_OBJH
#define OOO_STRING_SVTOOLS_RTF_OBJEMB
#define OOO_STRING_SVTOOLS_RTF_RESULT
#define OOO_STRING_SVTOOLS_RTF_OBJDATA
#define OOO_STRING_SVTOOLS_RTF_PICWGOAL
#define OOO_STRING_SVTOOLS_RTF_PICW
#define OOO_STRING_SVTOOLS_RTF_PICH
#define OOO_STRING_SVTOOLS_RTF_WMETAFILE
#define OOO_STRING_SVTOOLS_RTF_OBJW
#define OOO_STRING_SVTOOLS_RTF_OBJCLASS
#define OOO_STRING_SVTOOLS_RTF_OBJECT
#define OOO_STRING_SVTOOLS_RTF_PICHGOAL
#define OOO_STRING_SVTOOLS_RTF_IGNORE
#define OOO_STRING_SVTOOLS_RTF_PICT
RTF_TEXTTOKEN
RTF_OBJDATA
TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nUnits)
SvParserState
unsigned char sal_uInt8
VCL_DLLPUBLIC bool ConvertGraphicToWMF(const Graphic &rGraphic, SvStream &rTargetStream, FilterConfigItem const *pConfigItem, bool bPlaceable=true)
std::unique_ptr< char[]> aBuffer