core.git: oox/source

2024-05-31 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshape.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 51f2f5ca45a9f9aade210ca674b167a9a11f87bf
Author: Justin Luth 
AuthorDate: Fri May 31 10:53:07 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Jun 1 03:18:55 2024 +0200

tdf#97618 DOCX import: VML shape: fix missing text wrap #2

The default value is to wrap text.

mso-wrap-style: Specifies the wrapping mode for text
in shapes in WordprocessingML documents. *Default is square*.

Allowed values are:
   square - Wraps text inside the shape in a square.
   none - Text does not wrap.

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

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d8ac1b1ed9af..d9a50e3084db 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -830,8 +830,9 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 PropertySet(xShape).setAnyProperty(PROP_TextVerticalAdjust, 
Any(eTextVerticalAdjust));
 
 // tdf#97618
-if(!maTypeModel.maWrapStyle.isEmpty())
-PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, 
Any(maTypeModel.maWrapStyle == "square"));
+const bool bWrap = maTypeModel.maWrapStyle != "none";
+PropertySet(xShape).setAnyProperty(PROP_TextWordWrap, Any(bWrap));
+
 
 // tdf#123626
 if (!maShapeModel.maHyperlink.isEmpty())


core.git: sc/source

2024-05-31 Thread Justin Luth (via logerrit)
 sc/source/filter/xml/xmlexprt.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 068befc95ab8d7c368e76f08447827dbdea21014
Author: Justin Luth 
AuthorDate: Thu May 30 09:22:55 2024 -0400
Commit: Justin Luth 
CommitDate: Fri May 31 15:27:51 2024 +0200

tdf#114398 ods export: output  when CELLTYPE_EDIT

assume regression since LO 4.2
based on LO 7.5 a7589f621fcbe6305335730d2dd86b9230a18594
for tdf#103829.

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

diff --git a/sc/source/filter/xml/xmlexprt.cxx 
b/sc/source/filter/xml/xmlexprt.cxx
index 1f56ece42e9c..00231fc4ae38 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3145,6 +3145,11 @@ void flushParagraph(
 SvXMLElementExport Tab(rExport, XML_NAMESPACE_TEXT, 
XML_TAB, false, false);
 break;
 }
+else if (p->Which() == EE_FEATURE_LINEBR)
+{
+SvXMLElementExport L(rExport, XML_NAMESPACE_TEXT, 
XML_LINE_BREAK, false, false);
+break;
+}
 }
 }
 else


core.git: sw/qa sw/source

2024-05-31 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   11 +++
 sw/source/core/doc/number.cxx  |5 -
 sw/source/filter/ww8/wrtw8num.cxx  |   11 ++-
 3 files changed, 25 insertions(+), 2 deletions(-)

New commits:
commit 71c49057deb1a696e4b0ce9d2091aaa28572b57a
Author: Justin Luth 
AuthorDate: Mon May 20 14:28:59 2024 -0400
Commit: Justin Luth 
CommitDate: Fri May 31 15:27:14 2024 +0200

tdf#149258 sw ms export: no separator for NONE numbering level

This is to benefit ODT->DOCX.

LO does not show the separators specified after a numbering level
that has no numbering type (since LO 7.2.5).
However, MSO does show any specified separators.
So export this the way that LO sees it.

Note that in the very odd case where an MSO user actually wanted
these separators to be visible, LO fails to show them,
and thus this will end up exporting as "data loss". How sad.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf156105_percentSuffix

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index baeba733afcc..e487bbf00015 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -298,6 +298,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf156105_percentSuffix, 
"tdf156105_percentSuffix.o
 // given a numbered list with a non-escaping percent symbol in the prefix 
and suffix
 CPPUNIT_ASSERT_EQUAL(OUString("(%)[%]"),
  getProperty(getParagraph(3), 
"ListLabelString"));
+
+// tdf#149258 - NONE number should not export separator since LO doesn't 
currently show it
+CPPUNIT_ASSERT_EQUAL_MESSAGE("showing levels 1, 2, and 4", 
OUString("(%)1.1.1[%]"),
+ getProperty(getParagraph(4), 
"ListLabelString"));
+if (isExported())
+{
+xmlDocUniquePtr pXmlNum = parseExport("word/numbering.xml");
+// The 3rd level is NONE. If we include the separator, MS Word will 
display it.
+assertXPath(pXmlNum, 
"/w:numbering/w:abstractNum[1]/w:lvl[4]/w:lvlText"_ostr, "val"_ostr,
+"(%)%1.%2.%3%4[%]");
+}
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index f43ab140b60d..e811f7b83540 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -763,8 +763,11 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 // Numbering disabled - replacement is empty
 // And we should skip all level string content until next 
level marker:
 // so %1%.%2%.%3% with second level as NONE will result 1.1, 
not 1..1
+
+// NOTE: if changed, fix MSWordExportBase::NumberingLevel to 
match new behaviour.
+
 sal_Int32 nPositionNext = sLevelFormat.indexOf('%', nPosition 
+ sFind.getLength());
-if (nPosition >= 0 && nPositionNext >= nPosition)
+if (nPosition >= 0 && nPositionNext > nPosition)
 {
 sLevelFormat = sLevelFormat.replaceAt(nPosition, 
nPositionNext - nPosition, u"");
 }
diff --git a/sw/source/filter/ww8/wrtw8num.cxx 
b/sw/source/filter/ww8/wrtw8num.cxx
index 4c56472bb6b3..e8f7b197ed59 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -489,9 +489,18 @@ void MSWordExportBase::NumberingLevel(
 sal_Int32 nFnd = sNumStr.indexOf(sSrch);
 if (-1 != nFnd)
 {
+sal_Int32 nLen = sSrch.getLength();
+if (i < nLvl && rRule.Get(i).GetNumberingType() == 
SVX_NUM_NUMBER_NONE)
+{
+// LO doesn't show this level, so don't export its 
separator
+const OUString sSrch2("%" + OUString::number(i + 2) + 
"%");
+const sal_Int32 nFnd2 = sNumStr.indexOf(sSrch2, nFnd);
+if (-1 != nFnd2)
+nLen = nFnd2 - nFnd;
+}
 *pLvlPos = static_cast(nFnd + 1);
 ++pLvlPos;
-sNumStr = sNumStr.replaceAt(nFnd, sSrch.getLength(), 
rtl::OUStringChar(static_cast(i)));
+sNumStr = sNumStr.replaceAt(nFnd, nLen, 
OUStringChar(static_cast(i)));
 }
 }
 }


core.git: sw/qa sw/source

2024-05-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |3 ---
 sw/source/filter/ww8/docxattributeoutput.cxx |4 
 2 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a2b00082114b443962715a671b8bbb17733d6453
Author: Justin Luth 
AuthorDate: Mon May 27 20:31:54 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 30 01:21:48 2024 +0200

tdf#131098 docx export: write fill property of graphic

All these are round-tripping (at least at a basic level):
- bitmap
- hatch
- solid color
- transparency (unit test)

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf131098_imageFill

No existing unit tests had an image with a fill.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 901a0b161d6a..baeba733afcc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -534,9 +534,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, 
"tdf126533_pageBitmap.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf131098_imageFill, "tdf131098_imageFill.docx")
 {
-if (isExported())
-return;
-
 // given a document with an image background transparency (blue-white)
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
  getProperty(getShape(1), 
"FillStyle"));
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 971f27df0314..827d037b274c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5411,6 +5411,10 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 m_pSerializer->singleElementNS(XML_a, XML_avLst);
 m_pSerializer->endElementNS( XML_a, XML_prstGeom );
 
+m_rDrawingML.SetFS(m_pSerializer); // to be sure that we write to the 
right stream
+if (xShapePropSet)
+m_rDrawingML.WriteFill(xShapePropSet, awt::Size(aSize.Width(), 
aSize.Height()));
+
 const SvxBoxItem& rBoxItem = pFrameFormat->GetBox();
 const SvxBorderLine* pLeft = rBoxItem.GetLine(SvxBoxItemLine::LEFT);
 const SvxBorderLine* pRight = rBoxItem.GetLine(SvxBoxItemLine::RIGHT);


core.git: sw/qa sw/source

2024-05-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   11 +++
 sw/source/writerfilter/dmapper/GraphicImport.cxx   |   52 -
 3 files changed, 61 insertions(+), 2 deletions(-)

New commits:
commit 2862f1989591f4666ed0f7b994c80a0d0fd8ae52
Author: Justin Luth 
AuthorDate: Mon May 27 16:48:04 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 30 01:20:18 2024 +0200

tdf#131098 oox import: apply fill properties to graphic

The fill properties picked up by oox import
were not being transferred to the final graphic.

For some reason, the shape didn't import at all
if I copied over the Fill*Name properties.

All these are importing (at least at a basic level):
- bitmap
- hatch
- solid color
- transparency (unit test)

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf131098_imageFill

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx 
b/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx
new file mode 100644
index ..b663bdf72ac4
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf131098_imageFill.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 1c55be3df2cf..901a0b161d6a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -532,6 +532,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf126533_pageBitmap, 
"tdf126533_pageBitmap.docx")
 
"/rels:Relationships/rels:Relationship[@Target='media/image1.jpeg']"_ostr, 1);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf131098_imageFill, "tdf131098_imageFill.docx")
+{
+if (isExported())
+return;
+
+// given a document with an image background transparency (blue-white)
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT,
+ getProperty(getShape(1), 
"FillStyle"));
+CPPUNIT_ASSERT_EQUAL(Color(0x729fcf), getProperty(getShape(1), 
"FillColor"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf154369, "tdf154369.docx")
 {
 //Unit test for bug fix in tdf#154369
diff --git a/sw/source/writerfilter/dmapper/GraphicImport.cxx 
b/sw/source/writerfilter/dmapper/GraphicImport.cxx
index b7621f776f4e..bab91d2b7fe0 100644
--- a/sw/source/writerfilter/dmapper/GraphicImport.cxx
+++ b/sw/source/writerfilter/dmapper/GraphicImport.cxx
@@ -1953,8 +1953,56 @@ rtl::Reference 
GraphicImport::createGraphicObject(uno::Ref
 uno::Any(m_pImpl->m_eColorMode));
 }
 
-xGraphicObject->setPropertyValue(getPropertyName( PROP_BACK_COLOR 
),
-uno::Any( GraphicImport_Impl::nFillColor ));
+// copy the image fill area properties
+xGraphicObject->setPropertyValue("FillBackground",
+ 
xShapeProps->getPropertyValue("FillBackground"));
+xGraphicObject->setPropertyValue("FillBitmap",
+ 
xShapeProps->getPropertyValue("FillBitmap"));
+xGraphicObject->setPropertyValue(
+"FillBitmapLogicalSize", 
xShapeProps->getPropertyValue("FillBitmapLogicalSize"));
+xGraphicObject->setPropertyValue("FillBitmapMode",
+ 
xShapeProps->getPropertyValue("FillBitmapMode"));
+xGraphicObject->setPropertyValue("FillBitmapOffsetX",
+ 
xShapeProps->getPropertyValue("FillBitmapOffsetX"));
+xGraphicObject->setPropertyValue(
+"FillBitmapPositionOffsetX",
+xShapeProps->getPropertyValue("FillBitmapPositionOffsetX"));
+xGraphicObject->setPropertyValue(
+"FillBitmapPositionOffsetY",
+xShapeProps->getPropertyValue("FillBitmapPositionOffsetY"));
+xGraphicObject->setPropertyValue(
+"FillBitmapRectanglePoint",
+xShapeProps->getPropertyValue("FillBitmapRectanglePoint"));
+xGraphicObject->setPropertyValue("FillBitmapSizeX",
+ 
xShapeProps->getPropertyValue("FillBitmapSizeX"));
+xGraphicObject->setPropertyValue("FillBitmapSizeY",
+ 
xShapeProps->getPropertyValue("FillBitmapSizeY"));
+xGraphicObject->setPropertyValu

core.git: Branch 'libreoffice-24-2' - sd/source

2024-05-23 Thread Justin Luth (via logerrit)
 sd/source/ui/view/ToolBarManager.cxx |   67 ---
 1 file changed, 32 insertions(+), 35 deletions(-)

New commits:
commit 5777b30375df6b34568cf88cc3701513635eace1
Author: Justin Luth 
AuthorDate: Wed May 22 17:50:55 2024 -0400
Commit: Xisco Fauli 
CommitDate: Thu May 23 09:41:30 2024 +0200

Revert "tdf#126095 sd notebookbar: don't force table/media toolbar"

This reverts my 24.2 commit e58e251756ecb0312cb6891d4df23e17ef8f6fcb.

Unintended side affect in Draw (not Writer) sidebar.

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

diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index 4be073bac612..4fcb99529871 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -1044,47 +1044,44 @@ void ToolBarRules::SelectionHasChanged (
 
 mpToolBarManager->ResetToolBars(ToolBarManager::ToolBarGroup::Function);
 
-if (!sfx2::SfxNotebookBar::IsActive())
+switch (rView.GetContext())
 {
-switch (rView.GetContext())
-{
-case SdrViewContext::Graphic:
-if (!bTextEdit)
-
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Graf_Toolbox);
-break;
-
-case SdrViewContext::Media:
-if (!bTextEdit)
-
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Media_Toolbox);
-break;
+case SdrViewContext::Graphic:
+if (!bTextEdit)
+
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
+  
ToolbarId::Draw_Graf_Toolbox);
+break;
 
-case SdrViewContext::Table:
+case SdrViewContext::Media:
+if (!bTextEdit)
 
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Table_Toolbox);
-bTextEdit = true;
-break;
+  
ToolbarId::Draw_Media_Toolbox);
+break;
 
-case SdrViewContext::Standard:
-default:
-if (!bTextEdit)
+case SdrViewContext::Table:
+
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
+  ToolbarId::Draw_Table_Toolbox);
+bTextEdit = true;
+break;
+
+case SdrViewContext::Standard:
+default:
+if (!bTextEdit)
+{
+switch(rViewShell.GetShellType())
 {
-switch(rViewShell.GetShellType())
-{
-case ::sd::ViewShell::ST_IMPRESS:
-case ::sd::ViewShell::ST_DRAW:
-case ::sd::ViewShell::ST_NOTES:
-case ::sd::ViewShell::ST_HANDOUT:
-
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Function,
- 
ToolBarManager::msDrawingObjectToolBar);
-break;
-default:
-break;
-}
-break;
+case ::sd::ViewShell::ST_IMPRESS:
+case ::sd::ViewShell::ST_DRAW:
+case ::sd::ViewShell::ST_NOTES:
+case ::sd::ViewShell::ST_HANDOUT:
+
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Function,
+ 
ToolBarManager::msDrawingObjectToolBar);
+break;
+default:
+break;
 }
-}
+break;
+}
 }
 
 if( bTextEdit )


core.git: sd/source

2024-05-22 Thread Justin Luth (via logerrit)
 sd/source/ui/view/ToolBarManager.cxx |   71 ---
 1 file changed, 34 insertions(+), 37 deletions(-)

New commits:
commit cdbd4139790383052f004def482f32fdec604fbb
Author: Justin Luth 
AuthorDate: Wed May 22 17:50:55 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 23 02:26:26 2024 +0200

Revert "tdf#126095 sd notebookbar: don't force table/media toolbar"

This reverts my 24.2 commit e58e251756ecb0312cb6891d4df23e17ef8f6fcb.

Unintended side affect in Draw (not Writer) sidebar.

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

diff --git a/sd/source/ui/view/ToolBarManager.cxx 
b/sd/source/ui/view/ToolBarManager.cxx
index 5296b7bd94ef..afb5c135e1d6 100644
--- a/sd/source/ui/view/ToolBarManager.cxx
+++ b/sd/source/ui/view/ToolBarManager.cxx
@@ -1045,49 +1045,46 @@ void ToolBarRules::SelectionHasChanged (
 
 mpToolBarManager->ResetToolBars(ToolBarManager::ToolBarGroup::Function);
 
-if (!sfx2::SfxNotebookBar::IsActive())
+switch (rView.GetContext())
 {
-switch (rView.GetContext())
-{
-case SdrViewContext::Graphic:
-if (!bTextEdit)
-
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Graf_Toolbox);
-break;
-
-case SdrViewContext::Media:
-if (!bTextEdit)
-
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Media_Toolbox);
-break;
+case SdrViewContext::Graphic:
+if (!bTextEdit)
+
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
+  
ToolbarId::Draw_Graf_Toolbox);
+break;
 
-case SdrViewContext::Table:
+case SdrViewContext::Media:
+if (!bTextEdit)
 
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
-  
ToolbarId::Draw_Table_Toolbox);
-bTextEdit = true;
-break;
+  
ToolbarId::Draw_Media_Toolbox);
+break;
 
-case SdrViewContext::Standard:
-default:
-if (!bTextEdit)
+case SdrViewContext::Table:
+
mpToolBarManager->SetToolBarShell(ToolBarManager::ToolBarGroup::Function,
+  ToolbarId::Draw_Table_Toolbox);
+bTextEdit = true;
+break;
+
+case SdrViewContext::Standard:
+default:
+if (!bTextEdit)
+{
+switch(rViewShell.GetShellType())
 {
-switch(rViewShell.GetShellType())
-{
-case ::sd::ViewShell::ST_IMPRESS:
-case ::sd::ViewShell::ST_DRAW:
-case ::sd::ViewShell::ST_NOTES:
-case ::sd::ViewShell::ST_HANDOUT:
-
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Function,
- 
ToolBarManager::msDrawingObjectToolBar);
-
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Permanent,
- 
ToolBarManager::msToolBar);
-break;
-default:
-break;
-}
-break;
+case ::sd::ViewShell::ST_IMPRESS:
+case ::sd::ViewShell::ST_DRAW:
+case ::sd::ViewShell::ST_NOTES:
+case ::sd::ViewShell::ST_HANDOUT:
+
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Function,
+ 
ToolBarManager::msDrawingObjectToolBar);
+
mpToolBarManager->SetToolBar(ToolBarManager::ToolBarGroup::Permanent,
+ 
ToolBarManager::msToolBar);
+break;
+default:
+break;
 }
-}
+break;
+}
 }
 
 if( bTextEdit )


core.git: sw/source

2024-05-22 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/docxattributeoutput.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit fe5b4257d852b937652d55f2272ed535835d85c5
Author: Justin Luth 
AuthorDate: Wed May 22 12:22:07 2024 -0400
Commit: Justin Luth 
CommitDate: Wed May 22 23:22:17 2024 +0200

NFC IsInline includes GetAnchorId() == RndStdIds::FLY_AS_CHAR

m_bIsInline is either forced true,
or is set by GetAnchorId() == RndStdIds::FLY_AS_CHAR.
Nothing sets it to false, but it can become true with
ForceTreatAsInline.

So, no need to check for FLY_AS_CHAR if we also allow IsInline.

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

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 20ce68a5b08c..682959b33f33 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6409,8 +6409,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl(const 
ww8::Frame& rFrame, const Po
 /// support that feature, instead it postponed and exported
 /// later when the original shape closed.
 
-if (rFrame.GetFrameFormat().GetAnchor().GetAnchorId() == 
RndStdIds::FLY_AS_CHAR
-|| rFrame.IsInline())
+if (rFrame.IsInline())
 {
 m_nEmbedFlyLevel++;
 WriteFlyFrame(rFrame);


core.git: Branch 'distro/collabora/co-23.05' - pyuno/source

2024-05-21 Thread Justin Luth (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 +++
 pyuno/source/module/pyuno_callable.cxx |3 +++
 pyuno/source/module/pyuno_iterator.cxx |6 ++
 pyuno/source/module/pyuno_runtime.cxx  |3 +++
 pyuno/source/module/pyuno_struct.cxx   |3 +++
 5 files changed, 18 insertions(+)

New commits:
commit 122d7f8deec80d05552ab98ce349d748c953446f
Author: Justin Luth 
AuthorDate: Wed Mar 13 08:38:40 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue May 21 09:15:01 2024 +0200

allow build with python 3.12.0: initialize new tp_watched

This fixes the build failure after I updated Ubuntu 24.04 (alpha),
which upgraded python 3.11.7 to python 3.12.0, causing the error:

libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1:
error: missing initializer for member ‘_typeobject::tp_watched’
[-Werror=missing-field-initializers]
...

I gleaned this information from a July 2023 commit for
https://github.com/xbmc/xbmc/issues/23503

tp_watched was added in upstream commit python/cpython@82ccbf6

https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab

This change first appeared in Python v3.12.0a1

Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Stephan Bergmann 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167834
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins CollaboraOffice 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index cc4858279949..e8fa6c89d991 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index f22de316b7de..8f19fc8eb654 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 134f318a1017..2fc70a32fcff 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
@@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 7f3eb7a6e95f..02f02c2f6679 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -138,6 +138,9 @@ static PyTypeObject RuntimeImpl_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index c8fd7e987905..364f2776011a 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };


core.git: desktop/source

2024-05-20 Thread Justin Luth (via logerrit)
 desktop/source/app/cmdlinehelp.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 3d4a3b30aea603b98da447ec6587b5d3eb20da66
Author: Justin Luth 
AuthorDate: Tue May 14 09:20:49 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:42:36 2024 +0200

tdf#69192 fix cmdlinehelp: --show[=slide_number], etc.

I had skimmed the help file earlier, and concluded that { }
are used elsewhere to indicate optional paramaters.
However, there is --quickstart[=no], and -env:[=]
which exactly match my optional addition.

Thanks Stéphane for pointing this out.
Also included are some other changes we made
to clarify the help wording in general,
so the documentation and the cmdline help are in sync.

We dropped
Files other than Impress documents are opened in
default mode, regardless of previous mode.
because:
-from an initial reading it doesn't convey any useful meaning.
-searching for other uses of "mode" in the file suggests it means
 that prior --print/--convert-to/--view modes
 no longer apply. This override of prior modes is true for all modes,
 but only this argument tries to spell this out.
-it seems rather inconceivable that any user would attempt
 to mix --show with any other arguments or more than one file.

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

diff --git a/desktop/source/app/cmdlinehelp.cxx 
b/desktop/source/app/cmdlinehelp.cxx
index 10b3e5c48cbb..7fb0b3d48a1e 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -145,11 +145,10 @@ namespace desktop
 "   not appear. If the file name contains spaces, 
then it   
"
 "   must be enclosed in quotation marks.   
 
"
 "   --view  Opens following files in viewer mode 
(read-only).   
"
-"   --show{=slide#} Opens and starts the following presentation 
documents   
"
-"   of each immediately. Files are closed after 
the showing.
"
-"   If a slide # is provided, they start at that 
slide. 
"
-"   Files other than Impress documents are opened 
in
"
-"   default mode , regardless of previous mode.
 
"
+"   --show[=slide_number]  Opens and starts the slideshow of the 
following  
"
+"   presentation documents immediately.
 
"
+"   Files are closed after the showing.
 
"
+"   If a slide_number is provided, they start at 
that slide.
"
 "   --convert-to OutputFileExtension[:OutputFilterName] \  

"
 " [--outdir output_dir] [--convert-images-to]  
 
"
 "   Batch convert files (implies --headless). If 
--outdir   
"


core.git: include/editeng

2024-05-20 Thread Justin Luth (via logerrit)
 include/editeng/numitem.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 382801ee5368a4c3d59931450dec0d2d9f369285
Author: Justin Luth 
AuthorDate: Sat May 18 12:02:56 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:41:19 2024 +0200

documentation: list format placeholder has been "%1%" since LO 7.2

Vasily's commit aa5c6d127559912ad60a63fbd972b78fb8f9691b
new ODF numbered list parameter loext:num-list-format

Internal LO format for list format is changed:
instead of placeholders like %1, %2, etc
we right now use %1%, %2%... Reason: for ODT documents,
having more than 9 levels there is ambiguity in "%10":
it is "%1" followed by "0" suffix, or "%10"?

It was introduced in 6.4.5 for DOCX support with
Vasily's commit 7459b9ecb54a298f02d19089620149718f8d8d48
tdf#116883: sw: support for lists level format string

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

diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 5005a20fa7a1..423a0e2aeda3 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -104,7 +104,7 @@ public:
 private:
 OUStringsPrefix;
 OUStringsSuffix;
-std::optional sListFormat;// Format string ">%1.%2<" can 
be used instead of prefix/suffix
+std::optional sListFormat;// Format string ">%1%.%2%<" 
can be used instead of prefix/suffix
 // Right now it is optional 
value to distinguish empty list format
 // and not set list format 
when we need to fallback to prefix/suffix.
 


core.git: editeng/source

2024-05-20 Thread Justin Luth (via logerrit)
 editeng/source/items/numitem.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a94db2e3b6e130fe90de31cbd909ce54f5450601
Author: Justin Luth 
AuthorDate: Sat May 18 11:36:24 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:40:58 2024 +0200

tdf#156105 sw: make SvxNumberFormat GetPrefix/Suffix more trustworthy

As soon as SetPrefix or SetSuffix are called,
any partially formed sListFormat is invalid (unless nothing changed).

ListFormat creates sPrefix/sSuffix as a convenience/compat item,
and changing it directly is NOT reflected in the sListFormat itself.
Trying to keep them in sync would be very complicated.

Any process that uses these functions OUGHT TO be doing it as
building blocks to eventually call SetListFormat(prefix, suffix, lvl),
at which point a proper sListFormat will be created.

Change-Id: I05f681c812ea5207cb8127b30dafbd543ffea219
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167832
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index 0d677dfc6696..f0fe0085e157 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -571,7 +571,7 @@ OUString SvxNumberFormat::CreateRomanString( sal_Int32 nNo, 
bool bUpper )
 void SvxNumberFormat::SetPrefix(const OUString& rSet)
 {
 // ListFormat manages the prefix. If badly changed via this function, 
sListFormat is invalidated
-if (sListFormat && rSet.getLength() != sPrefix.getLength())
+if (sListFormat)
 sListFormat.reset();
 
 sPrefix = rSet;
@@ -580,7 +580,7 @@ void SvxNumberFormat::SetPrefix(const OUString& rSet)
 void SvxNumberFormat::SetSuffix(const OUString& rSet)
 {
 // ListFormat manages the suffix. If badly changed via this function, 
sListFormat is invalidated
-if (sListFormat && rSet.getLength() != sSuffix.getLength())
+if (sListFormat)
 sListFormat.reset();
 
 sSuffix = rSet;


core.git: sw/qa sw/source

2024-05-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|7 ++
 sw/source/core/doc/number.cxx |   33 +++---
 3 files changed, 15 insertions(+), 25 deletions(-)

New commits:
commit 65e226aff6a946ae4884b9f5afdccaa1c745bcd4
Author: Justin Luth 
AuthorDate: Fri May 17 12:17:26 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:40:38 2024 +0200

tdf#156105 sw: trust SvxNumberFormat GetPrefix/GetSuffix

After LO 7.4 (backported to 7.2.5) created this
function that manually identifies the Prefix/Suffix,
there was some work done to ensure
GetPrefix and GetSuffix were trustworthy in
LO 7.5's commit 835cda561217bd8c53af2de927158dd5712b06c0
Author: Justin Luth on Tue Aug 2 13:30:31 2022 -0400
related tdf#150197: use SetListFormat or SetPrefix/Suffix
GetListFormat DEPENDS on having managed prefix/suffix itself...

So, lets make sure we use and fix these functions in only one place.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf156105_percentSuffix

Change-Id: I44c021a200ba45960e39983087c6af268751fbc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167792
Reviewed-by: Justin Luth 
Reviewed-by: Vasily Melenchuk 
Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt 
b/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt
new file mode 100644
index ..a5319f7a9522
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf156105_percentSuffix.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 01c42d0ea34d..6cfbe8d783fc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -293,6 +293,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf156105_percentSuffix, 
"tdf156105_percentSuffix.odt")
+{
+// given a numbered list with a non-escaping percent symbol in the prefix 
and suffix
+CPPUNIT_ASSERT_EQUAL(OUString("(%)[%]"),
+ getProperty(getParagraph(3), 
"ListLabelString"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
 {
 // given a VML (Word 2003) document with a LEFT "column/text" anchored 
image
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index c92d2af29a7d..f43ab140b60d 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -721,32 +721,15 @@ OUString SwNumRule::MakeNumString( const 
SwNumberTree::tNumberVector & rNumVecto
 
 if (rMyNFormat.GetNumberingType() == SVX_NUM_NUMBER_NONE)
 {
-if (!rMyNFormat.HasListFormat()) {
-OUString sRet = bInclStrings ? rMyNFormat.GetPrefix() + 
rMyNFormat.GetSuffix() : OUString();
-StripNonDelimiter(sRet);
-return sRet;
-}
-
-// If numbering is disabled for this level we should emit just 
prefix/suffix
-// Remove everything between first %1% and last %n% (including markers)
-OUString sLevelFormat = rMyNFormat.GetListFormat(bInclStrings && 
!bHideNonNumerical);
-
-if (bInclStrings && bHideNonNumerical) {
-// If hiding non numerical text, we need to strip the prefix and 
suffix properly, so let's add them manually
-OUString sPrefix = rMyNFormat.GetPrefix();
-OUString sSuffix = rMyNFormat.GetSuffix();
+// since numbering is disabled for this level,
+// only emit prefix/suffix (unless they are not wanted either)
+if (!bInclStrings)
+return OUString();
 
-StripNonDelimiter(sPrefix);
-StripNonDelimiter(sSuffix);
-
-sLevelFormat = sPrefix + sLevelFormat + sSuffix;
-}
-
-sal_Int32 nFirstPosition = sLevelFormat.indexOf("%");
-sal_Int32 nLastPosition = sLevelFormat.lastIndexOf("%");
-if (nFirstPosition >= 0 && nLastPosition >= nFirstPosition)
-sLevelFormat = sLevelFormat.replaceAt(nFirstPosition, 
nLastPosition - nFirstPosition + 1, u"");
-return sLevelFormat;
+OUString sRet = rMyNFormat.GetPrefix() + rMyNFormat.GetSuffix();
+if (bHideNonNumerical)
+StripNonDelimiter(sRet);
+return sRet;
 }
 
 css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));


core.git: editeng/source

2024-05-20 Thread Justin Luth (via logerrit)
 editeng/source/items/numitem.cxx |   28 +---
 1 file changed, 25 insertions(+), 3 deletions(-)

New commits:
commit 047e3f62901ae89da30bf1367218104e57439f70
Author: Justin Luth 
AuthorDate: Fri May 17 10:01:50 2024 -0400
Commit: Justin Luth 
CommitDate: Mon May 20 15:40:07 2024 +0200

related tdf#156105 sw UI: recognize '%' in numbering prefix/suffix

bug 156105's listWithPercents.odt is an example of a
properly defined ListFormat which contains a percent symbol
in the prefix and suffix, which looked fine in the document itself,
but was cut off short in the UI.

sw/qa/extras/ooxmlexport/data/tdf116883.docx is also an example,
which can be seen if you reduce the first entry to level 1
instead of level 2.
Level 1 is improperly defined as "1%>". This is invalid formatting,
so the entire thing should be considered a suffix.
MS Word also considers it to be a suffix.

This code segment still isn't completely comprehensive
because it won't properly parse "%1xyz%1%." and "%1xyz%10%."
but I'm losing patience.

There is still a potential problem with the
nInclUpperLevels calculation in case
a '%' is used as an in-between separator,
but that seems extremely theoretical and irrelevant to me.
IIUC, the main impact is that it shows some extra dots
in the bullets and numbering UI preview.

Change-Id: Ic1b8fbda62917ad4c7b88bf4fff136d72242f977
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167782
Reviewed-by: Justin Luth 
Reviewed-by: Vasily Melenchuk 
Tested-by: Jenkins

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index b81172f9e5a2..0d677dfc6696 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -626,17 +626,39 @@ void 
SvxNumberFormat::SetListFormat(std::optional oSet)
 // For backward compatibility and UI we should create something looking 
like
 // a prefix, suffix and included levels also. This is not possible in 
general case
 // since level format string is much more flexible. But for most cases is 
okay
+
+// If properly formatted, sListFormat should look something like "%1%…%10%"
+// with an optional prefix or suffix (which could theoretically include a 
percent symbol)
+const sal_Int32 nLen = sListFormat->getLength();
 sal_Int32 nFirstReplacement = sListFormat->indexOf('%');
-sal_Int32 nLastReplacement = sListFormat->lastIndexOf('%') + 1;
+while (nFirstReplacement > -1 && nFirstReplacement < nLen - 1
+   && ((*sListFormat)[nFirstReplacement + 1] < '1'
+   || (*sListFormat)[nFirstReplacement + 1] > '9'))
+{
+nFirstReplacement = sListFormat->indexOf('%', nFirstReplacement + 1);
+}
+
+sal_Int32 nLastReplacement = nFirstReplacement == -1 ? -1 : 
sListFormat->lastIndexOf('%');
+while (nLastReplacement > 0
+   && ((*sListFormat)[nLastReplacement - 1] < '0'
+   || (*sListFormat)[nLastReplacement - 1] > '9'))
+{
+nLastReplacement = sListFormat->lastIndexOf('%', nLastReplacement);
+}
+if (nLastReplacement < nFirstReplacement)
+nLastReplacement = nFirstReplacement;
+else
+++nLastReplacement;
+
 if (nFirstReplacement > 0)
 // Everything before first '%' will be prefix
 sPrefix = sListFormat->copy(0, nFirstReplacement);
-if (nLastReplacement >= 0 && nLastReplacement < sListFormat->getLength())
+if (nLastReplacement >= 0 && nLastReplacement < nLen)
 // Everything beyond last '%' is a suffix
 sSuffix = sListFormat->copy(nLastReplacement);
 
 sal_uInt8 nPercents = 0;
-for (sal_Int32 i = 0; i < sListFormat->getLength(); i++)
+for (sal_Int32 i = nFirstReplacement > 0 ? nFirstReplacement : 0; i < 
nLastReplacement; i++)
 {
 if ((*sListFormat)[i] == '%')
 nPercents++;


core.git: sw/source

2024-05-16 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/ww8graf.cxx |   17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 1a38ff09bef969ad13877e3e752b04e1d590323e
Author: Justin Luth 
AuthorDate: Tue May 14 21:29:29 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 16 13:07:16 2024 +0200

NFC use more GetTrueWhichIDFromSlotID

We already check if nWhich is not equal to 0,
so instead of returning nWhich == nSlotId
(which we immediately check for an reject),
use this version of the function which returns a 0
instead of the slotid when there is no nWhich.

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

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a0209e002d8e..97420da84945 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -536,12 +536,10 @@ void SwWW8ImplReader::InsertTxbxStyAttrs(SfxItemSet& rS, 
sal_uInt16 nColl, ManTy
 aLR.SetRight(pStyInf->m_pFormat->GetRightMargin().GetRight());
 rS.Put(aLR);
 }
-else if (
-nSlotId && nWhich != nSlotId &&
-0 != (nWhich = pEditPool->GetWhichIDFromSlotID(nSlotId)) &&
-nWhich != nSlotId &&
-( SfxItemState::SET != rS.GetItemState(nWhich, false) )
-   )
+else if (nSlotId && nWhich != nSlotId
+ && 0 != (nWhich = 
pEditPool->GetTrueWhichIDFromSlotID(nSlotId))
+ && SfxItemState::SET != rS.GetItemState(nWhich, false))
+
 {
 rS.Put( pItem->CloneSetWhich(nWhich) );
 }
@@ -794,11 +792,8 @@ void SwWW8ImplReader::InsertAttrsAsDrawingAttrs(WW8_CP 
nStartCp, WW8_CP nEndCp,
 }
 pS->Put(aLR);
 }
-else if (
-nSlotId && nWhich != nSlotId &&
-0 != (nWhich = 
pEditPool->GetWhichIDFromSlotID(nSlotId)) &&
-nWhich != nSlotId
-)
+else if (nSlotId && nWhich != nSlotId
+ && 0 != (nWhich = 
pEditPool->GetTrueWhichIDFromSlotID(nSlotId)))
 {
 pS->Put( pItem->CloneSetWhich(nWhich) );
 }


core.git: sw/qa sw/source

2024-05-16 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/data/tdf72511_editengLRSpace.doc |binary
 sw/qa/extras/ww8export/ww8export4.cxx   |   23 ++
 sw/source/filter/ww8/ww8graf.cxx|   61 +++-
 sw/source/filter/ww8/ww8par.hxx |2 
 4 files changed, 82 insertions(+), 4 deletions(-)

New commits:
commit 7fcd5ac42086f1374c3bd5eb2be9a59e6f38f2e3
Author: Justin Luth 
AuthorDate: Tue May 14 18:12:59 2024 -0400
Commit: Michael Stahl 
CommitDate: Thu May 16 09:54:33 2024 +0200

tdf#72511 tdf#78510 ww8import: recombine into SvxLRSpaceItem for EE

This fixes Michael's 7.6 regression,
commit db115bec9254417ef7a3faf687478fe5424ab378
which split RES_LR_SPACE into (mainly) three pieces.

The regression caused paragraphs in textboxes
(and anything else that ends up in EditEng)
to lose left and right paragraph indents.

Accidentally, that regression fixed indents for comments,
since MSO ignores them for DOC format,
so I made sure that these properties were not passed to commments.

make CppunitTest_sw_ww8export4 \
CPPUNIT_TEST_NAME=testTdf72511_editengLRSpace

Change-Id: I95121e4b32193701af3e1d77ba92c36aca7f16cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167651
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ww8export/data/tdf72511_editengLRSpace.doc 
b/sw/qa/extras/ww8export/data/tdf72511_editengLRSpace.doc
new file mode 100644
index ..adf12e9f6b58
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf72511_editengLRSpace.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index 6caffceffa00..b52e2b8f77f1 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -54,6 +55,28 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964)
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, 
getProperty(getShapeByName(u"Image2"), 
"AnchorType"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf72511_editengLRSpace, 
"tdf72511_editengLRSpace.doc")
+{
+// given a default paragraph style with a left indent of 2 inches,
+// the comment should ignore the indent, but the textbox must not.
+uno::Reference xRun(
+
getProperty>(getRun(getParagraph(1), 3), 
"TextField"));
+uno::Reference 
xComment(getProperty>(xRun, "TextRange"));
+uno::Reference xParagraph(getParagraphOfText(1, 
xComment), uno::UNO_QUERY);
+// The comment was indented by 4001 (2 inches) instead of nothing
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xParagraph, 
"ParaLeftMargin"));
+
+uno::Reference xGroupShape(getShape(1), 
uno::UNO_QUERY_THROW);
+uno::Reference xShape2(xGroupShape->getByIndex(1), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.TextShape"), 
xShape2->getShapeType());
+uno::Reference xTextbox(xShape2, uno::UNO_QUERY_THROW);
+uno::Reference xTBPara(xTextbox, uno::UNO_QUERY);
+// Textbox paragraphs had no indent instead of 5080 (2 inches - the same 
as normal paragraphs).
+CPPUNIT_ASSERT_EQUAL(sal_Int32(5080), getProperty(xTBPara, 
"ParaLeftMargin"));
+CPPUNIT_ASSERT_EQUAL_MESSAGE("sanity check: normal paragraph's indent", 
sal_Int32(5080),
+ getProperty(getParagraph(1), 
"ParaLeftMargin"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, 
"tdf160049_anchorMargin.doc")
 {
 // given a document with a LEFT "column/text" anchored image
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 28b1211683d1..a0209e002d8e 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -68,6 +68,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -495,7 +496,7 @@ static ESelection GetESelection(EditEngine const 
, tools::Long n
 // Which-IDs are changed according to the aDstTab table so that the
 // EditEngine will not ignore them.
 // Both Paragraph and character attributes are stuffed into the ItemSet.
-void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, sal_uInt16 nColl )
+void SwWW8ImplReader::InsertTxbxStyAttrs(SfxItemSet& rS, sal_uInt16 nColl, 
ManTypes eType)
 {
 SwWW8StyInf * pStyInf = GetStyle(nColl);
 if( !(pStyInf != nullptr && pStyInf->m_pFormat && pStyInf->m_bColl) )
@@ -512,7 +513,30 @@ void SwWW8ImplReader::InsertTxbxStyAttrs( SfxItemSet& rS, 
sal_uInt16 nColl )
 SfxItemPool *pEditPool = rS.GetPool();
 sal_uInt16 nWhich = i;
 sal_uInt16 nSlotId = m_rDoc.GetAttrPool().GetSlotId(nWhich);
-if (
+
+

core.git: sw/source

2024-05-15 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/ww8par6.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit ebf7d87fa4cb7ceac80190f48b7d035aa9469acf
Author: Justin Luth 
AuthorDate: Fri May 10 11:24:26 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 16 01:48:38 2024 +0200

NFC typo: rename to consistent bFirstLineOfstSet

One version spelled "Line" wrong (Lin),
and the other version had poor "Ofst" capitalization(OfSt).

I decided not to make it "Ofset" because then you get
"OfsetSet" which looks a bit more redundant,
and then m_aTextNodesHavingFirstLineOfstSet should also be renamed...

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

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index bc89199c4904..021445724647 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2844,7 +2844,7 @@ bool SwWW8ImplReader::TestSameApo(const ApoTestResults 
,
 }
 
 void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr,
-   const bool bFirstLineOfStSet,
+   const bool bFirstLineOfstSet,
const bool bLeftIndentSet )
 {
 if( m_bNoAttrImport ) // for ignoring styles during doc inserts
@@ -2867,7 +2867,7 @@ void SwWW8ImplReader::NewAttr( const SfxPoolItem& rAttr,
 {
 m_xCtrlStck->NewAttr(*m_pPaM->GetPoint(), rAttr);
 // #i103711#
-if ( bFirstLineOfStSet )
+if (bFirstLineOfstSet)
 {
 const SwNode* pNd = &(m_pPaM->GetPoint()->GetNode());
 m_aTextNodesHavingFirstLineOfstSet.insert( pNd );
@@ -4346,7 +4346,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const 
sal_uInt8* pData, short nLe
 }
 }
 
-bool bFirstLinOfstSet( false ); // #i103711#
+bool bFirstLineOfstSet(false); // #i103711#
 bool bLeftIndentSet( false ); // #i105414#
 
 switch (nId)
@@ -4412,7 +4412,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const 
sal_uInt8* pData, short nLe
 {
 m_vColl[m_nCurrentColl].m_bListRelevantIndentSet = true;
 }
-bFirstLinOfstSet = true; // #i103711#
+bFirstLineOfstSet = true; // #i103711#
 break;
 //sprmPDxaRight
 case NS_sprm::v6::sprmPDxaRight:
@@ -4424,7 +4424,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const 
sal_uInt8* pData, short nLe
 return;
 }
 
-NewAttr(*pFirstLine, bFirstLinOfstSet, false); // #i103711#, #i105414#
+NewAttr(*pFirstLine, bFirstLineOfstSet, false); // #i103711#, #i105414#
 NewAttr(*pLeftMargin, false, bLeftIndentSet);
 NewAttr(*pRightMargin, false, false);
 }


core.git: Branch 'distro/collabora/co-24.04' - desktop/source include/sfx2 sd/inc sd/qa sd/sdi sd/source sfx2/source

2024-05-14 Thread Justin Luth (via logerrit)
 desktop/source/app/app.cxx   |1 
 desktop/source/app/cmdlineargs.cxx   |4 ++-
 desktop/source/app/cmdlineargs.hxx   |2 +
 desktop/source/app/cmdlinehelp.cxx   |3 +-
 desktop/source/app/dispatchwatcher.cxx   |   10 
 desktop/source/app/dispatchwatcher.hxx   |2 -
 desktop/source/app/officeipcthread.cxx   |3 +-
 desktop/source/app/officeipcthread.hxx   |1 
 include/sfx2/sfxsids.hrc |2 -
 sd/inc/drawdoc.hxx   |8 +++---
 sd/qa/unit/tiledrendering/tiledrendering.cxx |2 -
 sd/sdi/sdraw.sdi |2 -
 sd/source/core/drawdoc.cxx   |6 ++--
 sd/source/ui/docshell/docshel4.cxx   |   33 ++-
 sd/source/ui/slideshow/slideshowimpl.cxx |7 +++--
 sd/source/ui/view/ViewShellBase.cxx  |   15 
 sd/source/ui/view/drviewse.cxx   |7 -
 sfx2/source/appl/appuno.cxx  |8 +++---
 sfx2/source/doc/objstor.cxx  |2 -
 19 files changed, 71 insertions(+), 47 deletions(-)

New commits:
commit 773fe1fe924110d36749a51645a4e44d27c939c8
Author: Justin Luth 
AuthorDate: Fri May 3 08:32:27 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue May 14 09:11:06 2024 +0200

tdf#69192: add StartingSlide to SID_PRESENTATION and cmdline show=

Allow the user to start the presentation at a specific slide
using command-line parameters.

This backport includes ddc4cd3d0cf9e8bde440df3e92e98a2a2017c797
NFC dispatchwatcher.hxx: rename aPrinterName to aParam

Change-Id: I87797cbccb463904e5d2fe9b078e3921be27c91a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167066
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167609
Tested-by: Jenkins CollaboraOffice 

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0d66a48daac7..7c81b0a3bbc1 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2081,6 +2081,7 @@ void Desktop::OpenClients()
 aRequest.aConversionParams = rArgs.GetConversionParams();
 aRequest.aConversionOut = rArgs.GetConversionOut();
 aRequest.aImageConversionType = rArgs.GetImageConversionType();
+aRequest.aStartListParams = rArgs.GetStartListParams();
 aRequest.aInFilter = rArgs.GetInFilter();
 aRequest.bTextCat = rArgs.IsTextCat();
 aRequest.bScriptCat = rArgs.IsScriptCat();
diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index e7f315204048..3a3f876f6e90 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -538,10 +538,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& 
supplier )
 // open in viewmode
 eCurrentEvent = CommandLineEvent::View;
 }
-else if ( oArg == "show" )
+else if (oArg == "show" || oArg.startsWith("show=", ))
 {
 // open in viewmode
 eCurrentEvent = CommandLineEvent::Start;
+// start on the first slide unless a valid starting slide # 
was provided
+m_startListParams = rest.toUInt32() > 0 ? rest : "1";
 }
 else if ( oArg == "display" )
 {
diff --git a/desktop/source/app/cmdlineargs.hxx 
b/desktop/source/app/cmdlineargs.hxx
index 64a1bcfd0ccb..8e0c6e649584 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -113,6 +113,7 @@ class CommandLineArgs
 const OUString& GetConversionParams() const { return 
m_conversionparams;}
 OUStringGetConversionOut() const;
 OUString const &GetImageConversionType() const { return 
m_convertimages; }
+const OUString& GetStartListParams() const { return 
m_startListParams; }
 const OUString& GetPidfileName() const { return m_pidfile;}
 
 // Special analyzed states (does not match directly to a command line 
parameter!)
@@ -176,6 +177,7 @@ class CommandLineArgs
 OUString m_conversionparams;
 OUString m_conversionout; // contains external URIs
 OUString m_convertimages; // The format in which images should be 
converted
+OUString m_startListParams;
 std::vector< OUString > m_infilter;
 OUString m_language;
 OUString m_pidfile;
diff --git a/desktop/source/app/cmdlinehelp.cxx 
b/desktop/source/app/cmdlinehelp.cxx
index 9c9fd940f233..10b3e5c48cbb 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -145,8 +145,9 @@ namespace desktop
 "   not appear. If the file name contains spaces

core.git: sw/qa

2024-05-09 Thread Justin Luth (via logerrit)
 sw/qa/core/fields/fields.cxx   |4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |4 ++--
 sw/qa/extras/rtfexport/rtfexport7.cxx  |1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 0f9abf6a5f95dd48cb74cc6bbbadf319aab140fe
Author: Justin Luth 
AuthorDate: Fri Apr 26 21:27:30 2024 -0400
Commit: Justin Luth 
CommitDate: Thu May 9 18:51:38 2024 +0200

document why GatherFields messes up sorted order

Of course, UNO gets a list of fields through some esoteric
broadcast system. This answers the big question in qa swfields
about why the sorting order is stable, but wrong.

An earlier version of the patchset has the code
that would keep the sorted order for at least comments.
But it isn't as efficient, and who knows what the implications
would be, so I have no intention of making such a generic change.

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

diff --git a/sw/qa/core/fields/fields.cxx b/sw/qa/core/fields/fields.cxx
index b783dc0cf3e9..36a29551097b 100644
--- a/sw/qa/core/fields/fields.cxx
+++ b/sw/qa/core/fields/fields.cxx
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf143424)
 xTextFieldsSupplier->getTextFields());
 uno::Reference 
xFields(xFieldsAccess->createEnumeration());
 
-// TODO: I have no idea why fields are enumerated in invalid order, not 
like in document
+// SwModify::Add() enumerates in invalid (mostly reverse) order, not like 
in document
 
 // Field: Chapter Format: Chapter name
 uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
@@ -129,7 +129,7 @@ CPPUNIT_TEST_FIXTURE(Test, testChapterFieldsFollowedBy)
 xTextFieldsSupplier->getTextFields());
 uno::Reference 
xFields(xFieldsAccess->createEnumeration());
 
-// TODO: I have no idea why fields are enumerated in invalid order, not 
like in document
+// SwModify::Add() enumerates in invalid (mostly reverse) order, not like 
in document
 std::vector aFieldValues = {
 "Followed by tab", // #1
 "I.I.I.I", // #16
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 74f83e105c67..ec07fb1124b1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -862,7 +862,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148111, "tdf148111.docx")
 uno::Reference 
xFields(xFieldsAccess->createEnumeration());
 std::vector aExpectedValues = {
 // These field values are NOT in order in document: getTextFields did 
provide
-// fields in a strange but fixed order
+// fields in a strange but fixed order (mostly reversed, thanks to 
SwModify::Add)
 "Title", "Placeholder", "Placeholder", "Placeholder",
 "Placeholder", "Placeholder", "Placeholder", "Placeholder",
 "Placeholder", "Placeholder", "Placeholder", "Placeholder",
@@ -972,7 +972,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf144563, "tdf144563.docx")
 
 std::vector aExpectedValues = {
 // These field values are NOT in order in document: getTextFields did 
provide
-// fields in a strange but fixed order
+// fields in a strange but fixed order (mostly reversed, thanks to 
SwModify::Add)
 "1", "1", "1", "1", "1/", "1/", "1/", "1)", "1)", "1)", "1.)",
 "1.)", "1.)", "1..", "1..", "1..", "1.", "1.", "1.", "1", "1"
 };
diff --git a/sw/qa/extras/rtfexport/rtfexport7.cxx 
b/sw/qa/extras/rtfexport/rtfexport7.cxx
index 61c06869b9a8..d0803d6bcb74 100644
--- a/sw/qa/extras/rtfexport/rtfexport7.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport7.cxx
@@ -728,6 +728,7 @@ DECLARE_RTFEXPORT_TEST(testTdf156030, "tdf156030.rtf")
 uno::Reference 
xFields(xFieldsAccess->createEnumeration());
 
 // As usual, fields given by FieldsAccess are not in same order as in the 
document
+// (mostly in reverse order, thanks to SwModify::Add)
 std::vector> aExpectedValues = {
 { "1 FORMULA 2", "true value 1", "false value 1" }, // #1, condition 
should be 1 = 2
 { "", "", "" }, // #9, not enough field params


core.git: sw/inc sw/qa sw/source

2024-05-08 Thread Justin Luth (via logerrit)
 dev/null|binary
 sw/inc/crsrsh.hxx   |2 -
 sw/qa/uitest/writer_tests8/tdf150037.py |   43 
 sw/source/core/crsr/crbm.cxx|9 ++
 sw/source/uibase/docvw/edtwin.cxx   |6 
 sw/source/uibase/inc/edtwin.hxx |2 -
 sw/source/uibase/inc/wrtsh.hxx  |2 -
 sw/source/uibase/uitest/uiobject.cxx|   37 ---
 sw/source/uibase/wrtsh/wrtsh3.cxx   |4 +-
 9 files changed, 8 insertions(+), 97 deletions(-)

New commits:
commit 22dd422f7ccf7a1ce4dc7fe5b274263a55e464c7
Author: Justin Luth 
AuthorDate: Sat May 4 13:26:53 2024 -0400
Commit: Justin Luth 
CommitDate: Wed May 8 15:28:08 2024 +0200

Revert "tdf#150037 Writer: text fieldmark behaviour changed"

This reverts 24.8 commit 96323a10d3a55d212c350886e2a1344c0cd2ba95.
A mouse click selects the fieldmark to be able to overwrite
the field with the next text input.
But I did not revert:
Additionally the EN SPACE (0x2002) character is visualized
by the DEGREE symbol when 'View/Formatting Marks' is active.

The problem was that the field itself was also selected,
so not only was the placeholder text overwritten,
but so was the entire field.

Additionally, it is ONLY placeholder text that should be selected,
but this was also selecting non-placeholder
(i.e. custom user-entered text) that was being pre-selected
which is NOT what happens in MS Word.

The whole point of the patch in the first place was to
emulate MS Word's response to placeholder text,
so we should also be emulating what happens
to non-placeholder text. That would require tracking
whether the field's text was placeholder or not,
which is not currently track in legacy fields.

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

diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 23dd92da39e1..f5e52e398f3d 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -593,7 +593,7 @@ public:
 ::sw::mark::IFieldmark* GetCurrentFieldmark();
 sw::mark::IFieldmark* GetFieldmarkAfter();
 sw::mark::IFieldmark* GetFieldmarkBefore();
-bool GotoFieldmark( const ::sw::mark::IFieldmark* const pMark, bool 
completeSelection = false );
+bool GotoFieldmark(const ::sw::mark::IFieldmark* const pMark);
 
 // update Cursr, i.e. reset it into content should only be called when the
 // cursor was set to a random position e.g. when deleting frames
diff --git a/sw/qa/uitest/data/tdf150037.docx b/sw/qa/uitest/data/tdf150037.docx
deleted file mode 100644
index 4fcb18efd724..
Binary files a/sw/qa/uitest/data/tdf150037.docx and /dev/null differ
diff --git a/sw/qa/uitest/data/tdf150037.odt b/sw/qa/uitest/data/tdf150037.odt
deleted file mode 100644
index 15d75a694b0a..
Binary files a/sw/qa/uitest/data/tdf150037.odt and /dev/null differ
diff --git a/sw/qa/uitest/writer_tests8/tdf150037.py 
b/sw/qa/uitest/writer_tests8/tdf150037.py
deleted file mode 100644
index e81cf947affc..
--- a/sw/qa/uitest/writer_tests8/tdf150037.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- 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 get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-
-class tdf150037(UITestCase):
-
-def test_tdf150037(self):
-
-with self.ui_test.load_file(get_url_for_data_file("tdf150037.docx")) 
as document:
-
-xWriterDoc = self.xUITest.getTopFocusWindow()
-xWriterEdit = xWriterDoc.getChild("writer_edit")
-
-xWriterEdit.executeAction("CLICK", mkPropertyValues({"START_POS": 
"14", "END_POS": "14"}))
-xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": 
"Replacement"}))
-xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": 
"0", "END_POS": "22"}))
-windowState = xWriterEdit.getState();
-self.assertEqual(windowState[14].Value, "Fieldmark: Replacement")
-
-def test_tdf150037_protected(self):
-
-with self.ui_test.load_file(get_url_for_data_file("tdf150037.odt")) as 
document:
-
-xWriterDoc = self.xUITest.getTopFocusWindow()
-xWriterEdit = xWriterDoc.getChild("writer_edit&

core.git: 2 commits - desktop/source include/sfx2 sd/inc sd/qa sd/sdi sd/source sfx2/source

2024-05-08 Thread Justin Luth (via logerrit)
 desktop/source/app/app.cxx   |1 
 desktop/source/app/cmdlineargs.cxx   |4 ++-
 desktop/source/app/cmdlineargs.hxx   |2 +
 desktop/source/app/cmdlinehelp.cxx   |3 +-
 desktop/source/app/dispatchwatcher.cxx   |   10 
 desktop/source/app/dispatchwatcher.hxx   |2 -
 desktop/source/app/officeipcthread.cxx   |3 +-
 desktop/source/app/officeipcthread.hxx   |1 
 include/sfx2/sfxsids.hrc |2 -
 sd/inc/drawdoc.hxx   |8 +++---
 sd/qa/unit/tiledrendering/tiledrendering.cxx |2 -
 sd/sdi/sdraw.sdi |2 -
 sd/source/core/drawdoc.cxx   |6 ++--
 sd/source/ui/docshell/docshel4.cxx   |   33 ++-
 sd/source/ui/slideshow/slideshowimpl.cxx |7 +++--
 sd/source/ui/view/ViewShellBase.cxx  |   15 
 sd/source/ui/view/drviewse.cxx   |7 -
 sfx2/source/appl/appuno.cxx  |8 +++---
 sfx2/source/doc/objstor.cxx  |2 -
 19 files changed, 71 insertions(+), 47 deletions(-)

New commits:
commit 90eb9ea881a7497bb2ec348b3e4cba5aa5d51fa8
Author: Justin Luth 
AuthorDate: Fri May 3 08:32:27 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed May 8 09:38:59 2024 +0200

tdf#69192: add StartingSlide to SID_PRESENTATION and cmdline show=

Allow the user to start the presentation at a specific slide
using command-line parameters.

This patch depends on the previous variable renaming patch.

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

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 1dcc49f56d7c..eff8b46d069f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2094,6 +2094,7 @@ void Desktop::OpenClients()
 aRequest.aConversionParams = rArgs.GetConversionParams();
 aRequest.aConversionOut = rArgs.GetConversionOut();
 aRequest.aImageConversionType = rArgs.GetImageConversionType();
+aRequest.aStartListParams = rArgs.GetStartListParams();
 aRequest.aInFilter = rArgs.GetInFilter();
 aRequest.bTextCat = rArgs.IsTextCat();
 aRequest.bScriptCat = rArgs.IsScriptCat();
diff --git a/desktop/source/app/cmdlineargs.cxx 
b/desktop/source/app/cmdlineargs.cxx
index ba5a3da5a6c3..09a0cd212947 100644
--- a/desktop/source/app/cmdlineargs.cxx
+++ b/desktop/source/app/cmdlineargs.cxx
@@ -537,10 +537,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& 
supplier )
 // open in viewmode
 eCurrentEvent = CommandLineEvent::View;
 }
-else if ( oArg == "show" )
+else if (oArg == "show" || oArg.startsWith("show=", ))
 {
 // open in viewmode
 eCurrentEvent = CommandLineEvent::Start;
+// start on the first slide unless a valid starting slide # 
was provided
+m_startListParams = rest.toUInt32() > 0 ? rest : "1";
 }
 else if ( oArg == "display" )
 {
diff --git a/desktop/source/app/cmdlineargs.hxx 
b/desktop/source/app/cmdlineargs.hxx
index 59cd741a8c3f..d5d94abd67f2 100644
--- a/desktop/source/app/cmdlineargs.hxx
+++ b/desktop/source/app/cmdlineargs.hxx
@@ -114,6 +114,7 @@ class CommandLineArgs
 const OUString& GetConversionParams() const { return 
m_conversionparams;}
 OUStringGetConversionOut() const;
 OUString const &GetImageConversionType() const { return 
m_convertimages; }
+const OUString& GetStartListParams() const { return 
m_startListParams; }
 const OUString& GetPidfileName() const { return m_pidfile;}
 
 // Special analyzed states (does not match directly to a command line 
parameter!)
@@ -177,6 +178,7 @@ class CommandLineArgs
 OUString m_conversionparams;
 OUString m_conversionout; // contains external URIs
 OUString m_convertimages; // The format in which images should be 
converted
+OUString m_startListParams;
 std::vector< OUString > m_infilter;
 OUString m_language;
 OUString m_pidfile;
diff --git a/desktop/source/app/cmdlinehelp.cxx 
b/desktop/source/app/cmdlinehelp.cxx
index 9c9fd940f233..10b3e5c48cbb 100644
--- a/desktop/source/app/cmdlinehelp.cxx
+++ b/desktop/source/app/cmdlinehelp.cxx
@@ -145,8 +145,9 @@ namespace desktop
 "   not appear. If the file name contains spaces, 
then it   
"
 "   must be enclosed in quotation marks.   
 
"
 "   --view  Opens

core.git: 2 commits - desktop/inc desktop/source sw/inc sw/source

2024-05-07 Thread Justin Luth (via logerrit)
 desktop/inc/app.hxx  |1 
 desktop/source/app/app.cxx   |5 -
 sw/inc/TextCursorHelper.hxx  |5 -
 sw/inc/ndtxt.hxx |2 
 sw/inc/unotextcursor.hxx |2 
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   86 +--
 6 files changed, 34 insertions(+), 67 deletions(-)

New commits:
commit e7ea91a4af1242fcfa5f5ba5f04bbc6662453e28
Author: Justin Luth 
AuthorDate: Wed May 1 11:04:39 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue May 7 08:46:49 2024 +0200

tdf#160814 writerfilter: insert comment after other comments #2

Since writerfilter moved into sw in 24.8,
this section can be seriously optimized.

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

diff --git a/sw/inc/TextCursorHelper.hxx b/sw/inc/TextCursorHelper.hxx
index 3eff663c3d08..41a91ed47626 100644
--- a/sw/inc/TextCursorHelper.hxx
+++ b/sw/inc/TextCursorHelper.hxx
@@ -17,12 +17,15 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #pragma once
+
+#include "swdllapi.h"
+
 #include 
 
 class SwDoc;
 class SwPaM;
 
-class SAL_LOPLUGIN_ANNOTATE("crosscast") OTextCursorHelper
+class SW_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") OTextCursorHelper
 {
 public:
 
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 2350d69edcdb..ee998a33eed6 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -445,7 +445,7 @@ public:
  */
 SwTextAttr* GetTextAttrForEndCharAt(sal_Int32 nIndex, sal_uInt16 nWhich) 
const;
 
-SwTextField* GetFieldTextAttrAt(
+SW_DLLPUBLIC SwTextField* GetFieldTextAttrAt(
 const sal_Int32 nIndex,
 ::sw::GetTextAttrMode const eMode = ::sw::GetTextAttrMode::Expand) 
const;
 
diff --git a/sw/inc/unotextcursor.hxx b/sw/inc/unotextcursor.hxx
index b45cc0899540..397d142dbb36 100644
--- a/sw/inc/unotextcursor.hxx
+++ b/sw/inc/unotextcursor.hxx
@@ -65,7 +65,7 @@ typedef ::cppu::WeakImplHelper
 ,   css::text::XMarkingAccess
 > SwXTextCursor_Base;
 
-class SwXTextCursor final
+class SW_DLLPUBLIC SwXTextCursor final
 : public SwXTextCursor_Base
 , public OTextCursorHelper
 {
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index ebb636e1ab36..bdf05bee33a5 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -129,8 +129,12 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -144,9 +148,6 @@
 #include 
 #include 
 
-#define REFFLDFLAG_STYLE_FROM_BOTTOM 0xc100
-#define REFFLDFLAG_STYLE_HIDE_NON_NUMERICAL 0xc200
-
 using namespace ::com::sun::star;
 using namespace oox;
 namespace writerfilter::dmapper{
@@ -4550,69 +4551,28 @@ void DomainMapper_Impl::PopAnnotation()
 // immediately at the end of the range it spans.
 // If multiple comments have the same end-point, we need to expand 
the range so that
 // this later comment doesn't insert itself before any earlier 
ones.
-const uno::Reference 
xModel(static_cast(m_xTextDocument.get()));
-const uno::Reference xTFS(xModel, 
uno::UNO_QUERY);
-if (xTFS.is())
+auto pSwCursor = dynamic_cast(xCursor.get());
+const SwPaM* pPaM = pSwCursor ? pSwCursor->GetPaM() : nullptr;
+SwTextNode* pTNd = pPaM ? pPaM->GetPointNode().GetTextNode() : 
nullptr;
+if (pTNd)
 {
-// sadly, the enumeration is not correctly sorted, which 
really complicates things.
-const uno::Reference 
xFieldEA(xTFS->getTextFields());
-bool bRetry(false);
-// keep track of the relevant (unsorted) fields that might 
have the same end point
-std::vector> xRetryFields;
-
-uno::Reference xEnum = 
xFieldEA->createEnumeration();
-// Although the primary interest is other comments, the same 
principle
-// probably applies to any kind of field.
-while (xEnum->hasMoreElements())
-{
-try
-{
-// IMPORTANT: nextElement() MUST run before any 
possible exception...
-const uno::Reference 
xField(xEnum->nextElement(),
-  
uno::UNO_QUERY_THROW);
-if 
(xTextRangeCompare->compareRegionStarts(xCursor->getEnd(),
- 

core.git: sw/qa sw/source

2024-05-06 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160814_commentOrder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|   14 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx  |   70 ++
 3 files changed, 84 insertions(+)

New commits:
commit 7ae84ed99b133cdb4c197ecb43e2454f90b0439a
Author: Justin Luth 
AuthorDate: Fri Apr 26 14:23:34 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon May 6 09:09:53 2024 +0200

tdf#160814 writerfilter: insert comment after other comments

If multiple comments all have on the same range
(comment replies typically, but not necessarily)
then make sure that later replies are not inserted
in front of the earlier replies.

MSO can anchor their comments anywhere in the document,
so this is not a perfect, fool-proof solution.
However, it should handle the typical cases.

make CppunitTest_sw_ooxmlexport21 /
CPPUNIT_TEST_NAME=testTdf160814_commentOrder

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160814_commentOrder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160814_commentOrder.docx
new file mode 100644
index ..f8d93e70b409
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160814_commentOrder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 15af73057d75..01c42d0ea34d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -437,6 +437,20 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf159207_footerFramePrBorder)
 // TODO: there SHOULD BE a top border, and even if loaded, it would be 
lost on re-import...
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf160814_commentOrder)
+{
+// given a document with a comment and 5 replies
+loadAndSave("tdf160814_commentOrder.docx");
+
+// make sure the order of the comments is imported and exported correctly
+xmlDocUniquePtr pXmlComments = parseExport("word/comments.xml");
+// This really should be "1. First comment", the 1. being list numbering...
+assertXPathContent(pXmlComments, "//w:comment[1]//w:t"_ostr, "First 
comment");
+assertXPathContent(pXmlComments, "//w:comment[2]//w:t"_ostr, "1.1 first 
reply.");
+assertXPathContent(pXmlComments, "//w:comment[4]//w:t"_ostr, "1.3");
+assertXPathContent(pXmlComments, "//w:comment[6]//w:t"_ostr, "1.5");
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testPersonalMetaData)
 {
 // 1. Remove all personal info
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index a0f0af0831f5..a26c517064ec 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4545,6 +4545,76 @@ void DomainMapper_Impl::PopAnnotation()
 }
 
 xCursor->gotoRange(aAnnotationPosition.m_xEnd, true);
+
+// MS Word can anchor a comment anywhere in the document, but LO 
always anchors it
+// immediately at the end of the range it spans.
+// If multiple comments have the same end-point, we need to expand 
the range so that
+// this later comment doesn't insert itself before any earlier 
ones.
+const uno::Reference 
xModel(static_cast(m_xTextDocument.get()));
+const uno::Reference xTFS(xModel, 
uno::UNO_QUERY);
+if (xTFS.is())
+{
+// sadly, the enumeration is not correctly sorted, which 
really complicates things.
+const uno::Reference 
xFieldEA(xTFS->getTextFields());
+bool bRetry(false);
+// keep track of the relevant (unsorted) fields that might 
have the same end point
+std::vector> xRetryFields;
+
+uno::Reference xEnum = 
xFieldEA->createEnumeration();
+// Although the primary interest is other comments, the same 
principle
+// probably applies to any kind of field.
+while (xEnum->hasMoreElements())
+{
+try
+{
+// IMPORTANT: nextElement() MUST run before any 
possible exception...
+const uno::Reference 
xField(xEnum->nextElement(),
+  
uno::UNO_QUERY_THROW);
+if 
(xTextRangeCompare->compareRegionStarts(xCursor->getEnd(),
+   
xField->getAnchor()) == 1)
+{
+ 

core.git: icon-themes/breeze icon-themes/breeze_dark icon-themes/colibre icon-themes/colibre_dark icon-themes/elementary icon-themes/karasa_jaga icon-themes/sifr icon-themes/sifr_dark icon-themes/suka

2024-05-03 Thread Justin Luth (via logerrit)
 icon-themes/breeze/links.txt |3 
 icon-themes/breeze_dark/links.txt|4 
 icon-themes/colibre/links.txt|3 
 icon-themes/colibre_dark/links.txt   |3 
 icon-themes/elementary/links.txt |3 
 icon-themes/karasa_jaga/links.txt|3 
 icon-themes/sifr/links.txt   |3 
 icon-themes/sifr_dark/links.txt  |3 
 icon-themes/sukapura/links.txt   |3 
 icon-themes/sukapura_dark/links.txt  |3 
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu |   11 ++
 sc/uiconfig/scalc/ui/notebookbar.ui  |   54 
+
 sd/uiconfig/sdraw/ui/notebookbar.ui  |   54 
+
 sd/uiconfig/simpress/ui/notebookbar.ui   |   54 
+
 sfx2/sdi/appslots.sdi|1 
 sfx2/sdi/sfx.sdi |5 
 sfx2/source/appl/appserv.cxx |   55 
+-
 sw/uiconfig/swriter/ui/notebookbar.ui|   54 
+
 18 files changed, 313 insertions(+), 6 deletions(-)

New commits:
commit da86bfd89e529e787da0bbb3e3150c1f5d4e0dfd
Author: Justin Luth 
AuthorDate: Sat Apr 27 10:58:45 2024 -0400
Commit: Justin Luth 
CommitDate: Fri May 3 17:58:15 2024 +0200

tdf#160349: add .uno:ChangeTheme to notebookbar to toggle dark mode

A temporary (ugly, but appropriate) icon has been assigned.

The toggle can be customize-assigned to keyboard, menu, and toolbar,
and can be found by searching for "Dark Mode".

In the menu, it is checked when in Dark mode,
and in the toolbar it is "depressed" or highlighted as active.

Dark mode has been added to the view tab of notebookbar.ui.
I added it as NOT VISIBLE, for several reasons.
- dark mode is rather new and not so stable, so don't over-promote it.
- notebookbars cannot be infinitely customized by the end user,
  so developers have to add all items. Users only enable or disable.
- toggling dark mode really ought to be done at the OS level,
  and typically should be a one-time setting,
  therefore not appropriate to waste precious toolbar space.

The primary benefit of making it available in the menu
is for QA testers who want to easily switch back and forth.
WARNING: by customizing the notebookbar, you prevent seeing
any future NBB changes made to the program
(until you reset to defaults or blow away the user profile).

Dark Mode can easily be added to a menu, toolbar or keyboard shortcut
by the end user, so I didn't bother adding it anywhere else.

To avoid completely cluttering up this commit,
I only added Dark mode to the main notebookbar.
Once this commit has been finalized,
the other writer-apps and notebookbars can
also gain this command.

Change-Id: Ia7594ad81e305ead922abd0ad7b41d6fc0413053
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166781
Reviewed-by: Heiko Tietze 
Tested-by: Jenkins
    Reviewed-by: Justin Luth 

diff --git a/icon-themes/breeze/links.txt b/icon-themes/breeze/links.txt
index 8eaca399a5f0..23ba813b7107 100644
--- a/icon-themes/breeze/links.txt
+++ b/icon-themes/breeze/links.txt
@@ -1486,16 +1486,19 @@ cmd/sc_leftpara.png cmd/sc_alignleft.png
 cmd/sc_rightpara.png cmd/sc_alignright.png
 
 # View menu
+cmd/32/changetheme.png cmd/32/symbolshapes.moon.png
 cmd/32/gridmenu.png cmd/32/gridvisible.png
 cmd/32/navigatemenu.png cmd/32/navigator.png
 cmd/32/scrollbarmenu.png cmd/32/scrollbar.png
 cmd/32/sidebarmenu.png cmd/32/sidebar.png
 
+cmd/lc_changetheme.png cmd/lc_symbolshapes.moon.png
 cmd/lc_gridmenu.png cmd/lc_gridvisible.png
 cmd/lc_navigatemenu.png cmd/lc_navigator.png
 cmd/lc_scrollbarmenu.png cmd/lc_scrollbar.png
 cmd/lc_sidebarmenu.png cmd/lc_sidebar.png
 
+cmd/sc_changetheme.png cmd/sc_symbolshapes.moon.png
 cmd/sc_gridmenu.png cmd/sc_gridvisible.png
 cmd/sc_navigatemenu.png cmd/sc_navigator.png
 cmd/sc_scrollbarmenu.png cmd/sc_scrollbar.png
diff --git a/icon-themes/breeze_dark/links.txt 
b/icon-themes/breeze_dark/links.txt
index 8eaca399a5f0..748bc16ab2d2 100644
--- a/icon-themes/breeze_dark/links.txt
+++ b/icon-themes/breeze_dark/links.txt
@@ -1486,16 +1486,20 @@ cmd/sc_leftpara.png cmd/sc_alignleft.png
 cmd/sc_rightpara.png cmd/sc_alignright.png
 
 # View menu
+
+cmd/32/changetheme.png cmd/32/symbolshapes.moon.png
 cmd/32/gridmenu.png cmd/32/gridvisible.png
 cmd/32/navigatemenu.png cmd/32/navigator.png
 cmd/32/scrollbarmenu.png cmd/32/s

core.git: sw/source

2024-04-30 Thread Justin Luth (via logerrit)
 sw/source/writerfilter/dmapper/GraphicImport.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit bc7501d30ab9a3a5edec66d2f0022177f85d6127
Author: Justin Luth 
AuthorDate: Sat Apr 20 19:45:39 2024 -0400
Commit: Justin Luth 
CommitDate: Wed May 1 00:44:37 2024 +0200

NFC GraphicImport.cxx: address nit x2

less emphasis on minimizing "if logic"
and more emphasis on readability
(especially since the comment comes after the logic).

In the most common cases, this version
should actually finish sooner too.

I didn't remember doing a copy/paste,
so the first time I only fixed the one instance...

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

diff --git a/sw/source/writerfilter/dmapper/GraphicImport.cxx 
b/sw/source/writerfilter/dmapper/GraphicImport.cxx
index 0320c671c47f..3a60e63dbefb 100644
--- a/sw/source/writerfilter/dmapper/GraphicImport.cxx
+++ b/sw/source/writerfilter/dmapper/GraphicImport.cxx
@@ -1304,9 +1304,10 @@ void GraphicImport::lcl_attribute(Id nName, Value& 
rValue)
 }
 
 if (m_pImpl->m_nHoriRelation == 
text::RelOrientation::FRAME
-&& m_pImpl->m_nHoriOrient > 
text::HoriOrientation::NONE
-&& m_pImpl->m_nHoriOrient != 
text::HoriOrientation::CENTER
-&& m_pImpl->m_nHoriOrient < 
text::HoriOrientation::FULL)
+&& (m_pImpl->m_nHoriOrient == 
text::HoriOrientation::LEFT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::RIGHT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::INSIDE
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::OUTSIDE))
 {
 // before compat15, relative 
left/right/inside/outside honored margins.
 if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)


core.git: sc/source

2024-04-30 Thread Justin Luth (via logerrit)
 sc/source/filter/inc/addressconverter.hxx |   37 ---
 sc/source/filter/oox/addressconverter.cxx |  156 +-
 sc/source/filter/oox/scenariobuffer.cxx   |3 
 sc/source/filter/oox/sheetdatacontext.cxx |3 
 4 files changed, 14 insertions(+), 185 deletions(-)

New commits:
commit a50b2d11ed6066a655278305f1fc880d3a5fe911
Author: Justin Luth 
AuthorDate: Wed Apr 24 14:23:22 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Apr 30 08:48:11 2024 +0200

xlsx import: parse short-hand version of address

Since I did this for the range, I might as well
try to entirely remove parseOoxAddress2d.

This allows me to remove parseOoxAddress2d.
No point in having duplicate functions to turn a string
into an ScAddress.
[I assume this was a left-over from when this code
was in /oox and didn't have access to sc methods.]

Earlier patchsets checked that the new method and the old method
returned the same values for all existing unit tests.

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

diff --git a/sc/source/filter/inc/addressconverter.hxx 
b/sc/source/filter/inc/addressconverter.hxx
index 034bcbacaf39..41fe38cd0efd 100644
--- a/sc/source/filter/inc/addressconverter.hxx
+++ b/sc/source/filter/inc/addressconverter.hxx
@@ -97,34 +97,6 @@ class AddressConverter final : public WorkbookHelper
 public:
 explicitAddressConverter( const WorkbookHelper& rHelper );
 
-/** Tries to parse the passed string for a 2d cell address in A1 notation.
-
-This function accepts all strings that match the regular expression
-"[a-zA-Z]{1,6}0*[1-9][0-9]{0,8}" (without quotes), i.e. 1 to 6 letters
-for the column index (translated to 0-based column indexes from 0 to
-321,272,405), and 1 to 9 digits for the 1-based row index (translated
-to 0-based row indexes from 0 to 999,999,998). The row number part may
-contain leading zeros, they will be ignored. It is up to the caller to
-handle cell addresses outside of a specific valid range (e.g. the
-entire spreadsheet).
-
-@param ornColumn  (out-parameter) Returns the converted column index.
-@param ornRow  (out-parameter) returns the converted row index.
-@param rString  The string containing the cell address.
-@param nStart  Start index of string part in rString to be parsed.
-@param nLength  Length of string part in rString to be parsed.
-
-@return  true = Parsed string was valid, returned values can be used.
- */
-static bool parseOoxAddress2d(
-sal_Int32& ornColumn, sal_Int32& ornRow,
-std::u16string_view aString,
-sal_Int32 nStart = 0,
-sal_Int32 nLength = SAL_MAX_INT32 );
-
-static bool parseOoxAddress2d(
-sal_Int32& ornColumn, sal_Int32& ornRow, std::string_view pStr );
-
 /** Returns the biggest valid cell address in the own Calc document. */
 const ScAddress&
 getMaxApiAddress() const { return maMaxApiPos; }
@@ -188,10 +160,7 @@ public:
 static boolconvertToCellAddressUnchecked(
 ScAddress& orAddress,
 const OUString& rString,
-sal_Int16 nSheet );
-
-static bool convertToCellAddressUnchecked(
-ScAddress& orAddress, std::string_view pStr, sal_Int16 nSheet );
+sal_Int16 nSheet, const ScDocument& rDoc);
 
 /** Tries to convert the passed string to a single cell address.
 
@@ -208,10 +177,6 @@ public:
 sal_Int16 nSheet,
 bool bTrackOverflow );
 
-bool convertToCellAddress(
-ScAddress& rAddress,
-std::string_view pStr, sal_Int16 nSheet, bool bTrackOverflow );
-
 /** Returns a valid cell address by moving it into allowed dimensions.
 
 @param rString  Cell address string in A1 notation.
diff --git a/sc/source/filter/oox/addressconverter.cxx 
b/sc/source/filter/oox/addressconverter.cxx
index 4109ef3c8833..98a8dae3b625 100644
--- a/sc/source/filter/oox/addressconverter.cxx
+++ b/sc/source/filter/oox/addressconverter.cxx
@@ -80,123 +80,6 @@ AddressConverter::AddressConverter( const WorkbookHelper& 
rHelper ) :
 initializeMaxPos( OOX_MAXTAB, OOX_MAXCOL, OOX_MAXROW );
 }
 
-bool AddressConverter::parseOoxAddress2d(
-sal_Int32& ornColumn, sal_Int32& ornRow,
-std::u16string_view aString, sal_Int32 nStart, sal_Int32 nLength )
-{
-ornColumn = ornRow = 0;
-if( (nStart < 0) || (nStart >= sal_Int32(aString.size())) || (nLength < 2

core.git: sc/qa sc/source

2024-04-29 Thread Justin Luth (via logerrit)
 dev/null   |binary
 sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |9 --
 sc/source/core/tool/rangelst.cxx   |4 
 sc/source/filter/excel/xestream.cxx|3 
 sc/source/filter/inc/addressconverter.hxx  |   25 -
 sc/source/filter/oox/addressconverter.cxx  |   58 +++--
 sc/source/filter/oox/autofilterbuffer.cxx  |6 -
 sc/source/filter/oox/commentsbuffer.cxx|4 
 sc/source/filter/oox/pivotcachebuffer.cxx  |4 
 sc/source/filter/oox/pivottablebuffer.cxx  |4 
 sc/source/filter/oox/tablebuffer.cxx   |4 
 sc/source/filter/oox/worksheetfragment.cxx |3 
 13 files changed, 38 insertions(+), 86 deletions(-)

New commits:
commit cfb913db1b2024f8ff6a55f45742b303107a1924
Author: Justin Luth 
AuthorDate: Tue Apr 23 20:15:27 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Apr 29 15:59:45 2024 +0200

xlsx import: parse short-hand version of range address

In order to indicate the entire row or column
(for the benefit of a spreadsheet program that may eventually
increase the supported number of rows or columns it supports)
a short-handed form of the range can be used
like "B:B" for the entire column,
or "1:10" for the first 10 rows of all columns.

Shorthand is nicer for humans
and allows for future expansion of row/column space

This reverts 24.8 commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7
xlsx export: never export short-hand version of range address
which reduced the likelihood that we will ever see
such a range, because Excel seems to always
write out the full address.
However, the shorthand version is definitely valid for Excel.

Earlier patchsets checked that the new method and the old method
returned the same values for all existing unit tests.

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

diff --git a/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx 
b/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx
new file mode 100644
index ..1f8a5675e796
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/enhancedProtectionRangeShorthand.xlsx differ
diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx 
b/sc/qa/unit/data/xlsx/protectedRange.xlsx
deleted file mode 100644
index a185ac3598d0..
Binary files a/sc/qa/unit/data/xlsx/protectedRange.xlsx and /dev/null differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index c0b17e11aeb8..1f9ba48df12a 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1263,15 +1263,14 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX)
 "External");
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange)
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testEnhancedProtectionRangeShorthand)
 {
-createScDoc("xlsx/protectedRange.xlsx");
+createScDoc("xlsx/enhancedProtectionRangeShorthand.xlsx");
 save("Calc Office Open XML");
-
 xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml");
 CPPUNIT_ASSERT(pDoc);
-// entire row was being exported as shorthand 'B:B' which LO couldn't read 
back
-assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, 
"sqref"_ostr, "B1:B1048576");
+// the shorthand version was not recognized as a valid range on import
+assertXPath(pDoc, "//x:protectedRanges/x:protectedRange[1]"_ostr, 
"sqref"_ostr, "C:C");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332)
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 998187b42996..f84c92c7a7ae 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -133,10 +133,6 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags 
nFlags, const ScDocument& r
   formula::FormulaGrammar::AddressConvention eConv,
   sal_Unicode cDelimiter, bool bFullAddressNotation ) 
const
 {
-// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand 
address,
-// so definitely do not export that way.
-assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation);
-
 if (!cDelimiter)
 cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep);
 
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index c93cf6f5f34d..32cecf352de3 100

core.git: Branch 'distro/collabora/co-23.05' - sc/source

2024-04-24 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/xestream.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 1675c3e2f14c68873e63cb725e0dd6e4b70cb3c3
Author: Justin Luth 
AuthorDate: Thu Apr 18 17:30:06 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed Apr 24 09:11:59 2024 +0200

xlsx export: never export short-hand version of range address

If all the columns are in focus, LO was exporting
A10:XFD11 as 10:11.

Amazingly, we can't read that. Seriously?
Doesn't Microsoft ever export in shorthand?

I thought it would be helpful to find any instances
where LO is exporting shorthand, to verify that
we really do break import of round-tripped files.

I made a brief attempt at fixing the import,
but it will require lots of changes
and break lots of assumptions.
Obviously it can't be a hugely common problem
because I didn't find any bug reports about it...
I abandoned my attempt because it is too prone to disaster.

Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166515
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index d511c6daebe1..c856eebd5c9c 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -745,7 +745,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, 
const ScRange& rRange, b
 OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& 
rRangeList )
 {
 OUString s;
-rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ');
+rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ',
+  /*FullAddressNotation=*/true);
 return s.toUtf8();
 }
 


core.git: Branch 'distro/collabora/co-24.04' - sc/qa sc/source

2024-04-24 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xlsx/protectedRange.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx   |   11 +++
 sc/source/core/tool/rangelst.cxx |4 
 sc/source/filter/excel/xestream.cxx  |3 ++-
 4 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 34886ba8843b319e114742f5d42e30d835a85ae0
Author: Justin Luth 
AuthorDate: Thu Apr 18 17:30:06 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed Apr 24 09:11:40 2024 +0200

xlsx export: never export short-hand version of range address

If all the columns are in focus, LO was exporting
A10:XFD11 as 10:11.

Amazingly, we can't read that. Seriously?
Doesn't Microsoft ever export in shorthand?

I thought it would be helpful to find any instances
where LO is exporting shorthand, to verify that
we really do break import of round-tripped files.

I made a brief attempt at fixing the import,
but it will require lots of changes
and break lots of assumptions.
Obviously it can't be a hugely common problem
because I didn't find any bug reports about it...
I abandoned my attempt because it is too prone to disaster.

Change-Id: If59c316d0af466e5cf71ecc459bdf57bb2cd5144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166269
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166514
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx 
b/sc/qa/unit/data/xlsx/protectedRange.xlsx
new file mode 100644
index ..a185ac3598d0
Binary files /dev/null and b/sc/qa/unit/data/xlsx/protectedRange.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 9f281928c732..c0b17e11aeb8 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1263,6 +1263,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX)
 "External");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange)
+{
+createScDoc("xlsx/protectedRange.xlsx");
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+// entire row was being exported as shorthand 'B:B' which LO couldn't read 
back
+assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, 
"sqref"_ostr, "B1:B1048576");
+}
+
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332)
 {
 createScDoc("xlsx/tdf91332.xlsx");
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index f84c92c7a7ae..998187b42996 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -133,6 +133,10 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags 
nFlags, const ScDocument& r
   formula::FormulaGrammar::AddressConvention eConv,
   sal_Unicode cDelimiter, bool bFullAddressNotation ) 
const
 {
+// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand 
address,
+// so definitely do not export that way.
+assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation);
+
 if (!cDelimiter)
 cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep);
 
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index a70e4e08bd71..e4ae036ead48 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -748,7 +748,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, 
const ScRange& rRange, b
 OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& 
rRangeList )
 {
 OUString s;
-rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ');
+rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ',
+  /*FullAddressNotation=*/true);
 return s.toUtf8();
 }
 


core.git: sc/source

2024-04-23 Thread Justin Luth (via logerrit)
 sc/source/core/tool/token.cxx |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 4ed26399e2c9a0d35a1f7e6f19f68a5bb0303109
Author: Justin Luth 
AuthorDate: Tue Apr 23 13:38:08 2024 -0400
Commit: Justin Luth 
CommitDate: Tue Apr 23 23:00:56 2024 +0200

NFC ScRawToken::CreateToken: ocPush uses the same function

Ever since commit 87307aba9e8dbca16672e6df701d9f905b9e1786
Author: Jens-Heiner Rechtien on Thu Jan 8 10:47:13 2009 +
CWS-TOOLING: integrate CWS frmdlg
 case svSingleRef :
 if (eOp == ocPush)
 return new ScSingleRefToken( aRef.Ref1 );
 else
-return new ScSingleRefOpToken( eOp, aRef.Ref1 );
+return new ScSingleRefToken( aRef.Ref1, eOp );
 case svDoubleRef :
 if (eOp == ocPush)
 return new ScDoubleRefToken( aRef );
 else
-return new ScDoubleRefOpToken( eOp, aRef );
+return new ScDoubleRefToken( aRef, eOp );

Instead of using different functions, they now use the same function
where optional eOp = ocPush [sc/inc/token.hxx].

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

diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 33e520723213..364913e4fa99 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -370,15 +370,9 @@ FormulaToken* ScRawToken::CreateToken(ScSheetLimits& 
rLimits) const
 return new FormulaStringOpToken(eOp, std::move(aSS));
 }
 case svSingleRef :
-if (eOp == ocPush)
-return new ScSingleRefToken(rLimits, aRef.Ref1 );
-else
-return new ScSingleRefToken(rLimits, aRef.Ref1, eOp );
+return new ScSingleRefToken(rLimits, aRef.Ref1, eOp);
 case svDoubleRef :
-if (eOp == ocPush)
-return new ScDoubleRefToken(rLimits, aRef );
-else
-return new ScDoubleRefToken(rLimits, aRef, eOp );
+return new ScDoubleRefToken(rLimits, aRef, eOp);
 case svMatrix :
 IF_NOT_OPCODE_ERROR( ocPush, ScMatrixToken);
 return new ScMatrixToken( pMat );


core.git: sc/qa sc/source

2024-04-23 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xlsx/protectedRange.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx   |   11 +++
 sc/source/core/tool/rangelst.cxx |4 
 sc/source/filter/excel/xestream.cxx  |3 ++-
 4 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit a29d91ac403f1ed431ca95b8b9c290bd354c3ae7
Author: Justin Luth 
AuthorDate: Thu Apr 18 17:30:06 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Apr 23 08:40:49 2024 +0200

xlsx export: never export short-hand version of range address

If all the columns are in focus, LO was exporting
A10:XFD11 as 10:11.

Amazingly, we can't read that. Seriously?
Doesn't Microsoft ever export in shorthand?

I thought it would be helpful to find any instances
where LO is exporting shorthand, to verify that
we really do break import of round-tripped files.

I made a brief attempt at fixing the import,
but it will require lots of changes
and break lots of assumptions.
Obviously it can't be a hugely common problem
because I didn't find any bug reports about it...
I abandoned my attempt because it is too prone to disaster.

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

diff --git a/sc/qa/unit/data/xlsx/protectedRange.xlsx 
b/sc/qa/unit/data/xlsx/protectedRange.xlsx
new file mode 100644
index ..a185ac3598d0
Binary files /dev/null and b/sc/qa/unit/data/xlsx/protectedRange.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 9f281928c732..c0b17e11aeb8 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -1263,6 +1263,17 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf126024XLSX)
 "External");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testProtectedRange)
+{
+createScDoc("xlsx/protectedRange.xlsx");
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pDoc = parseExport("xl/worksheets/sheet1.xml");
+CPPUNIT_ASSERT(pDoc);
+// entire row was being exported as shorthand 'B:B' which LO couldn't read 
back
+assertXPath(pDoc, "//x:protectedRanges/x:protectedRange"_ostr, 
"sqref"_ostr, "B1:B1048576");
+}
+
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf91332)
 {
 createScDoc("xlsx/tdf91332.xlsx");
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index f84c92c7a7ae..998187b42996 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -133,6 +133,10 @@ void ScRangeList::Format( OUString& rStr, ScRefFlags 
nFlags, const ScDocument& r
   formula::FormulaGrammar::AddressConvention eConv,
   sal_Unicode cDelimiter, bool bFullAddressNotation ) 
const
 {
+// LO's AddressConverter::parseOoxAddress2d cannot import a short-hand 
address,
+// so definitely do not export that way.
+assert(eConv != FormulaGrammar::CONV_XL_OOX || bFullAddressNotation);
+
 if (!cDelimiter)
 cDelimiter = ScCompiler::GetNativeSymbolChar(ocSep);
 
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 32cecf352de3..c93cf6f5f34d 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -748,7 +748,8 @@ OString XclXmlUtils::ToOString( const ScDocument& rDoc, 
const ScRange& rRange, b
 OString XclXmlUtils::ToOString( const ScDocument& rDoc, const ScRangeList& 
rRangeList )
 {
 OUString s;
-rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ');
+rRangeList.Format(s, ScRefFlags::VALID, rDoc, FormulaGrammar::CONV_XL_OOX, 
' ',
+  /*FullAddressNotation=*/true);
 return s.toUtf8();
 }
 


core.git: Branch 'libreoffice-24-2' - sc/source

2024-04-22 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/excrecds.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit c3bbc3b5c06b743a206a33111c061d4d7d011f21
Author: Justin Luth 
AuthorDate: Thu Apr 18 14:46:30 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Apr 22 08:38:57 2024 +0200

xlsx export: fix corrupt file for Excel: protectedRange must have sqref

Excel refuses to open a file if there is no sqref specified

  


In this case, import failed to import sqref="10:131".
A follow-up commit avoids exporting these shorthand ranges.

I don't see much point in trying to create a unit test for this.
(I assume protectedRange is simply round-tripped
because I doubt LO has working support for protectedRanges.)

commit 9cee6a45632623d3d7e5a574128940f96d8c926b
Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100
added ScEnhancedProtection to ScTableProtection

Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Tested-by: Justin Luth 
(cherry picked from commit 78bd5e2523d077a67468b752d4788a2c3b43fb5f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166220
Tested-by: Jenkins

diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 86afa5a6c163..f18e9f829bbe 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 rWorksheet->startElement(XML_protectedRanges);
 for (const auto& rProt : rProts)
 {
+if (!rProt.maRangeList.is())
+continue; // Excel refuses to open if sqref is missing from a 
protectedRange
+
 SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && 
!rProt.maSecurityDescriptor.empty(),
 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF 
security descriptor");
 rWorksheet->singleElement( XML_protectedRange,
@@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 XML_hashValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, 
!rProt.maPasswordHash.maHashValue.isEmpty()),
 XML_saltValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, 
!rProt.maPasswordHash.maSaltValue.isEmpty()),
 XML_spinCount, 
sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), 
rProt.maPasswordHash.mnSpinCount != 0),
-XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( 
rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
+XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), 
*rProt.maRangeList).getStr());
 }
 rWorksheet->endElement( XML_protectedRanges);
 }


core.git: Branch 'distro/collabora/co-23.05' - sc/source

2024-04-22 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/excrecds.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 6c82e96e849c4a312feaa6cba21093c48a0d9d46
Author: Justin Luth 
AuthorDate: Thu Apr 18 14:46:30 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Apr 22 08:39:10 2024 +0200

xlsx export: fix corrupt file for Excel: protectedRange must have sqref

Excel refuses to open a file if there is no sqref specified

  


In this case, import failed to import sqref="10:131".

I don't see much point in trying to create a unit test for this.
(I assume protectedRange is simply round-tripped
because I doubt LO has working support for protectedRanges.)

commit 9cee6a45632623d3d7e5a574128940f96d8c926b
Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100
added ScEnhancedProtection to ScTableProtection

Change-Id: I97ef1ee801898bdcace067d62890c4ce0e7cf1d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166265
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Tested-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166344
Tested-by: Jenkins CollaboraOffice 

diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 3db3d653073c..0dfba784f97c 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 rWorksheet->startElement(XML_protectedRanges);
 for (const auto& rProt : rProts)
 {
+if (!rProt.maRangeList.is())
+continue; // Excel refuses to open if sqref is missing from a 
protectedRange
+
 SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && 
!rProt.maSecurityDescriptor.empty(),
 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF 
security descriptor");
 rWorksheet->singleElement( XML_protectedRange,
@@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 XML_hashValue, rProt.maPasswordHash.maHashValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maHashValue.toUtf8().getStr(),
 XML_saltValue, rProt.maPasswordHash.maSaltValue.isEmpty() ? 
nullptr : rProt.maPasswordHash.maSaltValue.toUtf8().getStr(),
 XML_spinCount, rProt.maPasswordHash.mnSpinCount ? 
OString::number( rProt.maPasswordHash.mnSpinCount).getStr() : nullptr,
-XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( 
rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
+XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), 
*rProt.maRangeList).getStr());
 }
 rWorksheet->endElement( XML_protectedRanges);
 }


core.git: sw/qa sw/source

2024-04-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |3 ++
 sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx |   21 +++
 2 files changed, 24 insertions(+)

New commits:
commit 00ef339bfc747897b8e4410fa0aa4397c4e45717
Author: Justin Luth 
AuthorDate: Fri Apr 19 21:57:29 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Apr 20 19:07:22 2024 +0200

tdf#81956 vml import: put groupshape in foreground if positive z-index

no interesting unit tests found, but this one at least lets you
add text to the body and visibly see the effect of foreground/background.

make CppunitTest_sw_ooxmlimport CPPUNIT_TEST_NAME=testN751077

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

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e9bc24315d6b..7c2800b7aa72 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -175,6 +175,9 @@ xray ThisComponent.DrawPage(1).getByIndex(0).String
 xray ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
 */
 uno::Reference xShapes(getShape(2), uno::UNO_QUERY);
+// The groupshape should be in the foreground, not the background.
+CPPUNIT_ASSERT(getProperty(xShapes, "Opaque"));
+
 uno::Reference xShape(xShapes->getByIndex(0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("TEXT1
"), xShape->getString());
 // we want to test the textbox is on the first page (it was put onto 
another page without the fix),
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx 
b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 4fdacfb2f944..6e65750dec1e 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -4696,6 +4696,27 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 }
 }
 
+uno::Reference xShapePropertySet(xShape, 
uno::UNO_QUERY);
+uno::Sequence aGrabBag;
+xShapePropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+
+for (const auto& rProp : aGrabBag)
+{
+if (rProp.Name == "VML-Z-ORDER")
+{
+sal_Int64 zOrder(0);
+rProp.Value >>= zOrder;
+
+text::TextContentAnchorType nAnchorType
+= text::TextContentAnchorType_AT_PARAGRAPH;
+
xShapePropertySet->getPropertyValue(getPropertyName(PROP_ANCHOR_TYPE))
+>>= nAnchorType;
+
+const uno::Any aOpaque(nAnchorType == 
text::TextContentAnchorType_AS_CHARACTER
+   || (zOrder >= 0 && 
!IsInHeaderFooter()));
+
xShapePropertySet->setPropertyValue(getPropertyName(PROP_OPAQUE), aOpaque);
+}
+}
 // A GroupShape doesn't implement text::XTextRange, but appending
 // an empty reference to the stacks still makes sense, because this
 // way bToRemove can be set, and we won't end up with duplicated


core.git: sw/qa sw/source

2024-04-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |1 +
 sw/source/core/text/txtfld.cxx |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3b7ffa204c6d04640b5e2f4d4c6b6b4a03fd26c8
Author: Justin Luth 
AuthorDate: Thu Apr 18 04:00:05 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Apr 20 00:18:17 2024 +0200

tdf#140616 ApplyParagraphMarkFormatToNumbering: including highlight

I was concerned that I might override highlights
set in numbering.xml but in that case
pFormat && pFormat->hasItem(RES_CHRATR_HIGHLIGHT)
so pCleanSet no longer hasItem.
(see num3n.docx and TestDoc_highlight2.docx)
Note: must use Word 2010+ to see numbering.xml highlights!!

This is strictly a visual thing. Unit testing has traditionally
used magic tile rendering x,y positions to check the color,
which seems completely untrustworthy.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 6528b093fd57..ba70a335ca09 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -965,6 +965,7 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering)
 
 xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
 assertXPath(pXmlStyles, 
"//w:style[@w:styleId='CustomParaStyleHighlightGreen']/w:rPr/w:highlight"_ostr, 
"val"_ostr, "green");
+// Visually, the last bullet point's text should be green-highlighted (but 
the bullet point itself shouldn't)
 
 if (bWasExportToShade)
 {
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index 84f32e30971f..55e439096f3d 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -409,7 +409,7 @@ static void 
checkApplyParagraphMarkFormatToNumbering(SwFont* pNumFnt, SwTextForm
 
 if (oFontBackColor)
 pNumFnt->SetBackColor(oFontBackColor);
-if (aHighlight != COL_TRANSPARENT)
+if (aHighlight != COL_TRANSPARENT && 
!pCleanedSet->HasItem(RES_CHRATR_HIGHLIGHT))
 pNumFnt->SetHighlightColor(aHighlight);
 }
 


core.git: sc/source

2024-04-19 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/excrecds.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 78bd5e2523d077a67468b752d4788a2c3b43fb5f
Author: Justin Luth 
AuthorDate: Thu Apr 18 14:46:30 2024 -0400
Commit: Miklos Vajna 
CommitDate: Fri Apr 19 14:21:13 2024 +0200

xlsx export: fix corrupt file for Excel: protectedRange must have sqref

Excel refuses to open a file if there is no sqref specified

  


In this case, import failed to import sqref="10:131".
A follow-up commit avoids exporting these shorthand ranges.

I don't see much point in trying to create a unit test for this.
(I assume protectedRange is simply round-tripped
because I doubt LO has working support for protectedRanges.)

commit 9cee6a45632623d3d7e5a574128940f96d8c926b
Author: Eike Rathke on Thu Mar 20 10:16:50 2014 +0100
added ScEnhancedProtection to ScTableProtection

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

diff --git a/sc/source/filter/excel/excrecds.cxx 
b/sc/source/filter/excel/excrecds.cxx
index 86afa5a6c163..f18e9f829bbe 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -478,6 +478,9 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 rWorksheet->startElement(XML_protectedRanges);
 for (const auto& rProt : rProts)
 {
+if (!rProt.maRangeList.is())
+continue; // Excel refuses to open if sqref is missing from a 
protectedRange
+
 SAL_WARN_IF( rProt.maSecurityDescriptorXML.isEmpty() && 
!rProt.maSecurityDescriptor.empty(),
 "sc.filter", "XclExpSheetProtection::SaveXml: losing BIFF 
security descriptor");
 rWorksheet->singleElement( XML_protectedRange,
@@ -492,7 +495,7 @@ void XclExpSheetProtection::SaveXml( XclExpXmlStream& rStrm 
)
 XML_hashValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maHashValue, 
!rProt.maPasswordHash.maHashValue.isEmpty()),
 XML_saltValue, 
sax_fastparser::UseIf(rProt.maPasswordHash.maSaltValue, 
!rProt.maPasswordHash.maSaltValue.isEmpty()),
 XML_spinCount, 
sax_fastparser::UseIf(OString::number(rProt.maPasswordHash.mnSpinCount), 
rProt.maPasswordHash.mnSpinCount != 0),
-XML_sqref, rProt.maRangeList.is() ? XclXmlUtils::ToOString( 
rStrm.GetRoot().GetDoc(), *rProt.maRangeList).getStr() : nullptr);
+XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), 
*rProt.maRangeList).getStr());
 }
 rWorksheet->endElement( XML_protectedRanges);
 }


core.git: sw/qa sw/source

2024-04-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |3 +++
 sw/source/writerfilter/ooxml/model.xml |   11 ++-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 4a120f4f557b99bb8371474a4e7fdaf52b148143
Author: Justin Luth 
AuthorDate: Wed Apr 17 16:11:56 2024 -0400
Commit: Miklos Vajna 
CommitDate: Fri Apr 19 14:20:58 2024 +0200

tdf#140616 writerfilter: recognize style rPr under pPr

Although it is completely NOT normal to put any rPr's
in the style's pPr (since they normally just go
into a stand-alone rPr), MSO is able to read and apply
those - while LO just ignored them (as misplaced properties).

It seems harmless to me to import it this way as well.

make CppunitTest_sw_ooxmlexport14 \
CPPUNIT_TEST_NAME=testHighlightEdit_numbering

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index c33275b62394..6528b093fd57 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -963,6 +963,9 @@ CPPUNIT_TEST_FIXTURE(Test, testHighlightEdit_numbering)
 assertXPath(pXmlDoc, "//w:body/w:p[2]/w:pPr/w:rPr/w:highlight"_ostr, 
"val"_ostr, "none");
 // Visually, the "none" highlight means the bullet point should not have a 
character background.
 
+xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml");
+assertXPath(pXmlStyles, 
"//w:style[@w:styleId='CustomParaStyleHighlightGreen']/w:rPr/w:highlight"_ostr, 
"val"_ostr, "green");
+
 if (bWasExportToShade)
 {
 
officecfg::Office::Common::Filter::Microsoft::Export::CharBackgroundToHighlighting::set(false,
 batch);
diff --git a/sw/source/writerfilter/ooxml/model.xml 
b/sw/source/writerfilter/ooxml/model.xml
index 2f84e72c0615..c99eb836ffe6 100644
--- a/sw/source/writerfilter/ooxml/model.xml
+++ b/sw/source/writerfilter/ooxml/model.xml
@@ -12620,6 +12620,12 @@
   
 
   
+  
+
+
+  
+
+  
   
 
 
@@ -16226,7 +16232,7 @@
   
 
 
-  
+  
 
 
   
@@ -17739,6 +17745,9 @@
   
   
 
+
+  
+
 
   
   


core.git: sc/uiconfig

2024-04-10 Thread Justin Luth (via logerrit)
 sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 7b515b473cfb706c9fa0b474f27d61351aeec3a3
Author: Justin Luth 
AuthorDate: Wed Apr 10 12:45:20 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Apr 10 23:13:13 2024 +0200

tdf#160293 sc NBB: tabbed groupbar_compact keep tabs in Pivot context

The VBox was hidding each child item since none had
Pivot or any as context types.

This didn't affect any other NBB variants
because they hadn't wrapped the tabs in a ContextVBox.

Using context-any would be bad for PrintPreview for example.

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

diff --git a/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui 
b/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui
index e577579264c0..4e35ae8f780a 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_groupedbar_compact.ui
@@ -4904,6 +4904,9 @@
   
   
   
+  
+  
+  
 
   
   


core.git: Branch 'distro/collabora/co-23.05' - sw/source

2024-04-02 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit f53df0c693d8e73e86ddd986e5b861a0af28e62b
Author: Justin Luth 
AuthorDate: Mon Mar 25 16:01:44 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Apr 2 09:08:25 2024 +0200

tdf#131253 sw: draw frame text boundary only if show formatting marks

This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2

It is infuriating to see a border around your image
when there is no border defined. View - Text boundaries
does NOT sound like something that would apply to images,
and it is NOT nice to turn that off because then you also
lose the body text markers as well as the header/footer indicators.

Instead, do the same thing as the page boundaries - only show
the (full) boundary when show formatting marks is turned on
(and there are no partial boundaries for frames...)

These text boundaries around AT-anchored flies
only became visible in LO 6.0.

Change-Id: I7954effc46d977e1761cba71758f7a7af2072807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165428
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 92d8f087ec36..5ca89df04ba8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7331,6 +7331,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 const bool bFlys = pPage->GetSortedObjs() != nullptr;
 
 const bool bCell = IsCellFrame();
+
+if (!bCell && IsFlyFrame())
+{
+// particularly with images (but also plausible for any kind of frame),
+// it is very disconcerting to see a fake border,
+// so (just like the page boundary) only show fly "text boundaries"
+// when "Show Formatting Marks" is turned on
+if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+return;
+
+// if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+// (unless the frame itself contains text)
+const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
+if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+&& (!Lower() || !Lower()->IsTextFrame())
+&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
+|| aSurround == text::WrapTextMode::WrapTextMode_NONE))
+{
+return;
+}
+}
+
 //  #i3662# - use frame area for cells for section use also frame area
 const bool bUseFrameArea = bCell || IsSctFrame();
 SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );


core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-04-02 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit a1214585c7cb849c7d47591ec6bc0d68ea9a7ba8
Author: Justin Luth 
AuthorDate: Mon Mar 25 16:01:44 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Apr 2 09:07:57 2024 +0200

tdf#131253 sw: draw frame text boundary only if show formatting marks

This squashed backport includes c51f9f15b8c308e62b4839cc13d623fdab0486c2

It is infuriating to see a border around your image
when there is no border defined. View - Text boundaries
does NOT sound like something that would apply to images,
and it is NOT nice to turn that off because then you also
lose the body text markers as well as the header/footer indicators.

Instead, do the same thing as the page boundaries - only show
the (full) boundary when show formatting marks is turned on
(and there are no partial boundaries for frames...)

These text boundaries around AT-anchored flies
only became visible in LO 6.0.

Change-Id: I7954effc46d977e1761cba71758f7a7af2072807
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165294
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165463
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 46c9189f0dfd..ff5abcfcf898 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7488,6 +7488,28 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 const bool bFlys = pPage->GetSortedObjs() != nullptr;
 
 const bool bCell = IsCellFrame();
+
+if (!bCell && IsFlyFrame())
+{
+// particularly with images (but also plausible for any kind of frame),
+// it is very disconcerting to see a fake border,
+// so (just like the page boundary) only show fly "text boundaries"
+// when "Show Formatting Marks" is turned on
+if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+return;
+
+// if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+// (unless the frame itself contains text)
+const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
+if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+&& (!Lower() || !Lower()->IsTextFrame())
+&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
+|| aSurround == text::WrapTextMode::WrapTextMode_NONE))
+{
+return;
+}
+}
+
 //  #i3662# - use frame area for cells for section use also frame area
 const bool bUseFrameArea = bCell || IsSctFrame();
 SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );


core.git: Branch 'distro/mimo/mimo-7-3' - 2 commits - sw/qa sw/source

2024-03-28 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary
 sw/qa/extras/uiwriter/uiwriter4.cxx |   38 +++
 sw/source/core/crsr/findtxt.cxx |   86 ++--
 3 files changed, 92 insertions(+), 32 deletions(-)

New commits:
commit 7a7df4c0ea28e460ac6781d54f7da95a19355dde
Author: Justin Luth 
AuthorDate: Tue Mar 19 15:28:32 2024 -0400
Commit: Aron Budea 
CommitDate: Thu Mar 28 22:46:56 2024 +1030

related tdf#147583 sw find: fix backwards search for string at end of para

Prior to this fix, it was finding every single character in the document
when searching for ".$".

Interestingly, the unit test worked even before the patch.
Not sure how that could be possible...

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Mike Kaganski 
Reviewed-by: Miklos Vajna 
(cherry picked from commit e830394c068c229bb840018f2f0e8810da6a1487)
(cherry picked from commit 5a78a44c486a2a49532d32a8ef53b2f2b4833ffe)

diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx 
b/sw/qa/extras/uiwriter/uiwriter4.cxx
index e9e6eb2bd148..7c2a2f930a09 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -4193,6 +4193,11 @@ void SwUiWriterTest4::testTdf147583_backwardSearch()
 xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
 // should actually be 10 (including the empty para with the comment 
marker, and the last para)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+
+xSearchDes->setSearchString(".$"); // any last character (not just 
full-stops) in a paragraph
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// should be one for every non-empty paragraph
+CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount());
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest4);
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1f2d130f7147..06f72ea06306 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -734,6 +734,25 @@ bool DoSearch(SwPaM & rSearchPam,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
 SwRootFrame const*const pLayout, SwPaM* pPam)
 {
+if (bRegSearch && rSearchOpt.searchString.endsWith("$"))
+{
+bool bAlwaysSearchingForEndOfPara = true;
+sal_Int32 nIndex = 0;
+while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1)
+{
+if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$')
+{
+bAlwaysSearchingForEndOfPara = false;
+break;
+}
+++nIndex;
+}
+// when searching for something at the end of the paragraph, the para 
end must be in range
+const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart;
+if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != 
rParaEnd.GetAnyIndex())
+return false;
+}
+
 bool bFound = false;
 OUString sCleanStr;
 std::vector aFltArr;
commit d8ff9e1e259f7b11940f76d1055bce3dd44f0844
Author: Justin Luth 
AuthorDate: Fri Mar 15 20:01:39 2024 -0400
Commit: Aron Budea 
CommitDate: Thu Mar 28 22:33:03 2024 +1030

tdf#147583 sw find: fix backwards search for emptyPara/endOfPara

A comment added 10 years ago thought that it had never worked.

The very last paragraph end cannot be selected manually,
and so of course it can't work in find either.
It didn't work earlier either.

Everything goes ballistic if searching inside comments,
but that would be handled elsewhere anyway I guess.
It didn't work earlier either.

Keeping the search "inside the selection" didn't work earlier either.
That should be fixed now.

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I48a72084d277b8c270255de9296a2743162937cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a)
(cherry picked from commit 098a2536d08a18981032273b55e287bd231dc58e)

diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt
new file mode 100644
index ..9bfde3bfaa6b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ
diff

core.git: sw/source

2024-03-27 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit c51f9f15b8c308e62b4839cc13d623fdab0486c2
Author: Justin Luth 
AuthorDate: Wed Mar 27 09:50:36 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 27 18:49:09 2024 +0100

tdf#131253 sw: draw frame text boundary if fly has textframe

While the text boundary on a wrap-through frame
will not need text boundary markers for the external text,
it does have relevance for the internal text.

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 6903e80b1f46..8479436a88c8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7491,8 +7491,10 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 return;
 
 // if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+// (unless the frame itself contains text)
 const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
 if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+&& (!Lower() || !Lower()->IsTextFrame())
 && (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
 || aSurround == text::WrapTextMode::WrapTextMode_NONE))
 {


core.git: Branch 'libreoffice-7-6' - sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 576398b0493eb642af5221605dcc28ca7656630e
Author: Justin Luth 
AuthorDate: Mon Mar 25 19:20:32 2024 -0400
Commit: Rafael Lima 
CommitDate: Tue Mar 26 19:53:24 2024 +0100

tdf#129905 tdf#160365 sw: don't always draw text boundary on frames

This fixes a 7.6 regression caused by
commit 79811c27f34d3e752de1bc3959605c5d58ac2365
tdf#129905 Create toggle for Section boundaries

This fixes the toggle for View - Text boundaries,
so now images can have their thin gray border removed.

This also fixes the toggle for View - Table boundaries.

Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 47af9e64a573684eb42faa097e327e31777a2b58)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165311
(cherry picked from commit 948a5fb3ffb02e43f228a6adb85a37129a57692b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165315

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index a23d86d1181c..8820fa3a5d19 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7011,7 +7011,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect  
) const
 void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
 const SwRect  ) const
 {
-const bool bSubsOpt = isSubsidiaryLinesEnabled() || 
isSubsidiaryLinesForSectionsEnabled();
+const bool bSubsOpt
+= isSubsidiaryLinesEnabled() || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled());
 if ( bSubsOpt )
 PaintSubsidiaryLines( pPage, rRect );
 


core.git: Branch 'libreoffice-24-2' - sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 09b3dd1cb0c1741cf3560fc9faf2aec696d5c9a2
Author: Justin Luth 
AuthorDate: Mon Mar 25 19:20:32 2024 -0400
Commit: Rafael Lima 
CommitDate: Tue Mar 26 17:08:05 2024 +0100

tdf#129905 tdf#160365 sw: don't always draw text boundary on frames

This fixes a 7.6 regression caused by
commit 79811c27f34d3e752de1bc3959605c5d58ac2365
tdf#129905 Create toggle for Section boundaries

This fixes the toggle for View - Text boundaries,
so now images can have their thin gray border removed.

This also fixes the toggle for View - Table boundaries.

Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Miklos Vajna 
(cherry picked from commit 47af9e64a573684eb42faa097e327e31777a2b58)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165311

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 0f048c4e805d..5472695e9732 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7012,7 +7012,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect  
) const
 void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
 const SwRect  ) const
 {
-const bool bSubsOpt = isSubsidiaryLinesEnabled() || 
isSubsidiaryLinesForSectionsEnabled();
+const bool bSubsOpt
+= isSubsidiaryLinesEnabled() || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled());
 if ( bSubsOpt )
 PaintSubsidiaryLines( pPage, rRect );
 


core.git: sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 47af9e64a573684eb42faa097e327e31777a2b58
Author: Justin Luth 
AuthorDate: Mon Mar 25 19:20:32 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Mar 26 13:32:49 2024 +0100

tdf#129905 tdf#160365 sw: don't always draw text boundary on frames

This fixes a 7.6 regression caused by
commit 79811c27f34d3e752de1bc3959605c5d58ac2365
tdf#129905 Create toggle for Section boundaries

This fixes the toggle for View - Text boundaries,
so now images can have their thin gray border removed.

This also fixes the toggle for View - Table boundaries.

Change-Id: Idb75debf173d64b14a6864c61b4524e46898975f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165297
Reviewed-by: Justin Luth 
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 9a0776631f01..6903e80b1f46 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7004,7 +7004,8 @@ void SwPageFrame::RefreshSubsidiary( const SwRect  
) const
 void SwLayoutFrame::RefreshLaySubsidiary( const SwPageFrame *pPage,
 const SwRect  ) const
 {
-const bool bSubsOpt = isSubsidiaryLinesEnabled() || 
isSubsidiaryLinesForSectionsEnabled();
+const bool bSubsOpt
+= isSubsidiaryLinesEnabled() || (IsSctFrame() && 
isSubsidiaryLinesForSectionsEnabled());
 if ( bSubsOpt )
 PaintSubsidiaryLines( pPage, rRect );
 


core.git: sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 5bf7df62645f73ad69772f318ea3058dfd6fce12
Author: Justin Luth 
AuthorDate: Mon Mar 25 16:01:44 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Mar 26 13:29:13 2024 +0100

tdf#131253 sw: draw frame text boundary on when show formatting marks

It is infuriating to see a border around your image
when there is no border defined. View - Text boundaries
does NOT sound like something that would apply to images,
and it is NOT nice to turn that off because then you also
lose the body text markers as well as the header/footer indicators.

Instead, do the same thing as the page boundaries - only show
the (full) boundary when show formatting marks is turned on
(and there are no partial boundaries for frames...)

I tried to write a GDIMetaFile unit test,
but the dumps were identical - failing to capture this screen artifact.

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

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index 042c4f3be4a7..9a0776631f01 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -7479,6 +7479,26 @@ void SwLayoutFrame::PaintSubsidiaryLines( const 
SwPageFrame *pPage,
 const bool bFlys = pPage->GetSortedObjs() != nullptr;
 
 const bool bCell = IsCellFrame();
+
+if (!bCell && IsFlyFrame())
+{
+// particularly with images (but also plausible for any kind of frame),
+// it is very disconcerting to see a fake border,
+// so (just like the page boundary) only show fly "text boundaries"
+// when "Show Formatting Marks" is turned on
+if (!gProp.pSGlobalShell->GetViewOptions()->IsViewMetaChars())
+return;
+
+// if the frame is wrap none or wrap through, then text boundary lines 
have no meaning
+const text::WrapTextMode aSurround = 
GetFormat()->GetSurround().GetSurround();
+if (GetFormat()->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR
+&& (aSurround == text::WrapTextMode::WrapTextMode_THROUGH
+|| aSurround == text::WrapTextMode::WrapTextMode_NONE))
+{
+return;
+}
+}
+
 //  #i3662# - use frame area for cells for section use also frame area
 const bool bUseFrameArea = bCell || IsSctFrame();
 SwRect aOriginal( bUseFrameArea ? getFrameArea() : getFramePrintArea() );


core.git: Branch 'distro/mimo/mimo-7-5' - 2 commits - sw/qa sw/source

2024-03-26 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary
 sw/qa/extras/uiwriter/uiwriter7.cxx |   36 ++
 sw/source/core/crsr/findtxt.cxx |   86 ++--
 3 files changed, 90 insertions(+), 32 deletions(-)

New commits:
commit 5a78a44c486a2a49532d32a8ef53b2f2b4833ffe
Author: Justin Luth 
AuthorDate: Tue Mar 19 15:28:32 2024 -0400
Commit: Aron Budea 
CommitDate: Tue Mar 26 17:36:03 2024 +1030

related tdf#147583 sw find: fix backwards search for string at end of para

Prior to this fix, it was finding every single character in the document
when searching for ".$".

Interestingly, the unit test worked even before the patch.
Not sure how that could be possible...

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Mike Kaganski 
Reviewed-by: Miklos Vajna 
(cherry picked from commit e830394c068c229bb840018f2f0e8810da6a1487)

diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index dbae48e33798..127c78a1d583 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -386,6 +386,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, 
testTdf147583_backwardSearch)
 xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
 // should actually be 10 (including the empty para with the comment 
marker, and the last para)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+
+xSearchDes->setSearchString(".$"); // any last character (not just 
full-stops) in a paragraph
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// should be one for every non-empty paragraph
+CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index e87e4d6ff5c1..6b6cec3268d2 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -729,6 +729,25 @@ bool DoSearch(SwPaM & rSearchPam,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
 SwRootFrame const*const pLayout, SwPaM* pPam)
 {
+if (bRegSearch && rSearchOpt.searchString.endsWith("$"))
+{
+bool bAlwaysSearchingForEndOfPara = true;
+sal_Int32 nIndex = 0;
+while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1)
+{
+if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$')
+{
+bAlwaysSearchingForEndOfPara = false;
+break;
+}
+++nIndex;
+}
+// when searching for something at the end of the paragraph, the para 
end must be in range
+const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart;
+if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != 
rParaEnd.GetAnyIndex())
+return false;
+}
+
 bool bFound = false;
 OUString sCleanStr;
 std::vector aFltArr;
