Files
odfstudio/xmloff/CppunitTest_xmloff_text.mk
Miklos Vajna c625247680 tdf#167761 sw format redline, char style+direct: add ODT export
The bugdoc contains a format redline that changes the character style
from Strong to Quote and the font size from 24 to 36. Exporting to ODT,
loading the ODT and rejecting the redline, the font size is set to 24,
but the character style is set to default instead of Strong.

What happens is that the item set of the format redline contains the
necessary SvxFontHeightItem, but contains no SwFormatCharFormat. This is
because the ODT export writes no parents for char automatic styles,
because char formatting outside the redline table has 2 pool items for
such char formatting: a dedicated SwFormatCharFormat for the char style
and a separate SwFormatAutoFormat for other char props, so the ODT
export "knows" to ignore the autoformat parent and creates this markup:
<text:span text:style-name="...named style..."><text:span text:style-name="...automatic style...">t</text:span></text:span>

Fix the problem by explicitly exporting the parent style name when we
write an automatic style that is referred from the redline table (and
not from the body text). This is similar to what e.g. "frame" autostyles
already do, which also have parents. The result is this markup:
    <style:style style:name="..." style:family="text" style:parent-style-name="Strong_20_Emphasis">
      <style:text-properties fo:font-size="24pt"/>
...
          <text:format-change loext:style-name="...">
which contains both the named character style name and the automatic
style, describing the direct formatting.

The ODT import side still needs fixing.

Change-Id: I19a67cf5e2c538cfcfa1b13097241954667d2c89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190181
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
2025-08-26 12:32:30 +02:00

57 lines
1.5 KiB
Makefile

# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# 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/.
#
#*************************************************************************
$(eval $(call gb_CppunitTest_CppunitTest,xmloff_text))
$(eval $(call gb_CppunitTest_use_externals,xmloff_text,\
boost_headers \
libxml2 \
))
$(eval $(call gb_CppunitTest_add_exception_objects,xmloff_text, \
xmloff/qa/unit/text \
xmloff/qa/unit/text/txtprmap \
xmloff/qa/unit/text/txtparae \
))
$(eval $(call gb_CppunitTest_use_libraries,xmloff_text, \
comphelper \
cppu \
cppuhelper \
docmodel \
embobj \
sal \
subsequenttest \
test \
unotest \
utl \
tl \
))
$(eval $(call gb_CppunitTest_use_sdk_api,xmloff_text))
$(eval $(call gb_CppunitTest_use_ure,xmloff_text))
$(eval $(call gb_CppunitTest_use_vcl,xmloff_text))
$(eval $(call gb_CppunitTest_use_rdb,xmloff_text,services))
$(eval $(call gb_CppunitTest_use_custom_headers,xmloff_text,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_use_configuration,xmloff_text))
$(eval $(call gb_CppunitTest_add_arguments,xmloff_text, \
-env:arg-env=$(gb_Helper_LIBRARY_PATH_VAR)"$$$${$(gb_Helper_LIBRARY_PATH_VAR)+=$$$$$(gb_Helper_LIBRARY_PATH_VAR)}" \
))
# vim: set noet sw=4 ts=4: