21#include <osl/thread.h>
41 rtl_TextEncoding m_eOrigCharSet;
46 , m_eOrigCharSet(
m_rData.meActualCharSet)
51 bool TooDeep()
const {
return m_rData.mnParseDepth > 1024; }
55 m_rData.meActualCharSet = m_eOrigCharSet;
87 sal_uInt32 nStmCompressMode = 0;
103 std::unique_ptr<ImplMetaReadData> xReadData;
107 pData = xReadData.get();
111 if (aDepthGuard.TooDeep())
112 throw std::runtime_error(
"too much recursion");
139 SAL_WARN(
"vcl",
"GDIMetaFile exception during load");
299 pAction->SetSetting(aBool);
300 pAction->SetColor(aColor);
316 pAction->SetColor(aColor);
317 pAction->SetSetting(aBool);
331 pAction->SetRect(aRectangle);
345 pAction->SetPoint(aPoint);
362 pAction->SetPoint(aPoint);
363 pAction->SetColor(aColor);
381 pAction->SetStartPoint(aPoint);
382 pAction->SetEndPoint(aEndPoint);
389 pAction->SetLineInfo(aLineInfo);
404 sal_uInt32 HorzRound(0);
405 sal_uInt32 VertRound(0);
408 pAction->SetRect(aRectangle);
409 pAction->SetHorzRound(HorzRound);
410 pAction->SetVertRound(VertRound);
425 pAction->SetRect(aRectangle);
444 pAction->SetRect(aRectangle);
445 pAction->SetStartPoint(aPoint);
446 pAction->SetEndPoint(aEndPoint);
465 pAction->SetRect(aRectangle);
466 pAction->SetStartPoint(aPoint);
467 pAction->SetEndPoint(aEndPoint);
486 pAction->SetRect(aRectangle);
487 pAction->SetStartPoint(aPoint);
488 pAction->SetEndPoint(aEndPoint);
508 pAction->SetLineInfo(aLineInfo);
517 pAction->SetPolygon(aPolygon);
539 pAction->SetPolygon(aPolygon);
554 pAction->SetPolyPolygon(aPolyPolygon);
558 sal_uInt16 nNumberOfComplexPolygons(0);
560 const size_t nMinRecordSize =
sizeof(sal_uInt16);
562 if (nNumberOfComplexPolygons > nMaxRecords)
564 SAL_WARN(
"vcl.gdi",
"Parsing error: " << nMaxRecords <<
" max possible entries, but "
565 << nNumberOfComplexPolygons
566 <<
" claimed, truncating");
567 nNumberOfComplexPolygons = nMaxRecords;
569 for (sal_uInt16
i = 0;
i < nNumberOfComplexPolygons; ++
i)
578 <<
" outside possible range "
579 << aPolyPolygon.
Count());
585 pAction->SetPolyPolygon(aPolyPolygon);
600 sal_uInt16 nTmpIndex(0);
602 sal_uInt16 nTmpLen(0);
605 pAction->SetPoint(aPoint);
610 if (nTmpIndex >
aStr.getLength())
612 SAL_WARN(
"vcl.gdi",
"inconsistent offset");
613 nTmpIndex =
aStr.getLength();
616 if (nTmpLen >
aStr.getLength() - nTmpIndex)
618 SAL_WARN(
"vcl.gdi",
"inconsistent len");
619 nTmpLen =
aStr.getLength() - nTmpIndex;
622 pAction->SetIndex(nTmpIndex);
623 pAction->SetLen(nTmpLen);
625 pAction->SetText(
aStr);
641 pAction->SetPoint(aPoint);
644 pAction->SetText(
aStr);
646 sal_uInt16 nTmpIndex(0);
649 sal_uInt16 nTmpLen(0);
652 sal_Int32 nAryLen(0);
655 if (nTmpLen >
aStr.getLength() - nTmpIndex)
657 SAL_WARN(
"vcl.gdi",
"inconsistent offset and len");
658 pAction->SetIndex(0);
659 pAction->SetLen(
aStr.getLength());
663 pAction->SetIndex(nTmpIndex);
664 pAction->SetLen(nTmpLen);
669 if (nTmpLen >= nAryLen)
675 for (
i = 0;
i < nAryLen;
i++)
681 for (;
i < nTmpLen;
i++)
684 catch (std::bad_alloc&)
697 pAction->SetText(
aStr);
699 if (nTmpLen >
aStr.getLength() - nTmpIndex)
701 SAL_WARN(
"vcl.gdi",
"inconsistent offset and len");
702 pAction->SetIndex(0);
703 pAction->SetLen(
aStr.getLength());
709 pAction->SetDXArray(std::move(aArray));
713 sal_uInt32 nKashidaAryLen(0);
715 nTmpLen = std::min(nKashidaAryLen,
static_cast<sal_uInt32
>(pAction->GetDXArray().size()));
719 std::vector<sal_Bool> aKashidaArray(pAction->GetDXArray().size(), 0);
723 for (sal_uInt32
i = 0;
i < nTmpLen;
i++)
726 aKashidaArray[
i] = val;
728 pAction->SetKashidaArray(std::move(aKashidaArray));
745 sal_uInt32 nTmpWidth(0);
747 sal_uInt16 nTmpIndex(0);
749 sal_uInt16 nTmpLen(0);
752 pAction->SetPoint(aPoint);
753 pAction->SetWidth(nTmpWidth);
758 if (nTmpIndex >
aStr.getLength())
760 SAL_WARN(
"vcl.gdi",
"inconsistent offset");
761 nTmpIndex =
aStr.getLength();
764 if (nTmpLen >
aStr.getLength() - nTmpIndex)
766 SAL_WARN(
"vcl.gdi",
"inconsistent len");
767 nTmpLen =
aStr.getLength() - nTmpIndex;
770 pAction->SetIndex(nTmpIndex);
771 pAction->SetLen(nTmpLen);
773 pAction->SetText(
aStr);
791 pAction->SetRect(aRect);
798 pAction->SetStyle(nFlags);
803 pAction->SetText(
aStr);
817 sal_Int32 nTempWidth(0);
820 pAction->SetStartPoint(aPos);
823 SAL_WARN(
"vcl.gdi",
"negative width");
826 pAction->SetWidth(nTempWidth);
828 sal_uInt32 nTempStrikeout(0);
830 sal_uInt32 nTempUnderline(0);
838 sal_uInt32 nTempOverline(0);
857 pAction->SetBitmap(aBmp);
858 pAction->SetPoint(aPoint);
877 pAction->SetBitmap(aBmp);
878 pAction->SetPoint(aPoint);
879 pAction->SetSize(aSz);
901 pAction->SetBitmap(aBmp);
902 pAction->SetDestPoint(aDestPoint);
903 pAction->SetDestSize(aDestSize);
904 pAction->SetSrcPoint(aSrcPoint);
905 pAction->SetSrcSize(aSrcSize);
921 pAction->SetPoint(aPoint);
922 pAction->SetBitmapEx(aBmpEx);
941 pAction->SetBitmapEx(aBmpEx);
942 pAction->SetPoint(aPoint);
943 pAction->SetSize(aSize);
965 pAction->SetBitmapEx(aBmpEx);
966 pAction->SetDestPoint(aDstPoint);
967 pAction->SetDestSize(aDstSize);
968 pAction->SetSrcPoint(aSrcPoint);
969 pAction->SetSrcSize(aSrcSize);
985 pAction->SetBitmap(aBmp);
986 pAction->SetPoint(aPoint);
1004 pAction->SetBitmap(aBmp);
1005 pAction->SetPoint(aPoint);
1006 pAction->SetSize(aSize);
1030 pAction->SetBitmap(aBmp);
1031 pAction->SetColor(aColor);
1032 pAction->SetDestPoint(aDstPt);
1033 pAction->SetDestSize(aDstSz);
1034 pAction->SetSrcPoint(aSrcPt);
1035 pAction->SetSrcSize(aSrcSz);
1052 pAction->SetRect(aRect);
1053 pAction->SetGradient(aGradient);
1069 pAction->SetGradient(aGradient);
1070 pAction->SetPolyPolygon(aPolyPoly);
1085 pAction->SetPolyPolygon(aPolyPoly);
1086 pAction->SetHatch(aHatch);
1099 pAction->SetWallpaper(aWallpaper);
1114 pAction->SetRegion(aRegion);
1115 pAction->SetClipping(aClip);
1129 pAction->SetRect(aRect);
1141 pAction->SetRegion(aRegion);
1151 sal_Int32 nTmpHM(0), nTmpVM(0);
1154 pAction->SetHorzMove(nTmpHM);
1155 pAction->SetVertMove(nTmpVM);
1168 pAction->SetColor(aColor);
1183 pAction->SetColor(aColor);
1184 pAction->SetSetting(bSet);
1199 pAction->SetColor(aColor);
1200 pAction->SetSetting(bSet);
1215 pAction->SetColor(aColor);
1216 pAction->SetSetting(bSet);
1226 sal_uInt16 nTmp16(0);
1229 pAction->SetTextAlign(
static_cast<TextAlign>(nTmp16));
1243 pAction->SetMapMode(aMapMode);
1256 if (
pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW)
1257 pData->meActualCharSet = osl_getThreadTextEncoding();
1259 pAction->SetFont(aFont);
1290 sal_uInt16 nTmp16(0);
1295 pAction->SetRasterOp(
static_cast<RasterOp>(nTmp16));
1307 sal_uInt16 nTransPercent(0);
1310 pAction->SetPolyPolygon(aPolyPoly);
1311 pAction->SetTransparence(nTransPercent);
1334 pAction->SetGDIMetaFile(aMtf);
1335 pAction->SetPoint(aPoint);
1336 pAction->SetSize(aSize);
1337 pAction->SetGradient(aGradient);
1344 double fOff, fR, fG, fB;
1348 if (nTmp > nMaxPossibleEntries)
1350 SAL_WARN(
"vcl.gdi",
"gradient record claims to have: " << nTmp <<
" entries, but only "
1351 << nMaxPossibleEntries
1352 <<
" possible, clamping");
1353 nTmp = nMaxPossibleEntries;
1356 for (sal_uInt16
a(0);
a < nTmp;
a++)
1366 pAction->addSVGTransparencyColorStops(aColorStops);
1387 pAction->SetLink(aGfxLink);
1388 pAction->SetPoint(aPoint);
1389 pAction->SetSize(aSize);
1390 pAction->SetSubstitute(aSubst);
1407 pAction->SetRefPoint(aRefPoint);
1408 pAction->SetSetting(bSet);
1421 sal_uInt32 nDataSize(0);
1427 << nDataSize <<
" claimed, truncating");
1431 SAL_INFO(
"vcl.gdi",
"MetaCommentAction::Read " << aComment);
1433 std::unique_ptr<sal_uInt8[]>
pData;
1442 pAction->SetComment(aComment);
1443 pAction->SetDataSize(nDataSize);
1444 pAction->SetValue(
nValue);
1445 pAction->SetData(
pData.get(), nDataSize);
1468 sal_uInt16 nTmp = 0;
1471 pAction->SetTextLanguage(
static_cast<LanguageType>(nTmp));
const Sequence< Sequence< double > > & m_rData
DepthGuard(HWPFile &rFile)
void push_back(sal_Int32 nUnit)
Converts old SVGDI aka SVM1 format data to current VCLMTF aka SVM2 format metafile data.
SvStream & ReadCharAsBool(bool &rBool)
void SetEndian(SvStreamEndian SvStreamEndian)
OUString ReadUniOrByteString(rtl_TextEncoding eSrcCharSet)
SvStream & ReadDouble(double &rDouble)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStreamEndian GetEndian() const
void SetError(ErrCode nErrorCode)
sal_uInt64 Seek(sal_uInt64 nPos)
SvStream & ReadInt32(sal_Int32 &rInt32)
std::size_t ReadBytes(void *pData, std::size_t nSize)
rtl_TextEncoding GetStreamCharSet() const
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
SvStream & ReadUChar(unsigned char &rChar)
rtl::Reference< MetaAction > TextLineColorHandler()
rtl::Reference< MetaAction > PieHandler()
rtl::Reference< MetaAction > TextColorHandler()
rtl::Reference< MetaAction > PolyPolygonHandler()
rtl::Reference< MetaAction > ClipRegionHandler()
rtl::Reference< MetaAction > PointHandler()
rtl::Reference< MetaAction > ArcHandler()
rtl::Reference< MetaAction > RefPointHandler()
rtl::Reference< MetaAction > GradientHandler()
rtl::Reference< MetaAction > BmpExScalePartHandler()
SvStream & Read(GDIMetaFile &rMetaFile, ImplMetaReadData *pData=nullptr)
void ReadColor(::Color &rColor)
rtl::Reference< MetaAction > BmpExHandler()
rtl::Reference< MetaAction > TextArrayHandler(const ImplMetaReadData *pData)
rtl::Reference< MetaAction > MapModeHandler()
rtl::Reference< MetaAction > MaskHandler()
rtl::Reference< MetaAction > LineColorHandler()
rtl::Reference< MetaAction > HatchHandler()
rtl::Reference< MetaAction > TextAlignHandler()
rtl::Reference< MetaAction > RasterOpHandler()
rtl::Reference< MetaAction > ISectRegionClipRegionHandler()
rtl::Reference< MetaAction > BmpHandler()
rtl::Reference< MetaAction > CommentHandler()
rtl::Reference< MetaAction > PopHandler()
rtl::Reference< MetaAction > StretchTextHandler(const ImplMetaReadData *pData)
rtl::Reference< MetaAction > PixelHandler()
rtl::Reference< MetaAction > ChordHandler()
SvmReader(SvStream &rIStm)
rtl::Reference< MetaAction > TransparentHandler()
rtl::Reference< MetaAction > EllipseHandler()
rtl::Reference< MetaAction > PolyLineHandler()
rtl::Reference< MetaAction > MoveClipRegionHandler()
rtl::Reference< MetaAction > FillColorHandler()
rtl::Reference< MetaAction > TextHandler(const ImplMetaReadData *pData)
rtl::Reference< MetaAction > FloatTransparentHandler(ImplMetaReadData *pData)
rtl::Reference< MetaAction > PolygonHandler()
rtl::Reference< MetaAction > PushHandler()
rtl::Reference< MetaAction > TextFillColorHandler()
rtl::Reference< MetaAction > TextLanguageHandler()
rtl::Reference< MetaAction > ISectRectClipRegionHandler()
rtl::Reference< MetaAction > BmpScalePartHandler()
rtl::Reference< MetaAction > TextRectHandler(const ImplMetaReadData *pData)
static rtl::Reference< MetaAction > DefaultHandler()
rtl::Reference< MetaAction > MaskScalePartHandler()
rtl::Reference< MetaAction > MetaActionHandler(ImplMetaReadData *pData)
rtl::Reference< MetaAction > EPSHandler()
rtl::Reference< MetaAction > RectHandler()
rtl::Reference< MetaAction > OverlineColorHandler()
rtl::Reference< MetaAction > RoundRectHandler()
rtl::Reference< MetaAction > BmpScaleHandler()
rtl::Reference< MetaAction > WallpaperHandler()
rtl::Reference< MetaAction > MaskScaleHandler()
rtl::Reference< MetaAction > BmpExScaleHandler()
rtl::Reference< MetaAction > LineHandler()
rtl::Reference< MetaAction > GradientExHandler()
rtl::Reference< MetaAction > FontHandler(ImplMetaReadData *pData)
rtl::Reference< MetaAction > LayoutModeHandler()
rtl::Reference< MetaAction > TextLineHandler()
void readMapMode(MapMode &rMapMode)
void readGradient(Gradient &rGradient)
void readGfxLink(GfxLink &rGfxLink)
sal_uInt16 GetVersion() const
rtl_TextEncoding GetCharSet() const
#define SVSTREAM_FILEFORMAT_ERROR
SvStream & ReadFont(SvStream &rIStm, vcl::Font &rFont)
SvStream & ReadHatch(SvStream &rIStm, Hatch &rHatch)
SvStream & ReadLineInfo(SvStream &rIStm, LineInfo &rLineInfo)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
SvStream & ReadRegion(SvStream &rIStrm, vcl::Region &rRegion)
OString read_uInt16_lenPrefixed_uInt8s_ToOString(SvStream &rStrm)
OUString read_uInt16_lenPrefixed_uInt16s_ToOUString(SvStream &rStrm)
SvStream & ReadWallpaper(SvStream &rIStm, Wallpaper &rImplWallpaper)