commit 098a2536d08a18981032273b55e287bd231dc58e
Author: Justin Luth 
AuthorDate: Fri Mar 15 20:01:39 2024 -0400
Commit: Aron Budea 
CommitDate: Tue Mar 26 17:15:32 2024 +1030

tdf#147583 sw find: fix backwards search for emptyPara/endOfPara

A comment added 10 years ago thought that it had never worked.

The very last paragraph end cannot be selected manually,
and so of course it can't work in find either.
It didn't work earlier either.

Everything goes ballistic if searching inside comments,
but that would be handled elsewhere anyway I guess.
It didn't work earlier either.

Keeping the search "inside the selection" didn't work earlier either.
That should be fixed now.

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I48a72084d277b8c270255de9296a2743162937cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982
Tested-by: Jenkins CollaboraOffice 
(cherry picked from commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a)

diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt
new file mode 100644
index ..9bfde3bfaa6b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 92b6732f2778..dbae48e33798 100644
--- 

core.git: sw/qa sw/source

2024-03-21 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter7.cxx |5 +
 sw/source/core/crsr/findtxt.cxx |   19 +++
 2 files changed, 24 insertions(+)

New commits:
commit e830394c068c229bb840018f2f0e8810da6a1487
Author: Justin Luth 
AuthorDate: Tue Mar 19 15:28:32 2024 -0400
Commit: Miklos Vajna 
CommitDate: Thu Mar 21 10:59:23 2024 +0100

related tdf#147583 sw find: fix backwards search for string at end of para

Prior to this fix, it was finding every single character in the document
when searching for ".$".

Interestingly, the unit test worked even before the patch.
Not sure how that could be possible...

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I20779898c01736eb39ecd7db7d66c2c24e4358b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165037
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Mike Kaganski 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index bf9a4ee1bd1c..dda894b7fda5 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -386,6 +386,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, 
testTdf147583_backwardSearch)
 xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
 // should actually be 10 (including the empty para with the comment 
marker, and the last para)
 CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+
+xSearchDes->setSearchString(".$"); // any last character (not just 
full-stops) in a paragraph
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// should be one for every non-empty paragraph
+CPPUNIT_ASSERT_EQUAL(sal_Int32(14), xIndex->getCount());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 930ac7926ce2..34d16d2a91b9 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -726,6 +726,25 @@ bool DoSearch(SwPaM & rSearchPam,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
 SwRootFrame const*const pLayout, SwPaM& rPam)
 {
+if (bRegSearch && rSearchOpt.searchString.endsWith("$"))
+{
+bool bAlwaysSearchingForEndOfPara = true;
+sal_Int32 nIndex = 0;
+while ((nIndex = rSearchOpt.searchString.indexOf("|", nIndex)) != -1)
+{
+if (!nIndex || rSearchOpt.searchString[nIndex - 1] != '$')
+{
+bAlwaysSearchingForEndOfPara = false;
+break;
+}
+++nIndex;
+}
+// when searching for something at the end of the paragraph, the para 
end must be in range
+const AmbiguousIndex& rParaEnd = bSrchForward ? nEnd : nStart;
+if (bAlwaysSearchingForEndOfPara && nTextLen.GetAnyIndex() != 
rParaEnd.GetAnyIndex())
+return false;
+}
+
 bool bFound = false;
 OUString sCleanStr;
 std::vector aFltArr;


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-03-21 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx |binary
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   43 
++
 sw/source/core/doc/docnum.cxx |   11 +-
 sw/source/uibase/shells/txtnum.cxx|1 
 sw/source/uibase/wrtsh/wrtsh1.cxx |   31 
---
 5 files changed, 52 insertions(+), 34 deletions(-)

New commits:
commit 5956bb9937164a815bccadd4801dee63c28367f5
Author: Justin Luth 
AuthorDate: Mon Mar 18 16:56:55 2024 -0400
Commit: Miklos Vajna 
CommitDate: Thu Mar 21 10:54:23 2024 +0100

tdf#159054 sw: fix .uno:DefaultNumber toggle on Heading numbering

This fixes a 7.2 regression from
commit c456f839a597f537f1c59becd7d0bb6c86248ef8
Author: Anshu on Wed Jan 6 15:04:16 2021 +0530
tdf#115965 tdf#92622 NoList default in menu,tool,sidebar

The current implementation would set the number format
to SVX_NUM_NUMBER_NONE, but it still looks like a number to the toolbar,
so toggling didn't work since 7.4's bcede3c0ed94d4
It also never cleared out the prefix/suffix when toggled off,
and it affected ALL paragraphs using that outline numbering style.

Remove numbering was doing the same kind of thing.

I think the toggle was trying to follow the drop-down behaviour
of modifying the outline numbering style itself.
While I think the drop-down handling could be considered appropriate,
using the toggle to pseudo-disable the entire style just seems wrong.

This patch kills that, and in addition
automatically gains all the nice undo/redo functionality.

This is one tiny step in making outline numbering go away.

make CppunitTest_sw_uiwriter9 \
CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering

Change-Id: Id6a24ac25479cb8f35bf1c2c58344390ed7512fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164985
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165076
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx 
b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx
new file mode 100644
index ..091a3830e75b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 3772955dd9c1..96ea65e988d9 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -200,6 +200,49 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159816)
 xTransfer->PrivateDrop(*pWrtShell, ptTo, /*bMove=*/true, 
/*bXSelection=*/true);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering)
+{
+createSwDoc("tdf159054_disableOutlineNumbering.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+const uno::Reference xPara1 = getParagraph(1, "Heading 
A");
+const uno::Reference xPara2 = getParagraph(2, "Heading 
B");
+const uno::Reference xPara3 = getParagraph(3, "Heading 
C");
+
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, 
"ListLabelString"));
+
+// select (at least parts) of the first two paragraphs
+pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1, /*bBasicCall=*/true);
+
+// on the selection, simulate pressing the toolbar button to toggle OFF 
numbering
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// the selected paragraphs should definitely have the list label removed
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, 
"ListLabelString"));
+// the third paragraph must retain the existing numbering format
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, 
"ListLabelString"));
+
+// on the selection, simulate pressing the toolbar button to toggle ON 
numbering again
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// the outline numbering format must be re-applied to the first two 
paragraphs
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, 
"ListLab

core.git: sw/qa sw/source

2024-03-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter9.cxx |   26 --
 sw/source/core/doc/docnum.cxx   |   11 ---
 sw/source/uibase/shells/txtnum.cxx  |1 -
 sw/source/uibase/wrtsh/wrtsh1.cxx   |   31 +--
 4 files changed, 25 insertions(+), 44 deletions(-)

New commits:
commit 91e5d1ef52964dc43875ed62acd766524fa7cc5c
Author: Justin Luth 
AuthorDate: Tue Mar 19 09:22:34 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed Mar 20 16:20:14 2024 +0100

tdf#159054 sw: fix .uno:DefaultNumber toggle on Heading numbering

This fixes a 7.2 regression from
commit c456f839a597f537f1c59becd7d0bb6c86248ef8
Author: Anshu on Wed Jan 6 15:04:16 2021 +0530
tdf#115965 tdf#92622 NoList default in menu,tool,sidebar

The current implementation would set the number format
to SVX_NUM_NUMBER_NONE, but it still looks like a number to the toolbar,
so toggling didn't work since 7.4's bcede3c0ed94d4
It also never cleared out the prefix/suffix when toggled off,
and it affected ALL paragraphs using that outline numbering style.

Remove numbering was doing the same kind of thing.

I think the toggle was trying to follow the drop-down behaviour
of modifying the outline numbering style itself.
While I think the drop-down handling could be considered appropriate,
using the toggle to pseudo-disable the entire style just seems wrong.

This patch kills that, and in addition
automatically gains all the nice undo/redo functionality.

This is one tiny step in making outline numbering go away.

make CppunitTest_sw_uiwriter9 \
CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering

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

diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index a18f14c9ad9a..f46d43e537b6 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -429,20 +429,26 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, 
testTdf159054_disableOutlineNumbering)
 dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
 
 // the selected paragraphs should definitely have the list label removed
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, 
"ListLabelString"));
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, 
"ListLabelString"));
-// current implementation: the numbering style itself is changed too - 
affects all Heading 1's.
-// A valid alternative implementation would be to simply 
SetCountInList(false) for 1st para,
-// and leave the Outline style format alone.
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, 
"ListLabelString"));
+// the third paragraph must retain the existing numbering format
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, 
"ListLabelString"));
 
 // on the selection, simulate pressing the toolbar button to toggle ON 
numbering again
 dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
 
-// current implementation: the entire format was removed, so turn 
(default) numbering on
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, 
"ListLabelString"));
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, 
"ListLabelString"));
-CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, 
"ListLabelString"));
+// the outline numbering format must be re-applied to the first two 
paragraphs
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, 
"ListLabelString"));
+
+// on the selection, simulate a right click - list - No list
+dispatchCommand(mxComponent, ".uno:RemoveBullets", {});
+
+// the selected paragraphs should definitely have the list label removed
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara3, 
"ListLabelString"));
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_dde_disable)
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/c

core.git: sw/qa

2024-03-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx |binary
 sw/qa/extras/uiwriter/uiwriter9.cxx   |   37 
++
 2 files changed, 37 insertions(+)

New commits:
commit f78c0dfa7a63303533eed17636e7abf8332eea48
Author: Justin Luth 
AuthorDate: Mon Mar 18 16:56:55 2024 -0400
Commit: Miklos Vajna 
CommitDate: Wed Mar 20 16:19:14 2024 +0100

tdf#159054 unit test: noting the current state before making changes

The historical implementation is rather bizarre,
so I submit it beforehand so that my patch
shows the changes in behaviour in a clearer way.

I checked LO 5.1, and while things were slightly different
(still inexplicable, but not in the same way)
it still did leave behind the suffix,
and toggled back on as 1.

So this has never been good.
Throwing out the old behaviour seems appropriate in this case.

make CppunitTest_sw_uiwriter9 \
CPPUNIT_TEST_NAME=testTdf159054_disableOutlineNumbering

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

diff --git a/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx 
b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx
new file mode 100644
index ..091a3830e75b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf159054_disableOutlineNumbering.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx 
b/sw/qa/extras/uiwriter/uiwriter9.cxx
index 77245e63ce2f..a18f14c9ad9a 100644
--- a/sw/qa/extras/uiwriter/uiwriter9.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter9.cxx
@@ -408,6 +408,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf151710)
 CPPUNIT_ASSERT_EQUAL(sStartDoubleQuote, pTextDoc->getText()->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf159054_disableOutlineNumbering)
+{
+createSwDoc("tdf159054_disableOutlineNumbering.docx");
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+const uno::Reference xPara1 = getParagraph(1, "Heading 
A");
+const uno::Reference xPara2 = getParagraph(2, "Heading 
B");
+const uno::Reference xPara3 = getParagraph(3, "Heading 
C");
+
+CPPUNIT_ASSERT_EQUAL(OUString("A."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("B."), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("C."), getProperty(xPara3, 
"ListLabelString"));
+
+// select (at least parts) of the first two paragraphs
+pWrtShell->Down(/*bSelect=*/true, /*nCount=*/1, /*bBasicCall=*/true);
+
+// on the selection, simulate pressing the toolbar button to toggle OFF 
numbering
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// the selected paragraphs should definitely have the list label removed
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, 
"ListLabelString"));
+// current implementation: the numbering style itself is changed too - 
affects all Heading 1's.
+// A valid alternative implementation would be to simply 
SetCountInList(false) for 1st para,
+// and leave the Outline style format alone.
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, 
"ListLabelString"));
+
+// on the selection, simulate pressing the toolbar button to toggle ON 
numbering again
+dispatchCommand(mxComponent, ".uno:DefaultNumbering", {});
+
+// current implementation: the entire format was removed, so turn 
(default) numbering on
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara1, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara2, 
"ListLabelString"));
+CPPUNIT_ASSERT_EQUAL(OUString("."), getProperty(xPara3, 
"ListLabelString"));
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf158375_dde_disable)
 {
 std::shared_ptr pBatch(


core.git: sw/source

2024-03-20 Thread Justin Luth (via logerrit)
 sw/source/ui/misc/outline.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit f056f4d45080febc6c912bd623b5df8fa06f87a1
Author: Justin Luth 
AuthorDate: Tue Mar 19 13:20:36 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 20 15:40:09 2024 +0100

related tdf#150197: ensure HasListFormat

Steps to reproduce
1.) tools - Heading numbering - set "Number" to non-NONE (e.g. 1, 2, 3)
2.) set a paragraph to "Heading 1" style (to ensure we export style)
3.) export to assert.docx

hits commit 727c5ed30f68abc28bb04531b25a1df30810760f
assert(false && "deprecated format still exists and is unhandled.
 Inform Vasily or Justin");

Not reproduced with "Bullets and numbering"

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

diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 6500bfdd6eca..c216289a0b10 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -623,6 +623,8 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, NumberSelect, 
weld::ComboBox&, void)
 {
 SwNumFormat aNumFormat(m_pNumRule->Get(i));
 aNumFormat.SetNumberingType(nNumberType);
+// ensure that HasListFormat
+aNumFormat.SetListFormat(aNumFormat.GetPrefix(), 
aNumFormat.GetSuffix(), i);
 m_pNumRule->Set(i, aNumFormat);
 CheckForStartValue_Impl(nNumberType);
 }


core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-03-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary
 sw/qa/extras/uiwriter/uiwriter7.cxx |   31 +++
 sw/source/core/crsr/findtxt.cxx |   67 
 3 files changed, 66 insertions(+), 32 deletions(-)

New commits:
commit 2f5b9916baaf0017ece84bf867a9e9acfe86d61a
Author: Justin Luth 
AuthorDate: Fri Mar 15 20:01:39 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Mar 19 08:57:27 2024 +0100

tdf#147583 sw find: fix backwards search for emptyPara/endOfPara

A comment added 10 years ago thought that it had never worked.

The very last paragraph end cannot be selected manually,
and so of course it can't work in find either.
It didn't work earlier either.

Everything goes ballistic if searching inside comments,
but that would be handled elsewhere anyway I guess.
It didn't work earlier either.

Keeping the search "inside the selection" didn't work earlier either.
That should be fixed now.

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

Change-Id: I48a72084d277b8c270255de9296a2743162937cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164892
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164982
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt
new file mode 100644
index ..9bfde3bfaa6b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 16afe5f205c0..844e9ff06c42 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -358,6 +358,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch)
  pCursor->GetPointNode().GetTextNode()->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch)
