diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-05-06 14:14:56 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-06-08 14:51:29 +0200 |
commit | d0a1616ccad0dd5f5a02c1b0204f537b57d0b4b5 (patch) | |
tree | f52e71cd8c4f6e2df6dad122d70e28a00d75e2a1 /test/source | |
parent | 95ebd24a629b4c8cd62cc20c0701683512cc8fa0 (diff) |
editengine-columns: Implement layout
This changes the way how different parts access positions of lines and
paragraphs. Now there is ImpEditEngine::IterateLineAreas, which performs
uniform iteration over all ParaPortions and lines in order, calling a
user-provided callback function for each portion and line; it passes
all information about current portion, line, area, and column to the
callback, and checks the return from the callback, to decide if it needs
to continue iteration (in case when callback indicated that if doesn't
need further data), and if it needs calling the callback for the rest of
current portion's lines.
This allows to have the code that calculates and iterates dimensions of
lines in one central place, without the need to have duplicating logic
in several places.
One important exception is ImpEditEngine::Paint, which iterates without
ImpEditEngine::IterateLineAreas, because it does many atomic paint
operations in different points of iteration process, and implementing
ImpEditEngine::IterateLineAreas to call callback in the required places
would require increased complexity, which is left for a future change.
To make that possible, ImpEditEngine::IterFlag should be extended to
indicate additional requirements.
Note that in fact, ImpEditEngine::Paint was taken as the model for
implementation of ImpEditEngine::IterateLineAreas, with its detailed
handling of all the vertical offsets like additional line spacing and
interparagraph spacings that depend on context.
The notable result of the centralization of the iteration code is slight
change of heights reported by ImpEditEngine::CalcTextHeight. Previously
it simply added all pre-calculated heights of portions, and not taking
into account all the spacing handling that ImpEditEngine::Paint did,
which was inconsistent (calculated height was different from painted
height). Now ImpEditEngine::CalcTextHeight should provide more accurate
results, which required small changes in the unit tests.
Change-Id: I33cbb978deb974b314d36fda8674186a03991107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116034
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'test/source')
-rw-r--r-- | test/source/sheet/xsheetannotationshapesupplier.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/source/sheet/xsheetannotationshapesupplier.cxx b/test/source/sheet/xsheetannotationshapesupplier.cxx index dac446b72b52..fe392fc83494 100644 --- a/test/source/sheet/xsheetannotationshapesupplier.cxx +++ b/test/source/sheet/xsheetannotationshapesupplier.cxx @@ -33,7 +33,7 @@ void XSheetAnnotationShapeSupplier::testGetAnnotationShape() CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong width", sal_Int32(11275), xShape->getSize().Width); CPPUNIT_ASSERT_EQUAL_MESSAGE("getAnnotationShape() wrong height", - sal_Int32(1386), xShape->getSize().Height); + sal_Int32(1387), xShape->getSize().Height); } } |