[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-09-21 Thread Justin Luth (via logerrit)
 sw/source/core/layout/paintfrm.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 20672741eded49de01e8b7bc660e115f404203aa
Author: Justin Luth 
AuthorDate: Mon Sep 20 15:25:01 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Sep 21 09:15:27 2021 +0200

Revert "tdf#99492 sw layout: always paint merged cell grids"

This reverts LO 7.1 commit c016fe2b5918d6e53113e100b1126076b6e1a6a3.

This failed for two reasons.
1.) If it is not a solid color (like a graphic for example)
then the graphic is going to be repeated in each cell.
2.) This is NOT actually repainting the visible cell's background.
It is painting the hidden cell - which MIGHT be different
from the visible cell (in the case of a solid color).

Since this will require a completely different approach,
I am just reverting this. Thanks Mike for finding an
example document that shows the flaws.

Change-Id: Icdc21e09118e7c33ac9f7ede23c913b95ad69c93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122366
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit eb830ad284f245165b6ab5e8647d48834622f2d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122281

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index d7ea6592d1c9..192afd6365fd 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6300,6 +6300,10 @@ void SwFrame::PaintSwFrameBackground( const SwRect 
, const SwPageFrame *pP
 return;
 }
 
+// nothing to do for covered table cells:
+if( IsCellFrame() && IsCoveredCell() )
+return;
+
 SwViewShell *pSh = gProp.pSGlobalShell;
 
 // #i16816# tagged pdf support


[Libreoffice-commits] core.git: framework/source

2021-10-01 Thread Justin Luth (via logerrit)
 framework/source/uielement/resourcemenucontroller.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 57f8b90d46756c22f01961260241fd2ab4bc64c5
Author: Justin Luth 
AuthorDate: Sat Sep 25 15:06:58 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Fri Oct 1 19:55:46 2021 +0200

tdf#127543 add saveacopy to Save dropdown menu

Why not? It usually doesn't exist in a nearby shortcut.

Change-Id: I3f9f0070c05bb1ce05795cabe8db0f95593ab5cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122606
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/framework/source/uielement/resourcemenucontroller.cxx 
b/framework/source/uielement/resourcemenucontroller.cxx
index 6e83ca846977..cebd11f03c19 100644
--- a/framework/source/uielement/resourcemenucontroller.cxx
+++ b/framework/source/uielement/resourcemenucontroller.cxx
@@ -400,6 +400,7 @@ void SaveAsMenuController::impl_setPopupMenu()
 
 pVCLPopupMenu->InsertItem( ".uno:SaveAs", nullptr );
 pVCLPopupMenu->InsertItem( ".uno:ExportTo", nullptr );
+pVCLPopupMenu->InsertItem( ".uno:SaveACopy", nullptr );
 pVCLPopupMenu->InsertItem( ".uno:SaveAsTemplate", nullptr );
 pVCLPopupMenu->InsertSeparator();
 pVCLPopupMenu->InsertItem( ".uno:SaveAsRemote", nullptr );


[Libreoffice-commits] core.git: sc/uiconfig sd/uiconfig sw/uiconfig

2021-09-26 Thread Justin Luth (via logerrit)
 sc/uiconfig/scalc/ui/notebookbar_compact.ui|2 +-
 sd/uiconfig/sdraw/ui/notebookbar_compact.ui|2 +-
 sd/uiconfig/simpress/ui/notebookbar_compact.ui |2 +-
 sw/uiconfig/swriter/ui/notebookbar_compact.ui  |1 +
 4 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a0cc67350a56a77a457a1236f414a579c148194a
Author: Justin Luth 
AuthorDate: Sat Sep 25 15:05:15 2021 +0200
Commit: Justin Luth 
CommitDate: Mon Sep 27 06:45:40 2021 +0200

tdf#127543 add saveacopy to File dropdown menu tabs #2

Invisible menu items just don't cut it.
This adds SaveACopy also to "Tabbed Compact"

Change-Id: If6e2807467e8885ab494b291e98778c7626ebe54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122605
Tested-by: Jenkins
Reviewed-by: Andreas Kainz 

diff --git a/sc/uiconfig/scalc/ui/notebookbar_compact.ui 
b/sc/uiconfig/scalc/ui/notebookbar_compact.ui
index 97084586f8f8..62ec2e2645a8 100644
--- a/sc/uiconfig/scalc/ui/notebookbar_compact.ui
+++ b/sc/uiconfig/scalc/ui/notebookbar_compact.ui
@@ -624,7 +624,7 @@
 
 
   
-False
+True
 False
 .uno:SaveACopy
   
diff --git a/sd/uiconfig/sdraw/ui/notebookbar_compact.ui 
b/sd/uiconfig/sdraw/ui/notebookbar_compact.ui
index 42fd5833d5f2..e3fd42bcfb87 100644
--- a/sd/uiconfig/sdraw/ui/notebookbar_compact.ui
+++ b/sd/uiconfig/sdraw/ui/notebookbar_compact.ui
@@ -503,7 +503,7 @@
 
 
   
-False
+True
 False
 .uno:SaveACopy
   
diff --git a/sd/uiconfig/simpress/ui/notebookbar_compact.ui 
b/sd/uiconfig/simpress/ui/notebookbar_compact.ui
index 0394e09918ec..06b923785a3a 100644
--- a/sd/uiconfig/simpress/ui/notebookbar_compact.ui
+++ b/sd/uiconfig/simpress/ui/notebookbar_compact.ui
@@ -502,7 +502,7 @@
 
 
   
-False
+True
 False
 .uno:SaveACopy
   
diff --git a/sw/uiconfig/swriter/ui/notebookbar_compact.ui 
b/sw/uiconfig/swriter/ui/notebookbar_compact.ui
index b647b3203d8f..da4803483030 100644
--- a/sw/uiconfig/swriter/ui/notebookbar_compact.ui
+++ b/sw/uiconfig/swriter/ui/notebookbar_compact.ui
@@ -206,6 +206,7 @@
 
 
   
+True
 False
 .uno:SaveACopy
   


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source

2021-10-25 Thread Justin Luth (via logerrit)
 sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt |binary
 sw/qa/extras/odfexport/odfexport2.cxx|   12 
 sw/source/filter/xml/xmltbli.cxx |2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit d3b4ef0f7726ef1619717d9e3327963ceb4c065a
Author: Justin Luth 
AuthorDate: Fri Oct 22 21:11:59 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Oct 25 10:16:53 2021 +0200

tdf#131025 ODF import: recognize SV_COUNTRY_LANGUAGE_OFFSET

File import was making an exception for "float value 0"
if the accompanying text had no resemblance to the value 0,
but that only applied to GENERAL number format.

It should apply to any language's default number format.

REGRESSION warning: as we can see, this has been handled
inconsistently in the past. But from the coding exception to overcome
losing text to a zero (and the huge number of duplicate bugs)
the best choice seems to be ignore the spec that says that
a number value overrides the text value - at least in
the case where the number value is zero.

Change-Id: I701e72c6a5dad42c7799ab501255a4859adf61d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124080
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit 3e1d316734354c6b49696c8904e0fc431cfb5143)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124014
Reviewed-by: Xisco Fauli 

diff --git a/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
new file mode 100644
index ..f2bffb050ac4
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 3b1a7b8c527d..e58c460f0f7e 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -8,7 +8,9 @@
  */
 
 #include 
+#include 
 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -49,6 +51,16 @@ DECLARE_ODFEXPORT_TEST(testTdf104254_noHeaderWrapping, 
"tdf104254_noHeaderWrappi
 CPPUNIT_ASSERT_MESSAGE("Paragraph should fit on a single line", 
nParaHeight < 600);
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, 
"tdf131025_noZerosInTable.odt")
+{
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTables = 
xSupplier->getTextTables();
+uno::Reference xTable(xTables->getByName("Table1"), 
uno::UNO_QUERY);
+
+uno::Reference xCell(xTable->getCellByName("C3"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString());
+}
+
 DECLARE_ODFEXPORT_TEST(testTdf137199, "tdf137199.docx")
 {
 CPPUNIT_ASSERT_EQUAL(OUString(">1<"), 
getProperty(getParagraph(1), "ListLabelString"));
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 560fe1c81e1f..fc61659c5972 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1928,7 +1928,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 {
 const SwTableBoxNumFormat* pNumFormat =
 static_cast( pItem );
-if( ( pNumFormat != nullptr ) && ( pNumFormat->GetValue() == 0 
) )
+if (pNumFormat && (pNumFormat->GetValue() % 
SV_COUNTRY_LANGUAGE_OFFSET) == 0)
 {
 // only one text node?
 SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );


[Libreoffice-commits] core.git: sc/source

2021-12-17 Thread Justin Luth (via logerrit)
 sc/source/ui/view/output.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit b58dbb862296b63f3f2395c59d30fba40fa5f59f
Author: Justin Luth 
AuthorDate: Fri Dec 17 11:47:55 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Dec 17 12:40:23 2021 +0100

tdf#58125 sc: don't show comment notifier for hidden columns

This fixes a LO 3.6-ish regression.

Things have changed a lot since then. I assume that pCell
was empty when it was hidden. The test for pCell was
removed in commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094,
which was in the range that bibisect suggested.

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

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index d5e5d24464ae..fe6b3c278884 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2327,11 +2327,10 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& 
rRenderContext)
 SCCOL nMergeX = nX;
 SCROW nMergeY = nY;
 mpDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
-// use origin's pCell for NotePtr test below
 }
 
-if ( mpDoc->GetNote(nX, pRowInfo[nArrY].nRowNo, nTab) && ( 
bIsMerged ||
-( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
+if (!mpDoc->ColHidden(nX, nTab) && mpDoc->GetNote(nX, 
pRowInfo[nArrY].nRowNo, nTab)
+&& (bIsMerged || (!pInfo->bHOverlapped && 
!pInfo->bVOverlapped)))
 {
 if (bFirst)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source

2021-12-20 Thread Justin Luth (via logerrit)
 sw/source/core/docnode/ndtbl1.cxx |   34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

New commits:
commit f314a882c96cc0e951fecb83be73a03ef3f33da1
Author: Justin Luth 
AuthorDate: Thu Dec 16 15:36:59 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Dec 20 14:13:53 2021 +0100

related tdf#90805 sw table: ensure border when setting border color

When using uno:FrameLineColor to set a table's border color,
add hairline borders if there are none at all.

Change-Id: Ib2b2f8aff0052dc32b38486c98670ebff3bd6a4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126923
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127000

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 964b2cb610f2..d7f3c5419590 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -928,6 +928,8 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 
GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pTableNd));
 }
 
+const SvxBorderLine aHairlineBorder(pColor, SvxBorderLineWidth::Hairline);
+
 for( auto  : aUnions )
 {
 SwSelUnion *pUnion = 
@@ -946,24 +948,32 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 SwFrameFormat *pFormat = pCell->GetFormat();
 std::unique_ptr aBox(pFormat->GetBox().Clone());
 
+SvxBorderLine* pTop = const_cast(aBox->GetTop());
+SvxBorderLine* pBot = 
const_cast(aBox->GetBottom());
+SvxBorderLine* pLeft = const_cast(aBox->GetLeft());
+SvxBorderLine* pRight = 
const_cast(aBox->GetRight());
+
 if ( !pBorderLine && bSetLine )
 {
 aBox.reset(::GetDfltAttr(RES_BOX)->Clone());
 }
+else if (pColor && !pBorderLine && !pTop && !pBot && !pLeft && 
!pRight)
+{
+aBox->SetLine(, SvxBoxItemLine::TOP);
+aBox->SetLine(, SvxBoxItemLine::BOTTOM);
+aBox->SetLine(, SvxBoxItemLine::LEFT);
+aBox->SetLine(, SvxBoxItemLine::RIGHT);
+}
 else
 {
-if ( aBox->GetTop() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetTop()),
-pColor, pBorderLine );
-if ( aBox->GetBottom() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetBottom()),
-pColor, pBorderLine );
-if ( aBox->GetLeft() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetLeft()),
-pColor, pBorderLine );
-if ( aBox->GetRight() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetRight()),
-pColor, pBorderLine );
+if (pTop)
+::lcl_SetLineStyle(pTop, pColor, pBorderLine);
+if (pBot)
+::lcl_SetLineStyle(pBot, pColor, pBorderLine);
+if (pLeft)
+::lcl_SetLineStyle(pLeft, pColor, pBorderLine);
+if (pRight)
+::lcl_SetLineStyle(pRight, pColor, pBorderLine);
 }
 pFormat->SetFormatAttr( *aBox );
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source

2021-12-20 Thread Justin Luth (via logerrit)
 sw/source/uibase/shells/frmsh.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 68fdfc6013126526f5ba3908c5ad762f18f463cf
Author: Justin Luth 
AuthorDate: Thu Dec 16 11:45:15 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Dec 20 14:13:06 2021 +0100

tdf#90805 sw: if no border when adding border color, add hairline

Due to things like tdf#90070 (since LO scales down an image when
adding a border), only make this a hairline border.
Otherwise, a larger default would seem reasonable...

From what I can tell, SID_FRAME_LINECOLOR
in SwFrameShell::ExecFrameStyle affects frames and images
and OLE objects.

Change-Id: Icd72cecb7ebd7fc8b236fb5b8ebd14771399f94d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126910
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126999
Tested-by: Jenkins

diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 4463908f4b22..997e40a07da5 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1219,6 +1219,9 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
 {
 aBorderLine.SetColor( rNewColor );
+
aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
+aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
+
 aBoxItem->SetLine(, SvxBoxItemLine::TOP);
 aBoxItem->SetLine(, 
SvxBoxItemLine::BOTTOM);
 aBoxItem->SetLine(, SvxBoxItemLine::LEFT);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source

2021-12-20 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   19 +++
 sw/source/core/swg/SwXMLTextBlocks1.cxx |   16 +---
 2 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit d8cf8482ae5ed72dc969d9adb47c113c442452be
Author: Justin Luth 
AuthorDate: Fri Dec 17 18:45:42 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Dec 20 13:54:05 2021 +0100

tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"

This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.

It caused the regression documented in bug 144364.

Change-Id: I044c49e42873db120a94d93a00e9b35105778b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127012
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126982
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127147

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 514a13e88ff1..b536692fc5a6 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1689,6 +1689,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629)
 CPPUNIT_ASSERT_EQUAL(1, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144364)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtSh);
+
+// expands autotext (via F3)
+pWrtSh->Insert("AR");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
+Scheduler::ProcessEventsToIdle();
+
+// was ...'letter of '
+CPPUNIT_ASSERT_EQUAL(
+OUString("We hereby acknowledge the receipt of your letter of 
."),
+getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
 SwDoc* const pDoc = createSwDoc();
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx 
b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 0297d68fa442..589d4e192097 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 uno::Reference< uno::XComponentContext > xContext =
 comphelper::getProcessComponentContext();
 
+// get parser
+uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create( xContext );
+
 // create descriptor and reference to it. Either
 // both or neither must be kept because of the
 // reference counting!
@@ -206,15 +210,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 OUString sFilterComponent = bOasis
 ? 
OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
 : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
-uno::Reference< xml::sax::XFastParser > xFilter(
+uno::Reference< xml::sax::XDocumentHandler > xFilter(
 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
 sFilterComponent, aFilterArguments, xContext),
-UNO_QUERY_THROW );
+UNO_QUERY );
+OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+if ( !xFilter.is() )
+return ERR_SWG_READ_ERROR;
+
+// connect parser and filter
+xParser->setDocumentHandler( xFilter );
 
 // parse the stream
 try
 {
-xFilter->parseStream( aParserInput );
+xParser->parseStream( aParserInput );
 }
 catch( xml::sax::SAXParseException& )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2021-12-17 Thread Justin Luth (via logerrit)
 sc/source/ui/view/output.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 13814db571b1d08a7f301cd2de3618a387d9dfe4
Author: Justin Luth 
AuthorDate: Fri Dec 17 11:47:55 2021 +0200
Commit: Xisco Fauli 
CommitDate: Fri Dec 17 23:05:12 2021 +0100

tdf#58125 sc: don't show comment notifier for hidden columns

This fixes a LO 3.6-ish regression.

Things have changed a lot since then. I assume that pCell
was empty when it was hidden. The test for pCell was
removed in commit c06dbbe7594c2a0b5a5b19f8e183d9c421e6e094,
which was in the range that bibisect suggested.

Change-Id: I0af137358335a808de90a71f5c113fabcf24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127001
Reviewed-by: Justin Luth 
Tested-by: Jenkins
(cherry picked from commit b58dbb862296b63f3f2395c59d30fba40fa5f59f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126975
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index d5e5d24464ae..fe6b3c278884 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -2327,11 +2327,10 @@ void ScOutputData::DrawNoteMarks(vcl::RenderContext& 
rRenderContext)
 SCCOL nMergeX = nX;
 SCROW nMergeY = nY;
 mpDoc->ExtendOverlapped( nMergeX, nMergeY, nX, nY, nTab );
-// use origin's pCell for NotePtr test below
 }
 
-if ( mpDoc->GetNote(nX, pRowInfo[nArrY].nRowNo, nTab) && ( 
bIsMerged ||
-( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) )
+if (!mpDoc->ColHidden(nX, nTab) && mpDoc->GetNote(nX, 
pRowInfo[nArrY].nRowNo, nTab)
+&& (bIsMerged || (!pInfo->bHOverlapped && 
!pInfo->bVOverlapped)))
 {
 if (bFirst)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa sw/source

2021-12-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   19 +++
 sw/source/core/swg/SwXMLTextBlocks1.cxx |   16 +---
 2 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 97783676a85ea49aee856b5bd7193a4911856946
Author: Justin Luth 
AuthorDate: Fri Dec 17 18:45:42 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon Dec 20 08:32:24 2021 +0100

tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"

This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.

It caused the regression documented in bug 144364.

Change-Id: I044c49e42873db120a94d93a00e9b35105778b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127012
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126982
Reviewed-by: Noel Grandin 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 43ef4250aaba..978c61255354 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1905,6 +1905,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf116315)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144364)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtSh);
+
+// expands autotext (via F3)
+pWrtSh->Insert("AR");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
+Scheduler::ProcessEventsToIdle();
+
+// was ...'letter of '
+CPPUNIT_ASSERT_EQUAL(
+OUString("We hereby acknowledge the receipt of your letter of 
."),
+getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
 SwDoc* const pDoc = createSwDoc();
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx 
b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 9f0c6cb545af..36ff82236c9e 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 uno::Reference< uno::XComponentContext > xContext =
 comphelper::getProcessComponentContext();
 
+// get parser
+uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create( xContext );
+
 // create descriptor and reference to it. Either
 // both or neither must be kept because of the
 // reference counting!
@@ -205,15 +209,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 OUString sFilterComponent = bOasis
 ? 
OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
 : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
-uno::Reference< xml::sax::XFastParser > xFilter(
+uno::Reference< xml::sax::XDocumentHandler > xFilter(
 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
 sFilterComponent, aFilterArguments, xContext),
-UNO_QUERY_THROW );
+UNO_QUERY );
+OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+if ( !xFilter.is() )
+return ERR_SWG_READ_ERROR;
+
+// connect parser and filter
+xParser->setDocumentHandler( xFilter );
 
 // parse the stream
 try
 {
-xFilter->parseStream( aParserInput );
+xParser->parseStream( aParserInput );
 }
 catch( xml::sax::SAXParseException& )
 {


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

2021-12-17 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   19 +++
 sw/source/core/swg/SwXMLTextBlocks1.cxx |   16 +---
 2 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218
Author: Justin Luth 
AuthorDate: Fri Dec 17 18:45:42 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Dec 18 06:46:19 2021 +0100

tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"

This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.

It caused the regression documented in bug 144364.

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

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index ca37d6ffa53e..3589d4d9f23c 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1939,6 +1939,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf116315)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144364)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtSh);
+
+// expands autotext (via F3)
+pWrtSh->Insert("AR");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
+Scheduler::ProcessEventsToIdle();
+
+// was ...'letter of '
+CPPUNIT_ASSERT_EQUAL(
+OUString("We hereby acknowledge the receipt of your letter of 
."),
+getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
 SwDoc* const pDoc = createSwDoc();
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx 
b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 9f0c6cb545af..36ff82236c9e 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 uno::Reference< uno::XComponentContext > xContext =
 comphelper::getProcessComponentContext();
 
+// get parser
+uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create( xContext );
+
 // create descriptor and reference to it. Either
 // both or neither must be kept because of the
 // reference counting!
@@ -205,15 +209,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 OUString sFilterComponent = bOasis
 ? 
OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
 : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
-uno::Reference< xml::sax::XFastParser > xFilter(
+uno::Reference< xml::sax::XDocumentHandler > xFilter(
 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
 sFilterComponent, aFilterArguments, xContext),
-UNO_QUERY_THROW );
+UNO_QUERY );
+OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+if ( !xFilter.is() )
+return ERR_SWG_READ_ERROR;
+
+// connect parser and filter
+xParser->setDocumentHandler( xFilter );
 
 // parse the stream
 try
 {
-xFilter->parseStream( aParserInput );
+xParser->parseStream( aParserInput );
 }
 catch( xml::sax::SAXParseException& )
 {


[Libreoffice-commits] core.git: editeng/source include/editeng sd/source

2021-12-20 Thread Justin Luth (via logerrit)
 editeng/source/outliner/outlvw.cxx |   29 +
 include/editeng/outliner.hxx   |5 +
 sd/source/ui/func/fuolbull.cxx |   13 +
 3 files changed, 47 insertions(+)

New commits:
commit 12832284318125b8649f6a67e3aa12aa953afdfb
Author: Justin Luth 
AuthorDate: Thu Dec 16 08:51:55 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Dec 21 08:30:40 2021 +0100

tdf#133713 sd: bullets and numbering should enable it

This fixes a LO 6.3 regression caused by re-working
the numbering dialog (switching from FuOutlineBullet
to the new FuBulletAndPosition).

When running uno:OutlineBullet, one expects to have
numbering applied to the selection. However, that part
was completely omitted from the new implementation.
I can't imagine why, since most everything else in the
nearby code was just a copy/paste from the old methods.

This patch restores some of the logic from the old function.
[Deleted in commit 5ff162bede44b77cb19e5ff6571b6e34f228d9fb
Author: Gül?ah Köse on Mon May 27 23:49:41 2019 +0300
tdf#120905 Remove old FuOutlineBullet dialog code.]

Partially revert loplugin:unusedmethods to recover EnableBullets()
from commit cae829e9c1394851fc88829d5197460929c2792a

This fixes Format -> Bullets and Numbering,
right-click pop-up Bullets and Numbering,
and sidebar's Toggle * List's "More Numbering".

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

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index e607698d5efe..bf11c742dfea 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -930,6 +930,35 @@ void OutlinerView::ToggleBulletsNumbering(
 }
 }
 
+void OutlinerView::EnsureNumberingIsOn()
+{
+pOwner->UndoActionStart(OLUNDO_DEPTH);
+
+ESelection aSel(pEditView->GetSelection());
+aSel.Adjust();
+
+const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout();
+pOwner->pEditEngine->SetUpdateLayout(false);
+
+for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++)
+{
+Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
+
+if (pPara && pOwner->GetDepth(nPara) == -1)
+pOwner->SetDepth(pPara, 0);
+}
+
+sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
+pOwner->ImplCheckParagraphs(aSel.nStartPara, nParaCount);
+
+const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
+pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.nStartPara, 0, 
nEndPara, 0));
+
+pOwner->pEditEngine->SetUpdateLayout(bUpdate);
+
+pOwner->UndoActionEnd();
+}
 
 void OutlinerView::ApplyBulletsNumbering(
 const bool bHandleBullets,
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index f34028496941..87fabb4ee45e 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -345,6 +345,11 @@ public:
 void SwitchOffBulletsNumbering(
 const bool bAtSelection = false );
 
+/** enables numbering for the selected paragraphs that are not enabled and 
ignore all selected
+paragraphs that already have numbering enabled.
+*/
+voidEnsureNumberingIsOn();
+
 boolIsCursorAtWrongSpelledWord();
 boolIsWrongSpelledWordAtPos( const Point& rPosPixel );
 voidExecuteSpellPopup(const Point& rPosPixel, const 
Link& rCallBack);
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index c661666f198c..0116b4b0e80f 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -91,6 +91,19 @@ void FuBulletAndPosition::DoExecute( SfxRequest& rReq )
 
 if( nResult == RET_OK )
 {
+OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+std::unique_ptr> aGuard;
+
+if (OutlineView* pOutlineView = dynamic_cast(pView))
+{
+pOLV = 
pOutlineView->GetViewByWindow(mpViewShell->GetActiveWindow());
+aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
+}
+
+if( pOLV )
+pOLV->EnsureNumberingIsOn();
+
 const SfxItemSet pOutputSet( *pDlg->GetOutputItemSet(  ) );
 pView->SetAttributes(pOutputSet, /*bReplaceAll=*/false, /*bSlide*/ 
pDlg->IsSlideScope(), /*bMaster=*/pDlg->IsApplyToMaster());
 }


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

2021-12-21 Thread Justin Luth (via logerrit)
 sw/source/core/docnode/ndtbl1.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 3807e43b3b1a05eb7d9c88988b41448cfc05015a
Author: Justin Luth 
AuthorDate: Mon Dec 20 14:43:09 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Dec 21 09:29:39 2021 +0100

tdf#90805 sw tables: use veryThin instead of hairline borders

This keeps it consitent with tdf#99027 which was fixed on the
same day.

Change-Id: I03d8a9c2ab1e7f6cf8a7c95d7600d549138e414e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127165
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Reviewed-by: Justin Luth 

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index f300cec48c5d..1cb5fc651b6c 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -930,7 +930,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 
GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pTableNd));
 }
 
-const SvxBorderLine aHairlineBorder(pColor, SvxBorderLineWidth::Hairline);
+const SvxBorderLine aDefaultBorder(pColor, SvxBorderLineWidth::VeryThin);
 
 for( auto  : aUnions )
 {
@@ -961,10 +961,10 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 }
 else if (pColor && !pBorderLine && !pTop && !pBot && !pLeft && 
!pRight)
 {
-aBox->SetLine(, SvxBoxItemLine::TOP);
-aBox->SetLine(, SvxBoxItemLine::BOTTOM);
-aBox->SetLine(, SvxBoxItemLine::LEFT);
-aBox->SetLine(, SvxBoxItemLine::RIGHT);
+aBox->SetLine(, SvxBoxItemLine::TOP);
+aBox->SetLine(, SvxBoxItemLine::BOTTOM);
+aBox->SetLine(, SvxBoxItemLine::LEFT);
+aBox->SetLine(, SvxBoxItemLine::RIGHT);
 }
 else
 {


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

2022-01-05 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf146489.rtf |   56 ++
 sw/qa/extras/rtfexport/rtfexport4.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 44c37c4af2d23d1469cdeeb56f2f5a2bef493986
Author: Justin Luth 
AuthorDate: Tue Jan 4 15:36:35 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Jan 5 09:44:30 2022 +0100

tdf#146489 writerfilter: ensure only character properties

This is another RTF regression found against LO 6.0's
commit fdfdea4d5af51a68f2d497cc5c3359d74c385fd5
   tdf#82173 writerfilter: apply char properties to footnote

The original commit in LO 6.0 intended that only character properties
were used. A follow-up commit for RTF tried to ensure that
these would be on the top of the stack.

However, in this case, it seems like somehow the table is
getting involved in putting the paragraph context
on the top. (Actually, there is no
GetTopContextOfType(CONTEXT_CHARACTER) at all.)

In any case, aFontProperties should only contain
character properties, so ensure that.

The unit test shows that there is still some kind
of import problem, because the footnote marker
should be a large, red character, but it is just
normal text. See tdf#108949.

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

diff --git a/sw/qa/extras/rtfexport/data/tdf146489.rtf 
b/sw/qa/extras/rtfexport/data/tdf146489.rtf
new file mode 100644
index ..d8e198114052
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf146489.rtf
@@ -0,0 +1,56 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New 
Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt 
Arial};}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}{\f6\fswiss\fprq0\fcharset0 
FreeSans;}{\f7\fnil\fprq2\fcharset0 FreeSans;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red201\green33\blue30;\red255\green233\blue148;}
+{\stylesheet{\s0\snext0\rtlch\af7\afs24\alang1081 
\ltrch\lang1033\langfe2052\hich\af3\loch\widctlpar\hyphpar0\aspalpha\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af5\langfe2052
 Normal;}
+{\*\cs15\snext15 Numbering Symbols;}
+{\*\cs16\snext16\loch\super Footnote Anchor;}
+{\*\cs17\snext17 Footnote Characters;}
+{\*\cs18\snext18\loch\super Endnote Anchor;}
+{\*\cs19\snext19 Endnote Characters;}
+{\s20\sbasedon0\snext21\rtlch\af7\afs28 
\ltrch\hich\af4\loch\sb240\sa120\keepn\f4\fs28\dbch\af5 Heading;}
+{\s21\sbasedon0\snext21\loch\sl276\slmult1\sb0\sa140 Text Body;}
+{\s22\sbasedon21\snext22\rtlch\af6 \ltrch\loch\sl276\slmult1\sb0\sa140 List;}
+{\s23\sbasedon0\snext23\rtlch\af6\afs24\ai 
\ltrch\loch\sb120\sa120\noline\fs24\i Caption;}
+{\s24\sbasedon0\snext24\rtlch\af6\alang255 
\ltrch\lang255\langfe255\loch\noline\lang255\dbch\langfe255 Index;}
+{\s25\sbasedon0\snext25\loch\nowidctlpar\noline Table Contents;}
+{\s26\sbasedon0\snext26\rtlch\afs20 
\ltrch\loch\li340\ri0\lin340\rin0\fi-340\noline\fs20 Footnote;}
+}{\*\listtable{\list\listtemplateid1
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'00.;}{\levelnumbers\'01;}\fi-360\li720}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'01.;}{\levelnumbers\'01;}\fi-360\li1080}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'02.;}{\levelnumbers\'01;}\fi-360\li1440}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'03.;}{\levelnumbers\'01;}\fi-360\li1800}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'04.;}{\levelnumbers\'01;}\fi-360\li2160}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'05.;}{\levelnumbers\'01;}\fi-360\li2520}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'06.;}{\levelnumbers\'01;}\fi-360\li2880}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'07.;}{\levelnumbers\'01;}\fi-360\li3240}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'08.;}{\levelnumbers\'01;}\fi-360\li3600}\listid1}
+{\list\listtemplateid2
+{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext 
\'00;}{\levelnumbers;}\fi0\li0}
+{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext 
\'00;}{\levelnumbers;}\fi0\li0

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/qa writerfilter/source

2022-01-05 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/tdf146489.rtf |   56 ++
 sw/qa/extras/rtfexport/rtfexport4.cxx |6 ++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 411cc8af8490ba307245c689ed5714f612bb9d6f
Author: Justin Luth 
AuthorDate: Tue Jan 4 15:36:35 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Jan 5 11:35:55 2022 +0100

tdf#146489 writerfilter: ensure only character properties

This is another RTF regression found against LO 6.0's
commit fdfdea4d5af51a68f2d497cc5c3359d74c385fd5
   tdf#82173 writerfilter: apply char properties to footnote

The original commit in LO 6.0 intended that only character properties
were used. A follow-up commit for RTF tried to ensure that
these would be on the top of the stack.

However, in this case, it seems like somehow the table is
getting involved in putting the paragraph context
on the top. (Actually, there is no
GetTopContextOfType(CONTEXT_CHARACTER) at all.)

In any case, aFontProperties should only contain
character properties, so ensure that.

The unit test shows that there is still some kind
of import problem, because the footnote marker
should be a large, red character, but it is just
normal text. See tdf#108949.

Change-Id: I1ea7256891b198046f79f0d3a36e43d6c2ae3383
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127943
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 44c37c4af2d23d1469cdeeb56f2f5a2bef493986)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127954

diff --git a/sw/qa/extras/rtfexport/data/tdf146489.rtf 
b/sw/qa/extras/rtfexport/data/tdf146489.rtf
new file mode 100644
index ..d8e198114052
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf146489.rtf
@@ -0,0 +1,56 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\fonttbl{\f0\froman\fprq2\fcharset0 Times New 
Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 
Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New 
Roman};}{\f4\fswiss\fprq2\fcharset0 Liberation Sans{\*\falt 
Arial};}{\f5\fnil\fprq2\fcharset0 DejaVu Sans;}{\f6\fswiss\fprq0\fcharset0 
FreeSans;}{\f7\fnil\fprq2\fcharset0 FreeSans;}}
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red201\green33\blue30;\red255\green233\blue148;}
+{\stylesheet{\s0\snext0\rtlch\af7\afs24\alang1081 
\ltrch\lang1033\langfe2052\hich\af3\loch\widctlpar\hyphpar0\aspalpha\ltrpar\cf0\f3\fs24\lang1033\kerning1\dbch\af5\langfe2052
 Normal;}
+{\*\cs15\snext15 Numbering Symbols;}
+{\*\cs16\snext16\loch\super Footnote Anchor;}
+{\*\cs17\snext17 Footnote Characters;}
+{\*\cs18\snext18\loch\super Endnote Anchor;}
+{\*\cs19\snext19 Endnote Characters;}
+{\s20\sbasedon0\snext21\rtlch\af7\afs28 
\ltrch\hich\af4\loch\sb240\sa120\keepn\f4\fs28\dbch\af5 Heading;}
+{\s21\sbasedon0\snext21\loch\sl276\slmult1\sb0\sa140 Text Body;}
+{\s22\sbasedon21\snext22\rtlch\af6 \ltrch\loch\sl276\slmult1\sb0\sa140 List;}
+{\s23\sbasedon0\snext23\rtlch\af6\afs24\ai 
\ltrch\loch\sb120\sa120\noline\fs24\i Caption;}
+{\s24\sbasedon0\snext24\rtlch\af6\alang255 
\ltrch\lang255\langfe255\loch\noline\lang255\dbch\langfe255 Index;}
+{\s25\sbasedon0\snext25\loch\nowidctlpar\noline Table Contents;}
+{\s26\sbasedon0\snext26\rtlch\afs20 
\ltrch\loch\li340\ri0\lin340\rin0\fi-340\noline\fs20 Footnote;}
+}{\*\listtable{\list\listtemplateid1
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'00.;}{\levelnumbers\'01;}\fi-360\li720}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'01.;}{\levelnumbers\'01;}\fi-360\li1080}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'02.;}{\levelnumbers\'01;}\fi-360\li1440}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'03.;}{\levelnumbers\'01;}\fi-360\li1800}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'04.;}{\levelnumbers\'01;}\fi-360\li2160}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'05.;}{\levelnumbers\'01;}\fi-360\li2520}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'06.;}{\levelnumbers\'01;}\fi-360\li2880}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'07.;}{\levelnumbers\'01;}\fi-360\li3240}
+{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext 
\'02\'08.;}{\levelnumbers\'01;}\fi-360\li3600}\listid1}
+{\list\listtemplateid2
+{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext 
\'00

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - editeng/source include/editeng sd/source

2021-12-21 Thread Justin Luth (via logerrit)
 editeng/source/outliner/outlvw.cxx |   29 +
 include/editeng/outliner.hxx   |5 +
 sd/source/ui/func/fuolbull.cxx |   13 +
 3 files changed, 47 insertions(+)

New commits:
commit d181d828d9a3490cefc3a9b41fbda2d5b07b08c3
Author: Justin Luth 
AuthorDate: Thu Dec 16 08:51:55 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Dec 21 09:54:57 2021 +0100

tdf#133713 sd: bullets and numbering should enable it

This fixes a LO 6.3 regression caused by re-working
the numbering dialog (switching from FuOutlineBullet
to the new FuBulletAndPosition).

When running uno:OutlineBullet, one expects to have
numbering applied to the selection. However, that part
was completely omitted from the new implementation.
I can't imagine why, since most everything else in the
nearby code was just a copy/paste from the old methods.

This patch restores some of the logic from the old function.
[Deleted in commit 5ff162bede44b77cb19e5ff6571b6e34f228d9fb
Author: Gül?ah Köse on Mon May 27 23:49:41 2019 +0300
tdf#120905 Remove old FuOutlineBullet dialog code.]

Partially revert loplugin:unusedmethods to recover EnableBullets()
from commit cae829e9c1394851fc88829d5197460929c2792a

This fixes Format -> Bullets and Numbering,
right-click pop-up Bullets and Numbering,
and sidebar's Toggle * List's "More Numbering".

Change-Id: Iee3b66bd715e92167c9423242627a996191dcb72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126904
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 12832284318125b8649f6a67e3aa12aa953afdfb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127176
Reviewed-by: Justin Luth 

diff --git a/editeng/source/outliner/outlvw.cxx 
b/editeng/source/outliner/outlvw.cxx
index e607698d5efe..bf11c742dfea 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -930,6 +930,35 @@ void OutlinerView::ToggleBulletsNumbering(
 }
 }
 
+void OutlinerView::EnsureNumberingIsOn()
+{
+pOwner->UndoActionStart(OLUNDO_DEPTH);
+
+ESelection aSel(pEditView->GetSelection());
+aSel.Adjust();
+
+const bool bUpdate = pOwner->pEditEngine->IsUpdateLayout();
+pOwner->pEditEngine->SetUpdateLayout(false);
+
+for (sal_Int32 nPara = aSel.nStartPara; nPara <= aSel.nEndPara; nPara++)
+{
+Paragraph* pPara = pOwner->pParaList->GetParagraph(nPara);
+DBG_ASSERT(pPara, "OutlinerView::EnableBullets(), illegal selection?");
+
+if (pPara && pOwner->GetDepth(nPara) == -1)
+pOwner->SetDepth(pPara, 0);
+}
+
+sal_Int32 nParaCount = pOwner->pParaList->GetParagraphCount();
+pOwner->ImplCheckParagraphs(aSel.nStartPara, nParaCount);
+
+const sal_Int32 nEndPara = (nParaCount > 0) ? nParaCount-1 : nParaCount;
+pOwner->pEditEngine->QuickMarkInvalid(ESelection(aSel.nStartPara, 0, 
nEndPara, 0));
+
+pOwner->pEditEngine->SetUpdateLayout(bUpdate);
+
+pOwner->UndoActionEnd();
+}
 
 void OutlinerView::ApplyBulletsNumbering(
 const bool bHandleBullets,
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index f34028496941..87fabb4ee45e 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -345,6 +345,11 @@ public:
 void SwitchOffBulletsNumbering(
 const bool bAtSelection = false );
 
+/** enables numbering for the selected paragraphs that are not enabled and 
ignore all selected
+paragraphs that already have numbering enabled.
+*/
+voidEnsureNumberingIsOn();
+
 boolIsCursorAtWrongSpelledWord();
 boolIsWrongSpelledWordAtPos( const Point& rPosPixel );
 voidExecuteSpellPopup(const Point& rPosPixel, const 
Link& rCallBack);
diff --git a/sd/source/ui/func/fuolbull.cxx b/sd/source/ui/func/fuolbull.cxx
index 6c6b9aef5b0f..054a44e9b8a3 100644
--- a/sd/source/ui/func/fuolbull.cxx
+++ b/sd/source/ui/func/fuolbull.cxx
@@ -91,6 +91,19 @@ void FuBulletAndPosition::DoExecute( SfxRequest& rReq )
 
 if( nResult == RET_OK )
 {
+OutlinerView* pOLV = pView->GetTextEditOutlinerView();
+
+std::unique_ptr> aGuard;
+
+if (OutlineView* pOutlineView = dynamic_cast(pView))
+{
+pOLV = 
pOutlineView->GetViewByWindow(mpViewShell->GetActiveWindow());
+aGuard.reset(new OutlineViewModelChangeGuard(*pOutlineView));
+}
+
+if( pOLV )
+pOLV->EnsureNumberingIsOn();
+
 const SfxItemSet pOutputSet( *pDlg->GetOutputItemSet(  ) );
 pView->SetAttributes(pOutputSet, /*bReplaceAll=*/false, /*bSlide*/ 
pDlg->IsSlideScope(), /*bMaster=*/pDlg->IsApplyToMaster());
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source

2021-12-21 Thread Justin Luth (via logerrit)
 sw/source/core/docnode/ndtbl1.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 40b84167a58901d50d98730260d968046283376c
Author: Justin Luth 
AuthorDate: Mon Dec 20 14:43:09 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Dec 21 12:36:29 2021 +0100

tdf#90805 sw tables: use veryThin instead of hairline borders

This keeps it consitent with tdf#99027 which was fixed on the
same day.

Change-Id: I03d8a9c2ab1e7f6cf8a7c95d7600d549138e414e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127165
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Reviewed-by: Justin Luth 
(cherry picked from commit 3807e43b3b1a05eb7d9c88988b41448cfc05015a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127183
Reviewed-by: Xisco Fauli 

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index f300cec48c5d..1cb5fc651b6c 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -930,7 +930,7 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 
GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pTableNd));
 }
 
-const SvxBorderLine aHairlineBorder(pColor, SvxBorderLineWidth::Hairline);
+const SvxBorderLine aDefaultBorder(pColor, SvxBorderLineWidth::VeryThin);
 
 for( auto  : aUnions )
 {
@@ -961,10 +961,10 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 }
 else if (pColor && !pBorderLine && !pTop && !pBot && !pLeft && 
!pRight)
 {
-aBox->SetLine(, SvxBoxItemLine::TOP);
-aBox->SetLine(, SvxBoxItemLine::BOTTOM);
-aBox->SetLine(, SvxBoxItemLine::LEFT);
-aBox->SetLine(, SvxBoxItemLine::RIGHT);
+aBox->SetLine(, SvxBoxItemLine::TOP);
+aBox->SetLine(, SvxBoxItemLine::BOTTOM);
+aBox->SetLine(, SvxBoxItemLine::LEFT);
+aBox->SetLine(, SvxBoxItemLine::RIGHT);
 }
 else
 {


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - sw/source

2021-12-21 Thread Justin Luth (via logerrit)
 sw/source/core/edit/acorrect.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 55a7fde6bbe62eb9be2f48f1e97ac86192d932c8
Author: Justin Luth 
AuthorDate: Thu Nov 11 12:28:21 2021 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Dec 21 23:51:46 2021 +0100

tdf#139922 sw autocorr: don't return GetPrevPara if isEmpty

This fixes a LO 6.2 regression caused by
commit 4cf5a46f16dec8ce16c6662ce5c17903e28b8fa3.

Change-Id: I4aee8f4e79a40a8b8f82faa3e62dead80a952510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125037
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Michael Stahl 
(cherry picked from commit 59dc5d00b04927d07df2dcc3c17acfdc760d8765)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125144
(cherry picked from commit 133fe29d06445daadc556cff013d5194a883ea9b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127156
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 7304e6e7b702..286d4d078de5 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -346,8 +346,11 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const 
bAtNormalPos)
 }
 sw::GotoPrevLayoutTextFrame(*pIdx, rEditSh.GetLayout());
 }
-if (pFrame && 0 == 
pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+if (pFrame && !pFrame->GetText().isEmpty() &&
+0 == pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+{
 pStr = & pFrame->GetText();
+}
 
 if( bUndoIdInitialized )
 bUndoIdInitialized = true;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-5' - sw/qa sw/source

2021-12-22 Thread Justin Luth (via logerrit)
 sw/qa/extras/uiwriter/uiwriter3.cxx |   19 +++
 sw/source/core/swg/SwXMLTextBlocks1.cxx |   16 +---
 2 files changed, 32 insertions(+), 3 deletions(-)

New commits:
commit 156f2e3bac9ba2cfe517ea14e7cce961bd0e7ceb
Author: Justin Luth 
AuthorDate: Fri Dec 17 18:45:42 2021 +0200
Commit: Michael Stahl 
CommitDate: Wed Dec 22 10:15:27 2021 +0100

tdf#144364 sw: Revert "Use FastParser in SwXMLTextBlocks"

This reverts 7.0 commit fd6feb4f538b0c5c9061529ff002be9f62a7239a.
Noel said this was just a performance fix, so just go ahead
and revert it.

It caused the regression documented in bug 144364.

Change-Id: I044c49e42873db120a94d93a00e9b35105778b9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127012
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 1addd8c104f6ad390bdd0ca61cd5ce97b55ce218)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126982
Reviewed-by: Noel Grandin 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127147
(cherry picked from commit d8cf8482ae5ed72dc969d9adb47c113c442452be)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127168
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 514a13e88ff1..b536692fc5a6 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1689,6 +1689,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629)
 CPPUNIT_ASSERT_EQUAL(1, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf144364)
+{
+SwDoc* const pDoc = createSwDoc();
+SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtSh);
+
+// expands autotext (via F3)
+pWrtSh->Insert("AR");
+
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_F3);
+Scheduler::ProcessEventsToIdle();
+
+// was ...'letter of '
+CPPUNIT_ASSERT_EQUAL(
+OUString("We hereby acknowledge the receipt of your letter of 
."),
+getParagraph(1)->getString());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
 SwDoc* const pDoc = createSwDoc();
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx 
b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 0297d68fa442..589d4e192097 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -194,6 +195,9 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 uno::Reference< uno::XComponentContext > xContext =
 comphelper::getProcessComponentContext();
 
+// get parser
+uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create( xContext );
+
 // create descriptor and reference to it. Either
 // both or neither must be kept because of the
 // reference counting!
@@ -206,15 +210,21 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
 OUString sFilterComponent = bOasis
 ? 
OUString("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter")
 : OUString("com.sun.star.comp.Writer.XMLAutotextEventsImporter");
-uno::Reference< xml::sax::XFastParser > xFilter(
+uno::Reference< xml::sax::XDocumentHandler > xFilter(
 
xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
 sFilterComponent, aFilterArguments, xContext),
-UNO_QUERY_THROW );
+UNO_QUERY );
+OSL_ENSURE( xFilter.is(), "can't instantiate autotext-events filter");
+if ( !xFilter.is() )
+return ERR_SWG_READ_ERROR;
+
+// connect parser and filter
+xParser->setDocumentHandler( xFilter );
 
 // parse the stream
 try
 {
-xFilter->parseStream( aParserInput );
+xParser->parseStream( aParserInput );
 }
 catch( xml::sax::SAXParseException& )
 {


[Libreoffice-commits] core.git: oox/source

2021-11-22 Thread Justin Luth (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 283586c89a0542efb2d57a36ee3aad7cc5153ed5
Author: Justin Luth 
AuthorDate: Mon Nov 22 19:33:48 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Nov 23 06:57:23 2021 +0100

tdf#138223 oox: don't set highlight color if it is transparent

Probably when this was first implemented in 6.4,
it should have set a transparency threshold of when to accept
the color as the background (perhaps at 50%).
But since this has already been running for a while,
I only cancel it if it is fully transparent.

No existing unit tests matched this scenario.

I'm not making a unit test because the color really
ought to be set - it should just be transparent.
LO doesn't seem to have a character highlight
transparency capability, so this needs to be emulated.

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

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index a34cb14af639..93d642324782 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -195,7 +195,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 }
 // TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
 
-if( maHighlightColor.isUsed() )
+if (maHighlightColor.isUsed() && maHighlightColor.getTransparency() != 100)
 rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( 
rFilter.getGraphicHelper() ));
 else
 rPropMap.setProperty( PROP_CharBackColor, sal_Int32(-1));


[Libreoffice-commits] core.git: vcl/source

2021-11-23 Thread Justin Luth (via logerrit)
 vcl/source/window/printdlg.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 324daa38a823477e1d1b650b5d91f3dc91c6a9af
Author: Justin Luth 
AuthorDate: Tue Nov 23 09:18:20 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Nov 23 11:05:19 2021 +0100

tdf#129638 print preview: use new paper size after switching page

This is a partial revert of LO 6.3
commit 2c23a96f7b6888c0e05fdc2aba57f03cd797b647.

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

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index dd1192c21a9d..12aa14628887 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -984,6 +984,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
 {
 PrinterController::PageSize aPageSize =
 maPController->getFilteredPageFile( mnCurPage, aMtf, 
i_bMayUseCache );
+aCurPageSize = aPrt->PixelToLogic(aPrt->GetPaperSizePixel(), 
MapMode(MapUnit::Map100thMM));
 if( ! aPageSize.bFullPaper )
 {
 const MapMode aMapMode( MapUnit::Map100thMM );


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

2021-11-23 Thread Justin Luth (via logerrit)
 sw/source/uibase/shells/drwtxtex.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 87fafdb9dc045735e235cbba2ef37198043422c7
Author: Justin Luth 
AuthorDate: Tue Nov 23 10:23:37 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Nov 23 11:27:20 2021 +0100

tdf#131150 sw menu: use nSlotId=0 to avoid adding to set

This fixes a regression in LO 6.4 caused by
commit 86cb2a1f98c0585d2121e6ae34fe62f072ef9a63

Not surprisingly, adding a new condition that multiple
other items match on caused a regression.

bFlag is always set to false at the top of the loop.
In the above commit, bFlag was not set to true,
and so thus it would always be false.
So just set the SlotId to 0
to avoid rSet.Put - like so many other cases already do.

Change-Id: I02e9ca9d8dd75db519e801ad0e86fc8d541ae20a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125688
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Reviewed-by: Justin Luth 

diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index 1d0a8ee58ccc..3f7a1e5e5dad 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -957,6 +957,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
 {
 if (!URLFieldHelper::IsCursorAtURLField(pOLV))
 rSet.DisableItem(nWhich);
+nSlotId = 0;
 }
 break;
 default:
@@ -964,7 +965,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
 break;
 }
 
-if (nSlotId && bFlag)
+if (nSlotId)
 rSet.Put(SfxBoolItem(nWhich, bFlag));
 
 nWhich = aIter.NextWhich();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - oox/source

2021-11-23 Thread Justin Luth (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1ed00f2ad9bbc6e920248ba3d39c227acb06e0e6
Author: Justin Luth 
AuthorDate: Mon Nov 22 19:33:48 2021 +0200
Commit: Xisco Fauli 
CommitDate: Tue Nov 23 11:50:17 2021 +0100

tdf#138223 oox: don't set highlight color if it is transparent

Probably when this was first implemented in 6.4,
it should have set a transparency threshold of when to accept
the color as the background (perhaps at 50%).
But since this has already been running for a while,
I only cancel it if it is fully transparent.

No existing unit tests matched this scenario.

I'm not making a unit test because the color really
ought to be set - it should just be transparent.
LO doesn't seem to have a character highlight
transparency capability, so this needs to be emulated.

Change-Id: I7b295894e529f8345cadc9b30bc43598a9a02e2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125670
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 283586c89a0542efb2d57a36ee3aad7cc5153ed5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125465
Reviewed-by: Xisco Fauli 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 4eb5acaffb56..ca1d2af1360d 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -175,7 +175,7 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 }
 // TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
 
-if( maHighlightColor.isUsed() )
+if (maHighlightColor.isUsed() && maHighlightColor.getTransparency() != 100)
 rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( 
rFilter.getGraphicHelper() ));
 else
 rPropMap.setProperty( PROP_CharBackColor, sal_Int32(-1));


[Libreoffice-commits] core.git: sd/uiconfig

2021-11-23 Thread Justin Luth (via logerrit)
 sd/uiconfig/sdraw/popupmenu/draw.xml|1 +
 sd/uiconfig/simpress/popupmenu/draw.xml |1 +
 2 files changed, 2 insertions(+)

New commits:
commit b7a46259eba35257291fe00851252c18ffb4fc90
Author: Justin Luth 
AuthorDate: Tue Nov 23 07:55:21 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 24 06:36:02 2021 +0100

tdf#130131 UI: add back "Split" to draw/impress popup

This is a partial revert of LO 6.2
commit cf8b3a74e8c093dd0ffc7e2f431a26864958f6fb

I have no idea why uno:Dismantle would have been
removed in this commit, since it wasn't
added back anywhere else, and seems to be
unrelated to anything else in that patch.

Change-Id: I1fbed2b3a58aee733c41c7a4817b215e4bec6061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125681
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sd/uiconfig/sdraw/popupmenu/draw.xml 
b/sd/uiconfig/sdraw/popupmenu/draw.xml
index 68655c28f41b..d29bb5046456 100644
--- a/sd/uiconfig/sdraw/popupmenu/draw.xml
+++ b/sd/uiconfig/sdraw/popupmenu/draw.xml
@@ -61,6 +61,7 @@
 
   
   
+  
   
   
   
diff --git a/sd/uiconfig/simpress/popupmenu/draw.xml 
b/sd/uiconfig/simpress/popupmenu/draw.xml
index a607562c4147..722250f0d2e3 100644
--- a/sd/uiconfig/simpress/popupmenu/draw.xml
+++ b/sd/uiconfig/simpress/popupmenu/draw.xml
@@ -61,6 +61,7 @@
 
   
   
+  
   
   
   


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

2021-11-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135906.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |5 +
 sw/source/filter/ww8/docxsdrexport.cxx   |1 +
 vcl/qt5/QtGraphics_GDI.cxx   |9 -
 vcl/qt5/QtSvpGraphics.cxx|9 -
 5 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 0afd2d3bfa9d55249ffd1408681ff04decf2d8fa
Author: Justin Luth 
AuthorDate: Thu Nov 18 11:28:42 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Nov 19 09:12:44 2021 +0100

tdf#135906 docxexport: set serializer before writing

This fixes a 6.3 regresssion from
commit aafaf1f55fa413ad49d4556cf7c0a713dd206ae4.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135906.docx 
b/sw/qa/extras/ooxmlexport/data/tdf135906.docx
new file mode 100644
index ..701fccff5ed4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135906.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 0a7879269a75..a8a6029392f0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -48,6 +48,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, 
"tdf135164_cancelledN
 CPPUNIT_ASSERT_EQUAL(OUString("i"), getProperty(xPara, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135906, "tdf135906.docx")
+{
+// just test round-tripping. The document was exported as corrupt and 
didn't re-load.
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testParaStyleNumLevel)
 {
 loadAndSave("para-style-num-level.docx");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 3b25c0c0c608..2efafc412d82 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1689,6 +1689,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrameFormat
 Size aSize(sdrObject->GetSnapRect().getWidth(), 
sdrObject->GetSnapRect().getHeight());
 startDMLAnchorInline(, aSize);
 
+m_pImpl->getDrawingML()->SetFS(m_pImpl->getSerializer());
 m_pImpl->getDrawingML()->WriteDiagram(xShape, nDiagramId);
 
 endDMLAnchorInline();
commit dc0016bc8d7e6c4456f4442c7ccf287bfc0c2e9b
Author: Michael Weghorn 
AuthorDate: Thu Nov 18 21:15:10 2021 +0100
Commit: Michael Weghorn 
CommitDate: Fri Nov 19 09:12:34 2021 +0100

tdf#137924 qt (>=5.14): Use proper DPI without requiring window handle

For Qt >= 5.14, don't require a window handle to retrieve
the screen and then the associated DPI value from that one,
but directly use 'QWidget::screen' (introduced in QT 5.14)
to retrieve the screen.

Previously, no DPI values would be set in case there was
no window handle.

This makes UI scaling work without having to manually set
'SAL_FORCEDPI' on Wayland.

While various UI elements (like e.g. the "Help" -> "About LibreOffice"
still look quite broken with the qt5 and kf5 VCL plugins
in a Plasma Wayland session (at least on my Debian testing with
Qt 5.15.2 and Plasma 5.23), they look OK
when using the qt6 VCL plugin with a custom build of qtbase
and qtwayland from Qt's "dev" git branches.

Change-Id: I5feae46ed86a8b7d3cf92d4a973f7a0f9a9f95de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125507
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx
index 0f9faa022d0b..f87de50827df 100644
--- a/vcl/qt5/QtGraphics_GDI.cxx
+++ b/vcl/qt5/QtGraphics_GDI.cxx
@@ -746,10 +746,17 @@ void QtGraphics::GetResolution(sal_Int32& rDPIX, 
sal_Int32& rDPIY)
 return;
 }
 
-if (!m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle())
+if (!m_pFrame)
+return;
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+QScreen* pScreen = m_pFrame->GetQWidget()->screen();
+#else
+if (!m_pFrame->GetQWidget()->window()->windowHandle())
 return;
 
 QScreen* pScreen = 
m_pFrame->GetQWidget()->window()->windowHandle()->screen();
+#endif
 rDPIX = pScreen->logicalDotsPerInchX() * pScreen->devicePixelRatio() + 0.5;
 rDPIY = pScreen->logicalDotsPerInchY() * pScreen->devicePixelRatio() + 0.5;
 }
diff --git a/vcl/qt5/QtSvpGraphics.cxx b/vcl/qt5/QtSvpGraphics.cxx
index b6018a95e299..3632c8990706 100644
--- a/vcl/qt5/QtSvpGraphics.cxx
+++ b/vcl/qt5/QtSvpGraphics.cxx
@@ -102,10 +102,17 @@ void QtSvpGraphics::GetResolution(sal_Int32& rDPIX, 
sal_Int32& rDPIY)
 r

[Libreoffice-commits] core.git: oox/inc oox/source sd/qa

2021-11-19 Thread Justin Luth (via logerrit)
 oox/inc/drawingml/textcharacterproperties.hxx   |3 +++
 oox/source/drawingml/textcharacterproperties.cxx|   12 
 oox/source/drawingml/textcharacterpropertiescontext.cxx |7 ---
 sd/qa/unit/export-tests-ooxml3.cxx  |   13 +
 sd/qa/unit/import-tests2.cxx|4 ++--
 5 files changed, 34 insertions(+), 5 deletions(-)

New commits:
commit 894a01640a838c9affed7cc7378a452139b5
Author: Justin Luth 
AuthorDate: Sat Nov 13 09:40:09 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Nov 19 13:49:01 2021 +0100

tdf#137438 drawingml: separate outline from text import

By ignoring the a:ln group, the contents in that group
(like transparency) were being applied to the text.
Well, it should only apply to a line around the text,
which LO isn't doing.
[Well, LO can do this as Fontwork, but perhaps that
doesn't match so well with text in shapes generally?]

At any rate, don't allow one group's settings
to override the others. Keep them separate and then apply
a bit of merging logic to try to achieve the best look.

So emulate a little bit. If the outline is not very
transparent (less transparent than the main text)
then it may (if thick or opaque enough) dominate
the text.

For simplicity (and because there is no right answer overall)
I just compared transparency and used the more opaque colour.

Unit tests potentially affected:
-export-tests-ooxml1.cxx: tdf100348_FontworkBitmapFill.odp -> PPTX
   -now imports black instead of yellow (MSO sees gradient colors)
   -so previously completely wrong, and now perhaps even more wrong?
-export-tests-ooxml3.cxx: tdf114848.pptx
   -shows blue text regardless - defined by area.
   -can't see where this is set in MSO2016. Perhaps illegal?
-  : tdf125573_FontWorkScaleX.pptx
   -no visual difference. Same as tdf100348, but with black outline.
-  : tdf119087.pptx
   -should be green, not purple. [Added test for that.]
-  : tdf143315-WordartWithoutBullet.ppt
   -no visual difference (COL_AUTO outline?)
-import-tests2.cxx: tdf129686.pptx
   -poor test usage (but also weird transparent default).
   -no visual change.
-ooxmlimport2.cx: tdf143476_lockedCanvas_position.docx
   -no visual difference. Irrelevant since we can't RT

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

diff --git a/oox/inc/drawingml/textcharacterproperties.hxx 
b/oox/inc/drawingml/textcharacterproperties.hxx
index 2724af43051b..49d4125698a4 100644
--- a/oox/inc/drawingml/textcharacterproperties.hxx
+++ b/oox/inc/drawingml/textcharacterproperties.hxx
@@ -26,6 +26,7 @@
 #include 
 
 #include 
+#include 
 
 namespace oox { class PropertySet; }
 
@@ -57,6 +58,8 @@ struct TextCharacterProperties
 OptValue< bool >moItalic;
 OptValue< bool >moUnderlineLineFollowText;
 OptValue< bool >moUnderlineFillFollowText;
+OptValue moTextOutlineProperties;
+
 FillProperties  maFillProperties;
 /// Set if there was a property set that alters run visually during import
 bool mbHasVisualRunProperties;
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index bd4d051a490b..9200e9666cbf 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const 
TextCharacterProperties& rSource
 moItalic.assignIfUsed( rSourceProps.moItalic );
 moUnderlineLineFollowText.assignIfUsed( 
rSourceProps.moUnderlineLineFollowText );
 moUnderlineFillFollowText.assignIfUsed( 
rSourceProps.moUnderlineFillFollowText );
+moTextOutlineProperties.assignIfUsed(rSourceProps.moTextOutlineProperties);
 
 maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
 maFillProperties.assignUsed( rSourceProps.maFillProperties );
@@ -110,6 +111,17 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 if ( maFillProperties.moFillType.has() )
 {
 Color aColor = maFillProperties.getBestSolidColor();
+// tdf#137438 Emulate text outline color/transparency.
+// If the outline color dominates, then use it as the text color.
+if (moTextOutlineProperties.has()
+&& moTextOutlineProperties.get().maLineFill.moFillType.has()
+&& moTextOutlineProperties.get().maLineFill.moFillType.get() != 
XML_noFill)
+{
+Color aLineColor = 
moTextOutlineProperties.get().maLineFill.getBestSolidColor();
+sal_Int16 nLineTransparency = aLineColor.getTrans

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/qa sw/source

2021-11-19 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf135906.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |5 +
 sw/source/filter/ww8/docxsdrexport.cxx   |1 +
 3 files changed, 6 insertions(+)

New commits:
commit 5853e4d137c3cb535571cba0233b05a48761ac52
Author: Justin Luth 
AuthorDate: Thu Nov 18 11:28:42 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Nov 19 17:08:05 2021 +0100

tdf#135906 docxexport: set serializer before writing

This fixes a 6.3 regresssion from
commit aafaf1f55fa413ad49d4556cf7c0a713dd206ae4.

Change-Id: Ia2d3d26fe2cfa2b213326021f6b97f8d40c6e98c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125441
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125537

diff --git a/sw/qa/extras/ooxmlexport/data/tdf135906.docx 
b/sw/qa/extras/ooxmlexport/data/tdf135906.docx
new file mode 100644
index ..701fccff5ed4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf135906.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index f1726052ca02..c1c723fccb25 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -43,6 +43,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, 
"tdf135164_cancelledN
 CPPUNIT_ASSERT_EQUAL(OUString("i"), getProperty(xPara, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf135906, "tdf135906.docx")
+{
+// just test round-tripping. The document was exported as corrupt and 
didn't re-load.
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf123642_BookmarkAtDocEnd, "tdf123642.docx")
 {
 // get bookmark interface
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 539eb63c20b1..fe284534ae64 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1245,6 +1245,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* 
sdrObject, const SwFrameFormat
 Size aSize(sdrObject->GetSnapRect().GetWidth(), 
sdrObject->GetSnapRect().GetHeight());
 startDMLAnchorInline(, aSize);
 
+m_pImpl->getDrawingML()->SetFS(m_pImpl->getSerializer());
 m_pImpl->getDrawingML()->WriteDiagram(xShape, nDiagramId);
 
 endDMLAnchorInline();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-11-11 Thread Justin Luth (via logerrit)
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 62d82a9a4108f715cf1a2bf15205adc28e9fd31a
Author: Justin Luth 
AuthorDate: Wed Nov 10 09:15:58 2021 +0200
Commit: Xisco Fauli 
CommitDate: Thu Nov 11 16:27:15 2021 +0100

tdf#142986 sc sampling: allow more than default (100) samples

The default maximum for a spinbutton must be 100.
For some reason, the previous setMax to maxint was removed
in LO 6.3 in commit 2c5c20b19c349a4b7f6d78d69d8d57f9af5c351c.

Change-Id: I846c1ce037db6ef3b8d48975e24b748cad0394d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124948
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit eb50d356ffbe5bd2e3de9ac574ddf28ce4e034ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124972

diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx 
b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 608ba1a30fa1..fad4ac6d05a5 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -87,7 +87,9 @@ void ScSamplingDialog::Init()
 mxOutputRangeEdit->SetModifyHdl( aLink2);
 
 mxSampleSize->connect_value_changed( LINK( this, ScSamplingDialog, 
SamplingSizeValueModified ));
+mxSampleSize->set_range(1, SAL_MAX_INT32);
 mxPeriod->connect_value_changed( LINK( this, ScSamplingDialog, 
PeriodValueModified ));
+mxPeriod->set_range(1, SAL_MAX_INT32);
 
 mxPeriodicMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );
 mxRandomMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );


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

2021-11-16 Thread Justin Luth (via logerrit)
 sw/source/core/edit/acorrect.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 59dc5d00b04927d07df2dcc3c17acfdc760d8765
Author: Justin Luth 
AuthorDate: Thu Nov 11 12:28:21 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Nov 16 16:07:07 2021 +0100

tdf#139922 sw autocorr: don't return GetPrevPara if isEmpty

This fixes a LO 6.2 regression caused by
commit 4cf5a46f16dec8ce16c6662ce5c17903e28b8fa3.

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

diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 63f9229566c1..1ad211fa4354 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -357,8 +357,11 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const 
bAtNormalPos)
 }
 sw::GotoPrevLayoutTextFrame(*m_pIndex, m_rEditSh.GetLayout());
 }
-if (pFrame && 0 == 
pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+if (pFrame && !pFrame->GetText().isEmpty() &&
+0 == pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+{
 pStr = & pFrame->GetText();
+}
 
 if( m_bUndoIdInitialized )
 m_bUndoIdInitialized = true;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-11-16 Thread Justin Luth (via logerrit)
 sw/source/core/edit/acorrect.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 133fe29d06445daadc556cff013d5194a883ea9b
Author: Justin Luth 
AuthorDate: Thu Nov 11 12:28:21 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Nov 16 19:15:31 2021 +0100

tdf#139922 sw autocorr: don't return GetPrevPara if isEmpty

This fixes a LO 6.2 regression caused by
commit 4cf5a46f16dec8ce16c6662ce5c17903e28b8fa3.

Change-Id: I4aee8f4e79a40a8b8f82faa3e62dead80a952510
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125037
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Michael Stahl 
(cherry picked from commit 59dc5d00b04927d07df2dcc3c17acfdc760d8765)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125144

diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 9a8e45cb137c..5a7946d66885 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -356,8 +356,11 @@ OUString const* SwAutoCorrDoc::GetPrevPara(bool const 
bAtNormalPos)
 }
 sw::GotoPrevLayoutTextFrame(*m_pIndex, m_rEditSh.GetLayout());
 }
-if (pFrame && 0 == 
pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+if (pFrame && !pFrame->GetText().isEmpty() &&
+0 == pFrame->GetTextNodeForParaProps()->GetAttrOutlineLevel())
+{
 pStr = & pFrame->GetText();
+}
 
 if( m_bUndoIdInitialized )
 m_bUndoIdInitialized = true;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2021-11-29 Thread Justin Luth (via logerrit)
 sc/source/ui/cctrl/dpcontrol.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 5d331f3c92623fe6cba089bf2c49e8b518d225dd
Author: Justin Luth 
AuthorDate: Fri Nov 26 13:53:42 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Nov 29 09:59:36 2021 +0100

tdf#126356 partial Revert "sc tiled editing: Mapping has to be

turned off after drawing the buttons."

This partially reverts LO 5.0
commit 342d84218c17da40d0a4f96bc3b07b536d64517a which comments:
   Also - we are actually never call with something else than MAP_PIXEL,
   so let's kill the resetting of the mapmode;
   let's see if some obscure corner case bites us here.

Several bug reports have indicated artifacts on screen,
all coming from the use of autofilter,
and in these cases the map mode is 0 (Map100thMM),
so I restored the whimsically removed logic.

Change-Id: I9bb5d7418fc4083ed71139a64329b11fa1e4cc13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125879
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit bed6b7356e4bba1604ee5f760c80acc16ae54bae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125894
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 4b0bcc449f5b..f504b6c75089 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -89,6 +89,11 @@ void ScDPFieldButton::setPopupLeft(bool b)
 
 void ScDPFieldButton::draw()
 {
+bool bOldMapEnabled = mpOutDev->IsMapModeEnabled();
+
+if (mpOutDev->GetMapMode().GetMapUnit() != MapUnit::MapPixel)
+mpOutDev->EnableMapMode(false);
+
 if (mbBaseButton)
 {
 // Background
@@ -135,6 +140,8 @@ void ScDPFieldButton::draw()
 
 if (mbPopupButton)
 drawPopupButton();
+
+mpOutDev->EnableMapMode(bOldMapEnabled);
 }
 
 void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const


[Libreoffice-commits] core.git: sc/source

2021-11-26 Thread Justin Luth (via logerrit)
 sc/source/ui/cctrl/dpcontrol.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit bed6b7356e4bba1604ee5f760c80acc16ae54bae
Author: Justin Luth 
AuthorDate: Fri Nov 26 13:53:42 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Nov 26 18:13:06 2021 +0100

tdf#126356 partial Revert "sc tiled editing: Mapping has to be

turned off after drawing the buttons."

This partially reverts LO 5.0
commit 342d84218c17da40d0a4f96bc3b07b536d64517a which comments:
   Also - we are actually never call with something else than MAP_PIXEL,
   so let's kill the resetting of the mapmode;
   let's see if some obscure corner case bites us here.

Several bug reports have indicated artifacts on screen,
all coming from the use of autofilter,
and in these cases the map mode is 0 (Map100thMM),
so I restored the whimsically removed logic.

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

diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 4b0bcc449f5b..f504b6c75089 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -89,6 +89,11 @@ void ScDPFieldButton::setPopupLeft(bool b)
 
 void ScDPFieldButton::draw()
 {
+bool bOldMapEnabled = mpOutDev->IsMapModeEnabled();
+
+if (mpOutDev->GetMapMode().GetMapUnit() != MapUnit::MapPixel)
+mpOutDev->EnableMapMode(false);
+
 if (mbBaseButton)
 {
 // Background
@@ -135,6 +140,8 @@ void ScDPFieldButton::draw()
 
 if (mbPopupButton)
 drawPopupButton();
+
+mpOutDev->EnableMapMode(bOldMapEnabled);
 }
 
 void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sd/uiconfig

2021-11-25 Thread Justin Luth (via logerrit)
 sd/uiconfig/sdraw/popupmenu/draw.xml|1 +
 sd/uiconfig/simpress/popupmenu/draw.xml |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 8b5783266357b600e58bd757fef1f34f942b2d58
Author: Justin Luth 
AuthorDate: Tue Nov 23 07:55:21 2021 +0200
Commit: Caolán McNamara 
CommitDate: Thu Nov 25 15:06:08 2021 +0100

tdf#130131 UI: add back "Split" to draw/impress popup

This is a partial revert of LO 6.2
commit cf8b3a74e8c093dd0ffc7e2f431a26864958f6fb

I have no idea why uno:Dismantle would have been
removed in this commit, since it wasn't
added back anywhere else, and seems to be
unrelated to anything else in that patch.

Change-Id: I1fbed2b3a58aee733c41c7a4817b215e4bec6061
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125681
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit b7a46259eba35257291fe00851252c18ffb4fc90)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125713
Reviewed-by: Caolán McNamara 

diff --git a/sd/uiconfig/sdraw/popupmenu/draw.xml 
b/sd/uiconfig/sdraw/popupmenu/draw.xml
index 68655c28f41b..d29bb5046456 100644
--- a/sd/uiconfig/sdraw/popupmenu/draw.xml
+++ b/sd/uiconfig/sdraw/popupmenu/draw.xml
@@ -61,6 +61,7 @@
 
   
   
+  
   
   
   
diff --git a/sd/uiconfig/simpress/popupmenu/draw.xml 
b/sd/uiconfig/simpress/popupmenu/draw.xml
index a607562c4147..722250f0d2e3 100644
--- a/sd/uiconfig/simpress/popupmenu/draw.xml
+++ b/sd/uiconfig/simpress/popupmenu/draw.xml
@@ -61,6 +61,7 @@
 
   
   
+  
   
   
   


[Libreoffice-commits] core.git: svtools/source

2021-11-22 Thread Justin Luth (via logerrit)
 svtools/source/control/tabbar.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit fbda2f3b7b47021a140cbfd3288aa7de1b42e1fd
Author: Justin Luth 
AuthorDate: Sat Nov 20 20:29:17 2021 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 22 10:30:37 2021 +0100

tdf#132470 tabbar: revert back to bold font on visible tab

This is a partial regression to LO 6.3's
commit fad98c8641342a77241124dd98e0cb781daef4ad.

The current sheet is always selected, which is fairly
distinctive. However, it is possible to select
multiple sheets, and the current one should be
distinctly marked to differentiate it from
the other selected sheets.

Change-Id: Ib160535cccebcfcabee94d17e5941cc3cd23bb15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125601
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Tomaž Vajngerl 

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 65c1d27074b3..e910473de6e7 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1162,8 +1162,11 @@ void TabBar::Paint(vcl::RenderContext& rRenderContext, 
const tools::Rectangle& r
 aDrawer.mbProtect = pItem->mbProtect;
 aDrawer.drawTab();
 
-// actual page is drawn using a bold font
-rRenderContext.SetFont(aLightFont);
+// currently visible sheet is drawn using a bold font
+if (bCurrent)
+rRenderContext.SetFont(aFont);
+else
+rRenderContext.SetFont(aLightFont);
 
 // Set the correct FillInBrush depending on status
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - svtools/source

2021-11-22 Thread Justin Luth (via logerrit)
 svtools/source/control/tabbar.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 13c0794e2040e3a29801a56c6eb9835f364f8f27
Author: Justin Luth 
AuthorDate: Sat Nov 20 20:29:17 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 22 14:27:23 2021 +0100

tdf#132470 tabbar: revert back to bold font on visible tab

This is a partial regression to LO 6.3's
commit fad98c8641342a77241124dd98e0cb781daef4ad.

The current sheet is always selected, which is fairly
distinctive. However, it is possible to select
multiple sheets, and the current one should be
distinctly marked to differentiate it from
the other selected sheets.

Change-Id: Ib160535cccebcfcabee94d17e5941cc3cd23bb15
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125601
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit fbda2f3b7b47021a140cbfd3288aa7de1b42e1fd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125462
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 4bca7ccbb99d..612686c50a73 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -1162,8 +1162,11 @@ void TabBar::Paint(vcl::RenderContext& rRenderContext, 
const tools::Rectangle& r
 aDrawer.mbProtect = pItem->mbProtect;
 aDrawer.drawTab();
 
-// actual page is drawn using a bold font
-rRenderContext.SetFont(aLightFont);
+// currently visible sheet is drawn using a bold font
+if (bCurrent)
+rRenderContext.SetFont(aFont);
+else
+rRenderContext.SetFont(aLightFont);
 
 // Set the correct FillInBrush depending on status
 


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

2021-11-20 Thread Justin Luth (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |5 +
 sd/qa/unit/data/pptx/tdf118776.pptx  |binary
 sd/qa/unit/import-tests2.cxx |   23 +++
 3 files changed, 28 insertions(+)

New commits:
commit 823a351adb0384598304d597ae7f637079ca6175
Author: Justin Luth 
AuthorDate: Tue Nov 16 13:46:07 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 20 15:13:02 2021 +0100

tdf#118776 drawingml: treat XML_nofill as (mostly) transparent

100% transparent typically ends up as COL_AUTO which
certainly doesn't do what is intended.
So set as 99% transparent to get effectively
the same invisible effect.

Adapted patch and re-used unit test from an earlier
commit authored by Xisco. This depends on tdf#137438
not spamming the text properties with outline props.

Only one existing unit test that matched this condition:
-export-tests-ooxml1.cxx customxml.pptx
   -empty textbox - text entered here SHOULD be invisible.

Change-Id: I077b748e500713188421f0eeefdfd85c46555e84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125301
Tested-by: Jenkins
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 
Reviewed-by: Justin Luth 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 9200e9666cbf..a34cb14af639 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,11 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 if ( maFillProperties.moFillType.has() )
 {
 Color aColor = maFillProperties.getBestSolidColor();
+
+// noFill doesn't exist for characters. Map noFill to 99% transparency
+if (maFillProperties.moFillType.get() == XML_noFill)
+aColor.addTransformation(XML_alpha, 1000);
+
 // tdf#137438 Emulate text outline color/transparency.
 // If the outline color dominates, then use it as the text color.
 if (moTextOutlineProperties.has()
diff --git a/sd/qa/unit/data/pptx/tdf118776.pptx 
b/sd/qa/unit/data/pptx/tdf118776.pptx
new file mode 100644
index ..8df94522ab29
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf118776.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 9a5021f533b6..c299ad4303dd 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -118,6 +118,7 @@ public:
 void testTdf103792();
 void testTdf103876();
 void testTdf79007();
+void testTdf118776();
 void testTdf129686();
 void testTdf104015();
 void testTdf104201();
@@ -183,6 +184,7 @@ public:
 CPPUNIT_TEST(testTdf103792);
 CPPUNIT_TEST(testTdf103876);
 CPPUNIT_TEST(testTdf79007);
+CPPUNIT_TEST(testTdf118776);
 CPPUNIT_TEST(testTdf129686);
 CPPUNIT_TEST(testTdf104015);
 CPPUNIT_TEST(testTdf104201);
@@ -547,6 +549,27 @@ void SdImportTest2::testTdf79007()
 xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf118776()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf118776.pptx"), 
PPTX);
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+
+// Get first paragraph of the text
+uno::Reference const xParagraph(getParagraphFromShape(0, 
xShape));
+
+// Get first run of the paragraph
+uno::Reference xRun(getRunFromParagraph(0, xParagraph));
+uno::Reference xPropSet(xRun, uno::UNO_QUERY_THROW);
+sal_Int16 nTransparency = 0;
+xPropSet->getPropertyValue("CharTransparence") >>= nTransparency;
+
+// Import noFill color as 99% transparency
+CPPUNIT_ASSERT_EQUAL(static_cast(99), nTransparency);
+
+xDocShRef->DoClose();
+}
+
 void SdImportTest2::testTdf129686()
 {
 sd::DrawDocShellRef xDocShRef


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2-3' - sc/source

2021-11-12 Thread Justin Luth (via logerrit)
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit b89853d017f862de9dfadcf9efdbcf7d68feb945
Author: Justin Luth 
AuthorDate: Wed Nov 10 09:15:58 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 13 06:33:59 2021 +0100

tdf#142986 sc sampling: allow more than default (100) samples

The default maximum for a spinbutton must be 100.
For some reason, the previous setMax to maxint was removed
in LO 6.3 in commit 2c5c20b19c349a4b7f6d78d69d8d57f9af5c351c.

Change-Id: I846c1ce037db6ef3b8d48975e24b748cad0394d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124948
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit eb50d356ffbe5bd2e3de9ac574ddf28ce4e034ad)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124972
(cherry picked from commit 62d82a9a4108f715cf1a2bf15205adc28e9fd31a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124974
Reviewed-by: Xisco Fauli 
Reviewed-by: Justin Luth 
Tested-by: Justin Luth 

diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx 
b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 608ba1a30fa1..fad4ac6d05a5 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -87,7 +87,9 @@ void ScSamplingDialog::Init()
 mxOutputRangeEdit->SetModifyHdl( aLink2);
 
 mxSampleSize->connect_value_changed( LINK( this, ScSamplingDialog, 
SamplingSizeValueModified ));
+mxSampleSize->set_range(1, SAL_MAX_INT32);
 mxPeriod->connect_value_changed( LINK( this, ScSamplingDialog, 
PeriodValueModified ));
+mxPeriod->set_range(1, SAL_MAX_INT32);
 
 mxPeriodicMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );
 mxRandomMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sw/source

2021-11-23 Thread Justin Luth (via logerrit)
 sw/source/uibase/shells/drwtxtex.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit cad293c26215855578eb218d7154ec8300960969
Author: Justin Luth 
AuthorDate: Tue Nov 23 10:23:37 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 24 03:03:09 2021 +0100

tdf#131150 sw menu: use nSlotId=0 to avoid adding to set

This fixes a regression in LO 6.4 caused by
commit 86cb2a1f98c0585d2121e6ae34fe62f072ef9a63

Not surprisingly, adding a new condition that multiple
other items match on caused a regression.

bFlag is always set to false at the top of the loop.
In the above commit, bFlag was not set to true,
and so thus it would always be false.
So just set the SlotId to 0
to avoid rSet.Put - like so many other cases already do.

Change-Id: I02e9ca9d8dd75db519e801ad0e86fc8d541ae20a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125688
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
Reviewed-by: Justin Luth 
(cherry picked from commit 87fafdb9dc045735e235cbba2ef37198043422c7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125707
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index 770b46d7e7ba..8ac84122ff41 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -953,6 +953,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
 {
 if (!URLFieldHelper::IsCursorAtURLField(pOLV))
 rSet.DisableItem(nWhich);
+nSlotId = 0;
 }
 break;
 default:
@@ -960,7 +961,7 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
 break;
 }
 
-if (nSlotId && bFlag)
+if (nSlotId)
 rSet.Put(SfxBoolItem(nWhich, bFlag));
 
 nWhich = aIter.NextWhich();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - vcl/source

2021-11-23 Thread Justin Luth (via logerrit)
 vcl/source/window/printdlg.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 6809461add683eaa49a11530445c1f4c4b3d8fe8
Author: Justin Luth 
AuthorDate: Tue Nov 23 09:18:20 2021 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 24 03:04:03 2021 +0100

tdf#129638 print preview: use new paper size after switching page

This is a partial revert of LO 6.3
commit 2c23a96f7b6888c0e05fdc2aba57f03cd797b647.

Change-Id: I17525d06d96779671caaa84e1e48629289453ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125685
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 324daa38a823477e1d1b650b5d91f3dc91c6a9af)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125466
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index c69799ed1c4e..251ce6002535 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -975,6 +975,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
 {
 PrinterController::PageSize aPageSize =
 maPController->getFilteredPageFile( mnCurPage, aMtf, 
i_bMayUseCache );
+aCurPageSize = aPrt->PixelToLogic(aPrt->GetPaperSizePixel(), 
MapMode(MapUnit::Map100thMM));
 if( ! aPageSize.bFullPaper )
 {
 Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), 
aMapMode ) );


[Libreoffice-commits] core.git: sc/source

2021-11-11 Thread Justin Luth (via logerrit)
 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit eb50d356ffbe5bd2e3de9ac574ddf28ce4e034ad
Author: Justin Luth 
AuthorDate: Wed Nov 10 09:15:58 2021 +0200
Commit: Eike Rathke 
CommitDate: Thu Nov 11 13:58:21 2021 +0100

tdf#142986 sc sampling: allow more than default (100) samples

The default maximum for a spinbutton must be 100.
For some reason, the previous setMax to maxint was removed
in LO 6.3 in commit 2c5c20b19c349a4b7f6d78d69d8d57f9af5c351c.

Change-Id: I846c1ce037db6ef3b8d48975e24b748cad0394d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124948
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx 
b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
index 608ba1a30fa1..fad4ac6d05a5 100644
--- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx
@@ -87,7 +87,9 @@ void ScSamplingDialog::Init()
 mxOutputRangeEdit->SetModifyHdl( aLink2);
 
 mxSampleSize->connect_value_changed( LINK( this, ScSamplingDialog, 
SamplingSizeValueModified ));
+mxSampleSize->set_range(1, SAL_MAX_INT32);
 mxPeriod->connect_value_changed( LINK( this, ScSamplingDialog, 
PeriodValueModified ));
+mxPeriod->set_range(1, SAL_MAX_INT32);
 
 mxPeriodicMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );
 mxRandomMethodRadio->connect_toggled( LINK( this, ScSamplingDialog, 
ToggleSamplingMethod ) );


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

2021-11-02 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/first-header-footerB.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx   |   18 +
 sw/source/filter/ww8/wrtw8sty.cxx  |   10 +
 3 files changed, 24 insertions(+), 4 deletions(-)

New commits:
commit f5c618f4e5d3ef2a33301d5f20035bb8bc213a38
Author: Justin Luth 
AuthorDate: Tue Oct 26 12:33:32 2021 +0200
Commit: Michael Stahl 
CommitDate: Tue Nov 2 09:58:02 2021 +0100

tdf#145317 sw ms export: handle First Page with a first header

partial revert of LO 5.2.4's tdf#101814.

Just because the page style has a first doesn't mean that it
should not check if it is also a first-follow that could be
merged into a single ww8section.

In this case, the follow page-style's H/F definitions were
lost, because only the First Page style was considered.

No existing unit tests matched these conditions.

I did test bug 101814's CAFCA - Modèle feuille A4 - v2015-2.odt
and it still shows the same H/F.

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

diff --git a/sw/qa/extras/ooxmlexport/data/first-header-footerB.odt 
b/sw/qa/extras/ooxmlexport/data/first-header-footerB.odt
new file mode 100644
index ..0ae1992ed7e1
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/first-header-footerB.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ce5092e01585..9f8ba44e6a2b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -226,6 +226,24 @@ DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooter, 
"first-header-footer.docx")
 CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"),  
parseDump("/root/page[6]/footer/txt/text()"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooterB, "first-header-footerB.odt")
+{
+CPPUNIT_ASSERT_EQUAL( 6, getPages() );
+
+CPPUNIT_ASSERT_EQUAL(OUString("First page header"),  
parseDump("/root/page[1]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("First page footer"),  
parseDump("/root/page[1]/footer/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Even page header"),   
parseDump("/root/page[2]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Even page footer"),   
parseDump("/root/page[2]/footer/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Odd page header"),  
parseDump("/root/page[3]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer"),  
parseDump("/root/page[3]/footer/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("First page header2"), 
parseDump("/root/page[4]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("First page footer 2"), 
parseDump("/root/page[4]/footer/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Odd page header 2"), 
parseDump("/root/page[5]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer 2"), 
parseDump("/root/page[5]/footer/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Even page header 2"),  
parseDump("/root/page[6]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"),  
parseDump("/root/page[6]/footer/txt/text()"));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testFDO83044)
 {
 loadAndSave("fdo83044.docx");
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 9a5441d366aa..72c171bacdff 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1736,9 +1736,7 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
 // it as title page.
 // With Left/Right changes it's different - we have to detect where
 // the change of pages is, but here it's too late for that!
-// tdf#101814 if there is already an explicit first-page, no point
-// in checking heuristics here.
-if ( !titlePage && pPd->GetFollow() && pPd != pPd->GetFollow() &&
+if ( pPd->GetFollow() && pPd != pPd->GetFollow() &&
  pPd->GetFollow()->GetFollow() == pPd->GetFollow() &&
  pPd->IsHeaderShared() && pPd->IsFooterShared() &&
  ( !rSepInfo.pPDNd || pPd->IsFollowNextPageOfNode( *rSepInfo.pPDNd 
) ) )
@@ -1747,7 +1745,11 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
 const SwFrameFormat& rFollowFormat = pFollow->GetMaster();

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

2021-11-02 Thread Justin Luth (via logerrit)
 dev/null  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx |3 ---
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx |   11 ---
 3 files changed, 14 deletions(-)

New commits:
commit 1891061f0b99c8a7c5d9983b925efcf401c958fd
Author: Justin Luth 
AuthorDate: Tue Nov 2 08:56:35 2021 +0200
Commit: Justin Luth 
CommitDate: Wed Nov 3 06:57:16 2021 +0100

prelim tdf#136472: remove implementation specific unit tests

These test documentations are completely pointless.
They test something implementation specific without
anything to actually test for accuracy.

4-test_segfault_while_save.docx: pseudo-preventative test.
8-fdo49940.docx: an empty page with no header/footer enabled.
  Who cares if it is called Default style or First Page.

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

diff --git a/sw/qa/extras/ooxmlexport/data/fdo49940.docx 
b/sw/qa/extras/ooxmlexport/data/fdo49940.docx
deleted file mode 100644
index 242284463632..
Binary files a/sw/qa/extras/ooxmlexport/data/fdo49940.docx and /dev/null differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index c0ed9c95a9e7..5cd8f4a0fe32 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -282,9 +282,6 @@ CPPUNIT_TEST_FIXTURE(Test, testSegFaultWhileSave)
 // fdo#74499
 xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
 CPPUNIT_ASSERT_EQUAL(static_cast(6137), getXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
-
-// tdf#106572 - preventative test matching danger conditions, but imported 
OK anyway
-CPPUNIT_ASSERT_EQUAL(OUString("First Page"), 
getProperty(getParagraphOrTable(1), "PageDescName"));
 }
 
 CPPUNIT_TEST_FIXTURE(Test, fdo69656)
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 7cc19abd58b6..d011d695d5a1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -144,17 +144,6 @@ DECLARE_OOXMLEXPORT_TEST(testN751117, "n751117.docx")
 
CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.drawing.LineShape"));
 }
 
-DECLARE_OOXMLEXPORT_TEST(testFdo49940, "fdo49940.docx")
-{
-uno::Reference xTextDocument(mxComponent, 
uno::UNO_QUERY);
-uno::Reference 
xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
-uno::Reference xParaEnum = 
xParaEnumAccess->createEnumeration();
-uno::Reference xPara(xParaEnum->nextElement(), 
uno::UNO_QUERY);
-OUString aValue;
-xPara->getPropertyValue("PageStyleName") >>= aValue;
-CPPUNIT_ASSERT_EQUAL(OUString("First Page"), aValue);
-}
-
 DECLARE_OOXMLEXPORT_TEST(testFdo74745, "fdo74745.docx")
 {
 uno::Reference paragraph = getParagraph(3);


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

2021-10-26 Thread Justin Luth (via logerrit)
 include/svl/numformat.hxx|2 ++
 svl/source/numbers/zforlist.cxx  |8 
 sw/source/core/table/swtable.cxx |   12 +++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 546e7d14b397cfd1210b891c8dc4a195c25f3876
Author: Justin Luth 
AuthorDate: Wed Oct 20 18:09:46 2021 +0200
Commit: Eike Rathke 
CommitDate: Tue Oct 26 16:04:13 2021 +0200

tdf#131025 swtable: don't apply number format to non-number text

Applying a numbering style to text causes export to save that
out as a number (valued as zero). That is not good because
the ODF spec says that a number overrides a string.

So don't accept a numbering format on non-number text.

Why is this change good?
-the cell previously had no direct formatting (by definition).
-the cell's previous old format was text (tested).
-any numbering format applied obviously isn't correct (by definition).
-any previous formatting has already been overwritten with numformat.
-the default numbering is appropriate for text.
-empty cells still get the numbering format (tested).
-odd human-designed formats are accepted as intentional (tested).

What are the concerns?
-the scope of this change is HUGE, way beyond this bug.
-on both my dev box and patch box I saw occassional crashes.
-the bug was "fixed" by a different import commit that ensured
 different languages were treated consistently.
 So this patch is no longer critical, just nice to have
 to avoid exporting out-of-spec content.

Change-Id: Id3dc5f803c3cf4875bc0cab52d1019a18679da77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123904
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx
index 4026ff71e4a4..2cbfeb9cd171 100644
--- a/include/svl/numformat.hxx
+++ b/include/svl/numformat.hxx
@@ -256,6 +256,8 @@ public:
 /// Get return string for Calc CELL() function, "G", "D1", ...
 OUString GetCalcCellReturn(sal_uInt32 nFormat) const;
 
+bool IsUserDefined(sal_uInt32 F_Index) const;
+
 /// Check if format code string may be deleted by user
 bool IsUserDefined(std::u16string_view sStr, LanguageType eLnge = 
LANGUAGE_DONTKNOW);
 
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index d2340bf2d968..3969f1885199 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3351,6 +3351,14 @@ OUString SvNumberFormatter::GenerateFormat(sal_uInt32 
nIndex,
 return sString.makeStringAndClear();
 }
 
+bool SvNumberFormatter::IsUserDefined(sal_uInt32 F_Index) const
+{
+::osl::MutexGuard aGuard( GetInstanceMutex() );
+const SvNumberformat* pFormat = GetFormatEntry(F_Index);
+
+return pFormat && (pFormat->GetType() & SvNumFormatType::DEFINED);
+}
+
 bool SvNumberFormatter::IsUserDefined(std::u16string_view sStr,
   LanguageType eLnge)
 {
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index a67b05a48e2f..9f68ca5203ff 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2318,6 +2318,7 @@ void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& 
rBox, const SwTableBoxNum
 // format contents with the new value assigned and write to paragraph
 const Color* pCol = nullptr;
 OUString sNewText;
+bool bChangeFormat = true;
 if(DBL_MAX == fVal)
 {
 sNewText = SwViewShell::GetShellRes()->aCalc_Error;
@@ -2342,6 +2343,14 @@ void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& 
rBox, const SwTableBoxNum
 #else
 sNewText = aOrigText;
 #endif
+// Remove the newly assigned numbering format as well if text 
actually exists.
+// Exception: assume user-defined formats are always 
intentional.
+if (bChgText && pNumFormatr->IsTextFormat(nOldFormat)
+&& !pNumFormatr->IsUserDefined(nNewFormat))
+{
+rBox.GetFrameFormat()->ResetFormatAttr(RES_BOXATR_FORMAT);
+bChangeFormat = false;
+}
 }
 
 if(!bChgText)
@@ -2349,7 +2358,8 @@ void SwTableBoxFormat::BoxAttributeChanged(SwTableBox& 
rBox, const SwTableBoxNum
 }
 
 // across all boxes
-ChgTextToNum(rBox, sNewText, pCol, GetDoc()->IsInsTableAlignNum());
+if (bChangeFormat)
+ChgTextToNum(rBox, sNewText, pCol, GetDoc()->IsInsTableAlignNum());
 
 }
 else if(bNewIsTextFormat && nOldFormat != nNewFormat)


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

2021-11-05 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 74723bbe6b860e54c26711c108f1e2d2388e8feb
Author: Justin Luth 
AuthorDate: Sat Oct 23 13:02:24 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Nov 5 17:22:59 2021 +0100

NFC writerfilter: simplify logic

if (!A && !B || B) is the same as
if (!A || B)

and the ELSE is also by definition A && !B now.

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index dcec98ed59e0..e338664d6068 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2885,7 +2885,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 {
 bool bLeft = eType == SectionPropertyMap::PAGE_LEFT;
 bool bFirst = eType == SectionPropertyMap::PAGE_FIRST;
-if ((!bLeft && !GetSettingsTable()->GetEvenAndOddHeaders()) || 
(GetSettingsTable()->GetEvenAndOddHeaders()))
+if (!bLeft || GetSettingsTable()->GetEvenAndOddHeaders())
 {
 //switch on header/footer use
 xPageStyle->setPropertyValue(
@@ -2913,7 +2913,7 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 m_bDiscardHeaderFooter = false; // set only on success!
 }
 // If we have *hidden* header footer
-else if (bLeft && !GetSettingsTable()->GetEvenAndOddHeaders())
+else
 {
 bool bIsShared = false;
 // Turn on the headers


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

2021-11-05 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit a2d322c02af05db1b785633ea398fe0b62b67605
Author: Justin Luth 
AuthorDate: Sat Oct 23 13:25:41 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 6 05:06:00 2021 +0100

NFC writerfilter: m_bDiscardHeaderFooter = false in both cases

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e338664d6068..8887a79d65a2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2910,7 +2910,6 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 ? uno::Reference()
 : xText->createTextCursorByRange(xText->getStart())),
 bHeader));
-m_bDiscardHeaderFooter = false; // set only on success!
 }
 // If we have *hidden* header footer
 else
@@ -2931,11 +2930,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 TextAppendContext(uno::Reference(xText, 
uno::UNO_QUERY_THROW),
   m_bIsNewDoc ? 
uno::Reference()
   : 
xText->createTextCursorByRange(xText->getStart(;
-m_bDiscardHeaderFooter = false; // set only on success!
 // Restore the original state of the shared prop after we stored 
the necessary values.
 xPageStyle->setPropertyValue(getPropertyName(ePropShared), 
uno::makeAny(bIsShared));
 }
-
+m_bDiscardHeaderFooter = false; // set only on success!
 }
 catch( const uno::Exception& )
 {


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

2021-11-06 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/PropertyMap.cxx |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 0ce586e1e50deeaf2ba210acc4fea08058f8b15c
Author: Justin Luth 
AuthorDate: Thu Nov 4 13:28:39 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Nov 6 08:45:08 2021 +0100

related tdf#136472 writerfilter: only copy even pages if used

Allowing the use of Even pages is a document-level setting.
So if the document does not allow the use of an even page,
although we will read it in once (in order to preserve the contents)
there is no point in copying it to every inheriting page style
(especially if it contains large items like images).

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

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx 
b/writerfilter/source/dmapper/PropertyMap.cxx
index 393d49839cc9..dc833c363571 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -957,6 +957,7 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 SectionPropertyMap* pLastContext = rDM_Impl.GetLastSectionContext();
 if ( pLastContext )
 {
+const bool bUseEvenPages = 
rDM_Impl.GetSettingsTable()->GetEvenAndOddHeaders();
 uno::Reference< beans::XPropertySet > xPrevStyle = 
pLastContext->GetPageStyle( rDM_Impl,
 bFirstPage );
 uno::Reference< beans::XPropertySet > xStyle = GetPageStyle( rDM_Impl,
@@ -971,10 +972,10 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool 
bFirstPage, DomainMapper_Imp
 else
 {
 CopyHeaderFooter( xPrevStyle, xStyle,
-!m_bDefaultHeaderLinkToPrevious,
-!m_bEvenPageHeaderLinkToPrevious,
-!m_bDefaultFooterLinkToPrevious,
-!m_bEvenPageFooterLinkToPrevious );
+ !m_bDefaultHeaderLinkToPrevious,
+ !(m_bEvenPageHeaderLinkToPrevious && 
bUseEvenPages),
+ !m_bDefaultFooterLinkToPrevious,
+ !(m_bEvenPageFooterLinkToPrevious && 
bUseEvenPages));
 }
 }
 SAL_INFO( "writerfilter", "END>>> 
SectionPropertyMap::CopyLastHeaderFooter()" );


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

2021-11-03 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |2 +-
 sw/qa/extras/ooxmlexport/ooxmlexport4.cxx  |   23 +--
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx  |   29 +++--
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx  |   12 ++--
 4 files changed, 19 insertions(+), 47 deletions(-)

New commits:
commit bac1b748f5b600952b9bf3eaaaf5a4bb8342fe59
Author: Justin Luth 
AuthorDate: Tue Nov 2 09:11:19 2021 +0200
Commit: Justin Luth 
CommitDate: Thu Nov 4 06:24:20 2021 +0100

prelim tdf#136472: adjust implementation specific unit tests

Using a "First Page" style before a "Default Page Style"
in order to apply a different header to the first page
is an implementation specific detail.
As of LO 4.0/4.1, we have the ability to set a different
first-header (different even-odd were already available).

So remove any dependency on "First Page".

4-inheritFirstHeader.docx: just test the actual layout
8-n777337.docx: margins must match both page styles.
   -First and Standard are defined from the same settings
8-n779642.docx: reverting the patch breaks unit test: GOOD
8-n780843.docx: export of footer works now - so test that.
   -PROOF: CONTINUOUS BREAK - SHOULDN"T SHOW FIRST PAGE - so turn off.
9-headerfooter-link-to-prev.docx: a real thorn test.
   -happy it still passes after making this logical-seeming change.
15-tdf135216_evenOddFooter.odt: is first of odd in ODT.
   -when first is shared, it still works to check first.

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 9decd693f327..d5da1882eb35 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -474,7 +474,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135216_evenOddFooter, 
"tdf135216_evenOddFooter.o
 xCursor->jumpToNextPage();
 pageStyleName = getProperty(xCursor, "PageStyleName");
 xPageStyle.set(xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
-xFooter.set(getProperty>(xPageStyle, 
"FooterTextRight"));
+xFooter.set(getProperty>(xPageStyle, 
"FooterTextFirst"));
 CPPUNIT_ASSERT_EQUAL(OUString("odd page - first footer"), 
xFooter->getString());
 
 xCursor->jumpToNextPage();
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index 5cd8f4a0fe32..5858eec46524 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -1187,24 +1187,11 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf95367_inheritFollowStyle, "tdf95367_inheritFollo
 DECLARE_OOXMLEXPORT_TEST(testInheritFirstHeader,"inheritFirstHeader.docx")
 {
 // First page headers always link to last used first header, never to a follow 
header
-uno::Reference xModel(mxComponent, uno::UNO_QUERY);
-uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
-uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
-
-xCursor->jumpToLastPage();
-OUString sPageStyleName = getProperty( xCursor, "PageStyleName" 
);
-uno::Reference xHeaderText = getProperty< 
uno::Reference 
>(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
-CPPUNIT_ASSERT_EQUAL( OUString("Last Header"), xHeaderText->getString() );
-
-xCursor->jumpToPreviousPage();
-sPageStyleName = getProperty( xCursor, "PageStyleName" );
-xHeaderText = getProperty< uno::Reference 
>(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
-CPPUNIT_ASSERT_EQUAL( OUString("First Header"), xHeaderText->getString() );
-
-xCursor->jumpToPreviousPage();
-sPageStyleName = getProperty( xCursor, "PageStyleName" );
-xHeaderText = getProperty< uno::Reference 
>(getStyles("PageStyles")->getByName(sPageStyleName), "HeaderText");
-CPPUNIT_ASSERT_EQUAL( OUString("Follow Header"), xHeaderText->getString() 
);
+CPPUNIT_ASSERT_EQUAL(OUString("First Header"), 
parseDump("/root/page[1]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Follow Header"), 
parseDump("/root/page[2]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Follow Header"), 
parseDump("/root/page[3]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("First Header"), 
parseDump("/root/page[4]/header/txt/text()"));
+CPPUNIT_ASSERT_EQUAL(OUString("Last Header&qu

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

2021-10-23 Thread Justin Luth (via logerrit)
 sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt |binary
 sw/qa/extras/odfexport/odfexport2.cxx|   12 
 sw/source/filter/xml/xmltbli.cxx |2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 3e1d316734354c6b49696c8904e0fc431cfb5143
Author: Justin Luth 
AuthorDate: Fri Oct 22 21:11:59 2021 +0200
Commit: Eike Rathke 
CommitDate: Sat Oct 23 14:51:23 2021 +0200

tdf#131025 ODF import: recognize SV_COUNTRY_LANGUAGE_OFFSET

File import was making an exception for "float value 0"
if the accompanying text had no resemblance to the value 0,
but that only applied to GENERAL number format.

It should apply to any language's default number format.

REGRESSION warning: as we can see, this has been handled
inconsistently in the past. But from the coding exception to overcome
losing text to a zero (and the huge number of duplicate bugs)
the best choice seems to be ignore the spec that says that
a number value overrides the text value - at least in
the case where the number value is zero.

Change-Id: I701e72c6a5dad42c7799ab501255a4859adf61d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124080
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
new file mode 100644
index ..f2bffb050ac4
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport2.cxx 
b/sw/qa/extras/odfexport/odfexport2.cxx
index 28d0cd873944..c9eb4cdd18aa 100644
--- a/sw/qa/extras/odfexport/odfexport2.cxx
+++ b/sw/qa/extras/odfexport/odfexport2.cxx
@@ -8,7 +8,9 @@
  */
 
 #include 
+#include 
 
+#include 
 
 class Test : public SwModelTestBase
 {
@@ -52,6 +54,16 @@ DECLARE_ODFEXPORT_TEST(testTdf104254_noHeaderWrapping, 
"tdf104254_noHeaderWrappi
 CPPUNIT_ASSERT_MESSAGE("Paragraph should fit on a single line", 
nParaHeight < 600);
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, 
"tdf131025_noZerosInTable.odt")
+{
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTables = 
xSupplier->getTextTables();
+uno::Reference xTable(xTables->getByName("Table1"), 
uno::UNO_QUERY);
+
+uno::Reference xCell(xTable->getCellByName("C3"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString());
+}
+
 DECLARE_ODFEXPORT_TEST(testTdf143793_noBodyWrapping, 
"tdf143793_noBodyWrapping.odt")
 {
 CPPUNIT_ASSERT_EQUAL(2, getShapes());
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index b7efd43a3dea..2b02a1360a94 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1916,7 +1916,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 {
 const SwTableBoxNumFormat* pNumFormat =
 static_cast( pItem );
-if( ( pNumFormat != nullptr ) && ( pNumFormat->GetValue() == 0 
) )
+if (pNumFormat && (pNumFormat->GetValue() % 
SV_COUNTRY_LANGUAGE_OFFSET) == 0)
 {
 // only one text node?
 SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );


[Libreoffice-commits] core.git: sc/source

2021-12-09 Thread Justin Luth (via logerrit)
 sc/source/ui/miscdlgs/anyrefdg.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit a99aea61c3199dc8188d4d873a10201082dff2e2
Author: Justin Luth 
AuthorDate: Tue Dec 7 15:19:45 2021 +0200
Commit: Justin Luth 
CommitDate: Thu Dec 9 15:12:03 2021 +0100

tdf#121699 sc: wrap LOKit stuff with isActive

This is a partial revert of LO 6.1
commit 009d2756b1678477ec23d5647bd5004c4bff3a62.

It is one thing to change code that you don't really
know why it is setup that way, but it is another thing
to ignore the resulting regression reports for 3 years.
Not impressed.

It look me only 1 hour to work through this,
and this is completely outside of my normal
line of programming.

Change-Id: I8671677f38cc1332c6c5a76847801e2680097048
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126500
Tested-by: Jenkins
Reviewed-by: Henry Castro 
Reviewed-by: Justin Luth 

diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx 
b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 7e310d12cb45..20b2d7318df4 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -458,6 +458,28 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
 
 void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
 {
+if (!comphelper::LibreOfficeKit::isActive())
+{
+// lock / unlock only the dispatchers of Calc documents
+ScDocShell* pDocShell = 
static_cast(SfxObjectShell::GetFirst(checkSfxObjectShell));
+while (pDocShell)
+{
+SfxViewFrame* pFrame = SfxViewFrame::GetFirst(pDocShell);
+while (pFrame)
+{
+SfxDispatcher* pDisp = pFrame->GetDispatcher();
+if (pDisp)
+pDisp->Lock(bLock);
+pFrame = SfxViewFrame::GetNext(*pFrame, pDocShell);
+}
+pDocShell = 
static_cast(SfxObjectShell::GetNext(*pDocShell, 
checkSfxObjectShell));
+}
+return;
+// if a new view is created while the dialog is open,
+// that view's dispatcher is locked when trying to create the dialog
+// for that view (ScTabViewShell::CreateRefDialog)
+}
+
 //  lock / unlock only the dispatcher of Calc document
 SfxDispatcher* pDisp = nullptr;
 if ( m_pBindings )


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

2021-12-08 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx |   61 +
 sc/source/filter/oox/stylesbuffer.cxx  |4 -
 3 files changed, 63 insertions(+), 2 deletions(-)

New commits:
commit ab99d16e21e56596803b7d9a28af0895b435ef3e
Author: Justin Luth 
AuthorDate: Tue Nov 30 15:15:24 2021 +0200
Commit: Justin Luth 
CommitDate: Wed Dec 8 18:32:28 2021 +0100

tdf#123139 sc oox: CellXf should default to applyAlignment

Since the same logic applied to applyProtection
I tested and changed that one too.

No documentation was found to support the comment
(which was probably taken from binary import)
that applyAlignment had a context-dependent default value.

Testing on the other hand suggests that applyAlignment
is always considered true in the case of CellXf
and only matters for CellStyleXf.
The unit test tests for this - confirmed on Excel 2003/2016.

No existing unit tests where found with an
assert(rXf1.maModel.mbAlignUsed ||
(rXf1.maAlignment.getApiData() == rXf2.maAlignment.getApiData()));

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

diff --git a/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx 
b/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx
new file mode 100644
index ..e8ffc4861f45
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf123139_applyAlignment.xlsx 
differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index a74fff7e04af..1dc763f96631 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -185,6 +186,7 @@ public:
 void testTdf121718_UseFirstPageNumberXLSX();
 void testHeaderFontStyleXLSX();
 void testTdf135828_Shape_Rect();
+void testTdf123139XLSX();
 void testTdf123353();
 void testTdf140098();
 void testTdf133688_precedents();
@@ -298,6 +300,7 @@ public:
 CPPUNIT_TEST(testTdf121718_UseFirstPageNumberXLSX);
 CPPUNIT_TEST(testHeaderFontStyleXLSX);
 CPPUNIT_TEST(testTdf135828_Shape_Rect);
+CPPUNIT_TEST(testTdf123139XLSX);
 CPPUNIT_TEST(testTdf123353);
 CPPUNIT_TEST(testTdf140098);
 CPPUNIT_TEST(testTdf133688_precedents);
@@ -2169,6 +2172,64 @@ void ScExportTest2::testTdf135828_Shape_Rect()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(1988280, nHeight, 1);
 }
 
+void ScExportTest2::testTdf123139XLSX()
+{
+ScDocShellRef xDocSh = loadDoc(u"tdf123139_applyAlignment.", FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
+
+ScDocument& rDoc = xDocSh->GetDocument();
+const ScPatternAttr* pAttr = rDoc.GetPattern(0, 0, 0); //A1
+
+{
+const SvxHorJustifyItem& rJustify = pAttr->GetItem(ATTR_HOR_JUSTIFY);
+CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Repeat, rJustify.GetValue());
+}
+
+pAttr = rDoc.GetPattern(0, 1, 0); //A2
+
+{
+const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY);
+const SvxHorJustifyItem& rJustify = static_cast(rItem);
+CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Center, rJustify.GetValue());
+}
+
+{
+const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION);
+CPPUNIT_ASSERT(rItem.GetProtection());
+CPPUNIT_ASSERT(!rItem.GetHideFormula());
+}
+
+pAttr = rDoc.GetPattern(2, 0, 0); //C1
+
+{
+const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY);
+const SvxHorJustifyItem& rJustify = static_cast(rItem);
+CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Standard, rJustify.GetValue());
+}
+
+{
+const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION);
+CPPUNIT_ASSERT(rItem.GetProtection());
+CPPUNIT_ASSERT(rItem.GetHideFormula());
+}
+
+pAttr = rDoc.GetPattern(2, 1, 0); //C2
+
+{
+const SfxPoolItem& rItem = pAttr->GetItem(ATTR_HOR_JUSTIFY);
+const SvxHorJustifyItem& rJustify = static_cast(rItem);
+CPPUNIT_ASSERT_EQUAL(SvxCellHorJustify::Block, rJustify.GetValue());
+}
+
+{
+const ScProtectionAttr& rItem = pAttr->GetItem(ATTR_PROTECTION);
+CPPUNIT_ASSERT(!rItem.GetProtection());
+CPPUNIT_ASSERT(!rItem.GetHideFormula());
+}
+
+xDocSh->DoClose();
+}
+
 void ScExportTest2::testTdf123353()
 {
 ScDocShellRef xShell = loadDoc(u"tdf123353.", FORMAT_XLSX);
diff --git a/sc/source/filter/oox/stylesbuffer.cxx 
b/sc/source/filter/oox/stylesbuffer.cxx
index d40fcdc3d395..ad17e1db9f4e 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -1976,1

[Libreoffice-commits] core.git: sc/source

2021-12-09 Thread Justin Luth (via logerrit)
 sc/source/core/data/documen3.cxx |6 +++---
 sc/source/core/data/validat.cxx  |6 +++---
 sc/source/ui/app/inputhdl.cxx|4 ++--
 sc/source/ui/view/gridwin.cxx|4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit ac1ea5944a236efef75af7c85d0ffe10d374e7fa
Author: Justin Luth 
AuthorDate: Mon Dec 6 14:53:14 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Dec 10 01:46:41 2021 +0100

new ScTypedStrData: typically missed argument in CTOR, tdf#142910 follow-up

Pretty much any attempted use of eType was completely wrong and lost.

Regression from

commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
CommitDate: Wed Jul 7 17:44:46 2021 +0200

tdf#142910 sc filter: fix "greater than" or "smaller than" etc

Most calls to this are missing the "rounded number" argument,
so the enumator is actually accepted as the double fRVal,
and the StringValue eType was left as the default value (Standard),
instead of the intended enumerator.

0.0 looks too much like 0, 0 to even notice in
casual code reading.

This had rendered the type mostly irrelevant.

Change-Id: If4fa69d4b3077981244a2c3a785f80b77f9f9501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126453
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index cd10db483ae5..163c374b6406 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1668,7 +1668,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 if ( pRangeName )
 {
 for (const auto& rEntry : *pRangeName)
-rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 
ScTypedStrData::Name));
+rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 0.0, 
ScTypedStrData::Name));
 }
 
 // Database collection
@@ -1676,7 +1676,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 {
 const ScDBCollection::NamedDBs& rDBs = pDBCollection->getNamedDBs();
 for (const auto& rxDB : rDBs)
-rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 
ScTypedStrData::DbName));
+rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 0.0, 
ScTypedStrData::DbName));
 }
 
 // Content of name ranges
@@ -1699,7 +1699,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 continue;
 
 OUString aStr = aIter.getString();
-rStrings.insert(ScTypedStrData(aStr, 0.0, 
ScTypedStrData::Header));
+rStrings.insert(ScTypedStrData(aStr, 0.0, 0.0, 
ScTypedStrData::Header));
 }
 }
 }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index ade4908df44a..78541960a11c 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -836,7 +836,7 @@ bool ScValidationData::GetSelectionFromFormula(
 }
 
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, 0.0, 
ScTypedStrData::Standard));
+pEntry.reset(new ScTypedStrData(aValStr, 0.0, 0.0, 
ScTypedStrData::Standard));
 
 if (!rCell.isEmpty() && rMatch < 0)
 aCondTokArr.AddString(rSPool.intern(aValStr));
@@ -873,7 +873,7 @@ bool ScValidationData::GetSelectionFromFormula(
 aCondTokArr.AddDouble( nMatVal.fVal );
 }
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, nMatVal.fVal, 
ScTypedStrData::Value));
+pEntry.reset(new ScTypedStrData(aValStr, nMatVal.fVal, 
nMatVal.fVal, ScTypedStrData::Value));
 }
 
 if (rMatch < 0 && !rCell.isEmpty() && IsEqualToTokenArray(rCell, 
rPos, aCondTokArr))
@@ -916,7 +916,7 @@ bool 
ScValidationData::FillSelectionList(std::vector& rStrColl,
 OUString aStr(pString);
 bool bIsValue = 
GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue);
 rStrColl.emplace_back(
-aStr, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
+aStr, fValue, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
 }
 bOk = aIt.Ok();
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f4540b11ddee..24d99a658e48 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1033,10 +1033,10 @@ void ScInputHandler::GetFormulaData()
 maFormulaChar.insert( c );
 }
 OUString aFuncName = *pDesc->mxFuncName + aParenthesesReplacement;
-  

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2021-12-09 Thread Justin Luth (via logerrit)
 sc/source/core/data/documen3.cxx |6 +++---
 sc/source/core/data/validat.cxx  |6 +++---
 sc/source/ui/app/inputhdl.cxx|4 ++--
 sc/source/ui/view/gridwin.cxx|4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 20c1ab5d85e3f24d4cdf6ab167ea6ce98e2586b4
Author: Justin Luth 
AuthorDate: Mon Dec 6 14:53:14 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Dec 10 02:57:53 2021 +0100

new ScTypedStrData: typically missed argument in CTOR, tdf#142910 follow-up

Pretty much any attempted use of eType was completely wrong and lost.

Regression from

commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
CommitDate: Wed Jul 7 17:44:46 2021 +0200

tdf#142910 sc filter: fix "greater than" or "smaller than" etc

Most calls to this are missing the "rounded number" argument,
so the enumator is actually accepted as the double fRVal,
and the StringValue eType was left as the default value (Standard),
instead of the intended enumerator.

0.0 looks too much like 0, 0 to even notice in
casual code reading.

This had rendered the type mostly irrelevant.

Change-Id: If4fa69d4b3077981244a2c3a785f80b77f9f9501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126453
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 
(cherry picked from commit ac1ea5944a236efef75af7c85d0ffe10d374e7fa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126591
Tested-by: Jenkins

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 92c721fa48ca..a1e7a2d9e73b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1669,7 +1669,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 if ( pRangeName )
 {
 for (const auto& rEntry : *pRangeName)
-rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 
ScTypedStrData::Name));
+rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 0.0, 
ScTypedStrData::Name));
 }
 
 // Database collection
@@ -1677,7 +1677,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 {
 const ScDBCollection::NamedDBs& rDBs = pDBCollection->getNamedDBs();
 for (const auto& rxDB : rDBs)
-rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 
ScTypedStrData::DbName));
+rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 0.0, 
ScTypedStrData::DbName));
 }
 
 // Content of name ranges
@@ -1700,7 +1700,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 continue;
 
 OUString aStr = aIter.getString();
-rStrings.insert(ScTypedStrData(aStr, 0.0, 
ScTypedStrData::Header));
+rStrings.insert(ScTypedStrData(aStr, 0.0, 0.0, 
ScTypedStrData::Header));
 }
 }
 }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index d467db7ccf0f..6f578402309d 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -843,7 +843,7 @@ bool ScValidationData::GetSelectionFromFormula(
 }
 
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, 0.0, 
ScTypedStrData::Standard));
+pEntry.reset(new ScTypedStrData(aValStr, 0.0, 0.0, 
ScTypedStrData::Standard));
 
 if (!rCell.isEmpty() && rMatch < 0)
 aCondTokArr.AddString(rSPool.intern(aValStr));
@@ -880,7 +880,7 @@ bool ScValidationData::GetSelectionFromFormula(
 aCondTokArr.AddDouble( nMatVal.fVal );
 }
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, nMatVal.fVal, 
ScTypedStrData::Value));
+pEntry.reset(new ScTypedStrData(aValStr, nMatVal.fVal, 
nMatVal.fVal, ScTypedStrData::Value));
 }
 
 if (rMatch < 0 && !rCell.isEmpty() && IsEqualToTokenArray(rCell, 
rPos, aCondTokArr))
@@ -923,7 +923,7 @@ bool 
ScValidationData::FillSelectionList(std::vector& rStrColl,
 OUString aStr(pString);
 bool bIsValue = 
GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue);
 rStrColl.emplace_back(
-aStr, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
+aStr, fValue, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
 }
 bOk = aIt.Ok();
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f3f672d23d42..7d16794db8b1 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -993,10 +993,10 @@ void ScInputHandler::GetForm

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2021-12-09 Thread Justin Luth (via logerrit)
 sc/source/core/data/documen3.cxx |6 +++---
 sc/source/core/data/validat.cxx  |6 +++---
 sc/source/ui/app/inputhdl.cxx|4 ++--
 sc/source/ui/view/gridwin.cxx|4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 77727e6dbcf1a42113ed442d840e941b5ce08bcd
