OOXML writes @ and # as calls and a reference union as a parenthesised list, so for each of them we need to know how far the sub-expression under it reaches. CreateStringFromTokenArray worked that out from the text it had already written. The problem with this is that every pair it spliced in shifted all the offsets that were still waiting behind it, so it kept breaking. Instead of patching the text, OOXMLRewriter builds a second token array in the shape OOXML spells out and the writer walks that as it stands. The call names and the parentheses are ordinary tokens, so there is nothing to splice and no offsets to keep track of. It is the same trick RewriteMissing already plays a few lines further up, and it means the input and the output can be looked at side by side. The # changes place, from behind its operand to a call in front of it, so it gets an opcode of its own. _xlfn.ANCHORARRAY spells ocAnchorArray now, and ocSpill keeps the native postfix spelling with no OOXML one at all, so the postfix form cannot end up in a file by accident. The import already rewrote the call back into the postfix operator and now recognises it by opcode instead of by position. The @ stays ocSingleValue, it is already in front of its operand so only the parentheses are new. The OFFSET() literal argument is swapped for the reference error in the same pass, instead of the writing loop jumping over tokens. A unit test drives the rewrite on its own: token array in, token array out, one case per shape. The shapes that end up with nothing to wrap are in there too - a lone @, one with a missing argument, and text that never parsed - since those are the ones where dropping a token is the only change. Also drop the dead "@" and "#" rows from the OOXML symbol table, the rows above them already have _xlfn.SINGLE and _xlfn.ANCHORARRAY. Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> Change-Id: I63944fb85b5c4388f304f7d94afd0b4f347d7782 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/10155 Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 4feac84950f5b524d99e277481de50f7b45a8d2f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210292 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
32 lines
783 B
Makefile
32 lines
783 B
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_Module_Module,formula))
|
|
|
|
$(eval $(call gb_Module_add_targets,formula,\
|
|
Library_for \
|
|
Library_forui \
|
|
UIConfig_formula \
|
|
))
|
|
|
|
$(eval $(call gb_Module_add_check_targets,formula,\
|
|
CppunitTest_formula_ooxml \
|
|
))
|
|
|
|
$(eval $(call gb_Module_add_l10n_targets,formula,\
|
|
AllLangMoTarget_for \
|
|
))
|
|
|
|
# screenshots
|
|
$(eval $(call gb_Module_add_screenshot_targets,formula,\
|
|
CppunitTest_formula_dialogs_test \
|
|
))
|
|
|
|
# vim: set noet sw=4 ts=4:
|