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);
821 pAction->SetWidth(nTempWidth);
823 sal_uInt32 nTempStrikeout(0);
825 sal_uInt32 nTempUnderline(0);
833 sal_uInt32 nTempOverline(0);
852 pAction->SetBitmap(aBmp);
853 pAction->SetPoint(aPoint);
872 pAction->SetBitmap(aBmp);
873 pAction->SetPoint(aPoint);
874 pAction->SetSize(aSz);
896 pAction->SetBitmap(aBmp);
897 pAction->SetDestPoint(aDestPoint);
898 pAction->SetDestSize(aDestSize);
899 pAction->SetSrcPoint(aSrcPoint);
900 pAction->SetSrcSize(aSrcSize);
916 pAction->SetPoint(aPoint);
917 pAction->SetBitmapEx(aBmpEx);
936 pAction->SetBitmapEx(aBmpEx);
937 pAction->SetPoint(aPoint);
938 pAction->SetSize(aSize);
960 pAction->SetBitmapEx(aBmpEx);
961 pAction->SetDestPoint(aDstPoint);
962 pAction->SetDestSize(aDstSize);
963 pAction->SetSrcPoint(aSrcPoint);
964 pAction->SetSrcSize(aSrcSize);
980 pAction->SetBitmap(aBmp);
981 pAction->SetPoint(aPoint);
999 pAction->SetBitmap(aBmp);
1000 pAction->SetPoint(aPoint);
1001 pAction->SetSize(aSize);
1025 pAction->SetBitmap(aBmp);
1026 pAction->SetColor(aColor);
1027 pAction->SetDestPoint(aDstPt);
1028 pAction->SetDestSize(aDstSz);
1029 pAction->SetSrcPoint(aSrcPt);
1030 pAction->SetSrcSize(aSrcSz);
1047 pAction->SetRect(aRect);
1048 pAction->SetGradient(aGradient);
1064 pAction->SetGradient(aGradient);
1065 pAction->SetPolyPolygon(aPolyPoly);
1080 pAction->SetPolyPolygon(aPolyPoly);
1081 pAction->SetHatch(aHatch);
1094 pAction->SetWallpaper(aWallpaper);
1109 pAction->SetRegion(aRegion);
1110 pAction->SetClipping(aClip);
1124 pAction->SetRect(aRect);
1136 pAction->SetRegion(aRegion);
1146 sal_Int32 nTmpHM(0), nTmpVM(0);
1149 pAction->SetHorzMove(nTmpHM);
1150 pAction->SetVertMove(nTmpVM);
1163 pAction->SetColor(aColor);
1178 pAction->SetColor(aColor);
1179 pAction->SetSetting(bSet);
1194 pAction->SetColor(aColor);
1195 pAction->SetSetting(bSet);
1210 pAction->SetColor(aColor);
1211 pAction->SetSetting(bSet);
1221 sal_uInt16 nTmp16(0);
1224 pAction->SetTextAlign(
static_cast<TextAlign>(nTmp16));
1238 pAction->SetMapMode(aMapMode);
1251 if (
pData->meActualCharSet == RTL_TEXTENCODING_DONTKNOW)
1252 pData->meActualCharSet = osl_getThreadTextEncoding();
1254 pAction->SetFont(aFont);
1285 sal_uInt16 nTmp16(0);
1290 pAction->SetRasterOp(
static_cast<RasterOp>(nTmp16));
1302 sal_uInt16 nTransPercent(0);
1305 pAction->SetPolyPolygon(aPolyPoly);
1306 pAction->SetTransparence(nTransPercent);
1329 pAction->SetGDIMetaFile(aMtf);
1330 pAction->SetPoint(aPoint);
1331 pAction->SetSize(aSize);
1332 pAction->SetGradient(aGradient);
1352 pAction->SetLink(aGfxLink);
1353 pAction->SetPoint(aPoint);
1354 pAction->SetSize(aSize);
1355 pAction->SetSubstitute(aSubst);
1372 pAction->SetRefPoint(aRefPoint);
1373 pAction->SetSetting(bSet);
1386 sal_uInt32 nDataSize(0);
1392 << nDataSize <<
" claimed, truncating");
1396 SAL_INFO(
"vcl.gdi",
"MetaCommentAction::Read " << aComment);
1398 std::unique_ptr<sal_uInt8[]>
pData;
1407 pAction->SetComment(aComment);
1408 pAction->SetDataSize(nDataSize);
1409 pAction->SetValue(
nValue);
1410 pAction->SetData(
pData.get(), nDataSize);
1433 sal_uInt16 nTmp = 0;
1436 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 & 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)