+{
+createSwDoc("tdf147583_backwardSearch.odt");
+uno::Reference xSearch(mxComponent, uno::UNO_QUERY);
+uno::Reference xSearchDes = 
xSearch->createSearchDescriptor();
+uno::Reference xProp(xSearchDes, uno::UNO_QUERY);
+
+uno::Reference xIndex;
+const sal_Int32 nParas = getParagraphs();
+
+//specifying the search attributes
+uno::Reference xPropSet(xSearchDes, 
uno::UNO_QUERY_THROW);
+xSearchDes->setPropertyValue("SearchRegularExpression", uno::Any(true)); 
// regex
+xSearchDes->setSearchString("$"); // the end of the paragraph pilcrow 
marker
+
+// xSearchDes->setPropertyValue("SearchBackwards", uno::Any(false));
+// xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// // all paragraphs (including the unselected last one) should be found
+// CPPUNIT_ASSERT_EQUAL(nParas, xIndex->getCount());
+
+xSearchDes->setPropertyValue("SearchBackwards", uno::Any(true));
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// all paragraphs (except the troublesome last one) are found
+CPPUNIT_ASSERT_EQUAL(nParas - 1, xIndex->getCount());
+
+xSearchDes->setSearchString("^$"); // empty paragraphs
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// should actually be 10 (including the empty para with the comment 
marker, and the last para)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
 {
 createSwDoc();
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 9d05c3290e50..ca3b19fb0be9 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -730,7 +730,6 @@ bool DoSearch(SwPaM & rSearchPam,
 SwRootFrame const*const pLayout, SwPaM& rPam)
 {
 bool bFound = false;
-SwPosition& rPtPos = *rPam.GetPoint();
 OUString sCleanStr;
 std::vector aFltArr;
 LanguageType eLastLang = LANGUAGE_SYSTEM;
@@ -872,39 +871,43 @@ bool DoSearch(SwPaM & rSearchPam,
 
 if ( bFound )
 return true;
-else if ((bChkEmptyPara && !nStart.GetAnyIndex() && 
!nTextLen.GetAnyIndex())
- || bChkParaEnd)
+
+if (!bChkEmptyPara && !bChkParaEnd)
+return false;
+
+if (bChkEmptyPara && bSrchForward && nTextLen.GetAnyIndex())
+return false; // the length is not zero - there is content here
+
+// move to the end (or start) of the paragraph
+*rSearchPam.GetPoint() = *rPam.GetPoint();
+if (pLayout)
 {
-*rSearchPam.GetPoint() = *rPam.GetPoint();
-if (pLayout)
-{
-*rSearchPam.GetPoint() = pFrame->MapViewT

core.git: Branch 'distro/collabora/co-24.04' - sw/source

2024-03-19 Thread Justin Luth (via logerrit)
 sw/source/core/crsr/findtxt.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 60b39486660f238fd4385a9cab48a396ed15a155
Author: Justin Luth 
AuthorDate: Fri Mar 15 12:40:42 2024 -0400
Commit: Miklos Vajna 
CommitDate: Tue Mar 19 08:56:56 2024 +0100

DoSearch's pPam was not optional - made it an SwPam& rPam

oPam also is not a real optional - it is always populated
by MakeRegion, and known to be non-null since it was used
in the containing while loop clause earlier

Change-Id: I33133c8f9f9188e57fe100f3c455dc92453d05f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164868
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Noel Grandin 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164981
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 5f63f8f13694..9d05c3290e50 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -361,7 +361,7 @@ static bool DoSearch(SwPaM & rSearchPam,
 bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex nTextLen,
 SwTextNode const* pNode, SwTextFrame const* pTextFrame,
-SwRootFrame const* pLayout, SwPaM* pPam);
+SwRootFrame const* pLayout, SwPaM& rPam);
 
 namespace sw {
 
@@ -677,7 +677,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStartInside, nEndInside, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 if ( bFound )
 break;
 else
@@ -710,7 +710,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStart, nEnd, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 }
 if (bFound)
 break;
@@ -727,10 +727,10 @@ bool DoSearch(SwPaM & rSearchPam,
   bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex const 
nTextLen,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
-SwRootFrame const*const pLayout, SwPaM* pPam)
+SwRootFrame const*const pLayout, SwPaM& rPam)
 {
 bool bFound = false;
-SwPosition& rPtPos = *pPam->GetPoint();
+SwPosition& rPtPos = *rPam.GetPoint();
 OUString sCleanStr;
 std::vector aFltArr;
 LanguageType eLastLang = LANGUAGE_SYSTEM;
@@ -818,7 +818,7 @@ bool DoSearch(SwPaM & rSearchPam,
 nStart = nProxyStart;
 nEnd = nProxyEnd;
 // set section correctly
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 rSearchPam.SetMark();
 
 // adjust start and end
@@ -875,7 +875,7 @@ bool DoSearch(SwPaM & rSearchPam,
 else if ((bChkEmptyPara && !nStart.GetAnyIndex() && 
!nTextLen.GetAnyIndex())
  || bChkParaEnd)
 {
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 if (pLayout)
 {
 *rSearchPam.GetPoint() = pFrame->MapViewToModelPos(


core.git: sw/qa sw/source

2024-03-18 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt |binary
 sw/qa/extras/uiwriter/uiwriter7.cxx |   31 +++
 sw/source/core/crsr/findtxt.cxx |   67 
 3 files changed, 66 insertions(+), 32 deletions(-)

New commits:
commit 8b58007fc5a619012b58a1f8d8731a753bc1c40d
Author: Justin Luth 
AuthorDate: Fri Mar 15 20:01:39 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Mar 18 14:25:39 2024 +0100

tdf#147583 sw find: fix backwards search for emptyPara/endOfPara

A comment added 10 years ago thought that it had never worked.

The very last paragraph end cannot be selected manually,
and so of course it can't work in find either.
It didn't work earlier either.

Everything goes ballistic if searching inside comments,
but that would be handled elsewhere anyway I guess.
It didn't work earlier either.

Keeping the search "inside the selection" didn't work earlier either.
That should be fixed now.

make CppunitTest_sw_uiwriter7 \
CPPUNIT_TEST_NAME=testTdf147583_backwardSearch

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

diff --git a/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt
new file mode 100644
index ..9bfde3bfaa6b
Binary files /dev/null and 
b/sw/qa/extras/uiwriter/data/tdf147583_backwardSearch.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index fe873d8cfb3b..898ed6dcd1b5 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -358,6 +358,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTextSearch)
  pCursor->GetPointNode().GetTextNode()->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf147583_backwardSearch)
+{
+createSwDoc("tdf147583_backwardSearch.odt");
+uno::Reference xSearch(mxComponent, uno::UNO_QUERY);
+uno::Reference xSearchDes = 
xSearch->createSearchDescriptor();
+uno::Reference xProp(xSearchDes, uno::UNO_QUERY);
+
+uno::Reference xIndex;
+const sal_Int32 nParas = getParagraphs();
+
+//specifying the search attributes
+uno::Reference xPropSet(xSearchDes, 
uno::UNO_QUERY_THROW);
+xSearchDes->setPropertyValue("SearchRegularExpression", uno::Any(true)); 
// regex
+xSearchDes->setSearchString("$"); // the end of the paragraph pilcrow 
marker
+
+// xSearchDes->setPropertyValue("SearchBackwards", uno::Any(false));
+// xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// // all paragraphs (including the unselected last one) should be found
+// CPPUNIT_ASSERT_EQUAL(nParas, xIndex->getCount());
+
+xSearchDes->setPropertyValue("SearchBackwards", uno::Any(true));
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// all paragraphs (except the troublesome last one) are found
+CPPUNIT_ASSERT_EQUAL(nParas - 1, xIndex->getCount());
+
+xSearchDes->setSearchString("^$"); // empty paragraphs
+xIndex.set(xSearch->findAll(xSearchDes), uno::UNO_SET_THROW);
+// should actually be 10 (including the empty para with the comment 
marker, and the last para)
+CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xIndex->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf69282)
 {
 createSwDoc();
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1edde20d7ccc..930ac7926ce2 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -727,7 +727,6 @@ bool DoSearch(SwPaM & rSearchPam,
 SwRootFrame const*const pLayout, SwPaM& rPam)
 {
 bool bFound = false;
-SwPosition& rPtPos = *rPam.GetPoint();
 OUString sCleanStr;
 std::vector aFltArr;
 LanguageType eLastLang = LANGUAGE_SYSTEM;
@@ -869,39 +868,43 @@ bool DoSearch(SwPaM & rSearchPam,
 
 if ( bFound )
 return true;
-else if ((bChkEmptyPara && !nStart.GetAnyIndex() && 
!nTextLen.GetAnyIndex())
- || bChkParaEnd)
+
+if (!bChkEmptyPara && !bChkParaEnd)
+return false;
+
+if (bChkEmptyPara && bSrchForward && nTextLen.GetAnyIndex())
+return false; // the length is not zero - there is content here
+
+// move to the end (or start) of the paragraph
+*rSearchPam.GetPoint() = *rPam.GetPoint();
+if (pLayout)
 {
-*rSearchPam.GetPoint() = *rPam.GetPoint();
-if (pLayout)
-{
-*rSearchPam.GetPoint() = pFrame->MapViewToModelPos(
-bChkParaEnd ? nTextLen.GetFrameIndex() : TextFrameIndex(0));
-}
-

core.git: sfx2/source

2024-03-18 Thread Justin Luth (via logerrit)
 sfx2/source/doc/docfile.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5441ed518d36ac12a6bd0c517e2cfc24aff94d50
Author: Justin Luth 
AuthorDate: Thu Mar 14 11:29:08 2024 -0400
Commit: Miklos Vajna 
CommitDate: Mon Mar 18 14:20:38 2024 +0100

tdf#40244 tdf#160192: create tempFile elsewhere if LogicBase is RO

This avoids a crash/infinite loop in specific read-only folder
situation (where the lock file already exists).

It also fixes ODF files giving three misleading/unclear
notices when attempting to save into a read-only folder.

When LO saves a file, it saves to a temporary file
and then moves that file overtop of the previous one, IIUC.

Prior to 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b
that temporary file was stored in the /tmp directory (IIUC),
but was changed to be in the same folder for easier renaming,
same filesystem etc.

Note that typically this situation would fail
since a locking file also could not be created.
However in the case where the lock file already exists,
then all the pieces are in place to actually modify the document.

By falling back to the /tmp folder if the document's folder
is read-only, we can still modify a writeable document.

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

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index c90fb794f690..b58d27c95fa4 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -4038,6 +4038,8 @@ void SfxMedium::CreateTempFile( bool bReplace )
 
 OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl);
 pImpl->pTempFile.reset(new ::utl::TempFileNamed());
+if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty())
+pImpl->pTempFile.reset(new ::utl::TempFileNamed());
 pImpl->pTempFile->EnableKillingFile();
 pImpl->m_aName = pImpl->pTempFile->GetFileName();
 OUString aTmpURL = pImpl->pTempFile->GetURL();
@@ -4134,6 +4136,8 @@ void SfxMedium::CreateTempFileNoCopy()
 
 OUString aLogicBase = GetLogicBase(GetURLObject(), pImpl);
 pImpl->pTempFile.reset(new ::utl::TempFileNamed());
+if (!aLogicBase.isEmpty() && pImpl->pTempFile->GetFileName().isEmpty())
+pImpl->pTempFile.reset(new ::utl::TempFileNamed());
 pImpl->pTempFile->EnableKillingFile();
 pImpl->m_aName = pImpl->pTempFile->GetFileName();
 if ( pImpl->m_aName.isEmpty() )


core.git: sw/source

2024-03-15 Thread Justin Luth (via logerrit)
 sw/source/core/crsr/findtxt.cxx |  463 +++-
 1 file changed, 230 insertions(+), 233 deletions(-)

New commits:
commit 0b7494dfd361f7f2f7d8257b0a8a233a11f00679
Author: Justin Luth 
AuthorDate: Fri Mar 15 12:49:00 2024 -0400
Commit: Justin Luth 
CommitDate: Sat Mar 16 02:59:53 2024 +0100

NFC flatten sw FindTextImpl

and /opt/lo/clang-format the changed lines

There hasn't been much change in this function
in the last two years, so now is a good time to flatten it.
It will be easy to backport this commit
if any fixes to this area of code warrant backporting.

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

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 9d05c3290e50..1edde20d7ccc 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -403,318 +403,315 @@ bool FindTextImpl(SwPaM & rSearchPam,
 // LanguageType eLastLang = 0;
 while (nullptr != (pNode = ::GetNode(*oPam, bFirst, fnMove, bInReadOnly, 
pLayout)))
 {
-if( pNode->IsTextNode() )
+if (!pNode->IsTextNode())
+continue;
+
+const SwTextNode& rTextNode = *pNode->GetTextNode();
+SwTextFrame const* const pFrame(
+pLayout ? static_cast(rTextNode.getLayoutFrame(pLayout)) : nullptr);
+assert(!pLayout || pFrame);
+AmbiguousIndex nTextLen;
+if (pLayout)
+{
+
nTextLen.SetFrameIndex(TextFrameIndex(pFrame->GetText().getLength()));
+}
+else
+{
+nTextLen.SetModelIndex(rTextNode.GetText().getLength());
+}
+AmbiguousIndex nEnd;
+if (pLayout ? FrameContainsNode(*pFrame, 
oPam->GetMark()->GetNodeIndex())
+: rPtPos.GetNode() == oPam->GetMark()->GetNode())
 {
-SwTextNode& rTextNode = *pNode->GetTextNode();
-SwTextFrame const*const pFrame(pLayout
-? static_cast(rTextNode.getLayoutFrame(pLayout))
-: nullptr);
-assert(!pLayout || pFrame);
-AmbiguousIndex nTextLen;
 if (pLayout)
 {
-
nTextLen.SetFrameIndex(TextFrameIndex(pFrame->GetText().getLength()));
+
nEnd.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetMark()));
 }
 else
 {
-nTextLen.SetModelIndex(rTextNode.GetText().getLength());
+nEnd.SetModelIndex(oPam->GetMark()->GetContentIndex());
 }
-AmbiguousIndex nEnd;
-if (pLayout
-? FrameContainsNode(*pFrame, 
oPam->GetMark()->GetNodeIndex())
-: rPtPos.GetNode() == oPam->GetMark()->GetNode())
+}
+else
+{
+if (bSrchForward)
+{
+nEnd = nTextLen;
+}
+else
 {
 if (pLayout)
 {
-
nEnd.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetMark()));
+nEnd.SetFrameIndex(TextFrameIndex(0));
 }
 else
 {
-nEnd.SetModelIndex(oPam->GetMark()->GetContentIndex());
+nEnd.SetModelIndex(0);
 }
 }
-else
+}
+AmbiguousIndex nStart;
+if (pLayout)
+{
+nStart.SetFrameIndex(pFrame->MapModelToViewPos(*oPam->GetPoint()));
+}
+else
+{
+nStart.SetModelIndex(rPtPos.GetContentIndex());
+}
+
+/* #i80135# */
+// if there are SwPostItFields inside our current node text, we
+// split the text into separate pieces and search for text inside
+// the pieces as well as inside the fields
+MaybeMergedIter iter(pLayout ? pFrame : nullptr, pLayout ? nullptr : 
);
+
+// count PostItFields by looping over all fields
+std::vector> postits;
+if (bSearchInNotes)
+{
+if (!bSrchForward)
 {
-if (bSrchForward)
-{
-nEnd = nTextLen;
-}
-else
+std::swap(nStart, nEnd);
+}
+
+SwTextNode const* pTemp(nullptr);
+while (SwTextAttr const* const pTextAttr = iter.NextAttr(pTemp))
+{
+if (pTextAttr->Which() == RES_TXTATR_ANNOTATION)
 {
+AmbiguousIndex aPos;
+aPos.SetModelIndex(pTextAttr->GetStart());
 if (pLayout)
 {
-nEnd.SetFrameIndex(TextFrameIndex(0));

core.git: sw/source

2024-03-15 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/wrtww8.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f56b2dcb5f8b264366a7f7945f3d5ad83aaa7ea8
Author: Justin Luth 
AuthorDate: Thu Mar 14 17:28:50 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Mar 15 22:02:15 2024 +0100

tdf#160192: avoid crash when trying to overwrite doc/lockfile in RO dir

Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b
sfx2 store: create temp files next to local files

Change-Id: I769096f5ee1b2568e198c1e53b71c10af58f5c9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164850
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Reviewed-by: Justin Luth 

diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 23bc15c8f941..72ed190b4ec2 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3553,6 +3553,9 @@ ErrCode WW8Export::ExportDocument_Impl()
 m_pFib.reset(new WW8Fib(8, m_bDot));
 
 rtl::Reference 
xWwStrm(GetWriter().GetStorage().OpenSotStream(m_aMainStg));
+if (!xWwStrm->IsWritable())
+return ERRCODE_IO_ACCESSDENIED;
+
 rtl::Reference xTableStrm(xWwStrm), xDataStrm(xWwStrm);
 xWwStrm->SetBufferSize( 32768 );
 


core.git: sfx2/source

2024-03-15 Thread Justin Luth (via logerrit)
 sfx2/source/doc/oleprops.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c615fba780da5ac3073fe5a00848824f59ee376a
Author: Justin Luth 
AuthorDate: Thu Mar 14 12:29:25 2024 -0400
Commit: Justin Luth 
CommitDate: Fri Mar 15 21:57:44 2024 +0100

tdf#160192: avoid hang when trying to overwrite doc/lockfile in RO dir

Bug exposed with 6.1 5259ab8104cfba60c40748ed0cd59d93df038c5b
sfx2 store: create temp files next to local files

tested on .doc format, code-read suggests it affects xls/ppt too,
but they throw exceptions, apparently before hitting this section.

I was seeing an infinite loop on SfxOleSection::SaveProperty's
while((rStrm.Tell() & 3))
rStrm.WriteUChar( 0 );

because nothing checks to confirm that the tempfile
is actually created/useable.

Now, instead of an infinite loop, we get a crash...

Change-Id: I9e093432361a8ad6f928ec9b47290274b3d4ef06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164840
Reviewed-by: Julien Nabet 
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx
index 891110c43780..714f58c2f1af 100644
--- a/sfx2/source/doc/oleprops.cxx
+++ b/sfx2/source/doc/oleprops.cxx
@@ -1110,7 +1110,7 @@ ErrCode const & SfxOlePropertySet::SavePropertySet( 
SotStorage* pStrg, const OUS
 if( pStrg )
 {
 rtl::Reference xStrm = pStrg->OpenSotStream( 
rStrmName, StreamMode::TRUNC | StreamMode::STD_WRITE );
-if( xStrm.is() )
+if (xStrm.is() && xStrm->IsWritable())
 Save( *xStrm );
 else
 SetError( ERRCODE_IO_ACCESSDENIED );


core.git: sw/source

2024-03-15 Thread Justin Luth (via logerrit)
 sw/source/core/crsr/findtxt.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 397cacaa13dd8c102fb467a0c769597a60a2cfbf
Author: Justin Luth 
AuthorDate: Fri Mar 15 12:40:42 2024 -0400
Commit: Noel Grandin 
CommitDate: Fri Mar 15 20:29:21 2024 +0100

DoSearch's pPam was not optional - made it an SwPam& rPam

oPam also is not a real optional - it is always populated
by MakeRegion, and known to be non-null since it was used
in the containing while loop clause earlier

Change-Id: I33133c8f9f9188e57fe100f3c455dc92453d05f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164868
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Noel Grandin 

diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 5f63f8f13694..9d05c3290e50 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -361,7 +361,7 @@ static bool DoSearch(SwPaM & rSearchPam,
 bool bSrchForward, bool bRegSearch, bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex nTextLen,
 SwTextNode const* pNode, SwTextFrame const* pTextFrame,
-SwRootFrame const* pLayout, SwPaM* pPam);
+SwRootFrame const* pLayout, SwPaM& rPam);
 
 namespace sw {
 
@@ -677,7 +677,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStartInside, nEndInside, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 if ( bFound )
 break;
 else
@@ -710,7 +710,7 @@ bool FindTextImpl(SwPaM & rSearchPam,
bRegSearch, bChkEmptyPara, bChkParaEnd,
nStart, nEnd, nTextLen,
pNode->GetTextNode(), pFrame, pLayout,
-   oPam ? &*oPam : nullptr );
+   *oPam);
 }
 if (bFound)
 break;
@@ -727,10 +727,10 @@ bool DoSearch(SwPaM & rSearchPam,
   bool bChkEmptyPara, bool bChkParaEnd,
 AmbiguousIndex & nStart, AmbiguousIndex & nEnd, AmbiguousIndex const 
nTextLen,
 SwTextNode const*const pNode, SwTextFrame const*const pFrame,
-SwRootFrame const*const pLayout, SwPaM* pPam)
+SwRootFrame const*const pLayout, SwPaM& rPam)
 {
 bool bFound = false;
-SwPosition& rPtPos = *pPam->GetPoint();
+SwPosition& rPtPos = *rPam.GetPoint();
 OUString sCleanStr;
 std::vector aFltArr;
 LanguageType eLastLang = LANGUAGE_SYSTEM;
@@ -818,7 +818,7 @@ bool DoSearch(SwPaM & rSearchPam,
 nStart = nProxyStart;
 nEnd = nProxyEnd;
 // set section correctly
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 rSearchPam.SetMark();
 
 // adjust start and end
@@ -875,7 +875,7 @@ bool DoSearch(SwPaM & rSearchPam,
 else if ((bChkEmptyPara && !nStart.GetAnyIndex() && 
!nTextLen.GetAnyIndex())
  || bChkParaEnd)
 {
-*rSearchPam.GetPoint() = *pPam->GetPoint();
+*rSearchPam.GetPoint() = *rPam.GetPoint();
 if (pLayout)
 {
 *rSearchPam.GetPoint() = pFrame->MapViewToModelPos(


core.git: Branch 'distro/mimo/mimo-7-2' - sd/source

2024-03-14 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit fccf8882a59fbfc68b5d567b968841541713230c
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Aron Budea 
CommitDate: Thu Mar 14 13:17:06 2024 +1030

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506
Reviewed-by: Miklos Vajna 
(cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671
(cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e)
(cherry picked from commit 6ff74883ec3e6ca6b1552968306556f8a921aa23)
(cherry picked from commit eb26913aba35522babb15eee06124d18d4a0cb4e)

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 3320ed06b9e3..add1f86b25a8 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: Branch 'libreoffice-7-6' - pyuno/source

2024-03-14 Thread Justin Luth (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 +++
 pyuno/source/module/pyuno_callable.cxx |3 +++
 pyuno/source/module/pyuno_iterator.cxx |6 ++
 pyuno/source/module/pyuno_runtime.cxx  |3 +++
 pyuno/source/module/pyuno_struct.cxx   |3 +++
 5 files changed, 18 insertions(+)

New commits:
commit 31d72aff203e6d16e4ff624a2b2d17eb3e2d9852
Author: Justin Luth 
AuthorDate: Wed Mar 13 08:38:40 2024 -0400
Commit: Stephan Bergmann 
CommitDate: Thu Mar 14 07:59:58 2024 +0100

allow build with python 3.12.0: initialize new tp_watched

This fixes the build failure after I updated Ubuntu 24.04 (alpha),
which upgraded python 3.11.7 to python 3.12.0, causing the error:

libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1:
error: missing initializer for member ‘_typeobject::tp_watched’
[-Werror=missing-field-initializers]
...

I gleaned this information from a July 2023 commit for
https://github.com/xbmc/xbmc/issues/23503

tp_watched was added in upstream commit python/cpython@82ccbf6

https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab

This change first appeared in Python v3.12.0a1

Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Stephan Bergmann 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164789

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index bd4904d5f729..a589c72ba3bf 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index f22de316b7de..8f19fc8eb654 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 134f318a1017..2fc70a32fcff 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
@@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 7f3eb7a6e95f..02f02c2f6679 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -138,6 +138,9 @@ static PyTypeObject RuntimeImpl_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index c8fd7e987905..364f2776011a 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };


core.git: Branch 'distro/mimo/mimo-7-3' - sd/source

2024-03-13 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit eb26913aba35522babb15eee06124d18d4a0cb4e
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Aron Budea 
CommitDate: Wed Mar 13 15:11:53 2024 +1030

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506
Reviewed-by: Miklos Vajna 
(cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671
(cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e)
(cherry picked from commit 6ff74883ec3e6ca6b1552968306556f8a921aa23)

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 703f2f59809f..1446832f2802 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: sw/qa

2024-03-13 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx |4 ++--
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx |   24 
 sw/qa/extras/rtfexport/rtfexport5.cxx  |   12 ++--
 sw/qa/extras/rtfexport/rtfexport8.cxx  |   12 ++--
 sw/qa/extras/rtfimport/rtfimport.cxx   |6 +++---
 sw/qa/extras/uiwriter/uiwriter3.cxx|4 ++--
 sw/qa/extras/ww8export/ww8export3.cxx  |2 +-
 7 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit 80219819e068dcf53059e2026be2a6f4151d6fc6
Author: Justin Luth 
AuthorDate: Tue Dec 19 10:14:29 2023 -0500
Commit: Justin Luth 
CommitDate: Wed Mar 13 22:38:36 2024 +0100

address nit: use xmlDocUniquePtr, not const auto&

Miklos "nitted" me that I should NOT use const auto&
in this context. Obviously anything I do
is simply copy/paste, so lets make sure that
this "bad example" is removed from all unit tests.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 49d974b01159..6169ca1140df 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -600,7 +600,7 @@ DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, 
"testWPGZOrder.docx")
 CPPUNIT_TEST_FIXTURE(Test, testTdf148720)
 {
 loadAndReload("tdf148720.odt");
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 
 const OString sShapeXPaths[] =
 {
@@ -1098,7 +1098,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx")
 
 DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx")
 {
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 
 // Ensure first element is a tab
 assertXPath(pLayout, 
"/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]"_ostr, 
"type"_ostr, "PortionType::TabLeft");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index cb41f033730d..de10f434b07c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -131,7 +131,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_largeTab, 
"tdf153042_largeTab.docx")
 if (isExported())
 return;
 
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 // Ensure a large tabstop is used in the pseudo-numbering (numbering::NONE 
followed by tabstop)
 assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "1701");
 }
@@ -147,7 +147,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153042_noTab, 
"tdf153042_noTab.docx")
 if (isExported())
 return;
 
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 // Ensure a miniscule tab is used in the pseudo-numbering (numbering::NONE 
followed by tabstop)
 assertXPath(pLayout, "//SwFixPortion"_ostr, "width"_ostr, "10");
 }
@@ -205,7 +205,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrB, 
"tdf105035_framePrB.docx")
 {
 // The paragraphs have different frame definitions, so they must be in 
separate frames,
 // and the frames must not overlap - even though their vertical positions 
are identical.
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 sal_Int32 n1stFlyBottom
 = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, 
"bottom"_ostr).toInt32();
 sal_Int32 n2ndFlyTop
@@ -222,7 +222,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105035_framePrC, 
"tdf105035_framePrC.docx")
 {
 // The paragraphs have different frame definitions, so they must be in 
separate frames,
 // and the frames DO overlap this time.
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 sal_Int32 n1stFlyTop
 = getXPath(pLayout, "//page[1]//anchored/fly[1]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
 sal_Int32 n2ndFlyTop
@@ -307,21 +307,21 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePrTextDirection, "tdf154703_framePrT
 
 DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak, 
"tdf153613_anchoredAfterPgBreak.docx")
 {
-const auto& pLayout = parseLayoutDump();
+xmlDocUniquePtr pLayout = parseLayoutDump();
 // An anchored TO character image anchors before the page break.
 assertXPath(pLayout, "//page[1]//anchored"_ostr, 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf153613_anchoredAfterPgBreak2, 

core.git: sc/source

2024-03-13 Thread Justin Luth (via logerrit)
 sc/source/filter/xml/xmlimprt.cxx |5 -
 1 file changed, 5 deletions(-)

New commits:
commit 21bd1facb207e5d558854eab3a45a0fb2bb222f7
Author: Justin Luth 
AuthorDate: Wed Mar 13 11:30:02 2024 -0400
Commit: Justin Luth 
CommitDate: Wed Mar 13 21:29:45 2024 +0100

related tdf#123026 xmlimprt: cleanup #includes after removing code block

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

diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index b59b644b5c4d..b94d1d44d8fa 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -42,7 +42,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -51,16 +50,12 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include "xmlbodyi.hxx"
 #include "xmlstyli.hxx"
 #include 
 #include 
 
 #include 
-#include 
 
 #include "XMLConverter.hxx"
 #include "XMLDetectiveContext.hxx"


core.git: Branch 'libreoffice-24-2' - pyuno/source

2024-03-13 Thread Justin Luth (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 +++
 pyuno/source/module/pyuno_callable.cxx |3 +++
 pyuno/source/module/pyuno_iterator.cxx |6 ++
 pyuno/source/module/pyuno_runtime.cxx  |3 +++
 pyuno/source/module/pyuno_struct.cxx   |3 +++
 5 files changed, 18 insertions(+)

New commits:
commit 7a561440acd01949e9b7b4efef9062ce05ce5d64
Author: Justin Luth 
AuthorDate: Wed Mar 13 08:38:40 2024 -0400
Commit: Stephan Bergmann 
CommitDate: Wed Mar 13 20:28:53 2024 +0100

allow build with python 3.12.0: initialize new tp_watched

This fixes the build failure after I updated Ubuntu 24.04 (alpha),
which upgraded python 3.11.7 to python 3.12.0, causing the error:

libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1:
error: missing initializer for member ‘_typeobject::tp_watched’
[-Werror=missing-field-initializers]
...

I gleaned this information from a July 2023 commit for
https://github.com/xbmc/xbmc/issues/23503

tp_watched was added in upstream commit python/cpython@82ccbf6

https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab

This change first appeared in Python v3.12.0a1

Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Stephan Bergmann 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164785

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index bd4904d5f729..a589c72ba3bf 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index f22de316b7de..8f19fc8eb654 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 134f318a1017..2fc70a32fcff 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
@@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index cb95e5a46dc1..91e971fdd582 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -139,6 +139,9 @@ static PyTypeObject RuntimeImpl_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index c8fd7e987905..364f2776011a 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };


core.git: pyuno/source

2024-03-13 Thread Justin Luth (via logerrit)
 pyuno/source/module/pyuno.cxx  |3 +++
 pyuno/source/module/pyuno_callable.cxx |3 +++
 pyuno/source/module/pyuno_iterator.cxx |6 ++
 pyuno/source/module/pyuno_runtime.cxx  |3 +++
 pyuno/source/module/pyuno_struct.cxx   |3 +++
 5 files changed, 18 insertions(+)

New commits:
commit daa04d405a0081c5212cfbad0d36a049a4ea83c2
Author: Justin Luth 
AuthorDate: Wed Mar 13 08:38:40 2024 -0400
Commit: Stephan Bergmann 
CommitDate: Wed Mar 13 17:45:49 2024 +0100

allow build with python 3.12.0: initialize new tp_watched

This fixes the build failure after I updated Ubuntu 24.04 (alpha),
which upgraded python 3.11.7 to python 3.12.0, causing the error:

libreoffice/pyuno/source/module/pyuno_callable.cxx:249:1:
error: missing initializer for member ‘_typeobject::tp_watched’
[-Werror=missing-field-initializers]
...

I gleaned this information from a July 2023 commit for
https://github.com/xbmc/xbmc/issues/23503

tp_watched was added in upstream commit python/cpython@82ccbf6

https://github.com/python/cpython/commit/82ccbf69a842db25d8117f1c41b47aa5b4ed96ab

This change first appeared in Python v3.12.0a1

Change-Id: If82ff1eb47d66d2669d90d6e00e0feff3c55b5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164775
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 44fd8af6810e..f21cbb63d2f4 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1667,6 +1667,9 @@ static PyTypeObject PyUNOType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_callable.cxx 
b/pyuno/source/module/pyuno_callable.cxx
index f22de316b7de..8f19fc8eb654 100644
--- a/pyuno/source/module/pyuno_callable.cxx
+++ b/pyuno/source/module/pyuno_callable.cxx
@@ -244,6 +244,9 @@ static PyTypeObject PyUNO_callable_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_iterator.cxx 
b/pyuno/source/module/pyuno_iterator.cxx
index 134f318a1017..2fc70a32fcff 100644
--- a/pyuno/source/module/pyuno_iterator.cxx
+++ b/pyuno/source/module/pyuno_iterator.cxx
@@ -177,6 +177,9 @@ static PyTypeObject PyUNO_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
@@ -323,6 +326,9 @@ static PyTypeObject PyUNO_list_iterator_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index cb95e5a46dc1..91e971fdd582 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -139,6 +139,9 @@ static PyTypeObject RuntimeImpl_Type =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };
diff --git a/pyuno/source/module/pyuno_struct.cxx 
b/pyuno/source/module/pyuno_struct.cxx
index c8fd7e987905..364f2776011a 100644
--- a/pyuno/source/module/pyuno_struct.cxx
+++ b/pyuno/source/module/pyuno_struct.cxx
@@ -354,6 +354,9 @@ static PyTypeObject PyUNOStructType =
 #pragma clang diagnostic pop
 #endif
 #endif
+#if PY_VERSION_HEX >= 0x030C00A1
+, 0 // tp_watched
+#endif
 #endif
 #endif
 };


core.git: Branch 'distro/mimo/mimo-7-5' - sd/source

2024-03-12 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 6ff74883ec3e6ca6b1552968306556f8a921aa23
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Aron Budea 
CommitDate: Tue Mar 12 18:49:31 2024 +1030

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506
Reviewed-by: Miklos Vajna 
(cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671
(cherry picked from commit 2dd2471290acf4d1229cca7b43719e57242cd59e)

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 0c0786d3eebb..1f5ada44cf33 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: Branch 'libreoffice-7-6' - sd/source

2024-03-12 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 2dd2471290acf4d1229cca7b43719e57242cd59e
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Mar 12 08:36:06 2024 +0100

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506
Reviewed-by: Miklos Vajna 
(cherry picked from commit 703cc8d674d81573a1e6191a12cec4012cca22f7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164671

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8401ec38cd6e..92f7e9be1cb0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: writerfilter/source

2024-03-11 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/GraphicImport.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit ccf988d206a47701c81126f23e2bef71fc3db333
Author: Justin Luth 
AuthorDate: Mon Mar 11 08:26:28 2024 -0400
Commit: Justin Luth 
CommitDate: Mon Mar 11 15:34:03 2024 +0100

GraphicImport.cxx: address nit

less emphasis on minimizing "if logic"
and more emphasis on readability
(especially since the comment comes after the logic).

In the most common cases, this version
should actually finish sooner to.

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

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 6ee808355a60..2df2569530a1 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1863,9 +1863,10 @@ uno::Reference 
GraphicImport::createGraphicObject(uno::Refer
 if (m_pImpl->m_rGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
 {
 if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME
-&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE
-&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER
-&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL)
+&& (m_pImpl->m_nHoriOrient == text::HoriOrientation::LEFT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::RIGHT
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::INSIDE
+|| m_pImpl->m_nHoriOrient == 
text::HoriOrientation::OUTSIDE))
 {
 // before compat15, relative left/right/inside/outside 
honored margins.
 if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)


core.git: Branch 'libreoffice-24-2' - sd/source

2024-03-11 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 703cc8d674d81573a1e6191a12cec4012cca22f7
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 13:15:13 2024 +0100

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 62323124f54885c6de4ac4fa38052d380309a5a1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164506
Reviewed-by: Miklos Vajna 

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8401ec38cd6e..92f7e9be1cb0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: Branch 'distro/collabora/co-24.04' - sw/qa writerfilter/source

2024-03-11 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|   27 ++
 writerfilter/source/dmapper/GraphicImport.cxx |   13 ++
 3 files changed, 40 insertions(+)

New commits:
commit 8192ed8c0e0e474ef631f7012577fb2821708b52
Author: Justin Luth 
AuthorDate: Wed Mar 6 18:56:55 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 09:47:34 2024 +0100

tdf#160077 writerfilter: shape vertRelation is FRAME for layoutinCell

When layoutInCell is active, then the offset must be applied
against the paragraph instead of the page or page margins.

There were only two unit tests that matched this,
and both were off-sheet positioned.
-tdf151704_thinColumnHeight.docx
-tdf92157.docx

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160077_layoutInCell

Change-Id: I28241136c0c0be12d3f2dd876550ecdf91b0009c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164514
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164585
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx
new file mode 100644
index ..811fc47e184c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 61c1b3172d19..e26abce21066 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -321,6 +321,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, 
"tdf160077_layoutInCell.docx")
+{
+// given an in-table, slightly rotated image vertically aligned -1cm 
(above) the top page margin
+// (which is actually forced to layoutInCell, so that becomes 1cm above 
the paragraph instead)
+
+xmlDocUniquePtr pDump = parseLayoutDump();
+const sal_Int32 nCellTop
+= getXPath(pDump, "//row[1]/cell[1]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+const sal_Int32 nParaTop
+= getXPath(pDump, "//row[1]/cell[1]/txt/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+const sal_Int32 nImageTop
+= getXPath(pDump, 
"//row[1]/cell[1]/txt/anchored/SwAnchoredDrawObject/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// The image is approximately half-way between cell top and the start of 
the text
+// correct ImageTop: 3588, while incorrect value was 1117. Cell top is 
3051, ParaTop is 4195
+const sal_Int32 nHalfway = nCellTop + (nParaTop - nCellTop) / 2;
+CPPUNIT_ASSERT_DOUBLES_EQUAL(nHalfway, nImageTop, 50); // +/- 4.4%
+
+// The effect is implemented by forcing "Entire paragraph area"/FRAME/0
+// instead of "Page text area"/PAGE_PRINT_AREA/8
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+ getProperty(getShape(1), 
"VertOrientRelation"));
+// since layoutInCell had been turned off. If the implementation changes, 
check the layout.
+CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 46a5da451226..9b0f161d2f94 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1263,6 +1263,19 @@ void GraphicImport::lcl_attribute(Id nName, Value& 
rValue)
 
 if (m_pImpl->m_nWrap == text::WrapTextMode_THROUGH && 
m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME)
 {
+if (m_pImpl->m_bLayoutInCell && 
m_pImpl->m_rDomainMapper.IsInTable()
+&& (m_pImpl->m_nVertRelation == 
text::RelOrientation::PAGE_FRAME
+|| m_pImpl->m_nVertRelation == 
text::RelOrientation::PAGE_PRINT_AREA))
+{
+// Impossible to be page-oriented when layout 
in cell.
+// Since we are turning LayoutInCell off (to 
simplify layout),
+// we need to set the orientation to the 
paragraph,
+

core.git: Branch 'distro/collabora/co-24.04' - sw/qa writerfilter/source

2024-03-11 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   10 ++
 writerfilter/source/dmapper/GraphicImport.cxx  |   10 ++
 3 files changed, 20 insertions(+)

New commits:
commit 14451b801029e8efc05d7f777692a91eddab9e16
Author: Justin Luth 
AuthorDate: Tue Mar 5 20:19:09 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 09:47:18 2024 +0100

tdf#160049 dml shape import: use margins with left/right HoriOrientRel

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin

Change-Id: I3e2df2037cabfedbb6df6b8c8257e90baeaab96e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164445
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164584
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx
new file mode 100644
index ..349ed4cbeea7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index d57c94835e4b..61c1b3172d19 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -302,6 +302,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginV
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, 
"tdf160049_anchorMargin2.docx")
+{
+// given a DML compat14 (Word 2010) document with a LEFT "column/text" 
anchored shape
+
+// The shape takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15.docx")
 {
 // given a DML compat15 (Word 2013) document with a LEFT "column/text" 
anchored image
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 3e5d6d87b267..46a5da451226 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1268,6 +1268,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& 
rValue)
 m_pImpl->m_bLayoutInCell = false;
 }
 
+if (m_pImpl->m_nHoriRelation == 
text::RelOrientation::FRAME
+&& m_pImpl->m_nHoriOrient > 
text::HoriOrientation::NONE
+&& m_pImpl->m_nHoriOrient != 
text::HoriOrientation::CENTER
+&& m_pImpl->m_nHoriOrient < 
text::HoriOrientation::FULL)
+{
+// before compat15, relative 
left/right/inside/outside honored margins.
+if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)
+m_pImpl->m_nHoriRelation = 
text::RelOrientation::PRINT_AREA;
+}
+
 // Anchored: Word only supports at-char in that case.
 text::TextContentAnchorType eAnchorType = 
text::TextContentAnchorType_AT_CHARACTER;
 


core.git: Branch 'distro/collabora/co-24.04' - 3 commits - oox/source sw/qa sw/source writerfilter/source

2024-03-11 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshape.cxx  |   17 +++-
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx  |binary
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   21 +++
 sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc   |binary
 sw/qa/extras/ww8export/ww8export4.cxx|   10 +
 sw/source/filter/ww8/ww8graf.cxx |6 +++
 writerfilter/source/dmapper/GraphicImport.cxx|   10 +
 8 files changed, 61 insertions(+), 3 deletions(-)

New commits:
commit 8dcc7c73999727a5a5e5577d6d48f43f403e2995
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:43:51 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 09:44:45 2024 +0100

tdf#160049 doc import: use margins with left/right HoriOrientRelation

No interesting existing unit tests.

make CppunitTest_sw_ww8export4 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin

Change-Id: Ib855d9f35db9e0f47aff18400b69a990cd1ad5ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/16
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164583
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc 
b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc
new file mode 100644
index ..d1082515fd9c
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index d31bf17a31f6..e297ac949afe 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -49,6 +49,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964)
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, 
getProperty(getShapeByName(u"Image2"), 
"AnchorType"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, 
"tdf160049_anchorMargin.doc")
+{
+// given a document with a LEFT "column/text" anchored image
+
+// The image takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, 
"tdf150197_anlv2ListFormat.doc")
 {
 CPPUNIT_ASSERT_EQUAL(OUString("1."), 
getProperty(getParagraph(2), "ListLabelString"));
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 8a9dd1197129..7d486f471e1f 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2400,6 +2400,12 @@ RndStdIds 
SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
 rFSPA.nXaLeft = 0;
 rFSPA.nXaRight = nWidth;
 }
+else if ((eHoriOri == text::HoriOrientation::LEFT || eHoriOri == 
text::HoriOrientation::RIGHT)
+ && eHoriRel == text::RelOrientation::FRAME)
+{
+// relative left/right honors paragraph margins, but not with center 
or none/absolute offset
+eHoriRel = text::RelOrientation::PRINT_AREA;
+}
 
 // #i24255# - position of floating screen objects in
 // R2L layout are given in L2R layout, thus convert them of all
commit bb6fa9b093e857c7d34eb161ff4c6692f09f7b9e
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:22:34 2024 -0500
Commit: Miklos Vajna 
CommitDate: Mon Mar 11 09:44:39 2024 +0100

tdf#160049 dml import: use margins with left/right HoriOrientRelation

I'm really surprised this wasn't found much earlier.
Even DOC format isn't handling this.

compat15 gets rid of this inconsistency.

Surprisingly, there were no interesting unit tests matching this.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin15

Change-Id: Ic5c316569ad3640ba0e786d39a6e5c006c74d665
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164443
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164582
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx
new file mode 100755
index ..0b80c9652fbe
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx differ
diff --git a/sw/qa/extras/oox

core.git: sw/qa

2024-03-08 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx |binary
 1 file changed

New commits:
commit 4904e608fd7ac3d61c924a17fe3494f5e4a43ae6
Author: Justin Luth 
AuthorDate: Fri Mar 8 17:43:51 2024 -0500
Commit: Justin Luth 
CommitDate: Sat Mar 9 01:45:33 2024 +0100

replace unit test font with Liberation Sans

since I was getting a build failure on Ubuntu 24.04

warn:vcl.fonts:1268905:1268905:
vcl/unx/generic/fontmanager/fontconfig.cxx:1192:
PrintFontManager::Substitute: missing font: 'Rockwell'
try: Noto Sans instead

replaced theme1.xml Rockwell and Franklin fonts
with Liberation Sans

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx
index 741bf8270855..625e149ff38e 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx and 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx differ


core.git: sw/qa

2024-03-08 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   16 +
 2 files changed, 16 insertions(+)

New commits:
commit 61b1d3a17ff784b7c79a92cbe069a90ce4932535
Author: Justin Luth 
AuthorDate: Fri Mar 8 08:37:30 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 8 18:22:46 2024 +0100

tdf#160077 unit test: this file was helpful identifying a "bad fix"

...since I'm walking away from doing any fix at all
as it involves layout code for layoutInCell.

Following the createGraphicObject route could also benefit from
a similar fix as d210667c72ff821b8cb50b386a83ed55d65ae9bf,
but placing that code outside of the try/catch
will be important because this example exceptions out.
However, my first instinct was to put the code in the "obvious spot"
and it didn't work, so adding this as a separate unit test.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160077_layoutInCellB

Change-Id: Ifa6a62d9708d9248e48766b913d54a79cfcb230a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164578
    Tested-by: Justin Luth 
    Reviewed-by: Justin Luth 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx
new file mode 100644
index ..741bf8270855
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCellB.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 5e320bb6d743..2683ccad087e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -381,6 +381,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, 
"tdf160077_layoutInCell.doc
 CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCellB, 
"tdf160077_layoutInCellB.docx")
+{
+// given an in-table, group-shape vertically aligned -1.35 cm (above) the 
top page margin
+// (which is actually forced to layoutInCell, so that turns into 1.35cm 
above the paragraph)
+
+xmlDocUniquePtr pDump = parseLayoutDump();
+const sal_Int32 nShapeTop
+= getXPath(pDump,
+   
"//body/tab[1]/row[1]/cell[1]/txt[1]/anchored/SwAnchoredDrawObject/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// The shape is approximately 1 cm below the top of the page, and ~0.5cm 
above the cell
+// correct ShapeTop: 888 TWIPS, while incorrect value was -480. Cell top 
is 1148, PageTop is 284
+CPPUNIT_ASSERT_DOUBLES_EQUAL(888, nShapeTop, 50);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored


core.git: sw/qa writerfilter/source

2024-03-08 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx|   27 ++
 writerfilter/source/dmapper/GraphicImport.cxx |   13 ++
 3 files changed, 40 insertions(+)

New commits:
commit d210667c72ff821b8cb50b386a83ed55d65ae9bf
Author: Justin Luth 
AuthorDate: Wed Mar 6 18:56:55 2024 -0500
Commit: Miklos Vajna 
CommitDate: Fri Mar 8 10:59:36 2024 +0100

tdf#160077 writerfilter: shape vertRelation is FRAME for layoutinCell

When layoutInCell is active, then the offset must be applied
against the paragraph instead of the page or page margins.

There were only two unit tests that matched this,
and both were off-sheet positioned.
-tdf151704_thinColumnHeight.docx
-tdf92157.docx

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160077_layoutInCell

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx
new file mode 100644
index ..811fc47e184c
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160077_layoutInCell.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index fcb2eea321c9..5e320bb6d743 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -354,6 +354,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160077_layoutInCell, 
"tdf160077_layoutInCell.docx")
+{
+// given an in-table, slightly rotated image vertically aligned -1cm 
(above) the top page margin
+// (which is actually forced to layoutInCell, so that becomes 1cm above 
the paragraph instead)
+
+xmlDocUniquePtr pDump = parseLayoutDump();
+const sal_Int32 nCellTop
+= getXPath(pDump, "//row[1]/cell[1]/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+const sal_Int32 nParaTop
+= getXPath(pDump, "//row[1]/cell[1]/txt/infos/bounds"_ostr, 
"top"_ostr).toInt32();
+const sal_Int32 nImageTop
+= getXPath(pDump, 
"//row[1]/cell[1]/txt/anchored/SwAnchoredDrawObject/bounds"_ostr,
+   "top"_ostr)
+  .toInt32();
+// The image is approximately half-way between cell top and the start of 
the text
+// correct ImageTop: 3588, while incorrect value was 1117. Cell top is 
3051, ParaTop is 4195
+const sal_Int32 nHalfway = nCellTop + (nParaTop - nCellTop) / 2;
+CPPUNIT_ASSERT_DOUBLES_EQUAL(nHalfway, nImageTop, 50); // +/- 4.4%
+
+// The effect is implemented by forcing "Entire paragraph area"/FRAME/0
+// instead of "Page text area"/PAGE_PRINT_AREA/8
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+ getProperty(getShape(1), 
"VertOrientRelation"));
+// since layoutInCell had been turned off. If the implementation changes, 
check the layout.
+CPPUNIT_ASSERT(!getProperty(getShape(1), "IsFollowingTextFlow"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index b7d5f101f417..6ee808355a60 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1285,6 +1285,19 @@ void GraphicImport::lcl_attribute(Id nName, Value& 
rValue)
 
 if (m_pImpl->m_nWrap == text::WrapTextMode_THROUGH && 
m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME)
 {
+if (m_pImpl->m_bLayoutInCell && 
m_pImpl->m_rDomainMapper.IsInTable()
+&& (m_pImpl->m_nVertRelation == 
text::RelOrientation::PAGE_FRAME
+|| m_pImpl->m_nVertRelation == 
text::RelOrientation::PAGE_PRINT_AREA))
+{
+// Impossible to be page-oriented when layout 
in cell.
+// Since we are turning LayoutInCell off (to 
simplify layout),
+// we need to set the orientation to the 
paragraph,
+// as MSO effectively does when it forces 
layoutInCell.
+// Probabl

core.git: sw/qa

2024-03-06 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx  |   31 
 2 files changed, 31 insertions(+)

New commits:
commit b0f8b695ef25dfd24416afe36b26d7d4f41c40a9
Author: Justin Luth 
AuthorDate: Wed Mar 6 09:25:31 2024 -0500
Commit: Justin Luth 
CommitDate: Thu Mar 7 04:23:50 2024 +0100

tdf#160049 full unit test: use margins with left/right HoriOrientRel

The other unit tests focused on the concept in general,
but always used the same situation.

This is a comprehensive test,
indicating the things that should NOT use the margins (center, left by)
and both things that do use the margin (right, as well as left).

So there are a few "do not break what is already working" situations
now tested for...

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx
new file mode 100644
index ..b39c0cad83e7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin14.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index bc5d5f253e8e..fcb2eea321c9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -314,6 +314,37 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, 
"tdf160049_anchorMargin2.d
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin14, 
"tdf160049_anchorMargin14.docx")
+{
+// given a DML compat14 (Word 2010) document with a LEFT "column/text" 
anchored image
+// followed by a RIGHT column/text anchored image (with a 2cm paragraph 
right margin)
+// followed by a CENTER column/text anchored image (with a large left 
margin)
+// followed by a LEFT FROM column/text anchored image (which ignores the 
left margin)
+// followed by a LEFT "margin" anchored image (which always ignores the 
left margin)
+
+// The shape takes into account the left margin, looking like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+uno::Reference xShape(getShapeByName(u"Picture 2"));
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(xShape, "HoriOrientRelation"));
+// The shape takes into account the right margin, looking like it is in 
the middle of the doc,
+xShape.set(getShapeByName(u"Picture 3"));
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(xShape, "HoriOrientRelation"));
+// The third shape takes "center" very seriously, and ignores the margins
+xShape.set(getShapeByName(u"Picture 4"));
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+ getProperty(xShape, "HoriOrientRelation"));
+// The fourth shape takes "left by 123", and ignores the margins, acting 
just like "margin"
+xShape.set(getShapeByName(u"Picture 5"));
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+ getProperty(xShape, "HoriOrientRelation"));
+// The fifth shape shows how "left" works with "margin", which apparently 
means page margin
+xShape.set(getShapeByName(u"Picture 6"));
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PAGE_PRINT_AREA,
+ getProperty(xShape, "HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15.docx")
 {
 // given a DML compat15 (Word 2013) document with a LEFT "column/text" 
anchored image


core.git: sw/qa writerfilter/source

2024-03-06 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx |   10 ++
 writerfilter/source/dmapper/GraphicImport.cxx  |   10 ++
 3 files changed, 20 insertions(+)

New commits:
commit 77980d4375b270f328afe1dd90e96e2e31fd498d
Author: Justin Luth 
AuthorDate: Tue Mar 5 20:19:09 2024 -0500
Commit: Justin Luth 
CommitDate: Thu Mar 7 02:20:33 2024 +0100

tdf#160049 dml shape import: use margins with left/right HoriOrientRel

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx
new file mode 100644
index ..349ed4cbeea7
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 8bae715cf4de..bc5d5f253e8e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -304,6 +304,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginV
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin2, 
"tdf160049_anchorMargin2.docx")
+{
+// given a DML compat14 (Word 2010) document with a LEFT "column/text" 
anchored shape
+
+// The shape takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15.docx")
 {
 // given a DML compat15 (Word 2013) document with a LEFT "column/text" 
anchored image
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index fb34152cda6f..b7d5f101f417 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1290,6 +1290,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& 
rValue)
 m_pImpl->m_bLayoutInCell = false;
 }
 
+if (m_pImpl->m_nHoriRelation == 
text::RelOrientation::FRAME
+&& m_pImpl->m_nHoriOrient > 
text::HoriOrientation::NONE
+&& m_pImpl->m_nHoriOrient != 
text::HoriOrientation::CENTER
+&& m_pImpl->m_nHoriOrient < 
text::HoriOrientation::FULL)
+{
+// before compat15, relative 
left/right/inside/outside honored margins.
+if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)
+m_pImpl->m_nHoriRelation = 
text::RelOrientation::PRINT_AREA;
+}
+
 // Anchored: Word only supports at-char in that case.
 text::TextContentAnchorType eAnchorType = 
text::TextContentAnchorType_AT_CHARACTER;
 


core.git: sw/qa sw/source

2024-03-06 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc |binary
 sw/qa/extras/ww8export/ww8export4.cxx  |   10 ++
 sw/source/filter/ww8/ww8graf.cxx   |6 ++
 3 files changed, 16 insertions(+)

New commits:
commit 3aeaee800f675a5f733e06bb4ea73909570f9004
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:43:51 2024 -0500
Commit: Miklos Vajna 
CommitDate: Wed Mar 6 11:27:04 2024 +0100

tdf#160049 doc import: use margins with left/right HoriOrientRelation

No interesting existing unit tests.

make CppunitTest_sw_ww8export4 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin

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

diff --git a/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc 
b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc
new file mode 100644
index ..d1082515fd9c
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf160049_anchorMargin.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index ea50ed2a19b9..7ab6f76ec3a6 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -51,6 +51,16 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf77964)
 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER, 
getProperty(getShapeByName(u"Image2"), 
"AnchorType"));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf160049_anchorMargin, 
"tdf160049_anchorMargin.doc")
+{
+// given a document with a LEFT "column/text" anchored image
+
+// The image takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf150197_anlv2ListFormat, 
"tdf150197_anlv2ListFormat.doc")
 {
 CPPUNIT_ASSERT_EQUAL(OUString("1."), 
getProperty(getParagraph(2), "ListLabelString"));
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index a7c9ec979e09..28b1211683d1 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2400,6 +2400,12 @@ RndStdIds 
SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec& rRecord, WW8_FS
 rFSPA.nXaLeft = 0;
 rFSPA.nXaRight = nWidth;
 }
+else if ((eHoriOri == text::HoriOrientation::LEFT || eHoriOri == 
text::HoriOrientation::RIGHT)
+ && eHoriRel == text::RelOrientation::FRAME)
+{
+// relative left/right honors paragraph margins, but not with center 
or none/absolute offset
+eHoriRel = text::RelOrientation::PRINT_AREA;
+}
 
 // #i24255# - position of floating screen objects in
 // R2L layout are given in L2R layout, thus convert them of all


core.git: sw/qa writerfilter/source

2024-03-06 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx  |   12 ++--
 writerfilter/source/dmapper/GraphicImport.cxx   |   10 ++
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit eacf8dc7ab850f2d00bd4b327f830c55cf2a0d92
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:22:34 2024 -0500
Commit: Miklos Vajna 
CommitDate: Wed Mar 6 11:23:59 2024 +0100

tdf#160049 dml import: use margins with left/right HoriOrientRelation

I'm really surprised this wasn't found much earlier.
Even DOC format isn't handling this.

compat15 gets rid of this inconsistency.

Surprisingly, there were no interesting unit tests matching this.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMargin15

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx
new file mode 100755
index ..0b80c9652fbe
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMargin15.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index d045e18efa32..8bae715cf4de 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -297,14 +297,22 @@ DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginV
 {
 // given a VML (Word 2003) document with a LEFT "column/text" anchored 
image
 // (which will import as DML compat12 on the round-trip)
-if (isExported())
-return;
+
 // The image takes into account the margin, so it looks like it is in the 
middle of the doc,
 // which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
 CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
  getProperty(getShape(1), 
"HoriOrientRelation"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMargin15, 
"tdf160049_anchorMargin15.docx")
+{
+// given a DML compat15 (Word 2013) document with a LEFT "column/text" 
anchored image
+
+// The image ignores the margin, so it is at the left for compat15 (but 
middle-ish for compat14)
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::FRAME,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index a2acdeb604cc..fb34152cda6f 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1839,6 +1839,16 @@ uno::Reference 
GraphicImport::createGraphicObject(uno::Refer
 sal_Int32 nWidth = - m_pImpl->m_nLeftPosition;
 if (m_pImpl->m_rGraphicImportType == IMPORT_AS_DETECTED_ANCHOR)
 {
+if (m_pImpl->m_nHoriRelation == text::RelOrientation::FRAME
+&& m_pImpl->m_nHoriOrient > text::HoriOrientation::NONE
+&& m_pImpl->m_nHoriOrient != text::HoriOrientation::CENTER
+&& m_pImpl->m_nHoriOrient < text::HoriOrientation::FULL)
+{
+// before compat15, relative left/right/inside/outside 
honored margins.
+if 
(m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() < 15)
+m_pImpl->m_nHoriRelation = 
text::RelOrientation::PRINT_AREA;
+}
+
 //adjust margins
 if( (m_pImpl->m_nHoriOrient == text::HoriOrientation::LEFT &&
 (m_pImpl->m_nHoriRelation == 
text::RelOrientation::PAGE_PRINT_AREA ||


core.git: oox/source sw/qa

2024-03-06 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlshape.cxx  |   17 +--
 sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx   |   13 
 3 files changed, 27 insertions(+), 3 deletions(-)

New commits:
commit e0ef7d54b4e4ccbaaada5d2c4a42ba41d961ea69
Author: Justin Luth 
AuthorDate: Tue Mar 5 19:05:29 2024 -0500
Commit: Miklos Vajna 
CommitDate: Wed Mar 6 11:22:31 2024 +0100

tdf#160049 oox import: use margins with left/right HoriOrientRelation

I'm really surprised this wasn't found much earlier.
Even DOC format isn't handling this.

make CppunitTest_sw_ooxmlexport21 \
CPPUNIT_TEST_NAME=testTdf160049_anchorMarginVML

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

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 5284de176839..8f16c6267211 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -647,8 +647,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 rPropSet.setAnyProperty(PROP_VertOrient, 
Any(text::VertOrientation::TOP));
 }
 
+// if the anchor is not inline, and is relative to left or right, then 
apply the margins
+bool bHonorMargins = rTypeModel.maPosition == "relative" || 
rTypeModel.maPosition == "absolute";
 if ( rTypeModel.maPositionHorizontal == "center" )
+{
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::CENTER));
+bHonorMargins = false;
+}
 else if ( rTypeModel.maPositionHorizontal == "left" )
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::LEFT));
 else if ( rTypeModel.maPositionHorizontal == "right" )
@@ -663,6 +668,8 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 rPropSet.setAnyProperty(PROP_HoriOrient, 
Any(text::HoriOrientation::RIGHT));
 rPropSet.setAnyProperty(PROP_PageToggle, Any(true));
 }
+else
+bHonorMargins = false;
 
 if ( rTypeModel.maPositionHorizontalRelative == "page" )
 rPropSet.setAnyProperty(PROP_HoriOrientRelation, 
Any(text::RelOrientation::PAGE_FRAME));
@@ -674,9 +681,13 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const 
ShapeTypeModel& rType
 else if (rTypeModel.maPositionHorizontalRelative == "left-margin-area" ||
  rTypeModel.maPositionHorizontalRelative == "outer-margin-area")
 rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PAGE_LEFT);
-else if ( rTypeModel.maPositionHorizontalRelative == "text" )
-rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::FRAME);
-
+else // "text"
+{
+if (bHonorMargins)
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::PRINT_AREA);
+else
+rPropSet.setProperty(PROP_HoriOrientRelation, 
text::RelOrientation::FRAME);
+}
 if ( rTypeModel.maPositionVertical == "center" )
 rPropSet.setAnyProperty(PROP_VertOrient, 
Any(text::VertOrientation::CENTER));
 else if ( rTypeModel.maPositionVertical == "top" )
