summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 13:35:24 +0300
committerpanoskorovesis <panoskorovesis@outlook.com>2021-07-08 13:35:24 +0300
commit017fff734c9b1fd473a1a78a53ff24e4a1d7428a (patch)
treeee23777ac764b6fd82b0cf615aa05f8d587118ac
parentAdd Handler for MetaStretchText Read (diff)
downloadcore-017fff734c9b1fd473a1a78a53ff24e4a1d7428a.tar.gz
core-017fff734c9b1fd473a1a78a53ff24e4a1d7428a.zip
Add Handler for MetaTextRect Read
The handler separates MetaTextAction::Read from metaact.hxx Read implementation is now in SvmReader.hxx Change-Id: Ifa77ced87362204f946b36f95aebd3f72705ed5f
-rw-r--r--include/vcl/filter/SvmReader.hxx1
-rw-r--r--include/vcl/metaact.hxx3
-rw-r--r--vcl/source/filter/svm/SvmReader.cxx27
3 files changed, 30 insertions, 1 deletions
diff --git a/include/vcl/filter/SvmReader.hxx b/include/vcl/filter/SvmReader.hxx
index 230a725c0ca9..ab9654ea8d9a 100644
--- a/include/vcl/filter/SvmReader.hxx
+++ b/include/vcl/filter/SvmReader.hxx
@@ -54,6 +54,7 @@ public:
rtl::Reference<MetaAction> TextHandler(ImplMetaReadData* pData);
rtl::Reference<MetaAction> TextArrayHandler(ImplMetaReadData* pData);
rtl::Reference<MetaAction> StretchTextHandler(ImplMetaReadData* pData);
+ rtl::Reference<MetaAction> TextRectHandler(ImplMetaReadData* pData);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index 19ed80859f33..b6509c12aaf8 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -644,6 +644,9 @@ public:
const tools::Rectangle& GetRect() const { return maRect; }
const OUString& GetText() const { return maStr; }
DrawTextFlags GetStyle() const { return mnStyle; }
+ void SetRect(tools::Rectangle& rRect) { maRect = rRect; }
+ void SetText(OUString& rStr) { maStr = rStr; }
+ void SetStyle(DrawTextFlags rStyle) { mnStyle = rStyle; }
};
class SAL_DLLPUBLIC_RTTI MetaTextLineAction final : public MetaAction
diff --git a/vcl/source/filter/svm/SvmReader.cxx b/vcl/source/filter/svm/SvmReader.cxx
index cea3409df856..1cfb6cd4ab75 100644
--- a/vcl/source/filter/svm/SvmReader.cxx
+++ b/vcl/source/filter/svm/SvmReader.cxx
@@ -204,7 +204,7 @@ rtl::Reference<MetaAction> SvmReader::MetaActionHandler(ImplMetaReadData* pData)
return StretchTextHandler(pData);
break;
case MetaActionType::TEXTRECT:
- pAction = new MetaTextRectAction;
+ return TextRectHandler(pData);
break;
case MetaActionType::TEXTLINE:
pAction = new MetaTextLineAction;
@@ -776,4 +776,29 @@ rtl::Reference<MetaAction> SvmReader::StretchTextHandler(ImplMetaReadData* pData
return pAction;
}
+
+rtl::Reference<MetaAction> SvmReader::TextRectHandler(ImplMetaReadData* pData)
+{
+ auto pAction = new MetaTextRectAction();
+
+ VersionCompatRead aCompat(mrStream);
+ TypeSerializer aSerializer(mrStream);
+
+ tools::Rectangle aRect;
+ aSerializer.readRectangle(aRect);
+ OUString aStr;
+ aStr = mrStream.ReadUniOrByteString(pData->meActualCharSet);
+ sal_uInt16 nTmp;
+ mrStream.ReadUInt16(nTmp);
+
+ pAction->SetRect(aRect);
+ pAction->SetStyle(static_cast<DrawTextFlags>(nTmp));
+
+ if (aCompat.GetVersion() >= 2) // Version 2
+ aStr = read_uInt16_lenPrefixed_uInt16s_ToOUString(mrStream);
+
+ pAction->SetText(aStr);
+
+ return pAction;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */