diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-10-24 09:06:54 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-10-26 09:54:10 +0200 |
commit | 5e430a08cb5bd3f292836c044b9700572a7d8f00 (patch) | |
tree | 402f8287c54e782114e0d2ca0811bd791ebeab6c /include | |
parent | c8d4a99082269c7008df5765232a93d19e7a3d84 (diff) |
tdf#155040 sw floattable, RTF: fix table is overlapped by subsequent inline one
The document had overlapping text on load since commit
05425f73bfa41d3f7591461e2ad0beb4fafc39b4 (sw floatable: teach the RTF
import about SwFormatFlySplit, 2023-04-21).
Interestingly the DOCX equivalent was fine, there the inline table is
shifted down, below the floating table, so the overlap doesn't happen.
Fix the problem by moving the AddVerticalFrameOffsets=true code from the
DOCX filter to the shared dmapper, because RTF needs the same.
See commit 50223ea6e212b60b7d33839c2753c5601fb50f95 (tdf#98987 sw: add
AddVerticalFrameOffsets compat mode, 2016-03-31) for more details about
this compat flag. It was already enabled for DOC, too.
(cherry picked from commit 612629f4a81acd7b851b7eccc97aba9a5915d13c)
[ The backport also contains a subset of commit
56e17186ffcda7e93530bef3a06120584bb7d579 ([API CHANGE] Merge
sfx2::XmlDump into css::qa::XDumper, 2022-12-10), otherwise it's hard to
verify the layout from writerfilter/. ]
Conflicts:
chart2/source/model/main/ChartModel.cxx
chart2/source/view/main/ChartView.cxx
include/comphelper/dumpxmltostring.hxx
sw/source/uibase/inc/unotxvw.hxx
Change-Id: I948b179c9ec5fa24377014b0e86826568c417b6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158481
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/comphelper/dumpxmltostring.hxx | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/include/comphelper/dumpxmltostring.hxx b/include/comphelper/dumpxmltostring.hxx new file mode 100644 index 000000000000..72cdafee35fe --- /dev/null +++ b/include/comphelper/dumpxmltostring.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <sal/config.h> + +#include <libxml/tree.h> +#include <libxml/xmlwriter.h> + +#include <new> + +namespace comphelper +{ +template <typename F> OUString dumpXmlToString(F f) +{ + auto const buf = xmlBufferCreate(); + if (buf == nullptr) + { + throw std::bad_alloc(); + } + auto const writer = xmlNewTextWriterMemory(buf, 0); + if (writer == nullptr) + { + throw std::bad_alloc(); + } + f(writer); + xmlFreeTextWriter(writer); + std::string_view s(reinterpret_cast<char const*>(xmlBufferContent(buf)), xmlBufferLength(buf)); + OUString rv = OStringToOUString(s, RTL_TEXTENCODING_ISO_8859_1); //TODO + xmlBufferFree(buf); + return rv; +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |