[Libreoffice-commits] core.git: sw/qa

2023-12-05 Thread Miklos Vajna (via logerrit)
 sw/qa/inc/swmodeltestbase.hxx  |8 
 sw/qa/unit/swmodeltestbase.cxx |4 
 2 files changed, 12 deletions(-)

New commits:
commit fa38d98155a857908641380c7a1a5a34fafe934e
Author: Miklos Vajna 
AuthorDate: Tue Dec 5 19:57:53 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Dec 6 08:19:43 2023 +0100

Remove now unused SwModelTestBase::preTest()

Which was a way to place test setup code far from the test itself, so
good to get rid of it.

Change-Id: I9f88ded958e7b546f0b1ecd7ce025e72a2a5e245
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160373
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 7eb41f2eda7c..950136e66eba 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -140,14 +140,6 @@ protected:
 CPPUNIT_FAIL( "verify method must be overridden" );
 }
 
-/**
- * Override this function if some special filename-specific setup is needed
- */
-virtual std::unique_ptr preTest(const char* /*filename*/)
-{
-return nullptr;
-}
-
 /// Override this function if some special file-specific setup is needed 
during export test: after load, but before save.
 virtual void postLoad(const char* /*pFilename*/)
 {
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 5029421a631a..d5248bd414fb 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -66,7 +66,6 @@ void SwModelTestBase::executeImportTest(const char* filename, 
const char* pPassw
 {
 maTempFile.EnableKillingFile(false);
 header();
-std::unique_ptr const pChanges(preTest(filename));
 loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword);
 verify();
 finish();
@@ -77,7 +76,6 @@ void SwModelTestBase::executeLoadVerifyReloadVerify(const 
char* filename, const
 {
 maTempFile.EnableKillingFile(false);
 header();
-std::unique_ptr const pChanges(preTest(filename));
 loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword);
 verify();
 postLoad(filename);
@@ -91,7 +89,6 @@ void SwModelTestBase::executeLoadReloadVerify(const char* 
filename, const char*
 {
 maTempFile.EnableKillingFile(false);
 header();
-std::unique_ptr const pChanges(preTest(filename));
 loadURL(createFileURL(OUString::createFromAscii(filename)), pPassword);
 postLoad(filename);
 saveAndReload(mpFilter, pPassword);
@@ -104,7 +101,6 @@ void SwModelTestBase::executeImportExport(const char* 
filename, const char* pPas
 {
 maTempFile.EnableKillingFile(false);
 header();
-std::unique_ptr const pChanges(preTest(filename));
 loadAndSave(filename, pPassword);
 maTempFile.EnableKillingFile(false);
 verify();


[Libreoffice-commits] core.git: sw/qa

2023-12-05 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/rtfexport/rtfexport6.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d9291c24a21ef02240df7b0bd06f86cac1c6f659
Author: Andrea Gelmini 
AuthorDate: Tue Dec 5 13:07:57 2023 +0100
Commit: Julien Nabet 
CommitDate: Tue Dec 5 14:14:33 2023 +0100

Fix typo

Change-Id: Id5c6ac6c1358334dba4b96fcc6dee9e40859ec32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160341
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx 
b/sw/qa/extras/rtfexport/rtfexport6.cxx
index e65e57fd3192..275d2593d2df 100644
--- a/sw/qa/extras/rtfexport/rtfexport6.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport6.cxx
@@ -178,7 +178,7 @@ DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat, 
"tdf108505_fieldCharFormat
 
 DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat2, 
"tdf108505_fieldCharFormat2.rtf")
 {
-// not exported properly. Currrently xyz exports as run 6, red, italic.
+// not exported properly. Currently xyz exports as run 6, red, italic.
 if (isExported())
 return;
 


[Libreoffice-commits] core.git: sw/qa

2023-12-05 Thread Andrea Gelmini (via logerrit)
 sw/qa/core/layout/tabfrm.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 192c581395e2db07829ff9ba1ed79d5492dcbbce
Author: Andrea Gelmini 
AuthorDate: Tue Dec 5 13:08:37 2023 +0100
Commit: Julien Nabet 
CommitDate: Tue Dec 5 14:14:13 2023 +0100

Fix typo

Change-Id: I5f000f53f4dfec62a6d5a332361c380dc142d2bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160342
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index 091b78cd2478..9357fc2df133 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -187,7 +187,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrappedByTable)
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
 auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
 CPPUNIT_ASSERT(pFly);
-// Get the bottom of of the floating table, ignoring margins:
+// Get the bottom of the floating table, ignoring margins:
 SwTwips nFloatingBottom = pFly->getFrameArea().Top() + 
pFly->getFramePrintArea().Height();
 SwFrame* pBody = pPage->FindBodyCont();
 auto pTab = pBody->GetLower()->GetNext()->DynCastTabFrame();


[Libreoffice-commits] core.git: sw/qa sw/source

2023-12-05 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-wrapped-by-table.docx |binary
 sw/qa/core/layout/tabfrm.cxx|   30 
 sw/source/core/layout/tabfrm.cxx|   22 +++
 3 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit 868140fcc1311259b9d5f37b33d226511a53
Author: Miklos Vajna 
AuthorDate: Tue Dec 5 08:39:10 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 5 10:15:52 2023 +0100

tdf#60558 sw floattable: allow wrap of table on the right of a floattable

The bugdoc shows that Word wraps inline tables around floating tables if
they have enough space, but Writer didn't do this.

Table frames may wrap fly frames by adding some top, left or right
margin to the table at a layout level, this is calculated in
SwTabFrame::CalcFlyOffsets(). There we currently decide the give a top
margin to such tables, which fixes the overlap problem, but the bugdoc
is now of 2 pages instead of 1 page, since we don't wrap.

Fix the problem by improving the "shift down" case by checking if
shifting to the right would also work (has enough space). If so, do that
in case the fly frame is a split fly.

Note that this could be done for all flys as well, but that would have
to be conditional on some Word compat flag and that's not needed to fix
the bugdoc, so leave that for later.

Change-Id: Idb45413257758fd0334b17ef348ba28010a52316
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160331
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/floattable-wrapped-by-table.docx 
b/sw/qa/core/layout/data/floattable-wrapped-by-table.docx
new file mode 100644
index ..a53f652183ea
Binary files /dev/null and 
b/sw/qa/core/layout/data/floattable-wrapped-by-table.docx differ
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index e83767992aa6..091b78cd2478 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -169,6 +169,36 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTableJoin)
 CPPUNIT_ASSERT(pFly->GetPrecede());
 CPPUNIT_ASSERT(!pFly->HasFollow());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrappedByTable)
+{
+// Given a document with a floating table, wrapped by an inline table:
+// When laying out the document:
+createSwDoc("floattable-wrapped-by-table.docx");
+
+// Then make sure the inline table wraps around the floating table:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage);
+// Get the top of the inline table, ignoring margins:
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+// Get the bottom of of the floating table, ignoring margins:
+SwTwips nFloatingBottom = pFly->getFrameArea().Top() + 
pFly->getFramePrintArea().Height();
+SwFrame* pBody = pPage->FindBodyCont();
+auto pTab = pBody->GetLower()->GetNext()->DynCastTabFrame();
+SwTwips nInlineTop = pTab->getFrameArea().Top() + 
pTab->getFramePrintArea().Top();
+// Make sure the inline table is on the right of the floating one, not 
below it:
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected less than: 7287
+// - Actual  : 7287
+// i.e. the inline table was under the floating one, not on the right of 
it.
+CPPUNIT_ASSERT_LESS(nFloatingBottom, nInlineTop);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 4367d86255a2..c1acc0c9e9fe 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3179,6 +3179,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
 nSurround = text::WrapTextMode_PARALLEL;
 
 bool bShiftDown = css::text::WrapTextMode_NONE == nSurround;
+bool bSplitFly = pFly->IsFlySplitAllowed();
 if (!bShiftDown && bAddVerticalFlyOffsets)
 {
 if (nSurround == text::WrapTextMode_PARALLEL && 
isHoriOrientShiftDown)
@@ -3201,6 +3202,18 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper,
 // normally an SwFlyPortion is created instead that increases 
the height
 // of the first table row.
 bShiftDown = aTabRange.overlaps(aFlyRange);
+
+if (bSplitFly && pFly->GetAnchorFrame()->GetUpper() == 
GetUpper())
+{
+// Split fly followed by an inline table. Check if we have 
enough space to shift
+// to the right instead.
+SwTwips nShift

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-12-04 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/rtfexport6.cxx|2 ++
 writerfilter/source/rtftok/rtfdispatchflag.cxx   |9 +
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |4 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx   |1 -
 writerfilter/source/rtftok/rtfdocumentimpl.hxx   |3 ---
 5 files changed, 3 insertions(+), 16 deletions(-)

New commits:
commit b63a12d481cd26f960f97f74e5a4d764966db338
Author: Justin Luth 
AuthorDate: Fri Dec 1 14:30:45 2023 -0500
Commit: Miklos Vajna 
CommitDate: Tue Dec 5 08:49:33 2023 +0100

tdf#148540 Revert "tdf#109790 RTF import: keep remembering...

... paragraph style between \cell and \row"
This reverts 5.4.1 commit aaa6a5202a447fb4e86d5f016d8e79fbc34a3ed7,
and rtfexport7's tdf109790.rtf unit test still passes.
I also did a visual test, which looks good.

After \cell, we normally get more \cells, so an impending
\row is completely unexpected most of the time.
I'm not really sure why that patch was ever thought to be good.

The problem was that \pard was not removing the paragraph style
that was assigned to an earlier column. The end result seemed
innocent (no bad formatting noticed),
but that is probably based on other work
done in the meantime which allows the unit test to still pass
even after all of "its code" has been reverted.

[If this causes a regression, perhaps m_pLastCharacterContext
could be of value?]

Change-Id: Ide9b65f5e5fa39c21bac6d8ed354bb88e0bbefe5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160233
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/rtfexport/rtfexport6.cxx 
b/sw/qa/extras/rtfexport/rtfexport6.cxx
index f4ff562c37e8..e65e57fd3192 100644
--- a/sw/qa/extras/rtfexport/rtfexport6.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport6.cxx
@@ -172,6 +172,8 @@ DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat, 
"tdf108505_fieldCharFormat
 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty(xRun, 
"CharWeight"));
 CPPUNIT_ASSERT_EQUAL(awt::FontSlant_NONE, 
getProperty(xRun, "CharPosture"));
 CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, getProperty(xRun, 
"CharColor"));
+
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"), getProperty(xPara, 
"ParaStyleName"));
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf108505_fieldCharFormat2, 
"tdf108505_fieldCharFormat2.rtf")
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 23d8f5d1f59f..72c777aab1fb 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -579,8 +579,6 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
 dispatchSymbol(RTFKeyword::PAR);
 // \pard is allowed between \cell and \row, but in that case it 
should not reset the fact that we're inside a table.
 // It should not reset the paragraph style, either, so remember 
the old paragraph style.
-RTFValue::Pointer_t pOldStyle
-= 
m_aStates.top().getParagraphSprms().find(NS_ooxml::LN_CT_PPrBase_pStyle);
 m_aStates.top().getParagraphSprms() = 
m_aDefaultState.getParagraphSprms();
 m_aStates.top().getParagraphAttributes() = 
m_aDefaultState.getParagraphAttributes();
 
@@ -593,19 +591,14 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 {
 // We are still in a table.
 m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_inTbl, 
new RTFValue(1));
-if (m_bAfterCellBeforeRow && pOldStyle)
-// And we still have the same paragraph style.
-
m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_pStyle,
-pOldStyle);
 // Ideally getDefaultSPRM() would take care of this, but it 
would not when we're buffering.
 
m_aStates.top().getParagraphSprms().set(NS_ooxml::LN_CT_PPrBase_tabs,
 new RTFValue());
 }
 resetFrame();
 
-// Reset currently selected paragraph style as well, unless we are 
in the special "after \cell, before \row" state.
+// Reset currently selected paragraph style as well.
 // By default the style with index 0 is applied.
-if (!m_bAfterCellBeforeRow)
 {
 OUString const aName = getStyleName(0);
 // But only in case it's not a character style.
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx 
b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index d5b196790a50..61499aac04b5 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -180,9 +180,6 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
 c

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-12-04 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat2.rtf |   37 +
 sw/qa/extras/rtfexport/rtfexport6.cxx  |   21 +++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |   28 +++--
 3 files changed, 68 insertions(+), 18 deletions(-)

New commits:
commit caecfff1adbe9715260ef9e2009333e523d61123
Author: Justin Luth 
AuthorDate: Fri Dec 1 14:16:14 2023 -0500
Commit: Miklos Vajna 
CommitDate: Tue Dec 5 08:48:38 2023 +0100

tdf#108505 writerfilter: fix field direct char settings

Instead of adding characters properties one at a time,
lets take care of everything all at once.

The results seem to be good so far.
There is even some similarity between
how MS Word has these properties on the
"in-between" pseudo end character, where
placing the cursor after the field gets these properties.
I don't see it happening in MS Word
at the pseudo start character, but it does in LO now...

Hopefully that doesn't end up doing bad things.

In the unit test, replacing the content ends up
in red, italic. However, I see the same thing in MSO
when testing with my second FORMTEXT example,
so I think everything is "working as expected".

I tried to see if I could limit doing this
for only certain types of fields or conditions.
However, pContext->GetResult() doesn't have a \fldrslt
yet at the time this is happening. Also, TextField.is()
happens less than I expected. I'm sure I could limit it
to just certain pContext->GetFieldId(),
but so far no problems are noticed for all field types.

make CppunitTest_sw_rtfexport6 \
CPPUNIT_TEST_NAME=testTdf108505_fieldCharFormat

make CppunitTest_sw_rtfexport6 \
CPPUNIT_TEST_NAME=testTdf108505_fieldCharFormat2

Change-Id: I3223437fd0d694f5e5733a9f7323f10f03d7802f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160232
Tested-by: Jenkins
Tested-by: Gabor Kelemen 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat2.rtf 
b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat2.rtf
new file mode 100644
index ..bb45e3052011
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat2.rtf
@@ -0,0 +1,37 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057\themelang3079\themelangfe0\themelangcs0
+
+\noqfpromote {\stylesheet{\ql 
\li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 
+\af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \snext0 \sqformat 
\spriority0 Normal;}{\s17\ql \li0\ri0\widctlpar
+\tqc\tx4819\tqr\tx9071\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \sbasedon0 \snext17 
\slink18 header;}
+}
+\paperw16834\paperh11913\margl1134\margr1418\margt1418\margb567\gutter0\ltrsect
 
+\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1\noextrasprl\prcolbl\cvmme\sprsspbf\brkfrm\swpbdr\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\lytprtmet\hyphcaps0\formshade\horzdoc\fracwidth\dghspace180\dgvspace180\dghorigin1701\dgvorigin1984\dghshow0\dgvshow0
+\jexpand\viewkind1\viewscale70\pgbrdrhead\pgbrdrfoot\nolnhtadjtbl\nojkernpunct\rsidroot3825670
 \fet0
+
+\ltrrow\trowd \irow0\irowband0\lastrow \ltrrow
+\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth8931\trftsWidthB3\trftsWidthA3\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid16408416\tblind0\tblindtype3
 \clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl 
+\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil 
\cellx1206\clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl 
\clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth3969\clshdrawnil 
\cellx5175\clvertalt\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 
+\clbrdrb\brdrs\brdrw30 \clbrdrr\brdrs\brdrw30 
\cltxlrtb\clftsWidth3\clwWidth2126\clshdrawnil 
\cellx7301\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrs\brdrw30 \clbrdrb\brdrtbl 
\clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth1560\clshdrawnil \cellx8861
+\pard\plain \ltrpar\s17\ql 
\li72\ri0\sb120\sa120\widctlpar\intbl\tqr\tx1561\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin72\pararsid8918882
 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079
+
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f5\fnil\fprq2\fcharset128 Linux Biolinum Keyboard O;}}
+
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-12-04 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf |   34 ++
 sw/qa/extras/rtfexport/rtfexport6.cxx |   14 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 
 3 files changed, 58 insertions(+), 1 deletion(-)

New commits:
commit 59a0be15b097dc4f2529837d128f52cc3fb497d9
Author: Justin Luth 
AuthorDate: Fri Dec 1 10:34:36 2023 -0500
Commit: Miklos Vajna 
CommitDate: Tue Dec 5 08:30:29 2023 +0100

tdf#108505 writerfilter: fix legacy dropdown fields direct bold setting

Any character property should be passed on,
but do that in a follow-up commit, so that
at least the bold case will remain intact
if the broader fix gets reverted for any reason.

make CppunitTest_sw_rtfexport6 \
CPPUNIT_TEST_NAME=testTdf108505_fieldCharFormat

Change-Id: Id77980b704db2ff118e89c29eb9d4db82e117cdc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160221
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf 
b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf
new file mode 100644
index ..b05c2deec6b6
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf108505_fieldCharFormat.rtf
@@ -0,0 +1,34 @@
+{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057\themelang3079\themelangfe0\themelangcs0
+
+\noqfpromote {\stylesheet{\ql 
\li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 
+\af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \snext0 \sqformat 
\spriority0 Normal;}{\s17\ql \li0\ri0\widctlpar
+\tqc\tx4819\tqr\tx9071\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 \sbasedon0 \snext17 
\slink18 header;}
+}
+\paperw16834\paperh11913\margl1134\margr1418\margt1418\margb567\gutter0\ltrsect
 
+\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\trackmoves0\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0
+\showxmlerrors1\noextrasprl\prcolbl\cvmme\sprsspbf\brkfrm\swpbdr\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\lytprtmet\hyphcaps0\formshade\horzdoc\fracwidth\dghspace180\dgvspace180\dghorigin1701\dgvorigin1984\dghshow0\dgvshow0
+\jexpand\viewkind1\viewscale70\pgbrdrhead\pgbrdrfoot\nolnhtadjtbl\nojkernpunct\rsidroot3825670
 \fet0
+
+\ltrrow\trowd \irow0\irowband0\lastrow \ltrrow
+\ts11\trgaph70\trleft-70\trkeep\trftsWidth3\trwWidth8931\trftsWidthB3\trftsWidthA3\trpaddl70\trpaddr70\trpaddfl3\trpaddfr3\tblrsid16408416\tblind0\tblindtype3
 \clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl \clbrdrr\brdrtbl 
+\cltxlrtb\clftsWidth3\clwWidth1276\clshdrawnil 
\cellx1206\clvertalc\clbrdrt\brdrtbl \clbrdrl\brdrtbl \clbrdrb\brdrtbl 
\clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth3969\clshdrawnil 
\cellx5175\clvertalt\clbrdrt\brdrs\brdrw30 \clbrdrl\brdrs\brdrw30 
+\clbrdrb\brdrs\brdrw30 \clbrdrr\brdrs\brdrw30 
\cltxlrtb\clftsWidth3\clwWidth2126\clshdrawnil 
\cellx7301\clvertalt\clbrdrt\brdrtbl \clbrdrl\brdrs\brdrw30 \clbrdrb\brdrtbl 
\clbrdrr\brdrs\brdrw30 \cltxlrtb\clftsWidth3\clwWidth1560\clshdrawnil \cellx8861
+\pard\plain \ltrpar\s17\ql 
\li72\ri0\sb120\sa120\widctlpar\intbl\tqr\tx1561\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin72\pararsid8918882
 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079
+
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f5\fnil\fprq2\fcharset128 Linux Biolinum Keyboard O;}}
+
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+
+{\rtlch\fcs1 \af0 \ltrch\fcs0 \f5\fs32\chcbpat7\insrsid16408416 
Header}{\rtlch\fcs1 \af0 \ltrch\fcs0 \fs32\insrsid16408416\charrsid8918882 
\cell }\pard\plain \ltrpar\ql 
\li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid5246913
 
+\rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079 {\rtlch\fcs1 \af0 
\ltrch\fcs0 \insrsid16408416\charrsid8918882 Normal\cell }\pard \ltrpar
+\qc 
\li0\ri0\sb120\sa120\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0
 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid5701682\charrsid5701682 {\*\bkmkstart 
Dropdown1}x}{\field\fldpriv{\*\fldinst {\ltrch\fcs0 
+\b\fs48\cf4  FORMDROPDOWN }{{\*\datafield 0abcd}
+{\*\formfield{\fftype2\ffres25\fftypetxt0\ffh

[Libreoffice-commits] core.git: sw/qa sw/source

2023-12-04 Thread László Németh (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf158436.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |6 ++
 sw/source/core/text/guess.cxx|5 -
 3 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 7059a1858ddb044c5f3f0c8e0386d3e1d9dd2b5f
Author: László Németh 
AuthorDate: Mon Dec 4 15:33:14 2023 +0100
Commit: László Németh 
CommitDate: Mon Dec 4 21:41:04 2023 +0100

tdf#119908 tdf#158439 sw smart justify: fix freezing with NBSP

Stop shrinking during underflow, because it resulted
endless layout loop, e.g. when a very short word followed
by a no-break space.

Regression from commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: Id832b7fdbc01453a30067995e14e5430b0a15232
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160316
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf158436.docx 
b/sw/qa/extras/ooxmlexport/data/tdf158436.docx
new file mode 100644
index ..8cdcd21b4c1a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf158436.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index d9ef6b8a48d0..0656bb868795 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -1408,6 +1408,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf130088, "tdf130088.docx")
 CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf158436, "tdf158436.docx")
+{
+// This resulted freezing
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testHyphenationAuto)
 {
 loadAndReload("hyphenation.odt");
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 5e66b366c63f..37a2147d0987 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -82,7 +82,10 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
 
 // allow shrinking, i.e. more text in justified lines, depending on the 
justification algorithm
 if ( rAdjust == SvxAdjust::Block && 
rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(
-DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING))
+DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING) &&
+ // tdf#158436 avoid shrinking at underflow, e.g. no-break space
+ // after a very short word resulted endless loop
+ !rInf.IsUnderflow() )
 {
 // allow up to 2% shrinking of the line
 nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();


[Libreoffice-commits] core.git: sw/qa sw/UITest_writer_tests8.mk

2023-12-04 Thread Xisco Fauli (via logerrit)
 sw/UITest_writer_tests8.mk|2 
 sw/qa/uitest/writer_tests8/tdf156243.py   |   53 +-
 sw/qa/uitest/writer_tests8_data/registrymodifications.xcu |   12 ---
 3 files changed, 36 insertions(+), 31 deletions(-)

New commits:
commit 14fd379f54c0a325d33e1c33c699de4d0f3ffe7f
Author: Xisco Fauli 
AuthorDate: Mon Dec 4 11:52:23 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 4 15:03:03 2023 +0100

UITest_writer_tests8: do not use custom configuration

Added with b6e273aaaf597b60f78c1dd3db8676eea958a9f5
"tdf#156243 Fix off-by-one bug for autocorrect"

Change-Id: Ib9ce030cbc83514db174c39f5688d7382698d874
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160297
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/UITest_writer_tests8.mk b/sw/UITest_writer_tests8.mk
index a33fdedbe255..c951163c2128 100644
--- a/sw/UITest_writer_tests8.mk
+++ b/sw/UITest_writer_tests8.mk
@@ -15,6 +15,4 @@ $(eval $(call gb_UITest_set_defs,writer_tests8, \
 TDOC="$(SRCDIR)/sw/qa/uitest/data" \
 ))
 
-$(eval $(call 
gb_UITest_use_configuration,writer_tests8,$(SRCDIR)/sw/qa/uitest/writer_tests8_data/registrymodifications.xcu))
-
 # vim: set noet sw=4 ts=4:
diff --git a/sw/qa/uitest/writer_tests8/tdf156243.py 
b/sw/qa/uitest/writer_tests8/tdf156243.py
index fc4eecffdb7c..461c9b508b86 100644
--- a/sw/qa/uitest/writer_tests8/tdf156243.py
+++ b/sw/qa/uitest/writer_tests8/tdf156243.py
@@ -15,25 +15,44 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class tdf156243(UITestCase):
 
-   def test_tdf156243_Autocorrect_dialog(self):
+def change_autocorrect_option(self, enabled):
+with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "2")
+xList = xDialog.getChild('list')
+xCheckbox = xList.getChild("3")
+self.assertEqual("Automatic *bold*, /italic/, -strikeout- and 
_underline_", get_state_as_dict(xCheckbox)["Text"])
+
+xCheckbox.executeAction("CLICK", tuple())
+self.assertEqual(enabled, 
get_state_as_dict(xCheckbox)["IsChecked"])
+
+def test_tdf156243_Autocorrect_dialog(self):
 with self.ui_test.create_doc_in_start_center("writer") as document:
 xWriterDoc = self.xUITest.getTopFocusWindow()
 xWriterEdit = xWriterDoc.getChild("writer_edit")
-type_text(xWriterEdit, "*ab*")
-with 
self.ui_test.execute_dialog_through_command(".uno:AutoFormatRedlineApply", 
close_button="close") as xAutoFmt:
-xAcceptAll = xAutoFmt.getChild("acceptall")
-xAcceptAll.executeAction("CLICK", tuple())
-xWriterEdit.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"SHIFT+LEFT"}))
-with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog", 
close_button="cancel") as xDialog:
-xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "0")
-xweststylelbcjk = xDialog.getChild("cbWestStyle")
-self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], 
"Bold")
-self.xUITest.executeCommand(".uno:GoLeft")
-with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog", 
close_button="cancel") as xDialog:
-xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "0")
-xweststylelbcjk = xDialog.getChild("cbWestStyle")
-self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], 
"Bold")
+try:
+self.change_autocorrect_option("true")
+
+type_text(xWriterEdit, "*ab*")
+
+with 
self.ui_test.execute_dialog_through_command(".uno:AutoFormatRedlineApply", 
close_button="close") as xAutoFmt:
+xAcceptAll = xAutoFmt.getChild("acceptall")
+xAcceptAll.executeAction("CLICK", tuple())
+xWriterEdit.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"SHIFT+LEFT"}))
+with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog", 
close_button="cancel") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "0")
+xweststylelbcjk = xDialog.getChild("cbWestStyle")
+
self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")
+self.xUITest.executeCommand(".uno:GoLeft")
+with 
self.ui_test.execute_dialog_through_command(".uno:FontDialog", 
close_button="cancel") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "0")
+xweststylelbcjk = xDialog.getChild("cbWestStyle")
+
self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold")

[Libreoffice-commits] core.git: sw/qa

2023-12-04 Thread Xisco Fauli (via logerrit)
 sw/qa/uitest/writer_tests/tdf156165.py |   70 +++--
 1 file changed, 33 insertions(+), 37 deletions(-)

New commits:
commit c14dd7d8ddbdb348aaefce575976c1e52b9967f8
Author: Xisco Fauli 
AuthorDate: Mon Dec 4 12:03:56 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 4 13:06:16 2023 +0100

uitest: sw: refactor test to reset config change at the end

Change-Id: I6447f6e97da7fc5d8946c0658f4bc11fbbfbbba7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160299
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/uitest/writer_tests/tdf156165.py 
b/sw/qa/uitest/writer_tests/tdf156165.py
index de90eebdd54b..02353a533d47 100644
--- a/sw/qa/uitest/writer_tests/tdf156165.py
+++ b/sw/qa/uitest/writer_tests/tdf156165.py
@@ -15,22 +15,23 @@ from time import sleep
 
 class tdf156165(UITestCase):
 
-   def test_tdf156165(self):
+def change_autocorrect_option(self, enabled):
+with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "2")
+xList = xDialog.getChild('list')
+xCheckbox = xList.getChild("17")
+self.assertEqual("Replace Custom Styles", 
get_state_as_dict(xCheckbox)["Text"])
+
+xCheckbox.executeAction("CLICK", tuple())
+self.assertEqual(enabled, 
get_state_as_dict(xCheckbox)["IsChecked"])
+
+def test_tdf156165(self):
 with self.ui_test.load_file(get_url_for_data_file("tdf156165.odt")):
 xMainWindow = self.xUITest.getTopFocusWindow()
 writer_edit = xMainWindow.getChild("writer_edit")
 style=xMainWindow.getChild('applystyle')
 
-with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
-xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "2")
-options=xDialog.getChild('list')
-checkbox=options.getChild("17")
-self.assertEqual("Replace Custom Styles", 
get_state_as_dict(checkbox)["Text"])
-
-# Replace Custom Styles is default to be false
-self.assertEqual("false", 
get_state_as_dict(checkbox)["IsChecked"])
-
 # Replace Custom Styles when applying manually with it disabled, 
should not change style
 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"0", "START_POS": "12"}))
 self.xUITest.executeCommand(".uno:AutoFormatApply")
@@ -47,34 +48,29 @@ class tdf156165(UITestCase):
 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"0", "START_POS": "12"}))
 self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") # 
original line
 
-with 
self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog:
-xTabs = xDialog.getChild("tabcontrol")
-select_pos(xTabs, "2")
-options=xDialog.getChild('list')
-checkbox=options.getChild("17")
-self.assertEqual("Replace Custom Styles", 
get_state_as_dict(checkbox)["Text"])
-
-# set Replace Custom Styles to True
-checkbox.executeAction("CLICK", tuple())
-self.assertEqual("true", 
get_state_as_dict(checkbox)["IsChecked"])
+try:
+self.change_autocorrect_option("true")
 
-# Replace Custom Styles when applying manually with it enabled, 
should change style
-writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
-writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
-writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"0", "START_POS": "12"}))
-self.xUITest.executeCommand(".uno:AutoFormatApply")
-sleep(1)
-self.assertEqual(get_state_as_dict(style)["Text"], "Body Text")
+# Replace Custom Styles when applying manually with it 
enabled, should change style
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+writer_edit.executeAction("SELECT", 
mkPropertyValues({"END_POS": "0", "START_POS": "12"}))
+self.xUITest.executeCommand(".uno:AutoFormatApply")
+sleep(1)
+self.assertEqual(get_state_as_dict(style)["Text"], "Body Text")
 
-# Replace Custom Styles when typing with it enabled, should not 
change style
-writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
-writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": 
"12", "START_POS": "12"}))
-writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-sleep(1)
-  

[Libreoffice-commits] core.git: sw/qa

2023-12-02 Thread Julien Nabet (via logerrit)
 sw/qa/extras/layout/layout3.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 20661c37480c0cadc64d8e99da0463313e02d47c
Author: Julien Nabet 
AuthorDate: Sat Dec 2 16:43:32 2023 +0100
Commit: Julien Nabet 
CommitDate: Sat Dec 2 17:45:25 2023 +0100

Extended loplugin:ostr: sw/qa/extras/layout/layout3.cxx

Change-Id: I1b86da0ef1ccdd2ccb83f489563f634605c25b0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160245
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 27f9e0a2f59b..ea2c3a52d24e 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2086,7 +2086,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf152307)
 // XML dump and some basic assertions
 sal_Int32 nPage = 7, nPages = 0;
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-nPages = countXPathNodes(pXmlDoc, "/root/page");
+nPages = countXPathNodes(pXmlDoc, "/root/page"_ostr);
 CPPUNIT_ASSERT_MESSAGE("tdf152307.odt / testTdf152307: Not enough pages.", 
nPage < nPages);
 assertXPath(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/body/section", 1);
 
@@ -2103,11 +2103,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf152307)
 "/root/page[" + OString::number(nPage) + 
"]/body/section/tab["
 + OString::number(nTables) + "]/row["
 + OString::number(nRowsLastTable) + 
"]/infos/bounds",
-"bottom")
+"bottom"_ostr)
.toInt32();
 // Where does the footer start (footer/info/bounds/top)?
 sal_Int32 nFooterTop
-= getXPath(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/footer/infos/bounds", "top")
+= getXPath(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/footer/infos/bounds",
+   "top"_ostr)
   .toInt32();
 // Is the bottom value of the last row above the top value of the footer?
 OString aMsg = "tdf152307.odt / testTdf152307: Bottom value of last table 
row on page "


[Libreoffice-commits] core.git: sw/qa

2023-12-02 Thread EMartinGube (via logerrit)
 sw/qa/extras/layout/data/tdf152307.odt |binary
 sw/qa/extras/layout/layout3.cxx|   45 +
 2 files changed, 45 insertions(+)

New commits:
commit c05bed53174ebc6f4e82838db9c2a7fcb587d3bd
Author: EMartinGube 
AuthorDate: Fri Oct 13 09:43:49 2023 +0200
Commit: Xisco Fauli 
CommitDate: Sat Dec 2 12:38:53 2023 +0100

tdf#152307 sw: layout: invalidate more frames when footer grows

Unit test added.

Change-Id: Ibcdb504c57c020cde9b76994cb54e744d1a12888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157905
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/layout/data/tdf152307.odt 
b/sw/qa/extras/layout/data/tdf152307.odt
new file mode 100644
index ..766687d49234
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf152307.odt differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 5401cef9a380..27f9e0a2f59b 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -2071,6 +2071,51 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155611)
 // Also must not crash on close because of a frame that accidentally fell 
off of the layout
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf152307)
+{
+// Problem: On a given Writer document a table layout changed
+// after doing Tools -> Update -> Update All. The last table row on page 13
+// was bigger than the page size allowed and thus was hidden behind the 
footer.
+
+// load the document
+createSwDoc("tdf152307.odt");
+
+// do Tools -> Update -> Update All
+dispatchCommand(mxComponent, ".uno:UpdateAllIndexes", {});
+
+// XML dump and some basic assertions
+sal_Int32 nPage = 7, nPages = 0;
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+nPages = countXPathNodes(pXmlDoc, "/root/page");
+CPPUNIT_ASSERT_MESSAGE("tdf152307.odt / testTdf152307: Not enough pages.", 
nPage < nPages);
+assertXPath(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/body/section", 1);
+
+// Actual test procedure:
+// On page 7, check:
+// How much tables do we have? How much rows does the last table have?
+int nTables
+= countXPathNodes(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/body/section/tab");
+int nRowsLastTable
+= countXPathNodes(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/body/section/tab["
+   + OString::number(nTables) + "]/row");
+// What is the bottom value of the last table row?
+sal_Int32 nTabBottom = getXPath(pXmlDoc,
+"/root/page[" + OString::number(nPage) + 
"]/body/section/tab["
++ OString::number(nTables) + "]/row["
++ OString::number(nRowsLastTable) + 
"]/infos/bounds",
+"bottom")
+   .toInt32();
+// Where does the footer start (footer/info/bounds/top)?
+sal_Int32 nFooterTop
+= getXPath(pXmlDoc, "/root/page[" + OString::number(nPage) + 
"]/footer/infos/bounds", "top")
+  .toInt32();
+// Is the bottom value of the last row above the top value of the footer?
+OString aMsg = "tdf152307.odt / testTdf152307: Bottom value of last table 
row on page "
+   + OString::number(nPage) + " is below top value of footer: "
+   + OString::number(nTabBottom) + " > " + 
OString::number(nFooterTop);
+CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), nTabBottom < nFooterTop);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa xmloff/inc xmloff/source

2023-12-02 Thread Tomaž Vajngerl (via logerrit)
 sw/qa/extras/fodfexport/data/SvgImageTest.fodt |  321 +
 sw/qa/extras/fodfexport/fodfexport.cxx |   25 +
 xmloff/inc/xmlmultiimagehelper.hxx |1 
 xmloff/source/core/xmlmultiimagehelper.cxx |   28 +-
 xmloff/source/draw/ximpshap.cxx|   24 +
 xmloff/source/draw/ximpshap.hxx|3 
 xmloff/source/text/XMLTextFrameContext.cxx |   12 
 xmloff/source/text/XMLTextFrameContext.hxx |1 
 8 files changed, 400 insertions(+), 15 deletions(-)

New commits:
commit f5cf0c10eb7050feff19190b06b4597aab2d400a
Author: Tomaž Vajngerl 
AuthorDate: Sat Dec 2 16:57:30 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Dec 2 11:10:34 2023 +0100

tdf#123396 actually use the mimetype set in the from document

In the document we set the mime type for the images stored, but
at import we never actually used the mime types. We always did
mime type detection from the filename extension. The problem with
this is that files stored as base64 streams don't have a filename
so it is also not possible to determine the mime type from the
file name.

The consequence of this is that we can't know which image to take
if we have multiple images (fallback images) so we always take the
last one, which could be the wrong one. This happend in the test
document.

This changes the behavior so that we always first use the document
set mime type as there is no reason to not trust that. Only if the
mime type isn't provided by the document we use other mime type
detection methods.

Change-Id: I175c509ce5f11eab2c0454d4d9901ca1fe975272
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160237
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/qa/extras/fodfexport/data/SvgImageTest.fodt 
b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt
new file mode 100644
index ..4246a7cb5e5e
--- /dev/null
+++ b/sw/qa/extras/fodfexport/data/SvgImageTest.fodt
@@ -0,0 +1,321 @@
+
+
+http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:c
 alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:
 meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2023-12-01T21:40:25.0108966092023-12-02T14:20:24.763250978PT2M41S2LibreOffice/7.6.3.1$Linux_X86_64
 LibreOffice_project/60$Build-1
+ 
+  
+   0
+   0
+   58104
+   33657
+   true
+   false
+   
+
+ view2
+ 20551
+ 17866
+ 0
+ 0
+ 58103
+ 33655
+ 0
+ 1
+ false
+ 100
+ false
+ false
+ false
+ false
+ false
+ false
+
+   
+  
+  
+   true
+   false
+   true
+   false
+   true
+   false
+   false
+   0
+   true
+   false
+   true
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+   
+   false
+   false
+   true
+   false
+   false
+   true
+   true
+   false
+   false
+   false
+   false
+   false
+   false
+   true
+   false
+   false
+ 

[Libreoffice-commits] core.git: sw/qa

2023-12-01 Thread Andrea Gelmini (via logerrit)
 sw/qa/core/header_footer/HeaderFooterTest.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 67444341273377f25f688b3e67acd8b2a1346431
Author: Andrea Gelmini 
AuthorDate: Fri Dec 1 12:10:01 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Dec 1 17:05:29 2023 +0100

Fix typo

Change-Id: Iae999cd64ca73f178e4e1148af71b47fe03c8e2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160206
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index d67e874df0ec..6bb5fd616710 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -98,7 +98,7 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testNonFirstHeaderIsDisabled)
 
 // TODO
 
-// Header can only be enabled or disabled, but can't be disbaled just for 
first, left or right page.
+// Header can only be enabled or disabled, but can't be disabled just for 
first, left or right page.
 // If a header is enabled but empty, the header still takes space in LO, 
but not in MSO, where it acts the same as
 // if it is disabled.
 }


[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/qa writerfilter/source

2023-11-30 Thread Tomaž Vajngerl (via logerrit)
 sw/qa/core/header_footer/HeaderFooterTest.cxx  |   74 -
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |3 
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |   13 
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx  |4 
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx  |9 
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx  |4 
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx   |3 
 sw/qa/extras/rtfexport/rtfexport.cxx   |3 
 sw/qa/extras/rtfexport/rtfexport2.cxx  |6 
 sw/qa/extras/rtfexport/rtfexport3.cxx  |   35 
 sw/qa/extras/rtfexport/rtfexport5.cxx  |2 
 sw/qa/extras/rtfimport/rtfimport.cxx   |   18 
 sw/source/filter/ww8/rtfexport.cxx |9 
 writerfilter/qa/cppunittests/dmapper/DomainMapper_Impl.cxx |1 
 writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx   |3 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |  214 +++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx  |   60 -
 writerfilter/source/dmapper/PropertyIds.cxx|3 
 writerfilter/source/dmapper/PropertyIds.hxx|3 
 writerfilter/source/dmapper/PropertyMap.cxx|  663 ++---
 writerfilter/source/dmapper/PropertyMap.hxx|   83 +
 21 files changed, 711 insertions(+), 502 deletions(-)

New commits:
commit 4b0fa253a4540f5461397815d290586f9ddabe61
Author: Tomaž Vajngerl 
AuthorDate: Tue Nov 28 13:46:21 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 1 08:26:38 2023 +0100

tdf#136472 adjust ooxml import to handle first header/footer

Previously the ooxml import added a new page style when the first
header or footer was detected. Since then we gained support to add
first page header/footer in an existing page style so we don't need
to import it like that anymore.
This changes the import code so that the old complication to add
"First Page" page style is removed and it always just uses the
"Standard" page style for all 3 cases: first, left and right headers
and footers.

This also adjusts the existing tests to align with this change.

Change-Id: Ibf69597e6990499ac520ea9e323a5f73f429800b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157860
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index b411632884e1..d67e874df0ec 100644
--- a/sw/qa/core/header_footer/HeaderFooterTest.cxx
+++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx
@@ -96,8 +96,11 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testNonFirstHeaderIsDisabled)
 
 createSwDoc("tdf127778.docx");
 
-xmlDocUniquePtr pLayout = parseLayoutDump();
-assertXPath(pLayout, "//page[2]/header"_ostr, 0);
+// TODO
+
+// Header can only be enabled or disabled, but can't be disbaled just for 
first, left or right page.
+// If a header is enabled but empty, the header still takes space in LO, 
but not in MSO, where it acts the same as
+// if it is disabled.
 }
 
 // Check for correct header/footer with special first page with TOC inside
@@ -113,8 +116,10 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testHeaderFooterWithSpecialFirstPage_OOXM
 {
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
 // check first page
-assertXPath(pXmlDoc, "/root/page[1]/header"_ostr, 0);
-assertXPath(pXmlDoc, "/root/page[1]/footer"_ostr, 0);
+assertXPath(pXmlDoc, "/root/page[1]/header"_ostr);
+assertXPath(pXmlDoc, "/root/page[1]/footer"_ostr);
+assertXPath(pXmlDoc, "/root/page[1]/header/txt/text()"_ostr, 0);
+assertXPath(pXmlDoc, "/root/page[1]/footer/txt/text()"_ostr, 0);
 // check second page in the same way
 assertXPath(pXmlDoc, "/root/page[2]/header"_ostr);
 assertXPath(pXmlDoc, "/root/page[2]/footer"_ostr);
@@ -463,7 +468,9 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf112694)
 uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard");
 // Header was on when header for file was for explicit first pages only
 // (marked via ).
-CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
+//CPPUNIT_ASSERT(!getProperty(aPageStyle, "HeaderIsOn"));
+// TODO - can't disable headers/footers selectively (only fo first 
page)
+CPPUNIT_ASSERT(getProperty(aPageStyle, "HeaderIsOn"));
 };
 
 createSwDoc("tdf112694.docx");
@@ -664,7 +671,10 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, 
testFirstPageFooterEnabled)
 // Footer shouldn't be enabled on first page, but then on the other pages
 auto verify = [this]() {
 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-assertXPath(pXmlDoc, "/root/page[1]/footer/txt"_ostr, 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-30 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/uiwriter/data/tdf158459_tracked_changes_across_nodes.fodt |   45 
++
 sw/qa/extras/uiwriter/uiwriter8.cxx|   27 
++
 sw/source/core/doc/DocumentContentOperationsManager.cxx|9 
+-
 3 files changed, 79 insertions(+), 2 deletions(-)

New commits:
commit 9c22a72a2fc92146d24c6b673d9c07b1e6ff83f2
Author: Mike Kaganski 
AuthorDate: Thu Nov 30 17:53:26 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Nov 30 17:35:50 2023 +0100

tdf#158459: call DeleteAndJoin in strict reverse order

The crash was caused by removal of a paragraph break (pointed to by a
PaM returned by pDelPam->GetNext()), that resulted in merge of the node
pDelPam pointed to, with the previous node. The destructin of the node
made pDelPam dangle. In debug builds, an assertion failed in destructor
of SwContentIndexReg. I.e., since the code always called DeleteAndJoin
on pDelPam->GetNext(), the processing went from second-to-last deletion
towards the begin of the document, and the last deletion (represented
by pDelPam) was handled last, when GetNext call wrapped.

This change makes sure that the order is strict, from last to first.

Change-Id: I5cb7fe2f06d4138d3c445eeca8220f0a87a82626
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160158
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git 
a/sw/qa/extras/uiwriter/data/tdf158459_tracked_changes_across_nodes.fodt 
b/sw/qa/extras/uiwriter/data/tdf158459_tracked_changes_across_nodes.fodt
new file mode 100644
index ..bdd03bc0be70
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf158459_tracked_changes_across_nodes.fodt
@@ -0,0 +1,45 @@
+
+
+http://purl.org/dc/elements/1.1/"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+
+ 
+  
+   x
+   2000-01-01
+  
+ 
+
+
+ 
+  
+   x
+   2000-01-02
+  
+ 
+
+
+ 
+  
+   x
+   2000-01-03
+  
+ 
+
+
+ 
+  
+   x
+   2000-01-04
+  
+ 
+
+   
+   
+   a
+   bcdef
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 0fbb8e9fae81..641797b2c7b0 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -2817,6 +2817,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf156560)
 dispatchCommand(mxComponent, ".uno:InsertHeader", {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf158459)
+{
+createSwDoc("tdf158459_tracked_changes_across_nodes.fodt");
+SwDoc* pDoc = getSwDoc();
+
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+pWrtShell->FwdPara(); // Skip first paragraph
+pWrtShell->EndOfSection(true); // Select everything to the end
+
+SwDoc aClipboard;
+pWrtShell->Copy(aClipboard); // This must not crash
+
+pWrtShell->SelAll();
+pWrtShell->Delete();
+pWrtShell->Paste(aClipboard); // Replace everything with the copied stuff
+
+SwNodes& rNodes = pDoc->GetNodes();
+SwNodeIndex aIdx(rNodes.GetEndOfExtras());
+SwContentNode* pContentNode = rNodes.GoNext(&aIdx);
+CPPUNIT_ASSERT(pContentNode);
+SwTextNode* pTextNode = pContentNode->GetTextNode();
+CPPUNIT_ASSERT(pTextNode);
+// Check that deleted parts (paragraph break, "c", "e") haven't been pasted
+CPPUNIT_ASSERT_EQUAL(OUString("abdf"), pTextNode->GetText());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d7d15d279776..09e0a1233e5d 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -440,11 +440,16 @@ namespace
 
 ::sw::UndoGuard const undoGuard(rDestDoc.GetIDocumentUndoRedo());
 
+// At this point, pDelPam points to the last of maybe several disjoint 
selections, organized
+// in reverse order in document (so every GetNext() returns a PaM 
closer to document start,
+// until wrap to pDelPam). Removal of the selections must be from last 
in document to first,
+// to avoid situations when another PaM in chain points into the node 
that will be destroyed
+// (joined to previous) by removal of the currently processed PaM.
 do {
-rDestDoc.getIDocumentContentOperations().DeleteAndJoin( 
*pDelPam->GetNext() );
+rDestDoc.getIDocumentContentOperations().DeleteAndJoin(*pDelPam);
 if( !pDelPam->IsMultiSelection() )
 break;
-delete pDelPam->GetNext();
+pDelPam.reset(pDelPam->GetNext());
 } while( true );

[Libreoffice-commits] core.git: sw/qa

2023-11-29 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 93ab1bc6be7b46226874810ec4fc3c61d5d0fc7c
Author: László Németh 
AuthorDate: Wed Nov 29 20:56:38 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 30 08:35:03 2023 +0100

tdf#158419 sw: revert lost unit test testOfz64109

which was removed accidentally by commit 
20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
"tdf#119908 tdf#158419 sw smart justify: fix cursor position".

Change-Id: Ia96d9d8d8980dbf05aaa58d454e2d9b568555d81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160129
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 843712e62221..f919a6452912 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -864,6 +864,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testAbi11870)
 createSwDoc("abi11870-2.odt");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testOfz64109)
+{
+//just care it doesn't assert
+createSwDoc("ofz64109-1.fodt");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719)
 {
 // Insert a page break.


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-29 Thread Stephan Bergmann (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |2 
 sw/source/core/doc/docredln.cxx|8 -
 sw/source/core/text/txtfrm.cxx |6 -
 sw/source/filter/html/css1atr.cxx  |6 -
 sw/source/filter/html/htmlatr.cxx  |   28 +++---
 sw/source/filter/html/htmlflywriter.cxx|   12 +-
 sw/source/filter/html/htmlforw.cxx |   18 ++--
 sw/source/filter/html/htmlnumwriter.cxx|4 
 sw/source/filter/html/htmlreqifreader.cxx  |4 
 sw/source/filter/html/wrthtml.cxx  |4 
 sw/source/filter/ww8/docxattributeoutput.cxx   |  106 -
 sw/source/filter/ww8/rtfattributeoutput.cxx|8 -
 sw/source/filter/ww8/wrtw8sty.cxx  |2 
 13 files changed, 104 insertions(+), 104 deletions(-)

New commits:
commit 2c1e01b22514ec86ec120cb1ea3dd458a544fbdb
Author: Stephan Bergmann 
AuthorDate: Wed Nov 29 14:38:32 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 29 19:13:13 2023 +0100

Extended loplugin:ostr: sw

Change-Id: Ie3ceb8d4b939a652d09cc9cf02b78e65093c8fcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160099
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 271e30e47a93..36431f83856f 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -3309,7 +3309,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testDropDownFormFieldButtonEditing)
 OString sSelected( 
aTree.get_child("params").get_child("selected").get_value() );
 CPPUNIT_ASSERT_EQUAL("1"_ostr, sSelected);
 }
-m_aFormFieldButton = "";
+m_aFormFieldButton = ""_ostr;
 
 // Trigger a form field event to select a different item.
 vcl::ITiledRenderable::StringMap aArguments;
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 8ef699787b3f..3b0f8d7b9f53 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1352,16 +1352,16 @@ void SwRedlineData::dumpAsXml(xmlTextWriterPtr pWriter) 
const
 switch (GetType())
 {
 case RedlineType::Insert:
-sRedlineType = "REDLINE_INSERT";
+sRedlineType = "REDLINE_INSERT"_ostr;
 break;
 case RedlineType::Delete:
-sRedlineType = "REDLINE_DELETE";
+sRedlineType = "REDLINE_DELETE"_ostr;
 break;
 case RedlineType::Format:
-sRedlineType = "REDLINE_FORMAT";
+sRedlineType = "REDLINE_FORMAT"_ostr;
 break;
 default:
-sRedlineType = "UNKNOWN";
+sRedlineType = "UNKNOWN"_ostr;
 break;
 }
 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(sRedlineType.getStr()));
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 88f79aff22e5..18eb78db8348 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -803,15 +803,15 @@ void SwTextFrame::dumpAsXmlAttributes(xmlTextWriterPtr 
writer) const
 OString aMode = "Horizontal"_ostr;
 if (IsVertLRBT())
 {
-aMode = "VertBTLR";
+aMode = "VertBTLR"_ostr;
 }
 else if (IsVertLR())
 {
-aMode = "VertLR";
+aMode = "VertLR"_ostr;
 }
 else if (IsVertical())
 {
-aMode = "Vertical";
+aMode = "Vertical"_ostr;
 }
 (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), 
BAD_CAST(aMode.getStr()));
 }
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index deaaa5ea8a66..30ba8d3c0a75 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -777,16 +777,16 @@ sal_uInt16 SwHTMLWriter::GetCSS1Selector( const SwFormat 
*pFormat, OString& rTok
 if( pPseudo )
 {
 rToken = OOO_STRING_SVTOOLS_HTML_tabledata " "
- OOO_STRING_SVTOOLS_HTML_parabreak;
+ OOO_STRING_SVTOOLS_HTML_parabreak ""_ostr;
 }
 else
-rToken = OOO_STRING_SVTOOLS_HTML_parabreak;
+rToken = OOO_STRING_SVTOOLS_HTML_parabreak ""_ostr;
 break;
 case RES_POOLCOLL_TABLE_HDLN:
 if( pPseudo )
 {
 rToken = OOO_STRING_SVTOOLS_HTML_tableheader " "
- OOO_STRING_SVTOOLS_HTML_parabreak;
+ OOO_STRING_SVTOOLS_HTML_parabreak ""_ostr;
 }
 else
 rToken = OOO_STRING_SVTOOLS_HTML_parabreak ""_ostr;
diff --git a/sw/source/filter/html/htmlatr.cxx 
b/sw/source/filter/html/htmlatr.cxx
index b4ed5c567cff..9f67d1ee0304 100644
--- a/sw/source/filter/html

[Libreoffice-commits] core.git: sw/qa

2023-11-29 Thread Andrea Gelmini (via logerrit)
 sw/qa/core/layout/fly.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8bf1fbd2023945cfe7e86b85470669fd378fd4a3
Author: Andrea Gelmini 
AuthorDate: Wed Nov 29 14:28:10 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 29 14:54:52 2023 +0100

Fix typo

Change-Id: I1ca85b9f1424df5432c76d08280b9dba3e01d2dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160090
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/core/layout/fly.cxx b/sw/qa/core/layout/fly.cxx
index c1d54119a773..47cfb40fa6e7 100644
--- a/sw/qa/core/layout/fly.cxx
+++ b/sw/qa/core/layout/fly.cxx
@@ -59,7 +59,7 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNegativeHeight)
 }
 else if (pPage->GetPrev() && pPage->GetNext() && 
pPage->GetNext()->GetNext())
 {
-// Middle pages: have a prevous and a next fly:
+// Middle pages: have a previous and a next fly:
 CPPUNIT_ASSERT(pPage->GetSortedObjs());
 SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-29 Thread László Németh (via logerrit)
 sw/qa/core/text/text.cxx   |   12 ++--
 sw/source/core/text/porexp.cxx |5 +
 2 files changed, 7 insertions(+), 10 deletions(-)

New commits:
commit 78872cc81bf4b1377c9cae8f9040a2443d0690c0
Author: László Németh 
AuthorDate: Tue Nov 28 19:39:16 2023 +0100
Commit: László Németh 
CommitDate: Wed Nov 29 10:16:28 2023 +0100

tdf#157768 sw: fix lost character background of NBSP

Regression from commit 28675af84ae8e2342bd78be3696dc09de6ce5cc5
"tdf#41652: Variable width NBSP".

Change-Id: I066ecadac8961b182f8580147b197f13dd0daae4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160054
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 8951b9fb6a82..7340a151d1f4 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1263,9 +1263,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_legacy_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_legacy_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Measure the X of sections after NBSPs in a file with the option enabled
@@ -1278,9 +1278,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_optionDisabled_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_optionDisabled_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Measure the X of the sections after NBSPs in a file with the option 
enabled
@@ -1293,9 +1293,9 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testTdf41652NBSPWidth)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
 
 nSectionAfterNBSPX_optionEnabled_leftAligned
-= getXPath(pXmlDoc, "//textarray[3]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[4]"_ostr, "x"_ostr).toInt32();
 nSectionAfterNBSPX_optionEnabled_justified
-= getXPath(pXmlDoc, "//textarray[8]"_ostr, "x"_ostr).toInt32();
+= getXPath(pXmlDoc, "//textarray[10]"_ostr, "x"_ostr).toInt32();
 }
 
 // Assert left aligned NBSP for the legacy file is larger than zero
diff --git a/sw/source/core/text/porexp.cxx b/sw/source/core/text/porexp.cxx
index 56e3d7c34265..0884db6fce76 100644
--- a/sw/source/core/text/porexp.cxx
+++ b/sw/source/core/text/porexp.cxx
@@ -211,6 +211,7 @@ void SwBlankPortion::Paint( const SwTextPaintInfo &rInf ) 
const
 // Draw field shade (can be disabled individually)
 if (!m_bMulti) // No gray background for multiportion brackets
 rInf.DrawViewOpt(*this, PortionType::Blank);
+SwExpandPortion::Paint(rInf);
 
 if (m_cChar == CHAR_HARDBLANK)
 {
@@ -242,10 +243,6 @@ void SwBlankPortion::Paint( const SwTextPaintInfo &rInf ) 
const
 aInf.GetFont()->SetColor(colorBackup);
 }
 }
-else
-{
-SwExpandPortion::Paint(rInf);
-}
 }
 
 bool SwBlankPortion::GetExpText( const SwTextSizeInfo& rInf, OUString &rText ) 
const


[Libreoffice-commits] core.git: sw/qa

2023-11-28 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |   32 +++--
 1 file changed, 13 insertions(+), 19 deletions(-)

New commits:
commit 7f85266b390aaf784af6a8d4afa139cd1b6988e4
Author: Miklos Vajna 
AuthorDate: Tue Nov 28 20:11:54 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 29 08:18:29 2023 +0100

CppunitTest_sw_ooxmlexport16: rework to avoid preTest()

This keeps all code of a test in a single place, if we don't trigger the
preTest() magic.

Change-Id: Ib97bf07cde6e235d9f9705cbff2f163fbc6d72b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160055
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index f7e62615e8a8..dd1b87f147aa 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -30,29 +30,12 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
 public:
 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open 
XML Text") {}
-
-virtual std::unique_ptr preTest(const char* filename) override
-{
-if (filename == std::string_view("tdf135774_numberingShading.docx"))
-{
-bool bIsExportAsShading = 
SvtFilterOptions::Get().IsCharBackground2Shading();
-// This function is run at the end of the test - returning the 
filter options to normal.
-std::unique_ptr pResetter(new Resetter(
-[bIsExportAsShading] () {
-if (bIsExportAsShading)
-SvtFilterOptions::Get().SetCharBackground2Shading();
-}));
-// For these tests, ensure exporting CharBackground as w:highlight.
-SvtFilterOptions::Get().SetCharBackground2Highlighting();
-return pResetter;
-}
-return nullptr;
-}
 };
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf143860NonPrimitiveCustomShape)
@@ -542,8 +525,19 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134951_duplicates)
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf135773_numberingShading)
 {
+bool bIsExportAsShading = 
SvtFilterOptions::Get().IsCharBackground2Shading();
+// This function is run at the end of the test - returning the filter 
options to normal.
+comphelper::ScopeGuard g(
+[bIsExportAsShading]
+{
+if (bIsExportAsShading)
+SvtFilterOptions::Get().SetCharBackground2Shading();
+});
+// For these test, ensure exporting CharBackground as w:highlight.
+SvtFilterOptions::Get().SetCharBackground2Highlighting();
+
 loadAndSave("tdf135774_numberingShading.docx");
-// This test uses preTest to export CharBackground as Highlight instead of 
the 7.0 default of Shading.
+// This test uses a custom setting to export CharBackground as Highlight 
instead of the 7.0 default of Shading.
 
 // Before the fix, the imported shading was converted into a red highlight.
 xmlDocUniquePtr pXmlStyles = parseExport("word/numbering.xml");


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-28 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/image_anchored_to_paragraph_no_wrap.fodt |   20 +
 sw/qa/extras/htmlexport/htmlexport.cxx|   16 +
 sw/source/filter/html/htmlflywriter.cxx   |  112 
+-
 3 files changed, 95 insertions(+), 53 deletions(-)

New commits:
commit 1f2d30093c12de22a04bc16969e027446ded5205
Author: Mike Kaganski 
AuthorDate: Mon Nov 27 16:01:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Nov 29 06:46:33 2023 +0100

Don't emit 'br clear=...' for graphics wrap in ReqIF export

Change-Id: I7684c78c9b98fe63c2281bf3b2a2186d125e0ba4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159994
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git 
a/sw/qa/extras/htmlexport/data/image_anchored_to_paragraph_no_wrap.fodt 
b/sw/qa/extras/htmlexport/data/image_anchored_to_paragraph_no_wrap.fodt
new file mode 100644
index ..f1080724307e
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/image_anchored_to_paragraph_no_wrap.fodt
@@ -0,0 +1,20 @@
+
+
+
+ 
+  
+   
+  
+ 
+ 
+  
+   
+  
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0
+   cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDIw
+   IDIwIiBzdHJva2U9ImJsYWNrIj4KPHBhdGggZD0iTTEsMUwxOSwxOSIvPgo8L3N2Zz4=
+  
+ 
+
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 161357ffbdba..96bdfab66b60 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -3016,6 +3016,22 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_ExportFormulasAsPDF)
  xTypeDetection->queryTypeByDescriptor(descr, true));
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_NoBrClearForImageWrap)
+{
+// Given a document with a paragraph-anchored image with "none" wrap:
+createSwDoc("image_anchored_to_paragraph_no_wrap.fodt");
+// When exporting to reqif:
+ExportToReqif();
+// Make sure that there's no 'br' elements in the 'object' (used to 
represent the wrapping
+// in HTML export, using 'clear' attribute):
+xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+assertXPath(pXmlDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object"_ostr);
+assertXPath(
+pXmlDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object/reqif-xhtml:br"_ostr,
+0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmlflywriter.cxx 
b/sw/source/filter/html/htmlflywriter.cxx
index 9976124b3adc..a0627effdc2b 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -704,68 +704,71 @@ OString SwHTMLWriter::OutFrameFormatOptions( const 
SwFrameFormat &rFrameFormat,
 sOut.setLength(0);
 }
 
-// Insert wrap for graphics that are anchored to a paragraph as
-//  in the string
-const SwFormatSurround* pSurround;
-if( (nFrameOpts & HtmlFrmOpts::BrClear) &&
-((RndStdIds::FLY_AT_PARA == rFrameFormat.GetAnchor().GetAnchorId()) ||
- (RndStdIds::FLY_AT_CHAR == rFrameFormat.GetAnchor().GetAnchorId())) &&
-(pSurround = rItemSet.GetItemIfSet( RES_SURROUND )) )
-{
-sal_Int16 eHoriOri =rFrameFormat.GetHoriOrient().GetHoriOrient();
-pStr = nullptr;
-css::text::WrapTextMode eSurround = pSurround->GetSurround();
-bool bAnchorOnly = pSurround->IsAnchorOnly();
-switch( eHoriOri )
+if (!mbReqIF)
+{
+// Insert wrap for graphics that are anchored to a paragraph as
+//  in the string
+const SwFormatSurround* pSurround;
+if( (nFrameOpts & HtmlFrmOpts::BrClear) &&
+((RndStdIds::FLY_AT_PARA == 
rFrameFormat.GetAnchor().GetAnchorId()) ||
+ (RndStdIds::FLY_AT_CHAR == 
rFrameFormat.GetAnchor().GetAnchorId())) &&
+(pSurround = rItemSet.GetItemIfSet( RES_SURROUND )) )
 {
-case text::HoriOrientation::RIGHT:
+sal_Int16 eHoriOri =
rFrameFormat.GetHoriOrient().GetHoriOrient();
+pStr = nullptr;
+css::text::WrapTextMode eSurround = pSurround->GetSurround();
+bool bAnchorOnly = pSurround->IsAnchorOnly();
+switch( eHoriOri )
 {
-switch( eSurround )
+case text::HoriOrientation::RIGHT:
 {
-case css::text::WrapTextMode_NONE:
-case css::text::WrapTextMode_RIGHT:
-pStr = OOO_STRING_SVTOOLS_HTML_AL_right;
-break;
-case css::text::WrapTextMode_LEFT:
-case css::text::WrapTextMode_PARALLEL:
-if( bAnchorOnly )
-m_bClearRight = true;
-break;
-

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-28 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |   48 +++-
 sw/source/core/text/itrcrsr.cxx |4 +--
 sw/source/core/text/porlay.hxx  |7 -
 3 files changed, 45 insertions(+), 14 deletions(-)

New commits:
commit 20cbe88ce5610fd8ee302e5780a4c0821ddb3db4
Author: László Németh 
AuthorDate: Tue Nov 28 15:09:52 2023 +0100
Commit: László Németh 
CommitDate: Wed Nov 29 00:16:08 2023 +0100

tdf#119908 tdf#158419 sw smart justify: fix cursor position

Text cursor didn't follow the new word positions yet, because
of unsigned casting of the negative shrinking value.

Revert the temporary change of GetLLSpaceAdd() added by
commit 17eaebee279772b6062ae3448012133897fc71bb
"tdf#119908 sw smart justify: fix justification by shrinking".

Follow-up to commit 53de98b29548ded88e0a44c80256fc5e340d551e
"tdf#158333 sw smart justify: fix multiple text portions".

Change-Id: I82cb395fc5af800d8da67d27c16c5ed6837df695
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160050
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index dc70bf41b6f8..843712e62221 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -237,6 +237,48 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
 "consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158419)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwDocShell* pShell = pDoc->GetDocShell();
+
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// second paragraph.
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+SwWrtShell* pWrtShell = pShell->GetWrtShell();
+SwPosition aPosition(*pWrtShell->GetCursor()->Start());
+SwTwips nSecondParaLeft
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"left"_ostr).toInt32();
+SwTwips nSecondParaWidth
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"width"_ostr).toInt32();
+SwTwips nSecondParaTop
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+SwTwips nSecondParaHeight
+= getXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds"_ostr, 
"height"_ostr).toInt32();
+Point aPoint;
+
+// click at the end of the second line of the second paragraph
+// (a line shrunk by the new justification)
+
+aPoint.setX(nSecondParaLeft + nSecondParaWidth);
+aPoint.setY(nSecondParaTop + (nSecondParaHeight / 6) * 1.5);
+SwCursorMoveState aState(CursorMoveState::NONE);
+pLayout->GetModelPositionForViewPoint(&aPosition, aPoint, &aState);
+// Without the accompanying fix in place, this test would have failed: 
character position was 155,
+// i.e. cursor was before the end of the paragraph.
+CPPUNIT_ASSERT_EQUAL(static_cast(156), 
aPosition.GetContentIndex());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");
@@ -822,12 +864,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testAbi11870)
 createSwDoc("abi11870-2.odt");
 }
 
-CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testOfz64109)
-{
-//just care it doesn't assert
-createSwDoc("ofz64109-1.fodt");
-}
-
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719)
 {
 // Insert a page break.
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 7a7024d97a09..1770361c19de 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1371,7 +1371,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + sal_Int16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
 }
 if( ( pPor->InFixMargGrp() && ! pPor->IsMarginPortion() ) ||
 ( pPor->IsMultiPortion() && 
static_cast(pPor)->HasTabulator() )
@@ -1415,7 +1415,7 @@ TextFrameIndex 
SwTextCursor::GetModelPositionForViewPoint( SwPosition *pPos, con
 if ( pPor->InSpaceGrp() && nSpaceAdd )
 {
 const_cast(GetInfo()).SetIdx( nCurrStart );
-nWidth = nWidth + sal_uInt16( pPor->CalcSpacing( nSpaceAdd, 
GetInfo() ) );
+nWidth = nWidth + sal_Int16( pPor->CalcSpacing

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-27 Thread Jim Raykowski (via logerrit)
 sw/qa/uitest/navigator/tdf40427.py |   22 +++-
 sw/source/uibase/inc/content.hxx   |4 
 sw/source/uibase/inc/conttree.hxx  |1 
 sw/source/uibase/utlui/content.cxx |  188 ++---
 4 files changed, 174 insertions(+), 41 deletions(-)

New commits:
commit 468c5110226c7f5b3079852a27adde45dc32dc76
Author: Jim Raykowski 
AuthorDate: Wed Nov 22 00:00:57 2023 -0900
Commit: Jim Raykowski 
CommitDate: Mon Nov 27 18:56:38 2023 +0100

tdf#158103 Enhancement to display Sections as an expandable/

collapsible hierarchy in the Writer Navigator

Change-Id: I86bc17d11b4c5bf0ca0496e4ab62a0d77ddb625f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159812
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Reviewed-by: Jim Raykowski 

diff --git a/sw/qa/uitest/navigator/tdf40427.py 
b/sw/qa/uitest/navigator/tdf40427.py
index f394bf37aa06..aaab63ffdd4d 100644
--- a/sw/qa/uitest/navigator/tdf40427.py
+++ b/sw/qa/uitest/navigator/tdf40427.py
@@ -19,6 +19,20 @@ class tdf40427(UITestCase):
 if name == get_state_as_dict(xItem)['Text']:
 return xItem
 
+  def expand_all(self, xTreeItem):
+count = len(xTreeItem.getChildren())
+for i in xTreeItem.getChildren():
+xTreeItem.getChild(i).executeAction("EXPAND", ())
+count += self.expand_all(xTreeItem.getChild(i))
+return count
+
+  def get_names(self, xTreeItem):
+names = []
+for i in xTreeItem.getChildren():
+names.append(get_state_as_dict(xTreeItem.getChild(str(i)))['Text'])
+names += self.get_names(xTreeItem.getChild(i))
+return names
+
   def test_tdf40427(self):
 with 
self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")) 
as document:
 xMainWindow = self.xUITest.getTopFocusWindow()
@@ -53,6 +67,7 @@ class tdf40427(UITestCase):
 xSections = self.get_item(xContentTree, 'Sections')
 self.assertEqual('Sections', get_state_as_dict(xSections)['Text'])
 xSections.executeAction("EXPAND", ())
+totalSectionsCount = self.expand_all(xSections)
 
 refSectionNames = [
   'SectionZ',
@@ -69,11 +84,10 @@ class tdf40427(UITestCase):
   'SectionB', # High on screen, but late in list because it's on 
second page
   'SectionC',
 ]
-self.assertEqual(len(refSectionNames), len(xSections.getChildren()))
+self.assertEqual(len(refSectionNames), totalSectionsCount)
+
+actSectionNames = self.get_names(xSections)
 
-actSectionNames = []
-for i in range(len(refSectionNames)):
-  
actSectionNames.append(get_state_as_dict(xSections.getChild(str(i)))['Text'])
 # Without the fix in place, this would fail with
 #   AssertionError: Lists differ: ['SectionZ', 'SectionY', 
'SectionT3', 'SectionT1', 'SectionT2'[100 chars]onC'] != ['SectionZ', 
'SectionB', 'SectionF3', 'SectionFinF3', 'Section[100 chars]onA']
 self.assertEqual(refSectionNames, actSectionNames)
diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx
index c2a922189894..77cb156b744c 100644
--- a/sw/source/uibase/inc/content.hxx
+++ b/sw/source/uibase/inc/content.hxx
@@ -212,8 +212,8 @@ public:
 Invalidate();
 }
 
-bool GetSortType() const {return m_bAlphabeticSort;}
-void SetSortType(bool bAlphabetic) {m_bAlphabeticSort = bAlphabetic;}
+bool IsAlphabeticSort() const {return m_bAlphabeticSort;}
+void SetAlphabeticSort(bool bAlphabetic) {m_bAlphabeticSort = 
bAlphabetic;}
 
 voidInvalidate(); // only nMemberCount is read again
 
diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index 9c6db5b5a5eb..a8094c40303a 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -107,6 +107,7 @@ class SwContentTree final : public SfxListener
 SwNavigationConfig* m_pConfig;
 
 std::map< void*, bool > mOutLineNodeMap;
+std::map m_aRegionNodeExpandMap; // stores expand state 
of nodes with children
 
 sal_Int32   m_nActiveBlock; // used to restore content 
types/categories expand state
 sal_Int32   m_nHiddenBlock;
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 770f8b41e705..07fd64dc3bf9 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -217,6 +217,11 @@ namespace
 rPos = *pPos;
 }
 }
+
+bool lcl_IsLowerRegionContent(const weld::TreeIter& rEntry, const 
weld::TreeView& rTreeView, sal_uInt8 nLevel)
+{
+return weld::fromId(rTreeView.get_id(rEntry))->GetRegionLevel() < nLevel;
+}
 }
 
 // Content, contains names and reference at the content type.
@@ -1727,7 +1732,7 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, 
rCEvt, bool)
 && nContentType != Cont

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-27 Thread László Németh (via logerrit)
 sw/qa/extras/layout/layout3.cxx |   36 
 sw/source/core/text/guess.cxx   |2 +-
 sw/source/core/text/porlin.cxx  |4 ++--
 sw/source/core/text/portxt.cxx  |3 ++-
 4 files changed, 41 insertions(+), 4 deletions(-)

New commits:
commit 53de98b29548ded88e0a44c80256fc5e340d551e
Author: László Németh 
AuthorDate: Thu Nov 23 14:01:10 2023 +0100
Commit: László Németh 
CommitDate: Mon Nov 27 14:48:19 2023 +0100

tdf#158333 sw smart justify: fix multiple text portions

Multiple text portions, e.g. if some part of a line
contains direct character formatting breaks DOCX
interoperability of justified paragraphs.

Follow-up to commit 17eaebee279772b6062ae3448012133897fc71bb
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: Ia53e763fdba89bb733bde088874e641b25d733f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159862
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 797b41fc7baf..dc70bf41b6f8 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -201,6 +201,42 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
 CPPUNIT_ASSERT_GREATER(sal_Int32(5840), nPortionWidth);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158333)
+{
+createSwDoc("tdf130088.docx");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+
+// shrink line 2
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]", 
"portion",
+"viverra odio. Donec auctor molestie sem, sit amet tristique lectus 
hendrerit sed. ");
+
+// shrink line 7
+assertXPath(
+pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[7]", 
"portion",
+// This was "...diam ", not "...diam tempor "
+"laoreet vel leo nec, volutpat facilisis eros. Donec consequat arcu ut 
diam tempor ");
+
+// shrink line 2 of paragraph 2
+assertXPath(
+pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[2]", 
"portion",
+// This was "...Cras ", not "...Cras sodales "
+"Donec auctor molestie sem, sit amet tristique lectus hendrerit sed. 
Cras sodales ");
+
+// shrink line 2 of paragraph 4
+assertXPath(pXmlDoc, 
"/root/page/body/txt[4]/SwParaPortion/SwLineLayout[2]", "portion",
+// This was "...et ", not "...et magnis "
+"consequat arcu ut diam tempor luctus. Cum sociis natoque 
penatibus et magnis ");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 6d92b64d9fce..5e66b366c63f 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -85,7 +85,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, 
SwTextFormatInfo &rInf,
 DocumentSettingId::JUSTIFY_LINES_WITH_SHRINKING))
 {
 // allow up to 2% shrinking of the line
-nLineWidth /= 0.98;
+nLineWidth = nLineWidth / 0.98 + rInf.X() / 0.98 - rInf.X();
 }
 
 // tdf#104668 space chars at the end should be cut if the compatibility 
option is enabled
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index fdd0ffba53b9..6d0992f1abf6 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -276,9 +276,9 @@ void SwLinePortion::Move(SwTextPaintInfo & rInf) const
 bool bCounterDir = ( ! bFrameDir && DIR_RIGHT2LEFT == rInf.GetDirection() 
) ||
(   bFrameDir && DIR_LEFT2RIGHT == rInf.GetDirection() 
);
 
-if ( InSpaceGrp() && rInf.GetSpaceAdd() )
+if ( InSpaceGrp() && rInf.GetSpaceAdd(/*bShrink=*/true) )
 {
-SwTwips nTmp = PrtWidth() + CalcSpacing( rInf.GetSpaceAdd(), rInf );
+SwTwips nTmp = PrtWidth() + CalcSpacing( 
rInf.GetSpaceAdd(/*bShrink=*/true), rInf );
 if( rInf.IsRotated() )
 rInf.Y( rInf.Y() + ( bB2T ? -nTmp : nTmp ) );
 else if ( bCounterDir )
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 1e2f8d1823d0..ff6d40cd4d95 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -668,7 +668,8 @@ tools::Long SwTextPortion::CalcSpacing( tools::Long 
nSpaceAdd, const SwTextSizeI
 }
 }
 
-return sal_Int32(nCnt) * nSpaceAdd / SPACING_PRECISION_FACTOR;
+return sal_Int32(nCnt) * (nSpaceAdd > LONG_MAX/2 ? LONG_MAX/2 - nSpaceAdd 
: nSpaceAdd)
+ / SPACING_PRECISION_F

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-27 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/flycnt.cxx |   42 +++
 sw/source/core/layout/flycnt.cxx |7 ++
 2 files changed, 49 insertions(+)

New commits:
commit 272c3548c4d2362eb737947c8cbb017e2d55aae1
Author: Miklos Vajna 
AuthorDate: Mon Nov 27 08:36:37 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 27 10:35:15 2023 +0100

sw floattable, per-frame wrap-on-all-pages mode: add layout

The anchor text of a floating table is normally wrapped around the table
only on the last page of the table. This property requests to wrap on
all pages instead for this frame.

Commit 7d7ca347fafa7a06094b00e8fb0d0452c4c81366 (sw floattable, wrap on
all pages: add layout, 2023-10-13) already arranged the layout code to
go via the per-frame SwFlyAtContentFrame::IsWrapOnAllPages(), so only
that needs updating.

Instead of always deciding this at a per-doc level, first check if the
frame itself requests the on-all-pages behavior. Otherwise keep deciding
this on a per-doc level. This is meant to please what the OASIS/ODT
proposal wants and also keeps the Word-style per-doc setting.

The ODT filter still needs doing.

Change-Id: Ibf10b5f016d70e6fe948d5273cc1fb1d98495586
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159981
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
index 6c508a5f87e7..6b84ca3fb16d 100644
--- a/sw/qa/core/layout/flycnt.cxx
+++ b/sw/qa/core/layout/flycnt.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -1221,6 +1222,47 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrapOnAllPages)
 CPPUNIT_ASSERT(!pPage2Anchor->GetFollow());
 CPPUNIT_ASSERT_EQUAL(OUString("didn't bode well."), aAnchor2Text);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyPerFrameWrapOnAllPages)
+{
+// Given a document where we want to wrap on all pages, around a split 
floating table:
+createSwDoc("floattable-wrap-on-all-pages.docx");
+SwDoc* pDoc = getSwDoc();
+sw::SpzFrameFormats& rFlys = *pDoc->GetSpzFrameFormats();
+sw::SpzFrameFormat* pFly = rFlys[0];
+SfxItemSet aSet(pFly->GetAttrSet());
+SwFormatWrapTextAtFlyStart aItem(true);
+aSet.Put(aItem);
+pDoc->SetFlyFrameAttr(*pFly, aSet);
+
+// When formatting that document:
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->Reformat();
+
+// Then make sure that the anchor text is also split between page 1 and 
page 2:
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+auto pPage1Anchor = pPage1->FindLastBodyContent()->DynCastTextFrame();
+CPPUNIT_ASSERT(pPage1Anchor);
+OUString aAnchor1Text(pPage1Anchor->GetText().subView(
+static_cast(pPage1Anchor->GetOffset()),
+static_cast(pPage1Anchor->GetFollow()->GetOffset()
+   - pPage1Anchor->GetOffset(;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: He heard quiet steps behind him. That
+// - Actual  :
+// i.e. the first page had no anchor text, only the second.
+CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. That "), 
aAnchor1Text);
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+auto pPage2Anchor = pPage2->FindLastBodyContent()->DynCastTextFrame();
+CPPUNIT_ASSERT(pPage2Anchor);
+OUString aAnchor2Text(
+
pPage2Anchor->GetText().subView(static_cast(pPage2Anchor->GetOffset(;
+CPPUNIT_ASSERT(!pPage2Anchor->GetFollow());
+CPPUNIT_ASSERT_EQUAL(OUString("didn't bode well."), aAnchor2Text);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index c07201f49f43..a53b8841f84a 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -1786,6 +1787,12 @@ void SwFlyAtContentFrame::DelEmpty()
 
 bool SwFlyAtContentFrame::IsWrapOnAllPages() const
 {
+const SwFormatWrapTextAtFlyStart& rWrapTextAtFlyStart = 
GetFormat()->GetWrapTextAtFlyStart();
+if (rWrapTextAtFlyStart.GetValue())
+{
+return true;
+}
+
 const SwRootFrame* pRootFrame = getRootFrame();
 if (!pRootFrame)
 {


[Libreoffice-commits] core.git: sw/qa

2023-11-24 Thread Tomaž Vajngerl (via logerrit)
 sw/qa/unit/swmodeltestbase.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 6ef1728944b3e0ad0679a11cb17044b8d4401491
Author: Tomaž Vajngerl 
AuthorDate: Fri Nov 24 12:26:08 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Nov 25 06:22:15 2023 +0100

sw: prevent crash with assert in test base class

Change-Id: I4450d38bfc8146828f0ea447d713ff746c33f101
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159945
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 206f8dd53660..5029421a631a 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -210,8 +210,9 @@ OUString SwModelTestBase::parseDump(const OString& aXPath, 
const OString& aAttri
 if (pXmlXpathObj->type == XPATH_NODESET)
 {
 xmlNodeSetPtr pXmlNodes = pXmlXpathObj->nodesetval;
-CPPUNIT_ASSERT_EQUAL_MESSAGE("xpath should match exactly 1 node", 1,
- xmlXPathNodeSetGetLength(pXmlNodes));
+int nNodes = xmlXPathNodeSetGetLength(pXmlNodes);
+OString aMessage("xpath ('" + aXPath + "') should match exactly 1 
node");
+CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), 1, nNodes);
 xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
 if (aAttribute.getLength())
 pXpathStrResult = xmlGetProp(pXmlNode, 
BAD_CAST(aAttribute.getStr()));
@@ -343,7 +344,8 @@ SwModelTestBase::getParagraphOfText(int number, 
uno::Reference cons
 const OUString& content) const
 {
 uno::Reference const 
xParagraph(getParagraphOrTable(number, xText),
-  uno::UNO_QUERY_THROW);
+  uno::UNO_QUERY);
+CPPUNIT_ASSERT(xParagraph.is());
 if (!content.isEmpty())
 CPPUNIT_ASSERT_EQUAL_MESSAGE("paragraph does not contain expected 
content", content,
  xParagraph->getString());


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-22 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-table-join.docx |binary
 sw/qa/core/layout/tabfrm.cxx  |   60 ++
 sw/source/core/layout/tabfrm.cxx  |   14 -
 3 files changed, 73 insertions(+), 1 deletion(-)

New commits:
commit 223d2fac61e061478721a7a4a89b1362f5037d8f
Author: Miklos Vajna 
AuthorDate: Wed Nov 22 08:31:17 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 22 09:57:04 2023 +0100

sw floattable: fix crash by trying harder to split tables

Regression from commit 60e2fdf1d7e8346e5a3835369c47e582c737ce20 (sw
floattable: maintain the invariant that fly height is at least MINFLY,
2023-09-28), the bugdoc crashed on load in SwTabFrame::MakeAll(),
because the tab frame's HasFollowFlowLine() was true, but
GetFollow()->GetFirstNonHeadlineRow() was nullptr and the invarint is
that these are always in sync.

Digging deeper, what happens is that the master table has a split row at
the end, so the follow table has a "follow flow line". We remove that
when we try to split the master table (split either moves rows to the
follow or creates a new follow), so the follow table only has a
"headline row" remaining. Then Split() is called with bTryToSplit set to
true, this fails (because only a single line would fit the master, but
orphan/widow control rejects that) and then we join the follow table
(because it only has headline rows), so a split with bTryToSplit set to
false (don't split the row itself) never happens. This at the end leads
to a strange table frame with only headline rows and gets deleted, which
is odd to happen during the initial layout.

Fix the problem by remembering if we just removed the follow flow line,
and in case we tried to split the rows itself and table split failed,
then don't join the follow table, so a next split can be invoked with
bTryToSplit set to false, which leads to the correct layout. This means
not only the crash is fixed, but also no layout loop happens and result
matches Word.

Limit this to tables in split flys, at least for this bugdoc the inline
table case would not have this problem as widow/orphan control is
disabled inside inline tables.

Change-Id: I172e38be11baf6f73df722a4c6c035a6a283d727
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159802
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/floattable-table-join.docx 
b/sw/qa/core/layout/data/floattable-table-join.docx
new file mode 100644
index ..807b4cfa8c11
Binary files /dev/null and b/sw/qa/core/layout/data/floattable-table-join.docx 
differ
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index cfad007cebcd..e83767992aa6 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -13,6 +13,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 namespace
 {
@@ -109,6 +113,62 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNestedRowSpan)
 // Then make sure the resulting page count matches Word:
 CPPUNIT_ASSERT_EQUAL(6, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyTableJoin)
+{
+// Given a document with a multi-page floating table:
+// When loading this document:
+createSwDoc("floattable-table-join.docx");
+
+// Then make sure this document doesn't crash the layout and has a 
floating table split on 4
+// pages:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+CPPUNIT_ASSERT(pPage1->GetSortedObjs());
+{
+SwSortedObjs& rPageObjs = *pPage1->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = 
rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+// Start of the chain.
+CPPUNIT_ASSERT(!pFly->GetPrecede());
+CPPUNIT_ASSERT(pFly->HasFollow());
+}
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+{
+SwSortedObjs& rPageObjs = *pPage2->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = 
rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly);
+CPPUNIT_ASSERT(pFly->GetPrecede());
+CPPUNIT_ASSERT(pFly->HasFollow());
+}
+auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage3);
+CPPUNIT_ASSERT(pPage3->GetSortedObjs());
+{
+SwSortedObjs& rPageObjs = *pPage3->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs.size());
+auto pFly = 
rPageObjs[0]->DynCastFlyFrame()->DynCastFlyAtContentFrame();
+CPPUNIT_ASSERT(pFly)

[Libreoffice-commits] core.git: sw/qa

2023-11-21 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/mailmerge/mailmerge2.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit f732cedc77959489a9bee4d3e6d56901bd5625ed
Author: Miklos Vajna 
AuthorDate: Tue Nov 21 20:10:25 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 22 08:28:45 2023 +0100

CppunitTest_sw_mailmerge2: remove not needed preTest() call

1) preTest() retuns a unique_ptr which has to be hold till the test
   runs, which didn't happen here.

2) This was just copy&paste probably, since preTest() is not overwritten
   in this suite.

Change-Id: Idd8688a82db01d41ac9d0535a907dccc6064c6cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159796
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/mailmerge/mailmerge2.cxx 
b/sw/qa/extras/mailmerge/mailmerge2.cxx
index c86ae9cc48fb..4a58d07b4f01 100644
--- a/sw/qa/extras/mailmerge/mailmerge2.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge2.cxx
@@ -85,7 +85,6 @@ public:
 {
 maMMTest2Filename = filename;
 header();
-preTest(filename);
 
 utl::TempFileNamed aTempDir(nullptr, true);
 aTempDir.EnableKillingFile();


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-21 Thread Andreas Heinisch (via logerrit)
 sw/qa/uitest/writer_tests5/tdf115871.py |   87 
 sw/source/ui/chrdlg/numpara.cxx |6 +-
 2 files changed, 92 insertions(+), 1 deletion(-)

New commits:
commit c95f406fcde65e383cff90842ff66e55bfabfc79
Author: Andreas Heinisch 
AuthorDate: Tue Nov 21 15:45:22 2023 +0100
Commit: Andreas Heinisch 
CommitDate: Tue Nov 21 16:55:59 2023 +0100

tdf#115871 - Reset outline and list options to parent settings

Added the various items of the controls in the outline and list options
tab to the range container. Otherwise, the main dialog does not have any
knowledge about the options to reset to the parent settings.

Change-Id: Icc9f862e741eb0457cfb1c74e64324809c143ab3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159787
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sw/qa/uitest/writer_tests5/tdf115871.py 
b/sw/qa/uitest/writer_tests5/tdf115871.py
new file mode 100755
index ..1f8639b64586
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf115871.py
@@ -0,0 +1,87 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf115871(UITestCase):
+
+   def test_tdf115871_reset_outline_list_options_parent(self):
+
+with self.ui_test.create_doc_in_start_center("writer"):
+
+# Create new style from selection
+with 
self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as 
xDialog:
+xStyleName = xDialog.getChild("stylename")
+type_text(xStyleName, "Custom Heading 1")
+
+# Modify the created style to inherit paragraph attributes from 
Heading 1
+with self.ui_test.execute_dialog_through_command(".uno:EditStyle") 
as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "0")
+xLinkedWith = xTabs.getChild("linkedwith")
+xLinkedWith.executeAction("SELECT", mkPropertyValues({"TEXT": 
"Heading 1"}))
+
self.assertEqual(get_state_as_dict(xLinkedWith)["SelectEntryText"], "Heading 1")
+
+# Modify outline & list settings of the created style
+with self.ui_test.execute_dialog_through_command(".uno:EditStyle") 
as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "15")
+
+# Outline level
+xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL")
+xOutlineLevel.executeAction("SELECT", 
mkPropertyValues({"TEXT": "Level 5"}))
+
self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 5")
+
+# List style
+xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE")
+xListStyle.executeAction("SELECT", mkPropertyValues({"TEXT": 
"Numbering 123"}))
+
self.assertEqual(get_state_as_dict(xListStyle)["SelectEntryText"], "Numbering 
123")
+
+# Line numbering including start with
+xRestartAtParagraph = 
xTabs.getChild("checkCB_RESTART_PARACOUNT")
+xRestartAtParagraph.executeAction("CLICK", tuple())
+
self.assertEqual(get_state_as_dict(xRestartAtParagraph)["Selected"], "true")
+xStartWith = xTabs.getChild("spinNF_RESTART_PARA")
+xStartWith.executeAction("UP", tuple())
+self.assertEqual(get_state_as_dict(xStartWith)["Text"], "2")
+
+# Open the paragraph style dialog and reset dialog to parent 
settings
+with self.ui_test.execute_dialog_through_command(".uno:EditStyle") 
as xDialog:
+xTabs = xDialog.getChild("tabcontrol")
+select_pos(xTabs, "15")
+
+xStandardButton = xDialog.getChild("standard")
+xStandardButton.executeAction("CLICK", tuple())
+
+xOutlineLevel = xTabs.getChild("comboLB_OUTLINE_LEVEL")
+# Without the fix in place, this test would have failed with
+# AssertionError: 'Level 5' != 'Level 1'
+
self.assertEqual(get_state_as_dict(xOutlineLevel)["SelectEntryText"], "Level 1")
+
+xListStyle = xTabs.getChild("comboLB_NUMBER_STYLE")
+# Without the fix in place, this test would have failed with
+# AssertionError: 'Numbering 123' != 'Heading Numbering'
+
self.assertEqual(get_state_as_d

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-20 Thread Caolán McNamara (via logerrit)
 sw/qa/extras/layout/data/ofz64109-1.fodt |binary
 sw/qa/extras/layout/layout3.cxx  |6 ++
 sw/source/core/text/porfld.cxx   |   10 ++
 3 files changed, 16 insertions(+)

New commits:
commit 72928fa459f8e67c30a2e2357424ab75d3105a26
Author: Caolán McNamara 
AuthorDate: Sat Nov 18 21:56:51 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Nov 20 12:36:27 2023 +0100

ofz#64109 crash in CharClass::isLetterNumeric

there appears to be an extra portion created, because HookChar is
set, but there doesn't seem to be a reason for the HookChar so we
get an unwanted trailing portion.

It seems that the HookChar is set when processing the field, presumably
when we restore the SwTextFormatInfo text, idx and len we should also
restore its original HookChar state.

At least for this ruby text case there the field contents are drawn over
the body text, unlike others where the contents are drawn inline with
the body text, where we appear to need to keep the hook char.

Change-Id: Id48a3ef09cd10dcc91048f8c08207d2d105839d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159642
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/extras/layout/data/ofz64109-1.fodt 
b/sw/qa/extras/layout/data/ofz64109-1.fodt
new file mode 100644
index ..26a4bbbf63cf
Binary files /dev/null and b/sw/qa/extras/layout/data/ofz64109-1.fodt differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index 11b9aec05ad2..797b41fc7baf 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -786,6 +786,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testAbi11870)
 createSwDoc("abi11870-2.odt");
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testOfz64109)
+{
+//just care it doesn't assert
+createSwDoc("ofz64109-1.fodt");
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf118719)
 {
 // Insert a page break.
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 580b4a2635a7..1a30a4ecd7d1 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -145,6 +145,7 @@ class SwFieldSlot
 OUString aText;
 TextFrameIndex nIdx;
 TextFrameIndex nLen;
+sal_Unicode nOrigHookChar;
 SwTextFormatInfo *pInf;
 bool bOn;
 public:
@@ -158,6 +159,7 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, 
const SwFieldPortion *pP
 : pOldText(nullptr)
 , nIdx(0)
 , nLen(0)
+, nOrigHookChar(0)
 , pInf(nullptr)
 {
 bOn = pPor->GetExpText( *pNew, aText );
@@ -170,6 +172,7 @@ SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, 
const SwFieldPortion *pP
 nIdx = pInf->GetIdx();
 nLen = pInf->GetLen();
 pOldText = &(pInf->GetText());
+nOrigHookChar = pInf->GetHookChar();
 m_pOldCachedVclData = pInf->GetCachedVclData();
 pInf->SetLen(TextFrameIndex(aText.getLength()));
 pInf->SetCachedVclData(nullptr);
@@ -200,6 +203,13 @@ SwFieldSlot::~SwFieldSlot()
 {
 pInf->SetCachedVclData(m_pOldCachedVclData);
 pInf->SetText( *pOldText );
+// ofz#64109 at last for ruby-text when we restore the original text to
+// continue laying out the 'body' text of the ruby, then a tab or other
+// 'hook char' in the text drawn above it shouldn't affect the 'body'
+// While there are other cases, such as tdf#148360, where the tab in an
+// inline expanded field, that should affect the body.
+if (pInf->IsRuby())
+pInf->SetHookChar(nOrigHookChar);
 pInf->SetIdx( nIdx );
 pInf->SetLen( nLen );
 pInf->SetFakeLineStart( false );


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-20 Thread Jaume Pujantell (via logerrit)
 sw/qa/core/unocore/data/tdf108272-1-minimal.docx |binary
 sw/qa/core/unocore/unocore.cxx   |6 ++
 sw/source/core/unocore/unotext.cxx   |1 +
 3 files changed, 7 insertions(+)

New commits:
commit 43868de0ddabba952b923f6189d1fefeddb70bcf
Author: Jaume Pujantell 
AuthorDate: Mon Nov 20 10:24:18 2023 +0100
Commit: Jaume Pujantell 
CommitDate: Mon Nov 20 12:18:23 2023 +0100

fix a regression crash

Fixes a crash introduced by commit 5082d50.

Change-Id: Id33c49165c4d345d652a546db14df98ee0ff754a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159736
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/unocore/data/tdf108272-1-minimal.docx 
b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx
new file mode 100644
index ..28efdf65b9af
Binary files /dev/null and b/sw/qa/core/unocore/data/tdf108272-1-minimal.docx 
differ
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index fd5c139e979a..00c61a042b77 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -1025,6 +1025,12 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf149555)
 CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString());
 }
 
+// just care that it doesn't crash/assert
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf108272Crash)
+{
+createSwDoc("tdf108272-1-minimal.docx");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unotext.cxx 
b/sw/source/core/unocore/unotext.cxx
index 5fef89f3ffde..f959d6a6104c 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1579,6 +1579,7 @@ SwXText::convertToTextFrame(
 (pStartStartNode != GetStartNode()))
 {
 // if not - remove the additional paragraphs and throw
+oAnchorCheckPam.reset(); // clear SwIndex before deleting nodes
 if (bParaBeforeInserted)
 {
 SwCursor aDelete(*pStartPam->GetPoint(), nullptr);


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-20 Thread Miklos Vajna (via logerrit)
 sw/qa/core/frmedt/frmedt.cxx |   12 
 sw/source/core/frmedt/fefly1.cxx |   22 --
 2 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 45a4ed02281a7a8ca52fccf626c792e417c8ef1c
Author: Miklos Vajna 
AuthorDate: Mon Nov 20 08:35:57 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 20 10:19:22 2023 +0100

sw floattable, delete UI: fix undo/redo

Pressing the unfloat context menu item for a frame resulted in 2 undo
actions and trying to undo both even crashed.

One problem was that no SwNode was left in the TextFrame and then it was
deleted; but undo created a TextFrame with an empty SwNode in it.

Fix this by inserting an empty text node at the end of the TextFrame and
only then moving content from it.

The other trouble was that in case the new text node has no matching
frame during MoveNodeRange(), then the fly frame will be deleted twice:
once during MoveNodeRange() (because it has become empty) and once more
during DelLayoutFormat(). This can be avoided by moving AppendTextNode()
to its own layout action. Finally also group the (now) 3 undo actions
together, because it was a single action on the UI.

Change-Id: I95ce0abbab79a293ecb209579c105f96d284a1c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159730
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/frmedt/frmedt.cxx b/sw/qa/core/frmedt/frmedt.cxx
index 618fe7fb574f..b2a53e60db27 100644
--- a/sw/qa/core/frmedt/frmedt.cxx
+++ b/sw/qa/core/frmedt/frmedt.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /// Covers sw/source/core/frmedt/ fixes.
 class SwCoreFrmedtTest : public SwModelTestBase
@@ -204,6 +205,8 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyUnfloat)
 // Given a document with a floating table:
 createSwDoc();
 SwDoc* pDoc = getSwDocShell()->GetDoc();
+CPPUNIT_ASSERT(pDoc->GetUndoManager().IsUndoEnabled());
+pDoc->GetUndoManager().EnableUndo(false);
 sw::FrameFormats& rFlyFormats = 
*pDoc->GetSpzFrameFormats();
 CPPUNIT_ASSERT(rFlyFormats.empty());
 // Insert a table:
@@ -226,6 +229,7 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyUnfloat)
 pWrtShell->EndAllAction();
 CPPUNIT_ASSERT(!rFlyFormats.empty());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pDoc->GetTableFrameFormatCount(/*bUsed=*/true));
+pDoc->GetUndoManager().EnableUndo(true);
 
 // When marking that frame and unfloating it:
 selectShape(1);
@@ -236,6 +240,14 @@ CPPUNIT_TEST_FIXTURE(SwCoreFrmedtTest, testSplitFlyUnfloat)
 // have failed, the frame was not removed.
 CPPUNIT_ASSERT(rFlyFormats.empty());
 CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pDoc->GetTableFrameFormatCount(/*bUsed=*/true));
+
+// When undoing the conversion to inline:
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pDoc->GetUndoManager().GetUndoActionCount());
+pDoc->GetUndoManager().Undo();
+
+// Then the undo stack had 2 undo actions and undo-all crashed.
+CPPUNIT_ASSERT(!rFlyFormats.empty());
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pDoc->GetTableFrameFormatCount(/*bUsed=*/true));
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index d9a620122b07..9e2fedcc3827 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -275,6 +276,10 @@ void SwFEShell::SelectFlyFrame( SwFlyFrame& rFrame )
 
 void SwFEShell::UnfloatFlyFrame()
 {
+GetIDocumentUndoRedo().StartUndo(SwUndoId::DELLAYFMT, nullptr);
+comphelper::ScopeGuard g([this]
+ { 
GetIDocumentUndoRedo().EndUndo(SwUndoId::DELLAYFMT, nullptr); });
+
 SwFlyFrame* pFly = GetSelectedFlyFrame();
 if (!pFly)
 {
@@ -295,7 +300,21 @@ void SwFEShell::UnfloatFlyFrame()
 return;
 }
 
-SwNodeRange aRange(pFlyStart->GetNode(), SwNodeOffset(1), *pFlyEnd, 
SwNodeOffset(0));
+// Create an empty paragraph after the table, so the frame's SwNodes 
section is non-empty after
+// MoveNodeRange(). Undo would ensure it's non-empty and then node offsets 
won't match.
+IDocumentContentOperations& rIDCO = 
GetDoc()->getIDocumentContentOperations();
+{
+SwNodeIndex aInsertIndex(*pFlyEnd);
+--aInsertIndex;
+SwPosition aInsertPos(aInsertIndex);
+StartAllAction();
+rIDCO.AppendTextNode(aInsertPos);
+// Make sure that a layout frame is created for the node, so the fly 
frame is not deleted,
+// during MoveNodeRange(), either.
+EndAllAction();
+}
+
+SwNodeRange aRange(pFlyStart->GetNode(), SwNodeOffset(1), *pFlyEnd, 
SwNodeOffset(-1));
 const SwFormatAnchor& rAnchor = rFlyFormat.GetAnchor();
 SwNode* pAnchor = rAnchor.GetAnchorNode();
 if (!pAnchor)
@@ -305,7 +324,6 

[Libreoffice-commits] core.git: sw/qa

2023-11-17 Thread László Németh (via logerrit)
 sw/qa/extras/layout/data/tdf130088.docx |binary
 sw/qa/extras/layout/layout3.cxx |   21 +
 2 files changed, 21 insertions(+)

New commits:
commit c1803de8a093739d189be54b2d9bd5634e9e79ee
Author: László Németh 
AuthorDate: Thu Nov 16 23:48:03 2023 +0100
Commit: László Németh 
CommitDate: Fri Nov 17 09:33:06 2023 +0100

tdf#119908 sw smart justify: add unit test

Follow-up to commit 17eaebee279772b6062ae3448012133897fc71bb
"tdf#119908 sw smart justify: fix justification by shrinking".

Change-Id: I88cc7876c06729f81b9d61fed7456be801dc6373
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159525
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/layout/data/tdf130088.docx 
b/sw/qa/extras/layout/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf130088.docx differ
diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx
index b390e6e38b9c..11a9c0191d24 100644
--- a/sw/qa/extras/layout/layout3.cxx
+++ b/sw/qa/extras/layout/layout3.cxx
@@ -172,6 +172,27 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf128966)
 xmlXPathFreeObject(pXmlObj);
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf119908)
+{
+createSwDoc("tdf130088.docx");
+// Ensure that all text portions are calculated before testing.
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pTextDoc);
+SwViewShell* pViewShell
+= 
pTextDoc->GetDocShell()->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
+CPPUNIT_ASSERT(pViewShell);
+pViewShell->Reformat();
+
+xmlDocUniquePtr pXmlDoc = parseLayoutDump();
+// Keep real width of the exceeding line portions to calculate shrinking
+sal_Int32 nPortionWidth
+= getXPath(pXmlDoc, 
"/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]/SwLinePortion[2]",
+   "width")
+  .toInt32();
+// This was 5806 (not real portion width, but stripped to the line width)
+CPPUNIT_ASSERT_GREATER(sal_Int32(5840), nPortionWidth);
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf106234)
 {
 createSwDoc("tdf106234.fodt");


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-17 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/layout.cxx|3 ---
 sw/source/core/inc/objectformatter.hxx|3 ++-
 sw/source/core/layout/fly.cxx |6 --
 sw/source/core/layout/objectformatter.cxx |5 +++--
 4 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 191babee4f0ec643b80e96b0cd98c2d04ff96e4e
Author: Michael Stahl 
AuthorDate: Thu Nov 16 19:45:05 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 17 09:09:20 2023 +0100

sw: fix layout crash in SwObjectFormatterTextFrame::DoFormatObj()

Since commit 15b886f460919ea3dce425a621dc017c2992a96b this is happening
in testForcepoint93, but only on WNT.

The crash is in SwObjectFormatterTextFrame::DoFormatObj() calling
SwObjectFormatterTextFrame::InvalidateFollowObjs() and the mrPageFrame
has been deleted; there is also the m_bAgain flag set in the SwLayAction
up the stack, but the SwObjectFormatter::mpLayAction is null so
DoFormatObj() cannot check this condition.

In the caller CalcContent(), get the SwLayAction from the SwViewShell
and pass it to the SwObjectFormatter, which appears to fix the problem.

Change-Id: Ib3dc34ce39b4aad723251271c24bdd7a6598ab1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159518
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 83cbf0757c96..47f2eddbc42d 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -3480,15 +3480,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint91) 
{ createSwWebDoc("forcepo
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint92) { 
createSwDoc("forcepoint92.doc"); }
 
-#ifndef _MSC_VER
-//FIXME: crashes only on WNT with RTF import changes - debug next week
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint93)
 {
 createSwDoc("forcepoint93-1.rtf");
 createSwDoc("forcepoint93-2.rtf");
 }
-#endif
 
 //just care it doesn't crash/assert
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94) { 
createSwWebDoc("forcepoint94.html"); }
diff --git a/sw/source/core/inc/objectformatter.hxx 
b/sw/source/core/inc/objectformatter.hxx
index 99d8644f2c29..f85c12dc5f2d 100644
--- a/sw/source/core/inc/objectformatter.hxx
+++ b/sw/source/core/inc/objectformatter.hxx
@@ -166,7 +166,8 @@ class SwObjectFormatter
 */
 static bool FormatObj( SwAnchoredObject& _rAnchoredObj,
SwFrame* _pAnchorFrame = nullptr,
-   const SwPageFrame* _pPageFrame = nullptr );
+   const SwPageFrame* _pPageFrame = nullptr,
+   SwLayAction* pLayAction = nullptr );
 };
 
 #endif
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 33880623a481..8dad5a5ad047 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1566,7 +1566,8 @@ void SwFlyFrame::Format( vcl::RenderContext* 
/*pRenderContext*/, const SwBorderA
 //  Thus,  no longer used by 
.
 void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 {
-vcl::RenderContext* pRenderContext = 
pLay->getRootFrame()->GetCurrShell()->GetOut();
+SwViewShell & rShell(*pLay->getRootFrame()->GetCurrShell());
+vcl::RenderContext* pRenderContext = rShell.GetOut();
 SwSectionFrame* pSect;
 bool bCollect = false;
 if( pLay->IsSctFrame() )
@@ -1727,7 +1728,8 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
 }
 }
 
-if ( !SwObjectFormatter::FormatObj( *pAnchoredObj, 
pAnchorFrame, pAnchorPageFrame ) )
+if (!SwObjectFormatter::FormatObj(*pAnchoredObj, 
pAnchorFrame, pAnchorPageFrame,
+rShell.Imp()->IsAction() ? 
&rShell.Imp()->GetLayAction() : nullptr))
 {
 bRestartLayoutProcess = true;
 break;
diff --git a/sw/source/core/layout/objectformatter.cxx 
b/sw/source/core/layout/objectformatter.cxx
index b99da6a0fe4b..6395d2f9e3a8 100644
--- a/sw/source/core/layout/objectformatter.cxx
+++ b/sw/source/core/layout/objectformatter.cxx
@@ -167,7 +167,8 @@ bool SwObjectFormatter::FormatObjsAtFrame( SwFrame& 
_rAnchorFrame,
 */
 bool SwObjectFormatter::FormatObj( SwAnchoredObject& _rAnchoredObj,
SwFrame* _pAnchorFrame,
-   const SwPageFrame* _pPageFrame )
+   const SwPageFrame* _pPageFrame,
+   SwLayAction * pLayAction)
 {
 bool bSuccess( true );
 
@@ -181,7 +182,7 @@ bool SwObjectFormatter::FormatObj( SwAnchoredObject& 
_rAnchoredObj,
 
 // create corresponding object formatter
 std::unique_ptr pObjFormatter =
-SwObj

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-16 Thread László Németh (via logerrit)
 sw/qa/core/text/frmform.cxx |4 +---
 sw/source/core/inc/drawfont.hxx |6 +-
 sw/source/core/text/inftxt.cxx  |2 +-
 sw/source/core/text/inftxt.hxx  |6 --
 sw/source/core/text/itradj.cxx  |   13 -
 sw/source/core/text/porlay.hxx  |7 ++-
 sw/source/core/text/portxt.cxx  |7 +--
 7 files changed, 30 insertions(+), 15 deletions(-)

New commits:
commit 17eaebee279772b6062ae3448012133897fc71bb
Author: László Németh 
AuthorDate: Wed Nov 15 23:31:12 2023 +0100
Commit: László Németh 
CommitDate: Thu Nov 16 16:21:06 2023 +0100

tdf#119908 sw smart justify: fix justification by shrinking

Shrink the exceeding lines by shrinking the spaces
between the words.

Because the negative spacing values are used
for the extra space between the characters in the main
data structure of the justified line layout, and not for
the space between the words, like the positive values,
the negative space values for shrinking are stored over
LONG_MAX/2 as absolute values to avoid of bigger changes
of the data structure before designing a better
justification algorithm, where it's possible to mix
different methods for the more visible text layout.

Note: the text cursor doesn't follow the new word
positions yet.

Follow-up to commit 7d08767b890e723cd502b1c61d250924f695eb98
"tdf#130088 tdf#119908 smart justify: fix DOCX line count + compat opt."

Change-Id: I9a63b5a93d6bce230e963ebc88ea2d0f9aa8fffb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159511
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index b321fca51cee..3d43bde6aa9c 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -63,9 +63,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableNegativeVertOffset)
 CPPUNIT_ASSERT_LESS(pPara2->getFrameArea().Top(), rFlyRect.Bottom());
 }
 
-// FIXME: because breaking the lines at the right place, this test
-// became obsolete: proposed fix is to modify compatibilityMode to "14"
-// in the DOCX test file to use the old justification algorithm
+// FIXME: because breaking the lines at the right place, test document became 
obsolete
 #if 0
 CPPUNIT_TEST_FIXTURE(Test, testFloattableAvoidManipOfst)
 {
diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index 3d58f5fcd09d..fe6a44264759 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -544,7 +544,11 @@ public:
 }
 else
 {
-m_nSpace = nNew;
+// negative space (shrinking) stored over LONG_MAX/2
+if ( nNew < LONG_MAX/2 )
+m_nSpace = nNew;
+else
+m_nSpace = LONG_MAX/2 - nNew;
 m_nCharacterSpacing = 0;
 }
 #ifdef DBG_UTIL
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 82bbf9d879bf..129234c8a4cf 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -634,7 +634,7 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, 
const SwLinePortion &rPo
 aDrawInf.SetUnderFnt( m_pUnderFnt );
 
 const tools::Long nSpaceAdd = ( rPor.IsBlankPortion() || 
rPor.IsDropPortion() ||
- rPor.InNumberGrp() ) ? 0 : GetSpaceAdd();
+ rPor.InNumberGrp() ) ? 0 : 
GetSpaceAdd(/*bShrink=*/true);
 if ( nSpaceAdd )
 {
 TextFrameIndex nCharCnt(0);
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 62cca26ac08f..f2f6d146136e 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -443,8 +443,10 @@ public:
 void SetSpaceIdx( sal_uInt16 nNew ) { m_nSpaceIdx = nNew; }
 void IncSpaceIdx() { ++m_nSpaceIdx; }
 void RemoveFirstSpaceAdd() { m_pSpaceAdd->erase( m_pSpaceAdd->begin() ); }
-tools::Long GetSpaceAdd() const
-{ return ( m_pSpaceAdd && m_nSpaceIdx < m_pSpaceAdd->size() )
+tools::Long GetSpaceAdd( bool bShrink = false ) const
+{ return ( m_pSpaceAdd && m_nSpaceIdx < m_pSpaceAdd->size() &&
+   // get shrink data only if asked explicitly, otherwise zero 
it
+   ( bShrink || (*m_pSpaceAdd)[m_nSpaceIdx] < LONG_MAX/2 ) )
? (*m_pSpaceAdd)[m_nSpaceIdx] : 0; }
 
 void SetpSpaceAdd( std::vector* pNew ){ m_pSpaceAdd = pNew; }
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index b72a8d59f5f7..4dcaf03df1f8 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -290,6 +290,8 @@ void SwTextAdjuster::CalcNewBlock( SwLineLayout *pCurrent,
 bool bDoNotJustifyTab = false;
 
 SwLinePortion *pPos = pCurrent->GetNextPortion();
+// calculate real text width for shrinking
+tools::Long nBreakWidth = 0;
 
 while( pPos )
 {
@@ -367,6 +369

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-11-16 Thread Michael Stahl (via logerrit)
 sw/qa/extras/rtfimport/data/section-pagebreak.rtf |   15 ++
 sw/qa/extras/rtfimport/rtfimport.cxx  |   48 ++
 writerfilter/source/dmapper/DomainMapper.cxx  |1 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx|4 +
 4 files changed, 68 insertions(+)

New commits:
commit 454e5010aec9953f586fe8af671765358f6cafc4
Author: Michael Stahl 
AuthorDate: Wed Nov 15 18:24:50 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 16 15:36:03 2023 +0100

tdf#153194 writerfilter: RTF import: testContSectionPageBreak last para

For testContSectionPageBreak, Word inserts an additional empty paragraph
at the end of the document that was missing in Writer.

Ensure markLastSectionGroup() is always called at the end of the
document so that the \par that is dispatched in m_bNeedPar case will be
inserted and not automatically removed immediately.

Also add a test for the same document without \sbknone, which has 4
pages instead of 2.

Change-Id: Ib3e4fbdb66df55941e4a487d4b249cd98fe42008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159472
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfimport/data/section-pagebreak.rtf 
b/sw/qa/extras/rtfimport/data/section-pagebreak.rtf
new file mode 100644
index ..077cd71e5d48
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/section-pagebreak.rtf
@@ -0,0 +1,15 @@
+{\rtf1 \ansi
+\fet0 \ftnbj \paperw11905 \paperh16837 \margt2267 \margb1133 \margl1417 
\margr1417
+
+\sectd
+FIRST
+\par
+\sect
+SECOND
+\par
+\page
+\sect
+THIRD
+\par
+\sect
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3533b7a77f92..d561969f8989 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -877,10 +877,58 @@ CPPUNIT_TEST_FIXTURE(Test, testContSectionPageBreak)
 CPPUNIT_ASSERT_EQUAL(uno::Any(),
  uno::Reference(xParaThird, 
uno::UNO_QUERY_THROW)
  ->getPropertyValue("PageDescName"));
+// there is an empty paragraph after THIRD
+uno::Reference xParaLast = getParagraph(5);
+CPPUNIT_ASSERT_EQUAL(OUString(), xParaLast->getString());
+try
+{
+getParagraph(6);
+}
+catch (container::NoSuchElementException const&)
+{
+// does not exist - expected
+}
 
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testSectionPageBreak)
+{
+createSwDoc("section-pagebreak.rtf");
+uno::Reference xParaSecond = getParagraph(2);
+CPPUNIT_ASSERT_EQUAL(OUString("SECOND"), xParaSecond->getString());
+CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+ getProperty(xParaSecond, 
"BreakType"));
+CPPUNIT_ASSERT(uno::Any() != getProperty(xParaSecond, 
"PageDescName"));
+// actually not sure how many paragraph there should be between
+// SECOND and THIRD - important is that the page break is on there
+// (could be either 1 or 2; in Word it's a 2-line paragraph with the 1st
+// line containing only the page break being ~0 height)
+uno::Reference xParaNext = getParagraph(3);
+CPPUNIT_ASSERT_EQUAL(OUString(), xParaNext->getString());
+//If PageDescName is not empty, a page break / switch to page style is 
defined
+CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
+ getProperty(xParaNext, 
"BreakType"));
+uno::Reference xParaThird = getParagraph(4);
+CPPUNIT_ASSERT_EQUAL(OUString("THIRD"), xParaThird->getString());
+CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE,
+ getProperty(xParaThird, 
"BreakType"));
+CPPUNIT_ASSERT(uno::Any() != getProperty(xParaThird, 
"PageDescName"));
+// there is an empty paragraph after THIRD
+uno::Reference xParaLast = getParagraph(5);
+CPPUNIT_ASSERT_EQUAL(OUString(), xParaLast->getString());
+try
+{
+getParagraph(6);
+}
+catch (container::NoSuchElementException const&)
+{
+// does not exist - expected
+}
+
+CPPUNIT_ASSERT_EQUAL(4, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testBackground)
 {
 createSwDoc("background.rtf");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index dc863f3f5e8b..8cf91bcf859f 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4410,6 +4410,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
(!m_pImpl->GetParaChanged() && 
m_pImpl->GetParaSectpr()
 && !bSingleParagraphAfterRedline
 && !bIsColumnBreak
+&& !m_pImpl->GetIsLastSectionGroup() // 
testContSectionPageBreak
 && !m_pImpl->GetParaHadField()
 && 
(!m_pImpl->GetIsDummyPara

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-11-16 Thread Michael Stahl (via logerrit)
 sw/qa/extras/layout/layout.cxx  |3 +
 sw/qa/extras/rtfexport/data/page-break-emptyparas-spltpgpar.rtf |   13 +
 sw/qa/extras/rtfexport/data/page-break-emptyparas.rtf   |   12 
 sw/qa/extras/rtfexport/rtfexport5.cxx   |4 -
 sw/qa/extras/rtfexport/rtfexport6.cxx   |7 ++
 sw/qa/extras/rtfexport/rtfexport7.cxx   |   25 
++
 sw/qa/extras/rtfimport/rtfimport.cxx|5 +-
 writerfilter/source/dmapper/DomainMapper.cxx|4 +
 writerfilter/source/rtftok/rtfdispatchflag.cxx  |7 ++
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx|   25 
+-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |   16 +-
 11 files changed, 99 insertions(+), 22 deletions(-)

New commits:
commit 15b886f460919ea3dce425a621dc017c2992a96b
Author: Michael Stahl 
AuthorDate: Fri Nov 10 17:04:27 2023 +0100
Commit: Michael Stahl 
CommitDate: Thu Nov 16 10:19:49 2023 +0100

tdf#153194 writerfilter: RTF import: \spltpgpar

 1. Some experimenting with the bugdoc (saving it to DOCX in Word
changes the layout in Word to exactly what Writer imports from RTF!)
leads to DOCX w:splitPgBreakAndParaMark setting.

 2. the RTF implementation of \spltpgpar was missing; apparently if the
flag is present the "new" behavior is in effect, which is the
opposite of how it's specified in RTF Spec 1.9.1.

 3. the DomainMapper code that uses this attribute is not in the text()
function to which RTFDocumentImpl sends paragraph breaks, but in the
utext() function, so send the break there instead, rather than
creating even more copypasta.

 4. now some filters-text crashes with nullptr pContext in
DomainMapper::lcl_utext(), avoid that.

 5. dispatchSymbol(m_nResetBreakOnSectBreak) doesn't do anything because
these are handled by dispatchFlag().

 6. Test name: testFdo81892::Load_Verify_Reload_Verify
equality assertion failed
- Expected: Performance
- Actual  :

Fails because additional paragraph break inserted after \page; in
dispatchSymbol() for \sect, remove the parBreak() as already hinted at
in commit 3c610336a58f644525d5e4d2566c35eee6f7a618

 7. rtfimport.cxx:868:Assertion
Test name: testContSectionPageBreak::TestBody
equality assertion failed
- Expected:
- Actual  : THIRD

It has no paragraph between SECOND and THIRD, whereas Word
definitely shows a paragraph there.  In dispatchSymbol() for \sect,
sectBreak() is not called (which may create a paragraph break); in
m_bIgnoreNextContSectBreak case this needs to be done manually for
cont-section-pagebreak.rtf to get the empty paragraph between SECOND
and THIRD.

 8. testFdo52052 fails; in dispatchSymbol() for \sect, if the document
ends with \sect (e.g. fdo52052.rtf) a paragraph break must be
inserted after this (because DomainMapper unconditionally removes
the last paragraph break), but not via m_bNeedCr as that creates
unwanted page break in testNestedTable (m_bNeedCr =>
dispatchSymbol(\par) => m_bNeedSect => sectBreak()); handle it in
RTFDocumentImpl::popState() for the end of the document by
dispatching \par.

 9. rtfimport.cxx:1519:Assertion

testTdf108947 now has 1 empty paragraph in the header instead of 2;
Word also shows only 1 so it's an improvement.

10. Test name: testFdo49893_2::Load_Verify_Reload_Verify
equality assertion failed
- Expected: 1
- Actual  : 0
- xpath should match exactly 1 node

This was reduced to only 2 pages, while Word shows 5; in
dispatchSymbol() for \page, for the consecutive \page send an empty
string to DomainMapper's utext() which causes a paragraph break to
be created if \spltpgpar isn't set (this was not at all obvious!).

11. testTdf133437 fails with some numbers of flys changing, but it had
those values before commit 3c610336a58f644525d5e4d2566c35eee6f7a618
which says "the exact number isn't that interesting".

12. testTdf153613_anchoredAfterPgBreak4 fails, but it now looks as in
Word, so this is a bugfix.

13. Jenkins build on WNT (only) crashes in testForcepoint93 in sw
layout code - disable test for now, debug asap.

Change-Id: Ia1063693d96adff900ece943020a5bf69bdeb7a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159471
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 47f2eddbc42d..83cbf0757c96 100644
--- a/sw/qa/extras/layout/layo

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-15 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/split-table-merged-border.odt |binary
 sw/qa/core/layout/paintfrm.cxx   |   49 +++
 sw/source/core/layout/paintfrm.cxx   |   24 +
 3 files changed, 63 insertions(+), 10 deletions(-)

New commits:
commit 47d824dd167eb34b08e5aec7141d2d9e6e996b34
Author: Miklos Vajna 
AuthorDate: Wed Nov 15 08:24:39 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 15 10:14:25 2023 +0100

tdf#157911 sw floattable: fix inconsistent inferred bottom border on split

The bugdoc has a split table between page 1 and page 2. The last row of
page 1 has a half bottom border: it starts on the left of the table,
but finishes earlier than the right of the table. This is since commit
08aea5526c75ff4c5385e960bd940f10ffa19cd5 (tdf#156351 sw floattable: fix
missing bottom border in master table, 2023-08-21).

The trouble is that Writer table borders are really at a cell-level (and
not at row or table level), the current partial border happens because
the first row has merged cells and the last row on page 1 doesn't have
merged cells, so the layout can't do a 1:1 mapping between the first row
and last row cells. It's also far from clear if the fixed result should
be no bottom border or a table-width bottom border:

- Word documents can have cell-level borders (where no inferred border
  is wanted) and table-level borders (where inferred borders are
  wanted), see the tdf#156351 bugdoc for a case where such inferring is
  wanted

- In case only cell-level borders are defined, then Word doesn't do such
  inferring

Fix the problem by always inferring such borders, because:

- Writer already did this in some cases for a long time, see commit
  a4da71fb824f2d4ecc7c01f4deb2865ba52f5f4c (INTEGRATION: CWS fmebugs04
  (1.115.46); FILE MERGED 2008/05/13 13:56:19 fme 1.115.46.2: #i9860# Top
  border for tables - correction 2008/05/13 13:49:23 fme 1.115.46.1:
  #i9860# Top border for tables, 2008-06-06)

- The Word UI creates table borders by default, so the majority of the
  DOCX documents also want this inferring

An alternative could be to only do such inferring for Word documents
with a compat flag, but that looks poor, given that Word doesn't always
do such inferring itself, either.

Change-Id: I052e4591e99d066c3109e8ab8b590e97c8aebd36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159429
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/split-table-merged-border.odt 
b/sw/qa/core/layout/data/split-table-merged-border.odt
new file mode 100644
index ..122bfd473c7c
Binary files /dev/null and 
b/sw/qa/core/layout/data/split-table-merged-border.odt differ
diff --git a/sw/qa/core/layout/paintfrm.cxx b/sw/qa/core/layout/paintfrm.cxx
index ad09405fe3fb..baa858020acf 100644
--- a/sw/qa/core/layout/paintfrm.cxx
+++ b/sw/qa/core/layout/paintfrm.cxx
@@ -109,6 +109,55 @@ CPPUNIT_TEST_FIXTURE(Test, testRTLBorderMerge)
 // i.e. the 2nd and 5th vertical border was missing.
 CPPUNIT_ASSERT_EQUAL(6, nVerticalBorders);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitTableMergedBorder)
+{
+// Given a document with a split table, first row in frame 1 has merged 
cells:
+createSwDoc("split-table-merged-border.odt");
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwDocShell* pShell = pTextDoc->GetDocShell();
+
+// When rendering that document:
+std::shared_ptr xMetaFile = pShell->GetPreviewMetaFile();
+
+// Then make sure that the master table has a bottom border with the 
correct widths:
+MetafileXmlDump aDumper;
+xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile);
+xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, 
"//polyline[@style='solid']/point");
+xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
+std::set aHorizontalBorderStarts;
+std::set aHorizontalBorderEnds;
+// Collect the horizontal borders:
+for (int i = 0; i < xmlXPathNodeSetGetLength(pXmlNodes); i += 2)
+{
+xmlNodePtr pStart = pXmlNodes->nodeTab[i];
+xmlNodePtr pEnd = pXmlNodes->nodeTab[i + 1];
+xmlChar* pStartY = xmlGetProp(pStart, BAD_CAST("y"));
+xmlChar* pEndY = xmlGetProp(pEnd, BAD_CAST("y"));
+sal_Int32 nStartY = o3tl::toInt32(reinterpret_cast(pStartY));
+sal_Int32 nEndY = o3tl::toInt32(reinterpret_cast(pEndY));
+if (nStartY != nEndY)
+{
+// Vertical border.
+continue;
+}
+
+xmlChar* pStartX = xmlGetProp(pStart, BAD_CAST("x"));
+xmlChar* pEndX = xmlGetProp(pEnd, BAD_CAST("x"));
+sal_Int32 nStartX = o3tl::toInt32(reinterpret_cast(pStartX));
+sal_Int32 nEndX = o3tl::toInt32(reinterpret_cast(pEndX));
+aHorizontalBorderStarts.insert(nStartX);
+aHorizontalBorderEnds

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-14 Thread Miklos Vajna (via logerrit)
 sw/qa/uitest/ui/frmdlg/frmdlg.py   |5 +
 sw/source/uibase/frmdlg/frmmgr.cxx |4 
 sw/source/uibase/shells/textsh.cxx |   15 ---
 3 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit c1a535ee2db757b2e40683dc918cbad8b7429cfa
Author: Miklos Vajna 
AuthorDate: Tue Nov 14 08:20:47 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 14 09:34:10 2023 +0100

sw floattable, insert UI: fix unexpected border and spacing

Select an inline table (make sure the whole table is selected), insert a
frame, then the frame width is already calculated from the table width,
but an unexpected second frame border / spacing is also added. Given
that the table already has its own border, adding a second border by
default makes no sense.

It's possible to disable default borders in SetFrameSizeFromTable(), but
in case the borders are unchanged, the dialog's output item set will
still contain no border info, so we will still get the default borders.

Fix the problem by making this explicit: if the dialog's input item set
had border info and the output item set had none, then still copy over
the border info from the input to the output in
SwTextShell::ExecInsert().

This automatically fixes the unwanted border spacing as well, so the
default frame properties are on par with the ones created by Word import
filters.

Change-Id: I4c9f165dad7a8bb70cfcfadaea4466a8d174b46e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159399
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index bbb9d9a270dd..51b6f6e53199 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -98,6 +98,11 @@ class Test(UITestCase):
 # inserted first, only then it could be marked as "split allowed".
 self.assertEqual(fly_split_visible, True)
 
+# Without the accompanying fix in place, this test would have 
failed with:
+# AssertionError: 2 != 0
+# i.e. the frame had a border by default when the table already 
had its own border.
+
self.assertEqual(xComponent.TextFrames.Frame1.LeftBorder.LineWidth, 0)
+
 def test_insert_simple_frame(self):
 # Given a Writer document:
 with self.ui_test.create_doc_in_start_center("writer") as xComponent:
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx 
b/sw/source/uibase/frmdlg/frmmgr.cxx
index eb38c1c803f7..cdfeb267b990 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -666,6 +666,10 @@ void SwFlyFrameAttrMgr::SetFrameSizeFromTable()
 // The whole table is selected: default fly width should be the table width
 // in this case.
 m_aSet.Put(pTableFormat->GetFrameSize());
+
+// The table can have its own border already, so an additional fly border 
makes no sense.
+SvxBoxItem aBoxItem(RES_BOX);
+m_aSet.Put(aBoxItem);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index d0c9aabc979f..0924935b3d7e 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -531,7 +531,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
   GetView().GetViewFrame(),
   GetView().GetFrameWeld(),
   aSet));
-pDlg->StartExecuteAsync([pDlg, nSlot, this](sal_Int32 nResult) {
+pDlg->StartExecuteAsync([aSet, pDlg, nSlot, this](sal_Int32 
nResult) {
 if (nResult == RET_OK && pDlg->GetOutputItemSet())
 {
 SwFlyFrameAttrMgr aAttrMgr( true, GetShellPtr(), 
Frmmgr_Type::TEXT, nullptr );
@@ -541,8 +541,17 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
 rShell.StartAllAction();
 rShell.StartUndo(SwUndoId::INSERT);
 
-const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
-aAttrMgr.SetAttrSet(*pOutSet);
+SfxItemSet aOutSet(*pDlg->GetOutputItemSet());
+const SvxBoxItem* pBox = aSet.GetItem(RES_BOX);
+if (pBox && !aOutSet.HasItem(RES_BOX))
+{
+// The input set had border info but the output set 
not, then copy it over
+// to not lose the custom border info. This can happen 
when a whole table
+// is selected and that case has its own defaults, not 
matching the frame
+// style.
+aOutSet.Put(*pBox);
+}
+aAttrMgr.SetAttrSet(aOutSet);
 
 // At first delete the selection at the ClickTo

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-13 Thread Miklos Vajna (via logerrit)
 sw/qa/core/doc/doc.cxx|   43 ++
 sw/source/core/doc/doclay.cxx |   13 
 2 files changed, 48 insertions(+), 8 deletions(-)

New commits:
commit 6c761fa3b40d296444681d8d2f991e5a6b7e5b71
Author: Miklos Vajna 
AuthorDate: Mon Nov 13 08:49:43 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 13 10:24:26 2023 +0100

sw floattable, insert UI: fix missing undo/redo

There were 3 problems here:

1) SwDoc::MakeFlyAndMove() declared that inserting fly frames is broken
   anyway, so just deleted the whole undo stack. Remove the
   DelAllUndoObj() call, so the underlying problem is visible.

2) MoveNodeRange() had a flag to create undo objects, but this flag
   wasn't used.

3) The empty text node after the table in the just created fly was
   removed using a call to SwNodes::Delete(), which is not undo-aware,
   so the table was inserted after the anchor (and not before the anchor)
   on undo. Fix this by going via sw::DocumentContentOperationsManager that
   knows how to delete while working with the undo.

Do this unconditionally, because the 2 callers of this function is just
SwFEShell::NewFlyFrame() (UI) and SwXFrame::attachToRange() (UNO API,
mostly the DOCX import), probably both want proper undo support.

Change-Id: I50011bf969ff5636c76a8a0b280193ac6d2b90dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159354
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 2a9870660830..2fad46194174 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /// Covers sw/source/core/doc/ fixes.
 class SwCoreDocTest : public SwModelTestBase
@@ -566,6 +567,48 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testSplitExpandGlossary)
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage2Objs.size());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testSplitFlyInsertUndo)
+{
+// Given a document with an inline table, which is then turned into a 
floating one:
+createSwDoc();
+SwDoc* pDoc = getSwDocShell()->GetDoc();
+sw::FrameFormats& rFlyFormats = 
*pDoc->GetSpzFrameFormats();
+CPPUNIT_ASSERT(rFlyFormats.empty());
+// Insert a table:
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(aTableOptions, /*nRows=*/2, /*nCols=*/1);
+pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+pWrtShell->GoPrevCell();
+pWrtShell->Insert("A1");
+pWrtShell->GoNextCell();
+pWrtShell->Insert("A2");
+// Select cell:
+pWrtShell->SelAll();
+// Select table:
+pWrtShell->SelAll();
+// Wrap the table in a text frame:
+SwFlyFrameAttrMgr aMgr(true, pWrtShell, Frmmgr_Type::TEXT, nullptr);
+pWrtShell->StartAllAction();
+aMgr.InsertFlyFrame(RndStdIds::FLY_AT_PARA, aMgr.GetPos(), aMgr.GetSize());
+pWrtShell->EndAllAction();
+CPPUNIT_ASSERT(!rFlyFormats.empty());
+
+// When undoing the conversion to floating table:
+pDoc->GetUndoManager().Undo();
+
+// Then make sure we don't have a frame anymore:
+// Without the accompanying fix in place, this test would have failed, 
there was no undo action
+// to execute.
+CPPUNIT_ASSERT(rFlyFormats.empty());
+
+// And when redoing the conversion:
+pDoc->GetUndoManager().Redo();
+
+// Then make sure we again have a frame:
+CPPUNIT_ASSERT(!rFlyFormats.empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 516d15aed8ec..2ecea30dc3be 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -389,7 +389,8 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& rPam, 
const SfxItemSet& rS
 GetNodes().MakeTextNode( aRg.aStart.GetNode(),
 GetDfltTextFormatColl() );
 
-getIDocumentContentOperations().MoveNodeRange( aRg, 
oPos->GetNode(), SwMoveFlags::DEFAULT );
+// Create undo actions if undo is enabled.
+getIDocumentContentOperations().MoveNodeRange( aRg, 
oPos->GetNode(), SwMoveFlags::CREATEUNDOOBJ );
 }
 else
 {
@@ -404,13 +405,9 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& 
rPam, const SfxItemSet& rS
 OSL_ENSURE( aIndex.GetNode().GetTextNode(),
 "a TextNode should be here" );
 oPos.reset();   // Deregister index!
-GetNodes().Delete( aIndex );
-
-// This is a hack: whilst FlyFrames/Headers/Footers are not 
undoable we delete all Undo objects
-if( GetIDocumentUndoRedo().DoesUndo

[Libreoffice-commits] core.git: sw/qa

2023-11-11 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 619b0fcef2e645347ba959852748614ba8283d88
Author: Andrea Gelmini 
AuthorDate: Sat Nov 11 15:21:59 2023 +0100
Commit: Julien Nabet 
CommitDate: Sat Nov 11 15:41:53 2023 +0100

Remove exec bits on rtf file

Change-Id: I00f56edefeba01ab75fa504a074a5c99269bcef7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159321
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/rtfimport/data/tdf158044.rtf 
b/sw/qa/extras/rtfimport/data/tdf158044.rtf
old mode 100755
new mode 100644


[Libreoffice-commits] core.git: sw/qa

2023-11-11 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/rtfimport/rtfimport.cxx |   87 ++-
 1 file changed, 47 insertions(+), 40 deletions(-)

New commits:
commit 0d0068f7231e2839c24370c69c9176d353b1945a
Author: Mike Kaganski 
AuthorDate: Sat Nov 11 12:29:52 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 11 12:23:48 2023 +0100

Make the unit test linear and more explicit

In the pevious state, the test would not even fail in case when import
started to drop last paragraphs.

Change-Id: Ic28d059ed41f88c9264743034a5ce5397fff0b2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159317
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 763a7f196c39..604cafe616aa 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1716,47 +1716,54 @@ CPPUNIT_TEST_FIXTURE(Test, test158044Tdf)
 {
 createSwDoc("tdf158044.rtf");
 
-uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
-uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
-  
uno::UNO_QUERY);
-uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
-int paraIndex = 0;
-while (xParaEnum->hasMoreElements())
 {
-uno::Reference 
xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
-sal_Int16 adjust = getProperty(xPropertySet, "ParaAdjust");
-Color fillColor = getProperty(xPropertySet, "FillColor");
-drawing::FillStyle fillStyle = 
getProperty(xPropertySet, "FillStyle");
-uno::Sequence tabStops
-= getProperty>(xPropertySet, 
"ParaTabStops");
-switch (paraIndex)
-{
-case 0:
-CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tabStops.getLength());
-break;
-case 1:
-CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
-CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor);
-break;
-case 2:
-CPPUNIT_ASSERT_EQUAL(sal_Int16(0), adjust);
-break;
-case 3:
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabStops.getLength());
-break;
-case 4:
-CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength());
-CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, fillStyle);
-CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor);
-break;
-case 5:
-CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength());
-CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
-break;
-default:
-break;
-}
-++paraIndex;
+auto xPara(getParagraph(1));
+auto tabStops = getProperty>(xPara, 
"ParaTabStops");
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tabStops.getLength());
+}
+
+{
+auto xPara(getParagraph(2));
+auto fillColor = getProperty(xPara, "FillColor");
+auto fillStyle = getProperty(xPara, "FillStyle");
+
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
+CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor);
+}
+
+{
+auto xPara(getParagraph(3));
+auto adjust = getProperty(xPara, "ParaAdjust");
+
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), adjust);
+}
+
+{
+auto xPara(getParagraph(4));
+auto tabStops = getProperty>(xPara, 
"ParaTabStops");
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabStops.getLength());
+}
+
+{
+auto xPara(getParagraph(5));
+auto fillColor = getProperty(xPara, "FillColor");
+auto fillStyle = getProperty(xPara, "FillStyle");
+auto tabStops = getProperty>(xPara, 
"ParaTabStops");
+
+CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength());
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, fillStyle);
+CPPUNIT_ASSERT_EQUAL(Color(0xff), fillColor);
+}
+
+{
+auto xPara(getParagraph(6));
+auto fillStyle = getProperty(xPara, "FillStyle");
+auto tabStops = getProperty>(xPara, 
"ParaTabStops");
+
+CPPUNIT_ASSERT_LESS(sal_Int32(2), tabStops.getLength());
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
 }
 }
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT


[Libreoffice-commits] core.git: sw/qa

2023-11-11 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/rtfimport/rtfimport.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 42f6e7e5d638bbc3b597b22dbf5689bcbe86292a
Author: Mike Kaganski 
AuthorDate: Sat Nov 11 12:06:25 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 11 12:22:40 2023 +0100

Fix Windows 64-bit build using VS 2022

... after commit fce18155052821756466ea043c638f4ed72f41d6, failing like

  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): error C7692: 
'bool Color::operator ==(const Color &) const': rewritten candidate function 
was excluded from overload resolution because a corresponding operator!= 
declared in the same scope
  C:\lo\src\core\include\vcl/vclenum.hxx(174): note: could be 'bool 
operator ==(const ItalicMatrix &,const ItalicMatrix &)'
  C:\lo\src\core\include\comphelper/errcode.hxx(249): note: or   'bool 
operator ==(ErrCode,const ErrCodeMsg &)'
  C:\lo\src\core\include\comphelper/errcode.hxx(247): note: or   'bool 
operator ==(const ErrCodeMsg &,ErrCode)'
  C:\lo\src\core\include\tools/gen.hxx(536): note: or   'bool operator 
==(const Selection &,const Selection &)'
  C:\lo\src\core\include\tools/gen.hxx(473): note: or   'bool operator 
==(const Range &,const Range &)'
  C:\lo\src\core\include\tools/gen.hxx(365): note: or   'bool operator 
==(const AbsoluteScreenPixelSize &,const AbsoluteScreenPixelSize &)'
  C:\lo\src\core\include\tools/gen.hxx(361): note: or   'bool operator 
==(const Size &,const Size &)'
  C:\lo\src\core\include\tools/gen.hxx(231): note: or   'bool operator 
==(const AbsoluteScreenPixelPoint &,const AbsoluteScreenPixelPoint &)'
  C:\lo\src\core\include\tools/gen.hxx(227): note: or   'bool operator 
==(const Point &,const Point &)'
  C:\lo\src\core\include\tools/color.hxx(256): note: or 'bool 
Color::operator ==(const Color &) const' [synthesized expression 'y == x']
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: 'bool 
Color::operator ==(const Color &) const': rewritten candidate function was 
excluded from overload resolution because a corresponding operator!= declared 
in the same scope
  C:\lo\src\core\include\tools/gen.hxx(227): note: or 'bool operator 
==(const Point &,const Point &)' [synthesized expression 'y == x']
  C:\lo\src\core\include\tools/gen.hxx(231): note: or 'bool operator 
==(const AbsoluteScreenPixelPoint &,const AbsoluteScreenPixelPoint &)' 
[synthesized expression 'y == x']
  C:\lo\src\core\include\tools/gen.hxx(361): note: or 'bool operator 
==(const Size &,const Size &)' [synthesized expression 'y == x']
  C:\lo\src\core\include\tools/gen.hxx(365): note: or 'bool operator 
==(const AbsoluteScreenPixelSize &,const AbsoluteScreenPixelSize &)' 
[synthesized expression 'y == x']
  C:\lo\src\core\include\tools/gen.hxx(473): note: or 'bool operator 
==(const Range &,const Range &)' [synthesized expression 'y == x']
  C:\lo\src\core\include\tools/gen.hxx(536): note: or 'bool operator 
==(const Selection &,const Selection &)' [synthesized expression 'y == x']
  C:\lo\src\core\include\comphelper/errcode.hxx(247): note: or 'bool 
operator ==(const ErrCodeMsg &,ErrCode)' [synthesized expression 'y == x']
  C:\lo\src\core\include\comphelper/errcode.hxx(249): note: or 'bool 
operator ==(ErrCode,const ErrCodeMsg &)' [synthesized expression 'y == x']
  C:\lo\src\core\include\vcl/vclenum.hxx(174): note: or 'bool operator 
==(const ItalicMatrix &,const ItalicMatrix &)' [synthesized expression 'y == x']
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: or   
'built-in C++ operator==(int, sal_uInt32)'
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: or   
'built-in C++ operator==(int, sal_Int32)'
  C:\lo\src\core\include\svl/typedwhich.hxx(59): note: or   'bool 
operator ==(const TypedWhichId &,sal_uInt16)'
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: 'bool 
operator ==(const TypedWhichId &,sal_uInt16)': could not deduce template 
argument for 'const TypedWhichId &' from 'int'
  C:\lo\src\core\include\svl/typedwhich.hxx(51): note: or   'bool 
operator ==(sal_uInt16,const TypedWhichId &)'
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: 'bool 
operator ==(sal_uInt16,const TypedWhichId &)': could not deduce template 
argument for 'const TypedWhichId &' from 'Color'
  C:\lo\src\core\include\svl/typedwhich.hxx(43): note: or   'bool 
operator ==(const TypedWhichId &,TypedWhichId)'
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: 'bool 
operator ==(const TypedWhichId &,TypedWhichId)': could not deduce 
template argument for 'const TypedWhichId &' from 'int'
  C:\lo\src\core\include\vcl/vclptr.hxx(238): note: or   'bool operator 
==(T *,const VclPtr &)'
  C:/lo/src/core/sw/qa/extras/rtfimport/rtfimport.cxx(1739): note: 'bool 
opera

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-11-10 Thread Oliver Specht (via logerrit)
 sw/qa/extras/rtfimport/data/tdf158044.rtf  |   20 +
 sw/qa/extras/rtfimport/rtfimport.cxx   |   47 +
 writerfilter/source/dmapper/DomainMapper.cxx   |   89 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |1 
 writerfilter/source/rtftok/rtfsprm.cxx |9 +-
 5 files changed, 163 insertions(+), 3 deletions(-)

New commits:
commit fce18155052821756466ea043c638f4ed72f41d6
Author: Oliver Specht 
AuthorDate: Thu Nov 2 16:34:50 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Fri Nov 10 22:29:40 2023 +0100

tdf#158044 handling of paragraph attributes in RTF import

style attributes need to be repeated at the paragraph
if not repeated then defaults have to be applied

Change-Id: I4ee567e8006c240c046b7e7bb75eae92e5563776
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158839
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/rtfimport/data/tdf158044.rtf 
b/sw/qa/extras/rtfimport/data/tdf158044.rtf
new file mode 100755
index ..65e687f25d39
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf158044.rtf
@@ -0,0 +1,20 @@
+{\rtf1\ansi
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;
+\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;
+\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red0\green0\blue0;\red0\green0\blue0;}
+
+{\stylesheet
+{\fs24\sa3200 Normal;}
+{\s97\tx1701\tx2835 StyleTabstops;}
+{\s98\cbpat6  StyleRed;}
+{\s99\qc SyleCentered;}
+}
+
+
+{\s97 Paragraph without tabstops\par}
+{\s98 Pargraph without color \par}
+{\s99 Paragraph without center\par}
+{\s97\tx1701\tx2835 Paragraph with tabstops\par}
+{\s98\cbpat6  Pargraph with color \par}
+{\s99\qc Paragraph with center\par}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 78409762e827..b1b00cf2b1b4 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1712,6 +1712,53 @@ CPPUNIT_TEST_FIXTURE(Test, testParaStyleBottomMargin)
  getProperty(xPara, 
"ParaLineSpacing").Height);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, test158044Tdf)
+{
+createSwDoc("tdf158044.rtf");
+
+uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xParaEnumAccess(xTextDocument->getText(),
+  
uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+int paraIndex = 0;
+while (xParaEnum->hasMoreElements())
+{
+uno::Reference 
xPropertySet(xParaEnum->nextElement(), uno::UNO_QUERY);
+sal_Int16 adjust = getProperty(xPropertySet, "ParaAdjust");
+Color fillColor = getProperty(xPropertySet, "FillColor");
+drawing::FillStyle fillStyle = 
getProperty(xPropertySet, "FillStyle");
+uno::Sequence tabStops
+= getProperty>(xPropertySet, 
"ParaTabStops");
+switch (paraIndex)
+{
+case 0:
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), tabStops.getLength());
+break;
+case 1:
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
+CPPUNIT_ASSERT(0xff == fillColor);
+break;
+case 2:
+CPPUNIT_ASSERT_EQUAL(sal_Int16(0), adjust);
+break;
+case 3:
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2), tabStops.getLength());
+break;
+case 4:
+CPPUNIT_ASSERT(tabStops.getLength() < 2);
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, fillStyle);
+CPPUNIT_ASSERT(0xff == fillColor);
+break;
+case 5:
+CPPUNIT_ASSERT(tabStops.getLength() < 2);
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, fillStyle);
+break;
+default:
+break;
+}
+++paraIndex;
+}
+}
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f015b79520bf..a2399e44bf37 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3845,6 +3846,35 @@ void DomainMapper::lcl_endCharacterGroup()
 m_pImpl->PopProperties(CONTEXT_CHARACTER);
 }
 
+//copied from rtfsprm
+/// Is it problematic to deduplicate this SPRM?
+static bool isSPRMDeduplicateDenylist(PropertyIds nId, PropertyMapPtr pContext)
+{
+switch 

[Libreoffice-commits] core.git: sw/qa

2023-11-10 Thread Noel Grandin (via logerrit)
 sw/qa/extras/mailmerge/mailmerge.cxx  |  100 ++
 sw/qa/extras/mailmerge/mailmerge2.cxx |   55 +++---
 2 files changed, 65 insertions(+), 90 deletions(-)

New commits:
commit 6976c0ad33d44213417e88dc1aada88c6a5b2d8f
Author: Noel Grandin 
AuthorDate: Thu Nov 9 15:45:46 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 10 17:03:20 2023 +0100

loplugin:fieldcast in mailmerge unit tests

Change-Id: I3c5f31848ea572678a6ba85463ebda04b882eeaa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159303
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 5cec05290685..62d7d19fbbc4 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -49,16 +49,12 @@ public:
 
 virtual void tearDown() override
 {
-if (mxMMComponent.is())
+if (mxSwTextDocument.is())
 {
 if (mnCurOutputType == text::MailMergeType::SHELL)
-{
-SwXTextDocument* pTextDoc = 
dynamic_cast(mxMMComponent.get());
-CPPUNIT_ASSERT(pTextDoc);
-pTextDoc->GetDocShell()->DoClose();
-}
+mxSwTextDocument->GetDocShell()->DoClose();
 else
-mxMMComponent->dispose();
+mxSwTextDocument->dispose();
 }
 if (mxCurResultSet.is())
 {
@@ -219,8 +215,10 @@ public:
 
 if (mnCurOutputType == text::MailMergeType::SHELL)
 {
-CPPUNIT_ASSERT(res >>= mxMMComponent);
-CPPUNIT_ASSERT(mxMMComponent.is());
+uno::Reference< lang::XComponent > xTmp;
+CPPUNIT_ASSERT(res >>= xTmp);
+mxSwTextDocument = dynamic_cast(xTmp.get());
+CPPUNIT_ASSERT(mxSwTextDocument.is());
 }
 else
 {
@@ -284,7 +282,7 @@ public:
 void dumpMMLayout()
 {
 mpXmlBuffer = xmlBufferPtr();
-dumpLayout(mxMMComponent);
+dumpLayout(static_cast(mxSwTextDocument.get()));
 }
 
 protected:
@@ -297,7 +295,7 @@ protected:
 OUString msMailMergeOutputURL;
 OUString msMailMergeOutputPrefix;
 sal_Int16 mnCurOutputType;
-uno::Reference< lang::XComponent > mxMMComponent;
+rtl::Reference< SwXTextDocument > mxSwTextDocument;
 uno::Reference< sdbc::XRowSet > mxCurResultSet;
 const char* maMMtestFilename;
 };
@@ -333,9 +331,8 @@ protected:
 
 int MMTest::documentStartPageNumber( int document ) const
 {   // See documentStartPageNumber() .
-SwXTextDocument* pTextDoc = dynamic_cast(mxMMComponent.get());
-CPPUNIT_ASSERT(pTextDoc);
-SwWrtShell* shell = pTextDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(mxSwTextDocument);
+SwWrtShell* shell = mxSwTextDocument->GetDocShell()->GetWrtShell();
 IDocumentMarkAccess* marks = shell->GetDoc()->getIDocumentMarkAccess();
 // Unfortunately, the pages are marked using UNO bookmarks, which have 
internals names, so they cannot be referred to by their names.
 // Assume that there are no other UNO bookmarks than the ones used by mail 
merge, and that they are in the sorted order.
@@ -366,13 +363,11 @@ DECLARE_SHELL_MAILMERGE_TEST(testMultiPageAnchoredDraws, 
"multiple-page-anchored
 {
 executeMailMerge();
 
-SwXTextDocument* pTextDoc = dynamic_cast(mxMMComponent.get());
-CPPUNIT_ASSERT(pTextDoc);
-sal_uInt16 nPhysPages = 
pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum();
+CPPUNIT_ASSERT(mxSwTextDocument);
+sal_uInt16 nPhysPages = 
mxSwTextDocument->GetDocShell()->GetWrtShell()->GetPhyPageNum();
 CPPUNIT_ASSERT_EQUAL(sal_uInt16(8), nPhysPages);
 
-uno::Reference 
xDrawPageSupplier(mxMMComponent, uno::UNO_QUERY);
-uno::Reference xDraws = 
xDrawPageSupplier->getDrawPage();
+uno::Reference xDraws = 
mxSwTextDocument->getDrawPage();
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount());
 
 std::set pages;
@@ -497,9 +492,8 @@ 
DECLARE_SHELL_MAILMERGE_TEST(testPageBoundariesSimpleMailMerge, "simple-mail-mer
 // documentStartPageNumber() ).
 executeMailMerge();
 // Here getPages() works on the source document, so get pages of the 
resulting one.
-SwXTextDocument* pTextDoc = dynamic_cast(mxMMComponent.get());
-CPPUNIT_ASSERT(pTextDoc);
-CPPUNIT_ASSERT_EQUAL( sal_uInt16( 19 ), 
pTextDoc->GetDocShell()->GetWrtShell()->GetPhyPageNum()); // 10 pages, but each 
sub-document starts on odd page number
+CPPUNIT_ASSERT(mxSwTextDocument);
+CPPUNIT_ASSERT_EQUAL( sal_uInt16( 19 ), 
mxSwTextDocument->GetDocShell()->GetWrtShell()->GetPhyPageNum()); // 10 pages, 
but each sub-document starts on odd page number
 for( int doc = 0;
  doc < 10;
  ++doc )
@@ -511,9 +505,8 @@ 
DECLARE_SHELL_MAILMERGE_TEST(testPageBoundariesSimpleMailMerge, "simple-mail-mer
 DECLARE_SHELL_MAILMERGE_TEST(testPageBoundaries2Pages, 
"simple-m

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-10 Thread Miklos Vajna (via logerrit)
 sw/qa/uitest/ui/frmdlg/frmdlg.py   |   12 
 sw/source/ui/frmdlg/frmpage.cxx|1 -
 sw/source/uibase/shells/textsh.cxx |6 ++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 8d973c5b9405bfa6964d3dfebd0017fd60ec3eca
Author: Miklos Vajna 
AuthorDate: Fri Nov 10 10:17:16 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 10 13:49:10 2023 +0100

sw floattable, insert UI: default to at-char for non-split flys

Inserting new images defaulted to the at-char anchor type, but inserting
a new frame defaulted to at-para, which is inconsistent. This is now more
visible, since LOK exposes the insert frame dialog.

An additional problem is that the LOK case hides anything other than
at-char and as-char in the frame properties dialog since commit
4154d281fbecaadf6cd118c00cc6cff929e339a4 (sw lok: hide UI to set
Word-incompatible anchor types, 2019-07-05), which was intended for
images, but also affects text frames as well. But floating tables want
to-para anchored frames to be able to split.

Fix the problem by defaulting to at-char anchoring, unless we deal with
floating tables.

And show the to-para anchor widget in the LOK case again, given that all
of to-para, to-char and as-char have their use-cases, even when editing
Word documents.

Change-Id: I89b0973183a750d86f56e0cccd7b0fbcb3dc070d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159261
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index 4a438895572b..bbb9d9a270dd 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -98,4 +98,16 @@ class Test(UITestCase):
 # inserted first, only then it could be marked as "split allowed".
 self.assertEqual(fly_split_visible, True)
 
+def test_insert_simple_frame(self):
+# Given a Writer document:
+with self.ui_test.create_doc_in_start_center("writer") as xComponent:
+# When inserting a simple text frame (not a floating table):
+with 
self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog:
+to_char = xDialog.getChild("tochar")
+to_char_enabled = get_state_as_dict(to_char)["Checked"] == 
"true"
+# Then make sure the anchor type is to-char, matching the default 
anchor for images:
+# This failed, text frames defaulted to to-para, images defaulted 
to to-char, which was
+# inconsistent.
+self.assertTrue(to_char_enabled)
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 911df55f66d7..bdf1c90291ff 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -721,7 +721,6 @@ SwFramePage::SwFramePage(weld::Container* pPage, 
weld::DialogController* pContro
 if (comphelper::LibreOfficeKit::isActive())
 {
 m_xAnchorAtPageRB->hide();
-m_xAnchorAtParaRB->hide();
 m_xAnchorAtFrameRB->hide();
 }
 }
diff --git a/sw/source/uibase/shells/textsh.cxx 
b/sw/source/uibase/shells/textsh.cxx
index c9e0e8a4d6f9..d0c9aabc979f 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -918,6 +918,12 @@ SfxItemSet 
SwTextShell::CreateInsertFrameItemSet(SwFlyFrameAttrMgr& rMgr)
 aBoxInfo.SetDefDist(rBox.GetDistance(SvxBoxItemLine::LEFT));
 aSet.Put(aBoxInfo);
 
+if (!SwFlyFrameAttrMgr::SingleTableSelected(GetShell()))
+{
+SwFormatAnchor aAnchor(RndStdIds::FLY_AT_CHAR);
+aSet.Put(aAnchor);
+}
+
 return aSet;
 }
 


[Libreoffice-commits] core.git: sw/qa

2023-11-10 Thread Stephan Bergmann (via logerrit)
 sw/qa/uitest/navigator/tdf154521.py |  137 ++--
 1 file changed, 69 insertions(+), 68 deletions(-)

New commits:
commit 2368e09cd13aa58d597470f73fb0f2e181e1929c
Author: Stephan Bergmann 
AuthorDate: Fri Nov 10 08:12:50 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 10 10:45:31 2023 +0100

Disable flakey navigator UITest again

f2ba17fecb60d936599efb975d96a3ea06c2a43f "disable more flakey navigator 
UITest",
then 0a0c5a5b0521bea6cb695731d448e62c41ed4c57 "UITest_sw_navigator: avoid
oneprocess" enabled it again, apparently in the false hopes that 
non-oneprocess
would magically fix this issue.  But this still hangs frequently, e.g.
 hung here 
(and
got killed by kill-wrapper) with the python.bin process at

> Thread 1 (Thread 0x7f85438bbb80 (LWP 217701) "python3"):
> Traceback (most recent call first):
>   
>   File 
"/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/uitest/uitest/test.py",
 line 72, in wait_until_property_is_updated
> time.sleep(DEFAULT_SLEEP)
>   File 
"/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/sw/qa/uitest/navigator/tdf154521.py",
 line 158, in test_query_selected_bookmark
> self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
>   File "/usr/lib64/python3.6/unittest/case.py", line 622, in run
> testMethod()
>   File "/usr/lib64/python3.6/unittest/case.py", line 670, in __call__
> return self.run(*args, **kwds)
>   File "/usr/lib64/python3.6/unittest/suite.py", line 122, in run
> test(result)
>   File "/usr/lib64/python3.6/unittest/suite.py", line 84, in __call__
> return self.run(*args, **kwds)
>   File "/usr/lib64/python3.6/unittest/runner.py", line 176, in run
> test(result)
>   File 
"/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/uitest/test_main.py", 
line 138, in 
> result = unittest.TextTestRunner(stream=sys.stdout, 
verbosity=2).run(test_suite)

and the soffice.bin process just idling with nothing going on.

Change-Id: I44a38b12050cfe2cf4831631406df9018018e2ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159260
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/uitest/navigator/tdf154521.py 
b/sw/qa/uitest/navigator/tdf154521.py
index 7b2125646ec6..048efb0212c2 100644
--- a/sw/qa/uitest/navigator/tdf154521.py
+++ b/sw/qa/uitest/navigator/tdf154521.py
@@ -130,73 +130,74 @@ class tdf154521(UITestCase):
 
 xContentTree = xNavigatorPanel.getChild("contenttree")
 
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 1")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
1")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-
-#self.xUITest.executeCommand(".uno:Escape")
-
-# get the title of SwNavigatorPanel with emptying it to access to 
the selected bookmark
-self.assertEqual(self.getTitle(xDoc), "Navigator")
-# title was emptied
-self.assertEqual(self.getTitle(xDoc), "")
-
-# Select nested bookmark in Navigator
-
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-
-# This jumped to Bookmark 1 after selection
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 1")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
1")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-
-# This was "Navigator"
-self.assertEqual(self.getTitle(xDoc), "Bookmark 1")
-
-# Try the same selection with Bookmark 2
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-
-# This was "Navigator"
-self.assertEqual(self.getTitle(xDoc), "Bookmark 2")
-
-# Try the same selection with Bookmark 3
-
-# why we need this extra UP?
-xContentTree.executeAction("TYPE", mkPropertyValues

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-11-10 Thread Michael Stahl (via logerrit)
 sw/qa/extras/rtfexport/data/tdf153178.rtf  |7 +++
 sw/qa/extras/rtfexport/rtfexport7.cxx  |   10 ++
 writerfilter/source/rtftok/rtfdispatchflag.cxx |   20 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +++---
 4 files changed, 40 insertions(+), 3 deletions(-)

New commits:
commit 4e2f2489c4c7436f8b3a21a530bc625cbef4e365
Author: Michael Stahl 
AuthorDate: Thu Nov 9 19:54:19 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 10 10:33:54 2023 +0100

tdf#153178 writerfilter: do not create text frame spuriously

There are different RTF keywords that end up in RTFFrame, and some of
them cause Word to create a frame, while others don't.

Getting this right requires implementing support for all the missing
wrapping keywords, as most of them create a frame in Word but
\wrapdefault does not.

Change-Id: I1e55d15180564f3d66a5ee7d98274ae18f032872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159228
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfexport/data/tdf153178.rtf 
b/sw/qa/extras/rtfexport/data/tdf153178.rtf
new file mode 100644
index ..e1d74f4010ea
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf153178.rtf
@@ -0,0 +1,7 @@
+{\rtf1
+\tqr\tlul\tx2025\dxfrtext142\dfrmtxtx142\dfrmtxty142\wrapdefault\faauto\adjustright\rin0\lin57\itap0
 \rtlch\fcs1 \afs26\alang1025 \ltrch\fcs0 
\fs26\lang1031\langfe3079\cgrid\langnp1031\langfenp3079
+
+\par
+\pard
+\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx 
b/sw/qa/extras/rtfexport/rtfexport7.cxx
index ad9249bedeb8..4d1550af4fdd 100644
--- a/sw/qa/extras/rtfexport/rtfexport7.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport7.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -659,6 +660,15 @@ DECLARE_RTFEXPORT_TEST(testWatermark, "watermark.rtf")
 CPPUNIT_ASSERT_EQUAL(float(66), nFontSize);
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf153178, "tdf153178.rtf")
+{
+// the problem was that a frame was created
+uno::Reference xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf109790, "tdf109790.rtf")
 {
 uno::Reference xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx 
b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index de7b91e26fae..699698aa8df8 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1242,6 +1242,26 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword 
nKeyword)
 m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,

NS_ooxml::LN_Value_doc_ST_Wrap_notBeside);
 break;
+case RTFKeyword::OVERLAY:
+m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+   
NS_ooxml::LN_Value_doc_ST_Wrap_none);
+break;
+case RTFKeyword::WRAPAROUND:
+m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+   
NS_ooxml::LN_Value_doc_ST_Wrap_around);
+break;
+case RTFKeyword::WRAPTHROUGH:
+m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+   
NS_ooxml::LN_Value_doc_ST_Wrap_through);
+break;
+case RTFKeyword::WRAPTIGHT:
+m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+   
NS_ooxml::LN_Value_doc_ST_Wrap_tight);
+break;
+case RTFKeyword::WRAPDEFAULT:
+m_aStates.top().getFrame().setSprm(NS_ooxml::LN_CT_FramePr_wrap,
+   
NS_ooxml::LN_Value_doc_ST_Wrap_auto);
+break;
 case RTFKeyword::MNOR:
 m_bMathNor = true;
 break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 568ad4a8f31f..11e251b0828a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3995,9 +3995,9 @@ RTFSprms RTFFrame::getSprms()
 
 bool RTFFrame::hasProperties() const
 {
-return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0 || m_nHoriPadding 
!= 0
-   || m_nVertPadding != 0 || m_nHoriAlign != 0 || m_nHoriAnchor != 0 
|| m_nVertAlign != 0
-   || m_nVertAnchor != 0;
+// tdf#153178 \dxfrtext \dfrmtxtx \dfrmtxty \wrapdefault do *not* create 
frame
+return m_nX != 0 || m_nY != 0 || m_nW != 0 || m_nH != 0
+   || (m_oWrap && *m_oWrap !=

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-09 Thread Miklos Vajna (via logerrit)
 sw/qa/uitest/ui/frmdlg/frmdlg.py   |   20 +++-
 sw/source/ui/frmdlg/frmpage.cxx|   16 +++-
 sw/source/uibase/frmdlg/frmmgr.cxx |   25 ++---
 sw/source/uibase/inc/frmmgr.hxx|2 ++
 4 files changed, 54 insertions(+), 9 deletions(-)

New commits:
commit e306352b9ddd8bddfc37f0cfaac078d9260650d6
Author: Miklos Vajna 
AuthorDate: Thu Nov 9 08:51:59 2023 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 9 11:37:33 2023 +0100

sw floattable, insert UI: allow direct creation of floating tables

The frame insert UI could move a table into a new fly, and then the
frame properties allowed marking this fly as a split fly, but not in one
step.

This happened because the "split fly" checkbox is only visible when we
have a fly that has exactly 1 table, but the "new frame" dialog has no
fly as it still has to be created.

Fix the problem by showing the "split fly" checkbox if we don't have a
fly, but a single table is selected, because we know
SwDoc::MakeFlyAndMove() will create a fly that has exactly one table in
it.

Extract the common code to a new
SwFlyFrameAttrMgr::SingleTableSelected() to avoid copy&paste.

Change-Id: I24129e3fb4cb6231fb10b0adda53c205dfd90d62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159201
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index e30b67ff5313..4a438895572b 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -17,7 +17,7 @@ from uitest.uihelper.common import get_url_for_data_file
 
 
 class Test(UITestCase):
-def test_content_control_dialog(self):
+def test_uno_frame_dialog(self):
 with self.ui_test.create_doc_in_start_center("writer") as xComponent:
 # Given a document with a floating table:
 args = {
@@ -80,4 +80,22 @@ class Test(UITestCase):
 # i.e. the width was empty instead of the size from the UI.
 self.assertEqual(xComponent.TextFrames.Frame1.Size.Width, 
expected_mm100)
 
+def test_insert_floating_table(self):
+with self.ui_test.create_doc_in_start_center("writer") as xComponent:
+# Given a Writer document with a selected (inline) table:
+args = {
+"Columns": 1,
+"Rows": 1,
+}
+self.xUITest.executeCommandWithParameters(".uno:InsertTable", 
mkPropertyValues(args))
+self.xUITest.executeCommand(".uno:SelectAll")
+# When converting it to a split fly:
+with 
self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog:
+xFlySplit = xDialog.getChild("flysplit")
+fly_split_visible = get_state_as_dict(xFlySplit)["Visible"] == 
"true"
+# Then make sure the inserted fly can be marked as "split allowed":
+# Without the accompanying fix in place, this test would have 
failed, the fly had to be
+# inserted first, only then it could be marked as "split allowed".
+self.assertEqual(fly_split_visible, True)
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index b38ac22d0d11..911df55f66d7 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1050,9 +1050,23 @@ void SwFramePage::Reset( const SfxItemSet *rSet )
 const SwFrameFormat* pFlyFormat = pSh->GetFlyFrameFormat();
 if (!pFlyFormat || !ContainsSingleTable(*pFlyFormat) || 
ContainsChain(*pFlyFormat))
 {
+bool bSingleTable = false;
+if (!pFlyFormat && m_bNew)
+{
+// No fly is selected: check if a whole table is selected. If so, 
allow moving that into
+// a split fly.
+if (SwFlyFrameAttrMgr::SingleTableSelected(*pSh))
+{
+bSingleTable = true;
+}
+}
+
 // Only allow fly split if the frame contains a single table, 
otherwise it would be hard to
 // save the resulting model to Word formats.
-m_xFlySplitCB->hide();
+if (!bSingleTable)
+{
+m_xFlySplitCB->hide();
+}
 }
 
 Init(*rSet);
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx 
b/sw/source/uibase/frmdlg/frmmgr.cxx
index a71b7ef3fb0a..eb38c1c803f7 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -625,36 +625,47 @@ void SwFlyFrameAttrMgr::SetAttrSet(const SfxItemSet& rSet)
 m_aSet.Put( rSet );
 }
 
-void SwFlyFrameAttrMgr::SetFrameSizeFromTable()
+const SwTableFormat* SwFlyFrameAttrMgr::SingleTableSelected(SwWrtShell& 
rWrtShell)
 {
-if (!m_pOwnSh->IsTableMode())
+if (!rWrtShell.IsTableMode())
 {
-return;
+return nullptr;
 }
 
 // We have a table selection

[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-08 Thread Miklos Vajna (via logerrit)
 sw/qa/uibase/frmdlg/frmdlg.cxx |   45 +
 sw/source/uibase/frmdlg/frmmgr.cxx |   35 
 sw/source/uibase/inc/frmmgr.hxx|1 
 3 files changed, 81 insertions(+)

New commits:
commit 0ecb69d53864b582eb59533729ada01d85d383e6
Author: Miklos Vajna 
AuthorDate: Wed Nov 8 08:25:23 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 8 10:17:09 2023 +0100

sw floattable, insert UI: inherit fly width from selected table width

Inline table width defaults to the body frame width, so a hardcoded 2cm
default for the fly width is a bit poor.

Leave the normal fly insert case unchanged, but if an entire table is
selected, then change the default to the table width.

Check for the table selection like SwFEShell::NewFlyFrame() does it, and
determine if the entire table is selected like SwDoc::MakeFlyAndMove()
does it.

With this, a default table with a default frame keeps its width on frame
insert.

Change-Id: Iaf954395a4799222074acd83b5eae52ca75ae0ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159104
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/uibase/frmdlg/frmdlg.cxx b/sw/qa/uibase/frmdlg/frmdlg.cxx
index f6b7653de824..81a7746170c1 100644
--- a/sw/qa/uibase/frmdlg/frmdlg.cxx
+++ b/sw/qa/uibase/frmdlg/frmdlg.cxx
@@ -13,6 +13,11 @@
 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+
 /// Covers sw/source/uibase/frmdlg/ fixes.
 class SwUibaseFrmdlgTest : public SwModelTestBase
 {
@@ -60,6 +65,46 @@ CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, 
testAnchorTypeFromStyle)
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, eActual);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUibaseFrmdlgTest, testInsertFrameWidth)
+{
+// Given a document with an inline table, its width is set to 6000 twips:
+createSwDoc();
+// Insert a table:
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+SwInsertTableOptions aTableOptions(SwInsertTableFlags::DefaultBorder, 0);
+pWrtShell->InsertTable(aTableOptions, /*nRows=*/1, /*nCols=*/1);
+pWrtShell->MoveTable(GotoPrevTable, fnTableStart);
+SwTwips nExpectedWidth = 6000;
+{
+SfxItemSetFixed 
aSet(pWrtShell->GetAttrPool());
+SwFormatFrameSize aSize(SwFrameSize::Variable, nExpectedWidth);
+aSet.Put(aSize);
+pWrtShell->SetTableAttr(aSet);
+}
+pWrtShell->GoPrevCell();
+pWrtShell->Insert("A1");
+SwFormatFrameSize aRowSize(SwFrameSize::Minimum);
+pWrtShell->SetRowHeight(aRowSize);
+pWrtShell->GoNextCell();
+pWrtShell->Insert("A2");
+pWrtShell->SetRowHeight(aRowSize);
+// Select cell:
+pWrtShell->SelAll();
+// Select table:
+pWrtShell->SelAll();
+
+// When converting that table to a floating table:
+SwFlyFrameAttrMgr aMgr(/*bNew=*/true, pWrtShell, Frmmgr_Type::TEXT, 
nullptr);
+
+// Then make sure that the fly width will be based on the table width:
+const SwFormatFrameSize* pFrameSize = 
aMgr.GetAttrSet().GetItem(RES_FRM_SIZE);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 6000 (nExpectedWidth)
+// - Actual  : 1134 (2cm)
+// i.e. the fly width was the default, not inherited from the selected 
table.
+CPPUNIT_ASSERT_EQUAL(nExpectedWidth, pFrameSize->GetWidth());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx 
b/sw/source/uibase/frmdlg/frmmgr.cxx
index 729892398997..a71b7ef3fb0a 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -84,6 +84,9 @@ SwFlyFrameAttrMgr::SwFlyFrameAttrMgr( bool bNew, SwWrtShell* 
pSh, Frmmgr_Type nT
 }
 m_aSet.SetParent( &m_pOwnSh->GetFormatFromPool( nId )->GetAttrSet());
 m_aSet.Put( SwFormatFrameSize( SwFrameSize::Minimum, DFLT_WIDTH, 
DFLT_HEIGHT ));
+
+SetFrameSizeFromTable();
+
 if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) )
 m_aSet.Put( SwFormatHoriOrient( 0, text::HoriOrientation::LEFT, 
text::RelOrientation::PRINT_AREA ) );
 
@@ -622,4 +625,36 @@ void SwFlyFrameAttrMgr::SetAttrSet(const SfxItemSet& rSet)
 m_aSet.Put( rSet );
 }
 
+void SwFlyFrameAttrMgr::SetFrameSizeFromTable()
+{
+if (!m_pOwnSh->IsTableMode())
+{
+return;
+}
+
+// We have a table selection.
+SwSelBoxes aBoxes;
+GetTableSel(*m_pOwnSh, aBoxes);
+if (aBoxes.empty())
+{
+return;
+}
+
+auto pTableNd = 
const_cast(aBoxes[0]->GetSttNd()->FindTableNode());
+if (!pTableNd)
+{
+return;
+}
+
+SwTable& rTable = pTableNd->GetTable();
+if (aBoxes.size() != rTable.GetTabSortBoxes().size())
+{
+return;
+}
+
+// The whole table is selected: default fly width should be the table width
+// in this case.
+m_aSet.Put(rTable.GetFrameForm

[Libreoffice-commits] core.git: sw/qa

2023-11-07 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/mailmerge/mailmerge.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit ea7233bc1174b781c809db55d2c55af0011ce0e0
Author: Miklos Vajna 
AuthorDate: Tue Nov 7 20:11:43 2023 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 8 08:08:11 2023 +0100

CppunitTest_sw_mailmerge: clean up not needed preTest()

1) preTest() retuns a unique_ptr which has to be hold till the test
   runs, which didn't happen here.

2) This was just copy&paste probably, since preTest() is not overwritten
   in this suite.

Change-Id: Ib391f68d5dccb02ba6c42a298d1c86fe29c8606c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159081
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx 
b/sw/qa/extras/mailmerge/mailmerge.cxx
index 2b0881850207..5cec05290685 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -82,7 +82,6 @@ public:
 {
 maMMtestFilename = filename;
 header();
-preTest(filename);
 
 utl::TempFileNamed aTempDir(nullptr, true);
 aTempDir.EnableKillingFile();


[Libreoffice-commits] core.git: sw/qa sw/source sw/UITest_sw_ui_frmdlg.mk

2023-11-07 Thread Miklos Vajna (via logerrit)
 sw/UITest_sw_ui_frmdlg.mk|2 ++
 sw/qa/uitest/ui/frmdlg/frmdlg.py |   18 ++
 sw/source/ui/frmdlg/frmpage.cxx  |8 +++-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 4f1121255ebac035a439d242b47c2f81124418c3
Author: Miklos Vajna 
AuthorDate: Tue Nov 7 08:31:29 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 7 09:52:50 2023 +0100

sw floattable, insert UI: fix default frame width when inserting a new one

Insert -> Frame -> Frame presented a dialog which stated the width of
the new frame will be 2cm, but the width was ~zero.

This is a regression from commit
9da7b1592e010928c26c43ee93b91cdd66403985 (sw: remove all uses of MM50
with (added) o3tl::toTwip, 2021-07-23). Previously the code worked
because the 2cm was speficified as MM50*4 (283*4=1132 twips), and we
compared this to the 2cm from the UI, which had no rounding errors
(283.46456692913387*4=1134 twips), and this 1132 vs 1134 meant the
dialog put the unchanged size to the output item set.  Now we don't have
rounding errors anymore, so we have 1134 everywhere, which means the
dialog doesn't specify a default size, but no other code would do it,
resulting in a frame with minimal width, which is clearly not wanted.

Fix the problem by checking if this will be a new frame, and if so, the
dialog should send the default size to the caller, even if the user
didn't customize the size.  This restores the lost 2cm default width
while keeping the rounding improvements.

This requires running the test in its own process, because the
measurement unit is only loaded once from the config and the rounding
error is not hit with the default inches.

Change-Id: I9a5945fdd0e5cd64ff8bd84f95f11be5277b8d18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159050
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/UITest_sw_ui_frmdlg.mk b/sw/UITest_sw_ui_frmdlg.mk
index 0fae8bf25f1d..219a72ddfae3 100644
--- a/sw/UITest_sw_ui_frmdlg.mk
+++ b/sw/UITest_sw_ui_frmdlg.mk
@@ -15,4 +15,6 @@ $(eval $(call gb_UITest_set_defs,sw_ui_frmdlg, \
 TDOC="$(SRCDIR)/sw/qa/uitest/data" \
 ))
 
+$(eval $(call gb_UITest_avoid_oneprocess,sw_ui_frmdlg))
+
 # vim: set noet sw=4 ts=4:
diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py
index e3aeb67c569c..e30b67ff5313 100644
--- a/sw/qa/uitest/ui/frmdlg/frmdlg.py
+++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py
@@ -62,4 +62,22 @@ class Test(UITestCase):
 # and floating tables.
 self.assertEqual(get_state_as_dict(xFlysplit)['Visible'], 
"false")
 
+def test_insert_frame_dialog(self):
+# Change from inch to cm to hit the rounding error. 2 means 
Centimeter, see
+# officecfg/registry/schema/org/openoffice/Office/Writer.xcs.
+with 
self.ui_test.set_config('/org.openoffice.Office.Writer/Layout/Other/MeasureUnit',
 2):
+# Given a Writer document:
+with self.ui_test.create_doc_in_start_center("writer") as 
xComponent:
+# When inserting a new frame with the default width:
+with 
self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog:
+xWidth = xDialog.getChild("width")
+frame_width = float(get_state_as_dict(xWidth)["Value"])
+# Then make sure the width is not zero:
+# cm -> mm100
+expected_mm100 = frame_width * 1000
+# Without the accompanying fix in place, this test would have 
failed with:
+# AssertionError: 0 != 2000.0
+# i.e. the width was empty instead of the size from the UI.
+self.assertEqual(xComponent.TextFrames.Frame1.Size.Width, 
expected_mm100)
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 352dc15df463..b38ac22d0d11 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1264,7 +1264,13 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet)
 
 pOldItem = GetOldItem(*rSet, RES_FRM_SIZE);
 
-if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !m_bFormat) ||
+bool bSizeChanged = pOldItem && aSz != *pOldItem;
+if (!bSizeChanged && m_bNew)
+{
+// If no custom size is provided, always set a size for a new frame, 
to avoid ~zero width.
+bSizeChanged = true;
+}
+if (bSizeChanged || (!pOldItem && !m_bFormat) ||
 (m_bFormat &&
 (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
 (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))


[Libreoffice-commits] core.git: sw/qa

2023-11-06 Thread Miklos Vajna (via logerrit)
 sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx |binary
 sw/qa/core/objectpositioning/objectpositioning.cxx |   17 
++
 2 files changed, 17 insertions(+)

New commits:
commit 0bf60e32c0ac2bf79fad6c29c39c6f6a3f9ce8e8
Author: Miklos Vajna 
AuthorDate: Mon Nov 6 18:38:33 2023 +0100
Commit: Miklos Vajna 
CommitDate: Tue Nov 7 00:35:09 2023 +0100

tdf#99822 sw floattable: testcase for objects from different cells

Fails with commit 435f1aadf7dd8087a8997924bedfccff0f496ba2 (tdf#99822 sw
floattable: allow nomimal overlap of objects from different cells,
2023-10-27) reverted.

Change-Id: Ic90a2aa254a47804dc50eba8fc1daf0131e65a26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159007
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx 
b/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx
new file mode 100644
index ..50ec605ed7b7
Binary files /dev/null and 
b/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index 4e0db43c475f..9fea64267a15 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -371,6 +371,23 @@ CPPUNIT_TEST_FIXTURE(Test, 
testFloatingTableFollowWrongPage)
 const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage2Objs.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFloatingTableOverlapCell)
+{
+// Given a document with floating tables, overlapping, but anchored to 
different table cells:
+createSwDoc("floattable-overlap-cell.docx");
+
+// When laying out the document:
+// Without the accompanying fix in place, this resulted in a layout loop.
+calcLayout();
+
+// Then make sure the layout doesn't loop and results in a single page:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+CPPUNIT_ASSERT(!pPage1->GetNext());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: sw/qa sw/source

2023-11-02 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   55 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   36 +++---
 2 files changed, 80 insertions(+), 11 deletions(-)

New commits:
commit 3e266d5902439f34bc5559d6871f8c9fd6e579bb
Author: László Németh 
AuthorDate: Thu Nov 2 13:15:52 2023 +0100
Commit: László Németh 
CommitDate: Fri Nov 3 00:53:49 2023 +0100

tdf#158039 sw track changes: fix cycle case of selected sentences

Previous tracked changes of cycle case weren't removed, if
the selection doesn't end in a tracked change, i.e. sentences
with punctuation, or selections end in a capitalized word etc.

Fix also lost selection of multiple selected nodes.

Follow up to commit 4cf8de89bad9143a5b2dd3d6351080bf62b76029
"tdf#157667 sw track changes: fix cycle case on multiple words",
commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking" and
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
"tdf#157988 sw track changes: fix cycle case on a selected word".

Change-Id: I24476c359200a25ca9bcd467c33b0ebeb1afb037
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158804
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 8e6b91043b0b..30c449a597ac 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -796,7 +796,62 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157667)
 "Integer sodalesINTEGER SODALES tincidunt tristique."));
 
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+}
+
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf158039)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select the first sentence
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 26, 
/*bBasicCall=*/false);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesINTEGER SODALES tincidunt tristique."));
+
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
 
 CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index d51565c5eaee..d36ee7a8b31a 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3055,17 +3055,27 @@ void 
DocumentContentOperationsManager::TransliterateText(
 if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) 
&&
 pEnd->GetContentIndex() > 0 )
 {
-SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 
1);
-SwRedlineTable::size_type n = 0;
+// search all own redlines within the selected area
+SwRedlineTable::size_type n = SwRedlineTable::npos;
+const SwRedlineTable& aRedlineTable = rIDRA.GetRedlineTable();
+for( SwRedlineTable::size_type m = 0; m < aRedlineTable.size(); 
++

[Libreoffice-commits] core.git: sw/qa

2023-11-02 Thread Skyler Grey (via logerrit)
 sw/qa/core/fields/data/styleref-flags.docx |binary
 sw/qa/core/fields/data/styleref.odt|binary
 sw/qa/core/fields/data/suppress-non-numerical.docx |binary
 sw/qa/core/fields/fields.cxx   |  215 -
 4 files changed, 169 insertions(+), 46 deletions(-)

New commits:
commit fd5c75750f5c5448eec840033bce16375774a707
Author: Skyler Grey 
AuthorDate: Mon Oct 23 09:17:23 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Nov 2 10:27:52 2023 +0100

Improve and extend STYLEREF tests

- I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19,
  Ib664fec059aa1f7f130acc76c253d5d298fa59f7 and
  Iad8e8001807f5ceeaedc9665838672695174a936 added STYLEREF flags. This
  commit adds tests for them
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were partly
  broken due to the fields occasionally being inserted in the wrong
  place (i.e. at the end of the document), this commit makes sure to
  move the cursor before inserting a field
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 were not
  separated into sections which made it difficult to tell what was being
  tested. All STYLEREF tests that create documents are now clearly split
  into arrange/act/assert steps with comments denoting the sections
- The tests in I35dc36197b62fa53def4745da1d4755ece79ed22 had a lot of
  repetition, particularly in creating the document, adding headings,
  etc. This has been refactored into some helper functions
- I35dc36197b62fa53def4745da1d4755ece79ed22 was missing an ODF import
  test. This commit adds one

Follow-Up-To: I25dd7a6940abee5651a784b9059fe23b32547d6c
Follow-Up-To: I35dc36197b62fa53def4745da1d4755ece79ed22
Follow-Up-To: I7d8f455ffe90cface4f3b1acf6b9bef6a045ed19
Follow-Up-To: Ib664fec059aa1f7f130acc76c253d5d298fa59f7
Follow-Up-To: Iad8e8001807f5ceeaedc9665838672695174a936
Follow-Up-To: Iecd3e83a6bd3f8c2c6adba5c7eba9ee55b773510
Follow-Up-To: Ifaa67fbc2d53b0d4fb85e7305b2dbdf78cf0a1ad
Follow-Up-To: Id991c92b9aeaa054b136f7a3d9c7c8ea0026e514
Change-Id: I941b477c8e860270a400869cb9ea15e5561e402a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158352
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/sw/qa/core/fields/data/styleref-flags.docx 
b/sw/qa/core/fields/data/styleref-flags.docx
new file mode 100644
index ..443624a575e0
Binary files /dev/null and b/sw/qa/core/fields/data/styleref-flags.docx differ
diff --git a/sw/qa/core/fields/data/styleref.odt 
b/sw/qa/core/fields/data/styleref.odt
new file mode 100644
index ..27af5aae1f06
Binary files /dev/null and b/sw/qa/core/fields/data/styleref.odt differ
diff --git a/sw/qa/core/fields/data/suppress-non-numerical.docx 
b/sw/qa/core/fields/data/suppress-non-numerical.docx
new file mode 100644
index ..439e048b9f93
Binary files /dev/null and b/sw/qa/core/fields/data/suppress-non-numerical.docx 
differ
diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 9fae9cafef13..8e6a1488fa3a 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -7,8 +7,9 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -36,7 +37,6 @@
 
 #include 
 #include 
-
 #include 
 
 #include 
@@ -182,27 +182,49 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf86790)
 CPPUNIT_ASSERT_EQUAL(sValue.first, xField->getPresentation(true));
 CPPUNIT_ASSERT_EQUAL(sValue.second, xField->getPresentation(false));
 }
+CPPUNIT_ASSERT(!xFields->hasMoreElements());
+}
+
+void InsertParagraphBreak(const uno::Reference& xCursor)
+{
+uno::Reference xText = xCursor->getText();
+xText->insertControlCharacter(xCursor, 
text::ControlCharacter::PARAGRAPH_BREAK, false);
+}
+void InsertHeading(const uno::Reference& xCursor, const 
OUString& content)
+{
+uno::Reference xCursorPropertySet(xCursor, 
uno::UNO_QUERY);
+uno::Reference xText = xCursor->getText();
+
+xCursorPropertySet->setPropertyValue("ParaStyleName", 
uno::Any(OUString("Heading 1")));
+xText->insertString(xCursor, content, false);
+InsertParagraphBreak(xCursor);
 }
 
 /// If there is referenced text both above and below, STYLEREF searches up
 CPPUNIT_TEST_FIXTURE(Test, testStyleRefSearchUp)
 {
+// Arrange
+// Create a document with headings both above and below a cursor
 createSwDoc();
 
 uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
 uno::Reference xText = xTextDocument->getText();
 
 uno::Reference xCursor = xText->createTextCursor();
-uno::Reference xCursorPropertySet(xCursor, 
uno::UNO_QUERY);
 
-xCursorPropertySet->setPropertyValue("ParaStyleName", 
uno::Any(OUString("Heading 1")));
-xText->insertString(xCursor, "Heading far above field", false);
-xText->insertCont

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-31 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   43 ++
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   68 
 2 files changed, 96 insertions(+), 15 deletions(-)

New commits:
commit 4cf8de89bad9143a5b2dd3d6351080bf62b76029
Author: László Németh 
AuthorDate: Tue Oct 31 15:51:09 2023 +0100
Commit: László Németh 
CommitDate: Tue Oct 31 23:07:01 2023 +0100

tdf#157667 sw track changes: fix cycle case on multiple words

Fix tracked cycle case on multiple selected words.

Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking" and
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
"tdf#157988 sw track changes: fix cycle case on a selected word".

Change-Id: I81566f8be0cf6f4af6ed4af031116bd19e3884d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158732
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 83bc43f6d866..8e6b91043b0b 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -759,6 +759,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
 CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157667)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select the first three words
+pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 25, 
/*bBasicCall=*/false);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesSodales tinciduntTincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith(
+"Integer sodalesINTEGER SODALES tincidunt tristique."));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt tristique."));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 54b29b9b766c..d51565c5eaee 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2984,7 +2984,8 @@ void DocumentContentOperationsManager::TransliterateText(
 sal_Int32 nEndCnt = pEnd->GetContentIndex();
 
 SwTextNode* pTNd = pStt->GetNode().GetTextNode();
-if( (pStt == pEnd) && pTNd )  // no selection?
+bool bNoSelection = (pStt == pEnd) && pTNd;  // no selection?
+if ( bNoSelection )
 {
 /* Check if cursor is inside of a word */
 assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
@@ -3061,27 +3062,52 @@ void 
DocumentContentOperationsManager::TransliterateText(
 rIDRA.GetRedlineTable().FindAtPosition( aPos, 
n );
 if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 0 )
 {
-const SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[n-1];
-if ( RedlineType::Delete == pFnd2->GetType() &&
-  m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() 
&&
-  *pFnd2->End() == *pFnd->Start() &&
-  pFnd->GetAuthor() == pFnd2->GetAuthor() )
+SwWrtShell *pWrtShell = dynamic_cast(
+
m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
+
+sal_Int32 nRejectedCharacters = 0;
+SwRangeRedline* pFnd2 = rIDRA.GetRedlineTable()[--n];
+// loop on all redlines of a case changing, and reject them
+while ( ( ( RedlineType::Insert == pFnd->GetType() &&
+RedlineType::Delete == pFnd2->GetType() ) 

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-30 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/embedded_formula.fodt |   30 +++
 sw/qa/extras/htmlexport/htmlexport.cxx |   63 ---
 sw/source/filter/html/htmlplug.cxx |  184 +
 sw/source/filter/html/wrthtml.cxx  |6 
 sw/source/filter/html/wrthtml.hxx  |3 
 5 files changed, 201 insertions(+), 85 deletions(-)

New commits:
commit 2ecd5da533f8fc4229bb8a38167eb147c1213fa8
Author: Mike Kaganski 
AuthorDate: Mon Oct 30 17:14:47 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Oct 31 05:54:03 2023 +0100

ReqIF: introduce ExportFormulasAsPDF HTML export filter option

Change-Id: Id400bd5571d0a192d854620abe83d862e0512434
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158663
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/htmlexport/data/embedded_formula.fodt 
b/sw/qa/extras/htmlexport/data/embedded_formula.fodt
new file mode 100644
index ..46e5391223c0
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/embedded_formula.fodt
@@ -0,0 +1,30 @@
+
+
+
+ 
+  
+   Formula:
+   
+  http://www.w3.org/1998/Math/MathML"; display="block">
+   
+
+ 
+  e
+  
+   i
+   π
+  
+ 
+ +
+ 1
+ =
+ 0
+
+{ func e ^ { i %pi } + 1 } = 
0
+   
+  
+ 
+
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index a106dd53bf14..b4d3bfaaf10a 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -13,6 +13,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -215,9 +216,10 @@ public:
 {
 }
 
+OUString GetObjectPath(const OUString& ext);
 /// Get the .ole path, assuming maTempFile is an XHTML export result.
-OUString GetOlePath();
-OUString GetPngPath();
+OUString GetOlePath() { return GetObjectPath(u".ole"_ustr); }
+OUString GetPngPath() { return GetObjectPath(u".png"_ustr); }
 /// Parse the ole1 data out of an RTF fragment URL.
 void ParseOle1FromRtfUrl(const OUString& rRtfUrl, SvMemoryStream& rOle1);
 /// Export using the C++ HTML export filter, with xhtmlns=reqif-xhtml.
@@ -228,29 +230,16 @@ public:
 void ExportToHTML();
 };
 
-OUString SwHtmlDomExportTest::GetOlePath()
+OUString SwHtmlDomExportTest::GetObjectPath(const OUString& ext)
 {
+assert(ext.startsWith("."));
 xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
 OUString aOlePath = getXPath(
 pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
-OUString aOleSuffix(".ole");
-CPPUNIT_ASSERT(aOlePath.endsWith(aOleSuffix));
+CPPUNIT_ASSERT(aOlePath.endsWith(ext));
 INetURLObject aUrl(maTempFile.GetURL());
-aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - 
aOleSuffix.getLength()));
-aUrl.setExtension(u"ole");
-return aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
-}
-
-OUString SwHtmlDomExportTest::GetPngPath()
-{
-xmlDocUniquePtr pDoc = WrapReqifFromTempFile();
-OUString aPngPath = getXPath(
-pDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p/reqif-xhtml:object", "data");
-OUString aPngSuffix(".png");
-CPPUNIT_ASSERT(aPngPath.endsWith(aPngSuffix));
-INetURLObject aUrl(maTempFile.GetURL());
-aUrl.setBase(aPngPath.subView(0, aPngPath.getLength() - 
aPngSuffix.getLength()));
-aUrl.setExtension(u"png");
+aUrl.setBase(aOlePath.subView(0, aOlePath.getLength() - ext.getLength()));
+aUrl.setExtension(ext.subView(1));
 return aUrl.GetMainURL(INetURLObject::DecodeMechanism::NONE);
 }
 
@@ -2823,6 +2812,40 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testReqIF_PreserveSpaces)
 CPPUNIT_ASSERT_EQUAL(paraText, getParagraph(1)->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqIF_ExportFormulasAsPDF)
+{
+// Given a document with a formula:
+createSwDoc("embedded_formula.fodt");
+
+// When exporting to reqif with ExportFormulasAsPDF=true:
+uno::Reference xStorable(mxComponent, 
uno::UNO_QUERY_THROW);
+uno::Sequence aStoreProperties = {
+comphelper::makePropertyValue(u"FilterName"_ustr, u"HTML 
(StarWriter)"_ustr),
+comphelper::makePropertyValue(u"FilterOptions"_ustr, 
u"xhtmlns=reqif-xhtml"_ustr),
+comphelper::makePropertyValue(u"ExportFormulasAsPDF"_ustr, true),
+};
+xStorable->storeToURL(maTempFile.GetURL(), aStoreProperties);
+
+// Make sure that the formula is exported as PDF:
+xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+assertXPath(pXmlDoc,
+
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:p[2]/reqif-xhtml:object"_ostr,
+"type"_ostr, u"application/pdf"_ustr);
+
+css::uno::Sequence descr{
+comphelper::makePropertyValue(u"URL"_ustr, 
GetObjectPath(u".

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-30 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   69 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |   38 
 2 files changed, 107 insertions(+)

New commits:
commit 79435eb55ef226fb0e3507aabdc2f8af062680f6
Author: László Németh 
AuthorDate: Mon Oct 30 14:42:34 2023 +0100
Commit: László Németh 
CommitDate: Mon Oct 30 21:54:07 2023 +0100

tdf#157988 sw track changes: fix cycle case on a selected word

Cycle case didn't work on a selected word, only on the
word under the cursor without selection.

Add unit test also for tdf#141198.

Follow up to commit dc748d7dbd114fbf663752258dbaf003af2926c3
"tdf#141198 sw: fix cycle case with change tracking".

Change-Id: I0c1361c78d09e9b8743192a47dcdfa6f6da52e38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158666
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 53f6dce1a56a..83bc43f6d866 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -690,6 +690,75 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
 dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157988)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+
+// select the second word
+dispatchCommand(mxComponent, ".uno:GoToNextWord", {});
+dispatchCommand(mxComponent, ".uno:SelectWord", {});
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This was false (missing revert of the tracked change)
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+// tdf#141198 cycle case without selection: the word under the cursor
+
+dispatchCommand(mxComponent, ".uno:Escape", {});
+
+dispatchCommand(mxComponent, ".uno:GoRight", {});
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSODALES"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer 
sodalesSodales"));
+
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+CPPUNIT_ASSERT(getParagraph(1)->getString().startsWith("Integer sodales 
tincidunt"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 3f4c99a8f487..54b29b9b766c 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -3047,6 +3047,44 @@ void DocumentContentOperationsManager::TransliterateText(
 return;
 }
 }
+else
+{
+bool bHasTrackedChange = false;
+IDocumentRedlineAccess& rIDRA = m_rDoc.getIDocumentRedlineAccess();
+if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) 
&&
+pEnd->GetContentIndex() > 0 )
+{
+SwPosition aPos(*pEnd->GetContentNode(), pEnd->GetContentIndex() - 
1);
+SwRedlineTable::size_type n = 0;
+
+const SwRangeRedline* pFnd =
+rIDRA.GetRedlineTable().FindAtPosition( aPos, 
n );
+if ( pFnd && RedlineType::Insert == pFnd->GetType() && n > 

[Libreoffice-commits] core.git: sw/qa

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit d09a7ca9be52b850c3df82c49d74abd11476c886
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:46:10 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:43:37 2023 +0100

Fix typo

Change-Id: I46eacec6000182b24a8f4b14aedf0f6b97dc45b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158629
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index b10f955244fa..4b6130683f05 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2373,7 +2373,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf157663_RedlineMoveRecognition)
 CPPUNIT_ASSERT_EQUAL(nZeroID, rTable[i]->GetMoved());
 }
 
-// Check if Moveing Paragraps generate move redlines
+// Check if moving paragraphs generate redline moves
 
 // move a paragraph that has delete redlines inside of it
 // original text: "Seve ent teen"


[Libreoffice-commits] core.git: sw/qa

2023-10-30 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 82dc215580a6ef7ca284f1acb03e731f220b7497
Author: Andrea Gelmini 
AuthorDate: Mon Oct 30 05:45:49 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Oct 30 08:42:24 2023 +0100

Fix typo

Change-Id: I461707c6a61887f75078743c087b3f9d44f9e7a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158628
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 4d73f8c6f559..b10f955244fa 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2320,7 +2320,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf157663_RedlineMoveRecognition)
 // 20. and 22. redline is a delete/insert redline with the same text 
"three".
 // they are not recognised as a move, because 22. redline is not a whole 
paragraph.
 // Note: delete/insert redlines that are just a part of a paragraph 
decided to be part of
-// a move, only if it is at least 6 character long and conatin a space "" 
character.
+// a move, only if it is at least 6 character long and contain a space "" 
character.
 for (SwRedlineTable::size_type i = 0; i < rTable.size(); i++)
 {
 CPPUNIT_ASSERT_EQUAL(vMovedRedlines[i], rTable[i]->GetMoved() > 0);


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-27 Thread László Németh (via logerrit)
 sw/qa/extras/uiwriter/data/tdf130088.docx |binary
 sw/qa/extras/uiwriter/uiwriter6.cxx   |   27 +++
 sw/source/core/txtnode/txtedt.cxx |9 -
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit e079bb35429603988d2fd4ddf18b0f501a847a2c
Author: László Németh 
AuthorDate: Fri Oct 27 09:43:44 2023 +0200
Commit: László Németh 
CommitDate: Fri Oct 27 15:10:33 2023 +0200

tdf#157937 sw: fix freezing of cycle case on tracked changes

Add loop control to avoid never-ending iteration on selected
text with tracked changes, where transliteration can result
empty strings.

Regression since commit 2d3c77e9b10f20091ef338e262ba7756eb280ce9
"tdf#109266 sw change tracking: track transliteration".

Change-Id: Ia5f92adfdda33562b4d1abe72c51134be8304639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158525
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/sw/qa/extras/uiwriter/data/tdf130088.docx 
b/sw/qa/extras/uiwriter/data/tdf130088.docx
new file mode 100644
index ..8d5a7a604b5e
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf130088.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index dd0b1d6f468c..53f6dce1a56a 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -663,6 +663,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790)
 CPPUNIT_ASSERT(dynamic_cast(mxComponent.get()));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
+{
+createSwDoc("tdf130088.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// select paragraph
+pWrtShell->SelPara(nullptr);
+
+// enable redlining
+dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+   pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
+// show changes
+CPPUNIT_ASSERT_MESSAGE(
+"redlines should be visible",
+
IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+
+// cycle case with change tracking
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+
+// This resulted freezing
+dispatchCommand(mxComponent, ".uno:ChangeCaseRotateCase", {});
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf108048)
 {
 createSwDoc();
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 71ee1fd93a24..2f3e7aa6db86 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1973,6 +1973,7 @@ void SwTextNode::TransliterateText(
 
 sal_Int32 nEndPos = 0;
 LanguageType nLang = LANGUAGE_NONE;
+sal_Int32 nLoopControlRuns = 0;
 do {
 if( pIter )
 {
@@ -2005,7 +2006,13 @@ void SwTextNode::TransliterateText(
 }
 
 nStt = nEndPos;
-} while( nEndPos < nEnd && pIter && pIter->Next() );
+
+// tdf#157937 selection containing tracked changes needs loop 
control:
+// stop looping, if there are too much empty transliterations
+if ( sChgd.isEmpty() )
+++nLoopControlRuns;
+
+} while( nEndPos < nEnd && pIter && pIter->Next() && nLoopControlRuns 
< 100 );
 }
 
 if (aChanges.empty())


[Libreoffice-commits] core.git: sw/qa

2023-10-27 Thread OmkarAcharekar (via logerrit)
 sw/qa/core/layout/data/tdf157096.docx |binary
 sw/qa/core/layout/layact.cxx  |   13 +
 2 files changed, 13 insertions(+)

New commits:
commit ae9c207675f1144fdea8f628f370375768f1eb00
Author: OmkarAcharekar 
AuthorDate: Wed Oct 25 22:21:13 2023 +0530
Commit: Xisco Fauli 
CommitDate: Fri Oct 27 12:56:20 2023 +0200

tdf#157096: sw_layout: Add test for CRASH removing everything in document

Change-Id: I07fde27e71f112019532c57d90f46568af45fad9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158458
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/layout/data/tdf157096.docx 
b/sw/qa/core/layout/data/tdf157096.docx
new file mode 100644
index ..bca591e8ad83
Binary files /dev/null and b/sw/qa/core/layout/data/tdf157096.docx differ
diff --git a/sw/qa/core/layout/layact.cxx b/sw/qa/core/layout/layact.cxx
index 64262977f7fe..d432ae52b7c5 100644
--- a/sw/qa/core/layout/layact.cxx
+++ b/sw/qa/core/layout/layact.cxx
@@ -73,6 +73,19 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNextRowInvalidatePos)
 // i.e. row 2 has to be shifted down to 7390, but this didn't happen.
 CPPUNIT_ASSERT_GREATER(nOldRow2Top, nNewRow2Top);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf157096)
+{
+createSwDoc("tdf157096.docx");
+
+CPPUNIT_ASSERT_EQUAL(2, getPages());
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+// Without the fix in place, it would have crashed here
+dispatchCommand(mxComponent, ".uno:Delete", {});
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-25 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/data/tdf157132.odt |binary
 sw/qa/extras/uiwriter/uiwriter8.cxx  |   42 +++
 sw/source/core/table/swtable.cxx |2 +
 3 files changed, 44 insertions(+)

New commits:
commit 0c008ab081aa5bbf53f8562e95e547deae5afc2e
Author: Xisco Fauli 
AuthorDate: Wed Oct 25 18:07:18 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 26 08:48:23 2023 +0200

tdf#157132: restore behaviour for TBL_RELBOXNAME

Regression from 8a3dc12a13a3b9e99dbd5000ca6a1d541cf472f7
"8a3dc12a13a3b9e99dbd5000ca6a1d541cf472f7"
TBL_RELBOXNAME was no longer calling ToRelBoxNm

Change-Id: I296d84ab955b4415bf9173ccf72b4d51e55152f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158454
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/data/tdf157132.odt 
b/sw/qa/extras/uiwriter/data/tdf157132.odt
new file mode 100644
index ..ddb9522bf835
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf157132.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter8.cxx 
b/sw/qa/extras/uiwriter/uiwriter8.cxx
index 8e4869c5d694..7cef16f032bf 100644
--- a/sw/qa/extras/uiwriter/uiwriter8.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter8.cxx
@@ -1480,6 +1480,48 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf146573)
 CPPUNIT_ASSERT_EQUAL(OUString("204"), xCellA4->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf157132)
+{
+createSwDoc("tdf157132.odt");
+
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+// Go to cell A2
+pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1);
+
+// Select A2 and A3 and copy
+pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1);
+
+dispatchCommand(mxComponent, ".uno:Copy", {});
+
+// Go to A4 and paste
+pWrtShell->Down(/*bSelect=*/false, /*nCount=*/1);
+
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xTables(xTextTablesSupplier->getTextTables(),
+uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
+
+uno::Reference xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+
+uno::Reference xCellA2(xTextTable->getCellByName("A2"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("2"), xCellA2->getString());
+uno::Reference xCellA3(xTextTable->getCellByName("A3"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("3"), xCellA3->getString());
+uno::Reference xCellA4(xTextTable->getCellByName("A4"), 
uno::UNO_QUERY);
+
+// Without the fix in place, this test would have failed with
+// - Expected: 6
+// - Actual  : 2
+CPPUNIT_ASSERT_EQUAL(OUString("6"), xCellA4->getString());
+uno::Reference xCellA5(xTextTable->getCellByName("A5"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("7"), xCellA5->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest8, testTdf147938)
 {
 createSwDoc("tdf147938.fodt");
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 3d53ef518903..d50c493079a2 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1727,6 +1727,8 @@ void SwTable::UpdateFields(TableFormulaUpdateFlags eFlags)
 {
 if(eFlags == TBL_BOXPTR)
 pBoxFormula->TryBoxNmToPtr();
+else if(eFlags == TBL_RELBOXNAME)
+pBoxFormula->ToRelBoxNm(this);
 else
 pBoxFormula->ChangeState();
 }


[Libreoffice-commits] core.git: sw/qa

2023-10-24 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport10.cxx |   66 +++--
 1 file changed, 35 insertions(+), 31 deletions(-)

New commits:
commit aa6882da4b43f52ef1f92fa0bc500aec9878ed54
Author: Miklos Vajna 
AuthorDate: Tue Oct 24 20:17:50 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 25 08:11:36 2023 +0200

CppunitTest_sw_ooxmlexport10: avoid preTest()

This keeps all code of a test in a single place, if we don't trigger the
preTest() magic.

Change-Id: I13254fd11be344f84e0a8bb8eab4b93d7c1a8825
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158400
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index fb01ab2b47ba..50dc74101a62 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -33,26 +33,12 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
 public:
 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open 
XML Text") {}
-
-virtual std::unique_ptr preTest(const char* filename) override
-{
-if (filename == std::string_view("smartart.docx")
-|| filename == std::string_view("strict-smartart.docx") )
-{
-std::unique_ptr pResetter(new Resetter(
-[] () {
-SvtFilterOptions::Get().SetSmartArt2Shape(false);
-}));
-SvtFilterOptions::Get().SetSmartArt2Shape(true);
-return pResetter;
-}
-return nullptr;
-}
 };
 
 DECLARE_OOXMLEXPORT_TEST(testWPGtextboxes, "testWPGtextboxes.docx")
@@ -74,23 +60,32 @@ DECLARE_OOXMLEXPORT_TEST(testWPGtextboxes, 
"testWPGtextboxes.docx")
 
 }
 
-DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx")
+CPPUNIT_TEST_FIXTURE(Test, testSmartart)
 {
-CPPUNIT_ASSERT_EQUAL(1, getShapes());
+SvtFilterOptions::Get().SetSmartArt2Shape(true);
+comphelper::ScopeGuard g([] { 
SvtFilterOptions::Get().SetSmartArt2Shape(false); });
 
-uno::Reference xGroup(getShape(1), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xGroup->getCount()); // background, 3 
rectangles and an arrow in the group
+auto verify = [this]() {
+CPPUNIT_ASSERT_EQUAL(1, getShapes());
+
+uno::Reference xGroup(getShape(1), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xGroup->getCount()); // background, 
3 rectangles and an arrow in the group
 
-uno::Reference xPropertySet(xGroup->getByIndex(2), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), getProperty(xPropertySet, 
"FillColor")); // If fill color is right, theme import is OK
+uno::Reference 
xPropertySet(xGroup->getByIndex(2), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), getProperty(xPropertySet, 
"FillColor")); // If fill color is right, theme import is OK
 
-uno::Reference xTextRange(xGroup->getByIndex(2), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // 
Shape has text
+uno::Reference xTextRange(xGroup->getByIndex(2), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // 
Shape has text
 
-uno::Reference 
xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
-uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
-xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), 
getProperty( xPropertySet, "ParaAdjust")); // Paragraph properties 
are imported
+uno::Reference 
xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
+uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
+xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), 
getProperty( xPropertySet, "ParaAdjust")); // Paragraph properties 
are imported
+};
+createSwDoc("smartart.docx");
+verify();
+saveAndReload(mpFilter);
+verify();
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFdo69548)
@@ -534,11 +529,20 @@ DECLARE_OOXMLEXPORT_TEST(testStrict, "strict.docx")
 
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextEmbeddedObject"));
 }
 
-DECLARE_OOXMLEXPORT_TEST(testSmartartStrict, "strict-smartart.docx")
+CPPUNIT_TEST_FIXTURE(Test, testSmartartStrict)
 {
-uno::Reference xGroup(getShape(1), 
uno::UNO_QUERY);
-// This was 0, SmartArt was visually missing.
-CPPUNIT_ASSERT_EQUAL(sal_Int32(7), xGroup->getCount()); // background, 3 
ellipses + 3 arrows
+SvtFilterOptions::Get().SetSmartArt2Shape(true);
+comphelper::ScopeGuard g([] { 
SvtFilterOptions::Get().SetSmartArt2Shape(false); });
+
+auto verify = [this]() {
+uno::Reference xGroup(getShape(1), 
uno::UNO_QUERY);
+// This was 0, SmartArt was visually missing.
+CPPUNIT_A

[Libreoffice-commits] core.git: sw/qa

2023-10-24 Thread Stephan Bergmann (via logerrit)
 sw/qa/uitest/navigator/tdf144672.py |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit 9d5e8d5f5bc422178d6fca928e749ba3bb3d159e
Author: Stephan Bergmann 
AuthorDate: Tue Oct 24 10:08:34 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 24 11:13:38 2023 +0200

tdf#153519 Another TreeListEntryUIObject heap-use-after-free

...similar to the one addressed with the commits leading up to
9a23ded27470a4c57015e9e5d686259a60d464f2 "Fix thinko when to sleep"

Change-Id: I8114c6647e06ceb202cd790af691ecc18e9d4e17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158373
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/uitest/navigator/tdf144672.py 
b/sw/qa/uitest/navigator/tdf144672.py
index 4bded66dcb08..2dc11a8d3cf9 100644
--- a/sw/qa/uitest/navigator/tdf144672.py
+++ b/sw/qa/uitest/navigator/tdf144672.py
@@ -10,6 +10,7 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+import time
 
 class tdf144672(UITestCase):
 
@@ -32,6 +33,15 @@ class tdf144672(UITestCase):
 # wait until the navigator panel is available
 xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
 
+# HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the 
SwContentTree ctor in
+# sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is 
started by
+# SwContentTree::ShowTree triggered from the SIDEBAR action above, 
and which can
+# invalidate the TreeListEntryUIObjects used by the below code (see
+# 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of 
TreeListEntryUIObject as
+# dubious"); lets double that 1000 ms timeout value here to 
hopefully be on the safe
+# side:
+time.sleep(2)
+
 xContentTree = xNavigatorPanel.getChild("contenttree")
 
 xReferences = self.get_item(xContentTree, 'References')


[Libreoffice-commits] core.git: sw/qa

2023-10-23 Thread Xisco Fauli (via logerrit)
 sw/qa/core/txtnode/data/tdf157287.odt |binary
 sw/qa/core/txtnode/txtnode.cxx|   27 +++
 2 files changed, 27 insertions(+)

New commits:
commit bae0736bf0ec54828766c3d903e2a27458643395
Author: Xisco Fauli 
AuthorDate: Mon Oct 23 16:30:07 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 23 21:22:13 2023 +0200

tdf#157287: sw_core_txtnode: Add unittest

Change-Id: I4c14cbe8610dc6426b910f4ef5d96ccc6e7a4604
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158359
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/txtnode/data/tdf157287.odt 
b/sw/qa/core/txtnode/data/tdf157287.odt
new file mode 100644
index ..3ff6c4c6b9a6
Binary files /dev/null and b/sw/qa/core/txtnode/data/tdf157287.odt differ
diff --git a/sw/qa/core/txtnode/txtnode.cxx b/sw/qa/core/txtnode/txtnode.cxx
index 5e5f79969781..c5d7d8fc740e 100644
--- a/sw/qa/core/txtnode/txtnode.cxx
+++ b/sw/qa/core/txtnode/txtnode.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -432,6 +433,32 @@ CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, 
testContentControlCopy)
 CPPUNIT_ASSERT_EQUAL(SwContentControlType::CHECKBOX, 
rFormat2.GetContentControl()->GetType());
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testTdf157287)
+{
+createSwDoc("tdf157287.odt");
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(OUString("30"), xField->getPresentation(false));
+
+uno::Reference xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+uno::Reference xTextTable(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+
+uno::Reference xCellA1(xTextTable->getCellByName("B1"), 
uno::UNO_QUERY);
+xCellA1->setString("100");
+
+dispatchCommand(mxComponent, ".uno:UpdateFields", {});
+
+// Without the fix in place, this test would have failed with
+// - Expected: 120
+// - Actual  :
+CPPUNIT_ASSERT_EQUAL(OUString("120"), xField->getPresentation(false));
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTxtnodeTest, testFlySplitFootnote)
 {
 // Given a document with a split fly (to host a table):


[Libreoffice-commits] core.git: sw/qa

2023-10-23 Thread Stephan Bergmann (via logerrit)
 sw/qa/uitest/navigator/tdf134960.py |9 +
 1 file changed, 9 insertions(+)

New commits:
commit fcae1c4fdf75d6a62cdbfbca5deb07e78de591f5
Author: Stephan Bergmann 
AuthorDate: Mon Oct 23 14:02:15 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Oct 23 15:45:00 2023 +0200

tdf#153519 Another TreeListEntryUIObject heap-use-after-free

...similar to the one addressed with the commits leading up to
9a23ded27470a4c57015e9e5d686259a60d464f2 "Fix thinko when to sleep"

Change-Id: Ia6db1440b3d9623b440edb3866b750ff5a14bdb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158348
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
index 8388b63e40f9..270e9d347abb 100644
--- a/sw/qa/uitest/navigator/tdf134960.py
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -9,6 +9,7 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+import time
 
 class tdf134960_hyperlinks(UITestCase):
 
@@ -27,6 +28,14 @@ class tdf134960_hyperlinks(UITestCase):
 # wait until the navigator panel is available
 xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
 
+# HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the SwContentTree 
ctor in
+# sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is 
started by
+# SwContentTree::ShowTree triggered from the SIDEBAR action above, and 
which can invalidate
+# the TreeListEntryUIObjects used by the below code (see
+# 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of 
TreeListEntryUIObject as
+# dubious"); lets double that 1000 ms timeout value here to hopefully 
be on the safe side:
+time.sleep(2)
+
 xContentTree = xNavigatorPanel.getChild("contenttree")
 xHyperlinks = self.get_item(xContentTree, 'Hyperlinks')
 self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text'])


[Libreoffice-commits] core.git: sw/qa

2023-10-23 Thread OmkarAcharekar (via logerrit)
 sw/qa/core/unocore/data/tdf149555.docx |binary
 sw/qa/core/unocore/unocore.cxx |   39 +
 2 files changed, 39 insertions(+)

New commits:
commit 97b6b6b16c4b623f8a34393a906272439a7f0314
Author: OmkarAcharekar 
AuthorDate: Sat Oct 14 00:42:35 2023 +0530
Commit: Xisco Fauli 
CommitDate: Mon Oct 23 13:16:42 2023 +0200

tdf#149555: sw_unocore: Add test for convert RANGE_IS_SECTION SwXTextRange

Change-Id: I5e9fe7c59ac81004ce44ac04d5c50f65b754d847
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157947
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/unocore/data/tdf149555.docx 
b/sw/qa/core/unocore/data/tdf149555.docx
new file mode 100755
index ..b1f983c3402f
Binary files /dev/null and b/sw/qa/core/unocore/data/tdf149555.docx differ
diff --git a/sw/qa/core/unocore/unocore.cxx b/sw/qa/core/unocore/unocore.cxx
index 90970b6f680b..ea0f802ad515 100644
--- a/sw/qa/core/unocore/unocore.cxx
+++ b/sw/qa/core/unocore/unocore.cxx
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -984,6 +985,44 @@ CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, 
testCollectFrameAtNodeWithLayout)
 assertXPath(pXmlDoc, "//draw:frame", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreUnocoreTest, testTdf149555)
+{
+createSwDoc("tdf149555.docx");
+
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference xTextViewCursorSupplier(
+xModel->getCurrentController(), uno::UNO_QUERY);
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(),
+  uno::UNO_QUERY);
+
+xCursor->jumpToFirstPage();
+OUString sPageStyleName = getProperty(xCursor, "PageStyleName");
+uno::Reference xHeaderText = 
getProperty>(
+getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
+CPPUNIT_ASSERT_EQUAL(OUString("HEADER 1"), xHeaderText->getString());
+
+// Without the fix in place, this test would have failed with
+// - Expected: HEADER 2
+// - Actual: HEADER 1
+xCursor->jumpToPage(2);
+sPageStyleName = getProperty(xCursor, "PageStyleName");
+xHeaderText = getProperty>(
+getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
+CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString());
+
+xCursor->jumpToPage(3);
+sPageStyleName = getProperty(xCursor, "PageStyleName");
+xHeaderText = getProperty>(
+getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
+CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString());
+
+xCursor->jumpToPage(4);
+sPageStyleName = getProperty(xCursor, "PageStyleName");
+xHeaderText = getProperty>(
+getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
+CPPUNIT_ASSERT_EQUAL(OUString("HEADER 2"), xHeaderText->getString());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa

2023-10-23 Thread OmkarAcharekar (via logerrit)
 sw/qa/core/docnode/data/tdf156267.docx |binary
 sw/qa/core/docnode/docnode.cxx |   15 +++
 2 files changed, 15 insertions(+)

New commits:
commit 242bf93ae380d470e9fe34f8badf261ad203728b
Author: OmkarAcharekar 
AuthorDate: Thu Oct 12 01:50:26 2023 +0530
Commit: Xisco Fauli 
CommitDate: Mon Oct 23 13:12:34 2023 +0200

tdf#156267: sw_docnode: Add test for remove DdeBookmarks in 
SwDoc::DelTable()

Change-Id: I564fc701bf459e5591f65fad3c147d726b6881ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157850
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/core/docnode/data/tdf156267.docx 
b/sw/qa/core/docnode/data/tdf156267.docx
new file mode 100755
index ..f782ed0c95c2
Binary files /dev/null and b/sw/qa/core/docnode/data/tdf156267.docx differ
diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx
index 0282414f2116..9521c67b8ef7 100644
--- a/sw/qa/core/docnode/docnode.cxx
+++ b/sw/qa/core/docnode/docnode.cxx
@@ -51,6 +51,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf150086)
 CPPUNIT_ASSERT_EQUAL(OUString("Content\n"), rTable[6]->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156267)
+{
+createSwDoc("tdf156267.docx");
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+dispatchCommand(mxComponent, ".uno:Copy", {});
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// Without the fix in place, it would have crashed here
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa

2023-10-22 Thread Andrea Gelmini (via logerrit)
 sw/qa/core/fields/fields.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 42b0bab8d90c29e7806e681d1b009d3554195d91
Author: Andrea Gelmini 
AuthorDate: Sun Oct 22 03:37:21 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 22 21:34:09 2023 +0200

Remove duplicated includes

Change-Id: Ifdf7776c7c1abab5dadee8a9bb3301d9d7f4e596
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158320
Reviewed-by: Julien Nabet 
Tested-by: Jenkins

diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index 158e1c35dc2b..9fae9cafef13 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -19,16 +19,11 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -40,7 +35,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 


[Libreoffice-commits] core.git: sw/qa

2023-10-22 Thread Andrea Gelmini (via logerrit)
 sw/qa/core/text/itrform2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 42eaab2c8e6cc2fb9cb6f608db6ba4a07cc55409
Author: Andrea Gelmini 
AuthorDate: Sun Oct 22 03:33:30 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 22 13:04:06 2023 +0200

Fix typo

Change-Id: Ia58df805c7c59bdef07046431241b40d2aa404de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158318
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 02cd813ae549..fc8e981dcf5f 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -147,7 +147,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlHeaderPDFExport)
 
 CPPUNIT_TEST_FIXTURE(Test, testSplitFlyAnchorLeftMargin)
 {
-// Given a document with a floating table, anchor para is followed by an 
other para with a left
+// Given a document with a floating table, anchor para is followed by 
another para with a left
 // margin:
 createSwDoc("floattable-anchor-left-margin.docx");
 


[Libreoffice-commits] core.git: sw/qa

2023-10-20 Thread Stephan Bergmann (via logerrit)
 sw/qa/uitest/navigator/tdf137274.py |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 00286e56d17090ffdf0abd76ba3c236126f8c116
Author: Stephan Bergmann 
AuthorDate: Sat Oct 21 08:05:46 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Oct 21 08:54:59 2023 +0200

tdf#153519 Another TreeListEntryUIObject heap-use-after-free

...similar to the one addressed with the commits leading up to
9a23ded27470a4c57015e9e5d686259a60d464f2 "Fix thinko when to sleep"

Change-Id: Iecf0146c4c079ae95f980128531ac8f51b4b8535
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158302
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/uitest/navigator/tdf137274.py 
b/sw/qa/uitest/navigator/tdf137274.py
index 5273ddcb2f91..9bd780a7e5c2 100644
--- a/sw/qa/uitest/navigator/tdf137274.py
+++ b/sw/qa/uitest/navigator/tdf137274.py
@@ -42,6 +42,15 @@ class tdf137274(UITestCase):
 # wait until the navigator panel is available
 xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
 
+# HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the 
SwContentTree ctor in
+# sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is 
started by
+# SwContentTree::ShowTree triggered from the SIDEBAR action above, 
and which can
+# invalidate the TreeListEntryUIObjects used by the below code (see
+# 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of 
TreeListEntryUIObject as
+# dubious"); lets double that 1000 ms timeout value here to 
hopefully be on the safe
+# side:
+time.sleep(2)
+
 xContentTree = xNavigatorPanel.getChild("contenttree")
 xComments = self.get_item(xContentTree, 'Comments')
 self.assertEqual('Comments', get_state_as_dict(xComments)['Text'])


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-20 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   10 +-
 sw/source/core/doc/DocumentRedlineManager.cxx  |4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 113c4566933b798e3de4daf9e276ce24cdb8e773
Author: Mike Kaganski 
AuthorDate: Fri Oct 20 14:35:51 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Oct 20 19:05:55 2023 +0200

Avoid double notifications for deletion case

Follow-up to commit 34ac12dca3f5af50fddfb7c77e2943897980b815
When old redline is own Insert, and the new one is Delete, it means
that it was already handled in DocumentRedlineManager::DeleteRedline.

This also reverts the unit test change done in the mentioned commit.

Change-Id: I77e59dceb1c880fc6ec10ad98867be3bf5282f70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158253
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a280c0473843..4ed5f3af6cdb 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1652,9 +1652,9 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testRedlineUpdateCallback)
 m_nRedlineTableEntryModified = 0;
 pWrtShell->DelLeft();
 
-// Assert that we get exactly two notification about the redline update.
+// Assert that we get exactly one notification about the redline update.
 // This was 0, as LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED wasn't sent.
-CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableEntryModified);
 
 // Turn off the change tracking mode, make some modification to left of the
 // redline so that its position changes
@@ -1663,18 +1663,18 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testRedlineUpdateCallback)
 pWrtShell->Insert("This text is left of the redline");
 
 // Position of the redline has changed => Modify callback
-CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
 
 pWrtShell->DelLeft();
 // Deletion also emits Modify callback
-CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
 
 // Make changes to the right of the redline => no position change in 
redline
 pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 100/*Go 
enough right */, /*bBasicCall=*/false);
 pWrtShell->Insert("This text is right of the redline");
 
 // No Modify callbacks
-CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState)
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 7a9af1ee8891..5ac574b54858 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1842,8 +1842,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 delete pNewRedl;
 pNewRedl = nullptr;
 
-if (!bDec)
-MaybeNotifyRedlineModification(*pRedl, m_rDoc);
+// No need to call MaybeNotifyRedlineModification, 
because a notification
+// was already sent in 
DocumentRedlineManager::DeleteRedline
 break;
 
 case SwComparePosition::Outside:


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-20 Thread Stephan Bergmann (via logerrit)
 sw/qa/core/test_ToxLinkProcessor.cxx|   24 +--
 sw/qa/core/uwriter.cxx  |   20 -
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx   |4 -
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|2 
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx   |2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx  |8 +--
 sw/qa/extras/uiwriter/uiwriter.cxx  |   16 +++
 sw/qa/extras/uiwriter/uiwriter6.cxx |4 -
 sw/qa/extras/unowriter/unowriter.cxx|   12 ++---
 sw/source/core/access/accdoc.cxx|2 
 sw/source/core/access/accpara.cxx   |4 -
 sw/source/core/crsr/crossrefbookmark.cxx|2 
 sw/source/core/crsr/findtxt.cxx |2 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |2 
 sw/source/core/doc/docbm.cxx|2 
 sw/source/core/doc/docfld.cxx   |4 -
 sw/source/core/doc/doclay.cxx   |2 
 sw/source/core/doc/tblafmt.cxx  |2 
 sw/source/core/edit/edfcol.cxx  |   34 
 sw/source/core/swg/SwXMLTextBlocks1.cxx |2 
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   10 ++--
 sw/source/core/txtnode/attrcontentcontrol.cxx   |2 
 sw/source/core/unocore/unodraw.cxx  |8 +--
 sw/source/core/unocore/unofield.cxx |2 
 sw/source/core/unocore/unoidx.cxx   |2 
 sw/source/core/unocore/unosett.cxx  |2 
 sw/source/core/unocore/unotext.cxx  |2 
 sw/source/core/view/printdata.cxx   |4 -
 sw/source/filter/ascii/wrtasc.cxx   |2 
 sw/source/filter/docx/swdocxreader.cxx  |2 
 sw/source/filter/html/swhtml.cxx|4 -
 sw/source/filter/html/wrthtml.cxx   |2 
 sw/source/filter/ww8/docxexport.cxx |2 
 sw/source/filter/ww8/rtfexport.cxx  |2 
 sw/source/filter/ww8/ww8par5.cxx|2 
 sw/source/filter/ww8/ww8toolbar.cxx |2 
 sw/source/filter/xml/XMLRedlineImportHelper.cxx |6 +-
 sw/source/filter/xml/swxml.cxx  |   12 ++---
 sw/source/filter/xml/xmlexp.cxx |4 -
 sw/source/filter/xml/xmlimp.cxx |   10 ++--
 sw/source/filter/xml/xmltexte.cxx   |2 
 sw/source/ui/vba/vbalisthelper.cxx  |   22 +-
 sw/source/ui/vba/vbaparagraphformat.cxx |2 
 sw/source/uibase/app/applab.cxx |2 
 sw/source/uibase/app/docstyle.cxx   |2 
 sw/source/uibase/config/uinums.cxx  |2 
 sw/source/uibase/dbui/mmconfigitem.cxx  |2 
 sw/source/uibase/shells/grfsh.cxx   |2 
 sw/source/uibase/shells/langhelper.cxx  |6 +-
 sw/source/uibase/shells/textsh1.cxx |   10 ++--
 sw/source/uibase/sidebar/PageMarginControl.cxx  |   10 ++--
 sw/source/uibase/uno/SwXFilterOptions.cxx   |2 
 sw/source/uibase/uno/unomailmerge.cxx   |2 
 sw/source/uibase/uno/unotxdoc.cxx   |2 
 54 files changed, 150 insertions(+), 150 deletions(-)

New commits:
commit a841ac096f2794405408ef64189de2c77971c3e6
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:32 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 20 15:28:25 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: sw

Change-Id: I85fff7ed6932c5fc196e18f24fa01074ba4837e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158241
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx 
b/sw/qa/core/test_ToxLinkProcessor.cxx
index e493320eae90..a47762912c6c 100644
--- a/sw/qa/core/test_ToxLinkProcessor.cxx
+++ b/sw/qa/core/test_ToxLinkProcessor.cxx
@@ -40,12 +40,12 @@ public:
 SwGlobals::ensure();
 }
 
-static constexpr OUStringLiteral STYLE_NAME_1 = u"anyStyle1";
-static constexpr OUStringLiteral STYLE_NAME_2 = u"anyStyle2";
+static constexpr OUString STYLE_NAME_1 = u"anyStyle1"_ustr;
+static constexpr OUString STYLE_NAME_2 = u"anyStyle2"_ustr;
 static const sal_uInt16 POOL_ID_1;
 static const sal_uInt16 POOL_ID_2;
-static constexpr OUStringLiteral URL_1 = u"#anyUrl1";
-static constexpr OUStringLiteral URL_2 = u"#anyUrl2";
+static constexpr OUString URL_1 = u"#anyUrl1"_ustr;
+static constexpr OUString URL_2 = u"#anyUrl2"_ustr;
 };
 
 const sal_

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-20 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-nested-rowspan.docx |binary
 sw/qa/core/layout/tabfrm.cxx  |   11 +
 sw/source/core/layout/tabfrm.cxx  |   37 ++
 3 files changed, 48 insertions(+)

New commits:
commit 8e03dfd6a4bff4eabf779ace9b758b49cf80f8ba
Author: Miklos Vajna 
AuthorDate: Fri Oct 20 08:57:08 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 20 11:53:29 2023 +0200

tdf#157590 sw floattable: avoid hang in the nested + row span case

Regression from commit 905962db870e9d1cf1dcf3bd1be44c347cddafe1 (sw
floattable: handle AllowOverlap==false in the layout, 2023-08-10), the
document load resulted in a hang due to a layout loop.

What happens is that SwTabFrame::MakeAll() first does a Split(), but the
problematic row has cells with rowspans, and once this is combined with
multi-page nested floating tables, we move all the content to the next
page (we only leave a stub table frame on the old page), so the next
time SwTabFrame::MakeAll() is called, we do a Join(), and this leads to
a loop.

The traditional Writer way here would be to add a loop control, but we
can do a little bit better: nobody really asked for row span handling
with nested floating tables, so just don't split rows with row span in
this case, move the entire row forward instead. This is enough to avoid
the layout loop, and a next iteration can still use
SwFlowFrame::MoveBwd() / SwFlowFrame::MoveFwd() to split the complex
row.

The bug is fairly hard to hit, any naive simplification to the original
bugdoc leads to a working layout. Carefully keeping the size of the
document, it's possible to at least simplify the content of the table
cells (while keeping their size unchanged), so we avoid half of the
tables and half of the shapes for a faster test case.

Change-Id: Ib14154200c45ecb7f59e85f9f4f1fe0124c4256e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158228
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/floattable-nested-rowspan.docx 
b/sw/qa/core/layout/data/floattable-nested-rowspan.docx
new file mode 100644
index ..48cbdbfe59c3
Binary files /dev/null and 
b/sw/qa/core/layout/data/floattable-nested-rowspan.docx differ
diff --git a/sw/qa/core/layout/tabfrm.cxx b/sw/qa/core/layout/tabfrm.cxx
index a5e448081b0f..1659cf0df6fd 100644
--- a/sw/qa/core/layout/tabfrm.cxx
+++ b/sw/qa/core/layout/tabfrm.cxx
@@ -98,6 +98,17 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInInlineTable)
 CPPUNIT_ASSERT(!pTab->GetFollow());
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyNestedRowSpan)
+{
+// Given a document with nested floating tables and a row with rowspan 
cells at page boundary:
+// When loading that document:
+// Without the accompanying fix in place, this test would have resulted in 
a layout loop.
+createSwDoc("floattable-nested-rowspan.docx");
+
+// Then make sure the resulting page count matches Word:
+CPPUNIT_ASSERT_EQUAL(6, getPages());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 183c5114178a..688f1e9770a2 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -2644,6 +2644,43 @@ void SwTabFrame::MakeAll(vcl::RenderContext* 
pRenderContext)
 // See if this is a split fly that can also grow.
 auto pUpperFly = static_cast(GetUpper());
 bFlySplit = pUpperFly->IsFlySplitAllowed();
+
+if (bFlySplit)
+{
+// See if this is a nested split fly where the inner 
table also has
+// rowspans.
+SwTextFrame* pAnchorCharFrame = 
pUpperFly->FindAnchorCharFrame();
+if (pAnchorCharFrame && pAnchorCharFrame->IsInFly())
+{
+// Find the row we'll split.
+SwTwips nRemaining
+= aRectFnSet.YDiff(nDeadLine, 
aRectFnSet.GetTop(getFrameArea()));
+nRemaining -= aRectFnSet.GetTopMargin(*this);
+const SwFrame* pRow = Lower();
+for (; pRow->GetNext(); pRow = pRow->GetNext())
+{
+if (nRemaining < 
aRectFnSet.GetHeight(pRow->getFrameArea()))
+{
+break;
+}
+
+nRemaining -= 
aRectFnSet.GetHeight(pRow->getFrameArea());
+}
+// See if any cells have rowspans.
+for (const SwFrame* pLower = pRow->GetLower(); 
pLowe

[Libreoffice-commits] core.git: sw/qa

2023-10-20 Thread Venetia (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf148952.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport19.cxx  |   56 
 2 files changed, 56 insertions(+)

New commits:
commit d1ba7d0ae6d10c72a1503f88e9b9b32f54cade3b
Author: Venetia 
AuthorDate: Mon Sep 18 19:07:34 2023 -0600
Commit: Xisco Fauli 
CommitDate: Fri Oct 20 10:59:08 2023 +0200

tdf#148952 sw: Add unit test

Change-Id: I151f3d59f924280311653de025560e6fd2a826c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157037
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf148952.odt 
b/sw/qa/extras/ooxmlexport/data/tdf148952.odt
new file mode 100644
index ..b4f40f617da6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148952.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
index fbd3bdb4aaaf..f851210048e0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport19.cxx
@@ -1156,6 +1156,62 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf157136)
 }
 }
 
+//Tests for support of fallback for ECMA-376 1st ed to merge the title value 
with descr attribute
+CPPUNIT_TEST_FIXTURE(Test, testTdf148952_2007)
+{
+//Given a document with 1 image (with name, alt title and description 
field populated) in odt format
+createSwDoc("tdf148952.odt");
+
+OUString rFilterName = "MS Word 2007 XML";
+
+//Export it to MS word 2007(.docx) format
+saveAndReload(rFilterName);
+
+// Checks the number of images in the docx file
+const OString sFailedMessage = OString::Concat("Failed on filter: ") + 
rFilterName.toUtf8();
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 1, getShapes());
+
+uno::Reference xImage(getShape(1), uno::UNO_QUERY);
+
+// Check if alt title value is appended to description
+OUString descr;
+xImage->getPropertyValue("Description") >>= descr;
+CPPUNIT_ASSERT_EQUAL(OUString("Black\nShapes"), descr);
+
+// Check if alt title field is empty
+OUString title;
+xImage->getPropertyValue("Title") >>= title;
+CPPUNIT_ASSERT_EQUAL(OUString(""), title);
+}
+
+//Tests for support of title attribute for ECMA-376 2nd ed and above
+CPPUNIT_TEST_FIXTURE(Test, testTdf148952_2010)
+{
+//Given a document with 1 image (with name, alt title and description 
field populated) in odt format
+createSwDoc("tdf148952.odt");
+
+OUString rFilterName = "Office Open XML Text";
+
+//Export it to MS word 2010-365 (.docx) format
+saveAndReload(rFilterName);
+
+// Checks the number of images in the docx file
+const OString sFailedMessage = OString::Concat("Failed on filter: ") + 
rFilterName.toUtf8();
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 1, getShapes());
+
+uno::Reference xImage(getShape(1), uno::UNO_QUERY);
+
+// Check if description field contains same value after export
+OUString descr;
+xImage->getPropertyValue("Description") >>= descr;
+CPPUNIT_ASSERT_EQUAL(OUString("Shapes"), descr);
+
+// Check if alt title field contains same value after export
+OUString title;
+xImage->getPropertyValue("Title") >>= title;
+CPPUNIT_ASSERT_EQUAL(OUString("Black"), title);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-19 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   10 +-
 sw/source/core/doc/DocumentRedlineManager.cxx  |   23 +++
 2 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 34ac12dca3f5af50fddfb7c77e2943897980b815
Author: Mike Kaganski 
AuthorDate: Thu Oct 19 20:32:56 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Oct 20 00:55:03 2023 +0200

Do not forget to notify in cases when modified redline's start/end don't 
move

SwRangeRedline::SetStart/SetEnd call MaybeNotifyRedlineModification,
which means that e.g. continuing typing at the end of the current
redline would continue sending notifications. But as soon as cursor
is moved (e.g. using arrow left, inside the current redline), the
next modification is completely inside the current one, and would
be simply deleted. In this case (and other similar), notifications
weren't sent.

This change tries to make sure that every such case is handled. In
case of delete-inside-insert, when positions are equal, the current
redline is deleted; MaybeNotifyRedlineModification is not called,
to not crash. I don't know if this needs additional notification.

Change-Id: I2a97354623a5a784928ce4e1f2c93606954bd11c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158198
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 13a882b7f82f..d66a2bc98c2d 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1652,9 +1652,9 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testRedlineUpdateCallback)
 m_nRedlineTableEntryModified = 0;
 pWrtShell->DelLeft();
 
-// Assert that we get exactly one notification about the redline update.
+// Assert that we get exactly two notification about the redline update.
 // This was 0, as LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED wasn't sent.
-CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
 
 // Turn off the change tracking mode, make some modification to left of the
 // redline so that its position changes
@@ -1663,18 +1663,18 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testRedlineUpdateCallback)
 pWrtShell->Insert("This text is left of the redline");
 
 // Position of the redline has changed => Modify callback
-CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
 
 pWrtShell->DelLeft();
 // Deletion also emits Modify callback
-CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
 
 // Make changes to the right of the redline => no position change in 
redline
 pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 100/*Go 
enough right */, /*bBasicCall=*/false);
 pWrtShell->Insert("This text is right of the redline");
 
 // No Modify callbacks
-CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
+CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
 }
 
 CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState)
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index f5ab5a9fdba3..7a9af1ee8891 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1427,6 +1427,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 !pRedl->IsMoved() )
 {
 bool bDelete = false;
+bool bMaybeNotify = false;
 
 // Merge if applicable?
 if( (( SwComparePosition::Behind == eCmpPos &&
@@ -1477,22 +1478,22 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
 *pStt = *pREnd;
 if( ( *pStt == *pEnd ) &&
 ( pNewRedl->GetContentIdx() == nullptr ) )
-bDelete = true;
+bDelete = bMaybeNotify = true;
 }
 else if( SwComparePosition::OverlapBefore == eCmpPos )
 {
 *pEnd = *pRStt;
 if( ( *pStt == *pEnd ) &&
 ( pNewRedl->GetContentIdx() == nullptr ) )
-bDelete = true;
+bDelete = bMaybeNotify = true;
 }
 else if( SwComparePosition::Inside == eCmpPos )
 {
-bDelete = true;
+bDelete = bMaybeNotify = true;
 bMerged = true;
 }
  

[Libreoffice-commits] core.git: sw/qa

2023-10-19 Thread Miklos Vajna (via logerrit)
 sw/qa/core/text/data/floattable-anchor-left-margin.docx |binary
 sw/qa/core/text/itrform2.cxx|   23 
 2 files changed, 23 insertions(+)

New commits:
commit 65f508b44ecbc20c8bd5172d1656639f686730ff
Author: Miklos Vajna 
AuthorDate: Thu Oct 19 13:44:24 2023 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 19 18:36:52 2023 +0200

tdf#157573 sw floattable: add missing testcase

Fails with commit 626fe9ab5ebebc4ef36e35f4aa597c03a3564d22 (tdf#157573
sw floattable: fix incorrect lack of left margin after table,
2023-10-18) reverted.

Change-Id: I6a3bd69dc109e6df195d00c33118218eeaa00ce5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158179
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/text/data/floattable-anchor-left-margin.docx 
b/sw/qa/core/text/data/floattable-anchor-left-margin.docx
new file mode 100644
index ..aa55a0ce3001
Binary files /dev/null and 
b/sw/qa/core/text/data/floattable-anchor-left-margin.docx differ
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 0705069b3038..02cd813ae549 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -143,6 +144,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlHeaderPDFExport)
 // i.e. not all of header, heading and body text was there on page 2, 
content was lost.
 CPPUNIT_ASSERT_EQUAL(3, nTextCount);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyAnchorLeftMargin)
+{
+// Given a document with a floating table, anchor para is followed by an 
other para with a left
+// margin:
+createSwDoc("floattable-anchor-left-margin.docx");
+
+// When laying out that document:
+calcLayout();
+
+// Then make sure that the left margin of this last paragraph is not lost:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+SwContentFrame* pLastPara = pPage->FindLastBodyContent();
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 6480
+// - Actual  : 0
+// i.e. the left margin was lost.
+CPPUNIT_ASSERT_EQUAL(static_cast(6480), 
pLastPara->getFramePrintArea().Left());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sw/qa

2023-10-19 Thread Stephan Bergmann (via logerrit)
 sw/qa/core/uwriter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6359969e230af2569bb68e75ecfd85d43f95e20b
Author: Stephan Bergmann 
AuthorDate: Wed Oct 18 21:25:13 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 09:33:37 2023 +0200

Presumed loplugin:cppunitassertequals

Change-Id: I8acd32ff2cf3bd1b72136fd40e93ce047909f677
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158138
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 6875d63073d7..b64c67402c8d 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -762,7 +762,7 @@ void SwDocTest::testSwScanner()
 aPaM.GetPoint()->nContent.Assign(aPaM.GetPointContentNode(), 5);   
//set end of selection to fifth char of current node
 m_pDoc->getIDocumentContentOperations().DeleteAndJoin(aPaM);
//redline-aware deletion api
 //"real underlying text should be the same"
-CPPUNIT_ASSERT_EQUAL(pTextNode->GetText(), OUString(aString));
+CPPUNIT_ASSERT_EQUAL(OUString(aString), pTextNode->GetText());
 
 aDocStat.Reset();
 pTextNode->SetWordCountDirty(true);


[Libreoffice-commits] core.git: sw/qa

2023-10-17 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |   16 
 1 file changed, 16 deletions(-)

New commits:
commit ca81a82cabe650af47cb73cfceb2800932104ae8
Author: Miklos Vajna 
AuthorDate: Tue Oct 17 20:10:37 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 18 08:19:04 2023 +0200

CppunitTest_sw_ooxmlexport8: clean up not needed preTest()

This would set (and unset) custom configuration based on filenames, but
the suite has no such files anymore, so this can be removed.

Change-Id: I8f1dd40b62adcd71a0e4ae303c5d317943ef438b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158094
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 39badeb658ca..8c2261932e7a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -30,7 +30,6 @@
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -46,21 +45,6 @@ class Test : public SwModelTestBase
 {
 public:
 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open 
XML Text") {}
-
-virtual std::unique_ptr preTest(const char* filename) override
-{
-if (filename == std::string_view("smartart.docx")
-|| filename == std::string_view("strict-smartart.docx") )
-{
-std::unique_ptr pResetter(new Resetter(
-[] () {
-SvtFilterOptions::Get().SetSmartArt2Shape(false);
-}));
-SvtFilterOptions::Get().SetSmartArt2Shape(true);
-return pResetter;
-}
-return nullptr;
-}
 };
 
 DECLARE_OOXMLEXPORT_TEST(testN751054, "n751054.docx")


[Libreoffice-commits] core.git: sw/qa

2023-10-17 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx   |   50 ++
 sw/qa/uitest/writer_tests4/spellDialog.py |   66 --
 2 files changed, 50 insertions(+), 66 deletions(-)

New commits:
commit 7acd895d8a6ed16611a20873f3b2216fccef0634
Author: Xisco Fauli 
AuthorDate: Tue Oct 17 12:59:15 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Oct 18 00:19:37 2023 +0200

tdf#45949, tdf#152492: move UITest to CppUnittest

Disable the test on mac because it fails with

Test name: testTdf45949::TestBody
equality assertion failed
- Expected: 2
- Actual  : 1

Change-Id: I366eba2db939b25f70a859c6622901c1e0f55718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158082
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 3d4b6e3d8d8a..726e16774f3f 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1688,6 +1688,56 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603)
 }
 }
 
+#if !defined(MACOSX)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf45949)
+{
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+const SwViewOption* pOpt = pWrtShell->GetViewOptions();
+uno::Sequence params
+= comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } });
+dispatchCommand(mxComponent, ".uno:SpellOnline", params);
+
+// Automatic Spell Checking is enabled
+CPPUNIT_ASSERT(pOpt->IsOnlineSpell());
+
+// check available en_US dictionary and test spelling with it
+uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl());
+uno::Reference xSpell;
+xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY);
+LanguageType eLang = LanguageTag::convertToLanguageType(lang::Locale("en", 
"US", OUString()));
+if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang)))
+{
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+emulateTyping(*pTextDoc, u"baaad http://www.baaad.org baaad");
+SwCursorShell* pShell(pDoc->GetEditShell());
+SwTextNode* pNode = pShell->GetCursor()->GetPointNode().GetTextNode();
+
+// tdf#152492: Without the fix in place, this test would have failed 
with
+// - Expected: 1
+// - Actual  : 3
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pNode->GetWrong()->Count());
+
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 10, 
/*bBasicCall=*/false);
+emulateTyping(*pTextDoc, u" ");
+
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), pNode->GetWrong()->Count());
+
+pWrtShell->Left(SwCursorSkipMode::Chars, /*bSelect=*/false, 6, 
/*bBasicCall=*/false);
+emulateTyping(*pTextDoc, u" ");
+
+// Move down to trigger spell checking
+pWrtShell->Down(/*bSelect=*/false, 1);
+
+// Without the fix in place, this test would have failed with
+// - Expected: 3
+// - Actual  : 2
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), pNode->GetWrong()->Count());
+}
+}
+#endif
+
 #if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157442)
 {
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py 
b/sw/qa/uitest/writer_tests4/spellDialog.py
index 39ef8eaebe42..5fbffe93b1ca 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -139,72 +139,6 @@ frog, dogg, catt"""
 # correctly without the redline containing a deleted "o"
 self.assertEqual(output_text, 'goood baaadbaaed eeend')
 
-def test_DoNotCheckURL(self):
-supported_locale = self.is_supported_locale("en", "US")
-if not supported_locale:
-self.skipTest("no dictionary support for en_US available")
-
-with self.ui_test.create_doc_in_start_center("writer") as document:
-cursor = document.getCurrentController().getViewCursor()
-# Inserted text must be en_US, so make sure to set language in 
current location
-cursor.CharLocale = Locale("en", "US", "")
-
-xMainWindow = self.xUITest.getTopFocusWindow()
-xEdit = xMainWindow.getChild("writer_edit")
-
-# URL is recognized during typing
-type_text(xEdit, "baaad http://www.baaad.org baaad baaad")
-
-with 
self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog",
 close_button="close") as xDialog:
-checkgrammar = xDialog.getChild('checkgrammar')
-if get_state_as_dict(checkgrammar)['Selected'] == 'true':
-checkgrammar.executeAction('CLICK', ())
-self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 
'false')
-
-change = xDialog.getChild('change')
-change.executeAction("CLICK", ())
-change.executeAction("CLICK", ())
-
- 

[Libreoffice-commits] core.git: sw/qa

2023-10-17 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   43 ++--
 1 file changed, 41 insertions(+), 2 deletions(-)

New commits:
commit 4be9bd0595cec36b6a22ca12b48661e080a5a1d8
Author: Xisco Fauli 
AuthorDate: Tue Oct 17 11:13:07 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 17 21:30:57 2023 +0200

tdf#157442: sw_uiwriter6: Add unittest

gerrit_mac fails with

[_RUN_] testTdf157442::TestBody

Error: a unit test failed, please do one of:
make CppunitTest_sw_uiwriter6 CPPUNITTRACE="lldb --"   # for 
interactive debugging on macOS
make CppunitTest_sw_uiwriter6 VALGRIND=memcheck# for memory 
checking

You can limit the execution to just one particular test by:

make CppunitTest_sw_uiwriter6 CPPUNIT_TEST_NAME="testXYZ" ...above 
mentioned params...

so disable it for now on mac

Change-Id: Iaf51987010a976a3a38f264d6b45c8cc6eb7f283
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158079
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index ac5155f429a9..3d4b6e3d8d8a 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -46,6 +46,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1687,9 +1688,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
+#if !defined(MACOSX)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157442)
 {
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+const SwViewOption* pOpt = pWrtShell->GetViewOptions();
+uno::Sequence params
+= comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } });
+dispatchCommand(mxComponent, ".uno:SpellOnline", params);
+
+// Automatic Spell Checking is enabled
+CPPUNIT_ASSERT(pOpt->IsOnlineSpell());
+
+// check available en_US dictionary and test spelling with it
+uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl());
+uno::Reference xSpell;
+xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY);
+LanguageType eLang = LanguageTag::convertToLanguageType(lang::Locale("en", 
"US", OUString()));
+if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang)))
+{
+uno::Reference xLinguProperties(
+LinguMgr::GetLinguPropertySet());
+
+// Spell with digits is disabled by default
+CPPUNIT_ASSERT_EQUAL(sal_False, 
xLinguProperties->getIsSpellWithDigits());
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+emulateTyping(*pTextDoc, u"ErrorError Treee2 ");
+SwCursorShell* pShell(pDoc->GetEditShell());
+SwTextNode* pNode = pShell->GetCursor()->GetPointNode().GetTextNode();
+
+// Without the fix in place, this test would have crashed because 
GetWrong() returns nullptr
+CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pNode->GetWrong()->Count());
+}
+}
+#endif
+
 #if !defined(MACOSX)
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
+{
 createSwDoc("tdf65535.fodt");
 SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
 SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
@@ -1755,8 +1794,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
 }
 // This was false (lost comment with spelling replacement)
 CPPUNIT_ASSERT_EQUAL(OString("with comment"), sCommentText);
-#endif
 }
+#endif
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect)
 {


[Libreoffice-commits] core.git: sw/qa

2023-10-17 Thread Noel Grandin (via logerrit)
 sw/qa/uitest/navigator/tdf154521.py |   58 ++--
 1 file changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 6347dcbd3ab2e0a7cb2f7de3bcb5d007e8befc09
Author: Noel Grandin 
AuthorDate: Tue Oct 17 18:17:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 17 21:01:22 2023 +0200

disable more unreliable navigator UITest

Change-Id: I5df1edd842f4b1ed0936f6b903c6d2b2ac3aad39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158091
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sw/qa/uitest/navigator/tdf154521.py 
b/sw/qa/uitest/navigator/tdf154521.py
index c2140f2ce889..35972c5f53a7 100644
--- a/sw/qa/uitest/navigator/tdf154521.py
+++ b/sw/qa/uitest/navigator/tdf154521.py
@@ -159,44 +159,44 @@ class tdf154521(UITestCase):
 #self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
 #
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
 #
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+#xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+#self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
 
-# This was "Navigator"
-self.assertEqual(self.getTitle(xDoc), "Bookmark 2")
+## This was "Navigator"
+#self.assertEqual(self.getTitle(xDoc), "Bookmark 2")
 
-# Try the same selection with Bookmark 3
+## Try the same selection with Bookmark 3
 
-# why we need this extra UP?
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 3")
+## why we need this extra UP?
+#xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
+#self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
+#xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
+#self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 3")
 
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
3")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 3")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
3")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
3")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+#xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+#self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 3")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
3")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
 
-# This was "Navigator"
-self.assertEqual(self.getTitle(xDoc), "Bookmark 3")
+## This was "Navigator"
+#self.assertEqual(self.getTitle(xDoc), "Bookmark 3")
 
-# go to the previous item
+## go to the previous item
 
-# why we need this extra UP?
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 3")
-xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmarks")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], 
"Bookmarks")
-

[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/qa writerfilter/source

2023-10-16 Thread Miklos Vajna (via logerrit)
 sw/qa/filter/ww8/ww8.cxx|  
 23 ++
 sw/source/filter/ww8/docxexport.cxx |  
 12 +
 writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx  |  
 18 +++
 writerfilter/qa/cppunittests/dmapper/data/floattable-wrap-on-all-pages.docx 
|binary
 writerfilter/source/dmapper/SettingsTable.cxx   |  
 23 ++
 writerfilter/source/ooxml/OOXMLPropertySet.cxx  |  
  2 
 writerfilter/source/ooxml/OOXMLPropertySet.hxx  |  
  2 
 7 files changed, 79 insertions(+), 1 deletion(-)

New commits:
commit 33ade4171a1a443fd24e6463a9eaa279f7d778bb
Author: Miklos Vajna 
AuthorDate: Mon Oct 16 08:46:54 2023 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 16 09:53:35 2023 +0200

sw floattable, wrap on all pages: add DOCX filter

- map DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK to
   on export

- do the opposite on import

  - this requires a bit of rework, to avoid routing 
via a grab-bag when we want to actually read it during import

  - also expose GetBooleanValue() from the OOXML tokenizer, so dmapper
can know when the value of the compat flag is a true-like string.

Note that it seems DOC and RTF don't have a matching compat flag for
this.

Change-Id: I0cb1230ee40994f59b816c42f8e7d2ac658b3212
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158013
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 6a858193e776..1d863545578e 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -332,6 +332,29 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables)
 assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotBreakWrappedTables", 1);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak)
+{
+// Given a document with the ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK compat 
mode enabled:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+IDocumentSettingAccess& rIDSA = pDoc->getIDocumentSettingAccess();
+rIDSA.set(DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK, true);
+
+// When saving to docx:
+save("Office Open XML Text");
+
+// Then make sure the compat flag is serialized:
+xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// - XPath 
'/w:settings/w:compat/w:compatSetting[@w:name='allowTextAfterFloatingTableBreak']'
 number of nodes is incorrect
+// i.e. the compat flag was lost on export.
+assertXPath(pXmlDoc,
+
"/w:settings/w:compat/w:compatSetting[@w:name='allowTextAfterFloatingTableBreak']",
+"val", "1");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testDOCfDontBreakWrappedTables)
 {
 // Given a document with fDontBreakWrappedTables:
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 61319d5e2f3b..42ff0fdf7a09 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1435,6 +1435,18 @@ void DocxExport::WriteSettings()
 FSNS( XML_w, XML_name ), "compatibilityMode",
 FSNS( XML_w, XML_uri ),  
"http://schemas.microsoft.com/office/word";,
 FSNS( XML_w, XML_val ),  
OString::number(nTargetCompatibilityMode));
+
+const IDocumentSettingAccess& rIDSA = 
m_rDoc.getIDocumentSettingAccess();
+if 
(rIDSA.get(DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK))
+{
+// AllowTextAfterFloatingTableBreak doesn't have its own XML 
element, it's a
+//  with a specific name.
+pFS->singleElementNS(XML_w, XML_compatSetting,
+FSNS(XML_w, XML_name), "allowTextAfterFloatingTableBreak",
+FSNS(XML_w, XML_uri), 
"http://schemas.microsoft.com/office/word";,
+FSNS(XML_w, XML_val), "1");
+}
+
 pFS->endElementNS( XML_w, XML_compat );
 }
 
diff --git a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx 
b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
index 8b36a6170bb0..00d4147bfb05 100644
--- a/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/SettingsTable.cxx
@@ -41,6 +41,24 @@ CPPUNIT_TEST_FIXTURE(Test, testDoNotBreakWrappedTables)
 // set.
 CPPUNIT_ASSERT(bDoNotBreakWrappedTables);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testAllowTextAfterFloatingTableBreak)
+{
+// Given a document with :
+// When importing that document:
+loadFromURL(u"floattable-wrap-on-all-pages.docx");
+
+// Then make sure that the matching compat flag is set:
+uno::Reference xDocument(mxComponent, 
uno::UNO_QUERY);
+uno:

[Libreoffice-commits] core.git: sw/qa

2023-10-14 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/uiwriter/uiwriter5.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 974a1c84ea354fe712ec09db68266d5a82023c5e
Author: Andrea Gelmini 
AuthorDate: Sat Oct 14 12:22:38 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 14 16:30:23 2023 +0200

Fix typo

Change-Id: I6e1c0f7ef3a99d68c078b1d0c524bad54d240bfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157974
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index d97e0a8911f0..00371e084678 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -2255,7 +2255,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf157662_AcceptInsertRedlineCutWithDe
 pEditShell->RejectRedline(6);
 CPPUNIT_ASSERT_EQUAL(static_cast(6), 
pEditShell->GetRedlineCount());
 
-// Accept insert that splitted into 4 parts, but separeted to 2-2 parts, 
with another insert.
+// Accept insert that splitted into 4 parts, but separated to 2-2 parts, 
with another insert.
 // It will accept only 2 parts, that is not separated. It leave the 
deletion.
 pEditShell->AcceptRedline(0);
 CPPUNIT_ASSERT_EQUAL(static_cast(5), 
pEditShell->GetRedlineCount());
@@ -2282,12 +2282,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testTdf157662_RejectInsertRedlineCutWithDe
 SwEditShell* const pEditShell(pDoc->GetEditShell());
 CPPUNIT_ASSERT_EQUAL(static_cast(9), 
pEditShell->GetRedlineCount());
 
-// Reject the insert that splitted into 3 parts .. reject all 3 of them
+// Reject the insert that splitted into 3 parts. reject all 3 of them
 // it even remove the deletion, that was on the 2. insert...
 pEditShell->RejectRedline(6);
 CPPUNIT_ASSERT_EQUAL(static_cast(6), 
pEditShell->GetRedlineCount());
 
-// Reject insert that splitted into 4 parts, but separeted to 2-2 parts, 
with another insert.
+// Reject insert that splitted into 4 parts, but separated to 2-2 parts, 
with another insert.
 // It will reject only 2 parts, that is not separated. It remove the 
deletion.
 pEditShell->RejectRedline(0);
 CPPUNIT_ASSERT_EQUAL(static_cast(4), 
pEditShell->GetRedlineCount());


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-13 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx |binary
 sw/qa/core/layout/flycnt.cxx |   39 +++
 sw/source/core/inc/flyfrms.hxx   |1 
 sw/source/core/layout/flycnt.cxx |   18 ++
 sw/source/core/text/frmform.cxx  |5 +
 sw/source/core/text/porrst.cxx   |7 ++
 6 files changed, 68 insertions(+), 2 deletions(-)

New commits:
commit 7d7ca347fafa7a06094b00e8fb0d0452c4c81366
Author: Miklos Vajna 
AuthorDate: Fri Oct 13 08:48:43 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 13 10:25:26 2023 +0200

sw floattable, wrap on all pages: add layout

The anchor text of a floating table is normally wrapped around the table
only on the last page of the table. This compat flag requests to wrap on
all pages instead.

First, disable the SwTextFrame::FormatEmpty() optimization in this case,
so not only the last page has portions inside the text frame.

Second, improve SwTextFrame::FormatAdjust(), so that anchor content from
the last page can flow to previous pages.

Note that having a dedicated SwFlyAtContentFrame::IsWrapOnAllPages()
means that later it'll be possible to do per-frame decision on this if
there is demand for that (this came up on the mailing list, but it's not
something Word would support).

Change-Id: I75df539df859aaa6c7eaaeddb33f004639b1c004
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157902
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx 
b/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx
new file mode 100644
index ..39642002bbed
Binary files /dev/null and 
b/sw/qa/core/layout/data/floattable-wrap-on-all-pages.docx differ
diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
index 325b0078ecb0..16cd9cda4a57 100644
--- a/sw/qa/core/layout/flycnt.cxx
+++ b/sw/qa/core/layout/flycnt.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -1183,6 +1184,44 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInTableInSection)
 SwSortedObjs& rPage3Objs = *pPage3->GetSortedObjs();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage3Objs.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyWrapOnAllPages)
+{
+// Given a document where we want to wrap on all pages, around a split 
floating table:
+createSwDoc("floattable-wrap-on-all-pages.docx");
+SwDoc* pDoc = getSwDoc();
+
pDoc->getIDocumentSettingAccess().set(DocumentSettingId::ALLOW_TEXT_AFTER_FLOATING_TABLE_BREAK,
+  true);
+
+// When formatting that document:
+SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell();
+pWrtShell->Reformat();
+
+// Then make sure that the anchor text is also split between page 1 and 
page 2:
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+pLayout->dumpAsXml();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+auto pPage1Anchor = pPage1->FindLastBodyContent()->DynCastTextFrame();
+CPPUNIT_ASSERT(pPage1Anchor);
+OUString aAnchor1Text(pPage1Anchor->GetText().subView(
+static_cast(pPage1Anchor->GetOffset()),
+static_cast(pPage1Anchor->GetFollow()->GetOffset()
+   - pPage1Anchor->GetOffset(;
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: He heard quiet steps behind him. That
+// - Actual  :
+// i.e. the first page had no anchor text, only the second.
+CPPUNIT_ASSERT_EQUAL(OUString("He heard quiet steps behind him. That "), 
aAnchor1Text);
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+auto pPage2Anchor = pPage2->FindLastBodyContent()->DynCastTextFrame();
+CPPUNIT_ASSERT(pPage2Anchor);
+OUString aAnchor2Text(
+
pPage2Anchor->GetText().subView(static_cast(pPage2Anchor->GetOffset(;
+CPPUNIT_ASSERT(!pPage2Anchor->GetFollow());
+CPPUNIT_ASSERT_EQUAL(OUString("didn't bode well."), aAnchor2Text);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx
index fd4fff11b1d5..051d514fd31e 100644
--- a/sw/source/core/inc/flyfrms.hxx
+++ b/sw/source/core/inc/flyfrms.hxx
@@ -202,6 +202,7 @@ public:
 SwFlyAtContentFrame* GetPrecede();
 /// Like Cut(), except that follow chaining is maintained.
 void DelEmpty();
+bool IsWrapOnAllPages() const;
 void dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const override;
 };
 
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 98843c2c0d47..c07201f49f43 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1784,6 +1784

[Libreoffice-commits] core.git: sw/qa

2023-10-12 Thread Miklos Vajna (via logerrit)
 sw/qa/core/text/itrform2.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 7f17f309ff14a1e630ee5befc425dfdbfaf3759f
Author: Miklos Vajna 
AuthorDate: Thu Oct 12 15:53:52 2023 +0200
Commit: Miklos Vajna 
CommitDate: Fri Oct 13 08:11:43 2023 +0200

CppunitTest_sw_core_text: fix --disable-pdfium failure

Change-Id: I6e0727a60491aa108c949836ebc6fd52a77984c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157868
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 187eb9ab678e..0705069b3038 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -123,6 +123,10 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlHeaderPDFExport)
 
 // Then make sure all the expected text is there on page 2:
 std::unique_ptr pPdfDocument = parsePDFExport();
+if (!pPdfDocument)
+{
+return;
+}
 std::unique_ptr pPage2 = pPdfDocument->openPage(1);
 int nTextCount = 0;
 for (int i = 0; i < pPage2->getObjectCount(); ++i)


[Libreoffice-commits] core.git: sw/qa

2023-10-11 Thread Tomaž Vajngerl (via logerrit)
 sw/qa/extras/ooxmlimport/data/SimpleFirst.docx  |binary
 sw/qa/extras/ooxmlimport/data/SimpleFirst.odt   |binary
 sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.docx |binary
 sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.odt  |binary
 sw/qa/extras/ooxmlimport/data/SimpleLeftRight.docx  |binary
 sw/qa/extras/ooxmlimport/data/SimpleLeftRight.odt   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx   |  214 
 7 files changed, 214 insertions(+)

New commits:
commit 955ca0eba5c9ec22fbae0fc3e6220914ec3d69be
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 11 22:46:03 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 12 06:44:26 2023 +0200

sw: prepare tests cases for first, left, right headers and variants

This prepares the test case for first, left, right headers, only
first and non-first headers, only left and right (no first) headers
and make them run for ODF, where they should work as expected.
In a follow up commit, the OOXML implementation should be fixed so
that the same tests pass for OOXML documents.

Change-Id: I1e7f610324c14dd9eb285ff9d46829610de5b1b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157838
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sw/qa/extras/ooxmlimport/data/SimpleFirst.docx 
b/sw/qa/extras/ooxmlimport/data/SimpleFirst.docx
new file mode 100644
index ..1641a2d084ed
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/SimpleFirst.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/data/SimpleFirst.odt 
b/sw/qa/extras/ooxmlimport/data/SimpleFirst.odt
new file mode 100644
index ..fc165e966f85
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/SimpleFirst.odt 
differ
diff --git a/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.docx 
b/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.docx
new file mode 100644
index ..2b530a5e324f
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.odt 
b/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.odt
new file mode 100644
index ..d5035ac8f581
Binary files /dev/null and 
b/sw/qa/extras/ooxmlimport/data/SimpleFirstLeftRight.odt differ
diff --git a/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.docx 
b/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.docx
new file mode 100644
index ..80dbda0420d7
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.odt 
b/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.odt
new file mode 100644
index ..61302944da30
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/SimpleLeftRight.odt 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 76210cd2ef20..6b4054c4e38f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -48,6 +48,10 @@
 class Test : public SwModelTestBase
 {
 public:
+void checkFirstLeftRightHeaderPageStyles();
+void checkFirstRestHeaderPageStyles();
+void checkLeftRightHeaderPageStyles();
+
 Test()
 : SwModelTestBase("/sw/qa/extras/ooxmlimport/data/", "Office Open XML 
Text")
 {
@@ -1194,6 +1198,216 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf141969)
 CPPUNIT_ASSERT_EQUAL(8.0f, getProperty(xRun, "CharHeight"));
 }
 
+void Test::checkFirstLeftRightHeaderPageStyles()
+{
+// Page 1
+{
+OUString pageStyle;
+uno::Reference 
xPropertySet(getParagraphOrTable(1), uno::UNO_QUERY);
+
+uno::Reference xTextRange(xPropertySet, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Para 1"), xTextRange->getString());
+
+xPropertySet->getPropertyValue("PageStyleName") >>= pageStyle;
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"), pageStyle);
+}
+
+// Page 2
+{
+OUString pageStyle;
+uno::Reference 
xPropertySet(getParagraphOrTable(2), uno::UNO_QUERY);
+
+uno::Reference xTextRange(xPropertySet, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Para 2"), xTextRange->getString());
+
+xPropertySet->getPropertyValue("PageStyleName") >>= pageStyle;
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"), pageStyle);
+}
+
+// Page 3
+{
+OUString pageStyle;
+uno::Reference 
xPropertySet(getParagraphOrTable(3), uno::UNO_QUERY);
+
+uno::Reference xTextRange(xPropertySet, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("Para 3"), xTextRange->getString());
+
+xPropertySet->getPropertyValue("PageStyleName") >>= pageStyle;
+CPPUNIT_ASSERT_EQUAL(OUString("Standard"), pageStyle);
+}
+}
+
+void Test::checkFirstRestHeaderPageStyles()
+{
+// Page 1
+{
+OUString pageStyle;
+uno::Reference 
xProperty

[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/text/data/content-control-header.docx |binary
 sw/qa/core/text/itrform2.cxx |   27 +++
 sw/source/core/text/itrform2.cxx |   10 +++-
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 5dff1f3a995a8e78a156214fd9c32b1005337183
Author: Miklos Vajna 
AuthorDate: Tue Oct 10 20:06:39 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 11 10:11:20 2023 +0200

tdf#157593 sw content control, PDF export: fix headers/footers

Regression from commit de90c192cb8f1f03a4028493d8bfe9a127a76b2a (sw
content controls, plain text: enable DOCX filter with data binding,
2022-09-19), the PDF export of the bugdoc was broken, content was
missing on page 2.

Looking at the problem at a higher level, PDF form control in a header
or footer makes no sense, since then you would get multiple answers for
the same question.

Fix the problem by disabling the mapping of Writer content controls to
PDF widgets in headers and footers.

Note that the original motivation is probably around providing a way to
set the document header via scripting, without touching document.xml or
headerN.xml. This valid use-case still works after this fix, we still
update the value of the content control from data binding.

Change-Id: I969682bf90026236276992dd6b6099e50dffe949
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157769
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/core/text/data/content-control-header.docx 
b/sw/qa/core/text/data/content-control-header.docx
new file mode 100644
index ..c65ac1d41cac
Binary files /dev/null and b/sw/qa/core/text/data/content-control-header.docx 
differ
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 637396a01c2e..187eb9ab678e 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -112,6 +112,33 @@ CPPUNIT_TEST_FIXTURE(Test, testFlyMinimalWrap)
 // text frames in the body frame, not 2.
 CPPUNIT_ASSERT(!pPage2Para2->GetNext());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testContentControlHeaderPDFExport)
+{
+// Given a document with a content control in the header:
+createSwDoc("content-control-header.docx");
+
+// When exporting to PDF:
+save("writer_pdf_Export");
+
+// Then make sure all the expected text is there on page 2:
+std::unique_ptr pPdfDocument = parsePDFExport();
+std::unique_ptr pPage2 = pPdfDocument->openPage(1);
+int nTextCount = 0;
+for (int i = 0; i < pPage2->getObjectCount(); ++i)
+{
+std::unique_ptr pObject = 
pPage2->getObject(i);
+if (pObject->getType() == vcl::pdf::PDFPageObjectType::Text)
+{
+++nTextCount;
+}
+}
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 3
+// - Actual  : 2
+// i.e. not all of header, heading and body text was there on page 2, 
content was lost.
+CPPUNIT_ASSERT_EQUAL(3, nTextCount);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 36a86504adc5..6511d0ab45c9 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -974,8 +974,16 @@ bool SwContentControlPortion::DescribePDFControl(const 
SwTextPaintInfo& rInf) co
 return false;
 }
 
-// Check if this is the first content control portion of this content 
control.
 SwTextNode* pTextNode = pContentControl->GetTextNode();
+SwDoc& rDoc = pTextNode->GetDoc();
+if (rDoc.IsInHeaderFooter(*pTextNode))
+{
+// Form control in header/footer makes no sense, would allow multiple 
values for the same
+// control.
+return false;
+}
+
+// Check if this is the first content control portion of this content 
control.
 sal_Int32 nStart = m_pTextContentControl->GetStart();
 sal_Int32 nEnd = *m_pTextContentControl->GetEnd();
 TextFrameIndex nViewStart = rInf.GetTextFrame()->MapModelToView(pTextNode, 
nStart);


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-11 Thread Miklos Vajna (via logerrit)
 sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx |binary
 sw/qa/core/layout/flycnt.cxx |   26 +++
 sw/source/core/layout/flycnt.cxx |   26 ---
 3 files changed, 48 insertions(+), 4 deletions(-)

New commits:
commit 6b9378154f9b504b9e924fe4565df444786e7d73
Author: Miklos Vajna 
AuthorDate: Wed Oct 11 08:32:02 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 11 09:47:26 2023 +0200

sw floattable, crashtesting: fix PDF export of ooo91654-1.doc

Regression from 89a75cd194371002247d0138e759835bc673f7b0 (tdf#126449 sw
floattable: DOC import: handle inner floating table, 2023-10-04), the
document crashed Writer layout when exporting to PDF, which triggers a
layout calculation.

The trouble seems to be that in case the split fly is anchored in a
table which is in a section, then we assume that we can create a section
on the next page and move the follow fly frame there, which will mean
the follow anchor won't be in a table anymore.

Fix this by not moving the follow anchor explicitly, similar to what the
nested floating table (inline or floating outer table) code does. The
layout will later figure out that the available space is not enough,
split the outer table for us, which will lead to a correct result.

Note that the original bugdoc is DOC, but just saving it as-is in Word
hides the problem, so it's not easy to minimize the reproducer. Instead
create a similar DOCX reproducer from scratch.

Change-Id: I769615af467ccaa88057ab322da2865f11d3d2ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157803
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx 
b/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx
new file mode 100644
index ..ff329ecb5a5f
Binary files /dev/null and 
b/sw/qa/core/layout/data/floattable-in-inltbl-in-sect.docx differ
diff --git a/sw/qa/core/layout/flycnt.cxx b/sw/qa/core/layout/flycnt.cxx
index 37b255945d9e..325b0078ecb0 100644
--- a/sw/qa/core/layout/flycnt.cxx
+++ b/sw/qa/core/layout/flycnt.cxx
@@ -1157,6 +1157,32 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyDelEmpty)
 // Then make sure that the page count matches Word:
 CPPUNIT_ASSERT_EQUAL(7, getPages());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInTableInSection)
+{
+// Given a document where page 2 and page 3 has a floating table inside an 
inline table, inside
+// a section:
+// Without the accompanying fix in place, this test would have crashed, we 
created a follow
+// anchor which was marked as "in table", but had no table parent.
+createSwDoc("floattable-in-inltbl-in-sect.docx");
+
+// Then make sure that the floating table is on page 2 and page 3:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage1 = pLayout->Lower()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage1);
+CPPUNIT_ASSERT(!pPage1->GetSortedObjs());
+auto pPage2 = pPage1->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage2);
+CPPUNIT_ASSERT(pPage2->GetSortedObjs());
+SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage2Objs.size());
+auto pPage3 = pPage2->GetNext()->DynCastPageFrame();
+CPPUNIT_ASSERT(pPage3);
+CPPUNIT_ASSERT(pPage3->GetSortedObjs());
+SwSortedObjs& rPage3Objs = *pPage3->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), rPage3Objs.size());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 3c0254f929b8..98843c2c0d47 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -1579,11 +1579,30 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType 
eMakePage )
 SwLayoutFrame *pLayLeaf = nullptr;
 // Look up the first candidate.
 SwSectionFrame* pFlyAnchorSection = pFlyAnchor ? 
pFlyAnchor->FindSctFrame() : nullptr;
+bool bNesting = false;
 if (pFlyAnchorSection)
 {
-// We can't just move the split anchor to the next page, that would be 
outside the section.
-// Rather split that section as well.
-pLayLeaf = pFlyAnchorSection->GetNextSctLeaf(eMakePage);
+// The anchor is in a section.
+if (pFlyAnchor)
+{
+SwTabFrame* pFlyAnchorTab = pFlyAnchor->FindTabFrame();
+if (pFlyAnchorTab)
+{
+// The anchor is in table as well.
+if (pFlyAnchorTab->FindSctFrame() == pFlyAnchorSection)
+{
+// We're in a table-in-section, no anchor move in this 
case, because that would
+// mean we're not in a table anymore.
+bNesting = true;
+}
+  

[Libreoffice-commits] core.git: sw/qa

2023-10-10 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit b9fee0f1bb22555f321c8c071e6171ad2664b297
Author: Andrea Gelmini 
AuthorDate: Tue Oct 10 14:50:38 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Oct 10 14:57:17 2023 +0200

Remove exec bits on .doc file

Change-Id: Ia5cf772cab86869a46c5a8f610fe43d170545516
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157760
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/filter/ww8/data/null-pointer-dereference.doc 
b/sw/qa/filter/ww8/data/null-pointer-dereference.doc
old mode 100755
new mode 100644


[Libreoffice-commits] core.git: sw/qa

2023-10-10 Thread OmkarAcharekar (via logerrit)
 sw/qa/filter/ww8/data/null-pointer-dereference.doc |binary
 sw/qa/filter/ww8/ww8.cxx   |9 +
 2 files changed, 9 insertions(+)

New commits:
commit 1278ffc6e9d999bdfba7dbc582dfe8e7b5d6170a
Author: OmkarAcharekar 
AuthorDate: Tue Oct 10 10:31:06 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Tue Oct 10 13:11:32 2023 +0200

tdf#107786: sw_ww8: Add test for null pointer dereference

Change-Id: I54bd01ce3b0007abe9adb58c0b17195e38e8ceaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157742
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sw/qa/filter/ww8/data/null-pointer-dereference.doc 
b/sw/qa/filter/ww8/data/null-pointer-dereference.doc
new file mode 100755
index ..c2bc0a974477
Binary files /dev/null and b/sw/qa/filter/ww8/data/null-pointer-dereference.doc 
differ
diff --git a/sw/qa/filter/ww8/ww8.cxx b/sw/qa/filter/ww8/ww8.cxx
index 03c922a4c3f4..6a858193e776 100644
--- a/sw/qa/filter/ww8/ww8.cxx
+++ b/sw/qa/filter/ww8/ww8.cxx
@@ -525,6 +525,15 @@ CPPUNIT_TEST_FIXTURE(Test, testSplitFlyInInlineTableDOC)
 CPPUNIT_ASSERT(!pTab->GetFollow());
 }
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testNullPointerDereference)
+{
+// Given a document with multiple pages:
+// When loading that document:
+// Without the accompanying fix in place, this test would have crashed due 
to null pointer access
+createSwDoc("null-pointer-dereference.doc");
+CPPUNIT_ASSERT_EQUAL(6, getPages());
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-10 Thread Miklos Vajna (via logerrit)
 sw/qa/core/text/data/fly-minimal-wrap.docx |binary
 sw/qa/core/text/itrform2.cxx   |   30 +
 sw/qa/core/text/text.cxx   |4 +--
 sw/source/core/text/itrform2.cxx   |   23 --
 4 files changed, 53 insertions(+), 4 deletions(-)

New commits:
commit 4a5fb05d5e2448453477ce14862a8cf9846ecb49
Author: Miklos Vajna 
AuthorDate: Tue Oct 10 08:23:14 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 10 09:29:37 2023 +0200

tdf#157571 sw floattable: fix incorrect blank space after table-in-shape

Regression from a4af5432753408c4eea8a8d56c2f48202160c5fe (tdf#120262 sw
floattable, legacy: fix text wrap around fly when no content fits,
2023-07-17), the bugdoc has a shape which contains a table, and lots of
empty paragraphs next to it wrap around the shape. Writer didn't wrap
these empty paragraphs, so some of the page 1 content was shifted to
page 2.

What happened here is that in case there is a really small space for the
wrapping text around a floating object, then Word has some minimal
limit. If the available horizontal space is smaller than the limit, we
don't even try to wrap, even if the content (an empty paragraph) would
fit. It was assumed that this limit is the shape for normal anchored
objects and floating tables, but the two bugdocs show that there are two
different limits here.

Fix the problem by going back to MINLAY as the default limit where we
start wrapping, and only increase that to TEXT_MIN_SMALL when wrapping
around floating tables. That fixes the bugdoc and keeps the older
floating table use-case working as well.

This also allows reverting changes to testParaUpperMarginFlyIntersect,
to assert the non-floating-table case again.

Change-Id: I8f8a776c6ad5bdfa0ee4f197b600463fef6431f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157743
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/sw/qa/core/text/data/fly-minimal-wrap.docx 
b/sw/qa/core/text/data/fly-minimal-wrap.docx
new file mode 100644
index ..f5955d29d0ed
Binary files /dev/null and b/sw/qa/core/text/data/fly-minimal-wrap.docx differ
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index e190bed46f33..637396a01c2e 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -82,6 +82,36 @@ CPPUNIT_TEST_FIXTURE(Test, 
testFloattableLegacyWrapEmptyParagraph)
 const SwSortedObjs& rPageObjs2 = *pPage2->GetSortedObjs();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), rPageObjs2.size());
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testFlyMinimalWrap)
+{
+// Given a document with a first page that has a shape and a table in it 
(not floating table),
+// some empty paragraphs wrapping around the shape:
+createSwDoc("fly-minimal-wrap.docx");
+
+// When calculating the layout:
+calcLayout();
+
+// Then make sure the wrap happens, so the 2nd page only has 2 paragraphs:
+SwDoc* pDoc = getSwDoc();
+SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+auto pPage = dynamic_cast(pLayout->Lower());
+CPPUNIT_ASSERT(pPage);
+CPPUNIT_ASSERT(pPage->GetSortedObjs());
+const SwSortedObjs& rPageObjs = *pPage->GetSortedObjs();
+CPPUNIT_ASSERT_EQUAL(static_cast(2), rPageObjs.size());
+auto pPage2 = dynamic_cast(pPage->GetNext());
+CPPUNIT_ASSERT(pPage2);
+CPPUNIT_ASSERT(!pPage2->GetSortedObjs());
+SwLayoutFrame* pBody2 = pPage2->FindBodyCont();
+SwFrame* pPage2Para1 = pBody2->GetLower();
+CPPUNIT_ASSERT(pPage2Para1);
+SwFrame* pPage2Para2 = pPage2Para1->GetNext();
+CPPUNIT_ASSERT(pPage2Para2);
+// Without the accompanying fix in place, this test would have failed, the 
second page had 19
+// text frames in the body frame, not 2.
+CPPUNIT_ASSERT(!pPage2Para2->GetNext());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index 16aa73cd9823..8a48b75a03e4 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -1419,10 +1419,10 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, 
testParaUpperMarginFlyIntersect)
 nHeight += getXPath(pXmlDoc, xPath, "height").toInt32();
 }
 // Without the accompanying fix in place, this test would have failed with:
-// - Expected: 542 (~500)
+// - Expected: 521 (~500)
 // - Actual  : 857 (~1000)
 // I.e. both upper and lower margin was taken into account.
-CPPUNIT_ASSERT_EQUAL(542, nHeight);
+CPPUNIT_ASSERT_EQUAL(521, nHeight);
 }
 
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testTdf129810)
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index f8b2c3a41459..36a86504adc5 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2806,8 +2806,27 @@ void SwTextFormatter::CalcFlyWidth( Sw

[Libreoffice-commits] core.git: sw/qa

2023-10-09 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |   26 ++
 1 file changed, 10 insertions(+), 16 deletions(-)

New commits:
commit b36026381d46bf07fc891cdb1c06789ad3bc40f3
Author: Miklos Vajna 
AuthorDate: Mon Oct 9 20:02:07 2023 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 10 08:03:11 2023 +0200

CppunitTest_sw_ooxmlexport4: rework to avoid preTest()

ImportComboBoxAsDropDown is on by default, so all we need is to turn it
off at a single place + restore it at the test case end.

Change-Id: I399aa60e5bf89817baa226de090625fd89fbbac9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157734
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index ce1645007d85..999a144cde60 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -33,17 +34,6 @@ public:
 Test() : SwModelTestBase("/sw/qa/extras/ooxmlexport/data/", "Office Open 
XML Text") {}
 
 protected:
-virtual std::unique_ptr preTest(const char* filename) override
-{
-if (filename == std::string_view("combobox-control.docx") )
-{
-std::shared_ptr< comphelper::ConfigurationChanges > 
batch(comphelper::ConfigurationChanges::create());
-
officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(true,
 batch);
-batch->commit();
-}
-return nullptr;
-}
-
 void verifyComboBoxExport(bool aComboBoxAsDropDown);
 };
 
@@ -793,19 +783,23 @@ CPPUNIT_TEST_FIXTURE(Test, testComboBoxControl)
 
 CPPUNIT_TEST_FIXTURE(Test, tdf134043_ImportComboBoxAsDropDown_true)
 {
-std::shared_ptr< comphelper::ConfigurationChanges > 
batch(comphelper::ConfigurationChanges::create());
-
officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(true,
 batch);
-batch->commit();
-
 createSwDoc("combobox-control.docx");
 verifyComboBoxExport(true);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, tdf134043_ImportComboBoxAsDropDown_false)
 {
-std::shared_ptr< comphelper::ConfigurationChanges > 
batch(comphelper::ConfigurationChanges::create());
+std::shared_ptr batch(
+comphelper::ConfigurationChanges::create());
 
officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(false,
 batch);
 batch->commit();
+comphelper::ScopeGuard g(
+[batch]
+{
+
officecfg::Office::Writer::Filter::Import::DOCX::ImportComboBoxAsDropDown::set(true,
+   
batch);
+batch->commit();
+});
 
 createSwDoc("combobox-control.docx");
 verifyComboBoxExport(false);


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-07 Thread Mike Kaganski (via logerrit)
 sw/qa/extras/htmlexport/data/table_with_wide_horizontal_border.fodt |   27 
++
 sw/qa/extras/htmlexport/htmlexport.cxx  |   11 
 sw/source/filter/html/htmltabw.cxx  |   11 
 3 files changed, 38 insertions(+), 11 deletions(-)

New commits:
commit b6a5e84cd3f22a223d67fe88595006a33c291c48
Author: Mike Kaganski 
AuthorDate: Fri Oct 6 20:19:28 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat Oct 7 12:19:25 2023 +0200

tdf#157643: Drop extra cellless rows, a "substitute" for bold borders

Change-Id: Ic98bec72ed14623c880fad3b881d72ee13395a0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157670
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git 
a/sw/qa/extras/htmlexport/data/table_with_wide_horizontal_border.fodt 
b/sw/qa/extras/htmlexport/data/table_with_wide_horizontal_border.fodt
new file mode 100644
index ..a3c53a070784
--- /dev/null
+++ b/sw/qa/extras/htmlexport/data/table_with_wide_horizontal_border.fodt
@@ -0,0 +1,27 @@
+
+
+http://openoffice.org/2004/office"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:ooow="http://openoffice.org/200
 4/writer" xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; xmlns
 :css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:officeooo="http://openoffice.org/2009/office"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
+  
+   
+  
+ 
+ 
+  
+   
+
+
+ 
+  A1
+ 
+
+
+ 
+  A2
+ 
+
+   
+   
+  
+ 
+
\ No newline at end of file
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index dbdf472ceff9..6810baa1efe3 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2751,6 +2751,17 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testTdf156647_CellPaddingRoundtrip)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testTdf157643_WideHBorder)
+{
+// Given a document with a table with a wide border between its two rows:
+createSwDoc("table_with_wide_horizontal_border.fodt");
+// When exporting to reqif-xhtml:
+ExportToReqif();
+// Make sure that there's no extra tr's:
+xmlDocUniquePtr pXmlDoc = WrapReqifFromTempFile();
+assertXPath(pXmlDoc, 
"/reqif-xhtml:html/reqif-xhtml:div/reqif-xhtml:table/reqif-xhtml:tr", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmltabw.cxx 
b/sw/source/filter/html/htmltabw.cxx
index 9a3c0183142f..bd1f35888331 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -827,17 +827,6 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 
eAlign,
 {
 --nSkipRows;
 }
-if( !m_nCellSpacing && nRow < m_aRows.size()-1 && 
pRow->m_bBottomBorder &&
-pRow->m_nBottomBorder > SvxBorderLineWidth::Thin )
-{
-for( auto nCnt = (pRow->m_nBottomBorder / 
SvxBorderLineWidth::Thin) - 1; nCnt; --nCnt )
-{
-rWrt.OutNewLine();
-HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), 
Concat2View(rWrt.Get

[Libreoffice-commits] core.git: sw/qa

2023-10-06 Thread Andrea Gelmini (via logerrit)
 sw/qa/extras/tiledrendering/tiledrendering.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 65ff27c32a747ba20837f8453c18456423f4b474
Author: Andrea Gelmini 
AuthorDate: Thu Oct 5 21:30:27 2023 +0200
Commit: Julien Nabet 
CommitDate: Fri Oct 6 10:03:53 2023 +0200

Fix typo

Change-Id: I0b4c80e1e2b625e60d80ae4ae10a43477250176f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157606
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index b3b6c948d884..57d146edee3e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1376,7 +1376,7 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, 
testUndoReorderingMulti)
 // Then make sure view 1's undo action is invoked, out of order:
 // Without the accompanying fix in place, this test would have failed with:
 // - Expression: pTextNode1->GetText().isEmpty()
-// i.e. out of order undo was not executed, the first paragrph was still 
"a".
+// i.e. out of order undo was not executed, the first paragraph was still 
"a".
 CPPUNIT_ASSERT(pTextNode1->GetText().isEmpty());
 // The top 2 undo actions are not invoked, as they belong to view 2.
 CPPUNIT_ASSERT_EQUAL(OUString("yx"), pTextNode2->GetText());


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2023-10-05 Thread Justin Luth (via logerrit)
 dev/null  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|   15 ---
 writerfilter/source/dmapper/DomainMapper.cxx  |5 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 -
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 ---
 5 files changed, 1 insertion(+), 35 deletions(-)

New commits:
commit 32102e559eed6eadf2ea146e212a330a3bc897ca
Author: Justin Luth 
AuthorDate: Thu Oct 5 07:24:56 2023 -0400
Commit: Justin Luth 
CommitDate: Thu Oct 5 16:26:13 2023 +0200

tdf#157574 Revert "tdf#153613 tdf#146984 split para after anchors"

This reverts 7.6 commit 828fde37632a5bb0542b6925454690a5287d6490.

and also reverts the dependent parts of the follow-up test from
commit 828fde37632a5bb0542b6925454690a5287d6490
(although the patch itself is fine to remain in place)

and also reverts followup "cid#1522030 Uninitialized scalar field"
commit 9a123a6e63600ba3998d22bbc300ac4b65b3da2c.

The commit in general is fine. However, it fails in case
of an empty paragraph (with only anchors).
Unfortunately, there is no way of knowing ahead of time,
so either everything needs to be processed after a delay,
or else the paragraph needs to be split and then re-joined
in case it is not an empty paragraph.
Both options are extremely non-trivial - I don't know how
to do either of them.

Change-Id: I9e98d825ad0008e822172b6797116ad16e90b871
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157593
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx
deleted file mode 100644
index a282deaa0ad7..
Binary files 
a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx and 
/dev/null differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 066eb3647cb5..bbcc40dde073 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -193,11 +193,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf146984_anchorInShape, 
"tdf146984_anchorInShape.d
 {
 // This was only one page b/c the page break was missing.
 CPPUNIT_ASSERT_EQUAL(2, getPages());
-
-const auto& pLayout = parseLayoutDump();
-// There are shapes on both pages - these should be non-zero numbers
-assertXPath(pLayout, "//page[1]//anchored", 3);
-assertXPath(pLayout, "//page[2]//anchored", 2);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf127622_framePr, "tdf127622_framePr.docx")
@@ -379,16 +374,6 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, "tdf153613_textboxA
 assertXPathContent(pLayout, "//page[2]/body/txt", "There should be no 
prior carriage return.");
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, 
"tdf153613_textboxAfterPgBreak3.docx")
-{
-// All anchored TO-character shapes stay on the first page, before the 
page break.
-CPPUNIT_ASSERT_EQUAL(2, getPages());
-CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
-
-const auto& pLayout = parseLayoutDump();
-assertXPath(pLayout, "//page[2]//anchored", 0);
-}
-
 DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, 
"tdf153613_sdtAfterPgBreak.docx")
 {
 CPPUNIT_ASSERT_EQUAL(2, getPages());
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 5b5647be8bae..726730ad3076 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3741,7 +3741,7 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 {
 // If there is a deferred page break, handle it now, so that the
 // started shape will be on the correct page.
-if (m_pImpl->isBreakDeferred(PAGE_BREAK) && 
!m_pImpl->IsBreakDeferredByAnchor())
+if (m_pImpl->isBreakDeferred(PAGE_BREAK))
 {
 // RTF doesn't properly report IsFirstRun, so in order to prevent 
regressions
 // always split the paragraph for RTF since that is the way it has 
been done lately.
@@ -3751,9 +3751,6 @@ void 
DomainMapper::lcl_startShape(uno::Reference const& xShape)
 finishParagraph();
 lcl_startParagraphGroup();
 }
-else
-m_pImpl->SetIsBreakDeferredByAnchor();
-
 }
 m_pImpl->PushShapeContext( xShape );
 lcl_startParagraphGroup();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 36a0f6c178f9..4d91790ade4c 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -334,7 +334,6 @@ DomainMapper_Impl::DomainMapper_Impl(
 m_bIsColumnBreakDeferred( false ),
 m_b

[Libreoffice-commits] core.git: sw/qa

2023-10-05 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf157598.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx   |   12 
 2 files changed, 12 insertions(+)

New commits:
commit 98771c4a6da0e760b10983e66885fafcfe918d16
Author: Xisco Fauli 
AuthorDate: Thu Oct 5 10:13:46 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 5 12:40:30 2023 +0200

tdf#157598: sw_ooxmlexport18: Add unittest

Change-Id: If17054cfc56c57dfe9eab5461973fb4c3035f218
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157584
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf157598.docx 
b/sw/qa/extras/ooxmlexport/data/tdf157598.docx
new file mode 100644
index ..7a5a2b15999b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf157598.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index bf7eb22eb270..066eb3647cb5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -531,6 +531,18 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148834_lineNumbering)
 
"//w:style[@w:styleId='0NUMBERED']/w:pPr/w:suppressLineNumbers", "val", "0");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf157598)
+{
+loadAndSave("tdf157598.docx");
+
+xmlDocUniquePtr pStylesXml = parseExport("word/styles.xml");
+
+// Without the fix in place, this test would have failed with
+// - Expected: 0
+// - Actual  : 1
+assertXPath(pStylesXml, "//w:style[@w:styleId='Normal']/w:rPr/w:rtl", 0);
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf76022_textboxWrap)
 {
 // Granted, this is an ODT with a bit of an anomaly - tables ignore fly 
wrapping.


[Libreoffice-commits] core.git: sw/qa sw/source

2023-10-05 Thread Hossein (via logerrit)
 dev/null |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |9 -
 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx|2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |3 ---
 4 files changed, 1 insertion(+), 13 deletions(-)

New commits:
commit e0bedd3f7311bf47392a46d097304e3c7afcb246
Author: Hossein 
AuthorDate: Wed Oct 4 22:22:06 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 5 10:14:59 2023 +0200

Revert "tdf#155470 DOCX export: fix RTL numbers changed to LTR"

This reverts commit 40ed8dd3a5a16f21f2e98440c62efa0fa6ec60ff.

Reason for revert: tdf#157598 problem with LTR documents

Change-Id: I6f25913df4e308be660070e1eeca81f08c0547ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157547
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx 
b/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx
deleted file mode 100644
index 2142967a3619..
Binary files a/sw/qa/extras/ooxmlexport/data/numbers-rtl.docx and /dev/null 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 60e097925829..cbca150319b7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1106,15 +1106,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf115094v3)
 assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpY", 
"1064");
 }
 
-CPPUNIT_TEST_FIXTURE(Test, testTdf155470)
-{
-loadAndSave("numbers-rtl.docx");
-xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
-
-// Make sure that  is preserved
-assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:rPr/w:rtl");
-}
-
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 9458051ea6d3..db2abe3513a7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -174,7 +174,7 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleInheritance)
 
 // We output exactly 2 properties in rPrDefault, nothing else was
 // introduced as an additional default
-assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 3);
+assertXPath(pXmlStyles, "/w:styles/w:docDefaults/w:rPrDefault/w:rPr/*", 2);
 // Check that we output real content of rPrDefault
 assertXPath(pXmlStyles, 
"/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:rFonts", "ascii", "Times New 
Roman");
 assertXPath(pXmlStyles, 
"/w:styles/w:docDefaults/w:rPrDefault/w:rPr/w:lang", "bidi", "ar-SA");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4f0c67f3ce99..9c67855acbdd 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -160,7 +160,6 @@
 #include 
 #include 
 #include 
-#include 
 
 using ::editeng::SvxBorderLine;
 
@@ -7932,8 +7931,6 @@ void DocxAttributeOutput::CharLanguage( const 
SvxLanguageItem& rLanguage )
 AddToAttrList( m_pCharLangAttrList, FSNS( XML_w, XML_eastAsia ), 
aLanguageCode );
 break;
 case RES_CHRATR_CTL_LANGUAGE:
-if (MsLangId::isRightToLeft(rLanguage.GetLanguage()))
-m_pSerializer->singleElementNS(XML_w, XML_rtl);
 AddToAttrList( m_pCharLangAttrList, FSNS( XML_w, XML_bidi ), 
aLanguageCode );
 break;
 }


  1   2   3   4   5   6   7   8   9   10   >