Author: Justin Luth 
AuthorDate: Mon Dec 6 14:53:14 2021 +0200
Commit: Eike Rathke 
CommitDate: Fri Dec 10 02:57:38 2021 +0100

new ScTypedStrData: typically missed argument in CTOR, tdf#142910 follow-up

Pretty much any attempted use of eType was completely wrong and lost.

Regression from

commit f6b143a57d9bd8f5d7b29febcb4e01ee1eb2ff1d
CommitDate: Wed Jul 7 17:44:46 2021 +0200

tdf#142910 sc filter: fix "greater than" or "smaller than" etc

Most calls to this are missing the "rounded number" argument,
so the enumator is actually accepted as the double fRVal,
and the StringValue eType was left as the default value (Standard),
instead of the intended enumerator.

0.0 looks too much like 0, 0 to even notice in
casual code reading.

This had rendered the type mostly irrelevant.

Change-Id: If4fa69d4b3077981244a2c3a785f80b77f9f9501
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126453
Tested-by: Eike Rathke 
Reviewed-by: Eike Rathke 
(cherry picked from commit ac1ea5944a236efef75af7c85d0ffe10d374e7fa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126592
Tested-by: Jenkins

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 5d5583628985..420befae37d2 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1668,7 +1668,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 if ( pRangeName )
 {
 for (const auto& rEntry : *pRangeName)
-rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 
ScTypedStrData::Name));
+rStrings.insert(ScTypedStrData(rEntry.second->GetName(), 0.0, 0.0, 
ScTypedStrData::Name));
 }
 
 // Database collection
@@ -1676,7 +1676,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 {
 const ScDBCollection::NamedDBs& rDBs = pDBCollection->getNamedDBs();
 for (const auto& rxDB : rDBs)
-rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 
ScTypedStrData::DbName));
+rStrings.insert(ScTypedStrData(rxDB->GetName(), 0.0, 0.0, 
ScTypedStrData::DbName));
 }
 
 // Content of name ranges
@@ -1699,7 +1699,7 @@ void ScDocument::GetFormulaEntries( ScTypedCaseStrSet& 
rStrings )
 continue;
 
 OUString aStr = aIter.getString();
-rStrings.insert(ScTypedStrData(aStr, 0.0, 
ScTypedStrData::Header));
+rStrings.insert(ScTypedStrData(aStr, 0.0, 0.0, 
ScTypedStrData::Header));
 }
 }
 }
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index ade4908df44a..78541960a11c 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -836,7 +836,7 @@ bool ScValidationData::GetSelectionFromFormula(
 }
 
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, 0.0, 
ScTypedStrData::Standard));
+pEntry.reset(new ScTypedStrData(aValStr, 0.0, 0.0, 
ScTypedStrData::Standard));
 
 if (!rCell.isEmpty() && rMatch < 0)
 aCondTokArr.AddString(rSPool.intern(aValStr));
@@ -873,7 +873,7 @@ bool ScValidationData::GetSelectionFromFormula(
 aCondTokArr.AddDouble( nMatVal.fVal );
 }
 if( nullptr != pStrings )
-pEntry.reset(new ScTypedStrData( aValStr, nMatVal.fVal, 
ScTypedStrData::Value));
+pEntry.reset(new ScTypedStrData(aValStr, nMatVal.fVal, 
nMatVal.fVal, ScTypedStrData::Value));
 }
 
 if (rMatch < 0 && !rCell.isEmpty() && IsEqualToTokenArray(rCell, 
rPos, aCondTokArr))
@@ -916,7 +916,7 @@ bool 
ScValidationData::FillSelectionList(std::vector& rStrColl,
 OUString aStr(pString);
 bool bIsValue = 
GetDocument()->GetFormatTable()->IsNumberFormat(aStr, nFormat, fValue);
 rStrColl.emplace_back(
-aStr, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
+aStr, fValue, fValue, bIsValue ? ScTypedStrData::Value : 
ScTypedStrData::Standard);
 }
 bOk = aIt.Ok();
 
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6466c30576f0..b9ee0d62d02b 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1042,10 +1042,10 @@ void ScInputHandler::GetForm

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/qa sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods |binary
 sc/qa/unit/subsequent_export-test.cxx |   18 ++
 sc/source/filter/xml/xmlcoli.cxx  |1 +
 3 files changed, 19 insertions(+)

New commits:
commit 5e76c14d20799a2cbecdccc2e8b71961a0696f15
Author: Justin Luth 
AuthorDate: Wed Dec 8 14:22:01 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Dec 13 16:00:52 2021 +0100

tdf#128895 sc xmlimport: create enough dynamic cols if props

Since LO 6.3, only 64 columns are created by default,
where previously it was a fixed 1024.

A common user practice is to hide all columns not used,
but this collapsed property was lost because
only part of the columns were actually created and thus exported.

In this example, import specifies 1017 hidden columns (H-AMJ),
but since only 64 columns are created, export only specified 57.

So ensure that on import, any column with defined properties
is created - even if they don't contain any content.

Change-Id: If928880baf5585613715a1f4361a9059584d1ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Bartosz Kosiorek 
(cherry picked from commit 297ab561c6754f89326a1e8ce1751233669578d7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126668
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126728

diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods
new file mode 100644
index ..fa016369f206
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx 
b/sc/qa/unit/subsequent_export-test.cxx
index 31c0aae3dd71..431a03ebca65 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -142,6 +142,7 @@ public:
 #endif
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
+void testHiddenEmptyColsODS();
 void testAllRowsHiddenXLSX();
 void testLandscapeOrientationXLSX();
 
@@ -258,6 +259,7 @@ public:
 #endif
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testHiddenEmptyColsODS);
 CPPUNIT_TEST(testAllRowsHiddenXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
@@ -1411,6 +1413,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
 xShell->DoClose();
 }
 
+void ScExportTest::testHiddenEmptyColsODS()
+{
+//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to 
.XLSX
+ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"content.xml");
+CPPUNIT_ASSERT(pSheet);
+assertXPath(pSheet, "//table:table/table:table-column[2]");
+assertXPath(pSheet, "//table:table/table:table-column[2]", 
"number-columns-repeated", "1017");
+
+xShell->DoClose();
+}
+
 void ScExportTest::testLandscapeOrientationXLSX()
 {
 //tdf#48767 - Landscape page orientation is not loaded from .xlsx format 
with MS Excel, after export with Libre Office
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 8bec39546541..0e4af7bb9a9a 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 
/*nElement*/ )
 nLastColumn = pDoc->MaxCol();
 if (nCurrentColumn > pDoc->MaxCol())
 nCurrentColumn = pDoc->MaxCol();
+pDoc->CreateColumnIfNotExists(nSheet, nLastColumn);
 uno::Reference xColumnRowRange 
(xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), 
uno::UNO_QUERY);
 if (xColumnRowRange.is())
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/source/ui/miscdlgs/anyrefdg.cxx |   22 ++
 1 file changed, 22 insertions(+)

New commits:
commit 62600f404b5fbecee3958d15722388e5ab49a71e
Author: Justin Luth 
AuthorDate: Tue Dec 7 15:19:45 2021 +0200
Commit: Xisco Fauli 
CommitDate: Mon Dec 13 15:58:14 2021 +0100

tdf#121699 sc: wrap LOKit stuff with isActive

This is a partial revert of LO 6.1
commit 009d2756b1678477ec23d5647bd5004c4bff3a62.

It is one thing to change code that you don't really
know why it is setup that way, but it is another thing
to ignore the resulting regression reports for 3 years.
Not impressed.

It look me only 1 hour to work through this,
and this is completely outside of my normal
line of programming.

Change-Id: I8671677f38cc1332c6c5a76847801e2680097048
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126500
Tested-by: Jenkins
Reviewed-by: Henry Castro 
Reviewed-by: Justin Luth 
(cherry picked from commit a99aea61c3199dc8188d4d873a10201082dff2e2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126686
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx 
b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 7e310d12cb45..20b2d7318df4 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -458,6 +458,28 @@ void ScFormulaReferenceHelper::DoClose( sal_uInt16 nId )
 
 void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock )
 {
+if (!comphelper::LibreOfficeKit::isActive())
+{
+// lock / unlock only the dispatchers of Calc documents
+ScDocShell* pDocShell = 
static_cast(SfxObjectShell::GetFirst(checkSfxObjectShell));
+while (pDocShell)
+{
+SfxViewFrame* pFrame = SfxViewFrame::GetFirst(pDocShell);
+while (pFrame)
+{
+SfxDispatcher* pDisp = pFrame->GetDispatcher();
+if (pDisp)
+pDisp->Lock(bLock);
+pFrame = SfxViewFrame::GetNext(*pFrame, pDocShell);
+}
+pDocShell = 
static_cast(SfxObjectShell::GetNext(*pDocShell, 
checkSfxObjectShell));
+}
+return;
+// if a new view is created while the dialog is open,
+// that view's dispatcher is locked when trying to create the dialog
+// for that view (ScTabViewShell::CreateRefDialog)
+}
+
 //  lock / unlock only the dispatcher of Calc document
 SfxDispatcher* pDisp = nullptr;
 if ( m_pBindings )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/qa sc/source

2021-12-11 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods |binary
 sc/qa/unit/subsequent_export_test.cxx |   18 ++
 sc/source/filter/xml/xmlcoli.cxx  |1 +
 3 files changed, 19 insertions(+)

New commits:
commit ea229b09c3de7edb8fcb01a727b656f4d35821d4
Author: Justin Luth 
AuthorDate: Wed Dec 8 14:22:01 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Dec 11 16:56:17 2021 +0100

tdf#128895 sc xmlimport: create enough dynamic cols if props

Since LO 6.3, only 64 columns are created by default,
where previously it was a fixed 1024.

A common user practice is to hide all columns not used,
but this collapsed property was lost because
only part of the columns were actually created and thus exported.

In this example, import specifies 1017 hidden columns (H-AMJ),
but since only 64 columns are created, export only specified 57.

So ensure that on import, any column with defined properties
is created - even if they don't contain any content.

Change-Id: If928880baf5585613715a1f4361a9059584d1ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Bartosz Kosiorek 
(cherry picked from commit 297ab561c6754f89326a1e8ce1751233669578d7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126668

diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods
new file mode 100644
index ..fa016369f206
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 8fbe40a10ac9..32f94549325b 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -143,6 +143,7 @@ public:
 #endif
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
+void testHiddenEmptyColsODS();
 void testAllRowsHiddenXLSX();
 void testLandscapeOrientationXLSX();
 
@@ -259,6 +260,7 @@ public:
 #endif
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testHiddenEmptyColsODS);
 CPPUNIT_TEST(testAllRowsHiddenXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
@@ -1525,6 +1527,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
 xShell->DoClose();
 }
 
+void ScExportTest::testHiddenEmptyColsODS()
+{
+//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to 
.XLSX
+ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"content.xml");
+CPPUNIT_ASSERT(pSheet);
+assertXPath(pSheet, "//table:table/table:table-column[2]");
+assertXPath(pSheet, "//table:table/table:table-column[2]", 
"number-columns-repeated", "1017");
+
+xShell->DoClose();
+}
+
 void ScExportTest::testLandscapeOrientationXLSX()
 {
 //tdf#48767 - Landscape page orientation is not loaded from .xlsx format 
with MS Excel, after export with Libre Office
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 09224bb757a3..fc40a6f63c6b 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 
/*nElement*/ )
 nLastColumn = pDoc->MaxCol();
 if (nCurrentColumn > pDoc->MaxCol())
 nCurrentColumn = pDoc->MaxCol();
+pDoc->CreateColumnIfNotExists(nSheet, nLastColumn);
 uno::Reference xColumnRowRange 
(xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), 
uno::UNO_QUERY);
 if (xColumnRowRange.is())
 {


[Libreoffice-commits] core.git: sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/source/ui/view/tabview3.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6a7daa7ece8442e70351eea071bddbe0d24803de
Author: Justin Luth 
AuthorDate: Mon Dec 13 13:59:11 2021 +0200
Commit: Justin Luth 
CommitDate: Mon Dec 13 17:11:40 2021 +0100

NFC simplify sc: !(!A() const || B)  is  !B && A()

Not new AND Is the same tab
is much easier to wrap your mind around than
Not (Not the same tab OR New)

Plus it allows avoiding a (trivial) const function call.

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

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index a500d5fe03ab..d1543b22cfe6 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1803,7 +1803,7 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool 
bExtendSelection, bool bSa
 return;
 }
 
-if ( !(nTab != aViewData.GetTabNo() || bNew) )
+if (!bNew && nTab == aViewData.GetTabNo())
 return;
 
 // FormShell would like to be informed before the switch


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

2021-12-14 Thread Justin Luth (via logerrit)
 xmloff/qa/unit/text.cxx  |2 +-
 xmloff/source/style/styleexp.cxx |3 ++-
 xmloff/source/text/txtstyli.cxx  |5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit aed4c2d80c2f11b82631c097ed0b15a5cb52283d
Author: Justin Luth 
AuthorDate: Mon Dec 13 17:42:00 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Dec 14 10:36:48 2021 +0100

tdf#62032 xmloff: list-level is positiveInteger, impl is 0-based

Thanks for catching this Regina.

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

diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 78ebaf75e1bc..9ac9ac93dbc4 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -191,7 +191,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, 
testParaStyleListLevel)
 uno::Reference 
xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY);
 sal_Int16 nNumberingLevel{};
 CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= 
nNumberingLevel);
-CPPUNIT_ASSERT_EQUAL(static_cast(2), nNumberingLevel);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nNumberingLevel);
 
 // Test the export as well:
 
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 1a3a81f10c95..10ae6a22dcfa 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -147,7 +147,8 @@ void ExportStyleListlevel(const 
uno::Reference& xPropSe
 return;
 }
 
-rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, 
OUString::number(nNumberingLevel));
+// The spec is positiveInteger (1-based), but the implementation is 
0-based.
+rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, 
OUString::number(++nNumberingLevel));
 }
 }
 
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index bcd55b140868..85db00df1901 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -118,9 +118,10 @@ void XMLTextStyleContext::SetAttribute( sal_Int32 nElement,
 case XML_ELEMENT(STYLE, XML_LIST_LEVEL):
 {
 sal_Int32 nTmp;
-if (sax::Converter::convertNumber(nTmp, rValue) && nTmp >= 0 && 
nTmp <= 10)
+// The spec is positiveInteger (1-based), but the implementation 
is 0-based.
+if (sax::Converter::convertNumber(nTmp, rValue) && nTmp > 0 && 
nTmp <= 10)
 {
-m_aListLevel.emplace(nTmp);
+m_aListLevel.emplace(--nTmp);
 }
 break;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - xmloff/qa xmloff/source

2021-12-14 Thread Justin Luth (via logerrit)
 xmloff/qa/unit/text.cxx  |2 +-
 xmloff/source/style/styleexp.cxx |3 ++-
 xmloff/source/text/txtstyli.cxx  |5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit fda607397997df511dab3b340ca6f6da42f5c5bd
Author: Justin Luth 
AuthorDate: Mon Dec 13 17:42:00 2021 +0200
Commit: Justin Luth 
CommitDate: Tue Dec 14 11:47:43 2021 +0100

tdf#62032 xmloff: list-level is positiveInteger, impl is 0-based

Thanks for catching this Regina.

Change-Id: Iaf6a0c9161378934818e392126a4437e55f5ddf8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126743
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit aed4c2d80c2f11b82631c097ed0b15a5cb52283d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126812

diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 78ebaf75e1bc..9ac9ac93dbc4 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -191,7 +191,7 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, 
testParaStyleListLevel)
 uno::Reference 
xStyle(xStyleFamily->getByName("mystyle"), uno::UNO_QUERY);
 sal_Int16 nNumberingLevel{};
 CPPUNIT_ASSERT(xStyle->getPropertyValue("NumberingLevel") >>= 
nNumberingLevel);
-CPPUNIT_ASSERT_EQUAL(static_cast(2), nNumberingLevel);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nNumberingLevel);
 
 // Test the export as well:
 
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 1a3a81f10c95..10ae6a22dcfa 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -147,7 +147,8 @@ void ExportStyleListlevel(const 
uno::Reference& xPropSe
 return;
 }
 
-rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, 
OUString::number(nNumberingLevel));
+// The spec is positiveInteger (1-based), but the implementation is 
0-based.
+rExport.AddAttribute(XML_NAMESPACE_STYLE, XML_LIST_LEVEL, 
OUString::number(++nNumberingLevel));
 }
 }
 
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index bcd55b140868..85db00df1901 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -118,9 +118,10 @@ void XMLTextStyleContext::SetAttribute( sal_Int32 nElement,
 case XML_ELEMENT(STYLE, XML_LIST_LEVEL):
 {
 sal_Int32 nTmp;
-if (sax::Converter::convertNumber(nTmp, rValue) && nTmp >= 0 && 
nTmp <= 10)
+// The spec is positiveInteger (1-based), but the implementation 
is 0-based.
+if (sax::Converter::convertNumber(nTmp, rValue) && nTmp > 0 && 
nTmp <= 10)
 {
-m_aListLevel.emplace(nTmp);
+m_aListLevel.emplace(--nTmp);
 }
 break;
 }


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

2021-12-16 Thread Justin Luth (via logerrit)
 sw/source/core/docnode/ndtbl1.cxx |   34 ++
 1 file changed, 22 insertions(+), 12 deletions(-)

New commits:
commit 6ce377a649c8db7576dbb7a30949d0f89c08439f
Author: Justin Luth 
AuthorDate: Thu Dec 16 15:36:59 2021 +0200
Commit: Justin Luth 
CommitDate: Thu Dec 16 16:26:43 2021 +0100

related tdf#90805 sw table: ensure border when setting border color

When using uno:FrameLineColor to set a table's border color,
add hairline borders if there are none at all.

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

diff --git a/sw/source/core/docnode/ndtbl1.cxx 
b/sw/source/core/docnode/ndtbl1.cxx
index 964b2cb610f2..d7f3c5419590 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -928,6 +928,8 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 
GetIDocumentUndoRedo().AppendUndo(std::make_unique(*pTableNd));
 }
 
+const SvxBorderLine aHairlineBorder(pColor, SvxBorderLineWidth::Hairline);
+
 for( auto  : aUnions )
 {
 SwSelUnion *pUnion = 
@@ -946,24 +948,32 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
 SwFrameFormat *pFormat = pCell->GetFormat();
 std::unique_ptr aBox(pFormat->GetBox().Clone());
 
+SvxBorderLine* pTop = const_cast(aBox->GetTop());
+SvxBorderLine* pBot = 
const_cast(aBox->GetBottom());
+SvxBorderLine* pLeft = const_cast(aBox->GetLeft());
+SvxBorderLine* pRight = 
const_cast(aBox->GetRight());
+
 if ( !pBorderLine && bSetLine )
 {
 aBox.reset(::GetDfltAttr(RES_BOX)->Clone());
 }
+else if (pColor && !pBorderLine && !pTop && !pBot && !pLeft && 
!pRight)
+{
+aBox->SetLine(, SvxBoxItemLine::TOP);
+aBox->SetLine(, SvxBoxItemLine::BOTTOM);
+aBox->SetLine(, SvxBoxItemLine::LEFT);
+aBox->SetLine(, SvxBoxItemLine::RIGHT);
+}
 else
 {
-if ( aBox->GetTop() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetTop()),
-pColor, pBorderLine );
-if ( aBox->GetBottom() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetBottom()),
-pColor, pBorderLine );
-if ( aBox->GetLeft() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetLeft()),
-pColor, pBorderLine );
-if ( aBox->GetRight() )
-::lcl_SetLineStyle( 
const_cast(aBox->GetRight()),
-pColor, pBorderLine );
+if (pTop)
+::lcl_SetLineStyle(pTop, pColor, pBorderLine);
+if (pBot)
+::lcl_SetLineStyle(pBot, pColor, pBorderLine);
+if (pLeft)
+::lcl_SetLineStyle(pLeft, pColor, pBorderLine);
+if (pRight)
+::lcl_SetLineStyle(pRight, pColor, pBorderLine);
 }
 pFormat->SetFormatAttr( *aBox );
 }


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

2021-12-16 Thread Justin Luth (via logerrit)
 sw/source/uibase/shells/frmsh.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 9f93a26c23ae21324f2389a18512d71d3d610b99
Author: Justin Luth 
AuthorDate: Thu Dec 16 11:45:15 2021 +0200
Commit: Justin Luth 
CommitDate: Thu Dec 16 15:08:14 2021 +0100

tdf#90805 sw: if no border when adding border color, add hairline

Due to things like tdf#90070 (since LO scales down an image when
adding a border), only make this a hairline border.
Otherwise, a larger default would seem reasonable...

From what I can tell, SID_FRAME_LINECOLOR
in SwFrameShell::ExecFrameStyle affects frames and images
and OLE objects.

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

diff --git a/sw/source/uibase/shells/frmsh.cxx 
b/sw/source/uibase/shells/frmsh.cxx
index 4463908f4b22..997e40a07da5 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -1219,6 +1219,9 @@ void SwFrameShell::ExecFrameStyle(SfxRequest const & rReq)
 !aBoxItem->GetLeft() && !aBoxItem->GetRight())
 {
 aBorderLine.SetColor( rNewColor );
+
aBorderLine.SetBorderLineStyle(SvxBorderLineStyle::SOLID);
+aBorderLine.SetWidth(SvxBorderLineWidth::Hairline);
+
 aBoxItem->SetLine(, SvxBoxItemLine::TOP);
 aBoxItem->SetLine(, 
SvxBoxItemLine::BOTTOM);
 aBoxItem->SetLine(, SvxBoxItemLine::LEFT);


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

2021-12-10 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods |binary
 sc/qa/unit/subsequent_export_test.cxx |   18 ++
 sc/source/filter/xml/xmlcoli.cxx  |1 +
 3 files changed, 19 insertions(+)

New commits:
commit 297ab561c6754f89326a1e8ce1751233669578d7
Author: Justin Luth 
AuthorDate: Wed Dec 8 14:22:01 2021 +0200
Commit: Justin Luth 
CommitDate: Sat Dec 11 07:20:35 2021 +0100

tdf#128895 sc xmlimport: create enough dynamic cols if props

Since LO 6.3, only 64 columns are created by default,
where previously it was a fixed 1024.

A common user practice is to hide all columns not used,
but this collapsed property was lost because
only part of the columns were actually created and thus exported.

In this example, import specifies 1017 hidden columns (H-AMJ),
but since only 64 columns are created, export only specified 57.

So ensure that on import, any column with defined properties
is created - even if they don't contain any content.

Change-Id: If928880baf5585613715a1f4361a9059584d1ad2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126540
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Bartosz Kosiorek 

diff --git a/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods
new file mode 100644
index ..fa016369f206
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf128895_emptyHiddenCols.ods 
differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 355fdf4202ad..158323215660 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -143,6 +143,7 @@ public:
 #endif
 void testOutlineExportXLSX();
 void testHiddenEmptyRowsXLSX();
+void testHiddenEmptyColsODS();
 void testAllRowsHiddenXLSX();
 void testLandscapeOrientationXLSX();
 
@@ -259,6 +260,7 @@ public:
 #endif
 CPPUNIT_TEST(testOutlineExportXLSX);
 CPPUNIT_TEST(testHiddenEmptyRowsXLSX);
+CPPUNIT_TEST(testHiddenEmptyColsODS);
 CPPUNIT_TEST(testAllRowsHiddenXLSX);
 CPPUNIT_TEST(testLandscapeOrientationXLSX);
 CPPUNIT_TEST(testInlineArrayXLS);
@@ -1525,6 +1527,22 @@ void ScExportTest::testHiddenEmptyRowsXLSX()
 xShell->DoClose();
 }
 
+void ScExportTest::testHiddenEmptyColsODS()
+{
+//tdf#98106 FILESAVE: Hidden and empty rows became visible when export to 
.XLSX
+ScDocShellRef xShell = loadDoc(u"tdf128895_emptyHiddenCols.", FORMAT_ODS);
+CPPUNIT_ASSERT(xShell.is());
+
+std::shared_ptr pXPathFile
+= ScBootstrapFixture::exportTo(&(*xShell), FORMAT_ODS);
+xmlDocUniquePtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, 
"content.xml");
+CPPUNIT_ASSERT(pSheet);
+assertXPath(pSheet, "//table:table/table:table-column[2]");
+assertXPath(pSheet, "//table:table/table:table-column[2]", 
"number-columns-repeated", "1017");
+
+xShell->DoClose();
+}
+
 void ScExportTest::testLandscapeOrientationXLSX()
 {
 //tdf#48767 - Landscape page orientation is not loaded from .xlsx format 
with MS Excel, after export with Libre Office
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 09224bb757a3..fc40a6f63c6b 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -93,6 +93,7 @@ void SAL_CALL ScXMLTableColContext::endFastElement( sal_Int32 
/*nElement*/ )
 nLastColumn = pDoc->MaxCol();
 if (nCurrentColumn > pDoc->MaxCol())
 nCurrentColumn = pDoc->MaxCol();
+pDoc->CreateColumnIfNotExists(nSheet, nLastColumn);
 uno::Reference xColumnRowRange 
(xSheet->getCellRangeByPosition(nCurrentColumn, 0, nLastColumn, 0), 
uno::UNO_QUERY);
 if (xColumnRowRange.is())
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source

2021-12-10 Thread Justin Luth (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   54 +++-
 1 file changed, 37 insertions(+), 17 deletions(-)

New commits:
commit b1ab885437bfb08468601db9453cd036d6526de3
Author: Justin Luth 
AuthorDate: Thu Dec 9 19:48:46 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sat Dec 11 06:07:02 2021 +0100

tdf#144680 mailmerge toolbar: enable icons unless no resultset

which backports 7.4 commit 9a115a254171d702a56a93c5c7e320de755dc8e8
plus tdf#144680 mailmerge toolbar: disable all icons if no resultset
(7.4 commit 16376cae68f4406ef9440bdcb7b9617de6a6f998)
plus a backport-only paranoid check to ensure that xConfigItem exists.

This fixes a problem introduced in LO 6.3 (backported to 6.1.5)
via commit 60714a814847f6d10f00aa6809a3896a48741e0b
tdf#121606: displaying Mail Merge toolbar shouldn't activate connection

Before 6.1, a user needed to run the mailmerge wizard
(or start the toolbar manually) in order to have
the mailmerge toolbar become available. In either of those cases,
the connection to the database was attempted and thus enabled
or disabled the various buttons based on the status. All good.

In 6.1, the toolbar was started on document load,
as soon as database fields were detected.
Sounds reasonable - good context sensitive UI.

The problem is that databases can often be password protected,
or on slow, remote sites. Thus the 6.3 commit mentioned above,
which disabled most buttons until the connection was established.

Well, having disabled buttons isn't too helpful,
and basically put us back to needing the extra step of
running the mail-merge wizard anyway.
The only problem with leaving them enabled is that we need to
ensure that we don't run the functions with bad results.

So sure - this means that a user thinks they can use the
mail-merge, attempt it, and then may find the buttons disable
when it won't work. That is the same as the forward/backwards
buttons though, so no big deal. Plus it is good feedback that
something isn't right (which will rarely ever be true).

The only time the buttons disable is for non-existant resultsets.
[Note that buttons do NOT disable for a wrong password,
or for a remote connection that can't be established.
And that is what we want anyway, so that further attempts
can be made after fixing the underlying problem.]

Change-Id: I3e82d2d3b35d04632650933c768cb0b5c006cb6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126625
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126633
Reviewed-by: Mike Kaganski 

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index dd2b943f476a..6532ff0c4907 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -210,12 +210,12 @@ void SwModule::StateOther(SfxItemSet )
 
 // #i51949# hide e-Mail option if e-Mail is not supported
 // #i63267# printing might be disabled
+// Without attempting to open the database, (in case it is 
remote or passworded),
+// hide everything after determining there are no valid 
results. tdf#121606
 if (!xConfigItem ||
-!xConfigItem->GetConnection().is() ||
-xConfigItem->GetConnection()->isClosed() ||
-!xConfigItem->GetResultSet().is() ||
 xConfigItem->GetCurrentDBData().sDataSource.isEmpty() ||
 xConfigItem->GetCurrentDBData().sCommand.isEmpty() ||
+(xConfigItem->GetConnection().is() && 
!xConfigItem->GetConnection()->isClosed() && !xConfigItem->GetResultSet().is()) 
||
 (nWhich == FN_MAILMERGE_PRINT_DOCUMENTS && 
Application::GetSettings().GetMiscSettings().GetDisablePrinting()) ||
 (nWhich == FN_MAILMERGE_EMAIL_DOCUMENTS && 
!xConfigItem->IsMailAvailable()))
 {
@@ -806,27 +806,47 @@ void SwModule::ExecOther(SfxRequest& rReq)
 }
 break;
 case FN_MAILMERGE_CREATE_DOCUMENTS:
-{
-std::shared_ptr xConfigItem = 
SwDBManager::PerformMailMerge(GetActiveView());
-
-if (xConfigItem && xConfigItem->GetTargetView())
-
xConfigItem->GetTargetView()->GetViewFrame()->GetFrame().Appear();
-}
-break;
 case FN_MAILMERGE_SAVE_DOCUMENTS:
 case FN_MAILMERGE_PRINT_DOCUMENTS:
 case FN_MAILMERGE_EMAIL_DOCUMENTS:
 {
 std::shared_ptr xConfigItem = 
GetActiveView()->GetMailMergeConfigItem();
-if(!xConfigItem)
+assert(xConfigItem);
+if (!xConfigItem || !xConfigItem->GetResultSet().is())
+ 

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

2021-12-09 Thread Justin Luth (via logerrit)
 sw/source/uibase/app/apphdl.cxx |   50 ++--
 1 file changed, 33 insertions(+), 17 deletions(-)

New commits:
commit 9a115a254171d702a56a93c5c7e320de755dc8e8
Author: Justin Luth 
AuthorDate: Thu Dec 9 19:48:46 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Dec 10 07:14:41 2021 +0100

tdf#144680 mailmerge toolbar: enable icons unless no resultset

This fixes a problem introduced in LO 6.3 (backported to 6.1.5)
via commit 60714a814847f6d10f00aa6809a3896a48741e0b
tdf#121606: displaying Mail Merge toolbar shouldn't activate connection

Before 6.1, a user needed to run the mailmerge wizard
(or start the toolbar manually) in order to have
the mailmerge toolbar become available. In either of those cases,
the connection to the database was attempted and thus enabled
or disabled the various buttons based on the status. All good.

In 6.1, the toolbar was started on document load,
as soon as database fields were detected.
Sounds reasonable - good context sensitive UI.

The problem is that databases can often be password protected,
or on slow, remote sites. Thus the 6.3 commit mentioned above,
which disabled most buttons until the connection was established.

Well, having disabled buttons isn't too helpful,
and basically put us back to needing the extra step of
running the mail-merge wizard anyway.
The only problem with leaving them enabled is that we need to
ensure that we don't run the functions with bad results.

So sure - this means that a user thinks they can use the
mail-merge, attempt it, and then may find the buttons disable
when it won't work. That is the same as the forward/backwards
buttons though, so no big deal. Plus it is good feedback that
something isn't right (which will rarely ever be true).

The only time the buttons disable is for non-existant resultsets.
[Note that buttons do NOT disable for a wrong password,
or for a remote connection that can't be established.
And that is what we want anyway, so that further attempts
can be made after fixing the underlying problem.]

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

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index dd2b943f476a..4e68665ead51 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -210,12 +210,12 @@ void SwModule::StateOther(SfxItemSet )
 
 // #i51949# hide e-Mail option if e-Mail is not supported
 // #i63267# printing might be disabled
+// Without attempting to open the database, (in case it is 
remote or passworded),
+// hide everything after determining there are no valid 
results. tdf#121606
 if (!xConfigItem ||
-!xConfigItem->GetConnection().is() ||
-xConfigItem->GetConnection()->isClosed() ||
-!xConfigItem->GetResultSet().is() ||
 xConfigItem->GetCurrentDBData().sDataSource.isEmpty() ||
 xConfigItem->GetCurrentDBData().sCommand.isEmpty() ||
+(xConfigItem->GetConnection().is() && 
!xConfigItem->GetConnection()->isClosed() && !xConfigItem->GetResultSet().is()) 
||
 (nWhich == FN_MAILMERGE_PRINT_DOCUMENTS && 
Application::GetSettings().GetMiscSettings().GetDisablePrinting()) ||
 (nWhich == FN_MAILMERGE_EMAIL_DOCUMENTS && 
!xConfigItem->IsMailAvailable()))
 {
@@ -806,27 +806,43 @@ void SwModule::ExecOther(SfxRequest& rReq)
 }
 break;
 case FN_MAILMERGE_CREATE_DOCUMENTS:
-{
-std::shared_ptr xConfigItem = 
SwDBManager::PerformMailMerge(GetActiveView());
-
-if (xConfigItem && xConfigItem->GetTargetView())
-
xConfigItem->GetTargetView()->GetViewFrame()->GetFrame().Appear();
-}
-break;
 case FN_MAILMERGE_SAVE_DOCUMENTS:
 case FN_MAILMERGE_PRINT_DOCUMENTS:
 case FN_MAILMERGE_EMAIL_DOCUMENTS:
 {
 std::shared_ptr xConfigItem = 
GetActiveView()->GetMailMergeConfigItem();
-if(!xConfigItem)
+assert(xConfigItem);
+if (!xConfigItem->GetResultSet().is())
+{
+// The connection has been attempted, but failed or no results 
found,
+// so invalidate the toolbar buttons in case they need to be 
disabled.
+SfxBindings& rBindings
+= 
GetActiveView()->GetWrtShell().GetView().GetViewFrame()->GetBindings();
+rBindings.Inv

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

2021-12-10 Thread Justin Luth (via logerrit)
 sw/source/uibase/app/apphdl.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 16376cae68f4406ef9440bdcb7b9617de6a6f998
Author: Justin Luth 
AuthorDate: Fri Dec 10 08:58:41 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Dec 10 12:27:05 2021 +0100

tdf#144680 mailmerge toolbar: disable all icons if no resultset

followup to my previous patch. I had played with this,
and do to poor testing or some residual effect,
I thought this wasn't necessary to disable the
movement buttons specifically. But in renewed
testing it is clear that it isn't magic that
causes the disabling at the proper time.

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

diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index 4e68665ead51..f5d537b8974a 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -822,6 +822,10 @@ void SwModule::ExecOther(SfxRequest& rReq)
 rBindings.Invalidate(FN_MAILMERGE_SAVE_DOCUMENTS);
 rBindings.Invalidate(FN_MAILMERGE_PRINT_DOCUMENTS);
 rBindings.Invalidate(FN_MAILMERGE_EMAIL_DOCUMENTS);
+rBindings.Invalidate(FN_MAILMERGE_FIRST_ENTRY);
+rBindings.Invalidate(FN_MAILMERGE_PREV_ENTRY);
+rBindings.Invalidate(FN_MAILMERGE_NEXT_ENTRY);
+rBindings.Invalidate(FN_MAILMERGE_LAST_ENTRY);
 rBindings.Update();
 return;
 }


[Libreoffice-commits] core.git: svx/source

2021-12-03 Thread Justin Luth (via logerrit)
 svx/source/dialog/srchdlg.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 3c10bb151e5864c0ff532910b9f81185aa49c21f
Author: Justin Luth 
AuthorDate: Thu Dec 2 14:38:53 2021 +0200
Commit: Justin Luth 
CommitDate: Fri Dec 3 16:29:40 2021 +0100

tdf#129629 sw UI: Find/replace - stop popping open MORE section

This was a regression from LO 6.1, where it would always
show the "more" options if one of them was enabled.

That might be fine for the dialog initialization
(and that is how I implemented it)
but even that is a bit much. Perhaps it should be a
search option that is remembered while the application
is running. Is that what pSearchOptions holds?

Anyway, this much I can easily figure out.
Someone who knows more about these things
can enhance it further if they want.

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

diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index ba5def14777e..f2c506c62ba3 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -800,8 +800,6 @@ void SvxSearchDialog::Init_Impl( bool bSearchPattern )
 m_xIncludeDiacritics->set_active( !aOpt.IsIgnoreDiacritics_CTL() );
 if ( m_xIncludeKashida->get_visible() )
 m_xIncludeKashida->set_active( !aOpt.IsIgnoreKashida_CTL() );
-if ( SvxSearchDialog::IsOtherOptionsExpanded() )
-m_xOtherOptionsExpander->set_expanded( true );
 ApplyTransliterationFlags_Impl( pSearchItem->GetTransliterationFlags() );
 
 ShowOptionalControls_Impl();
@@ -1754,8 +1752,12 @@ void SvxSearchDialog::EnableControls_Impl( const 
SearchOptionFlags nFlags )
 }
 
 if ( pSearchItem )
+{
 Init_Impl( pSearchItem->GetPattern() &&
( !pSearchList || !pSearchList->Count() ) );
+if (SvxSearchDialog::IsOtherOptionsExpanded())
+m_xOtherOptionsExpander->set_expanded(true);
+}
 }
 
 void SvxSearchDialog::EnableControl_Impl(const weld::Widget& rCtrl)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/inc sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/inc/typedstrdata.hxx   |   11 ++-
 sc/source/ui/app/inputhdl.cxx |   23 +++
 2 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit a141f91037f9cf29822a369261f9e99db964
Author: Justin Luth 
AuthorDate: Tue Dec 7 07:42:52 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Dec 13 23:29:58 2021 +0100

tdf#92010 sc autoFormula: prefer MRU formulas

Prior to 4.3, only MRU formulas were auto-completed.
Then it changed to suggest all formulas - alphabetically
for the most part.

That 4.3 commit 5b0b7553241bb5150b12bbf7625b4b0b36970272
completely removed all reference to MRU.
But it makes sense to prefer an MRU over a strictly
alphabetical match.

This patch depends on LO 7.4 patch
"new ScTypedStrData: typically missed argument in CTOR"

Change-Id: Id5d860d1401693f43833719977d1c1e4c386385c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126499
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit b93a6964e0466c1b67d2c233040357a8f6c75214)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126749

