summaryrefslogtreecommitdiff
path: root/sw/source/filter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-04-16 10:14:05 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-04-16 10:58:49 +0200
commit21cd910d144b14ead358bccd1146650806346eb5 (patch)
tree2b949bdd9ae68b5f44b596e7073e47e31577e822 /sw/source/filter
parent0255a3f1704e50c478bd9a9e3e389a5e1f23ae81 (diff)
sw html/reqif export: fix size of embedded object
We used to write the size of the underlying OLE object, which may or may not match the user-configured size. The PNG preview was correct, which works with the size from the SwFormatFlyCnt ("as-char formatting"). Do the same when writing the "object size" (i.e. \objw and \objh in the RTF snippet). Change-Id: I7e240c1e115846c17b0945376b0de02d19769100 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114197 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source/filter')
-rw-r--r--sw/source/filter/html/htmlplug.cxx4
-rw-r--r--sw/source/filter/html/htmlreqifreader.cxx7
-rw-r--r--sw/source/filter/html/htmlreqifreader.hxx4
3 files changed, 10 insertions, 5 deletions
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 65e0419f4ed9..a744e6cb64ff 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1549,7 +1549,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
if (xStream.is())
{
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xStream));
- if (SwReqIfReader::WrapOleInRtf(*pStream, aOutStream, *pOLENd))
+ if (SwReqIfReader::WrapOleInRtf(*pStream, aOutStream, *pOLENd, rFrameFormat))
{
// Data always wrapped in RTF.
aFileType = aRTFType;
@@ -1568,7 +1568,7 @@ Writer& OutHTML_FrameFormatOLENodeGrf( Writer& rWrt, const SwFrameFormat& rFrame
aOLEExp.ExportOLEObject(rOLEObj.GetObject(), *pStorage);
pStorage->Commit();
aMemory.Seek(0);
- if (SwReqIfReader::WrapOleInRtf(aMemory, aOutStream, *pOLENd))
+ if (SwReqIfReader::WrapOleInRtf(aMemory, aOutStream, *pOLENd, rFrameFormat))
{
// Data always wrapped in RTF.
aFileType = aRTFType;
diff --git a/sw/source/filter/html/htmlreqifreader.cxx b/sw/source/filter/html/htmlreqifreader.cxx
index c0a3196bb018..6c9155fbc556 100644
--- a/sw/source/filter/html/htmlreqifreader.cxx
+++ b/sw/source/filter/html/htmlreqifreader.cxx
@@ -24,6 +24,8 @@
#include <vcl/FilterConfigItem.hxx>
#include <vcl/wmf.hxx>
#include <comphelper/propertyvalue.hxx>
+#include <fmtfsize.hxx>
+#include <frmfmt.hxx>
using namespace com::sun::star;
@@ -427,7 +429,8 @@ bool ExtractOleFromRtf(SvStream& rRtf, SvStream& rOle, bool& bOwnFormat)
return true;
}
-bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode)
+bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode,
+ const SwFrameFormat& rFormat)
{
sal_uInt64 nPos = rOle2.Tell();
comphelper::ScopeGuard g([&rOle2, nPos] { rOle2.Seek(nPos); });
@@ -436,7 +439,7 @@ bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode)
SvMemoryStream aOLE1;
// Prepare presentation data early, so it's available to both OLE1 and RTF.
- Size aSize(rOLENode.GetTwipSize());
+ Size aSize = rFormat.GetFrameSize().GetSize();
sal_uInt32 nWidth = aSize.getWidth();
sal_uInt32 nHeight = aSize.getHeight();
const Graphic* pGraphic = rOLENode.GetGraphic();
diff --git a/sw/source/filter/html/htmlreqifreader.hxx b/sw/source/filter/html/htmlreqifreader.hxx
index 3d0816739d6a..5f757d0fbf1d 100644
--- a/sw/source/filter/html/htmlreqifreader.hxx
+++ b/sw/source/filter/html/htmlreqifreader.hxx
@@ -13,6 +13,7 @@ class Graphic;
class Size;
class SvStream;
class SwOLENode;
+class SwFrameFormat;
namespace SwReqIfReader
{
@@ -24,7 +25,8 @@ namespace SwReqIfReader
bool ExtractOleFromRtf(SvStream& rRtf, SvStream& rOle, bool& bOwnFormat);
/// Wraps an OLE2 container binary in an RTF fragment.
-bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode);
+bool WrapOleInRtf(SvStream& rOle2, SvStream& rRtf, SwOLENode& rOLENode,
+ const SwFrameFormat& rFormat);
/**
* Wraps an image in an RTF fragment.