From d0a1616ccad0dd5f5a02c1b0204f537b57d0b4b5 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Thu, 6 May 2021 14:14:56 +0300 Subject: 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 --- .../qa/extras/xshape/data/reference/tdf90839-1.xml | 74 +++++++++++----------- .../qa/extras/xshape/data/reference/tdf90839-2.xml | 66 +++++++++---------- .../qa/extras/xshape/data/reference/tdf90839-3.xml | 66 +++++++++---------- .../qa/extras/xshape/data/reference/tdf90839-4.xml | 64 +++++++++---------- 4 files changed, 135 insertions(+), 135 deletions(-) (limited to 'chart2/qa/extras') diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-1.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-1.xml index 2af62c344940..3586969602c1 100644 --- a/chart2/qa/extras/xshape/data/reference/tdf90839-1.xml +++ b/chart2/qa/extras/xshape/data/reference/tdf90839-1.xml @@ -175,15 +175,15 @@ - + - + - + - + - + @@ -192,21 +192,21 @@ - - + + - - + + - + - + @@ -215,21 +215,21 @@ - - + + - - + + - + - + @@ -238,21 +238,21 @@ - - + + - - + + - + - + @@ -262,20 +262,20 @@ - + - + - + - + @@ -284,36 +284,36 @@ - - + + - - + + - - + + - - + + - - + + diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml index d7e5c4a364f9..a2719aaf69f5 100644 --- a/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml +++ b/chart2/qa/extras/xshape/data/reference/tdf90839-2.xml @@ -14,7 +14,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,11 +40,11 @@ - + - + @@ -175,15 +175,15 @@ - + - + - + - + - + @@ -193,20 +193,20 @@ - + - + - + - + @@ -216,20 +216,20 @@ - + - + - + - + @@ -239,20 +239,20 @@ - + - + - + - + @@ -262,20 +262,20 @@ - + - + - + - + @@ -285,50 +285,50 @@ - + - + - + - + - + - + - + - \ No newline at end of file + diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml index 77a1ac06f80a..3c4cc8a5b51d 100644 --- a/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml +++ b/chart2/qa/extras/xshape/data/reference/tdf90839-3.xml @@ -14,7 +14,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,11 +40,11 @@ - + - + @@ -175,15 +175,15 @@ - + - + - + - + - + @@ -193,20 +193,20 @@ - + - + - + - + @@ -216,20 +216,20 @@ - + - + - + - + @@ -239,20 +239,20 @@ - + - + - + - + @@ -262,20 +262,20 @@ - + - + - + - + @@ -285,50 +285,50 @@ - + - + - + - + - + - + - + - \ No newline at end of file + diff --git a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml index 6b182821f1c9..c8327f6e3e95 100644 --- a/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml +++ b/chart2/qa/extras/xshape/data/reference/tdf90839-4.xml @@ -14,7 +14,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,11 +40,11 @@ - + - + @@ -175,15 +175,15 @@ - + - + - + - + - + @@ -193,20 +193,20 @@ - + - + - + - + @@ -216,20 +216,20 @@ - + - + - + - + @@ -239,20 +239,20 @@ - + - + - + - + @@ -262,20 +262,20 @@ - + - + - + - + @@ -285,49 +285,49 @@ - + - + - + - + - + - + - + -- cgit v1.2.3