diff --git a/sc/inc/typedstrdata.hxx b/sc/inc/typedstrdata.hxx
index 7c7b1c7e45d4..c1a3738ce7fe 100644
--- a/sc/inc/typedstrdata.hxx
+++ b/sc/inc/typedstrdata.hxx
@@ -17,11 +17,12 @@ class ScTypedStrData
 {
 public:
 enum StringType {
-Value= 0,
-Standard = 1,
-Name = 2,
-DbName   = 3,
-Header   = 4
+Value,
+MRU,
+Standard,
+Name,
+DbName,
+Header
 };
 
 ScTypedStrData( const OUString& rStr, double fVal = 0.0, double fRVal = 
0.0, StringType eType = Standard,
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index b9ee0d62d02b..307f0f7a6886 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1048,6 +1048,29 @@ void ScInputHandler::GetFormulaData()
 pFormulaDataPara->insert(ScTypedStrData(aEntry, 0.0, 0.0, 
ScTypedStrData::Standard));
 }
 }
+
+// Increase suggestion priority of MRU formulas
+const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
+const sal_uInt16 nMRUCount = rOpt.GetLRUFuncListCount();
+const sal_uInt16* pMRUList = rOpt.GetLRUFuncList();
+for (sal_uInt16 i = 0; i < nMRUCount; i++)
+{
+const sal_uInt16 nId = pMRUList[i];
+for (sal_uInt32 j = 0; j < nListCount; j++)
+{
+const ScFuncDesc* pDesc = pFuncList->GetFunction(j);
+if (pDesc->nFIndex == nId && pDesc->mxFuncName)
+{
+const OUString aEntry = *pDesc->mxFuncName + 
aParenthesesReplacement;;
+const ScTypedStrData aData(aEntry, 0.0, 0.0, 
ScTypedStrData::Standard);
+auto it = pFormulaData->find(aData);
+if (it != pFormulaData->end())
+pFormulaData->erase(it);
+pFormulaData->insert(ScTypedStrData(aEntry, 0.0, 0.0, 
ScTypedStrData::MRU));
+break; // Stop searching
+}
+}
+}
 miAutoPosFormula = pFormulaData->end();
 rDoc.GetFormulaEntries( *pFormulaData );
 rDoc.GetFormulaEntries( *pFormulaDataPara );


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 42be5b7c75b2d50b93e110b0cd906a48b3bb0e26
Author: Justin Luth 
AuthorDate: Mon Dec 13 11:21:21 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Dec 13 23:30:18 2021 +0100

related tdf#92010 sc autoformula: ensure proper sorting order

When typing "=a", autoformula was suggesting
ACCRINT,ACCRINTM,ACOS instead of starting with ABS.
[This has been true since these 3 suggestions started in LO 5.2.]

Prior to this patch, the very first item in the sorted list
(ABS) was placed at the end of the suggestion vector.
That is because the loop immediately increments.
Since the given initialization value is end(),
it set begin() as the starting loop value and then
immediately incremented to item 2.
Item 1 was finally evaluated last, putting ABS after ZTEST.

The backwards loop handled this properly,
so do the same thing for the forward loop.

Change-Id: I539c749ea43140a1480d74471787bc886dda671e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126723
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit b2fb1631ab5b3c1d9d09aefa0d3a81307e7ffa35)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126750

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 307f0f7a6886..8b4d8bde90b3 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -258,7 +258,7 @@ ScTypedCaseStrSet::const_iterator findTextAll(
 ScTypedCaseStrSet::const_iterator it, itEnd;
 it = itPos;
 if ( it == rDataSet.end() )
-it = rDataSet.begin();
+it = --rDataSet.end();
 itEnd = it;
 bool bFirstTime = true;
 


[Libreoffice-commits] core.git: sc/inc sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/inc/typedstrdata.hxx   |   11 ++-
 sc/source/ui/app/inputhdl.cxx |   23 +++
 2 files changed, 29 insertions(+), 5 deletions(-)

New commits:
commit b93a6964e0466c1b67d2c233040357a8f6c75214
Author: Justin Luth 
AuthorDate: Tue Dec 7 07:42:52 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Dec 13 22:18:06 2021 +0100

tdf#92010 sc autoFormula: prefer MRU formulas

Prior to 4.3, only MRU formulas were auto-completed.
Then it changed to suggest all formulas - alphabetically
for the most part.

That 4.3 commit 5b0b7553241bb5150b12bbf7625b4b0b36970272
completely removed all reference to MRU.
But it makes sense to prefer an MRU over a strictly
alphabetical match.

This patch depends on LO 7.4 patch
"new ScTypedStrData: typically missed argument in CTOR"

Change-Id: Id5d860d1401693f43833719977d1c1e4c386385c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126499
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sc/inc/typedstrdata.hxx b/sc/inc/typedstrdata.hxx
index 7c7b1c7e45d4..c1a3738ce7fe 100644
--- a/sc/inc/typedstrdata.hxx
+++ b/sc/inc/typedstrdata.hxx
@@ -17,11 +17,12 @@ class ScTypedStrData
 {
 public:
 enum StringType {
-Value= 0,
-Standard = 1,
-Name = 2,
-DbName   = 3,
-Header   = 4
+Value,
+MRU,
+Standard,
+Name,
+DbName,
+Header
 };
 
 ScTypedStrData( const OUString& rStr, double fVal = 0.0, double fRVal = 
0.0, StringType eType = Standard,
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 24d99a658e48..f05f52fa90bd 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -1039,6 +1039,29 @@ void ScInputHandler::GetFormulaData()
 pFormulaDataPara->insert(ScTypedStrData(aEntry, 0.0, 0.0, 
ScTypedStrData::Standard));
 }
 }
+
+// Increase suggestion priority of MRU formulas
+const ScAppOptions& rOpt = SC_MOD()->GetAppOptions();
+const sal_uInt16 nMRUCount = rOpt.GetLRUFuncListCount();
+const sal_uInt16* pMRUList = rOpt.GetLRUFuncList();
+for (sal_uInt16 i = 0; i < nMRUCount; i++)
+{
+const sal_uInt16 nId = pMRUList[i];
+for (sal_uInt32 j = 0; j < nListCount; j++)
+{
+const ScFuncDesc* pDesc = pFuncList->GetFunction(j);
+if (pDesc->nFIndex == nId && pDesc->mxFuncName)
+{
+const OUString aEntry = *pDesc->mxFuncName + 
aParenthesesReplacement;;
+const ScTypedStrData aData(aEntry, 0.0, 0.0, 
ScTypedStrData::Standard);
+auto it = pFormulaData->find(aData);
+if (it != pFormulaData->end())
+pFormulaData->erase(it);
+pFormulaData->insert(ScTypedStrData(aEntry, 0.0, 0.0, 
ScTypedStrData::MRU));
+break; // Stop searching
+}
+}
+}
 miAutoPosFormula = pFormulaData->end();
 rDoc.GetFormulaEntries( *pFormulaData );
 rDoc.GetFormulaEntries( *pFormulaDataPara );


[Libreoffice-commits] core.git: sc/source

2021-12-13 Thread Justin Luth (via logerrit)
 sc/source/ui/app/inputhdl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit b2fb1631ab5b3c1d9d09aefa0d3a81307e7ffa35
Author: Justin Luth 
AuthorDate: Mon Dec 13 11:21:21 2021 +0200
Commit: Eike Rathke 
CommitDate: Mon Dec 13 22:18:42 2021 +0100

related tdf#92010 sc autoformula: ensure proper sorting order

When typing "=a", autoformula was suggesting
ACCRINT,ACCRINTM,ACOS instead of starting with ABS.
[This has been true since these 3 suggestions started in LO 5.2.]

Prior to this patch, the very first item in the sorted list
(ABS) was placed at the end of the suggestion vector.
That is because the loop immediately increments.
Since the given initialization value is end(),
it set begin() as the starting loop value and then
immediately incremented to item 2.
Item 1 was finally evaluated last, putting ABS after ZTEST.

The backwards loop handled this properly,
so do the same thing for the forward loop.

Change-Id: I539c749ea43140a1480d74471787bc886dda671e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126723
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index f05f52fa90bd..1abff527b363 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -255,7 +255,7 @@ ScTypedCaseStrSet::const_iterator findTextAll(
 ScTypedCaseStrSet::const_iterator it, itEnd;
 it = itPos;
 if ( it == rDataSet.end() )
-it = rDataSet.begin();
+it = --rDataSet.end();
 itEnd = it;
 bool bFirstTime = true;
 


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

2021-07-26 Thread Justin Luth (via logerrit)
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 1441e001938d6a0b19743ef8170980238b88d350
Author: Justin Luth 
AuthorDate: Mon Jul 26 14:39:17 2021 +0200
Commit: Justin Luth 
CommitDate: Mon Jul 26 19:24:04 2021 +0200

tdf#143517 partial revert "tdf#141964 writerfilter CN: get para...

...paragraph and inherited listLevel

IIRC, I changed GetCurrentNumberingCharStyle() on the premise that
no matter where the level is defined (paragraph or style),
any function looking for it should use the inherited/applied level.
But GetCurrentNumberingCharStyle() itself looks like a bogus
hack that probably should be eliminated completely.

Unfortunately, 2123ede032ca64f696ef54af4ad3238974ca2b5d
from 2012 which introduced it does not include a unit test,
so there is no easy way to test whether it still has any
function.
[Eliminating it passes all unit tests and sounds similar to
tdf#108518 revert OOo hack: Fix issue #i119405: Numbering text style.]

In any case, just revert the changes to this function for now,
since hopelessly faulty functions don't need to operate "better".

Another alternative would be to just use GetListlevel(pEntry)
to at least allow style inheritance, but since it seems like
a completely faulty function to begin with, it seems better to
leave the function completely untouched.

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

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 78f7dbc16b24..bc63eae6c0b0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -7657,7 +7657,7 @@ uno::Reference 
DomainMapper_Impl::GetCurrentNumberingRu
 if (nListId < 0)
 return xRet;
 if (pListLevel)
-*pListLevel = GetListLevel(pEntry, 
GetTopContextOfType(CONTEXT_PARAGRAPH));
+*pListLevel = pStyleSheetProperties->GetListLevel();
 
 // So we are in a paragraph style and it has numbering. Look up the 
relevant numbering rules.
 auto const pList(GetListTable()->GetList(nListId));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2021-07-16 Thread Justin Luth (via logerrit)
 sw/qa/extras/rtfexport/data/pgndec.rtf   |1 +
 sw/qa/extras/rtfexport/rtfexport.cxx |5 +
 writerfilter/source/rtftok/rtfdispatchsymbol.cxx |3 +++
 3 files changed, 9 insertions(+)

New commits:
commit fce76110e02409b67ad977ae0077adf55ca58065
Author: Justin Luth 
AuthorDate: Tue Jul 13 10:12:21 2021 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 16 08:57:16 2021 +0200

tdf#82111 rtf import: ensure CR before section break

In other places, there were caveats for applying a CR
when inserting instead of importing, or when in a header,
but none of those seem to apply in this case.
A section cannot occur in a table, and anytime a
section occurs, it ought to finish off the paragraph.
So a simple clause seems good enough here.

There were basically two different existing unit tests
that match this condition, and neither of them
were currently mis-handled. I safely adapted one of them
to imitate the error condition I was addressing.

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

diff --git a/sw/qa/extras/rtfexport/data/pgndec.rtf 
b/sw/qa/extras/rtfexport/data/pgndec.rtf
index 7f38c69101b8..bc53633e7a66 100644
--- a/sw/qa/extras/rtfexport/data/pgndec.rtf
+++ b/sw/qa/extras/rtfexport/data/pgndec.rtf
@@ -1,5 +1,6 @@
 {\rtf1
 \pard\plain \ltrpar\ql 
\li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
 \rtlch\fcs1 \af31507\afs22\alang1025 \ltrch\fcs0
+\par
 {\field\fldedit
 {\*\fldinst
 { PAGE   \\* MERGEFORMAT }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 714aa8f468b1..326c63a3cbae 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1223,6 +1223,11 @@ DECLARE_RTFEXPORT_TEST(testPgndec, "pgndec.rtf")
 CPPUNIT_ASSERT_EQUAL(
 style::NumberingType::ARABIC,
 getProperty(xPageStyles->getByName(pageStyleName), 
"NumberingType"));
+
+// tdf#82111 ensure a pargraph exists before a section break.
+// This was only two paragraphs, and both page number fields were in one 
para on page 2 ("11").
+getParagraph(2, "1");
+CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
 }
 
 DECLARE_RTFEXPORT_TEST(testTdf98806, "tdf98806.rtf")
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx 
b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 88d303c0b2c1..df02f36fc18a 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -133,6 +133,9 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword 
nKeyword)
 break;
 case RTFKeyword::SECT:
 {
+if (m_bNeedCr)
+dispatchSymbol(RTFKeyword::PAR);
+
 m_bHadSect = true;
 if (m_bIgnoreNextContSectBreak)
 m_bIgnoreNextContSectBreak = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2022-02-10 Thread Justin Luth (via logerrit)
 sc/source/core/data/table4.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit f3035cdb6a8d3ef56180640ef9d04031012250b9
Author: Justin Luth 
AuthorDate: Wed Feb 9 14:33:05 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Feb 10 10:53:08 2022 +0100

tdf#113785 sc FillAutoSimple: also optimize in negative direction

By only coding the optimization for the downward autofill,
it totally broke an upward autofill.
So this patch simply fixes the LO 4.3ish regression
from commit a995462e6855061816c6529c366f20ace2b45868.

This fix means that the non-hidden cells get the auto-value
instead of being erased.

However, the hidden cells are still erased
(which is the topic of tdf#119957).

I'm not going to bother with a unit test for this
portion. If I can solve bug 119957 as well,
then the unit test for that can cover both situations.

Change-Id: If6320ccf87fa8893ca6766c265b7760cc46ed7d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129723
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 618084819babc839510860b74b36631749093c4c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129753
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 6ef2c3b439b2..d2fdde2718b8 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1782,16 +1782,28 @@ void ScTable::FillAutoSimple(
 bool bIsOrdinalSuffix = false;
 
 bool bColHidden = false, bRowHidden = false;
+SCCOL nColHiddenFirst = rDocument.MaxCol();
 SCCOL nColHiddenLast = -1;
+SCROW nRowHiddenFirst = rDocument.MaxRow();
 SCROW nRowHiddenLast = -1;
 
 rInner = nIStart;
 while (true)// #i53728# with "for (;;)" old solaris/x86 compiler 
mis-optimizes
 {
-if (rCol > nColHiddenLast)
-bColHidden = ColHidden(rCol, nullptr, );
-if (rRow > nRowHiddenLast)
-bRowHidden = RowHidden(rRow, nullptr, );
+if (bPositive)
+{
+if (rCol > nColHiddenLast)
+bColHidden = ColHidden(rCol, nullptr, );
+if (rRow > nRowHiddenLast)
+bRowHidden = RowHidden(rRow, nullptr, );
+}
+else
+{
+if (rCol < nColHiddenFirst)
+bColHidden = ColHidden(rCol, );
+if (rRow < nRowHiddenFirst)
+bRowHidden = RowHidden(rRow, );
+}
 
 if (!bColHidden && !bRowHidden)
 {


[Libreoffice-commits] core.git: oox/source

2022-03-06 Thread Justin Luth (via logerrit)
 oox/source/ppt/pptshape.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 05502f78ed0d406ff50d43a39c05f7bb990001e9
Author: Justin Luth 
AuthorDate: Fri Feb 11 18:47:11 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Mar 6 08:59:49 2022 +0100

link bug report to "likely wrong" comment

Change-Id: I3184037d3df79b1bf4c972046e7636b372662cdd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129825
Tested-by: Adolfo Jayme Barrientos 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 6c12e1f3dd64..92b61176d0c1 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -686,7 +686,8 @@ namespace
 }
 
 // Function to find placeholder (ph) for a shape. No idea how MSO implements 
this, but
-// this order seems to work quite well (probably it's unnecessary complicated 
/ wrong):
+// this order seems to work quite well
+// (probably it's unnecessary complicated / wrong. i.e. tdf#104202):
 // 1. ph with nFirstSubType and the same oSubTypeIndex
 // 2. ph with nFirstSubType
 // 3. ph with nSecondSubType and the same oSubTypeIndex


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

2022-03-16 Thread Justin Luth (via logerrit)
 chart2/qa/extras/chart2export.cxx|   18 ++
 chart2/qa/extras/data/docx/TableOnPage3.docx |binary
 chart2/source/tools/InternalDataProvider.cxx |8 ++--
 3 files changed, 24 insertions(+), 2 deletions(-)

New commits:
commit cfd82e7a2cc2b45b738eb0efa0827196d2de61a4
Author: Justin Luth 
AuthorDate: Fri Mar 4 07:57:31 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Mar 16 10:28:42 2022 +0100

tdf#128747 chart2: don't overwrite labels

In almost every case, the values of a labeledDataSequence
create a new column, and therefore the label is attached
to the last column.

However, in the case where there are no values at all,
then this function is not called (for the value portion),
resulting in no new column being created,
and thus the label overwrote the previous series label.

Empty-value columns are excluded in later code,
so perhaps we shouldn't addDataSequenceToMap either,
but I don't know the implications of that.

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

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index bca7897025a0..c333ab9d651e 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -119,6 +119,7 @@ public:
 void testPlotVisOnlyXLSX();
 void testBarChartVaryColorsXLSX();
 void testTdf96161();
+void testTableOnPage3();
 void testMultipleAxisXLSX();
 void testSecondaryAxisXLSX();
 void testBarChartSecondaryAxisXLSX();
@@ -213,6 +214,7 @@ public:
 CPPUNIT_TEST(testPlotVisOnlyXLSX);
 CPPUNIT_TEST(testBarChartVaryColorsXLSX);
 CPPUNIT_TEST(testTdf96161);
+CPPUNIT_TEST(testTableOnPage3);
 CPPUNIT_TEST(testMultipleAxisXLSX);
 CPPUNIT_TEST(testSecondaryAxisXLSX);
 CPPUNIT_TEST(testBarChartSecondaryAxisXLSX);
@@ -1900,6 +1902,22 @@ void Chart2ExportTest::testTdf96161()
 assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:lineChart/c:varyColors", "val", "0");
 }
 
+void Chart2ExportTest::testTableOnPage3()
+{
+load(u"/chart2/qa/extras/data/docx/", "TableOnPage3.docx");
+reload("Office Open XML Text");
+
+Reference xChartDoc(getChartDocFromWriter(0), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+uno::Reference< chart::XChartDataArray > 
xDataArray(xChartDoc->getDataProvider(), UNO_QUERY_THROW);
+Sequence aColumnDesc = xDataArray->getColumnDescriptions();
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be 4 columns and descriptions", 
static_cast(4), aColumnDesc.getLength());
+CPPUNIT_ASSERT_EQUAL(OUString("If oversubscription relative to allowance 
increases at the same average rate B15-B17"), aColumnDesc[0]);
+CPPUNIT_ASSERT_EQUAL(OUString("Known requirements"), aColumnDesc[1]);
+CPPUNIT_ASSERT_EQUAL(OUString("Allowance"), aColumnDesc[2]);
+CPPUNIT_ASSERT_EQUAL(OUString("If oversubscription relative to allowance 
holds steady at average oversubscription level B15-B17"), aColumnDesc[3]);
+}
+
 void Chart2ExportTest::testMultipleAxisXLSX()
 {
 load(u"/chart2/qa/extras/data/ods/", "multiple_axis.ods");
diff --git a/chart2/qa/extras/data/docx/TableOnPage3.docx 
b/chart2/qa/extras/data/docx/TableOnPage3.docx
new file mode 100644
index ..79763bd35290
Binary files /dev/null and b/chart2/qa/extras/data/docx/TableOnPage3.docx differ
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index e1bf32b7ff10..6fe4ec94a8db 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -647,8 +647,12 @@ InternalDataProvider::createDataSequenceFromArray( const 
OUString& rArrayStr, st
 sal_Int32 nColSize = m_aInternalData.getColumnCount();
 if (!aRawElems.empty() && nColSize)
 {
-std::vector aLabels(1, uno::Any(aRawElems[0]));
-m_aInternalData.setComplexColumnLabel(nColSize-1, 
std::move(aLabels));
+// Do not overwrite an existing label (attempted by series with no 
data values)
+if 
(!m_aInternalData.getComplexColumnLabel(nColSize-1)[0].hasValue())
+{
+std::vector aLabels(1, uno::Any(aRawElems[0]));
+m_aInternalData.setComplexColumnLabel(nColSize-1, 
std::move(aLabels));
+}
 
 OUString aRangeRep = lcl_aLabelRangePrefix + 
OUString::number(nColSize-1);
 xSeq.set(new UncachedDataSequence(this, aRangeRep));


[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - sw/qa sw/source

2022-03-16 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf98000_changePageStyle.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |   13 +
 sw/source/filter/ww8/docxattributeoutput.cxx   |4 ++--
 sw/source/filter/ww8/wrtww8.cxx|1 -
 sw/source/filter/ww8/wrtww8.hxx|3 +--
 sw/source/filter/ww8/ww8atr.cxx|   11 ++-
 6 files changed, 18 insertions(+), 14 deletions(-)

New commits:
commit 1433ed1347407d07ff0410d1749eeed465c5ad28
Author: Justin Luth 
AuthorDate: Tue Jul 21 21:02:44 2020 +0300
Commit: Thorsten Behrens 
CommitDate: Wed Mar 16 13:36:55 2022 +0100

tdf#98000 docx export: blank paragraphs don't affect page breaks

Umm, how could that ever have possibly made sense? And why wasn't
it found and fixed earlier?

This goes way back to when first/follow page styles were
first being handled in tdf#66145, where a blank line skipped
calling OutputSectionBreak.

Then in LO 4.3, tdf#74566 adjusted that a bit more, and tdf#77890
decided to do the same thing for a previous blank line.
These all have unit tests to "prove" it too.

But none of that makes any sense, and by reverting all of that
garbage, all the unit tests still pass.  I also looked at the
original bug documents, and they also look fine after the
revert. So I think it is safe to kill this nonsense,
but I don't plan to backport it, just in case...

Change-Id: I4aaca0435fbf030fe9c3113b068ea3370eccd889
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99171
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131653
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/sw/qa/extras/ooxmlexport/data/tdf98000_changePageStyle.odt 
b/sw/qa/extras/ooxmlexport/data/tdf98000_changePageStyle.odt
new file mode 100644
index ..95f65e919fb6
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf98000_changePageStyle.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 5aff15ca6f5d..95359aebf820 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -35,6 +35,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf14_followPgStyle, 
"tdf14_followPgStyle.o
 CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf98000_changePageStyle, 
"tdf98000_changePageStyle.odt")
+{
+uno::Reference xModel(mxComponent, uno::UNO_QUERY);
+uno::Reference 
xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
+
+uno::Reference 
xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY_THROW);
+OUString sPageOneStyle = getProperty( xCursor, "PageStyleName" );
+
+xCursor->jumpToNextPage();
+OUString sPageTwoStyle = getProperty( xCursor, "PageStyleName" );
+CPPUNIT_ASSERT_MESSAGE("Different page1/page2 styles", sPageOneStyle != 
sPageTwoStyle);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf131801, "tdf131801.docx")
 {
 CPPUNIT_ASSERT_EQUAL(1, getPages());
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 40256891d509..912feef0816a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1175,7 +1175,7 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& 
rNode)
 if (aNextIndex.GetNode().IsTextNode())
 {
 const SwTextNode* pTextNode = 
static_cast(());
-m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty());
+m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen);
 }
 else if (aNextIndex.GetNode().IsTableNode())
 {
@@ -1192,7 +1192,7 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& 
rNode)
 // Also handle section endings
 const SwTextNode* pTextNode = aNextIndex.GetNode().GetTextNode();
 if (rNode.StartOfSectionNode()->IsTableNode() || 
rNode.StartOfSectionNode()->IsSectionNode())
-m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty());
+m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), 
*pTextNode, m_tableReference->m_bTableCellOpen);
 }
 }
 }
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 8d4add7b34bf..86899e1dba88 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8

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

2022-03-16 Thread Justin Luth (via logerrit)
 sw/source/core/table/swtable.cxx |   11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 6ba3c85aad33ad3eded935185686dfcaaa7fcaa8
Author: Justin Luth 
AuthorDate: Tue Mar 15 21:13:01 2022 +0200
Commit: Justin Luth 
CommitDate: Thu Mar 17 06:36:18 2022 +0100

tdf#119298 sw: keep automatic position on trivial width change

The issue here was that simply moving the border around
(which shouldn't change the table size at all)
triggered a miniscule difference in reported table width.

Well, that is not enough reason to change away from automatic
positioning now is it?

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

diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ec6487028790..7f2b5aef976c 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -872,7 +872,16 @@ void SwTable::SetTabCols( const SwTabCols , const 
SwTabCols ,
 else if(!bLeftDist && rNew.GetRight() + nShRight < 
rNew.GetRightMax())
 aOri.SetHoriOrient( text::HoriOrientation::LEFT );
 else
-aOri.SetHoriOrient( text::HoriOrientation::LEFT_AND_WIDTH 
);
+{
+// if an automatic table hasn't (really) changed size, 
then leave it as auto.
+const tools::Long nOldWidth = rOld.GetRight() - 
rOld.GetLeft();
+const tools::Long nNewWidth = rNew.GetRight() - 
rNew.GetLeft();
+if (aOri.GetHoriOrient() != text::HoriOrientation::FULL
+|| std::abs(nOldWidth - nNewWidth) > COLFUZZY)
+{
+
aOri.SetHoriOrient(text::HoriOrientation::LEFT_AND_WIDTH);
+}
+}
 }
 pFormat->SetFormatAttr( aOri );
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-16 Thread Justin Luth (via logerrit)
 sc/source/core/data/table4.cxx |   20 
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 99191703b528d8d7b0b9c5d84d76a6fdebbf5191
Author: Justin Luth 
AuthorDate: Wed Feb 9 14:33:05 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Feb 16 12:03:02 2022 +0100

tdf#113785 sc FillAutoSimple: also optimize in negative direction

By only coding the optimization for the downward autofill,
it totally broke an upward autofill.
So this patch simply fixes the LO 4.3ish regression
from commit a995462e6855061816c6529c366f20ace2b45868.

This fix means that the non-hidden cells get the auto-value
instead of being erased.

However, the hidden cells are still erased
(which is the topic of tdf#119957).

I'm not going to bother with a unit test for this
portion. If I can solve bug 119957 as well,
then the unit test for that can cover both situations.

Change-Id: If6320ccf87fa8893ca6766c265b7760cc46ed7d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129723
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 618084819babc839510860b74b36631749093c4c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129753
Reviewed-by: Xisco Fauli 
(cherry picked from commit f3035cdb6a8d3ef56180640ef9d04031012250b9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129760
Reviewed-by: Eike Rathke 

diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 0f1f7193fe59..73ad750d35c1 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1782,16 +1782,28 @@ void ScTable::FillAutoSimple(
 bool bIsOrdinalSuffix = false;
 
 bool bColHidden = false, bRowHidden = false;
+SCCOL nColHiddenFirst = rDocument.MaxCol();
 SCCOL nColHiddenLast = -1;
+SCROW nRowHiddenFirst = rDocument.MaxRow();
 SCROW nRowHiddenLast = -1;
 
 rInner = nIStart;
 while (true)// #i53728# with "for (;;)" old solaris/x86 compiler 
mis-optimizes
 {
-if (rCol > nColHiddenLast)
-bColHidden = ColHidden(rCol, nullptr, );
-if (rRow > nRowHiddenLast)
-bRowHidden = RowHidden(rRow, nullptr, );
+if (bPositive)
+{
+if (rCol > nColHiddenLast)
+bColHidden = ColHidden(rCol, nullptr, );
+if (rRow > nRowHiddenLast)
+bRowHidden = RowHidden(rRow, nullptr, );
+}
+else
+{
+if (rCol < nColHiddenFirst)
+bColHidden = ColHidden(rCol, );
+if (rRow < nRowHiddenFirst)
+bRowHidden = RowHidden(rRow, );
+}
 
 if (!bColHidden && !bRowHidden)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - chart2/qa chart2/source

2022-02-24 Thread Justin Luth (via logerrit)
 chart2/qa/extras/chart2import.cxx|   15 +++
 chart2/qa/extras/data/pptx/tdf127720.pptx|binary
 chart2/source/tools/InternalDataProvider.cxx |3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 446c491c2f0d2643f83c0f7981b04bced785894c
Author: Justin Luth 
AuthorDate: Wed Feb 23 20:45:04 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Feb 24 10:26:22 2022 +0100

tdf#127720 chart2: create new columns for error bars

This is basically a copy/paste of the bubble chart fix
for tdf#103984 against the same LO 4.4 regression.

No exist unit tests had error bars. Very interesting.

make CppunitTest_chart2_import CPPUNIT_TEST_NAME=testPPTXChartErrorBars

Change-Id: I81ff91ee2ba75277502a8e261106bf5837a8903b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130444
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit dfd0717b3f55eeb15a5634e52d7d0ed544d17578)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130447
Reviewed-by: Xisco Fauli 

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index e908cfc57a71..564d6b0815b9 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -53,6 +53,7 @@ public:
 void testDOCXChartSeries();
 void testDOCXChartEmptySeries();
 void testTdf81396();
+void testPPTXChartErrorBars();
 void testDOCXChartValuesSize();
 void testPPTXChartSeries();
 void testPPTXSparseChartSeries();
@@ -154,6 +155,7 @@ public:
 CPPUNIT_TEST(testDOCXChartSeries);
 CPPUNIT_TEST(testDOCXChartEmptySeries);
 CPPUNIT_TEST(testTdf81396);
+CPPUNIT_TEST(testPPTXChartErrorBars);
 CPPUNIT_TEST(testDOCXChartValuesSize);
 CPPUNIT_TEST(testPPTChartSeries);
 CPPUNIT_TEST(testPPTXChartSeries);
@@ -491,6 +493,19 @@ void Chart2ImportTest::testTdf81396()
 CPPUNIT_ASSERT_EQUAL(105.210801910481, aDataSeriesYValues[0][0]);
 }
 
+void Chart2ImportTest::testPPTXChartErrorBars()
+{
+load(u"/chart2/qa/extras/data/pptx/", "tdf127720.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference< chart::XChartDataArray > 
xDataArray(xChartDoc->getDataProvider(), UNO_QUERY_THROW);
+Sequence aColumnDesc = xDataArray->getColumnDescriptions();
+// Number of columns = 4 (Y-values, X-values and positive/negative error 
bars).
+// Without the fix there would only be 2 columns (no error range).
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be 4 columns and descriptions", 
static_cast(4), aColumnDesc.getLength());
+}
+
 void Chart2ImportTest::testDOCXChartValuesSize()
 {
 load( u"/chart2/qa/extras/data/docx/", "bubblechart.docx" );
diff --git a/chart2/qa/extras/data/pptx/tdf127720.pptx 
b/chart2/qa/extras/data/pptx/tdf127720.pptx
new file mode 100644
index ..b10a4c5ab4ed
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf127720.pptx differ
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index 794a780d5a86..3b2fe6e5a021 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -569,7 +569,8 @@ InternalDataProvider::createDataSequenceFromArray( const 
OUString& rArrayStr, st
 }
 
 if (rRole == u"values-y" || rRole == u"values-first" || rRole == 
u"values-last" ||
-rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size")
+rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size" ||
+rRole == u"error-bars-y-positive" || rRole == u"error-bars-y-negative")
 {
 // Column values.  Append a new data column and populate it.
 


[Libreoffice-commits] core.git: sc/source

2022-02-24 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/xestream.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit 8f2b1b1cb84e1ae3139eb90b8efdf61e608adbad
Author: Justin Luth 
AuthorDate: Wed Feb 23 22:11:18 2022 +0200
Commit: Justin Luth 
CommitDate: Thu Feb 24 09:00:04 2022 +0100

followup tdf#122098 xlsx export: avoid dataloss if not bool value

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

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index a3c1b92fe86d..2178b0b3abc7 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -673,16 +673,8 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& 
rCell, const char*& rsT
 rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError));
 break;
 case sc::FormulaResultValue::Value:
-if (rCell.GetFormatType() == SvNumFormatType::LOGICAL)
-{
-rsType = "b";
-rsValue = rCell.GetValue() == 0.0 ? "0" : "1";
-}
-else
-{
-rsType = "n";
-rsValue = OUString::number(aResValue.mfValue);
-}
+rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL ? "b" : 
"n";
+rsValue = OUString::number(aResValue.mfValue);
 break;
 case sc::FormulaResultValue::String:
 rsType = "str";


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

2022-02-23 Thread Justin Luth (via logerrit)
 include/svx/ruler.hxx   |3 ++-
 svx/source/dialog/rlrcitem.cxx  |2 +-
 svx/source/dialog/svxruler.cxx  |   13 -
 sw/source/uibase/uiview/viewtab.cxx |   22 +++---
 4 files changed, 26 insertions(+), 14 deletions(-)

New commits:
commit e87f9b4fa158b917bb38fc00513bae7f94024e58
Author: Justin Luth 
AuthorDate: Tue Feb 15 14:26:35 2022 +0200
Commit: Justin Luth 
CommitDate: Thu Feb 24 07:36:57 2022 +0100

tdf#95882 svxruler: restore adjustment for borders

This restores the clause removed from
LO 3.6's commit 47a77d7dbc427e51421e2df8d59695834cb74980
Ruler: disable snapping, tooltips

[Because that removal left behind dead code,
 which was later cleared out, of course this patch
 restores that as well.
commit 8303e7ed668fbcbd0ba75bd9dd259f03073ffd46
Author: Noel Grandin on Fri Jun 14 10:41:11 2019 +0200
]

Basic borders on the paragraph itself
do not affect where LO ends the tabstop,
and thus the removal of that clause was partially justified.
But the table/frame/page/headers definitely need to be adjusted
in order for the tabstops to show in the correct position.

RightFrameMargin needed this as well,
especially now that RTL is supported by the ruler since LO 3.6,
although the Left/Right functions are very different.

[Frames never worked because the aCoreSet wasn't accepting
 RES_BOX items. Interesting error considering all of the
 other sections of code created a new CoreSet.]

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

diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx
index 374209a73f69..010af4b17936 100644
--- a/include/svx/ruler.hxx
+++ b/include/svx/ruler.hxx
@@ -91,6 +91,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public SfxListener
 std::unique_ptr mxULSpaceItem;// upper and lower 
edge
 std::unique_ptr mxTabStopItem;// tab stops
 std::unique_ptr mxParaItem;   // paragraphs
+std::unique_ptr mxBorderItem; // border distance
 std::unique_ptr mxPagePosItem;// page distance to 
the rule
 std::unique_ptr  mxColumnItem; // columns
 std::unique_ptr  mxObjectItem; // object
@@ -140,7 +141,7 @@ class SVX_DLLPUBLIC SvxRuler: public Ruler, public 
SfxListener
 // paragraph indentations
 void UpdatePara(const SvxLRSpaceItem* pItem);
 // Border distance
-void UpdateParaBorder();
+void UpdateBorder(const SvxLRSpaceItem* pItem);
 // Tabs
 void Update(const SvxTabStopItem* pItem);
 // page position and width
diff --git a/svx/source/dialog/rlrcitem.cxx b/svx/source/dialog/rlrcitem.cxx
index 873663b27e30..a73cd00bdac5 100644
--- a/svx/source/dialog/rlrcitem.cxx
+++ b/svx/source/dialog/rlrcitem.cxx
@@ -131,7 +131,7 @@ void SvxRulerItem::StateChangedAtToolBoxControl( sal_uInt16 
nSID, SfxItemState e
 {
 const SvxLRSpaceItem *pItem = dynamic_cast( 
pState );
 SAL_WARN_IF(pState != nullptr && pItem == nullptr, "svx.dialog", 
"SvxLRSpaceItem expected");
-rRuler.UpdateParaBorder();
+rRuler.UpdateBorder(pItem);
 }
 break;
 case SID_RULER_TEXT_RIGHT_TO_LEFT :
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 6e960a18433d..d676c3c1208f 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -881,11 +881,16 @@ void SvxRuler::UpdatePara(const SvxLRSpaceItem *pItem) // 
new value of paragraph
 }
 }
 
-void SvxRuler::UpdateParaBorder()
+void SvxRuler::UpdateBorder(const SvxLRSpaceItem * pItem)
 {
 /* Border distance */
 if(bActive)
 {
+if (pItem)
+mxBorderItem.reset(new SvxLRSpaceItem(*pItem));
+else
+mxBorderItem.reset();
+
 StartListening_Impl();
 }
 }
@@ -1206,6 +1211,9 @@ tools::Long SvxRuler::GetLeftFrameMargin() const
 nLeft = mxColumnItem->GetActiveColumnDescription().nStart;
 }
 
+if (mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
+nLeft += mxBorderItem->GetLeft();
+
 return nLeft;
 }
 
@@ -1257,6 +1265,9 @@ tools::Long SvxRuler::GetRightFrameMargin() const
 else if(!bHorz && mxULSpaceItem)
 lResult += mxULSpaceItem->GetLower();
 
+if (bHorz && mxBorderItem && (!mxColumnItem || mxColumnItem->IsTable()))
+lResult += mxBorderItem->GetRight();
+
 if(bHorz)
 lResult = mxPagePosItem->GetWidth() - lResult;
 else
diff --git a/sw/source/uibase/uiview/viewtab.cxx 
b/sw/source/uibase/uiview/viewtab.cxx
index 6bf269219d9a..c911971fd314 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/u

[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source

2022-02-16 Thread Justin Luth (via logerrit)
 sc/source/core/data/table2.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0b59601e415d186565278289e4d3613f727ef75c
Author: Justin Luth 
AuthorDate: Wed Feb 9 20:17:53 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Feb 16 21:21:44 2022 +0100

tdf#113785 sc: IsDataFiltered must be normalized

I can't believe this hasn't caused major issues
and has survived as a bug for so long.

Due to the way IsDataFiltered is coded,
it is required that the range is normalized
in order to get any kind of meaningful result,
so lets ensure that.

Change-Id: I2ede77f738fbaeb05a0f1425a2e88e59fca08e9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129735
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit bda200a5e9c4592bd61b7924fa171ec3265bfd24)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129761
Reviewed-by: Eike Rathke 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130049
Reviewed-by: Christian Lohmaier 

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 95bef419c9a8..7ed03187b4b4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3665,6 +3665,8 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool 
bShow)
 
 bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, 
SCROW nRowEnd) const
 {
+assert(nColStart <= nColEnd && nRowStart <= nRowEnd
+   && "range must be normalized to obtain a valid result");
 for (SCROW i = nRowStart; i <= nRowEnd; ++i)
 {
 if (RowHidden(i))
@@ -3680,8 +3682,9 @@ bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW 
nRowStart, SCCOL nColEnd, SC
 
 bool ScTable::IsDataFiltered(const ScRange& rRange) const
 {
-return IsDataFiltered(rRange.aStart.Col(), rRange.aStart.Row(),
-rRange.aEnd.Col(), rRange.aEnd.Row());
+ScRange aNormalized(rRange.aStart, rRange.aEnd);
+return IsDataFiltered(aNormalized.aStart.Col(), aNormalized.aStart.Row(),
+  aNormalized.aEnd.Col(), aNormalized.aEnd.Row());
 }
 
 void ScTable::SetRowFlags( SCROW nRow, CRFlags nNewFlags )


[Libreoffice-commits] core.git: sc/inc sc/source

2022-02-25 Thread Justin Luth (via logerrit)
 sc/inc/table.hxx   |2 +
 sc/source/core/data/table4.cxx |   67 ++---
 sc/source/core/data/table5.cxx |   22 +
 3 files changed, 67 insertions(+), 24 deletions(-)

New commits:
commit 9cd4da63b6ed19b71a2475fccb4ab135f0a87873
Author: Justin Luth 
AuthorDate: Mon Feb 14 14:40:06 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Feb 25 18:46:54 2022 +0100

tdf#147404 sc AutoFillPreview: consider hidden cells

Back in the days before LO 3.6, only filtered cells
were skipped by autoFill. But when hidden cells were
also skipped, the preview function wasn't updated to look
for hidden cells instead of filtered cells.
(I said "instead" because filtered cells are also
considered to be hidden, so it encompasses both cases.)

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

diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 30c92cd87520..08624a937172 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -928,6 +928,8 @@ public:
 SCROW   CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
 tools::Long GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool 
bHiddenAsZero = true) const;
 
+SCCOL   CountVisibleCols(SCCOL nStartCol, SCCOL nEndCol) const;
+
 SCCOLROWLastHiddenColRow(SCCOLROW nPos, bool bCol) const;
 
 boolRowFiltered(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* 
pLastRow = nullptr) const;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index a4b232ea44d9..a3d49aa1c190 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -1247,6 +1247,49 @@ OUString ScTable::GetAutoFillPreview( const ScRange& 
rSource, SCCOL nEndX, SCROW
 
 if ( bOk )
 {
+tools::Long nBegin = 0;
+tools::Long nEnd = 0;
+tools::Long nHidden = 0;
+if (eFillDir == FILL_TO_BOTTOM || eFillDir == FILL_TO_TOP)
+{
+if (nEndY > nRow1)
+{
+nBegin = nRow2+1;
+nEnd = nEndY;
+}
+else
+{
+nBegin = nEndY;
+nEnd = nRow1 -1;
+}
+
+tools::Long nVisible = CountVisibleRows(nBegin, nEnd);
+nHidden = nEnd + 1 - nBegin - nVisible;
+}
+else
+{
+if (nEndX > nCol1)
+{
+nBegin = nCol2+1;
+nEnd = nEndX;
+}
+else
+{
+nBegin = nEndX;
+nEnd = nCol1 -1;
+}
+
+tools::Long nVisible = CountVisibleCols(nBegin, nEnd);
+nHidden = nEnd + 1 - nBegin - nVisible;
+}
+if (nHidden)
+{
+if (nIndex > 0)
+nIndex = nIndex - nHidden;
+else
+nIndex = nIndex + nHidden;
+}
+
 FillCmd eFillCmd;
 FillDateCmd eDateCmd;
 double nInc;
@@ -1277,30 +1320,6 @@ OUString ScTable::GetAutoFillPreview( const ScRange& 
rSource, SCCOL nEndX, SCROW
 }
 else if ( eFillCmd == FILL_SIMPLE ) // fill with pattern/sample
 {
-if ((eFillDir == FILL_TO_BOTTOM)||(eFillDir == FILL_TO_TOP))
-{
-tools::Long nBegin = 0;
-tools::Long nEnd = 0;
-if (nEndY > nRow1)
-{
-nBegin = nRow2+1;
-nEnd = nEndY;
-}
-else
-{
-nBegin = nEndY;
-nEnd = nRow1 -1;
-}
-
-tools::Long nNonFiltered = CountNonFilteredRows(nBegin, nEnd);
-tools::Long nFiltered = nEnd + 1 - nBegin - nNonFiltered;
-
-if (nIndex > 0)
-nIndex = nIndex - nFiltered;
-else
-nIndex = nIndex + nFiltered;
-}
-
 tools::Long nPosIndex = nIndex;
 while ( nPosIndex < 0 )
 nPosIndex += nSrcCount;
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index d62b94e40f28..4c510213edd9 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -796,6 +796,28 @@ tools::Long ScTable::GetTotalRowHeight(SCROW nStartRow, 
SCROW nEndRow, bool bHid
 return nHeight;
 }
 
+SCCOL ScTable::CountVisibleCols(SCCOL nStartCol, SCCOL nEndCol) const
+{
+assert(nStartCol <= nEndCol);
+SCCOL nCount = 0;
+SCCOL nCol = nStartCol;
+ScFlatBoolColSegments::RangeData aData;
+while (nCol <= nEndCol)
+{
+if (!mpHiddenCols->getRangeData(nCol, aData))
+break;
+
+if (aData.mnCol2 > nEndCol)
+aData

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

2022-02-28 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb |binary
 sc/qa/unit/data/xlsx/tdf122471.xlsx|binary
 sc/qa/unit/pivottable_filters_test.cxx |   56 +
 sc/source/filter/inc/pivotcachebuffer.hxx  |2 
 sc/source/filter/oox/pivotcachebuffer.cxx  |   10 +--
 sc/source/filter/oox/pivotcachefragment.cxx|2 
 6 files changed, 63 insertions(+), 7 deletions(-)

New commits:
commit 6961f6732954742415413fa53bdeebd1b03d9ec5
Author: Justin Luth 
AuthorDate: Mon Feb 28 15:36:08 2022 +0200
Commit: Justin Luth 
CommitDate: Mon Feb 28 19:17:53 2022 +0100

tdf#122471 xlsx import: pivottable error OUString, not uInt8

This fixes a LO 6.0 regression from
commit 9fa34e9f2cebe2cfc551668f2a67ddcb799d3fb8
which only half-way changed to OUString from uInt8.

An exception was raised because in XLSX, an INT was written
while the corresponding read function was expecting an OUString.

However, doing this runs into problems with binary files (xlsb),
which were still setting the value to an int.
Unit test shows the need to use OUString for xlsb too,
which now matches what I see in Excel 2003.

make CppunitTest_sc_pivottable_filters_test \
  CPPUNIT_TEST_NAME=testPivotTableErrorItem2FilterXLSX

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

diff --git a/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb 
b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb
new file mode 100644
index ..c32b8f3743e6
Binary files /dev/null and 
b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb differ
diff --git a/sc/qa/unit/data/xlsx/tdf122471.xlsx 
b/sc/qa/unit/data/xlsx/tdf122471.xlsx
new file mode 100644
index ..febac5c73506
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf122471.xlsx differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 36aa697b5071..14f790e89b68 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -79,6 +79,8 @@ public:
 void testPivotTableBoolFieldFilterXLSX();
 void testPivotTableRowColPageFieldFilterXLSX();
 void testPivotTableErrorItemFilterXLSX();
+void testPivotTableErrorItemFilterXLSB();
+void testPivotTableErrorItem2FilterXLSX();
 void testPivotTableOutlineModeXLSX();
 void testPivotTableDuplicatedMemberFilterXLSX();
 void testPivotTableTabularModeXLSX();
@@ -130,6 +132,8 @@ public:
 CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX);
 CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX);
 CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX);
+CPPUNIT_TEST(testPivotTableErrorItemFilterXLSB);
+CPPUNIT_TEST(testPivotTableErrorItem2FilterXLSX);
 CPPUNIT_TEST(testPivotTableOutlineModeXLSX);
 CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX);
 CPPUNIT_TEST(testPivotTableTabularModeXLSX);
@@ -2365,6 +2369,58 @@ void 
ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSX()
 xDocSh->DoClose();
 }
 
+void ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSB()
+{
+ScDocShellRef xDocSh = loadDoc(u"pivottable_error_item_filter.", 
FORMAT_XLSB);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+ScDocument& rDoc = xDocSh->GetDocument();
+ScDPCollection* pDPs = rDoc.GetDPCollection();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+const ScDPObject* pDPObj = &(*pDPs)[0];
+CPPUNIT_ASSERT(pDPObj);
+ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+CPPUNIT_ASSERT(pSaveData);
+
+ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName(u"b");
+CPPUNIT_ASSERT(pSaveDim);
+const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers();
+CPPUNIT_ASSERT_EQUAL(size_t(4), rMembers.size());
+ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("#DIV/0!");
+CPPUNIT_ASSERT(pMember);
+CPPUNIT_ASSERT(pMember->HasIsVisible());
+CPPUNIT_ASSERT(!pMember->GetIsVisible());
+
+xDocSh->DoClose();
+}
+
+void ScPivotTableFiltersTest::testPivotTableErrorItem2FilterXLSX()
+{
+ScDocShellRef xDocSh = loadDoc(u"tdf122471.", FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+ScDocument& rDoc = xDocSh->GetDocument();
+ScDPCollection* pDPs = rDoc.GetDPCollection();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+
+// Reload and check whether filtering is preserved
+xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+ScDocument& rLoadedDoc = xDocSh->GetDocument();
+pDPs = rLoa

[Libreoffice-commits] core.git: sc/source

2022-02-28 Thread Justin Luth (via logerrit)
 sc/source/filter/excel/xestream.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 5a64b618d84edb65465950d54e3b4afc952a301c
Author: Justin Luth 
AuthorDate: Tue Mar 1 06:54:49 2022 +0200
Commit: Justin Luth 
CommitDate: Tue Mar 1 07:19:51 2022 +0100

followup tdf#122098 xlsx export: avoid corrupt format if not bool value

Although I can't find any documents that cause a "b"
when the value is not 1 or 0, if such should ever happen,
then Excel complains about an invalid format and fails to load.

(The formatting looks a bit weird, but that is what clang-format
produces. How nice.)

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

diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 2178b0b3abc7..08048e922111 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -673,7 +673,10 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& 
rCell, const char*& rsT
 rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError));
 break;
 case sc::FormulaResultValue::Value:
-rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL ? "b" : 
"n";
+rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL
+ && (aResValue.mfValue == 0.0 || aResValue.mfValue 
== 1.0)
+ ? "b"
+ : "n";
 rsValue = OUString::number(aResValue.mfValue);
 break;
 case sc::FormulaResultValue::String:


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

2022-02-23 Thread Justin Luth (via logerrit)
 sc/qa/unit/pivottable_filters_test.cxx |5 +++--
 sc/source/filter/excel/xestream.cxx|   12 ++--
 sc/source/filter/oox/formulabuffer.cxx |7 +++
 3 files changed, 20 insertions(+), 4 deletions(-)

New commits:
commit 8f5d8669ca74fed8608e438a8436c173e35d43a6
Author: Justin Luth 
AuthorDate: Wed Feb 23 10:34:29 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Feb 23 16:48:56 2022 +0100

tdf#122098 xlsx im/export: let formulas guess their number format

This fixes the import side of a LO 4.2 regression
from commit 07b66cd3ac1a9f6c7b61a1d7da6e9d266e6de92d
and the export side of a LO 4.3 regression
from commit 69ecdad805281b2cb6ec2437da18daa19576deae

make CppunitTest_sc_pivottable_filters_test \
  CPPUNIT_TEST_NAME=testPivotTableBoolFieldFilterXLSX

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

diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index ef31fcf81282..36aa697b5071 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -2196,6 +2196,7 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX()
 ScDocument& rDoc = xDocSh->GetDocument();
 ScDPCollection* pDPs = rDoc.GetDPCollection();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(0, 1, 
0))); //A2
 
 // Reload and check filtering of row dimensions
 xDocSh = saveAndReload(*xDocSh, FORMAT_XLSX);