diff --git a/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx
new file mode 100644
index ..f8cb262f53c8
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf160049_anchorMarginVML.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 2e6c10c99031..d045e18efa32 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -292,6 +293,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf158597, "tdf158597.docx")
 }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf160049_anchorMarginVML, 
"tdf160049_anchorMarginVML.docx")
+{
+// given a VML (Word 2003) document with a LEFT "column/text" anchored 
image
+// (which will import as DML compat12 on the round-trip)
+if (isExported())
+return;
+// The image takes into account the margin, so it looks like it is in the 
middle of the doc,
+// which is "Paragraph text area"/PRINT_AREA/1, not "Entire paragraph 
area"/FRAME/0
+CPPUNIT_ASSERT_EQUAL(css::text::RelOrientation::PRINT_AREA,
+ getProperty(getShape(1), 
"HoriOrientRelation"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow.docx")
 {
 // Although MSO's UI reports "layoutInCell" for the rectangle, it isn't 
specified or honored


core.git: sd/qa sd/source

2024-03-01 Thread Justin Luth (via logerrit)
 sd/qa/uitest/impress_tests/tdf159927_dateTime.py |3 +--
 sd/source/ui/dlg/headerfooterdlg.cxx |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit de5816806589c6e6d1da11f50f9ceeb6f50dc3ef
Author: Justin Luth 
AuthorDate: Fri Mar 1 10:40:23 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 21:37:15 2024 +0100

fix build: UITest_impress_tests (re-enable date-time test)

accidental debugging change got mixed into a patch...

This reverts part of commit 99e33129346afeb0a386ffad859a9178290211a6
which shows I clearly failed to follow my normal practise of
properly reviewing the change in gerrit before submitting.

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

diff --git a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py 
b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py
index 7225d5c96468..17c5f23caa3b 100644
--- a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py
+++ b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py
@@ -19,7 +19,6 @@ class tdf159927(UITestCase):
 language_list = xDialog.getChild("language_list")
 # Expected: the existing language of the date/time field: 
Finnish
 # Actual without the fix: the user's locale as specified in 
tools - options.
-# comment out uitest that fails regularly both on jenkins and my local box
-#
self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish")
+
self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish")
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8aaf7fed1e47..92f7e9be1cb0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -536,7 +536,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-const sal_uInt16 nPageCount = 1;// 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {


core.git: sd/source writerfilter/source

2024-02-29 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx  |2 +-
 writerfilter/source/dmapper/GraphicImport.cxx |3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 99e33129346afeb0a386ffad859a9178290211a6
Author: Justin Luth 
AuthorDate: Thu Feb 29 11:35:43 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 01:39:18 2024 +0100

NFC writerfilter GraphicImport: streamline if statement

The function is a const static, so it doesn't require being run.

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

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 92f7e9be1cb0..8aaf7fed1e47 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -536,7 +536,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
+const sal_uInt16 nPageCount = 1;// 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index f64bef09e958..a2acdeb604cc 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -972,8 +972,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
 && !bIsDiagram && !bIsLockedCanvas && 
!bIsWordprocessingCanvas)
 || 
xServiceInfo->supportsService("com.sun.star.drawing.LineShape");
 SdrObject* pShape = 
SdrObject::getSdrObjectFromXShape(m_xShape);
-if ((bIsGroupOrLine && 
!lcl_bHasGroupSlantedChild(pShape) && nOOXAngle == 0)
-|| !bIsGroupOrLine)
+if (!bIsGroupOrLine || (!nOOXAngle && 
!lcl_bHasGroupSlantedChild(pShape)))
 {
 if (m_pImpl->isXSizeValid())
 aSize.Width = m_pImpl->getXSize();


core.git: sw/qa writerfilter/source

2024-02-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx|   17 
++
 writerfilter/source/dmapper/GraphicImport.cxx |4 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit c4c5937a98572630915de497b3138164b12079e3
Author: Justin Luth 
AuthorDate: Wed Feb 28 14:18:44 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 01:38:13 2024 +0100

tdf#159158 writerfilter: headers always behind text (!opaque)

If the body-anchored thing is in the background,
then if any header stuff was NOT in the background,
then it would show up above the body thing,
and that should not happen in a DOCX world.

This test was not easy to produce.
ODT kind of knows that headers are special,
and so it tries really hard to put stuff in the background
without any wrap - at least after a round-trip.

So I had to hand-craft from my example DOCX
that exhibited a behindDoc which actually
had some wrapping component to it.

make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf159158_zOrder_headerBehind2

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx
new file mode 100644
index ..e787b9c2605d
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 91fa26ea0a47..cb41f033730d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -1047,6 +1047,23 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind, "tdf159158_zOrder_he
 CPPUNIT_ASSERT_EQUAL(OUString("RectangleInBody"), 
getProperty(zOrder1,"Name"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind2, 
"tdf159158_zOrder_headerBehind2.docx")
+{
+// given a logo (marked as behind text) anchored in the header
+// and an overlapping blue rectangle anchored in the body text.
+uno::Reference zOrder0(getShape(1), uno::UNO_QUERY);
+uno::Reference zOrder1(getShape(2), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, 
"ZOrder")); // lower
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, 
"ZOrder")); // higher
+CPPUNIT_ASSERT_EQUAL(OUString("HeaderImage"),
+ getProperty(zOrder0, "LinkDisplayName"));
+CPPUNIT_ASSERT_EQUAL(OUString("BodyBlueRectangle"),
+ getProperty(zOrder1,"LinkDisplayName"));
+// The logo should not be opaque since it is in the header.
+CPPUNIT_ASSERT(!getProperty(zOrder0, "Opaque")); // logo should be 
invisible
+CPPUNIT_ASSERT(!getProperty(zOrder1, "Opaque"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
 {
 // Without the accompanying fix in place, this test would have crashed,
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index 386ac693d81b..f64bef09e958 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1602,7 +1602,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
 {
 // tdf#137850: Word >= 2013 seems to ignore bBehindDoc 
except for wrapNone, but older versions honour it.
 if (m_pImpl->m_bBehindDoc && 
m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() > 14)
-m_pImpl->m_bOpaque = true;
+m_pImpl->m_bOpaque = 
!m_pImpl->m_rDomainMapper.IsInHeaderFooter();
 }
 break;
 }
@@ -1720,7 +1720,7 @@ void GraphicImport::lcl_sprm(Sprm& rSprm)
 case NS_ooxml::LN_EG_WrapType_wrapTopAndBottom:
 // tdf#137850: Word >= 2013 seems to ignore bBehindDoc except for 
wrapNone, but older versions honour it.
 if (m_pImpl->m_bBehindDoc && 
m_pImpl->m_rDomainMapper.GetSettingsTable()->GetWordCompatibilityMode() > 14)
- m_pImpl->m_bOpaque = true;
+ m_pImpl->m_bOpaque = 
!m_pImpl->m_rDomainMapper.IsInHeaderFooter();
 m_pImpl->m_nWrap = text::WrapTextMode_NONE;
 break;
 case NS_ooxml::LN_CT_GraphicalObject_graphicData:


core.git: sw/qa writerfilter/inc writerfilter/source

2024-02-29 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx  |   15 ++
 writerfilter/inc/dmapper/GraphicZOrderHelper.hxx|   10 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx   |8 +
 writerfilter/source/dmapper/GraphicHelpers.cxx  |   58 
+-
 writerfilter/source/dmapper/GraphicImport.cxx   |   27 
 6 files changed, 89 insertions(+), 29 deletions(-)

New commits:
commit 9aa7dc185af99a540926cc699193449177050386
Author: Justin Luth 
AuthorDate: Tue Feb 27 19:56:32 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 01:36:30 2024 +0100

tdf#159158 writerfilter: headers always under other z-orders

I guessed that a negative z-order will be below
a positive relativeHeight when it is in the header.
It seems like a reasonable assumption.
No unit tests hit this situation AFAIK.

make CppunitTest_sw_ooxmlexport18 \
CPPUNIT_TEST_NAME=testTdf159158_zOrder_headerBehind

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt 
b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt
new file mode 100644
index ..a4bf98a1f7aa
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf159158_zOrder_headerBehind.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 084863c144f4..91fa26ea0a47 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -1032,6 +1032,21 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_behindDocB, "tdf159158_zOrder_behi
 CPPUNIT_ASSERT_EQUAL(OUString("5-Point Star Blue"), 
getProperty(zOrder1,"Name"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf159158_zOrder_headerBehind, 
"tdf159158_zOrder_headerBehind.odt")
+{
+// given a blue star (not marked as behind text) anchored in the header
+// and an overlapping yellow rectangle anchored in the body text.
+// (note that in ODT format the star is on top, but for DOCX format it 
must be behind (hidden)
+uno::Reference zOrder0(getShape(1), uno::UNO_QUERY);
+uno::Reference zOrder1(getShape(2), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(zOrder0, 
"ZOrder")); // lower
+CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(zOrder1, 
"ZOrder")); // higher
+// I don't know why the star is the lowest order in ODT import (maybe 
header weirdness),
+// but it certainly needs to be the lowest on docx round-trip (also for 
header weirdness)
+CPPUNIT_ASSERT_EQUAL(OUString("StarInHeader"), 
getProperty(zOrder0, "Name"));
+CPPUNIT_ASSERT_EQUAL(OUString("RectangleInBody"), 
getProperty(zOrder1,"Name"));
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf155903, "tdf155903.odt")
 {
 // Without the accompanying fix in place, this test would have crashed,
diff --git a/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx 
b/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx
index c6a308ddf819..b5bb27eea81b 100644
--- a/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx
+++ b/writerfilter/inc/dmapper/GraphicZOrderHelper.hxx
@@ -17,11 +17,15 @@ class GraphicZOrderHelper
 {
 public:
 void addItem(css::uno::Reference const& props,
- sal_Int32 relativeHeight);
-sal_Int32 findZOrder(sal_Int32 relativeHeight, bool bOldStyle = false);
+ sal_Int64 relativeHeight);
+
+// must run adjustRelativeHeight before findZOrder - to set zOrder 
priorities
+static void adjustRelativeHeight(sal_Int64& rRelativeHeight, bool 
bIsZIndex, bool bIsBehindText,
+ bool bIsInHeader);
+sal_Int32 findZOrder(sal_Int64 relativeHeight, bool bOldStyle = false);
 
 private:
-using Items = std::map>;
+using Items = std::map>;
 Items m_items;
 };
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 45ff00958083..bbdfbd35c34a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4763,8 +4763,10 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 if (rProp.Name == "VML-Z-ORDER")
 {
 GraphicZOrderHelper& rZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
-sal_Int32 zOrder(0);
+sal_Int64 zOrder(0);
 rProp.Value >>= zOrder;
+GraphicZOrderHelper::adj

core.git: writerfilter/source

2024-02-29 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper.cxx  |4 +--
 writerfilter/source/dmapper/DomainMapper.hxx  |2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   12 +--
 writerfilter/source/dmapper/GraphicImport.cxx |   23 +++---
 4 files changed, 21 insertions(+), 20 deletions(-)

New commits:
commit 027632ec97ad556606997254244c76c7474d9122
Author: Justin Luth 
AuthorDate: Thu Feb 29 08:42:07 2024 -0500
Commit: Justin Luth 
CommitDate: Fri Mar 1 01:29:58 2024 +0100

NFC prepwork for tdf#159158: flatten writerfilter applyZOrder

limit code shuffle in the fix itself

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

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 239ecde547d4..3548ece176ed 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -4908,11 +4908,11 @@ SettingsTablePtr const & 
DomainMapper::GetSettingsTable()
 return m_pImpl->GetSettingsTable();
 }
 
-GraphicZOrderHelper* DomainMapper::graphicZOrderHelper()
+GraphicZOrderHelper& DomainMapper::graphicZOrderHelper()
 {
 if (m_zOrderHelper == nullptr)
 m_zOrderHelper.reset( new GraphicZOrderHelper );
-return m_zOrderHelper.get();
+return *m_zOrderHelper;
 }
 
 uno::Reference DomainMapper::PopPendingShape()
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx 
b/writerfilter/source/dmapper/DomainMapper.hxx
index db29f10d45eb..9d9771e640f5 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -107,7 +107,7 @@ public:
 OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, 
bool bAlwaysCreate );
 StyleSheetTablePtr const & GetStyleSheetTable( );
 SettingsTablePtr const & GetSettingsTable();
-GraphicZOrderHelper* graphicZOrderHelper();
+GraphicZOrderHelper& graphicZOrderHelper();
 
 /// Return the first from the pending (not inserted to the document) 
shapes, if there are any.
 css::uno::Reference PopPendingShape();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0b1ff5e0e6e3..45ff00958083 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4762,12 +4762,12 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 {
 if (rProp.Name == "VML-Z-ORDER")
 {
-GraphicZOrderHelper* pZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
+GraphicZOrderHelper& rZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
 sal_Int32 zOrder(0);
 rProp.Value >>= zOrder;
 xShapePropertySet->setPropertyValue("ZOrder",
-uno::Any(pZOrderHelper->findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
-pZOrderHelper->addItem(xShapePropertySet, zOrder);
+uno::Any(rZOrderHelper.findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
+rZOrderHelper.addItem(xShapePropertySet, zOrder);
 xShapePropertySet->setPropertyValue(getPropertyName( 
PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
 checkZOrderStatus = true;
 }
@@ -4807,12 +4807,12 @@ void DomainMapper_Impl::PushShapeContext( const 
uno::Reference< drawing::XShape
 {
 if (rProp.Name == "VML-Z-ORDER")
 {
-GraphicZOrderHelper* pZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
+GraphicZOrderHelper& rZOrderHelper = 
m_rDMapper.graphicZOrderHelper();
 sal_Int32 zOrder(0);
 rProp.Value >>= zOrder;
 xShapePropertySet->setPropertyValue("ZOrder",
-uno::Any(pZOrderHelper->findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
-pZOrderHelper->addItem(xShapePropertySet, zOrder);
+uno::Any(rZOrderHelper.findZOrder(zOrder, 
/*LastDuplicateWins*/true)));
+rZOrderHelper.addItem(xShapePropertySet, zOrder);
 xShapePropertySet->setPropertyValue(getPropertyName( 
PROP_OPAQUE ), uno::Any( zOrder >= 0 ) );
 checkZOrderStatus = true;
 }
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx 
b/writerfilter/source/dmapper/GraphicImport.cxx
index c11717b4048a..

core.git: Branch 'distro/collabora/co-23.05' - sd/source

2024-02-28 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 5e7a86d54789252877072ec8d4c0812247bf1683
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Miklos Vajna 
CommitDate: Thu Feb 29 08:23:36 2024 +0100

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

A separate unit test was provided with
https://gerrit.libreoffice.org/c/core/+/164070

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164069
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164077
Reviewed-by: Miklos Vajna 

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 0c0786d3eebb..1f5ada44cf33 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: sd/qa

2024-02-27 Thread Justin Luth (via logerrit)
 sd/qa/uitest/data/tdf159927_dateTime.odp |binary
 sd/qa/uitest/impress_tests/tdf159927_dateTime.py |   28 +++
 2 files changed, 28 insertions(+)

New commits:
commit 0c643e8afdf8b0b929b603340979e771eeb9fc0b
Author: Justin Luth 
AuthorDate: Tue Feb 27 13:45:38 2024 -0500
Commit: Justin Luth 
CommitDate: Wed Feb 28 03:32:51 2024 +0100

tdf#159927 unit test for impress date/time language detection

make -srj1 UITest_impress_tests \
UITEST_TEST_NAME="tdf159927_dateTime.tdf159927.test_tdf159927" \
SAL_USE_VCLPLUGIN=gen

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

diff --git a/sd/qa/uitest/data/tdf159927_dateTime.odp 
b/sd/qa/uitest/data/tdf159927_dateTime.odp
new file mode 100644
index ..a04816608495
Binary files /dev/null and b/sd/qa/uitest/data/tdf159927_dateTime.odp differ
diff --git a/sd/qa/uitest/impress_tests/tdf159927_dateTime.py 
b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py
new file mode 100644
index ..1a72d1997b75
--- /dev/null
+++ b/sd/qa/uitest/impress_tests/tdf159927_dateTime.py
@@ -0,0 +1,28 @@
+# -*- 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 get_state_as_dict, get_url_for_data_file
+import time
+
+class tdf159927(UITestCase):
+
+   def test_tdf159927(self):
+with 
self.ui_test.load_file(get_url_for_data_file("tdf159927_dateTime.odp")) as 
document:
+
+with 
self.ui_test.execute_dialog_through_command(".uno:HeaderAndFooter", 
close_button="cancel") as xDialog:
+language_list = xDialog.getChild("language_list")
+# Expected: the existing language of the date/time field: 
Finnish
+# Actual without the fix: the user's locale as specified in 
tools - options.
+
self.assertEqual(get_state_as_dict(language_list)["SelectEntryText"], "Finnish")
+
+#time.sleep(2)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


core.git: Branch 'distro/collabora/co-24.04' - sd/source

2024-02-27 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 62ae4d01dd06629413af7316ffb6a8030acf83e9
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Justin Luth 
CommitDate: Wed Feb 28 03:32:22 2024 +0100

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

Change-Id: Ida44957013978720ad12fadc9b4ebc88bc10ea40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164045
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164069
Tested-by: Jenkins CollaboraOffice 

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8401ec38cd6e..92f7e9be1cb0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: sd/source

2024-02-27 Thread Justin Luth (via logerrit)
 sd/source/ui/dlg/headerfooterdlg.cxx |   22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 62323124f54885c6de4ac4fa38052d380309a5a1
Author: Justin Luth 
AuthorDate: Tue Feb 27 09:57:35 2024 -0500
Commit: Justin Luth 
CommitDate: Wed Feb 28 00:23:11 2024 +0100

tdf#159927 sd headerfooterdlg: detect existing date/time language

Sometimes it was hard to change an existing foreign language
to your own language for Impress' header/footer fields.

The function was only checking the first master slide for the
date/time language. If it didn't have one, then the default locale
was selected.

However, although all pages share the same date/time language,
it is not necessary for all (or even the first) master slide
to have a date/time field. So check through all the master slides
until one with a date/time is found.

Obviously if none have one defined things still work OK,
because that is effectively how it was working beforehand.

I don't have much hope for a successful unit test.
I'll try to develop it as a follow-up to this patch.

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

diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 8401ec38cd6e..92f7e9be1cb0 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -151,7 +151,8 @@ private:
 
 void FillFormatList(sal_Int32 nSelectedPos);
 void GetOrSetDateTimeLanguage( LanguageType , bool bSet );
-void GetOrSetDateTimeLanguage( LanguageType , bool bSet, SdPage* 
pPage );
+// returns true if the page has a date/time field item
+bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
 HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
@@ -535,25 +536,29 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 }
 else
 {
-// get the language from the first master page
-// or set it to all master pages
-sal_uInt16 nPageCount = bSet ? mpDoc->GetMasterSdPageCount( 
PageKind::Notes ) : 1;
+const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
 sal_uInt16 nPage;
 for( nPage = 0; nPage < nPageCount; nPage++ )
 {
-GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 
nPage, PageKind::Standard ) );
+SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
+
+// All pages must use the same language. If getting the language, 
only need to find one.
+if (!bSet && bHasDateFieldItem)
+break;
 }
 }
 }
 
-void HeaderFooterTabPage::GetOrSetDateTimeLanguage( LanguageType , 
bool bSet, SdPage* pPage )
+bool HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, 
bool bSet,
+   SdPage* pPage)
 {
 if( !pPage )
-return;
+return false;
 
 SdrTextObj* pObj = static_cast(pPage->GetPresObj( 
PresObjKind::DateTime ));
 if( !pObj )
-return;
+return false;
 
 Outliner* pOutl = mpDoc->GetInternalOutliner();
 pOutl->Init( OutlinerMode::TextObject );
@@ -623,6 +628,7 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType , boo
 
 pOutl->Clear();
 pOutl->Init( nOutlMode );
+return bHasDateFieldItem;
 }
 
 PresLayoutPreview::PresLayoutPreview()


core.git: oox/source

2024-02-27 Thread Justin Luth (via logerrit)
 oox/source/drawingml/fillproperties.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 5920bc2d1a624021a6f3eb42a56ce9b96b53a39f
Author: Justin Luth 
AuthorDate: Tue Feb 27 08:23:44 2024 -0500
Commit: Justin Luth 
CommitDate: Tue Feb 27 19:50:57 2024 +0100

address shortcoming: document why I avoided axials for transparency

Hmm, I like to complain when other people
don't comment on why certain situations are excluded,
and yet I did the same thing here.

Thanks vmiklos for pointing that out.

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index f24208722cb5..596e18f2176e 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -543,6 +543,10 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 
 // convert DrawingML angle (in 1/6 degrees) to API 
angle (in 1/10 degrees)
 aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( 
(8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 )));
+
+// If this is symmetrical, set it as an axial gradient for 
better UI/export.
+// There were chart2 unit test failures when doing this to 
transparent gradients
+// so just avoid that case.
 if (!bContainsTransparency)
 aGradient.tryToConvertToAxial();
 }


core.git: Branch 'libreoffice-24-2' - include/svx svx/source sw/source

2024-02-27 Thread Justin Luth (via logerrit)
 include/svx/sidebar/ValueSetWithTextControl.hxx  |1 -
 svx/source/sidebar/tools/ValueSetWithTextControl.cxx |9 -
 sw/source/uibase/sidebar/PageSizeControl.cxx |1 -
 3 files changed, 11 deletions(-)

New commits:
commit 759c9ea8e66b5fc1a362cf914055ac498fbbd80a
Author: Justin Luth 
AuthorDate: Mon Feb 26 11:09:59 2024 -0500
Commit: Xisco Fauli 
CommitDate: Tue Feb 27 09:27:32 2024 +0100

tdf#159865 Revert "tdf#136905 NBB: let ValueSetWithTextControl set optimal"

...height

This reverts my 24.2 commit 1876feb8a8805b2f80537e2828c152ccbdf67fe2.

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

diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx 
b/include/svx/sidebar/ValueSetWithTextControl.hxx
index 407e9606757f..ac397f9fdab6 100644
--- a/include/svx/sidebar/ValueSetWithTextControl.hxx
+++ b/include/svx/sidebar/ValueSetWithTextControl.hxx
@@ -40,7 +40,6 @@ public:
 
 SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* 
pDrawingArea) override;
 
-void SetOptimalDrawingAreaHeight();
 void AddItem(const OUString& rItemText, const OUString& rItemText2);
 
 SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx 
b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index 91cea51325e6..b5b1f2be3ce9 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -43,15 +43,6 @@ void 
ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
 SetColCount();
 }
 
-void ValueSetWithTextControl::SetOptimalDrawingAreaHeight()
-{
-const vcl::Font 
aFont(Application::GetSettings().GetStyleSettings().GetLabelFont());
-const sal_Int32 nRowHeight = aFont.GetFontSize().Height() * 9 / 4; // see 
UserDraw()
-const Size aSize(GetOutputSizePixel().Width(), nRowHeight * 
maItems.size());
-GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
-SetOutputSizePixel(aSize);
-}
-
 void ValueSetWithTextControl::AddItem(
 const OUString& rItemText,
 const OUString& rItemText2 )
diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx 
b/sw/source/uibase/sidebar/PageSizeControl.cxx
index 4ea5995c098f..a2dbe406f335 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -168,7 +168,6 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, 
weld::Widget* pParent)
 }
 mxSizeValueSet->SetNoSelection();
 mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) );
