diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-01-18 17:04:14 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-01-19 16:32:08 +0100 |
commit | f168cfc7a3a374fba2175eb8682a69b924928ccb (patch) | |
tree | 883987c60cc2e9fa4ec433ab0b7580ce06ee882d /vcl/source | |
parent | 1b826cf5cdc6aa145d62a1b0e6567a91b4b1acb9 (diff) |
sw: fix unexpected paragraph border inside table cells
The bug document has a table cell, which contains a paragraph with
borders. Its left/right/bottom borders are rendered in Writer, but not
in Word.
The reason for the left/right border is that it's outside the
paragraph's frame area, which is not rendered in Word. Fix this by
clipping the rendered borders so they don't go outside the paragraph's
frame area. (Normally the frame area is the larger rectangle, and then
margins may cause a smaller "print area", but in this case we have a
negative right margin, so clipping the print area to fit into the frame
area actually does something.)
This is quite similar to what commit
1e21902106cbe57658bed03ed24d4d0863685cfd (tdf#117884: intersect border
with paint area of upper frame., 2018-05-26) did for table borders.
The bottom border is a different problem: the cell has a fixed height
and enough content so the paragraph is cut off vertically. This means
that technically the bottom border would be inside the frame area, but
Word cuts it off, because they apply clipping on the not-yet-cut-off
rectangle. Fix this by dropping the bottom margin when the frame is cut
off.
(cherry picked from commit 4a7281fa206c0a82cfc2ba23f25c31ae775d8777)
Conflicts:
sw/qa/core/layout/layout.cxx
sw/source/core/layout/paintfrm.cxx
Change-Id: I7f65b68997330b247db65839db8a484e74f78c64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128611
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/mtfxmldump.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx index 5e80e3f229f5..33eae5a38263 100644 --- a/vcl/source/gdi/mtfxmldump.cxx +++ b/vcl/source/gdi/mtfxmldump.cxx @@ -1032,6 +1032,30 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& r // dumping the real polypolygon in the future tools::Rectangle aRectangle = pMetaClipRegionAction->GetRegion().GetBoundRect(); writeRectangle(rWriter, aRectangle); + + vcl::Region aRegion = pMetaClipRegionAction->GetRegion(); + + if (aRegion.HasPolyPolygonOrB2DPolyPolygon()) + { + tools::PolyPolygon aPolyPolygon = aRegion.GetAsPolyPolygon(); + + for (sal_uInt16 j = 0; j < aPolyPolygon.Count(); ++j) + { + rWriter.startElement("polygon"); + tools::Polygon const& rPolygon = aPolyPolygon[j]; + bool bFlags = rPolygon.HasFlags(); + for (sal_uInt16 i = 0; i < rPolygon.GetSize(); ++i) + { + rWriter.startElement("point"); + writePoint(rWriter, rPolygon[i]); + if (bFlags) + rWriter.attribute("flags", convertPolygonFlags(rPolygon.GetFlags(i))); + rWriter.endElement(); + } + rWriter.endElement(); + } + } + rWriter.endElement(); } break; |