@@ -2213,11 +2214,11 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX()
 
 const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers();
 CPPUNIT_ASSERT_EQUAL(size_t(2), rMembers.size());
-ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("0");
+ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("FALSE");
 CPPUNIT_ASSERT(pMember);
 CPPUNIT_ASSERT(pMember->HasIsVisible());
 CPPUNIT_ASSERT(!pMember->GetIsVisible());
-pMember = pSaveDim->GetExistingMemberByName("1");
+pMember = pSaveDim->GetExistingMemberByName("TRUE");
 CPPUNIT_ASSERT(pMember);
 CPPUNIT_ASSERT(pMember->HasIsVisible());
 CPPUNIT_ASSERT(pMember->GetIsVisible());
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 74c0f9514831..a3c1b92fe86d 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -673,8 +673,16 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& 
rCell, const char*& rsT
 rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError));
 break;
 case sc::FormulaResultValue::Value:
-rsType = "n";
-rsValue = OUString::number(aResValue.mfValue);
+if (rCell.GetFormatType() == SvNumFormatType::LOGICAL)
+{
+rsType = "b";
+rsValue = rCell.GetValue() == 0.0 ? "0" : "1";
+}
+else
+{
+rsType = "n";
+rsValue = OUString::number(aResValue.mfValue);
+}
 break;
 case sc::FormulaResultValue::String:
 rsType = "str";
diff --git a/sc/source/filter/oox/formulabuffer.cxx 
b/sc/source/filter/oox/formulabuffer.cxx
index 2aeccb1b37b7..7fcc4f5e259f 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -153,6 +153,9 @@ void applySharedFormulas(
 pCell = new ScFormulaCell(rDoc.getDoc(), aPos, *pArray);
 
 rDoc.setFormulaCell(aPos, pCell);
+if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), 
aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0)
+pCell->SetNeedNumberFormat(true);
+
 if (rDesc.maCellValue.isEmpty())
 {
 // No cached cell value. Mark it for re-calculation.
@@ -227,6 +230,8 @@ void applyCellFormulas(
 pCell = new ScFormulaCell(rDoc.getDoc(), aPos, 
p->mpCell->GetCode()->Clone());
 
 rDoc.setFormulaCell(aPos, pCell);
+if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), 
aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0)
+pCell->SetNeedNumberFormat(true);
 
 // Update the cache.
 p->mnRow = aPos.Row();
@@ -245,6 +250,8 @@ void applyCellFormulas(
 
 ScFormulaCell* pCell = new ScFormulaCell(rDoc.getDoc(), aPos, 
std::move(pCode));
 rDoc.setFormulaCell(aPos, pCell);
+if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) 
% SV_COUNTRY_LANGUAGE_OFFSET == 0)
+pCell->SetNeedNumberFormat(true);
 rCache.store(aPos, pCell);
 }
 }


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

2022-02-23 Thread Justin Luth (via logerrit)
 chart2/qa/extras/chart2import.cxx|   15 +++
 chart2/qa/extras/data/pptx/tdf127720.pptx|binary
 chart2/source/tools/InternalDataProvider.cxx |3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit dfd0717b3f55eeb15a5634e52d7d0ed544d17578
Author: Justin Luth 
AuthorDate: Wed Feb 23 20:45:04 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Feb 23 20:52:31 2022 +0100

tdf#127720 chart2: create new columns for error bars

This is basically a copy/paste of the bubble chart fix
for tdf#103984 against the same LO 4.4 regression.

No exist unit tests had error bars. Very interesting.

make CppunitTest_chart2_import CPPUNIT_TEST_NAME=testPPTXChartErrorBars

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

diff --git a/chart2/qa/extras/chart2import.cxx 
b/chart2/qa/extras/chart2import.cxx
index 0c129d26978b..70cb393ba7b6 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -50,6 +50,7 @@ public:
 void testDOCXChartSeries();
 void testDOCXChartEmptySeries();
 void testTdf81396();
+void testPPTXChartErrorBars();
 void testDOCXChartValuesSize();
 void testPPTXChartSeries();
 void testPPTXSparseChartSeries();
@@ -147,6 +148,7 @@ public:
 CPPUNIT_TEST(testDOCXChartSeries);
 CPPUNIT_TEST(testDOCXChartEmptySeries);
 CPPUNIT_TEST(testTdf81396);
+CPPUNIT_TEST(testPPTXChartErrorBars);
 CPPUNIT_TEST(testDOCXChartValuesSize);
 CPPUNIT_TEST(testPPTChartSeries);
 CPPUNIT_TEST(testPPTXChartSeries);
@@ -481,6 +483,19 @@ void Chart2ImportTest::testTdf81396()
 CPPUNIT_ASSERT_EQUAL(105.210801910481, aDataSeriesYValues[0][0]);
 }
 
