[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - 4 commits - external/liborcus sw/qa sw/source vcl/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 3 10:40:21 UTC 2021
external/liborcus/UnpackedTarball_liborcus.mk | 1
external/liborcus/liborcus_newline.patch.1 | 15 +++
sw/qa/extras/layout/data/tabellen_test_windows_1.odt |binary
sw/qa/extras/layout/layout.cxx | 12 ++
sw/source/core/layout/flowfrm.cxx | 3
sw/source/core/txtnode/txtedt.cxx | 8 +
vcl/source/window/printdlg.cxx | 88 +++++++++++++++----
7 files changed, 107 insertions(+), 20 deletions(-)
New commits:
commit 20c6cb67a3450358d393a48770317434d36bfa28
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Sat May 1 18:19:27 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 3 12:37:54 2021 +0200
liborcus: newline problem with GCC 11 -E -fdirectives-only
ooxml_tokens.inl:3524:32: error: stray '#' in program
Change-Id: Ib7f50e1798e8c985f31a0338944ae1e9b439e98f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114975
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit aa38eede9d340cbb11a792ab1ebbe681521a4489)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114921
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index 3b54db0e49ce..710d126a8c17 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/libtool.patch.0 \
external/liborcus/fix-pch.patch.0 \
external/liborcus/include.patch.0 \
+ external/liborcus/liborcus_newline.patch.1 \
))
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
diff --git a/external/liborcus/liborcus_newline.patch.1 b/external/liborcus/liborcus_newline.patch.1
new file mode 100644
index 000000000000..421c30846b27
--- /dev/null
+++ b/external/liborcus/liborcus_newline.patch.1
@@ -0,0 +1,15 @@
+Add newline at end of KRHangulMapping.h
+
+without this, compiling output of GCC 11 -E -fdirectives-only fails with:
+
+ooxml_tokens.inl:3524:32: error: stray '#' in program
+
+--- liborcus/src/liborcus/ooxml_tokens.inl.orig 2021-05-01 18:12:37.490131155 +0200
++++ liborcus/src/liborcus/ooxml_tokens.inl 2021-05-01 18:12:50.994119453 +0200
+@@ -3521,4 +3521,4 @@
+ "zoomToFit" // 3517
+ };
+
+-size_t token_name_count = 3518;
+\ No newline at end of file
++size_t token_name_count = 3518;
commit 9fd7055eb2ef20c5683995a1dc7a09a506e51203
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Fri Apr 30 15:31:54 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 3 12:37:45 2021 +0200
sw: speed up DoIdleJobs(WORD_COUNT)
SwTextNode::CountWords() has early returns that don't clear the
WordCountDirty flag, for nodes that don't contain any plain text.
This speeds things up considerably for tdf135116-1.odt, which didn't
finish the idle jobs after 5 minutes in an optimized 7.1 build, because
the time slice tends to expire iterating nodes in word-count before it
can make progress.
With this it does ~25 WORD_COUNT pages and then ~90 AUTOCOMPLETE_WORDS
pages per idle, sending OnLayoutFinished after 13-14 seconds.
jmux just pointed me to commit 0fedac18214a6025401c4c426466a5166553e8ec
which is not in 7.1 today and may have improved the performance here.
Change-Id: I5e9651da3a173649c49fc36edefb23298dfd6bc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114936
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit 4184569b963877c2a488ff05766654b9db194798)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114919
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index cc66f68ed23e..61e1101fb330 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -2022,6 +2022,10 @@ bool SwTextNode::CountWords( SwDocStat& rStat,
if( nStt == nEnd && !bCountNumbering)
{ // unnumbered empty node or empty selection
+ if (bCountAll)
+ {
+ SetWordCountDirty( false ); // reset flag to speed up DoIdleJob
+ }
return false;
}
@@ -2050,6 +2054,10 @@ bool SwTextNode::CountWords( SwDocStat& rStat,
if (aExpandText.isEmpty() && !bCountNumbering)
{
+ if (bCountAll)
+ {
+ SetWordCountDirty( false ); // reset flag to speed up DoIdleJob
+ }
return false;
}
commit f90fcf1b8868548de5253fc0297550c2d0452d74
Author: Armin Le Grand (Allotropia) <armin.le.grand at me.com>
AuthorDate: Tue Apr 27 11:09:32 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 3 12:37:37 2021 +0200
tdf#141761 Enhance PrintDialog Preview for FormControls
The display quality of the Preview is pretty ugly when
FormControls are used. I made a deep-dive why this happens,
and in principle the reason is the Mteafile::Scale used
below. Since Metafile actions are integer, that floating point
scale leads to rounduing errors that make the lines painting
the FormControls disappear in the surrounding ClipRegions.
That Scale cannot be avoided since the Metafile contains it's
own SetMapMode commands which *will* be executed on ::Play,
so the ::Scale is the only possibility fr Metafile currently:
Giving a Size as parameter in ::Play will *not* work due to
the relativeMapMode that gets created will fail on
::SetMapMode actions in the Metafile - and FormControls DO
use ::SetMapMode(MapPixel).
This can only be solved better in the future using Primitives
which would allow any scale by embedding to a Transformation,
but that would be a bigger rework.
Until then, use this little 'trick' to improve qulatity.
It uses the fact to empirically having tested that the quality
gets really bad for FormControls starting by a scale factor
smaller than 0.2 - that makes the ClipRegion overlap start.
So - for now - try not to go below that.
Change-Id: I540de602634c6afa697b5659d69c34159c22075c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114704
Reviewed-by: Armin Le Grand <Armin.Le.Grand at me.com>
Tested-by: Armin Le Grand <Armin.Le.Grand at me.com>
(cherry picked from commit 4722ad2cf3f2b91c217e3548f811f2972f2aa60c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114715
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index d37c0ec068bc..8866abe43733 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -351,17 +351,14 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
return;
}
- // create temporary VDev and render to it
+ // create temporary VDev with requested Size and DPI.
+ // CAUTION: DPI *is* important here - it DIFFRERS from 75x75, usually 600x600 is used
ScopedVclPtrInstance<VirtualDevice> pPrerenderVDev(*Application::GetDefaultDevice());
pPrerenderVDev->SetOutputSizePixel(aScaledSize, false);
pPrerenderVDev->SetReferenceDevice( mnDPIX, mnDPIY );
- pPrerenderVDev->EnableOutput();
- pPrerenderVDev->SetBackground( Wallpaper(COL_WHITE) );
- GDIMetaFile aMtf( maMtf );
-
- Size aVDevSize( pPrerenderVDev->GetOutputSizePixel() );
- const Size aLogicSize( pPrerenderVDev->PixelToLogic( aVDevSize, MapMode( MapUnit::Map100thMM ) ) );
+ // calculate needed Scale for Metafile (using Size and DPI from VDev)
+ Size aLogicSize( pPrerenderVDev->PixelToLogic( pPrerenderVDev->GetOutputSizePixel(), MapMode( MapUnit::Map100thMM ) ) );
Size aOrigSize( maOrigSize );
if( aOrigSize.Width() < 1 )
aOrigSize.setWidth( aLogicSize.Width() );
@@ -369,30 +366,85 @@ void PrintDialog::PrintPreviewWindow::preparePreviewBitmap()
aOrigSize.setHeight( aLogicSize.Height() );
double fScale = double(aLogicSize.Width())/double(aOrigSize.Width());
+ // tdf#141761
+ // The display quality of the Preview is pretty ugly when
+ // FormControls are used. I made a deep-dive why this happens,
+ // and in principle the reason is the Mteafile::Scale used
+ // below. Since Metafile actions are integer, that floating point
+ // scale leads to rounduing errors that make the lines painting
+ // the FormControls disappear in the surrounding ClipRegions.
+ // That Scale cannot be avoided since the Metafile contains it's
+ // own SetMapMode commands which *will* be executed on ::Play,
+ // so the ::Scale is the only possibility fr Metafile currently:
+ // Giving a Size as parameter in ::Play will *not* work due to
+ // the relativeMapMode that gets created will fail on
+ // ::SetMapMode actions in the Metafile - and FormControls DO
+ // use ::SetMapMode(MapPixel).
+ // This can only be solved better in the future using Primitives
+ // which would allow any scale by embedding to a Transformation,
+ // but that would be a bigger rework.
+ // Until then, use this little 'trick' to improve qulatity.
+ // It uses the fact to empirically having tested that the quality
+ // gets really bad for FormControls starting by a scale factor
+ // smaller than 0.2 - that makes the ClipRegion overlap start.
+ // So - for now - try not to go below that.
+ static double fMinimumScale(0.2);
+ double fFactor(0.0);
+ if(fScale < fMinimumScale)
+ {
+ fFactor = fMinimumScale / fScale;
+ fScale = fMinimumScale;
+
+ double fWidth(aScaledSize.getWidth() * fFactor);
+ double fHeight(aScaledSize.getHeight() * fFactor);
+ const double fNewNeededPixels(fWidth * fHeight);
+
+ // to not risk using too big bitmaps and runninig into
+ // memory problems, still limit to a useful factor is
+ // necessary, also empirically estimated to
+ // avoid the quality from collapsing (using a direct
+ // in-between , ceil'd result)
+ static double fMaximumQualitySquare(1396221.0);
+
+ if(fNewNeededPixels > fMaximumQualitySquare)
+ {
+ const double fCorrection(fMaximumQualitySquare/fNewNeededPixels);
+ fWidth *= fCorrection;
+ fHeight *= fCorrection;
+ fScale *= fCorrection;
+ }
+
+ const Size aScaledSize2(basegfx::fround(fWidth), basegfx::fround(fHeight));
+ pPrerenderVDev->SetOutputSizePixel(aScaledSize2, false);
+ aLogicSize = pPrerenderVDev->PixelToLogic( aScaledSize2, MapMode( MapUnit::Map100thMM ) );
+ }
+
+ pPrerenderVDev->EnableOutput();
+ pPrerenderVDev->SetBackground( Wallpaper(COL_WHITE) );
pPrerenderVDev->Erase();
- pPrerenderVDev->Push();
pPrerenderVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
- DrawModeFlags nOldDrawMode = pPrerenderVDev->GetDrawMode();
if( mbGreyscale )
pPrerenderVDev->SetDrawMode( pPrerenderVDev->GetDrawMode() |
( DrawModeFlags::GrayLine | DrawModeFlags::GrayFill | DrawModeFlags::GrayText |
DrawModeFlags::GrayBitmap | DrawModeFlags::GrayGradient ) );
+
+ // Copy, Scale and Paint Metafile
+ GDIMetaFile aMtf( maMtf );
aMtf.WindStart();
aMtf.Scale( fScale, fScale );
aMtf.WindStart();
-
- const AntialiasingFlags nOriginalAA(pPrerenderVDev->GetAntialiasing());
- pPrerenderVDev->SetAntialiasing(nOriginalAA | AntialiasingFlags::Enable);
aMtf.Play( pPrerenderVDev.get(), Point( 0, 0 ), aLogicSize );
- pPrerenderVDev->SetAntialiasing(nOriginalAA);
-
- pPrerenderVDev->Pop();
pPrerenderVDev->SetMapMode(MapMode(MapUnit::MapPixel));
+ maPreviewBitmap = pPrerenderVDev->GetBitmapEx(Point(0, 0), pPrerenderVDev->GetOutputSizePixel());
- maPreviewBitmap = pPrerenderVDev->GetBitmapEx(Point(0, 0), aVDevSize);
-
- pPrerenderVDev->SetDrawMode( nOldDrawMode );
+ if(0.0 != fFactor)
+ {
+ // Correct to needed size, BmpScaleFlag::Interpolate is acceptable,
+ // but BmpScaleFlag::BestQuality is just better. In case of time
+ // constraints, change to Interpolate would be possible
+ maPreviewBitmap.Scale(aScaledSize, BmpScaleFlag::BestQuality);
+ }
}
PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow()
commit 31c95393641bcd798ea068889d4061a8dc445a55
Author: Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Tue Apr 27 20:07:14 2021 +0200
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon May 3 12:37:30 2021 +0200
sw: layout: let nested table move forward
The problem is that a nested table at the bottom of the page doesn't fit
into its cell, but it is split and its first row still remains on the
page where it doesn't fit.
The outer table 3 tries to split with bTryToSplit=true.
In SwTabFrame::MakeAll(), first a split of the nested table 435 with
bTryToSplit=true is attempted; this fails and is partially undone -
the follow flow line is removed, but the last 2 rows remain in follow.
The bTryToSplit=false is skipped because there's only one row now.
Then MoveFwd() is tried, but it fails because the top-level table
doesn't have a previous frame.
Then bTryToSplit=false is tried, and succeeds, again leaving row 436
on page 1 and other 2 in follow.
Now another attempt with bTryToSplit=true is made, failing again, not
effectively changing anything.
During all of this, growing of the outer cell frame 434 and row frame
433 is prevented by the outer table 3 having a follow flow line, see
SwRowFrame::GrowFrame().
The result is that cell 434 has content area height 190 but the table
435 with its single row is all valid with height 406, so it's cut off in
the rendering.
This doesn't happen for SwTextFrame inside table because that one does
the MoveFwd().
Plausibly it's the inner table's responsibility to finish with a valid
state that fits the constraints of the current page; there are some
checks in lcl_RecalcSplitLine() to check for no content frame in the
row but none for the row being too small to contain the content that
was formatted.
So the only valid results for the inner table are that it either moved
forward, or it left behind a row containing no content (such as that
produced by its own failed attempt to split with bTryToSplit=true),
which could be handled by the outer table split code - but the latter
could be insufficient in case the outer table is itself a follow, or at
least would require further changes in lcl_RecalcSplitLine().
So fix this by removing a condition in MoveFwd() that doesn't make any
sense to me - why is it relevant for an inner table during a split of
the outer table whether the outer table itself can move forward?
Change-Id: I1e01ce233383cc70b9aea72d25369b7278eb75f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114760
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
(cherry picked from commit ca19177728c66d913996a48c91a0ba47d08825d6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114718
Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
diff --git a/sw/qa/extras/layout/data/tabellen_test_windows_1.odt b/sw/qa/extras/layout/data/tabellen_test_windows_1.odt
new file mode 100644
index 000000000000..a666fe5fd47d
Binary files /dev/null and b/sw/qa/extras/layout/data/tabellen_test_windows_1.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 15e33d74d18e..d4450264826a 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -492,6 +492,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf134272)
assertXPath(pXmlDoc, "/root/page[1]/header/txt[2]/infos/bounds", "bottom", "2819");
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestNestedTableMoveFwd)
+{
+ SwDoc* pDoc = createDoc("tabellen_test_windows_1.odt");
+ CPPUNIT_ASSERT(pDoc);
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+ // the row with the nested table should not be split but be the first row on page 2
+ assertXPath(pXmlDoc, "/root/page[1]/body/tab[1]/row[last()]/cell[1]/txt[1]/Text", "Portion",
+ "Tabelle 1");
+ assertXPath(pXmlDoc, "/root/page[2]/body/tab[1]/row[1]/cell[1]/tab[1]/row[1]/cell[1]/txt/Text",
+ "Portion", "Tabelle 2");
+}
+
CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf136613)
{
SwDoc* pDoc = createDoc("tdf136613.docx");
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index aeeb9df158cf..6a2c12a5044f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1951,8 +1951,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
// Allow the MoveFwd even if we do not have an IndPrev in these cases:
if ( m_rThis.IsInTab() &&
( !m_rThis.IsTabFrame() ||
- ( m_rThis.GetUpper()->IsInTab() &&
- m_rThis.GetUpper()->FindTabFrame()->IsFwdMoveAllowed() ) ) &&
+ m_rThis.GetUpper()->IsInTab() ) &&
nullptr != m_rThis.GetNextCellLeaf() )
{
bNoFwd = false;
More information about the Libreoffice-commits
mailing list