-mxSizeValueSet->SetOptimalDrawingAreaHeight();
 mxSizeValueSet->Show();
 mxSizeValueSet->Resize();
 


core.git: sw/source

2024-02-26 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/rtfattributeoutput.cxx |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 6931d41640e31db4f1ad07afb48ec4df7086f6bb
Author: Justin Luth 
AuthorDate: Mon Feb 26 15:28:10 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:45:44 2024 +0100

address nit: use boolean flag instead of minor copy/paste

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

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 0f2885068d12..36bb03149c06 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3760,13 +3760,11 @@ void RtfAttributeOutput::FormatFillGradient(const 
XFillGradientItem& rFillGradie
 std::make_pair("fillAngle"_ostr, 
OString::number(nAngle)));
 }
 
+bool bIsSymmetrical = true;
 if (rColorStops.size() < 3)
 {
-if (rGradient.GetGradientStyle() == awt::GradientStyle_AXIAL)
-{
-m_aFlyProperties.push_back(
-std::make_pair("fillFocus"_ostr, 
OString::number(50)));
-}
+if (rGradient.GetGradientStyle() != awt::GradientStyle_AXIAL)
+bIsSymmetrical = false;
 }
 else
 {
@@ -3774,15 +3772,18 @@ void RtfAttributeOutput::FormatFillGradient(const 
XFillGradientItem& rFillGradie
 // FillModel::pushToPropMap 'fFocus' value and usage.
 // The 2nd color is the in-between color, use it
 aMSOEndColor = Color(rColorStops[1].getStopColor());
-
-m_aFlyProperties.push_back(
-std::make_pair("fillFocus"_ostr, 
OString::number(50)));
 }
 
 m_aFlyProperties.push_back(std::make_pair(
 "fillColor"_ostr, 
OString::number(wwUtility::RGBToBGR(aMSOStartColor;
 m_aFlyProperties.push_back(std::make_pair(
 "fillBackColor"_ostr, 
OString::number(wwUtility::RGBToBGR(aMSOEndColor;
+
+if (bIsSymmetrical)
+{
+m_aFlyProperties.push_back(
+std::make_pair("fillFocus"_ostr, 
OString::number(50)));
+}
 }
 
 void RtfAttributeOutput::FormatBox(const SvxBoxItem& rBox)


core.git: sw/source writerfilter/source

2024-02-26 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/rtfattributeoutput.cxx |5 +++--
 writerfilter/source/rtftok/rtfsdrimport.cxx |3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 9348677e040927a736e70797d07bb1de32d729ca
Author: Justin Luth 
AuthorDate: Mon Feb 26 15:20:11 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:45:03 2024 +0100

address nit: use oox::drawingml::PER_DEGREE instead of 60,000

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

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 03fc0fa354cb..0f2885068d12 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -86,6 +86,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -3752,11 +3753,11 @@ void RtfAttributeOutput::FormatFillGradient(const 
XFillGradientItem& rFillGradie
 const Color aMSOStartColor(rColorStops.back().getStopColor());
 Color aMSOEndColor(rColorStops.front().getStopColor());
 
-const sal_Int32 nAngle = toDegrees(rGradient.GetAngle());
+const sal_Int32 nAngle = toDegrees(rGradient.GetAngle()) * 
oox::drawingml::PER_DEGREE;
 if (nAngle != 0)
 {
 m_aFlyProperties.push_back(
-std::make_pair("fillAngle"_ostr, 
OString::number(nAngle * 6)));
+std::make_pair("fillAngle"_ostr, 
OString::number(nAngle)));
 }
 
 if (rColorStops.size() < 3)
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 9c673e871835..812a8e69f318 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -42,6 +42,7 @@
 #include "rtfreferenceproperties.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -668,7 +669,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, 
ShapeOrPict const shap
 }
 else if (rProperty.first == "fillAngle")
 {
-aFillModel.moAngle = rProperty.second.toInt32() / 6;
+aFillModel.moAngle = rProperty.second.toInt32() / 
oox::drawingml::PER_DEGREE;
 }
 else if (rProperty.first == "fillFocus")
 aFillModel.moFocus = rProperty.second.toDouble() / 100; // percent


core.git: sw/source

2024-02-26 Thread Justin Luth (via logerrit)
 sw/source/filter/ww8/docxexport.cxx |  100 +++-
 sw/source/filter/ww8/docxexport.hxx |3 +
 2 files changed, 56 insertions(+), 47 deletions(-)

New commits:
commit 2e073dc313cb2beaa7e4d2aef8584e7f76e9edee
Author: Justin Luth 
AuthorDate: Mon Feb 26 14:24:14 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:44:16 2024 +0100

address nit: create separate WriteDocumentBackgroundFill function

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

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 787c90e32b12..f1331ce4141e 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1901,63 +1901,69 @@ bool DocxExport::isMirroredMargin()
 return bMirroredMargins;
 }
 
-void DocxExport::WriteMainText()
+void DocxExport::WriteDocumentBackgroundFill()
 {
-// setup the namespaces
-m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces());
+const std::unique_ptr pBrush = getBackground();
+if (!pBrush)
+return;
 
-// reset the incrementing linked-textboxes chain ID before re-saving.
-m_nLinkedTextboxesChainId=0;
-m_aLinkedTextboxesHelper.clear();
+m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, 
XML_color),
+  
msfilter::util::ConvertColor(pBrush->GetColor()));
 
-// Write background page color
-if (std::unique_ptr oBrush = getBackground(); oBrush)
+const SwAttrSet& rPageStyleAttrSet = 
m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet();
+const drawing::FillStyle eFillType = 
rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue();
+const GraphicObject* pGraphicObj = pBrush->GetGraphicObject();
+if (pGraphicObj) // image/pattern/texture
 {
-m_pDocumentFS->startElementNS(XML_w, XML_background, FSNS(XML_w, 
XML_color),
-  
msfilter::util::ConvertColor(oBrush->GetColor()));
-
-const SwAttrSet& rPageStyleAttrSet = 
m_rDoc.GetPageDesc(0).GetMaster().GetAttrSet();
-const drawing::FillStyle eFillType = 
rPageStyleAttrSet.Get(XATTR_FILLSTYLE).GetValue();
-const GraphicObject* pGraphicObj = oBrush->GetGraphicObject();
-if (pGraphicObj) // image/pattern/texture
+const OUString aRelId = 
m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic());
+if (!aRelId.isEmpty())
 {
-const OUString aRelId = 
m_pDrawingML->writeGraphicToStorage(pGraphicObj->GetGraphic());
-if (!aRelId.isEmpty())
-{
-m_pDocumentFS->startElementNS(XML_v, XML_background);
+m_pDocumentFS->startElementNS(XML_v, XML_background);
 
-// Although MSO treats everything as tile, it is better for LO 
to not always tile
-OString sType = "frame"_ostr; // single image
-if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue())
-sType = "tile"_ostr; // primarily for patterns / textures
-m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, 
XML_id), aRelId,
-XML_type, sType);
+// Although MSO treats everything as tile, it is better for LO to 
not always tile
+OString sType = "frame"_ostr; // single image
+if (rPageStyleAttrSet.Get(XATTR_FILLBMP_TILE).GetValue())
+sType = "tile"_ostr; // primarily for patterns / textures
+m_pDocumentFS->singleElementNS(XML_v, XML_fill, FSNS(XML_r, 
XML_id), aRelId, XML_type,
+   sType);
 
-m_pDocumentFS->endElementNS(XML_v, XML_background);
-}
-}
-else if (eFillType == drawing::FillStyle_GRADIENT)
-{
-SfxItemSetFixed 
aSet(m_rDoc.GetAttrPool());
-aSet.Set(rPageStyleAttrSet);
-
-// Collect all of the gradient attributes into SdrExporter() 
AttrLists
-m_pAttrOutput->OutputStyleItemSet(aSet, /*TestForDefault=*/true);
-assert(SdrExporter().getFlyAttrList().is() && "type and fillcolor 
are always provided");
-assert(SdrExporter().getFlyFillAttrList().is() && "color2 is 
always provided");
-
-rtl::Reference 
xFlyAttrList(SdrExporter().getFlyAttrList());
-rtl::Reference 
xFillAttrList(SdrExporter().getFlyFillAttrList());
-m_pDocumentFS->startElementNS(XML_v, XML_background, xFlyAttrList);
-m_pDocumentFS->singleElementNS(XML_v, XML_fill, xFillAttrList);
 m_pDocumentFS->endElementNS(XML_v, XML_background);
-
-

core.git: oox/source sw/qa

2024-02-26 Thread Justin Luth (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |2 +
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx |   30 +++
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx |   26 +++-
 sw/qa/extras/rtfexport/rtfexport.cxx  |   47 +++---
 sw/qa/extras/rtfexport/rtfexport8.cxx |   15 +
 5 files changed, 42 insertions(+), 78 deletions(-)

New commits:
commit 38083e4c0b5638d69162593c3fbf599da6cd499f
Author: Justin Luth 
AuthorDate: Tue Feb 20 16:11:08 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:40:50 2024 +0100

related tdf#126533 dml/vml import: import radials as radials

... and not as symmetrical linear gradients.

The benefit is that our export code
will be able to intelligently export it.

Apparently RTF export code does not intelligently export axials,
(now fixed - tdf#159824)
but VML and DML (and doc) do it well.

Unfortunately charts can be badly affected,
(avoided by ignoring when transparent)
and unit tests are implementation-tested...

This affects existing unit tests:
-tdf128345_Legend_CS_TG_axial.pptx: label imports fine:
lost on export (no change)
-tdf128345_ChartWall_CS_TG.pptx: wall gradient now looks axial:
lost on export (no change)
-textframe-gradient.docx: still round-trips OK: no change
-textframe-gradient.rtf: round-trips as linear: lost axial-ness
 (now fixed: tdf#159824)
-fdo78663.docx: textbox font fill: still exports as solid: no change

I ran the assert check against chart2, oox, and sw

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

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index dec9ab9672cc..f24208722cb5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -543,6 +543,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& 
rPropMap, const GraphicHelp
 
 // convert DrawingML angle (in 1/6 degrees) to API 
angle (in 1/10 degrees)
 aGradient.SetAngle(Degree10(static_cast< sal_Int16 >( 
(8100 - (nDmlAngle / (PER_DEGREE / 10))) % 3600 )));
+if (!bContainsTransparency)
+aGradient.tryToConvertToAxial();
 }
 
 if (awt::GradientStyle_RECT == aGradient.GetGradientStyle())
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index f8defa15d1a2..72072bc5bb03 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -577,34 +577,16 @@ DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, 
"textframe-gradient.docx")
 uno::Reference xFrame(getShape(1), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, 
getProperty(xFrame, "FillStyle"));
 awt::Gradient2 aGradient(getProperty(xFrame, 
"FillGradient"));
-
-// MCGR: Use the completely imported transparency gradient to check for 
correctness
-basegfx::BColorStops aColorStops = 
model::gradient::getColorStopsFromUno(aGradient.ColorStops);
-
-CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size());
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 
0.0));
-CPPUNIT_ASSERT_EQUAL(Color(0xd99594), 
Color(aColorStops[0].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 
0.5));
-CPPUNIT_ASSERT_EQUAL(Color(0xc0504d), 
Color(aColorStops[1].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 
1.0));
-CPPUNIT_ASSERT_EQUAL(Color(0xd99594), 
Color(aColorStops[2].getStopColor()));
-CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style);
+CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency, 
aGradient.StartColor));
+CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency, 
aGradient.EndColor));
+CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style);;
 
 xFrame.set(getShape(2), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, 
getProperty(xFrame, "FillStyle"));
 aGradient = getProperty(xFrame, "FillGradient");
-
-// MCGR: Use the completely imported transparency gradient to check for 
correctness
-aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops);
-
-CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size());
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 
0.0));
-CPPUNIT_ASSERT_EQUAL(Color(0x66), 
Color(aColorStops[0].getStopColor()));
-CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 
0.5));
-CPPUNIT_ASSERT_EQUAL(Color(0x00),

core.git: Branch 'distro/collabora/co-24.04' - sw/qa sw/source

2024-02-26 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/ww8export3.cxx |7 +++
 sw/source/filter/ww8/wrtw8esh.cxx |5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 9b6754db7659e8b192c36c36807729d6c37cf340
Author: Justin Luth 
AuthorDate: Mon Feb 26 09:56:11 2024 -0500
Commit: Miklos Vajna 
CommitDate: Tue Feb 27 08:38:07 2024 +0100

related tdf#126533 doc export: don't lose "tiled" aspect of image fill.

This affects patterns as well as textures/images.

make CppunitTest_sw_ww8export3 
CPPUNIT_TEST_NAME=testTdf101826_xattrTextBoxFill

Change-Id: I2742a6f333fc6688b3570772a1dbc8371741f210
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163948
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 93b14c1ba3afaf0a734ee5112444f0adbb35c428)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163970
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 97ea979d01e8..66c5ae5c471c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -621,6 +622,12 @@ DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, 
"tdf101826_xattrTextBoxFi
 CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != 
getProperty(getShape(4), "BackColor"));
 //Basic Picture Fill: Tux image
 CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", 
drawing::FillStyle_BITMAP, getProperty(getShape(5), 
"FillStyle"));
+// Basic Pattern fill: many thin, green, vertical stripes on yellow 
background
+auto eMode = getProperty(getShapeByName(u"Frame2"), 
"FillBitmapMode");
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled pattern", drawing::BitmapMode_REPEAT, 
eMode);
+// Basic Texture fill: tiled blue denim texture
+eMode = getProperty(getShapeByName(u"Frame6"), 
"FillBitmapMode");
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled texture", drawing::BitmapMode_REPEAT, 
eMode);
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, 
"tdf123433_fillStyleStop.doc")
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 19ac50ccf5c9..f9e1082f9276 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1849,8 +1849,9 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem 
,
 nOpaque = 255 - pGraphicObject->GetAttr().GetAlpha();
 if (0 != nOpaque)
 bSetOpacity = true;
-
-rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+const ESCHER_FillStyle eFillType
+= rBrush.GetGraphicPos() == GPOS_TILED ? ESCHER_FillTexture : 
ESCHER_FillPicture;
+rPropOpt.AddOpt(ESCHER_Prop_fillType, eFillType);
 rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
 rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
 }


core.git: include/svx svx/source sw/source

2024-02-26 Thread Justin Luth (via logerrit)
 include/svx/sidebar/ValueSetWithTextControl.hxx  |1 -
 svx/source/sidebar/tools/ValueSetWithTextControl.cxx |   11 ---
 sw/source/uibase/sidebar/PageSizeControl.cxx |1 -
 3 files changed, 13 deletions(-)

New commits:
commit 7c3cdc88337959ddbb9799c4cee57901e94719f3
Author: Justin Luth 
AuthorDate: Mon Feb 26 11:09:59 2024 -0500
Commit: Justin Luth 
CommitDate: Mon Feb 26 18:55:51 2024 +0100

tdf#159865 Revert "tdf#136905 NBB: let ValueSetWithTextControl set optimal"

...height

This reverts my 24.2 commit 1876feb8a8805b2f80537e2828c152ccbdf67fe2
(as well as my initial attempt to fix it in 24.8).

Change-Id: I70c3668393a13992f9ce489e86b07860218445b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163954
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 

diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx 
b/include/svx/sidebar/ValueSetWithTextControl.hxx
index 407e9606757f..ac397f9fdab6 100644
--- a/include/svx/sidebar/ValueSetWithTextControl.hxx
+++ b/include/svx/sidebar/ValueSetWithTextControl.hxx
@@ -40,7 +40,6 @@ public:
 
 SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* 
pDrawingArea) override;
 
-void SetOptimalDrawingAreaHeight();
 void AddItem(const OUString& rItemText, const OUString& rItemText2);
 
 SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override;
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx 
b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index d55740315c99..cddd7b0aa801 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -42,17 +42,6 @@ void 
ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea)
 SetColCount();
 }
 
-void ValueSetWithTextControl::SetOptimalDrawingAreaHeight()
-{
-const vcl::Font 
aFont(Application::GetSettings().GetStyleSettings().GetLabelFont());
-double fRowHeight = aFont.GetFontSize().Height() * 9 / 4.0; // see 
UserDraw()
-// It still looks too small. Probably the height specified should be the 
leading point size?
-fRowHeight *= 1.2; // add 20% leading
-const Size aSize(GetOutputSizePixel().Width(), fRowHeight * 
maItems.size());
-GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
-SetOutputSizePixel(aSize);
-}
-
 void ValueSetWithTextControl::AddItem(
 const OUString& rItemText,
 const OUString& rItemText2 )
diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx 
b/sw/source/uibase/sidebar/PageSizeControl.cxx
index 2591ffd99718..37ed1835e972 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -168,7 +168,6 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, 
weld::Widget* pParent)
 }
 mxSizeValueSet->SetNoSelection();
 mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) );
-mxSizeValueSet->SetOptimalDrawingAreaHeight();
 mxSizeValueSet->Show();
 mxSizeValueSet->Resize();
 


core.git: sw/qa sw/source

2024-02-26 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/ww8export3.cxx |7 +++
 sw/source/filter/ww8/wrtw8esh.cxx |5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 589ac948c0650a16c734db7337c6c31b950be151
Author: Justin Luth 
AuthorDate: Mon Feb 26 09:56:11 2024 -0500
Commit: Justin Luth 
CommitDate: Mon Feb 26 17:16:55 2024 +0100

related tdf#126533 doc export: don't lose "tiled" aspect of image fill.

This affects patterns as well as textures/images.

make CppunitTest_sw_ww8export3 
CPPUNIT_TEST_NAME=testTdf101826_xattrTextBoxFill

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

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 97ea979d01e8..66c5ae5c471c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -621,6 +622,12 @@ DECLARE_WW8EXPORT_TEST(testTdf101826_xattrTextBoxFill, 
"tdf101826_xattrTextBoxFi
 CPPUNIT_ASSERT_MESSAGE("background color", Color(0xFF, 0xFF, 0x00) != 
getProperty(getShape(4), "BackColor"));
 //Basic Picture Fill: Tux image
 CPPUNIT_ASSERT_EQUAL_MESSAGE("background image", 
drawing::FillStyle_BITMAP, getProperty(getShape(5), 
"FillStyle"));
+// Basic Pattern fill: many thin, green, vertical stripes on yellow 
background
+auto eMode = getProperty(getShapeByName(u"Frame2"), 
"FillBitmapMode");
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled pattern", drawing::BitmapMode_REPEAT, 
eMode);
+// Basic Texture fill: tiled blue denim texture
+eMode = getProperty(getShapeByName(u"Frame6"), 
"FillBitmapMode");
+CPPUNIT_ASSERT_EQUAL_MESSAGE("tiled texture", drawing::BitmapMode_REPEAT, 
eMode);
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, 
"tdf123433_fillStyleStop.doc")
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx 
b/sw/source/filter/ww8/wrtw8esh.cxx
index 7931387e32fa..55c140e2a7c9 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1849,8 +1849,9 @@ void SwBasicEscherEx::WriteBrushAttr(const SvxBrushItem 
,
 nOpaque = 255 - pGraphicObject->GetAttr().GetAlpha();
 if (0 != nOpaque)
 bSetOpacity = true;
-
-rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+const ESCHER_FillStyle eFillType
+= rBrush.GetGraphicPos() == GPOS_TILED ? ESCHER_FillTexture : 
ESCHER_FillPicture;
+rPropOpt.AddOpt(ESCHER_Prop_fillType, eFillType);
 rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
 rPropOpt.AddOpt( ESCHER_Prop_fillBackColor, 0 );
 }


  1   2   3   4   5   6   7   8   9   10   >