+void Chart2ImportTest::testPPTXChartErrorBars()
+{
+load(u"/chart2/qa/extras/data/pptx/", "tdf127720.pptx");
+Reference xChartDoc(getChartDocFromDrawImpress(0, 
0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xChartDoc.is());
+
+uno::Reference< chart::XChartDataArray > 
xDataArray(xChartDoc->getDataProvider(), UNO_QUERY_THROW);
+Sequence aColumnDesc = xDataArray->getColumnDescriptions();
+// Number of columns = 4 (Y-values, X-values and positive/negative error 
bars).
+// Without the fix there would only be 2 columns (no error range).
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be 4 columns and descriptions", 
static_cast(4), aColumnDesc.getLength());
+}
+
 void Chart2ImportTest::testDOCXChartValuesSize()
 {
 load( u"/chart2/qa/extras/data/docx/", "bubblechart.docx" );
diff --git a/chart2/qa/extras/data/pptx/tdf127720.pptx 
b/chart2/qa/extras/data/pptx/tdf127720.pptx
new file mode 100644
index ..b10a4c5ab4ed
Binary files /dev/null and b/chart2/qa/extras/data/pptx/tdf127720.pptx differ
diff --git a/chart2/source/tools/InternalDataProvider.cxx 
b/chart2/source/tools/InternalDataProvider.cxx
index ffbfebe10522..e1bf32b7ff10 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -568,7 +568,8 @@ InternalDataProvider::createDataSequenceFromArray( const 
OUString& rArrayStr, st
 }
 
 if (rRole == u"values-y" || rRole == u"values-first" || rRole == 
u"values-last" ||
-rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size")
+rRole == u"values-min" || rRole == u"values-max" || rRole == 
u"values-size" ||
+rRole == u"error-bars-y-positive" || rRole == u"error-bars-y-negative")
 {
 // Column values.  Append a new data column and populate it.
 


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - sw/qa sw/source

2022-02-23 Thread Justin Luth (via logerrit)
 sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx |   10 ++
 sw/source/filter/xml/xmltbli.cxx |2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit d9d7b17adf91c90a21a59250934e2e52e1133d81
Author: Justin Luth 
AuthorDate: Fri Oct 22 21:11:59 2021 +0200
Commit: Michael Stahl 
CommitDate: Wed Feb 23 18:20:20 2022 +0100

tdf#131025 ODF import: recognize SV_COUNTRY_LANGUAGE_OFFSET

File import was making an exception for "float value 0"
if the accompanying text had no resemblance to the value 0,
but that only applied to GENERAL number format.

It should apply to any language's default number format.

REGRESSION warning: as we can see, this has been handled
inconsistently in the past. But from the coding exception to overcome
losing text to a zero (and the huge number of duplicate bugs)
the best choice seems to be ignore the spec that says that
a number value overrides the text value - at least in
the case where the number value is zero.

Change-Id: I701e72c6a5dad42c7799ab501255a4859adf61d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124080
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit 3e1d316734354c6b49696c8904e0fc431cfb5143)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124014
Reviewed-by: Xisco Fauli 
(cherry picked from commit d3b4ef0f7726ef1619717d9e3327963ceb4c065a)

diff --git a/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
new file mode 100644
index ..f2bffb050ac4
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index 321ce301fb9c..6a216a1b5e92 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -219,6 +219,16 @@ DECLARE_ODFEXPORT_TEST(testTdf43569, 
"tdf43569_conditionalfield.doc")
 CPPUNIT_ASSERT(xFields->hasMoreElements());
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, 
"tdf131025_noZerosInTable.odt")
+{
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTables = 
xSupplier->getTextTables();
+uno::Reference xTable(xTables->getByName("Table1"), 
uno::UNO_QUERY);
+
+uno::Reference xCell(xTable->getCellByName("C3"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString());
+}
+
 DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt")
 {
 uno::Reference const xShape(getShape(1));
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 0fde4d3c509d..07ea1355b8fb 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2021,7 +2021,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 {
 const SwTableBoxNumFormat* pNumFormat =
 static_cast( pItem );
-if( ( pNumFormat != nullptr ) && ( pNumFormat->GetValue() == 0 
) )
+if (pNumFormat && (pNumFormat->GetValue() % 
SV_COUNTRY_LANGUAGE_OFFSET) == 0)
 {
 // only one text node?
 SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );


[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-1' - sw/qa sw/source

2022-02-23 Thread Justin Luth (via logerrit)
 sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt |binary
 sw/qa/extras/odfexport/odfexport.cxx |   10 ++
 sw/source/filter/xml/xmltbli.cxx |2 +-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit e0b1f46149acfe989b8c89f3fddc04e7c22bf568
Author: Justin Luth 
AuthorDate: Fri Oct 22 21:11:59 2021 +0200
Commit: Michael Stahl 
CommitDate: Wed Feb 23 18:39:41 2022 +0100

tdf#131025 ODF import: recognize SV_COUNTRY_LANGUAGE_OFFSET

File import was making an exception for "float value 0"
if the accompanying text had no resemblance to the value 0,
but that only applied to GENERAL number format.

It should apply to any language's default number format.

REGRESSION warning: as we can see, this has been handled
inconsistently in the past. But from the coding exception to overcome
losing text to a zero (and the huge number of duplicate bugs)
the best choice seems to be ignore the spec that says that
a number value overrides the text value - at least in
the case where the number value is zero.

Change-Id: I701e72c6a5dad42c7799ab501255a4859adf61d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124080
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Eike Rathke 
(cherry picked from commit 3e1d316734354c6b49696c8904e0fc431cfb5143)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124014
Reviewed-by: Xisco Fauli 
(cherry picked from commit d3b4ef0f7726ef1619717d9e3327963ceb4c065a)
(cherry picked from commit d9d7b17adf91c90a21a59250934e2e52e1133d81)

diff --git a/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt
new file mode 100644
index ..f2bffb050ac4
Binary files /dev/null and 
b/sw/qa/extras/odfexport/data/tdf131025_noZerosInTable.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index fa43734d8f7d..63f1ba7055b1 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -225,6 +225,16 @@ DECLARE_ODFEXPORT_TEST(testTdf43569, 
"tdf43569_conditionalfield.doc")
 CPPUNIT_ASSERT(xFields->hasMoreElements());
 }
 
+DECLARE_ODFEXPORT_TEST(testTdf131025_noZerosInTable, 
"tdf131025_noZerosInTable.odt")
+{
+uno::Reference xSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xTables = 
xSupplier->getTextTables();
+uno::Reference xTable(xTables->getByName("Table1"), 
uno::UNO_QUERY);
+
+uno::Reference xCell(xTable->getCellByName("C3"), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("5 gp"), xCell->getString());
+}
+
 DECLARE_ODFEXPORT_TEST(testTdf103567, "tdf103567.odt")
 {
 uno::Reference const xShape(getShape(1));
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 98ddb181baf1..13b0063e02da 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2053,7 +2053,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
 {
 const SwTableBoxNumFormat* pNumFormat =
 static_cast( pItem );
-if( ( pNumFormat != nullptr ) && ( pNumFormat->GetValue() == 0 
) )
+if (pNumFormat && (pNumFormat->GetValue() % 
SV_COUNTRY_LANGUAGE_OFFSET) == 0)
 {
 // only one text node?
 SwNodeIndex aNodeIndex( *(pCell->GetStartNode()), 1 );


[Libreoffice-commits] core.git: sc/source

2022-03-01 Thread Justin Luth (via logerrit)
 sc/source/core/data/dpcache.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit b7f654a406b704f469d1df424d83a3d98ae46432
Author: Justin Luth 
AuthorDate: Tue Mar 1 08:54:25 2022 +0200
Commit: Justin Luth 
CommitDate: Wed Mar 2 06:12:02 2022 +0100

tdf#118117 sc pivottable: STR_PIVOT_DATA is an existing name too

This fixes a LO 6.0 regression from
commit a078328e91ab9cbd78a92608c1abdc2c57ff9ac5

I looked for existing unit test examples using
assert (rLabel != ScResId(STR_PIVOT_DATA));
but found nothing.

I don't see the need for a unit test here.
The whole pivot table is messed up if you duplicate
a label, so why bother testing. It just is not
as bad now as it was before.

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

diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 0f3778eb40a6..52109c673bd3 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -356,9 +356,11 @@ void normalizeAddLabel(const OUString& rLabel, 
std::vector& rLabels, L
 
 std::vector normalizeLabels(const std::vector& 
rColData)
 {
-std::vector aLabels(1u, ScResId(STR_PIVOT_DATA));
+std::vector aLabels;
+aLabels.reserve(rColData.size() + 1);
 
 LabelSet aExistingNames;
+normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
 
 for (const InitColumnData& rCol : rColData)
 normalizeAddLabel(rCol.maLabel, aLabels, aExistingNames);
@@ -368,10 +370,11 @@ std::vector normalizeLabels(const 
std::vector& rColDat
 
 std::vector normalizeLabels(const ScDPCache::DBConnector& rDB, const 
sal_Int32 nLabelCount)
 {
-std::vector aLabels(1u, ScResId(STR_PIVOT_DATA));
+std::vector aLabels;
 aLabels.reserve(nLabelCount + 1);
 
 LabelSet aExistingNames;
+normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
 
 for (sal_Int32 nCol = 0; nCol < nLabelCount; ++nCol)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/qa sc/source

2022-03-02 Thread Justin Luth (via logerrit)
 sc/qa/unit/pivottable_filters_test.cxx |5 +++--
 sc/source/filter/excel/xestream.cxx|5 -
 sc/source/filter/oox/formulabuffer.cxx |7 +++
 3 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit e4f76cd9a4814ce6cc4795e5e1a5c74d54cb7513
Author: Justin Luth 
AuthorDate: Wed Feb 23 10:34:29 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Mar 2 13:05:22 2022 +0100

tdf#122098 xlsx im/export: let formulas guess their number format

SQUASHED backport: includes followup
  commit 5a64b618d84edb65465950d54e3b4afc952a301c

This fixes the import side of a LO 4.2 regression
from commit 07b66cd3ac1a9f6c7b61a1d7da6e9d266e6de92d
and the export side of a LO 4.3 regression
from commit 69ecdad805281b2cb6ec2437da18daa19576deae

make CppunitTest_sc_pivottable_filters_test \
  CPPUNIT_TEST_NAME=testPivotTableBoolFieldFilterXLSX

Change-Id: I4c680dbff844cf1eca52de641856daafa032eeb4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130406
Tested-by: Justin Luth 
Reviewed-by: Justin Luth 
(cherry picked from commit 8f5d8669ca74fed8608e438a8436c173e35d43a6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130386
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 8ad8fbffee81..80557c5b12aa 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -2201,6 +2201,7 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX()
 ScDocument& rDoc = xDocSh->GetDocument();
 ScDPCollection* pDPs = rDoc.GetDPCollection();
 CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(0, 1, 
0))); //A2
 
 // Reload and check filtering of row dimensions
 xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX);
@@ -2218,11 +2219,11 @@ void 
ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX()
 
 const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers();
 CPPUNIT_ASSERT_EQUAL(size_t(2), rMembers.size());
-ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("0");
+ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("FALSE");
 CPPUNIT_ASSERT(pMember);
 CPPUNIT_ASSERT(pMember->HasIsVisible());
 CPPUNIT_ASSERT(!pMember->GetIsVisible());
-pMember = pSaveDim->GetExistingMemberByName("1");
+pMember = pSaveDim->GetExistingMemberByName("TRUE");
 CPPUNIT_ASSERT(pMember);
 CPPUNIT_ASSERT(pMember->HasIsVisible());
 CPPUNIT_ASSERT(pMember->GetIsVisible());
diff --git a/sc/source/filter/excel/xestream.cxx 
b/sc/source/filter/excel/xestream.cxx
index 17395145bbab..3b49c5d6b9e2 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -670,7 +670,10 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& 
rCell, const char*& rsT
 rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError));
 break;
 case sc::FormulaResultValue::Value:
-rsType = "n";
+rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL
+ && (aResValue.mfValue == 0.0 || aResValue.mfValue 
== 1.0)
+ ? "b"
+ : "n";
 rsValue = OUString::number(aResValue.mfValue);
 break;
 case sc::FormulaResultValue::String:
diff --git a/sc/source/filter/oox/formulabuffer.cxx 
b/sc/source/filter/oox/formulabuffer.cxx
index 2aeccb1b37b7..7fcc4f5e259f 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -153,6 +153,9 @@ void applySharedFormulas(
 pCell = new ScFormulaCell(rDoc.getDoc(), aPos, *pArray);
 
 rDoc.setFormulaCell(aPos, pCell);
+if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), 
aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0)
+pCell->SetNeedNumberFormat(true);
+
 if (rDesc.maCellValue.isEmpty())
 {
 // No cached cell value. Mark it for re-calculation.
@@ -227,6 +230,8 @@ void applyCellFormulas(
 pCell = new ScFormulaCell(rDoc.getDoc(), aPos, 
p->mpCell->GetCode()->Clone());
 
 rDoc.setFormulaCell(aPos, pCell);
+if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), 
aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0)
+pCell->SetNeedNumberFormat(true);
 
 // Update the cache.
 p->mnRow = aPos.Row();
@@ -245,6 +250,8 @@ void applyCellFormulas(
 
 ScFormulaCell* pCell = new ScFormulaCell(rDoc.getDoc(), aPos, 
std::move(pCode));
 rDoc.setFormulaCell(aPos, pCell);

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/qa sc/source

2022-03-02 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb |binary
 sc/qa/unit/data/xlsx/tdf122471.xlsx|binary
 sc/qa/unit/pivottable_filters_test.cxx |   56 +
 sc/source/filter/inc/pivotcachebuffer.hxx  |2 
 sc/source/filter/oox/pivotcachebuffer.cxx  |   10 +--
 sc/source/filter/oox/pivotcachefragment.cxx|2 
 6 files changed, 63 insertions(+), 7 deletions(-)

New commits:
commit 789fbf732ad6db002fd83b307385940c392cc457
Author: Justin Luth 
AuthorDate: Mon Feb 28 15:36:08 2022 +0200
Commit: Eike Rathke 
CommitDate: Wed Mar 2 18:58:17 2022 +0100

tdf#122471 xlsx import: pivottable error OUString, not uInt8

This fixes a LO 6.0 regression from
commit 9fa34e9f2cebe2cfc551668f2a67ddcb799d3fb8
which only half-way changed to OUString from uInt8.

An exception was raised because in XLSX, an INT was written
while the corresponding read function was expecting an OUString.

However, doing this runs into problems with binary files (xlsb),
which were still setting the value to an int.
Unit test shows the need to use OUString for xlsb too,
which now matches what I see in Excel 2003.

make CppunitTest_sc_pivottable_filters_test \
  CPPUNIT_TEST_NAME=testPivotTableErrorItem2FilterXLSX

Change-Id: I399c9e34984bb1ff71695a87aa56f53063d37b3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130714
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit 6961f6732954742415413fa53bdeebd1b03d9ec5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130678
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb 
b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb
new file mode 100644
index ..c32b8f3743e6
Binary files /dev/null and 
b/sc/qa/unit/data/xlsb/pivottable_error_item_filter.xlsb differ
diff --git a/sc/qa/unit/data/xlsx/tdf122471.xlsx 
b/sc/qa/unit/data/xlsx/tdf122471.xlsx
new file mode 100644
index ..febac5c73506
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf122471.xlsx differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 80557c5b12aa..f6507d6cfccf 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -79,6 +79,8 @@ public:
 void testPivotTableBoolFieldFilterXLSX();
 void testPivotTableRowColPageFieldFilterXLSX();
 void testPivotTableErrorItemFilterXLSX();
+void testPivotTableErrorItemFilterXLSB();
+void testPivotTableErrorItem2FilterXLSX();
 void testPivotTableOutlineModeXLSX();
 void testPivotTableDuplicatedMemberFilterXLSX();
 void testPivotTableTabularModeXLSX();
@@ -130,6 +132,8 @@ public:
 CPPUNIT_TEST(testPivotTableBoolFieldFilterXLSX);
 CPPUNIT_TEST(testPivotTableRowColPageFieldFilterXLSX);
 CPPUNIT_TEST(testPivotTableErrorItemFilterXLSX);
+CPPUNIT_TEST(testPivotTableErrorItemFilterXLSB);
+CPPUNIT_TEST(testPivotTableErrorItem2FilterXLSX);
 CPPUNIT_TEST(testPivotTableOutlineModeXLSX);
 CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX);
 CPPUNIT_TEST(testPivotTableTabularModeXLSX);
@@ -2370,6 +2374,58 @@ void 
ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSX()
 xDocSh->DoClose();
 }
 
+void ScPivotTableFiltersTest::testPivotTableErrorItemFilterXLSB()
+{
+ScDocShellRef xDocSh = loadDoc(u"pivottable_error_item_filter.", 
FORMAT_XLSB);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+ScDocument& rDoc = xDocSh->GetDocument();
+ScDPCollection* pDPs = rDoc.GetDPCollection();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+const ScDPObject* pDPObj = &(*pDPs)[0];
+CPPUNIT_ASSERT(pDPObj);
+ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+CPPUNIT_ASSERT(pSaveData);
+
+ScDPSaveDimension* pSaveDim = pSaveData->GetExistingDimensionByName(u"b");
+CPPUNIT_ASSERT(pSaveDim);
+const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers();
+CPPUNIT_ASSERT_EQUAL(size_t(4), rMembers.size());
+ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("#DIV/0!");
+CPPUNIT_ASSERT(pMember);
+CPPUNIT_ASSERT(pMember->HasIsVisible());
+CPPUNIT_ASSERT(!pMember->GetIsVisible());
+
+xDocSh->DoClose();
+}
+
+void ScPivotTableFiltersTest::testPivotTableErrorItem2FilterXLSX()
+{
+ScDocShellRef xDocSh = loadDoc(u"tdf122471.", FORMAT_XLSX);
+CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.is());
+ScDocument& rDoc = xDocSh->GetDocument();
+ScDPCollection* pDPs = rDoc.GetDPCollection();
+CPPUNIT_ASSERT_EQUAL(static_cast(1), pDPs->GetCount());
+
+// Reload and check whether filtering is preserved
+xDocSh = saveAndReload(&(*xDocSh),

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sc/source

2022-03-03 Thread Justin Luth (via logerrit)
 sc/source/core/data/dpcache.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 268bddd26cc006a7b4a1f9142245aecbff51c173
Author: Justin Luth 
AuthorDate: Tue Mar 1 08:54:25 2022 +0200
Commit: Xisco Fauli 
CommitDate: Thu Mar 3 17:16:24 2022 +0100

tdf#118117 sc pivottable: STR_PIVOT_DATA is an existing name too

This fixes a LO 6.0 regression from
commit a078328e91ab9cbd78a92608c1abdc2c57ff9ac5

I looked for existing unit test examples using
assert (rLabel != ScResId(STR_PIVOT_DATA));
but found nothing.

I don't see the need for a unit test here.
The whole pivot table is messed up if you duplicate
a label, so why bother testing. It just is not
as bad now as it was before.

Change-Id: I59cc73becf91f766a29d2007c2d67685ffa2a65c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130751
Tested-by: Jenkins
Reviewed-by: Justin Luth 
(cherry picked from commit b7f654a406b704f469d1df424d83a3d98ae46432)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130784
Reviewed-by: Xisco Fauli 

diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index d544fb884d9c..dba2b7a7ac36 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -356,9 +356,11 @@ void normalizeAddLabel(const OUString& rLabel, 
std::vector& rLabels, L
 
 std::vector normalizeLabels(const std::vector& 
rColData)
 {
-std::vector aLabels(1u, ScResId(STR_PIVOT_DATA));
+std::vector aLabels;
+aLabels.reserve(rColData.size() + 1);
 
 LabelSet aExistingNames;
+normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
 
 for (const InitColumnData& rCol : rColData)
 normalizeAddLabel(rCol.maLabel, aLabels, aExistingNames);
@@ -368,10 +370,11 @@ std::vector normalizeLabels(const 
std::vector& rColDat
 
 std::vector normalizeLabels(const ScDPCache::DBConnector& rDB, const 
sal_Int32 nLabelCount)
 {
-std::vector aLabels(1u, ScResId(STR_PIVOT_DATA));
+std::vector aLabels;
 aLabels.reserve(nLabelCount + 1);
 
 LabelSet aExistingNames;
+normalizeAddLabel(ScResId(STR_PIVOT_DATA), aLabels, aExistingNames);
 
 for (sal_Int32 nCol = 0; nCol < nLabelCount; ++nCol)
 {


[Libreoffice-commits] core.git: svx/source

2022-03-03 Thread Justin Luth (via logerrit)
 svx/source/table/tablelayouter.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit c1b2ed31cbde0a81853ba4fe59841cded6c52105
Author: Justin Luth 
AuthorDate: Tue Feb 8 09:04:47 2022 +0200
Commit: Justin Luth 
CommitDate: Fri Mar 4 06:16:05 2022 +0100

related tdf#144092 svx: warn about wrong "empty cell" idea

An empty cell is not irrelevant in making height decisions,
at least in MS file formats, and yet all of this code that
is being based on that wrong assumption is being done to
import ppt(x) files, and causing one regression after another.
[Worst of all, this isn't even a filter import codebase.]

Unfortunately the regressions have been dealt with
or discovered slowly, so some of this has been in place
for years. Otherwise I would revert this in a heartbeat.

At least throw in a warning, so that this seemingly
logical conclusion will at least be challenged by
the next bug-fixer - instead of building another
layer on this house of cards.

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

diff --git a/svx/source/table/tablelayouter.cxx 
b/svx/source/table/tablelayouter.cxx
index 0c517707f4f8..87bd4436e7f3 100644
--- a/svx/source/table/tablelayouter.cxx
+++ b/svx/source/table/tablelayouter.cxx
@@ -766,6 +766,11 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& 
rArea, bool bFit )
 }
 else
 {
+// WARNING: tdf#144092 / tdf#139511 suggest this entire 
section is invalid.
+// Empty cells should not be ignored in regards to row 
height,
+// especially MS formats, despite this code being added to 
import MS files...
+// The problem is getMinimumHeight can give wrong values 
for empty cells.
+
 bool bCellHasText = xCell->hasText();
 bool bCellInEditMode = xCell->IsTextEditActive();
 


[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng sc/source

2022-02-25 Thread Justin Luth (via logerrit)
 editeng/source/editeng/editview.cxx |7 +-
 include/editeng/editview.hxx|2 
 sc/source/ui/inc/gridwin.hxx|2 
 sc/source/ui/view/gridwin.cxx   |   89 ++--
 4 files changed, 31 insertions(+), 69 deletions(-)

New commits:
commit 8238b887ccecb425f17166d2380afb208bbfdfbb
Author: Justin Luth 
AuthorDate: Mon Feb 21 10:17:36 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Feb 25 15:22:46 2022 +0100

tdf#81894 sc spelling: choose correct cell when in edit mode

In edit mode, text that is too large to fit inside the cell
will expand to cover other columns (or rows if cell wraps).
GetPosFromPixel doesn't account for this, so it needs to
be done separately. (SHOULD the function itself take this
into account? Probably, but it is used a LOT,
so I'm afraid to mess with it.)

This patch fixes two situations in bug 81894 comment 25's example.
1.) Open Francewhoa---2017-May-29---speadsheet.ods
2.) Double click on A1 to enter edit mode.
Notice that the cell expands to cover A1:A3.
3.) Right click on "productivityy".

Before the patch, the spell check was inspecting empty cell A2,
and thus showed the edit popup.
With the patch, the spell check is using cell A1,
and thus provides spelling suggestions, as expected.
[This patch depends on this bug report's prior comit.]

4.) Look at B3 and notice misspelled words spilling over from A3.
Double click on B3 to enter edit mode.
5.) Right click on the position where the misspelled word had been.

Before the patch, a spelling suggestion was provided,
even though we right-clicked on an empty place in a different col.
After the patch, we get the normal edit popup.

Change-Id: I58fbf60711a5c010263b525a96383a805be1b3ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130298
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5a8c9625c332..0f01233d64a9 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3182,9 +3182,24 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
 Point aPosPixel = rCEvt.GetMousePosPixel();
 Point aMenuPos = aPosPixel;
 
+bool bPosIsInEditView = mrViewData.HasEditView(eWhich);
 SCCOL nCellX = -1;
 SCROW nCellY = -1;
 mrViewData.GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, 
nCellY);
+// GetPosFromPixel ignores the fact that when editing a cell, the cell 
might grow to cover
+// other rows/columns. In addition, the mouse might now be outside the 
edited cell.
+if (bPosIsInEditView)
+{
+if (nCellX >= mrViewData.GetEditViewCol() && nCellX <= 
mrViewData.GetEditEndCol())
+nCellX = mrViewData.GetEditViewCol();
+else
+bPosIsInEditView = false;
+
+if (nCellY >= mrViewData.GetEditViewRow() && nCellY <= 
mrViewData.GetEditEndRow())
+nCellY = mrViewData.GetEditViewRow();
+else
+bPosIsInEditView = false;
+}
 
 bool bSpellError = false;
 SCCOL nColSpellError = nCellX;
@@ -3216,7 +3231,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
 // Find the first string to the left for spell checking in case 
the current cell is empty.
 ScAddress aPos(nCellX, nCellY, nTab);
 ScRefCellValue aSpellCheckCell(rDoc, aPos);
-while (aSpellCheckCell.meType == CELLTYPE_NONE)
+while (!bPosIsInEditView && aSpellCheckCell.meType == 
CELLTYPE_NONE)
 {
 // Loop until we get the first non-empty cell in the row.
 aPos.IncCol(-1);
commit cf18038c66075f7a18d89e47f3a2ab1a5bf7c4fd
Author: Justin Luth 
AuthorDate: Sat Feb 19 20:22:23 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Feb 25 15:22:32 2022 +0100

tdf#81894 sc spelling: eliminate separate(inaccurate) check

ExecuteSpellPopup is quite accurate at identifying whether
the spelling at PosPixel is a spelling error or not.
If it is not a misspelled word, then it just silently returns.

If we make this a bDone flag, then it will just move
on to the normal right-click dialog.

There are a few additional scenarios that need to be
handled (mainly in terms of showing the edit-mode menu
instead of the full format menu, and also not
always returning the correct row/col when in edit mode).
I will do them in separate patches so that
each edge case can be clearly seen and handled.
They all rely on this patch being applied first.

This is the base patch. Too many things simply don't
work with the interim check, so I removed it.
(Part of the problem is that EditView kicks on and off,
and then a new CompleteOnlineSpelling needs to be run befo

[Libreoffice-commits] core.git: sc/source

2022-02-25 Thread Justin Luth (via logerrit)
 sc/source/ui/view/gridwin.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit bdea5805c0344cbddb5c68d1fd19d3cd3b6e3afd
Author: Justin Luth 
AuthorDate: Mon Feb 21 11:05:41 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Feb 25 15:23:00 2022 +0100

tdf#81894 sc spelling: close EditView when moving outside cell

In a previous patch, we noted that instead of a spelling suggestion,
a popup was displayed. This patch handles that unfinished business.

1.) Open LOv4304.ods from bug 81894 comment 6.
2.) double-click on cell B4 (to enter edit mode)
3.) right click on "spellng" which appears to be in D4

Before any of the patches, this did nothing.
After the first base patch, it was showing the format popup.
Now it offers a spelling suggestion.

[By running EnterHandler, we are accepting any changes made
 so far in editing mode. That is consistent with what happens
 if a left-click selects a different cell.]

Change-Id: I23876a26861b695dc46efa42f6c3fed6fdb8da6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130299
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 0f01233d64a9..f99eb0b350c4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3199,6 +3199,15 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
 nCellY = mrViewData.GetEditViewRow();
 else
 bPosIsInEditView = false;
+
+if (!bPosIsInEditView)
+{
+// Close the edit view when moving outside of the edited cell
+// to avoid showing the edit popup, or providing the wrong 
EditView to spellcheck.
+ScInputHandler* pHdl = pScMod->GetInputHdl();
+if (pHdl)
+pHdl->EnterHandler();
+}
 }
 
 bool bSpellError = false;


[Libreoffice-commits] core.git: sc/source

2022-02-25 Thread Justin Luth (via logerrit)
 sc/source/ui/view/gridwin.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit a24eac37fbf8a325b09c3b575c568621a696a560
Author: Justin Luth 
AuthorDate: Mon Feb 21 11:48:48 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Feb 25 15:24:54 2022 +0100

tdf#81894 sc spelling: re-close EditView if not spelling error

In order to check if there is a spelling error,
the code had to open an EditView. If there was no spelling error
at the mouse pointer, then stop edit mode again before showing
the context menu so the full popup is shown, not just the edit one.

1.) Open LOv4304.ods from bug 81894 comment 6.
2.) right click on "The" in B3

Since we haven't been in edit mode, it should show the full
format popup. Before this patch series, that is what happened,
so this follow-up patch is critical to preventing a regression.

This patch makes use of a variable created in earlier patches
to fix other issues related to right-click spelling.

Change-Id: Ia9713e9654c1f74bc926d51fe8bc5180a8265c79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130300
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f99eb0b350c4..d92d2109cdd1 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3325,8 +3325,14 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
 Link aLink = LINK( this, ScGridWindow, 
PopupSpellingHdl );
 bDone = pEditView->ExecuteSpellPopup(aMenuPos, aLink);
 
-if (pHdl && pHdl->GetEditString() != sOldText)
+// If the spelling is corrected, stop editing to flush any cached 
spelling info.
+// Or, if no misspelled word at this position, and it wasn't 
initially in edit mode,
+// then exit the edit mode in order to get the full context popup 
(not edit popup).
+if (pHdl && (pHdl->GetEditString() != sOldText
+ || (!bDone && !bPosIsInEditView)))
+{
 pHdl->EnterHandler();
+}
 
 if (!bDone && nColSpellError != nCellX)
 {


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

2022-03-23 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/ww8export3.cxx |5 ++---
 sw/source/filter/ww8/ww8atr.cxx   |6 --
 2 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 7974d5ef1446f106a5f7c45b76ea2728fe4b18ce
Author: Justin Luth 
AuthorDate: Wed Mar 9 12:31:14 2022 +0200
Commit: Miklos Vajna 
CommitDate: Wed Mar 23 09:24:21 2022 +0100

tdf#147861 ww8export: DI_CUSTOM write fixed field, not plain txt

It looks like we just punt on fields, and try to avoid
round-tripping them as much as possible. And for good reason
since they are tough and poorly handled.

But since import of DI_CUSTOM has improved for DOC,
it would be nice to be able to round-trip it as well,
so that is what this allows.
It also opens the door to round-trip more field
situations as well.

This patch depends on the earlier related patch
that removes " (fixed)" from the FieldName.

RTF and DOCX also export OK, but import needs some love.

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

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 7f0132dcbc4e..6da63bbeb336 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -107,15 +107,14 @@ DECLARE_WW8EXPORT_TEST(testTdf147861_customField, 
"tdf147861_customField.doc")
 getParagraph(2, " INSERT Custom Title here"); // matches current 
DocProperty
 getParagraph(3, "My Title"); // edited
 
-if (mbExported)
-return;
-
 // Verify that these are fields, and not just plain text
 uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
 auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
 uno::Reference 
xFields(xFieldsAccess->createEnumeration());
 uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(OUString("CustomEditedTitle"), 
xField->getPresentation(false));
+// The " (fixed)" part is unnecessary, but it must be consistent across a 
round-trip
+CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), 
xField->getPresentation(true));
 }
 
 DECLARE_WW8EXPORT_TEST(testTdf138345_paraCharHighlight, 
"tdf138345_paraCharHighlight.doc")
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 4e0036e04f00..839897f93ebd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2910,7 +2910,7 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
 case SwFieldIds::DocInfo:// Last printed, last edited,...
 if( DI_SUB_FIXED & nSubType )
 bWriteExpand = true;
-else
+
 {
 OUString sStr;
 ww::eField eField(ww::eNONE);
@@ -2965,13 +2965,15 @@ void AttributeOutputBase::TextField( const 
SwFormatField& rField )
 
 if (pDocInfoField != nullptr)
 sStr = "\"" + pDocInfoField->GetName() + "\"";
+
+bWriteExpand = false;
 }
 break;
 default:
 break;
 }
 
-if (eField != ww::eNONE)
+if (!bWriteExpand && eField != ww::eNONE)
 {
 GetExport().OutputField(pField, eField, FieldString(eField) + 
sStr);
 }


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

2022-03-25 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf147861_customField.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   19 +++
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|2 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|   25 ++-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|4 ++
 5 files changed, 48 insertions(+), 2 deletions(-)

New commits:
commit c4cb1d1dd581a5f120d9cf8b1d4274ec38f3eabe
Author: Justin Luth 
AuthorDate: Sat Mar 12 11:11:01 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Mar 25 13:48:12 2022 +0100

tdf#147861 writerfilter: use GetFieldResult, not current DocProperty

Import DOCX and RTF DocProperty fields as "fixed" if the displayed
text does not match the File - Properties - Custom variable's content.

Otherwise LO will automatically update the field and show the wrong
contents (because MS Word requires the user to manually refresh via F9).

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf147861_customField.docx 
b/sw/qa/extras/ooxmlexport/data/tdf147861_customField.docx
new file mode 100644
index ..70071fa7e8a3
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf147861_customField.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index a33da51048b8..bbc5ec25da07 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -18,6 +18,7 @@
 
 #include 
 #include 
+#include 
 
 constexpr OUStringLiteral DATA_DIRECTORY = u"/sw/qa/extras/ooxmlexport/data/";
 
@@ -48,6 +49,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135164_cancelledNumbering, 
"tdf135164_cancelledN
 CPPUNIT_ASSERT_EQUAL(OUString("i"), getProperty(xPara, 
"ListLabelString"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf147861_customField, 
"tdf147861_customField.docx")
+{
+// These should each be specific values, not a shared DocProperty
+getParagraph(1, "CustomEditedTitle"); // edited
+// A couple of nulls at the end of the string thwarted all attemps at an 
"equals" comparison.
+CPPUNIT_ASSERT(getParagraph(2)->getString().startsWith(" INSERT Custom 
Title here"));
+getParagraph(3, "My Title"); // edited
+
+// Verify that these are fields, and not just plain text
+uno::Reference xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+auto xFieldsAccess(xTextFieldsSupplier->getTextFields());
+uno::Reference 
xFields(xFieldsAccess->createEnumeration());
+uno::Reference xField(xFields->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(OUString("CustomEditedTitle"), 
xField->getPresentation(false));
+// The " (fixed)" part is unnecessary, but it must be consistent across a 
round-trip
+CPPUNIT_ASSERT_EQUAL(OUString("DocInformation:Title (fixed)"), 
xField->getPresentation(true));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf135906)
 {
 loadAndReload("tdf135906.docx");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 3d0b23f9e71e..415138bc5e28 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -129,7 +129,7 @@ DECLARE_OOXMLEXPORT_TEST(testN751117, "n751117.docx")
 DECLARE_OOXMLEXPORT_TEST(testFdo74745, "fdo74745.docx")
 {
 uno::Reference paragraph = getParagraph(3);
-CPPUNIT_ASSERT_EQUAL(OUString("09/02/14"), paragraph->getString());
+CPPUNIT_ASSERT_EQUAL(OUString("09/02/2014"), paragraph->getString());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo81486, "fdo81486.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a4d59a8b7fdb..a3d6a4f69498 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4792,6 +4792,11 @@ void 
FieldContext::SetTextField(uno::Reference const& xTextFie
 m_xTextField = xTextField;
 }
 
+void FieldContext::CacheVariableValue(const uno::Any& rAny)
+{
+rAny >>= m_sVariableValue;
+}
+
 void FieldContext::AppendCommand(std::u16string_view rPart)
 {
 m_sCommand += rPart;
@@ -5425,6 +5430,9 @@ void DomainMapper_Impl::handleAuthor
 }
 }
 }
+else
+
pContext->CacheVariableValue(xUserDefinedProps->getPropertyValue(rFirstParam));
+
 OUString sServiceName("com.sun.star.text.TextField.");
 bool bIsCustomField = false;
 if(sFieldServiceName.isEmpty())
@@ -7044,7 +7052,2

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

2022-03-24 Thread Justin Luth (via logerrit)
 sw/qa/extras/ww8export/ww8export3.cxx |3 ++-
 sw/source/filter/ww8/ww8par5.cxx  |   23 ---
 2 files changed, 22 insertions(+), 4 deletions(-)

New commits:
commit f5c2085e70c40370a790868d4683133a41e6599d
Author: Justin Luth 
AuthorDate: Fri Mar 11 14:55:00 2022 +0200
Commit: Miklos Vajna 
CommitDate: Thu Mar 24 13:20:38 2022 +0100

tdf#147861 ww8import: solve TODO: not fixed-field if equal

Do not mark the field as "fixed" if the displayed string
matches the internal variable. This allows changing the variable
within LO and having the field update to reflect that change,
which is the way that these fields are supposed to work
(although in MS Word they only update manually via F9
 which is why some needed to be fixed in the first place).

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

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index bce5fdfbe2af..cf26c2d2447f 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -104,7 +104,8 @@ DECLARE_WW8EXPORT_TEST(testTdf147861_customField, 
"tdf147861_customField.doc")
 {
 // These should each be specific values, not a shared DocProperty
 getParagraph(1, "CustomEditedTitle"); // edited
-getParagraph(2, " INSERT Custom Title here"); // matches current 
DocProperty
+// A couple of \x0\x0 at the end of the import variable thwart an equality 
comparison
+CPPUNIT_ASSERT(getParagraph(2)->getString().startsWith(" INSERT Custom 
Title here"));
 getParagraph(3, "My Title"); // edited
 
 // Verify that these are fields, and not just plain text
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 66b0416b..a78fa37f2e45 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -1650,13 +1650,30 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* 
pF, OUString& rStr )
 // In other words, Word lets the field to be out of sync with the 
controlling variable.
 // Marking as FIXEDFLD solves the automatic replacement problem, 
but of course prevents
 // Writer from making any changes, even on an F9 refresh.
-// TODO: If the field already matches the DocProperty, no need to 
mark as fixed.
 // TODO: Extend LO to allow a linked field that doesn't 
automatically update.
+IDocumentContentOperations& 
rIDCO(m_rDoc.getIDocumentContentOperations());
 const auto pType(static_cast(
 
m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocInfo)));
 const OUString sDisplayed = GetFieldResult(pF);
-SwDocInfoField aField(pType, DI_CUSTOM | DI_SUB_FIXED | nReg, 
aDocProperty, sDisplayed);
-m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, 
SwFormatField(aField));
+SwDocInfoField aField(pType, DI_CUSTOM | nReg, aDocProperty);
+
+// If text already matches the DocProperty var, then safe to treat 
as refreshable field.
+OUString sVariable = aField.ExpandField(/*bCache=*/false, nullptr);
+if (sDisplayed.getLength() != sVariable.getLength())
+{
+sal_Int32 nLen = sVariable.indexOf('\x0');
+if (nLen >= 0)
+sVariable = sVariable.copy(0, nLen);
+}
+if (sDisplayed == sVariable)
+rIDCO.InsertPoolItem(*m_pPaM, SwFormatField(aField));
+else
+{
+// They don't match, so use a fixed field to prevent LO from 
altering the contents.
+SwDocInfoField aFixedField(pType, DI_CUSTOM | DI_SUB_FIXED | 
nReg, aDocProperty,
+   sDisplayed);
+rIDCO.InsertPoolItem(*m_pPaM, SwFormatField(aFixedField));
+}
 
 return eF_ResT::OK;
 }


<    6   7   8   9   10   11   12   13   14   15   >