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

2022-04-08 Thread Dennis Francis (via logerrit)
 sc/inc/scmod.hxx   |2 +-
 sc/source/ui/app/inputhdl.cxx  |   12 +++-
 sc/source/ui/app/scmod.cxx |4 ++--
 sc/source/ui/inc/inputhdl.hxx  |2 +-
 sc/source/ui/view/tabvwsha.cxx |   11 +--
 5 files changed, 24 insertions(+), 7 deletions(-)

New commits:
commit 08d3d0bcfd6a0540b19252730b2090da0b5da2d4
Author: Dennis Francis 
AuthorDate: Fri Apr 1 14:50:42 2022 +0530
Commit: Dennis Francis 
CommitDate: Fri Apr 8 09:15:30 2022 +0200

lok: avoid validation-dialog yield when saving

Disable error dialog box when about to save in lok mode as this
ultimately invokes SvpSalInstance::DoYield() when we want to save
immediately without committing any erroneous input in possibly a cell
with validation rules. After save is complete the user can continue
editing.

Conflicts:
sc/source/ui/app/inputhdl.cxx

Change-Id: Iffa0766ad594db75f57158986c4e1d2646f71da4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132410
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Michael Meeks 
(cherry picked from commit e0175ee821eaff56c4b8e0a1b7afa1cabe0ab593)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132654
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index a0a6e17e8423..919f4c22056d 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -197,7 +197,7 @@ public:
 boolIsInputMode();  // also for SC_INPUT_TYPE
 voidSetInputMode( ScInputMode eMode, const OUString* 
pInitText = nullptr );
 boolInputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit 
= false );
-SC_DLLPUBLIC void   InputEnterHandler( ScEnterMode nBlockMode = 
ScEnterMode::NORMAL );
+SC_DLLPUBLIC void   InputEnterHandler( ScEnterMode nBlockMode = 
ScEnterMode::NORMAL, bool bBeforeSavingInLOK = false );
 voidInputCancelHandler();
 voidInputSelection( const EditView* pView );
 voidInputChanged( const EditView* pView );
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index abd1190475fb..f7a41b13d084 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -2993,7 +2993,7 @@ static void lcl_SelectionToEnd( EditView* pView )
 }
 }
 
-void ScInputHandler::EnterHandler( ScEnterMode nBlockMode )
+void ScInputHandler::EnterHandler( ScEnterMode nBlockMode, bool 
bBeforeSavingInLOK )
 {
 if (!mbDocumentDisposing && comphelper::LibreOfficeKit::isActive()
 && pActiveViewSh != SfxViewShell::Current())
@@ -3073,6 +3073,16 @@ void ScInputHandler::EnterHandler( ScEnterMode 
nBlockMode )
 pSelEngine->ReleaseMouse();
 }
 
+if (bBeforeSavingInLOK)
+{
+// Invalid entry but not applied to the document model.
+// Exit to complete the "save", leaving the edit view as 
it is
+// for the user to continue after save.
+bInOwnChange = false;
+bInEnterHandler = false;
+return;
+}
+
 if (pData->DoError(pActiveViewSh->GetFrameWeld(), aString, 
aCursorPos))
 bForget = true; // Do not take over input
 }
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c4c0584eb6a9..97a5461956ca 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1405,13 +1405,13 @@ bool ScModule::InputKeyEvent( const KeyEvent& rKEvt, 
bool bStartEdit )
 return pHdl && pHdl->KeyInput( rKEvt, bStartEdit );
 }
 
-void ScModule::InputEnterHandler( ScEnterMode nBlockMode )
+void ScModule::InputEnterHandler( ScEnterMode nBlockMode, bool 
bBeforeSavingInLOK )
 {
 if ( !SfxGetpApp()->IsDowning() ) // Not when quitting the program
 {
 ScInputHandler* pHdl = GetInputHdl();
 if (pHdl)
-pHdl->EnterHandler( nBlockMode );
+pHdl->EnterHandler( nBlockMode, bBeforeSavingInLOK );
 }
 }
 
diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx
index 0bc24bcd51db..625d2f7ca1f8 100644
--- a/sc/source/ui/inc/inputhdl.hxx
+++ b/sc/source/ui/inc/inputhdl.hxx
@@ -196,7 +196,7 @@ public:
 voidMergeLanguageAttributes( ScEditEngineDefaulter& 
rDestEngine ) const;
 
 boolKeyInput( const KeyEvent& rKEvt, bool bStartEdit );
-voidEnterHandler( ScEnterMode nBlockMode = ScEnterMode::NORMAL 
);
+voidEnterHandler( ScEnterMode nBlockMode = 
ScEnterMode::NORMAL, bool bBeforeSavingInLOK = false );
 voidCancelHandler();
 voidSetReference( const ScRange& rRef, const ScDocument& rDoc 
);
 voidAddRefEntry();
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 734cc

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

2022-04-08 Thread Dennis Francis (via logerrit)
 sc/qa/unit/tiledrendering/data/validity.xlsx |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   57 ---
 2 files changed, 52 insertions(+), 5 deletions(-)

New commits:
commit 388b4fc1085074da759903a9b1768bded43dd0d3
Author: Dennis Francis 
AuthorDate: Thu Apr 7 13:14:59 2022 +0530
Commit: Dennis Francis 
CommitDate: Fri Apr 8 09:16:08 2022 +0200

lok: unit test for invalid entry save

Unit test related to the fix

lok: avoid validation-dialog yield when saving
e0175ee821eaff56c4b8e0a1b7afa1cabe0ab593

The test ensures that the document is marked unmodified after save has
been executed in the middle of entering partial data to a validation
cell.

Change-Id: Idffd6d647034e128d0d800fe8e29efc333c03db6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132655
Tested-by: Jenkins
Reviewed-by: Dennis Francis 

diff --git a/sc/qa/unit/tiledrendering/data/validity.xlsx 
b/sc/qa/unit/tiledrendering/data/validity.xlsx
new file mode 100644
index ..54a92acd5979
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/validity.xlsx differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 249cd2420e4a..7ce8ad47105b 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -124,6 +124,7 @@ public:
 void testSheetViewDataCrash();
 void testTextBoxInsert();
 void testCommentCellCopyPaste();
+void testInvalidEntrySave();
 
 CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
 CPPUNIT_TEST(testRowColumnHeaders);
@@ -180,6 +181,7 @@ public:
 CPPUNIT_TEST(testSheetViewDataCrash);
 CPPUNIT_TEST(testTextBoxInsert);
 CPPUNIT_TEST(testCommentCellCopyPaste);
+CPPUNIT_TEST(testInvalidEntrySave);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2569,18 +2571,25 @@ void ScTiledRenderingTest::testSortAscendingDescending()
 CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry);
 }
 
-void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, 
ScTabViewShell* pView, ScModelObj* pModelObj)
+void lcl_typeCharsInCell(const std::string& aStr, SCCOL nCol, SCROW nRow, 
ScTabViewShell* pView,
+ScModelObj* pModelObj, bool bInEdit = false, bool bCommit = true)
 {
-pView->SetCursor(nCol, nRow);
+if (!bInEdit)
+pView->SetCursor(nCol, nRow);
+
 for (const char& cChar : aStr)
 {
 pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, cChar, 0);
 pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, cChar, 0);
 Scheduler::ProcessEventsToIdle();
 }
-pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
-pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
-Scheduler::ProcessEventsToIdle();
+
+if (bCommit)
+{
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+Scheduler::ProcessEventsToIdle();
+}
 }
 
 void ScTiledRenderingTest::testAutoInputStringBlock()
@@ -2914,6 +2923,44 @@ void ScTiledRenderingTest::testCommentCellCopyPaste()
 comphelper::LibreOfficeKit::setTiledAnnotations(true);
 }
 
+void ScTiledRenderingTest::testInvalidEntrySave()
+{
+// Load a document
+comphelper::LibreOfficeKit::setActive();
+
+ScModelObj* pModelObj = createDoc("validity.xlsx");
+const ScDocument* pDoc = pModelObj->GetDocument();
+ViewCallback aView;
+int nView = SfxLokHelper::getView();
+
+SfxLokHelper::setView(nView);
+
+ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( 
pModelObj->GetEmbeddedObject() );
+ScTabViewShell* pTabViewShell = 
dynamic_cast(SfxViewShell::Current());
+CPPUNIT_ASSERT(pTabViewShell);
+
+// Type partial date "7/8" of "7/8/2013" that
+// the validation cell at A8 can accept
+lcl_typeCharsInCell("7/8", 0, 7, pTabViewShell, pModelObj,
+false /* bInEdit */, false /* bCommit */); // Type "7/8" in A8
+
+uno::Sequence aArgs;
+comphelper::dispatchCommand(".uno:Save", aArgs);
+Scheduler::ProcessEventsToIdle();
+
+CPPUNIT_ASSERT_MESSAGE("Should not be marked modified after save", 
!pDocSh->IsModified());
+
+// Complete the date in A8 by appending "/2013" and commit.
+lcl_typeCharsInCell("/2013", 0, 7, pTabViewShell, pModelObj,
+true /* bInEdit */, true /* bCommit */);
+
+// This would hang if the date entered "7/8/2013" is not acceptable.
+Scheduler::ProcessEventsToIdle();
+
+// Ensure that the correct date is recorded in the document.
+CPPUNIT_ASSERT_EQUAL(double(41463), pDoc->GetValue(ScAddress(0, 7, 0)));
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);


[Libreoffice-commits] core.git: basic/source chart2/qa comphelper/source compilerplugins/clang connectivity/source desktop/source filter/source forms/source include/comphelper include/o3tl l10ntools/i

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/sbx/sbxcurr.cxx  |   36 +---
 chart2/qa/extras/chart2dump/chart2dump.cxx|5 +
 comphelper/source/misc/string.cxx |2 
 compilerplugins/clang/stringviewparam.cxx |3 -
 connectivity/source/drivers/firebird/Util.cxx |9 +--
 connectivity/source/drivers/firebird/Util.hxx |2 
 desktop/source/app/officeipcthread.cxx|9 +--
 filter/source/msfilter/msvbahelper.cxx|   31 +-
 forms/source/xforms/xpathlib/xpathlib.cxx |7 +-
 include/comphelper/string.hxx |2 
 include/o3tl/string_view.hxx  |   66 ++
 l10ntools/inc/lngmerge.hxx|2 
 l10ntools/source/lngmerge.cxx |   12 ++--
 sw/source/filter/ww8/docxattributeoutput.cxx  |8 +-
 sw/source/filter/ww8/docxattributeoutput.hxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |5 +
 16 files changed, 138 insertions(+), 63 deletions(-)

New commits:
commit 3a88b513fd90f4793b6de7a7412fa33369542f40
Author: Noel Grandin 
AuthorDate: Thu Apr 7 10:46:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Apr 8 10:26:10 2022 +0200

loplugin:stringviewparam convert methods using trim

for which we add a new o3tl::trim method

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

diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index 416229afbc95..ad558f2284c1 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include "sbxconv.hxx"
 
 
@@ -85,7 +86,7 @@ static OUString ImpCurrencyToString( sal_Int64 rVal )
 }
 
 
-static sal_Int64 ImpStringToCurrency( const OUString &rStr )
+static sal_Int64 ImpStringToCurrency( std::u16string_view rStr )
 {
 
 sal_Int32   nFractDigit = 4;
@@ -99,50 +100,47 @@ static sal_Int64 ImpStringToCurrency( const OUString &rStr 
)
 // we should share some existing ( possibly from calc is there a currency
 // conversion there ? #TODO check )
 
-OUString sTmp( rStr.trim() );
-const sal_Unicode* p =  sTmp.getStr();
+std::u16string_view sTmp = o3tl::trim( rStr );
+auto p = sTmp.begin();
+auto pEnd = sTmp.end();
 
 // normalise string number by removing thousand & decimal point separators
-OUStringBuffer sNormalisedNumString( sTmp.getLength() +  nFractDigit );
+OUStringBuffer sNormalisedNumString( static_cast(sTmp.size()) + 
nFractDigit );
 
-if ( *p == '-'  || *p == '+' )
+if ( p != pEnd && (*p == '-'  || *p == '+' ) )
 sNormalisedNumString.append( *p++ );
 
-while ( *p >= '0' && *p <= '9' )
+while ( p != pEnd && *p >= '0' && *p <= '9' )
 {
 sNormalisedNumString.append( *p++ );
 // #TODO in vba mode set runtime error when a space ( or other )
 // illegal character is found
-if( *p == c1000Sep )
+if( p != pEnd && *p == c1000Sep )
 p++;
 }
 
 bool bRoundUp = false;
 
-if( *p == cDeciPnt )
+if( p != pEnd && *p == cDeciPnt )
 {
 p++;
-while( nFractDigit && *p >= '0' && *p <= '9' )
+while( nFractDigit && p != pEnd && *p >= '0' && *p <= '9' )
 {
 sNormalisedNumString.append( *p++ );
 nFractDigit--;
 }
 // Consume trailing content
-if ( p != nullptr )
-{
-// Round up if necessary
-if( *p >= '5' && *p <= '9' )
-bRoundUp = true;
-while( *p >= '0' && *p <= '9' )
-p++;
-}
-
+// Round up if necessary
+if( p != pEnd && *p >= '5' && *p <= '9' )
+bRoundUp = true;
+while( p != pEnd && *p >= '0' && *p <= '9' )
+p++;
 }
 // can we raise error here ? ( previous behaviour was more forgiving )
 // so... not sure that could break existing code, let's see if anyone
 // complains.
 
-if ( p != sTmp.getStr() + sTmp.getLength() )
+if ( p != pEnd )
 SbxBase::SetError( ERRCODE_BASIC_CONVERSION );
 while( nFractDigit )
 {
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx 
b/chart2/qa/extras/chart2dump/chart2dump.cxx
index bae904d4faf3..7418b80a8d5a 100644
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -16,6 +16,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -157,12 +158,12 @@ protected:
 return OUString(sTemp.data(), sTemp.length(), RTL_TEXTENCODING_UTF8);
 }
 
-void writeActual(const OUString& sActualValue, const OUString& sCheck)
+void writeActual(std::u16string_view sActualValue, const OUString& sCheck)
 {
 assert(m_bDumpMode);
 assert(m_aDumpFile.is_open

[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/unx

2022-04-08 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 303cc5c368a3fd192e7e34e3f4be1378cfb336e9
Author: Caolán McNamara 
AuthorDate: Thu Apr 7 16:46:33 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Apr 8 10:51:21 2022 +0200

Red used instead of Green

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 31935aea6102..2732ea7dd0ad 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16699,7 +16699,7 @@ private:
 void set_text_background_color(const Color& rColor)
 {
 guint16 nRed = rColor.GetRed() << 8;
-guint16 nGreen = rColor.GetRed() << 8;
+guint16 nGreen = rColor.GetGreen() << 8;
 guint16 nBlue = rColor.GetBlue() << 8;
 
 PangoAttrType aFilterAttrs[] = {PANGO_ATTR_BACKGROUND, 
PANGO_ATTR_INVALID};
@@ -16716,7 +16716,7 @@ private:
 void set_text_foreground_color(const Color& rColor, bool bSetBold)
 {
 guint16 nRed = rColor.GetRed() << 8;
-guint16 nGreen = rColor.GetRed() << 8;
+guint16 nGreen = rColor.GetGreen() << 8;
 guint16 nBlue = rColor.GetBlue() << 8;
 
 PangoAttrType aFilterAttrs[] = {PANGO_ATTR_FOREGROUND, 
PANGO_ATTR_WEIGHT, PANGO_ATTR_INVALID};


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - external/nss

2022-04-08 Thread Michael Stahl (via logerrit)
 external/nss/ExternalProject_nss.mk |4 
 1 file changed, 4 insertions(+)

New commits:
commit 2ce52702116b703345f91d7152d134b2e51e77e3
Author: Michael Stahl 
AuthorDate: Wed Apr 6 21:39:45 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 8 10:52:29 2022 +0200

nss: depend on zlib

Required on WNT since 1c748fefc3c5b42e3548a1a7f5017a579982005a, may
be needed on other platforms if using --without-system-zlib.

Change-Id: Ib8e544d81881f425d257514fc475e272ca2e53ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132648
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit b11a5d3900e3c19e94833c1b1e5218288320c3e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132608
Reviewed-by: Xisco Fauli 

diff --git a/external/nss/ExternalProject_nss.mk 
b/external/nss/ExternalProject_nss.mk
index 592ea70741b9..cc6c19bdbc35 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -15,6 +15,10 @@ $(eval $(call gb_ExternalProject_register_targets,nss,\
build \
 ))
 
+$(eval $(call gb_ExternalProject_use_externals,nss,\
+   zlib \
+))
+
 ifeq ($(OS),WNT)
 $(call gb_ExternalProject_get_state_target,nss,build): \
$(call gb_ExternalExecutable_get_dependencies,python) \


[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - external/nss

2022-04-08 Thread Michael Stahl (via logerrit)
 external/nss/ExternalProject_nss.mk |4 
 1 file changed, 4 insertions(+)

New commits:
commit 37340124d29f77683fdbe6a3e10c4d80f5d4a499
Author: Michael Stahl 
AuthorDate: Wed Apr 6 21:39:45 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Apr 8 10:54:00 2022 +0200

nss: depend on zlib

Required on WNT since 1c748fefc3c5b42e3548a1a7f5017a579982005a, may
be needed on other platforms if using --without-system-zlib.

Change-Id: Ib8e544d81881f425d257514fc475e272ca2e53ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132648
Reviewed-by: Jan-Marek Glogowski 
Tested-by: Jenkins
(cherry picked from commit b11a5d3900e3c19e94833c1b1e5218288320c3e3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132609
Reviewed-by: Caolán McNamara 

diff --git a/external/nss/ExternalProject_nss.mk 
b/external/nss/ExternalProject_nss.mk
index 5514f2dbb293..02e42b9e666d 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -15,6 +15,10 @@ $(eval $(call gb_ExternalProject_register_targets,nss,\
build \
 ))
 
+$(eval $(call gb_ExternalProject_use_externals,nss,\
+   zlib \
+))
+
 ifeq ($(OS),WNT)
 $(call gb_ExternalProject_get_state_target,nss,build): \
$(call gb_ExternalExecutable_get_dependencies,python) \


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

2022-04-08 Thread Miklos Vajna (via logerrit)
 sw/qa/core/doc/doc.cxx|   28 
 sw/source/core/doc/docfly.cxx |2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 267555f2458e6670a03013a5def67e87d6dc56cd
Author: Miklos Vajna 
AuthorDate: Thu Apr 7 16:59:32 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 8 11:12:53 2022 +0200

sw: keep URL when applying frame style on images

It seems that the intention is to reset properties which are possible to
set in a style when applying a style. For example the paragraph
alignment can be defined in a paragraph style, so reset that on style
apply.

URLs on frames can't be defined for frame styles, so it looks incorrect
to reset the URL of a frame/image on style apply, fix this.

Change-Id: Ie3a57b654cf06b9512b25d2dc103d15cd83727b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132675
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 97c18cf32a9a3088b5a51e2b0d535d8caf5daca8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132697
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index 0d39c2fbd508..43894afa03dc 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -197,6 +197,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testIMEGrouping)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle)
+{
+// Given a document with an image with a hyperlink:
+loadURL("private:factory/swriter", nullptr);
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDocument(mxComponent, uno::UNO_QUERY);
+uno::Reference xText = xDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xImage(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xImage, /*bAbsorb=*/false);
+uno::Reference xImageProps(xImage, uno::UNO_QUERY);
+OUString aExpected = "http://www.example.com";;
+xImageProps->setPropertyValue("HyperLinkURL", uno::makeAny(aExpected));
+
+// When applying a frame style on it:
+xImageProps->setPropertyValue("FrameStyleName", 
uno::makeAny(OUString("Frame")));
+
+// Then make sure that the hyperlink is not lost:
+auto aActual = getProperty(xImageProps, "HyperLinkURL");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: http://www.example.com
+// - Actual  :
+// i.e. the link was lost, even if the frame style dialog doesn't allow 
specifying a link on
+// frames.
+CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 6b73f1f756b5..db9518b2cecd 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -700,7 +700,7 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, 
SwFrameFormat& rNewForm
 rFormat.ResetFormatAttr( RES_PRINT, RES_SURROUND );
 rFormat.ResetFormatAttr( RES_LR_SPACE, RES_UL_SPACE );
 rFormat.ResetFormatAttr( RES_BACKGROUND, RES_COL );
-rFormat.ResetFormatAttr( RES_URL, RES_EDIT_IN_READONLY );
+rFormat.ResetFormatAttr( RES_EDIT_IN_READONLY );
 
 if( !bFrameSz )
 rFormat.SetFormatAttr( aFrameSz );


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

2022-04-08 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/rtfexport/data/tdf95706.rtf   |   36 ++
 sw/qa/extras/rtfexport/rtfexport4.cxx  |   61 +
 writerfilter/source/rtftok/rtfcharsets.cxx |9 +++
 writerfilter/source/rtftok/rtfcharsets.hxx |   13 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   39 +++
 5 files changed, 156 insertions(+), 2 deletions(-)

New commits:
commit d72dece2bc61e3bab8db5968d53dc0e98a3bea4d
Author: Vasily Melenchuk 
AuthorDate: Tue Apr 5 19:13:05 2022 +0300
Commit: Miklos Vajna 
CommitDate: Fri Apr 8 11:20:10 2022 +0200

tdf#95706: RTF import: Use fontname suffixes to detect encoding

Font names like "Arial CE", "Times New Roman Cyr" are not special
fonts. They are classical Arial, Times New Roman... And these
suffixes can be used to detect encoding used for RTF text.

Most interesting: for MS Word these suffixes have priority:
{\f34\cpg1253\fcharset161 Arial Baltic;} will have cp1257
and not cp1253.

Looks like compatibility issue came from dark ages.

Change-Id: Ife8e781d5d04c3f6a8c11fcf604357c74bf33055
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132584
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132681
Reviewed-by: Michael Stahl 

diff --git a/sw/qa/extras/rtfexport/data/tdf95706.rtf 
b/sw/qa/extras/rtfexport/data/tdf95706.rtf
new file mode 100644
index ..64c97930441d
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf95706.rtf
@@ -0,0 +1,36 @@
+{\rtf\ansi
+{\fonttbl
+{\f1 Arial Baltic;}
+{\f2 Arial CE;}
+{\f3 Arial Cyr;}
+{\f4 Arial Greek;}
+{\f5 Arial Tur;}
+{\f6 Arial (Hebrew);}
+{\f7 Arial (Arabic);}
+{\f8 Arial (Vietnamese);}
+{\f9 Arial BlaBlaBla;}
+
+{\f10\cpg1253\fcharset161 Arial;}
+{\f11\fcharset161 Arial;}
+{\f12\cpg1253 Arial;}
+{\f13\cpg1253\fcharset161 Arial Baltic;}
+{\f14 Arial Baltic;\cpg1253\fcharset161}
+
+}
+\pard Font name suffixes:\par
+\pard\f1\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f2\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f3\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f4\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f5\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f6\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f7\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f8\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f9\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard Font entry charset values:\par
+\pard\f10\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f11\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f12\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f13\fs26 \'c0\'c1\'c2\'c3\'c4\par
+\pard\f14\fs26 \'c0\'c1\'c2\'c3\'c4\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx 
b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 32f1a5f88cad..1f1434054085 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -461,6 +461,67 @@ CPPUNIT_TEST_FIXTURE(Test, testGutterTop)
 CPPUNIT_ASSERT(bGutterAtTop);
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf95706, "tdf95706.rtf")
+{
+uno::Reference xRun2
+= getRun(getParagraph(2), 1, u"\u0104\u012e\u0100\u0106\u00c4");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun2, 
"CharFontName"));
+
+uno::Reference xRun3
+= getRun(getParagraph(3), 1, u"\u0154\u00c1\u00c2\u0102\u00c4");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun3, 
"CharFontName"));
+
+uno::Reference xRun4
+= getRun(getParagraph(4), 1, u"\u0410\u0411\u0412\u0413\u0414");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun4, 
"CharFontName"));
+
+uno::Reference xRun5
+= getRun(getParagraph(5), 1, u"\u0390\u0391\u0392\u0393\u0394");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun5, 
"CharFontName"));
+
+uno::Reference xRun6
+= getRun(getParagraph(6), 1, u"\u00c0\u00c1\u00c2\u00c3\u00c4");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun6, 
"CharFontName"));
+
+uno::Reference xRun7
+= getRun(getParagraph(7), 1, u"\u05b0\u05b1\u05b2\u05b3\u05b4");
+// Do not check font for Hebrew: it can be substituted by smth able to 
handle these chars
+//CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun7, 
"CharFontName"));
+
+uno::Reference xRun8
+= getRun(getParagraph(8), 1, u"\u06c1\u0621\u0622\u0623\u0624");
+// Do not check font for Arabic: it can be substituted by smth able to 
handle these chars
+//CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun8, 
"CharFontName"));
+
+uno::Reference xRun9
+= getRun(getParagraph(9), 1, u"\u00c0\u00c1\u00c2\u0102\u00c4");
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun9, 
"CharFontName"));
+
+// Ensure strange font remains strange. No reason to check content: in 
this case it can vary on locale
+uno::Reference xRun10 = getRun(getParagraph(10), 1);
+CPPUNIT_ASSERT_EQUAL(OUString("Arial BlaBlaBla"),
+ getProperty(xRun10, "CharFontName"));
+
+uno

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

2022-04-08 Thread Vasily Melenchuk (via logerrit)
 sw/qa/extras/rtfexport/data/tdf95706_2.rtf  |   17 ++
 sw/qa/extras/rtfexport/rtfexport4.cxx   |   12 +
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |4 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |  162 +---
 writerfilter/source/rtftok/rtfdocumentimpl.hxx  |1 
 5 files changed, 122 insertions(+), 74 deletions(-)

New commits:
commit 844be7358f1eec00094a55fa1fb4fadadb8cd1bf
Author: Vasily Melenchuk 
AuthorDate: Thu Apr 7 20:59:08 2022 +0300
Commit: Miklos Vajna 
CommitDate: Fri Apr 8 11:22:54 2022 +0200

tdf#95706: RTF import: tolerant font table parsing

While font name in font table should end with semicolon
({\fonttbl{\f42 Arial;}}) it is not always true and
MS Word is tolerant to it: it still able to parse this
correctly. Seems LO also should not require strict spec
conformance.

So idea of font parsing is changed: instead of inserting
font on semicolon, it is done on next \fN or destination
end. All collected text to this moment is a font name.

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

diff --git a/sw/qa/extras/rtfexport/data/tdf95706_2.rtf 
b/sw/qa/extras/rtfexport/data/tdf95706_2.rtf
new file mode 100644
index ..d36d2ccd2396
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf95706_2.rtf
@@ -0,0 +1,17 @@
+{\rtf\ansi
+{\fonttbl
+{\f1 Arial}
+\f2 Impact
+\f3 T\'69mes New Roman
+\f4 T
+a
+h
+o
+m
+a
+}
+\pard\f1\fs26 Arial\par
+\pard\f2\fs26 Impact\par
+\pard\f3\fs26 Times New Roman\par
+\pard\f4\fs26 Tahoma\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx 
b/sw/qa/extras/rtfexport/rtfexport4.cxx
index 2d036538d6fe..c2af71a93f63 100644
--- a/sw/qa/extras/rtfexport/rtfexport4.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport4.cxx
@@ -553,6 +553,18 @@ DECLARE_RTFEXPORT_TEST(testTdf95706, "tdf95706.rtf")
 CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun16, 
"CharFontName"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf95706_2, "tdf95706_2.rtf")
+{
+CPPUNIT_ASSERT_EQUAL(OUString("Arial"),
+ getProperty(getRun(getParagraph(1), 1), 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Impact"),
+ getProperty(getRun(getParagraph(2), 1), 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Times New Roman"),
+ getProperty(getRun(getParagraph(3), 1), 
"CharFontName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Tahoma"),
+ getProperty(getRun(getParagraph(4), 1), 
"CharFontName"));
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf111851, "tdf111851.rtf")
 {
 uno::Reference xTable(getParagraphOrTable(1), 
uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index b3c04bb0f1f1..ca092fb66a37 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -762,6 +762,10 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
 if (m_aStates.top().getDestination() == Destination::FONTTABLE
 || m_aStates.top().getDestination() == Destination::FONTENTRY)
 {
+// Some text in buffer? It is font name. So previous font 
definition is complete
+if (m_aStates.top().getCurrentDestinationText()->getLength())
+handleFontTableEntry();
+
 m_aFontIndexes.push_back(nParam);
 m_nCurrentFontIndex = getFontIndex(nParam);
 }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5a19ccebb20a..47349ac8aaba 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1332,6 +1332,74 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool 
bRunProps)
 }
 }
 
+void RTFDocumentImpl::handleFontTableEntry()
+{
+OUString aName = 
m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
+
+if (aName.isEmpty())
+return;
+
+if (aName.endsWith(";"))
+{
+aName = aName.copy(0, aName.getLength() - 1);
+}
+
+// Old documents can contain no encoding information in fontinfo,
+// but there can be font name suffixes: Arial CE is not a special
+// font, it is ordinal Arial, but with used cp 1250 encoding.
+// Moreover these suffixes have priority over \cpgN and \fcharsetN
+// in MS Word.
+OUString aFontSuffix;
+OUString aNameNoSuffix(aName);
+sal_Int32 nLastSpace = aName.lastIndexOf(' ');
+if (nLastSpace >= 0)
+{
+aFontSuffix = aName.copy(nLastSpace + 1);
+aNameNoSuffix = aName.copy(0, nLastSpace);
+sal_Int32 nEncoding = RTL_TEXTENCODING_DONTKNOW;
+for (int i = 0; aRTFFontNameSuffixes[i].codepage != 

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

2022-04-08 Thread László Németh (via logerrit)
 sw/qa/uitest/writer_tests/trackedChanges.py |   29 
 sw/source/uibase/misc/redlndlg.cxx  |   27 ++
 2 files changed, 56 insertions(+)

New commits:
commit a21ef822f9769ded6ff834dbfa347cf0e5f913fd
Author: László Németh 
AuthorDate: Thu Apr 7 17:58:06 2022 +0200
Commit: László Németh 
CommitDate: Fri Apr 8 12:00:10 2022 +0200

tdf#147179 sw: select tracked row change in Manage Changes

In Manage Changes dialog window, selecting items
of list of changes results selection of the associated
text changes in the main text, as a visual feedback.
From commit eebe4747d2d13545004937bb0267ccfc8ab9d63f,
text changes of deleted/inserted rows or tables are
listed under a single "tracked row" list item, as its
children. Selecting a "tracked row" list item in
Manage Changes resulted incomplete text selection in
the main text: only the first text change in the first
cell was selected instead of all associated text changes
of tracked row(s) or table.

Note: Manage Changes supports multiple selections,
i.e. it's possible to select multiple list items by
Ctrl + click, and select ranges by Shift + click.
This commit does the same with redlines of tracked
row changes.

Follow-up to commit eebe4747d2d13545004937bb0267ccfc8ab9d63f
"tdf#144270 sw: manage tracked table (row) deletion/insertion".

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

diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py 
b/sw/qa/uitest/writer_tests/trackedChanges.py
index c04034e7149b..0d13ddcdff8d 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -353,4 +353,33 @@ class trackedchanges(UITestCase):
 # This was False (missing comment)
 self.assertEqual(True, 
get_state_as_dict(xChild)["Text"].endswith('\tComment added'))
 
+def test_tdf147179(self):
+with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
document:
+xWriterDoc = self.xUITest.getTopFocusWindow()
+xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+tables = document.getTextTables()
+self.assertEqual(3, len(tables))
+
+# Select text of the tracked row, not only text of its first cell
+with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
+changesList = xTrackDlg.getChild("writerchanges")
+
+# select second tracked table row in tree list
+changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DOWN"}))
+xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+while get_state_as_dict(xWriterEdit)["SelectedText"] != 'klj':
+xToolkit.processEventsToIdle()
+
+# this was "j" (only text of the first cell was selected, not 
text of the row)
+
self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "klj" )
+
+# select first tracked table row in tree list
+changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
+while get_state_as_dict(xWriterEdit)["SelectedText"] != 'bca':
+xToolkit.processEventsToIdle()
+
+# this was "a" (only text of the first cell was selected, not 
text of the row)
+
self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "bca" )
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/source/uibase/misc/redlndlg.cxx 
b/sw/source/uibase/misc/redlndlg.cxx
index 7bed942acbf5..dd5feeacc747 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -1123,6 +1123,33 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, 
void)
 pSh->EnterAddMode();
 }
 }
+
+// select all redlines of tracked table rows
+std::unique_ptr 
xChild(rTreeView.make_iterator( &*xActEntry ));
+if ( rTreeView.iter_children(*xChild) )
+{
+RedlinData *pData = 
reinterpret_cast(rTreeView.get_id(*xChild).toInt64());
+// disabled for redline stack, but not for redlines of 
table rows
+if ( !pData->bDisabled )
+{
+do
+{
+nPos = GetRedlinePos(*xChild);
+if (nPos != SwRedlineTable::npos)
+{
+const SwRangeRedline& rRedln = 
pSh->GetRedline( nPos );
+

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

2022-04-08 Thread Tomaž Vajngerl (via logerrit)
 sc/source/ui/inc/gridwin.hxx  |3 +
 sc/source/ui/view/gridwin.cxx |   67 ++
 2 files changed, 70 insertions(+)

New commits:
commit 34a97838137f6e54405722d607b7f414084f526e
Author: Tomaž Vajngerl 
AuthorDate: Fri Apr 8 13:12:50 2022 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Apr 8 12:29:01 2022 +0200

sc: add an overlay to show sparklines in a sparkline group

This adds an overlay that shows/selects all sparklines in a
sparkline group for the cursor cell sparkline, if the cursor cell
has an associated sparkline.

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

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index b4117736484e..93d7abd095a3 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -106,6 +106,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, 
public DropTargetHel
 std::unique_ptr mpOODragRect;
 std::unique_ptr mpOOHeader;
 std::unique_ptr mpOOShrink;
+std::unique_ptr mpOOSparklineGroup;
 
 std::optional mpAutoFillRect;
 
@@ -462,6 +463,8 @@ public:
 const std::vector* GetAutoSpellData( SCCOL nPosX, 
SCROW nPosY );
 bool InsideVisibleRange( SCCOL nPosX, SCROW nPosY );
 
+void UpdateSparklineGroupOverlay();
+void DeleteSparklineGroupOverlay();
 voidDeleteCopySourceOverlay();
 voidUpdateCopySourceOverlay();
 voidDeleteCursorOverlay();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 6ce6a6d6c421..516c9ef16d50 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -128,6 +128,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -6034,6 +6035,7 @@ void ScGridWindow::CursorChanged()
 // now, just re-create them
 
 UpdateCursorOverlay();
+UpdateSparklineGroupOverlay();
 }
 
 void ScGridWindow::ImpCreateOverlayObjects()
@@ -6045,6 +6047,7 @@ void ScGridWindow::ImpCreateOverlayObjects()
 UpdateDragRectOverlay();
 UpdateHeaderOverlay();
 UpdateShrinkOverlay();
+UpdateSparklineGroupOverlay();
 }
 
 void ScGridWindow::ImpDestroyOverlayObjects()
@@ -6056,6 +6059,7 @@ void ScGridWindow::ImpDestroyOverlayObjects()
 DeleteDragRectOverlay();
 DeleteHeaderOverlay();
 DeleteShrinkOverlay();
+DeleteSparklineGroupOverlay();
 }
 
 void ScGridWindow::UpdateAllOverlays()
@@ -6973,6 +6977,69 @@ void ScGridWindow::UpdateShrinkOverlay()
 SetMapMode( aOldMode );
 }
 
+void ScGridWindow::DeleteSparklineGroupOverlay()
+{
+mpOOSparklineGroup.reset();
+}
+
+void ScGridWindow::UpdateSparklineGroupOverlay()
+{
+MapMode aDrawMode = GetDrawMapMode();
+
+MapMode aOldMode = GetMapMode();
+if (aOldMode != aDrawMode)
+SetMapMode(aDrawMode);
+
+DeleteSparklineGroupOverlay();
+
+ScAddress aCurrentAddress = mrViewData.GetCurPos();
+
+ScDocument& rDocument = mrViewData.GetDocument();
+if (auto pSparkline = rDocument.GetSparkline(aCurrentAddress))
+{
+mpOOSparklineGroup.reset(new sdr::overlay::OverlayObjectList);
+
+rtl::Reference xOverlayManager = 
getOverlayManager();
+if (xOverlayManager.is())
+{
+auto* pList = rDocument.GetSparklineList(aCurrentAddress.Tab());
+if (pList)
+{
+auto const& pSparklines = 
pList->getSparklinesFor(pSparkline->getSparklineGroup());
+
+Color aColor = SvtOptionsDrawinglayer::getHilightColor();
+
+std::vector aRanges;
+const basegfx::B2DHomMatrix 
aTransform(GetOutDev()->GetInverseViewTransformation());
+
+for (auto const& pCurrentSparkline : pSparklines)
+{
+SCCOL nColumn = pCurrentSparkline->getColumn();
+SCROW nRow = pCurrentSparkline->getRow();
+
+Point aStart = mrViewData.GetScrPos(nColumn, nRow, eWhich);
+Point aEnd = mrViewData.GetScrPos(nColumn + 1, nRow + 1, 
eWhich);
+
+basegfx::B2DRange aRange(aStart.X(), aStart.Y(), aEnd.X(), 
aEnd.Y());
+
+aRange.transform(aTransform);
+aRanges.push_back(aRange);
+}
+
+std::unique_ptr pOverlay(new 
sdr::overlay::OverlaySelection(
+sdr::overlay::OverlayType::Transparent,
+aColor, std::move(aRanges), true));
+
+xOverlayManager->add(*pOverlay);
+mpOOSparklineGroup->append(std::move(pOverlay));
+}
+}
+}
+
+if (aOldMode != aDrawMode)
+SetMapMode(aOldMode);
+}
+
 // #i70788# central method to get the OverlayManager safely
 rtl::Reference ScGridWindow::getOverlayManager() 
const
 {


[Libreoffice-commits] core.git: Branch 'feature/cib_contract891c' - 27 commits - configure.ac download.lst external/curl external/expat external/graphite external/jpeg-turbo external/libwpd external/n

2022-04-08 Thread Gabor Kelemen (via logerrit)
 RepositoryExternal.mk|2 
 configure.ac |6 
 download.lst |   34 
 external/curl/ExternalPackage_curl.mk|4 
 external/curl/ExternalProject_curl.mk|8 
 external/curl/clang-cl.patch.0   |4 
 external/curl/curl-7.26.0_win-proxy.patch|2 
 external/curl/curl-msvc-disable-protocols.patch.1|7 
 external/curl/curl-msvc.patch.1  |8 
 external/curl/zlib.patch.0   |   14 
 external/expat/expat-winapi.patch|   15 
 external/graphite/StaticLibrary_graphite.mk  |4 
 external/graphite/UnpackedTarball_graphite.mk|8 
 external/graphite/graphite2.issue1115.patch.1|   22 
 external/graphite/graphite2.win64.patch.1|   60 -
 external/graphite/ubsan.patch|   40 -
 external/jpeg-turbo/UnpackedTarball_jpeg-turbo.mk|5 
 external/jpeg-turbo/c76f4a08263b0cea40d2967560ac7c21f6959079.patch.1 |   38 +
 external/libwpd/ExternalProject_libwpd.mk|6 
 external/libwpd/Library_wpd.mk   |3 
 external/libwpd/UnpackedTarball_libwpd.mk|2 
 external/libwpd/include.patch|   10 
 external/libwpd/libwpd-bundled-soname.patch.0|3 
 external/libwpd/libwpd-tdf112269.patch.1 |   42 -
 external/nss/ExternalProject_nss.mk  |4 
 external/openssl/UnpackedTarball_openssl.mk  |1 
 external/openssl/ccb0a11145ee72b042d10593a64eaf9e8a55ec12.patch.1|   56 +
 lotuswordpro/source/filter/lwpdrawobj.cxx|   81 --
 sc/source/filter/lotus/op.cxx|   11 
 shell/source/win32/SysShExec.cxx |2 
 solenv/flatpak-manifest.in   |6 
 sw/qa/extras/layout/data/LIBREOFFICE-N4LA0OHZ.rtf|  347 
++
 sw/qa/extras/layout/layout.cxx   |5 
 sw/qa/extras/ooxmlexport/ooxmlexport8.cxx|9 
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|4 
 sw/source/core/layout/tabfrm.cxx |1 
 sw/source/filter/ww8/wrtw8sty.cxx|   28 
 sw/source/filter/ww8/wrtww8.hxx  |4 
 vcl/source/fontsubset/sft.cxx|2 
 vcl/source/gdi/svmconverter.cxx  |   20 
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |2 
 xmlsecurity/qa/unit/signing/signing.cxx  |7 
 42 files changed, 609 insertions(+), 328 deletions(-)

New commits:
commit 3f4fc4e5a178b35ce2e3913969222454efd8f986
Author: Gabor Kelemen 
AuthorDate: Fri Apr 8 12:37:52 2022 +0200
Commit: Gabor Kelemen 
CommitDate: Fri Apr 8 12:37:52 2022 +0200

Disable some failing unit tests

Change-Id: I560ab753ec61ecf3b0ae90bd70c125037185fea1

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
index 07d33865f7e7..b5cf06e9f8e7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -1990,10 +1990,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90810, 
"tdf90810short.docx")
 rtl::OUString sFootnoteText = xFootnoteText->getString();
 // Original document doesn't have a leading tab in the footnote, but the
 // export adds one unconditionally.
-if (mbExported)
-CPPUNIT_ASSERT_EQUAL(static_cast(91), 
sFootnoteText.getLength());
-else
-CPPUNIT_ASSERT_EQUAL(static_cast(90), 
sFootnoteText.getLength());
+// FIXME this unit test fails for some reason
+//if (mbExported)
+//CPPUNIT_ASSERT_EQUAL(static_cast(91), 
sFootnoteText.getLength());
+//else
+//CPPUNIT_ASSERT_EQUAL(static_cast(90), 
sFootnoteText.getLength());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf89165, "tdf89165.docx")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index d4443761dd90..8afc19078369 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -471,8 +471,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf99227, "tdf99227.docx")
 xmlDocPtr pXmlDoc = parseExport("word/foot

[Libreoffice-commits] core.git: 2 commits - configure.ac filter/source

2022-04-08 Thread Stephan Bergmann (via logerrit)
 configure.ac   |2 +-
 filter/source/msfilter/msvbahelper.cxx |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 9ea17a6331ca9491e7012dca837d3815cd4309ac
Author: Stephan Bergmann 
AuthorDate: Fri Apr 8 09:15:19 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 8 12:46:41 2022 +0200

Adapt to latest VS 2022 MSM versions

...as present at least with VS 2022 17.1.3

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

diff --git a/configure.ac b/configure.ac
index 1cdd22b0ae66..a19f73031124 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6650,7 +6650,7 @@ find_msms()
 
 case "$VCVER" in
 16.0 | 17.0)
-my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm 
${my_msm_files}"
+my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm 
Microsoft_VC143_CRT_x86.msm ${my_msm_files}"
 ;;
 esac
 for f in $my_msm_files; do
commit f9a094cc0c2f61fd0838a42489b717ede3e24fed
Author: Andrea Gelmini 
AuthorDate: Fri Apr 8 11:14:37 2022 +0200
Commit: Andrea Gelmini 
CommitDate: Fri Apr 8 12:46:28 2022 +0200

Removed duplicated include

Change-Id: I898c24abd5366a85705b5f54258b16b22e044355
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132715
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini 

diff --git a/filter/source/msfilter/msvbahelper.cxx 
b/filter/source/msfilter/msvbahelper.cxx
index 89c5292a3cb3..5ba35cec81a5 100644
--- a/filter/source/msfilter/msvbahelper.cxx
+++ b/filter/source/msfilter/msvbahelper.cxx
@@ -39,7 +39,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: 2 commits - configure.ac include/xmloff schema/libreoffice xmloff/qa xmloff/source

2022-04-08 Thread Miklos Vajna (via logerrit)
 configure.ac|   61 
 include/xmloff/txtparae.hxx |4 
 include/xmloff/xmltoken.hxx |3 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |   15 ++
 xmloff/qa/unit/text.cxx |   36 +++
 xmloff/source/core/xmltoken.cxx |3 
 xmloff/source/text/txtparae.cxx |   41 
 xmloff/source/token/tokens.txt  |2 
 8 files changed, 104 insertions(+), 61 deletions(-)

New commits:
commit cf5bbe3fce4a250ab25998053965bdc604c6114e
Author: Miklos Vajna 
AuthorDate: Fri Apr 8 11:32:22 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 8 12:51:09 2022 +0200

sw content controls: add ODT export

Wrap the text portions inside the content control in a
 XML element. Also map the (so far) single UNO
property of it to .

This is just initial export for inline text content controls, more
properties are to be added in follow-up commits.

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

diff --git a/include/xmloff/txtparae.hxx b/include/xmloff/txtparae.hxx
index 70716c1f77a2..546bf2adca3c 100644
--- a/include/xmloff/txtparae.hxx
+++ b/include/xmloff/txtparae.hxx
@@ -368,6 +368,10 @@ protected:
 const css::uno::Reference< css::beans::XPropertySet> & i_xPortion,
 bool i_bAutoStyles, bool i_isProgress, bool & rPrevCharIsSpace);
 
+/// Exports a  element.
+void ExportContentControl(const 
css::uno::Reference& xPortion,
+  bool bAutoStyles, bool isProgress, bool& 
rPrevCharIsSpace);
+
 bool isAutoStylesCollected() const { return mbCollected; }
 
 virtual void exportTableAutoStyles();
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 86cc93f9a3a2..cdfb259f59ce 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3487,6 +3487,9 @@ namespace xmloff::token {
 XML_COLOR_LUM_MOD,
 XML_COLOR_LUM_OFF,
 
+XML_CONTENT_CONTROL,
+XML_SHOWING_PLACE_HOLDER,
+
 XML_TOKEN_END
 };
 
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index ccbc6e4336e8..68ac5c155d6a 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -2803,6 +2803,21 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
 
   
 
+  
+  
+
+  
+
+
+
+
+  
+  
+
+  
+
+  
+
   
   
 
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 3b067120eb7b..a7765e214066 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -383,6 +383,42 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testRelativeWidth)
 assertXPath(pXmlDoc, "//draw:frame", "width", "3.1492in");
 }
 
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testContentControlExport)
+{
+// Given a document with a content control around one or more text 
portions:
+getComponent() = loadFromDesktop("private:factory/swriter");
+uno::Reference xMSF(getComponent(), 
uno::UNO_QUERY);
+uno::Reference xTextDocument(getComponent(), 
uno::UNO_QUERY);
+uno::Reference xText = xTextDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+xText->insertString(xCursor, "test", /*bAbsorb=*/false);
+xCursor->gotoStart(/*bExpand=*/false);
+xCursor->gotoEnd(/*bExpand=*/true);
+uno::Reference xContentControl(
+xMSF->createInstance("com.sun.star.text.ContentControl"), 
uno::UNO_QUERY);
+uno::Reference xContentControlProps(xContentControl, 
uno::UNO_QUERY);
+xContentControlProps->setPropertyValue("ShowingPlaceHolder", 
uno::makeAny(true));
+xText->insertTextContent(xCursor, xContentControl, /*bAbsorb=*/true);
+
+// When exporting to ODT:
+uno::Reference xStorable(getComponent(), uno::UNO_QUERY);
+uno::Sequence aStoreProps = 
comphelper::InitPropertySequence({
+{ "FilterName", uno::makeAny(OUString("writer8")) },
+});
+utl::TempFile aTempFile;
+aTempFile.EnableKillingFile();
+xStorable->storeToURL(aTempFile.GetURL(), aStoreProps);
+validate(aTempFile.GetFileName(), test::ODF);
+
+// Then make sure the expected markup is used:
+std::unique_ptr pStream = parseExportStream(aTempFile, 
"content.xml");
+xmlDocUniquePtr pXmlDoc = parseXmlStream(pStream.get());
+// Without the accompanying fix in place, this failed with:
+// - XPath '//loext:content-control' number of nodes is incorrect
+// i.e. the content control was lost on export.
+assertX

[Libreoffice-commits] core.git: basic/source chart2/source connectivity/source editeng/source filter/source framework/source oox/source sc/source sd/source sfx2/source svl/source svx/source sw/source

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx|2 -
 basic/source/runtime/dllmgr-x86.cxx|2 -
 chart2/source/tools/InternalDataProvider.cxx   |   15 
 chart2/source/tools/PropertyHelper.cxx |3 +
 chart2/source/tools/XMLRangeHelper.cxx |3 +
 connectivity/source/drivers/dbase/DTable.cxx   |6 +--
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |4 +-
 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx |5 +-
 editeng/source/misc/svxacorr.cxx   |3 +
 filter/source/msfilter/util.cxx|3 +
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx   |3 +
 framework/source/fwe/helper/actiontriggerhelper.cxx|3 +
 oox/source/docprop/docprophandler.cxx  |   17 
+-
 oox/source/drawingml/customshapepresetdata.cxx |5 +-
 oox/source/drawingml/customshapeproperties.cxx |3 +
 oox/source/drawingml/hyperlinkcontext.cxx  |3 +
 oox/source/helper/attributelist.cxx|   13 ---
 oox/source/ole/axcontrol.cxx   |5 +-
 oox/source/ppt/pptshape.cxx|5 +-
 oox/source/ppt/presentationfragmenthandler.cxx |7 ++--
 oox/source/vml/vmldrawing.cxx  |3 +
 oox/source/vml/vmlformatting.cxx   |7 ++--
 oox/source/vml/vmlshape.cxx|7 ++--
 oox/source/vml/vmlshapecontext.cxx |3 +
 sc/source/core/data/global2.cxx|7 ++--
 sc/source/core/data/table4.cxx |4 +-
 sc/source/filter/oox/formulaparser.cxx |5 +-
 sc/source/filter/oox/pagesettings.cxx  |5 +-
 sc/source/filter/oox/sheetdatacontext.cxx  |5 +-
 sc/source/ui/docshell/impex.cxx|   11 +++---
 sc/source/ui/miscdlgs/acredlin.cxx |3 +
 sd/source/filter/xml/sdxmlwrp.cxx  |5 +-
 sd/source/ui/presenter/PresenterTextView.cxx   |5 +-
 sfx2/source/appl/appopen.cxx   |3 +
 sfx2/source/appl/childwin.cxx  |6 +--
 sfx2/source/bastyp/mieclip.cxx |9 ++---
 sfx2/source/doc/docfile.cxx|3 +
 sfx2/source/doc/sfxbasemodel.cxx   |3 +
 svl/source/numbers/zformat.cxx |2 -
 svx/source/xoutdev/xattr.cxx   |3 +
 sw/source/core/doc/doclay.cxx  |   10 +++--
 sw/source/core/doc/docnum.cxx  |2 -
 sw/source/core/doc/doctxm.cxx  |3 +
 sw/source/core/docnode/ndsect.cxx  |3 +
 sw/source/core/fields/cellfml.cxx  |2 -
 sw/source/core/unocore/XMLRangeHelper.cxx  |4 +-
 sw/source/core/unocore/unotbl.cxx  |2 -
 sw/source/filter/html/htmlatr.cxx  |   11 +++---
 sw/source/filter/html/wrthtml.hxx  |2 -
 sw/source/filter/ww8/wrtww8gr.cxx  |3 +
 sw/source/ui/vba/vbaparagraphformat.cxx|3 +
 sw/source/uibase/app/docsh2.cxx|3 +
 sw/source/uibase/fldui/fldmgr.cxx  |4 +-
 sw/source/uibase/misc/redlndlg.cxx |3 +
 sw/source/uibase/uiview/view2.cxx  |5 +-
 ucbhelper/source/client/proxydecider.cxx   |5 +-
 unotools/source/config/dynamicmenuoptions.cxx  |8 ++--
 vbahelper/source/vbahelper/vbalineformat.cxx   |2 -
 vcl/inc/ppdparser.hxx  |2 -
 vcl/source/control/field2.cxx  |8 ++--
 vcl/source/pdf/PDFiumLibrary.cxx   |   13 ---
 vcl/unx/generic/printer/jobdata.cxx|   11 +++---
 vcl/unx/generic/printer/ppdparser.cxx  |   17 
--
 writerfilter/source/dmapper/ConversionHelper.cxx   |5 +-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |7 ++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +--
 xmloff/source/chart/SchXMLChartContext.cxx |5 +-
 x

Redirecting conversation regarding GSoC Project to Mailing List

2022-04-08 Thread Sarrah Bastawala
Hello All,

Continuing here the conversation with Eike Rathke as instructed by him in
the previous email :

> However, I'd like to keep further dev-related and specifically GSoC
> discussion on our mailing list libreoffice@lists.freedesktop.org and
> continue things there, so everyone can benefit.
>
> That being said, do you already have ideas what would be required for
> a solution?

Thank you for replying to me! I would definitely be glad to solve an
interesting problem with your mentorship.

Based on what I have understood so far, here is the functionality we are
looking to implement in Table Styles


   -

   We want to visually make it similar to the tables currently present in
   autoformat, however it should be able to apply the same attribute to
   multiple cells changing as more data is entered
   -

   The functionality for this could be referred to from the present table
   styles in Impress and the functionality for sorting, filters, etc from
   existing code for pivot tables in calc, if I’m not wrong. ( I would
   appreciate if you could give me the code pointers for these to refer
   directly)
   -

   Also, as the bug [#132780](
   https://bugs.documentfoundation.org/show_bug.cgi?id=132780) talks about
   in detail, it also includes that the functionality is present identically
   in openoffice with a GPL3 license, so I do not know exactly how that can be
   used and how it would fall within the scope of this project, and hence
   would appreciate pointers from you.
   -

   I’m not extremely well versed in this, but I assume apart from the
   hindrance to user of formatting added data manually in Autoformat styles,
   the main difference of table styles to that would be that instead of
   applying the attributes cell by cell, they would be applied directly to the
   entire table. I believe this would require some concepts of Object-Oriented
   programming to increase the efficiency, and I think I could understand
   better from how it is already implemented in Impress.
   -

   Lastly, I see that suggestions include asking users to use pivot tables
   for functionalities such as creating charts from tables etc., so if we do
   implement table styles, I assume we would merge it with pivot tables.
   Please feel free to correct me if I’m wrong anywhere and guide me on how to
   proceed further with this project and what resources would I need to study?


Sincerely,
Sarrah


"forcepoint" ?

2022-04-08 Thread Regina Henschel

Hi all,

There are a lot of commits with "forcepoint" in subject. Is there 
somewhere a description about that "forcepoint" work?


Kind regards,
Regina


[Libreoffice-commits] core.git: Branch 'feature/cib_contract6721c' - sw/qa sw/source

2022-04-08 Thread Michael Stahl (via logerrit)
 sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt |  270 
++
 sw/qa/extras/uiwriter/uiwriter3.cxx   |   73 ++
 sw/source/core/doc/DocumentFieldsManager.cxx  |   25 
 sw/source/core/doc/docfld.cxx |   41 +
 sw/source/core/docnode/node2lay.cxx   |   77 ++
 sw/source/core/fields/expfld.cxx  |3 
 sw/source/core/inc/docfld.hxx |8 
 sw/source/core/inc/node2lay.hxx   |6 
 8 files changed, 472 insertions(+), 31 deletions(-)

New commits:
commit cc6df526939516986b465f63847ceeec9f49ee8e
Author: Michael Stahl 
AuthorDate: Tue Apr 5 18:27:35 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 8 14:31:34 2022 +0200

sw: fix expansion of SetGetExpField in headers with split table rows

The problem is that a get field in a header on page N may calculate and
show values that do not take into account a set field on page N-1.

This happens if a table row with multiple columns is split across the
pages: SwGetExpField::ChangeExpansion() calls GetBodyTextNode(), which
returns the first node in the first column that is on page N, but in the
SwNodes array this node is *before* any node in columns 2..M, any of
which may be on page N-1 in the layout.

So try to fix this by adding a page number to SetGetExpField and using
that as the highest priority in operator<().

This is a bit risky because some of the places that create
SetGetExpField don't have a frame to get the page number from; try to
adapt all that call into MakeFieldList(), while leaving unrelated ones
such as in MakeSetList() unchanged.

Change-Id: Ied2a897ad34f0faf1ef3d50baad07b23fafd49bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132641
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 9dc6e2c9062725ef1f9d7e321cae5f4dbe8ca749)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132645
Reviewed-by: Thorsten Behrens 
(cherry picked from commit 855e2af1bf6eb216d63ca7baeb9161c7cd501a42)

diff --git 
a/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt 
b/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt
new file mode 100644
index ..9d3668b6b2ee
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/variable-field-table-row-split-header.fodt
@@ -0,0 +1,270 @@
+
+http://openoffice.org/2009/office"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:rpt="http://openoffice.org/2005/report"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns
 :config:1.0" xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="ur
 n:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms"; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.text">
+ 
2022-04-06T17:07:05.9473620632022-04-06T17:17:45.832216066PT10M42S2LibreOfficeDev/7.4.0.0.alpha0$Linux_X86_64
 
LibreOffice_project/a5b31508f860f07ec86cda3cf992fcea2bee68ef
+ 
+  
+  
+  
+ 
+ 
+  

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/inc

2022-04-08 Thread Justin Luth (via logerrit)
 sw/inc/docufld.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2e6acddd815bca6261634b69b015c6deead74b58
Author: Justin Luth 
AuthorDate: Wed Apr 6 09:28:49 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 8 15:22:05 2022 +0200

tdf#147861 sw ms export: DI_SUB_MASK must exclude FIXED now

This is a follow-up to
7.4 commit daef39352b008fc1f903fd8c09288ff5e772fa42

There is only one place in which DI_SUB_MASK is used,
so I'm just changing it to what it could have always been,
since it never was actually used to mask out DI_SUB_FIXED.
Otherwise, I might have made this a MASK2 or whatever.

The issue here is that AUTHOR was not being recognized
when it was paired with FIXED, so every FIXEDFLD was
ended up being considered as a date/time.

In practice, this didn't really change anything
because bWriteExpand already ignored any of
these areas of the code. It is only when I turn off
bWriteExpand as I implement fixes that I am seeing
the wrong field type being created.

And regardless, since the field is FIXED, the visible
content remains the same anyway (until someone in MS Word
refreshes the field with F9).

Both Author and date have the same field name ":Created"
so I couldn't super easily test this.

Change-Id: Icd2d0be2d3fbe24dc4763e0e25801569bcca471b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132660
Tested-by: Jenkins
Reviewed-by: Justin Luth 
Reviewed-by: Miklos Vajna 
(cherry picked from commit e61eed211766f26a3896c1d912dc7349abbe823d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132698
Tested-by: Jenkins CollaboraOffice 

diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 9cad6b71f77c..f1023e372970 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -84,7 +84,7 @@ namespace nsSwDocInfoSubType
 const SwDocInfoSubType DI_SUB_TIME  = 0x0200;
 const SwDocInfoSubType DI_SUB_DATE  = 0x0300;
 const SwDocInfoSubType DI_SUB_FIXED = 0x1000;
-const SwDocInfoSubType DI_SUB_MASK  = 0xff00;
+const SwDocInfoSubType DI_SUB_MASK  = 0x0f00;
 }
 
 enum SwPageNumSubType


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

2022-04-08 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |  352 
 1 file changed, 161 insertions(+), 191 deletions(-)

New commits:
commit ddaab61002a5d9a6d150b53bb354112ee7f0b715
Author: Xisco Fauli 
AuthorDate: Thu Apr 7 16:18:17 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 8 15:23:07 2022 +0200

sw_uiwriter6: use keyevents to simulate the autocorrect

This way, the tests mimic what users do while typing

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

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 68c67d31f67f..a8f27234a361 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -61,6 +62,16 @@ sal_Int32 lcl_getAttributeIDFromHints(const SwpHints& hints)
 }
 return -1;
 }
+
+void emulateTyping(SwXTextDocument& rXTextDocument, const std::u16string_view& 
rStr)
+{
+for (const char16_t c : rStr)
+{
+rXTextDocument.postKeyEvent(LOK_KEYEVENT_KEYINPUT, c, 0);
+rXTextDocument.postKeyEvent(LOK_KEYEVENT_KEYUP, c, 0);
+Scheduler::ProcessEventsToIdle();
+}
+}
 } //namespace
 
 class SwUiWriterTest6 : public SwModelTestBase, public HtmlTestTools
@@ -1335,6 +1346,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testRedlineAutoCorrect)
 dispatchCommand(mxComponent, ".uno:GoToEndOfDoc", {});
 
 SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+CPPUNIT_ASSERT(pWrtShell);
+SwXTextDocument* pXTextDocument = 
dynamic_cast(mxComponent.get());
+CPPUNIT_ASSERT(pXTextDocument);
 
 // show tracked deletion with enabled change tracking
 RedlineFlags const nMode(pWrtShell->GetRedlineFlags() | RedlineFlags::On);
@@ -1345,13 +1359,11 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testRedlineAutoCorrect)
 CPPUNIT_ASSERT_MESSAGE("redlining should be on",
pDoc->getIDocumentRedlineAccess().IsRedlineOn());
 
-SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
-pWrtShell->AutoCorrect(corr, ' ');
-SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+emulateTyping(*pXTextDocument, u" ");
 
 // tdf#83419 This was "Ts " removing the deletion of "t" silently by 
sentence capitalization
 OUString sReplaced("ts ");
-CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 
 // hide delete redlines
 pWrtShell->SetRedlineFlags(nMode & ~RedlineFlags::ShowDelete);
@@ -1359,60 +1371,53 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, 
testRedlineAutoCorrect)
 // repeat it with not visible redlining
 dispatchCommand(mxComponent, ".uno:Undo", {});
 
-pWrtShell->AutoCorrect(corr, ' ');
-nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
+emulateTyping(*pXTextDocument, u" ");
 
 sReplaced = "S ";
-CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 
 // show delete redlines
 pWrtShell->SetRedlineFlags(nMode);
-nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
 
 // This still keep the tracked deletion, capitalize only the visible text 
"s"
 // with tracked deletion of the original character
 sReplaced = "tsS ";
-CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 
 // repeat it with visible redlining and word auto replacement of "tset"
 dispatchCommand(mxComponent, ".uno:Undo", {});
 dispatchCommand(mxComponent, ".uno:Undo", {});
 
-pWrtShell->Insert("et");
-pWrtShell->AutoCorrect(corr, ' ');
+emulateTyping(*pXTextDocument, u"et ");
 // This was "Ttest" removing the tracked deletion silently.
 // Don't replace, if a redline starts or ends within the text.
 sReplaced = "tset ";
-nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
-CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 
 // Otherwise replace it
-pWrtShell->Insert("tset");
-pWrtShell->AutoCorrect(corr, ' ');
+emulateTyping(*pXTextDocument, u"tset ");
 sReplaced = "tset test ";
-nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
-CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 
 // Including capitalization
-pWrtShell->Insert("end. word");
-pWrtShell->AutoCorrect(corr, ' ');
+emulateTyping(*pXTextDocument, u"end. word ");
 sReplaced = "tset tes

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

2022-04-08 Thread Mark Hung (via logerrit)
 vcl/win/window/salframe.cxx |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 2b2d1c08c94fdc3982971c2b19ea241f05e578c9
Author: Mark Hung 
AuthorDate: Mon Apr 4 20:12:36 2022 +0800
Commit: Mark Hung 
CommitDate: Fri Apr 8 15:23:54 2022 +0200

tdf#143447 ignore IME candidate window state.

Some traditional Chinese IMEs ( Input Method Editors ) under
Windows10 send WM_IME_NOTIFY with IMN_OPENCANDIDATE but not
IMN_CLOSECANDIDATE. The behavior is different if users configure
the IME and enable "legacy" option.

That caused the cursor been hidden, misled by mbCandidateMode.

The patch ignores the candidate window mode in case the length
of the composition string is 0, assume in that case candidate
window is useless, and resets the candidate window mode when
composition ended to maintain the state as much as we can.

Change-Id: I91a1c23ee1a031313243e032653f50f39b0f2a3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132512
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index cd9449c1a4ae..bbfd7843502a 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5153,7 +5153,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* 
pFrame,
 if ( (nTextLen > 0) || !(lParam & GCS_RESULTSTR) )
 {
 // End the mode, if the last character is deleted
-if ( !nTextLen && !pFrame->mbCandidateMode )
+if ( !nTextLen )
 {
 pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt );
 pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
@@ -5238,7 +5238,10 @@ static bool ImplHandleIMEEndComposition( HWND hWnd )
 if ( pFrame && pFrame->mbHandleIME )
 {
 if ( pFrame->mbAtCursorIME )
+{
+pFrame->mbCandidateMode = false;
 bDef = false;
+}
 }
 
 ImplSalYieldMutexRelease();


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

2022-04-08 Thread Mark Hung (via logerrit)
 vcl/inc/fontinstance.hxx   |8 
 vcl/source/font/fontinstance.cxx   |   37 +
 vcl/source/gdi/CommonSalLayout.cxx |   13 +
 3 files changed, 58 insertions(+)

New commits:
commit 257bb11cbc5b1eb1f90014f528b9e7d6ccfeae86
Author: Mark Hung 
AuthorDate: Sun Apr 3 14:53:14 2022 +0800
Commit: Mark Hung 
CommitDate: Fri Apr 8 15:25:37 2022 +0200

tdf#148330 fix vertical offset for DFKai-SB (ukai.ttf).

DFKai-SB (ukai.ttf) is a built-in font under tradtional Chinese
Windows. The font is very common, especially for official documents.
It is one of the so-called tricky fonts in FreeType[1].

DFKai-SB has incorrect extent in the glyf table[2]. It results in
incorrect glyph positions in vertical writing.

FreeType recalculates the extents based on the
glyph outline, but LibreOffice uses Harfbuzz with
built-in ot font functions instead of ft (FreeType).

This patch decides if the fix is necessary by
checking the family name of the font and the y-offset
value, and recaculates the glyph offset based on glyph
height and top bearing obtained from the glyph bound rect.


[1]https://freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_face_flag_tricky
[2]https://github.com/harfbuzz/harfbuzz/issues/3521

Change-Id: If632dd38c462c229837e1efb5446e2142f8f0639
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132511
Tested-by: Jenkins
Reviewed-by: Mark Hung 

diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 5822bd1a08b5..5b5ab206c26a 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -86,6 +86,9 @@ public: // TODO: make data members private
 
 inline hb_font_t* GetHbFont();
 bool IsGraphiteFont();
+// NeedOffsetCorrection: Return if the font need offset correction in TTB 
direction.
+// nYOffset is the original offset. It is used to check if the correction 
is necessary.
+bool NeedOffsetCorrection(sal_Int32 nYOffset);
 void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = 
std::abs(nFactor); }
 double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
 const vcl::font::FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
@@ -129,6 +132,11 @@ private:
 double m_nAveWidthFactor;
 rtl::Reference m_pFontFace;
 std::optional m_xbIsGraphiteFont;
+
+enum class FontFamilyEnum { Unclassified, DFKaiSB };
+
+// The value is initialized and used in NeedOffsetCorrection().
+std::optional m_xeFontFamilyEnum;
 };
 
 inline hb_font_t* LogicalFontInstance::GetHbFont()
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 5dbd1748a3c3..6f5bc7d1f37a 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -152,4 +152,41 @@ bool LogicalFontInstance::IsGraphiteFont()
 return *m_xbIsGraphiteFont;
 }
 
+bool LogicalFontInstance::NeedOffsetCorrection(sal_Int32 nYOffset)
+{
+if (!m_xeFontFamilyEnum)
+{
+char familyname[10];
+unsigned int familyname_size = 10;
+
+m_xeFontFamilyEnum = FontFamilyEnum::Unclassified;
+
+if (hb_ot_name_get_utf8 (hb_font_get_face(GetHbFont()),
+HB_OT_NAME_ID_FONT_FAMILY , HB_LANGUAGE_INVALID, 
&familyname_size, familyname) == 8)
+{
+// DFKai-SB (ukai.ttf) is a built-in font under tradtional Chinese
+// Windows. It has wrong extent values in glyf table. The problem 
results
+// in wrong positioning of glyphs in vertical writing.
+// Check https://github.com/harfbuzz/harfbuzz/issues/3521 for 
reference.
+if (!strncmp("DFKai-SB", familyname, 8))
+m_xeFontFamilyEnum = FontFamilyEnum::DFKaiSB;
+}
+}
+
+bool bRet = true;
+
+switch (*m_xeFontFamilyEnum)
+{
+case FontFamilyEnum::DFKaiSB:
+// -839: optimization for one third of ukai.ttf
+if (nYOffset == -839)
+bRet = false;
+break;
+default:
+bRet = false;
+}
+
+return bRet;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index be6480bfde1a..8dee28727997 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -621,6 +621,19 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
 nAdvance = -pHbPositions[i].y_advance;
 nXOffset = -pHbPositions[i].y_offset;
 nYOffset = -pHbPositions[i].x_offset - nBaseOffset;
+
+if 
(GetFont().NeedOffsetCorrection(pHbPositions[i].y_offset))
+{
+// We need glyph's advance, top bearing, and height to
+// correct y offset.
+ 

Re: "forcepoint" ?

2022-04-08 Thread Caolán McNamara
On Fri, 2022-04-08 at 14:40 +0200, Regina Henschel wrote:
> Hi all,
> 
> There are a lot of commits with "forcepoint" in subject. Is there 
> somewhere a description about that "forcepoint" work?

It's a set of documents that crash (or have similar ill effect)
recently kindly provided by helpful employees of the company
Forcepoint. I've just numbered them consecutively to keep track. There
was a similar round to this in 2019 or thereabouts, which is why the
recent commits begin with forcepoint#82.



[Libreoffice-commits] core.git: bin/sanitize-excludelist.txt

2022-04-08 Thread Caolán McNamara (via logerrit)
 bin/sanitize-excludelist.txt |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 3bf4925903cadb011bedaabb3cf18fde65bcf61a
Author: Caolán McNamara 
AuthorDate: Fri Apr 8 13:01:03 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 8 15:36:48 2022 +0200

ofz#46162 and ofz#46287 Integer overflow

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

diff --git a/bin/sanitize-excludelist.txt b/bin/sanitize-excludelist.txt
index ba4e1c8d4d71..0ed5b20a1575 100644
--- a/bin/sanitize-excludelist.txt
+++ b/bin/sanitize-excludelist.txt
@@ -12,6 +12,7 @@ src:cairo*.h
 src:*/boost/boost/rational.hpp
 src:*/include/tools/gen.hxx
 src:*/tools/source/generic/gen.cxx
+src:*/vcl/source/outdev/map.cxx
 [vptr]
 fun:_ZN4cppu14throwExceptionERKN3com3sun4star3uno3AnyE
 src:*/include/com/sun/star/uno/Reference.hxx


Re: "forcepoint" ?

2022-04-08 Thread Regina Henschel

Hi Caolán,

Caolán McNamara schrieb am 08.04.2022 um 15:30:

On Fri, 2022-04-08 at 14:40 +0200, Regina Henschel wrote:

Hi all,

There are a lot of commits with "forcepoint" in subject. Is there
somewhere a description about that "forcepoint" work?


It's a set of documents that crash (or have similar ill effect)
recently kindly provided by helpful employees of the company
Forcepoint. I've just numbered them consecutively to keep track. There
was a similar round to this in 2019 or thereabouts, which is why the
recent commits begin with forcepoint#82.



I see. Thank you for the insight.

Kind regards,
Regina




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

2022-04-08 Thread Mike Kaganski (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx |1 +
 basic/source/runtime/dllmgr-x86.cxx |1 +
 2 files changed, 2 insertions(+)

New commits:
commit ad7b90fc541413f091f6ff4bc7e2ced9fee8700b
Author: Mike Kaganski 
AuthorDate: Fri Apr 8 16:03:22 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Apr 8 16:39:19 2022 +0200

Fix build

... after commit 36e0e88b28e818faf25b8e32cc8c4dc444b8a0be

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

diff --git a/basic/source/runtime/dllmgr-x64.cxx 
b/basic/source/runtime/dllmgr-x64.cxx
index 15226cc3fb3c..2372ecd7144d 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/basic/source/runtime/dllmgr-x86.cxx 
b/basic/source/runtime/dllmgr-x86.cxx
index 3433282c22ec..32ddf68b6818 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -31,6 +31,7 @@
 
 #include 
 #include 
+#include 
 #include "runtime.hxx"
 #include 
 #include 


[Libreoffice-commits] core.git: Branch 'distro/vector/vector-7.0' - sw/qa sw/source

2022-04-08 Thread Miklos Vajna (via logerrit)
 sw/qa/core/doc/doc.cxx|   28 
 sw/source/core/doc/docfly.cxx |2 +-
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 0983dca4d64f3099c9cfe6341e9c219ea37e9aa5
Author: Miklos Vajna 
AuthorDate: Thu Apr 7 16:59:32 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Apr 8 16:44:23 2022 +0200

sw: keep URL when applying frame style on images

It seems that the intention is to reset properties which are possible to
set in a style when applying a style. For example the paragraph
alignment can be defined in a paragraph style, so reset that on style
apply.

URLs on frames can't be defined for frame styles, so it looks incorrect
to reset the URL of a frame/image on style apply, fix this.

(cherry picked from commit 97c18cf32a9a3088b5a51e2b0d535d8caf5daca8)

Conflicts:
sw/qa/core/doc/doc.cxx

Change-Id: Ie3a57b654cf06b9512b25d2dc103d15cd83727b7

diff --git a/sw/qa/core/doc/doc.cxx b/sw/qa/core/doc/doc.cxx
index a8489e01a274..59a73751308d 100644
--- a/sw/qa/core/doc/doc.cxx
+++ b/sw/qa/core/doc/doc.cxx
@@ -82,6 +82,34 @@ CPPUNIT_TEST_FIXTURE(SwCoreDocTest, 
testTextboxTextRotateAngle)
 ErrorRegistry::Reset();
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreDocTest, testImageHyperlinkStyle)
+{
+// Given a document with an image with a hyperlink:
+loadURL("private:factory/swriter", nullptr);
+uno::Reference xFactory(mxComponent, 
uno::UNO_QUERY);
+uno::Reference xDocument(mxComponent, uno::UNO_QUERY);
+uno::Reference xText = xDocument->getText();
+uno::Reference xCursor = xText->createTextCursor();
+uno::Reference xImage(
+xFactory->createInstance("com.sun.star.text.TextGraphicObject"), 
uno::UNO_QUERY);
+xText->insertTextContent(xCursor, xImage, /*bAbsorb=*/false);
+uno::Reference xImageProps(xImage, uno::UNO_QUERY);
+OUString aExpected = "http://www.example.com";;
+xImageProps->setPropertyValue("HyperLinkURL", uno::makeAny(aExpected));
+
+// When applying a frame style on it:
+xImageProps->setPropertyValue("FrameStyleName", 
uno::makeAny(OUString("Frame")));
+
+// Then make sure that the hyperlink is not lost:
+auto aActual = getProperty(xImageProps, "HyperLinkURL");
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: http://www.example.com
+// - Actual  :
+// i.e. the link was lost, even if the frame style dialog doesn't allow 
specifying a link on
+// frames.
+CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index e435920da879..b5aa5465cdc8 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -700,7 +700,7 @@ bool SwDoc::SetFrameFormatToFly( SwFrameFormat& rFormat, 
SwFrameFormat& rNewForm
 rFormat.ResetFormatAttr( RES_PRINT, RES_SURROUND );
 rFormat.ResetFormatAttr( RES_LR_SPACE, RES_UL_SPACE );
 rFormat.ResetFormatAttr( RES_BACKGROUND, RES_COL );
-rFormat.ResetFormatAttr( RES_URL, RES_EDIT_IN_READONLY );
+rFormat.ResetFormatAttr( RES_EDIT_IN_READONLY );
 
 if( !bFrameSz )
 rFormat.SetFormatAttr( aFrameSz );


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

2022-04-08 Thread Stephan Bergmann (via logerrit)
 sc/source/core/data/column2.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 126b1826c465002dccc7c354a584731fa70ec5fd
Author: Stephan Bergmann 
AuthorDate: Fri Apr 8 15:05:50 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Apr 8 16:44:51 2022 +0200

tdf#148423: Half a hack

"Regression" introduced with de4d296619b978ec303f1d7b1e2c78e13fa7a512 "Avoid
overflow in ScColumn::GetOptimalColWidth", which, for this bug document's
nWidth/nPPTX = 6004/0.0647708 = 92696.1, changed the calculation of nTwips 
from
the undefined-behavior 92696 % 65536 = 27161 to the clamped 65535, but 
which is
apparently a value large enough to cause "silent" issues (i.e., not causing
further undefined behavior) down the road, leading to a super-narrow column.

That commit already wondered whether sal_uInt16 is a useful choice here, but
lets keep that question unanswered and just clamp at half the previous 
value,
which happens to cause presumably more pleasing results.

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

diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 249d4c1346ac..f0270e07eee9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -825,7 +825,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
 {
 nWidth += 2;
 sal_uInt16 nTwips = static_cast(
-std::min(nWidth / nPPTX, 
double(std::numeric_limits::max(;
+std::min(nWidth / nPPTX, 
double(std::numeric_limits::max() / 2)));
 return nTwips;
 }
 else


[Libreoffice-commits] core.git: vcl/inc vcl/qt5

2022-04-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |6 +-
 vcl/inc/qt5/QtWidget.hxx |1 +
 vcl/qt5/QtFrame.cxx  |   19 +--
 vcl/qt5/QtWidget.cxx |6 ++
 4 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 881cfbf77567194f5016a961d1c3db869734d68b
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 7 01:07:43 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Apr 8 17:55:58 2022 +0200

tdf#141578 Qt handle QtFrame screen changes

LO doesn't provide any way to notify screen changes / scaling
factors of a window and in fact doesn't really handle scaling
factors in VCL. The QWidget doesn't receive a resize event,
because it's size doesn't change, just the scaling factor.
So we trigger a faked resize on QWindow::screenChanged signal.

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

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index c6edaa58304d..a873cec76ad6 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include "QtTools.hxx"
+#include "QtWidget.hxx"
 
 #include 
 #include 
@@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 friend class QtWidget;
 
-QWidget* m_pQWidget;
+QtWidget* m_pQWidget;
 QtMainWindow* m_pTopLevel;
 
 const bool m_bUseCairo;
@@ -133,6 +134,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 void fixICCCMwindowGroup();
 
+private Q_SLOTS:
+void screenChanged(QScreen*);
+
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
 virtual ~QtFrame() override;
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e2a22d3c9f18..575cef11014f 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -85,6 +85,7 @@ public:
 
 QtFrame& frame() const { return m_rFrame; }
 void endExtTextInput();
+void fakeResize();
 
 static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index b8f649e64b78..91361311d60e 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -176,10 +175,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else
 m_pQWidget = new QtWidget(*this, aWinFlags);
 
+QWindow* pChildWindow = windowHandle();
+connect(pChildWindow, &QWindow::screenChanged, this, 
&QtFrame::screenChanged);
+
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
 QWindow* pParentWindow = pParent->windowHandle();
-QWindow* pChildWindow = windowHandle();
 if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
 pChildWindow->setTransientParent(pParentWindow);
 }
@@ -191,6 +192,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 fixICCCMwindowGroup();
 }
 
+void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); }
+
 void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, 
QWidget* pWidget)
 {
 if (QGuiApplication::platformName() == "wayland")
@@ -343,7 +346,12 @@ bool QtFrame::PostEvent(std::unique_ptr pData)
 return true;
 }
 
-QWidget* QtFrame::asChild() const { return m_pTopLevel ? m_pTopLevel : 
m_pQWidget; }
+QWidget* QtFrame::asChild() const
+{
+if (m_pTopLevel)
+return m_pTopLevel;
+return m_pQWidget;
+}
 
 qreal QtFrame::devicePixelRatioF() const { return 
asChild()->devicePixelRatioF(); }
 
@@ -868,9 +876,8 @@ void QtFrame::SetInputContext(SalInputContext* pContext)
 
 void QtFrame::EndExtTextInput(EndExtTextInputFlags /*nFlags*/)
 {
-QtWidget* pQtWidget = static_cast(m_pQWidget);
-if (pQtWidget)
-pQtWidget->endExtTextInput();
+if (m_pQWidget)
+m_pQWidget->endExtTextInput();
 }
 
 OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode)
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index cd47492808cc..612682ae987f 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -134,6 +134,12 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent)
 m_rFrame.CallCallback(SalEvent::Resize, nullptr);
 }
 
+void QtWidget::fakeResize()
+{
+QResizeEvent aEvent(size(), QSize());
+resizeEvent(&aEvent);
+}
+
 void QtWidget::fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
  const QPoint& rPos, Qt::MouseButtons 
eButtons, int nWidth,
  SalAbstractMouseEvent& aSalEvent)


[Libreoffice-commits] core.git: filter/source officecfg/registry unotools/source vcl/source

2022-04-08 Thread Luboš Luňák (via logerrit)
 filter/source/pdf/pdfexport.cxx|   14 +
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |8 +++
 unotools/source/config/docinfohelper.cxx   |5 
 vcl/source/filter/eps/eps.cxx  |   10 +++--
 4 files changed, 31 insertions(+), 6 deletions(-)

New commits:
commit 14bfb0933073e5bf8ce4f810c38e91125066257a
Author: Luboš Luňák 
AuthorDate: Mon Apr 4 09:50:26 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 18:46:38 2022 +0200

allow to override the generator/producer string in output documents

Add a (non-gui) setting GeneratorOverride that, if set, is used
for odt/docx/pdf generator string identifying the application that
has written it instead of the normal productname etc. string.

Change-Id: Ibe12a063e7e6b5a09c69cdf66cba073793650d62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132495
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index d6f451f8392d..9b07ae1a9306 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "pdfexport.hxx"
 #include 
@@ -479,10 +480,15 @@ bool PDFExport::Export( const OUString& rFile, const 
Sequence< PropertyValue >&
 }
 }
 // getting the string for the producer
-aContext.DocumentInfo.Producer =
-utl::ConfigManager::getProductName() +
-" " +
-utl::ConfigManager::getProductVersion();
+OUString aProducerOverride = 
officecfg::Office::Common::Save::Document::GeneratorOverride::get();
+if( !aProducerOverride.isEmpty())
+aContext.DocumentInfo.Producer = aProducerOverride;
+else
+aContext.DocumentInfo.Producer =
+utl::ConfigManager::getProductName() +
+" " +
+utl::ConfigManager::getProductVersion();
+
 aContext.DocumentInfo.Creator = aCreator;
 
 OUString aSignCertificateSubjectName;
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index d1b16d62554b..781dcde05734 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2391,6 +2391,14 @@
   
   true
 
+
+  
+If set, the value will be used as the generator information 
saved
+in documents. Note that the generator information may affect 
document import
+and using an inappropriate value here may change how the document 
is imported.
+  
+  
+
   
   
 
diff --git a/unotools/source/config/docinfohelper.cxx 
b/unotools/source/config/docinfohelper.cxx
index 7e605d187c75..735f0ac2d56e 100644
--- a/unotools/source/config/docinfohelper.cxx
+++ b/unotools/source/config/docinfohelper.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 
@@ -30,6 +31,10 @@ namespace utl
 
 OUString DocInfoHelper::GetGeneratorString()
 {
+OUString aResultOverride = 
officecfg::Office::Common::Save::Document::GeneratorOverride::get();
+if( !aResultOverride.isEmpty())
+return aResultOverride;
+
 OUStringBuffer aResult(128);
 
 // First product: branded name + version
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 374b4c78218b..bb25bdccb57e 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -449,8 +450,13 @@ void PSWriter::ImplWriteProlog( const Graphic* pPreview )
 ImplWriteLong( aSizePoint.Width() );
 ImplWriteLong( aSizePoint.Height() ,PS_RET );
 ImplWriteLine( "%%Pages: 0" );
-OUString aCreator( "%%Creator: " + utl::ConfigManager::getProductName() + 
" " +
-   utl::ConfigManager::getProductVersion() );
+OUString aCreator;
+OUString aCreatorOverride = 
officecfg::Office::Common::Save::Document::GeneratorOverride::get();
+if( !aCreatorOverride.isEmpty())
+aCreator = aCreatorOverride;
+else
+aCreator = "%%Creator: " + utl::ConfigManager::getProductName() + " " +
+   utl::ConfigManager::getProductVersion();
 ImplWriteLine( OUStringToOString( aCreator, RTL_TEXTENCODING_UTF8 
).getStr() );
 ImplWriteLine( "%%Title: none" );
 ImplWriteLine( "%%CreationDate: none" );


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

2022-04-08 Thread Andrea Gelmini (via logerrit)
 vcl/source/font/fontinstance.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3bfac2a7fad9737f31443292699bd6fee6ac3a6f
Author: Andrea Gelmini 
AuthorDate: Fri Apr 8 16:00:32 2022 +0200
Commit: Julien Nabet 
CommitDate: Fri Apr 8 19:05:57 2022 +0200

Fix typo

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

diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 6f5bc7d1f37a..5c63338b75a1 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -164,7 +164,7 @@ bool LogicalFontInstance::NeedOffsetCorrection(sal_Int32 
nYOffset)
 if (hb_ot_name_get_utf8 (hb_font_get_face(GetHbFont()),
 HB_OT_NAME_ID_FONT_FAMILY , HB_LANGUAGE_INVALID, 
&familyname_size, familyname) == 8)
 {
-// DFKai-SB (ukai.ttf) is a built-in font under tradtional Chinese
+// DFKai-SB (ukai.ttf) is a built-in font under traditional Chinese
 // Windows. It has wrong extent values in glyf table. The problem 
results
 // in wrong positioning of glyphs in vertical writing.
 // Check https://github.com/harfbuzz/harfbuzz/issues/3521 for 
reference.


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

2022-04-08 Thread Jan-Marek Glogowski (via logerrit)
 vcl/inc/qt5/QtFrame.hxx  |6 +-
 vcl/inc/qt5/QtWidget.hxx |1 +
 vcl/qt5/QtFrame.cxx  |   21 ++---
 vcl/qt5/QtWidget.cxx |6 ++
 4 files changed, 26 insertions(+), 8 deletions(-)

New commits:
commit 76de12a19bd90c0ed0d7a6a85502d3dccdbeba4e
Author: Jan-Marek Glogowski 
AuthorDate: Thu Apr 7 01:07:43 2022 +0200
Commit: Jan-Marek Glogowski 
CommitDate: Fri Apr 8 19:48:56 2022 +0200

tdf#141578 Qt handle QtFrame screen changes

LO doesn't provide any way to notify screen changes / scaling
factors of a window and in fact doesn't really handle scaling
factors in VCL. The QWidget doesn't receive a resize event,
because it's size doesn't change, just the scaling factor.
So we trigger a faked resize on QWindow::screenChanged signal.

Change-Id: I6928c4c62d1c0995c70fea0088cff17849bcd1d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132650
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins
(cherry picked from commit 881cfbf77567194f5016a961d1c3db869734d68b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132740
Reviewed-by: Jan-Marek Glogowski 

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 59ec093a2ed6..5ffaacf3ad94 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -25,6 +25,7 @@
 #include 
 
 #include "QtTools.hxx"
+#include "QtWidget.hxx"
 
 #include 
 #include 
@@ -70,7 +71,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 friend class QtWidget;
 
-QWidget* m_pQWidget;
+QtWidget* m_pQWidget;
 QtMainWindow* m_pTopLevel;
 
 const bool m_bUseCairo;
@@ -134,6 +135,9 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 
 void fixICCCMwindowGroup();
 
+private Q_SLOTS:
+void screenChanged(QScreen*);
+
 public:
 QtFrame(QtFrame* pParent, SalFrameStyleFlags nSalFrameStyle, bool 
bUseCairo);
 virtual ~QtFrame() override;
diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e2a22d3c9f18..575cef11014f 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -85,6 +85,7 @@ public:
 
 QtFrame& frame() const { return m_rFrame; }
 void endExtTextInput();
+void fakeResize();
 
 static bool handleEvent(QtFrame&, const QWidget&, QEvent*);
 // key events might be propagated further down => call base on false
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index bcd95494dabd..c78417b3070a 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -30,7 +30,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -178,10 +177,12 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 else
 m_pQWidget = new QtWidget(*this, aWinFlags);
 
+QWindow* pChildWindow = windowHandle();
+connect(pChildWindow, &QWindow::screenChanged, this, 
&QtFrame::screenChanged);
+
 if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
 {
-QWindow* pParentWindow = 
pParent->GetQWidget()->window()->windowHandle();
-QWindow* pChildWindow = asChild()->window()->windowHandle();
+QWindow* pParentWindow = pParent->windowHandle();
 if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow))
 pChildWindow->setTransientParent(pParentWindow);
 }
@@ -193,6 +194,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags 
nStyle, bool bUseCairo)
 fixICCCMwindowGroup();
 }
 
+void QtFrame::screenChanged(QScreen*) { m_pQWidget->fakeResize(); }
+
 void QtFrame::FillSystemEnvData(SystemEnvData& rData, sal_IntPtr pWindow, 
QWidget* pWidget)
 {
 if (QGuiApplication::platformName() == "wayland")
@@ -343,7 +346,12 @@ bool QtFrame::PostEvent(std::unique_ptr pData)
 return true;
 }
 
-QWidget* QtFrame::asChild() const { return m_pTopLevel ? m_pTopLevel : 
m_pQWidget; }
+QWidget* QtFrame::asChild() const
+{
+if (m_pTopLevel)
+return m_pTopLevel;
+return m_pQWidget;
+}
 
 qreal QtFrame::devicePixelRatioF() const { return 
asChild()->devicePixelRatioF(); }
 
@@ -864,9 +872,8 @@ void QtFrame::SetInputContext(SalInputContext* pContext)
 
 void QtFrame::EndExtTextInput(EndExtTextInputFlags /*nFlags*/)
 {
-QtWidget* pQtWidget = static_cast(m_pQWidget);
-if (pQtWidget)
-pQtWidget->endExtTextInput();
+if (m_pQWidget)
+m_pQWidget->endExtTextInput();
 }
 
 OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode)
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index ab8bf2dc0017..1fe2ce9a7159 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -135,6 +135,12 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent)
 m_rFrame.CallCallback(SalEvent::Resize, nullptr);
 }
 
+void QtWidget::fakeResize()
+{
+QResizeEvent aEvent(size(), QSize());
+resizeEvent(&aEvent);
+}
+
 void QtWidget::fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
   

[Libreoffice-commits] core.git: basic/source chart2/source connectivity/source editeng/source filter/source framework/source include/comphelper include/o3tl oox/source sc/source sdext/source sd/source

2022-04-08 Thread Noel Grandin (via logerrit)
 basic/source/runtime/dllmgr-x64.cxx|3 
 basic/source/runtime/dllmgr-x86.cxx|3 
 chart2/source/tools/InternalDataProvider.cxx   |   16 +-
 chart2/source/tools/PropertyHelper.cxx |2 
 chart2/source/tools/XMLRangeHelper.cxx |4 
 connectivity/source/drivers/dbase/DTable.cxx   |7 -
 connectivity/source/drivers/mysqlc/mysqlc_databasemetadata.cxx |5 
 connectivity/source/drivers/odbc/ODatabaseMetaData.cxx |6 -
 editeng/source/misc/svxacorr.cxx   |4 
 filter/source/msfilter/util.cxx|4 
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx   |4 
 framework/source/fwe/helper/actiontriggerhelper.cxx|4 
 include/comphelper/string.hxx  |   58 
--
 include/o3tl/string_view.hxx   |   26 
 oox/source/docprop/docprophandler.cxx  |   18 +--
 oox/source/drawingml/customshapepresetdata.cxx |6 -
 oox/source/drawingml/customshapeproperties.cxx |4 
 oox/source/drawingml/hyperlinkcontext.cxx  |4 
 oox/source/helper/attributelist.cxx|   14 +-
 oox/source/ole/axcontrol.cxx   |6 -
 oox/source/ppt/pptshape.cxx|6 -
 oox/source/ppt/presentationfragmenthandler.cxx |8 -
 oox/source/vml/vmldrawing.cxx  |4 
 oox/source/vml/vmlformatting.cxx   |8 -
 oox/source/vml/vmlshape.cxx|8 -
 oox/source/vml/vmlshapecontext.cxx |4 
 sc/source/core/data/global2.cxx|8 -
 sc/source/core/data/table4.cxx |5 
 sc/source/filter/oox/formulaparser.cxx |6 -
 sc/source/filter/oox/pagesettings.cxx  |6 -
 sc/source/filter/oox/sheetdatacontext.cxx  |6 -
 sc/source/ui/docshell/impex.cxx|   12 +-
 sc/source/ui/miscdlgs/acredlin.cxx |4 
 sd/source/filter/xml/sdxmlwrp.cxx  |6 -
 sd/source/ui/presenter/PresenterTextView.cxx   |6 -
 sdext/source/pdfimport/wrapper/wrapper.cxx |6 -
 sfx2/source/appl/appopen.cxx   |3 
 sfx2/source/appl/childwin.cxx  |7 -
 sfx2/source/bastyp/mieclip.cxx |9 -
 sfx2/source/doc/docfile.cxx|3 
 sfx2/source/doc/sfxbasemodel.cxx   |3 
 svl/source/numbers/zformat.cxx |4 
 svx/source/xoutdev/xattr.cxx   |4 
 sw/source/core/doc/doclay.cxx  |4 
 sw/source/core/doc/docnum.cxx  |3 
 sw/source/core/doc/doctxm.cxx  |4 
 sw/source/core/docnode/ndsect.cxx  |4 
 sw/source/core/fields/cellfml.cxx  |3 
 sw/source/core/unocore/XMLRangeHelper.cxx  |4 
 sw/source/core/unocore/unotbl.cxx  |3 
 sw/source/filter/ascii/wrtasc.cxx  |4 
 sw/source/filter/html/htmlatr.cxx  |4 
 sw/source/filter/ww8/wrtww8gr.cxx  |4 
 sw/source/ui/vba/vbaparagraphformat.cxx|4 
 sw/source/uibase/app/docsh2.cxx|2 
 sw/source/uibase/fldui/fldmgr.cxx  |5 
 sw/source/uibase/misc/redlndlg.cxx |4 
 sw/source/uibase/uiview/view2.cxx  |5 
 sw/source/uibase/utlui/unotools.cxx|2 
 ucbhelper/source/client/proxydecider.cxx   |6 -
 unotools/source/config/dynamicmenuoptions.cxx  |4 
 vbahelper/source/vbahelper/vbalineformat.cxx   |2 
 vcl/source/control/field2.cxx  |9 -
 vcl/source/pdf/PDFiumLibrary.cxx   |   14 +-
 vcl/unx/generic/printer/jobdata.cxx|   12 +-
 vcl/unx/generic/printer/ppdparser.cxx  |7 -
 writerfilter/source/dmapper/ConversionHelper.cxx   |6 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx  |6 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  

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

2022-04-08 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/uiwriter.cxx  |  109 ---
 sw/qa/extras/uiwriter/uiwriter6.cxx |  126 +++-
 sw/qa/extras/uiwriter/uiwriter7.cxx |   16 
 3 files changed, 124 insertions(+), 127 deletions(-)

New commits:
commit 2ed743de88da7ef70eb63fed925a7cf29980c01a
Author: Xisco Fauli 
AuthorDate: Thu Apr 7 16:48:39 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 8 21:06:20 2022 +0200

sw_uiwriter: put autocorrect tests together

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

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index d6e13827213b..b4b7a9eac36d 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -1045,115 +1045,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testFdo85554)
 CPPUNIT_ASSERT_EQUAL(2, getShapes());
 }
 
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testAutoCorr)
-{
-SwDoc* pDoc = createSwDoc();
-SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
-const sal_Unicode cIns = ' ';
-
-//Normal AutoCorrect
-pWrtShell->Insert("tset");
-pWrtShell->AutoCorrect(corr, cIns);
-SwNodeOffset nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
-CPPUNIT_ASSERT_EQUAL(OUString("Test "), 
static_cast(pDoc->GetNodes()[nIndex])->GetText());
-
-//AutoCorrect with change style to bolt
-pWrtShell->Insert("Bolt");
-pWrtShell->AutoCorrect(corr, cIns);
-const uno::Reference< text::XTextRange > xRun = getRun(getParagraph(1), 2);
-CPPUNIT_ASSERT_EQUAL(OUString("Bolt"), xRun->getString());
-CPPUNIT_ASSERT_EQUAL(OUString("Arial"), getProperty(xRun, 
"CharFontName"));
-
-//AutoCorrect inserts Table with 2 rows and 3 columns
-pWrtShell->Insert("4xx");
-pWrtShell->AutoCorrect(corr, cIns);
-const uno::Reference< text::XTextTable > xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
-CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
-CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getColumns()->getCount());
-}
-
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf83260)
-{
-SwDoc* const pDoc(createSwDoc(DATA_DIRECTORY, "tdf83260-1.odt"));
-SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
-
-// enabled but not shown
-CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
-#if 0
-CPPUNIT_ASSERT(IDocumentRedlineAccess::IsHideChanges(
-pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
-#endif
-CPPUNIT_ASSERT(IDocumentRedlineAccess::IsRedlineOn(
-pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
-
CPPUNIT_ASSERT(!pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty());
-
-// the document contains redlines that are combined with CompressRedlines()
-// if that happens during AutoCorrect then indexes in Undo are off -> crash
-pWrtShell->Insert("tset");
-pWrtShell->AutoCorrect(corr, u' ');
-sw::UndoManager& rUndoManager = pDoc->GetUndoManager();
-auto const nActions(rUndoManager.GetUndoActionCount());
-for (auto i = nActions; 0 < i; --i)
-{
-rUndoManager.Undo();
-}
-// check that every text node has a layout frame
-for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i)
-{
-if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode())
-{
-CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr));
-}
-}
-for (auto i = nActions; 0 < i; --i)
-{
-rUndoManager.Redo();
-}
-for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i)
-{
-if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode())
-{
-CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr));
-}
-}
-for (auto i = nActions; 0 < i; --i)
-{
-rUndoManager.Undo();
-}
-for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i)
-{
-if (SwTextNode const*const pNode = pDoc->GetNodes()[i]->GetTextNode())
-{
-CPPUNIT_ASSERT(pNode->getLayoutFrame(nullptr, nullptr, nullptr));
-}
-}
-}
-
-CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf130274)
-{
-SwDoc *const pDoc(createSwDoc());
-SwWrtShell *const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
-SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
-
-CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines());
-CPPUNIT_ASSERT(!IDocumentRedlineAccess::IsRedlineOn(
-pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
-
-// "tset" may be replaced by the AutoCorrect in the test profile
-pWrtShell->Insert("tset");
-// select from left to right
-pWrtShell-

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

2022-04-08 Thread Xisco Fauli (via logerrit)
 sw/qa/extras/uiwriter/uiwriter6.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit ea3f08b91d70587400011e7a34fd9df259542e85
Author: Xisco Fauli 
AuthorDate: Thu Apr 7 17:31:56 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 8 21:06:37 2022 +0200

tdf#83037: sw_uiwriter6: Add unittest

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

diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index 6386c3f07fc6..50819388e96c 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -1591,6 +1591,20 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524)
 sReplaced += u" → ";
 // This was "–>" instead of "→"
 CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+
+// tdf#83037
+emulateTyping(*pXTextDocument, u"-> ");
+sReplaced += u"→ ";
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+emulateTyping(*pXTextDocument, u"<- ");
+sReplaced += u"← ";
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+emulateTyping(*pXTextDocument, u"<-- ");
+sReplaced += u"← ";
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
+emulateTyping(*pXTextDocument, u"<--> ");
+sReplaced += u"↔ ";
+CPPUNIT_ASSERT_EQUAL(sReplaced, getParagraph(1)->getString());
 }
 
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf133524_Romanian)


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

2022-04-08 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx |   17 ++---
 vcl/inc/TextLayoutCache.hxx|   32 
 vcl/source/gdi/CommonSalLayout.cxx |   30 +-
 vcl/source/gdi/impglyphitem.cxx|   20 +++-
 4 files changed, 58 insertions(+), 41 deletions(-)

New commits:
commit 94c2fb28d76c9c37849412a66b31d6861bce3155
Author: Luboš Luňák 
AuthorDate: Wed Apr 6 19:28:07 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:28:15 2022 +0200

faster hashing of very long strings in SalLayoutGlyphsCache

tdf#147284 being a (pathological) testcase.

Change-Id: I08d8dffb40193b461555bed818c040761e8d575b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132669
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/vcl/inc/TextLayoutCache.hxx b/vcl/inc/TextLayoutCache.hxx
index 0ce0c19d8278..ecb85ea7043d 100644
--- a/vcl/inc/TextLayoutCache.hxx
+++ b/vcl/inc/TextLayoutCache.hxx
@@ -20,6 +20,8 @@
 #pragma once
 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -48,6 +50,36 @@ public:
 std::vector runs;
 TextLayoutCache(sal_Unicode const* pStr, sal_Int32 const nEnd);
 };
+
+struct FirstCharsStringHash
+{
+size_t operator()(const OUString& str) const
+{
+// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be 
very long,
+// and computing an entire hash could almost negate the gain of 
hashing. Hash just first
+// characters, that should be good enough.
+size_t hash
+= rtl_ustr_hashCode_WithLength(str.getStr(), std::min(100, 
str.getLength()));
+o3tl::hash_combine(hash, str.getLength());
+return hash;
+}
+};
+
+struct FastStringCompareEqual
+{
+bool operator()(const OUString& str1, const OUString& str2) const
+{
+// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be 
very long,
+// and OUString operator == compares backwards and using hard-written 
code, while
+// memcmp() compares much faster.
+if (str1.getLength() != str2.getLength())
+return false;
+if (str1.getStr() == str2.getStr())
+return true;
+return memcmp(str1.getStr(), str2.getStr(), str1.getLength() * 
sizeof(str1.getStr()[0]))
+   == 0;
+}
+};
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 8dee28727997..2c8a4db8398f 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -154,40 +154,12 @@ namespace {
 return VerticalOrientation(nRet);
 }
 
-struct FirstCharsStringHash
-{
-size_t operator()( const OUString& str ) const
-{
-// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be 
very long,
-// and computing an entire hash could almost negate the gain of 
hashing. Hash just first
-// characters, that should be good enough.
-size_t hash = rtl_ustr_hashCode_WithLength( str.getStr(), 
std::min( 100, str.getLength()));
-o3tl::hash_combine(hash, str.getLength());
-return hash;
-}
-};
-
-struct ForwardStringCompareEqual
-{
-bool operator()( const OUString& str1, const OUString& str2 ) const
-{
-// Strings passed to GenericSalLayout::CreateTextLayoutCache() may be 
very long,
-// and OUString operator == compares backwards, which is inefficient 
for very long
-// strings (bad memory prefetch).
-if( str1.getLength() != str2.getLength())
-return false;
-if( str1.getStr() == str2.getStr())
-return true;
-return memcmp( str1.getStr(), str2.getStr(), str1.getLength() * 
sizeof( str1.getStr()[ 0 ] )) == 0;
-}
-};
-
 } // namespace
 
 std::shared_ptr 
GenericSalLayout::CreateTextLayoutCache(OUString const& rString)
 {
 typedef o3tl::lru_map,
-FirstCharsStringHash, ForwardStringCompareEqual> Cache;
+vcl::text::FirstCharsStringHash, vcl::text::FastStringCompareEqual> 
Cache;
 static vcl::DeleteOnDeinit< Cache > cache( 1000 );
 if( Cache* map = cache.get())
 {
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index eaf8cf5c8453..d320d27dad88 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 SalLayoutGlyphs::SalLayoutGlyphs() {}
 
@@ -146,7 +147,7 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtrGetFont());
 o3tl::hash_combine(hashValue, static_cast(stream.GetData()), 
stream.GetSize());
-o3tl::hash_combine(hashValue, text);
+o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
 o3tl::hash_combine(hashValue, index);
 o3tl::hash_combine(hashValue, len);
 o3tl::hash_combine(hashValue, logicPos.

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

2022-04-08 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx|6 +-
 vcl/inc/pdf/pdfwriter_impl.hxx|3 +++
 vcl/source/gdi/impglyphitem.cxx   |   35 +--
 vcl/source/gdi/pdfwriter_impl.cxx |   12 ++--
 4 files changed, 39 insertions(+), 17 deletions(-)

New commits:
commit 9ed2912d4ecfd9573b3ca9d2390a0f1b0e3060a2
Author: Luboš Luňák 
AuthorDate: Thu Apr 7 12:07:02 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:28:44 2022 +0200

check better for unchanged OutputDevice in SalLayoutGlyphsCache

Some things like font could change, so it needs to be saved and compared.
If would be even better to avoid comparing OutputDevice pointers
and instead compare only what actually matters, in order to reuse
the same glyphs used for different output devices, but I can't
find all the relevant data in OutputDevice.

Change-Id: Ib8634165b5b312d1db2c9fc28f8d7fdf7b552d25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132671
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 83c77309a632..64a1a64186ee 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -61,12 +61,16 @@ public:
 private:
 struct CachedGlyphsKey
 {
-VclPtr outputDevice;
 OUString text;
 sal_Int32 index;
 sal_Int32 len;
 Point logicPos;
 tools::Long logicWidth;
+VclPtr outputDevice;
+vcl::Font font;
+bool rtl;
+vcl::text::ComplexTextLayoutFlags layoutMode;
+LanguageType digitLanguage;
 size_t hashValue;
 CachedGlyphsKey(const VclPtr& dev, const OUString& 
t, sal_Int32 i,
 sal_Int32 l, const Point& p, tools::Long w);
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index d320d27dad88..ea3c490b0ba2 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -135,32 +135,47 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr& d,
const OUString& t, 
sal_Int32 i, sal_Int32 l,
const Point& p, 
tools::Long w)
-: outputDevice(d)
-, text(t)
+: text(t)
 , index(i)
 , len(l)
 , logicPos(p)
 , logicWidth(w)
+, outputDevice(d)
+// we also need to save things used in 
OutputDevice::ImplPrepareLayoutArgs(), in case they
+// change in the output device
+// TODO there is still something missing, otherwise it wouldn't be 
necessary to compare
+// also the OutputDevice pointers
+, font(outputDevice->GetFont())
+, rtl(outputDevice->IsRTLEnabled())
+, layoutMode(outputDevice->GetLayoutMode())
+, digitLanguage(outputDevice->GetDigitLanguage())
 {
 hashValue = 0;
-o3tl::hash_combine(hashValue, outputDevice.get());
-SvMemoryStream stream;
-WriteFont(stream, outputDevice->GetFont());
-o3tl::hash_combine(hashValue, static_cast(stream.GetData()), 
stream.GetSize());
 o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
 o3tl::hash_combine(hashValue, index);
 o3tl::hash_combine(hashValue, len);
 o3tl::hash_combine(hashValue, logicPos.X());
 o3tl::hash_combine(hashValue, logicPos.Y());
 o3tl::hash_combine(hashValue, logicWidth);
+
+o3tl::hash_combine(hashValue, outputDevice.get());
+SvMemoryStream stream;
+WriteFont(stream, font);
+o3tl::hash_combine(hashValue, static_cast(stream.GetData()), 
stream.GetSize());
+o3tl::hash_combine(hashValue, rtl);
+o3tl::hash_combine(hashValue, layoutMode);
+o3tl::hash_combine(hashValue, digitLanguage.get());
 }
 
 inline bool SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const 
CachedGlyphsKey& other) const
 {
-return hashValue == other.hashValue && outputDevice == other.outputDevice
-   && index == other.index && len == other.len && logicPos == 
other.logicPos
-   && logicWidth == other.logicWidth
-   && vcl::text::FastStringCompareEqual()(text, other.text);
+return hashValue == other.hashValue && index == other.index && len == 
other.len
+   && logicPos == other.logicPos && logicWidth == other.logicWidth
+   && outputDevice == other.outputDevice && rtl == other.rtl
+   && layoutMode == other.layoutMode
+   && digitLanguage == other.digitLanguage
+   // slower things here
+   && font == other.font && vcl::text::FastStringCompareEqual()(text, 
other.text);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 376a9792c32a51c91079a54a0cf190acd58485af
Author: Luboš Luňák 
AuthorDate: Wed Apr 6 19:29:06 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:28:29 2022 +0200

use SalLayoutGlyphsCache in PDFWriterImpl
   

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

2022-04-08 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx|9 +++--
 vcl/source/gdi/impglyphitem.cxx   |   17 ++---
 vcl/source/gdi/pdfwriter_impl.cxx |6 +++---
 3 files changed, 12 insertions(+), 20 deletions(-)

New commits:
commit 53fe4a26c7c4691fcf9d07d022adfd45247d176b
Author: Luboš Luňák 
AuthorDate: Thu Apr 7 12:25:09 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:28:58 2022 +0200

ignore Point logicalPos argument in SalLayoutGlyphsCache

It's only used for the DXArray argument in ImplLayout(), so if we
ignore that one when caching, the position can be ignored too.

Change-Id: Id2a7b452e2b75139177c1e73c48eaa466742a59c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132672
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 64a1a64186ee..fca8e9f12575 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -48,13 +48,11 @@ public:
 GetLayoutGlyphs(VclPtr outputDevice, const OUString& 
text,
 const vcl::text::TextLayoutCache* layoutCache = nullptr) 
const
 {
-return GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), 
Point(0, 0), 0,
-   layoutCache);
+return GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), 0, 
layoutCache);
 }
 const SalLayoutGlyphs*
 GetLayoutGlyphs(VclPtr outputDevice, const OUString& 
text, sal_Int32 nIndex,
-sal_Int32 nLen, const Point& rLogicPos = Point(0, 0),
-tools::Long nLogicWidth = 0,
+sal_Int32 nLen, tools::Long nLogicWidth = 0,
 const vcl::text::TextLayoutCache* layoutCache = nullptr) 
const;
 void clear() { mCachedGlyphs.clear(); }
 
@@ -64,7 +62,6 @@ private:
 OUString text;
 sal_Int32 index;
 sal_Int32 len;
-Point logicPos;
 tools::Long logicWidth;
 VclPtr outputDevice;
 vcl::Font font;
@@ -73,7 +70,7 @@ private:
 LanguageType digitLanguage;
 size_t hashValue;
 CachedGlyphsKey(const VclPtr& dev, const OUString& 
t, sal_Int32 i,
-sal_Int32 l, const Point& p, tools::Long w);
+sal_Int32 l, tools::Long w);
 bool operator==(const CachedGlyphsKey& other) const;
 };
 struct CachedGlyphsHash
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index ea3c490b0ba2..01654cfddcbc 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -97,13 +97,12 @@ bool SalLayoutGlyphsImpl::IsValid() const
 
 const SalLayoutGlyphs*
 SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, 
const OUString& text,
-  sal_Int32 nIndex, sal_Int32 nLen, const 
Point& rLogicPos,
-  tools::Long nLogicWidth,
+  sal_Int32 nIndex, sal_Int32 nLen, 
tools::Long nLogicWidth,
   const vcl::text::TextLayoutCache* 
layoutCache) const
 {
 if (nLen == 0)
 return nullptr;
-const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, rLogicPos, 
nLogicWidth);
+const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, nLogicWidth);
 auto it = mCachedGlyphs.find(key);
 if (it != mCachedGlyphs.end())
 {
@@ -121,7 +120,7 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 layoutCache = tmpLayoutCache.get();
 }
 std::unique_ptr layout
-= outputDevice->ImplLayout(text, nIndex, nLen, rLogicPos, nLogicWidth, 
{},
+= outputDevice->ImplLayout(text, nIndex, nLen, Point(0, 0), 
nLogicWidth, {},
SalLayoutFlags::GlyphItemsOnly, 
layoutCache);
 if (layout)
 {
@@ -134,11 +133,10 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 
 SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr& d,
const OUString& t, 
sal_Int32 i, sal_Int32 l,
-   const Point& p, 
tools::Long w)
+   tools::Long w)
 : text(t)
 , index(i)
 , len(l)
-, logicPos(p)
 , logicWidth(w)
 , outputDevice(d)
 // we also need to save things used in 
OutputDevice::ImplPrepareLayoutArgs(), in case they
@@ -154,8 +152,6 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr pLayout = ImplLayout( rText, nIndex, nLen, rPos,
 0, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs );
 if( pLayout )
@@ -6516,7 +6516,7 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, 
const OUString& rText, o3t
 
 // get a layout from the OutputDevice's SalGraphics
 // this also enforces font substitution and sets the font on SalGraphics
-const

[Libreoffice-commits] core.git: 2 commits - editeng/source include/editeng include/vcl sc/source svx/source sw/source vcl/inc vcl/source

2022-04-08 Thread Luboš Luňák (via logerrit)
 editeng/source/editeng/impedit.hxx  |3 
 editeng/source/editeng/impedit2.cxx |2 
 editeng/source/editeng/impedit3.cxx |   28 +++---
 editeng/source/items/svxfont.cxx|   27 ++---
 include/editeng/svxfont.hxx |   10 --
 include/vcl/glyphitemcache.hxx  |   10 +-
 include/vcl/outdev.hxx  |3 
 sc/source/ui/view/output2.cxx   |5 -
 svx/source/inc/StylesPreviewWindow.hxx  |2 
 svx/source/tbxctrls/StylesPreviewWindow.cxx |3 
 sw/source/core/docnode/ndtbl.cxx|1 
 sw/source/core/inc/fntcache.hxx |   45 +
 sw/source/core/layout/layact.cxx|3 
 sw/source/core/txtnode/fntcache.cxx |  130 +++-
 vcl/inc/pdf/pdfwriter_impl.hxx  |3 
 vcl/source/gdi/impglyphitem.cxx |   20 +++-
 vcl/source/gdi/pdfwriter_impl.cxx   |   10 +-
 vcl/source/outdev/text.cxx  |5 -
 18 files changed, 89 insertions(+), 221 deletions(-)

New commits:
commit de45c09a3b48e8ab3ac995ea72681ec265c24123
Author: Luboš Luňák 
AuthorDate: Thu Apr 7 17:42:30 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:29:33 2022 +0200

add SalLayoutGlyphs* parameter to OutputDevice::GetTextBreak()

Change-Id: I278e485e03cf27bc57724233453a672569dfd53f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132682
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index e1f85ad16fc7..d244638e5127 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1074,7 +1074,8 @@ public:
   sal_Unicode nExtraChar, 
sal_Int32& rExtraCharPos,
   sal_Int32 nIndex, sal_Int32 nLen,
   tools::Long nCharExtra,
-  vcl::text::TextLayoutCache 
const* = nullptr) const;
+  vcl::text::TextLayoutCache 
const* = nullptr,
+  const SalLayoutGlyphs* pGlyphs = 
nullptr) const;
 static std::shared_ptr 
CreateTextLayoutCache(OUString const&);
 
 protected:
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 0176332889d7..39e23613e669 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -2340,11 +2340,13 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo 
const & rInf, tools::Long nTe
 
 if( rInf.GetHyphPos() ) {
 sal_Int32 nHyphPos = sal_Int32(*rInf.GetHyphPos());
+const SalLayoutGlyphs* pGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(
+&rInf.GetOut(), *pTmpText, nTmpIdx.get(), nTmpLen.get(), 0, 
rInf.GetVclCache());
 nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak(
  *pTmpText, nTextWidth,
  u'-', nHyphPos,
  sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
- nKern, rInf.GetVclCache()));
+ nKern, rInf.GetVclCache(), pGlyphs));
 *rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? 
COMPLETE_STRING : nHyphPos);
 }
 else
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 8ac3cc379073..14e3aed21a97 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1508,12 +1508,13 @@ sal_Int32 OutputDevice::GetTextBreak( const OUString& 
rStr, tools::Long nTextWid
sal_Unicode nHyphenChar, sal_Int32& 
rHyphenPos,
sal_Int32 nIndex, sal_Int32 nLen,
tools::Long nCharExtra,
- vcl::text::TextLayoutCache const*const pLayoutCache) const
+ vcl::text::TextLayoutCache const*const pLayoutCache,
+ const SalLayoutGlyphs* pGlyphs) const
 {
 rHyphenPos = -1;
 
 std::unique_ptr pSalLayout = ImplLayout( rStr, nIndex, nLen,
-Point(0,0), 0, {}, eDefaultLayout, pLayoutCache);
+Point(0,0), 0, {}, eDefaultLayout, pLayoutCache, pGlyphs);
 sal_Int32 nRetVal = -1;
 if( pSalLayout )
 {
commit 3e5863605881c6de6ad130fe06883c176ca1c69f
Author: Luboš Luňák 
AuthorDate: Thu Apr 7 12:06:27 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Apr 8 21:29:19 2022 +0200

use just one shared global SalLayoutGlyphsCache

Now the cache should be capable of detecting what needs
to stay the same for having the same result, so it should
be enough to have just one cache that can reuse results
even between callers from different places.

Change-Id: Ibdc0303f5b727d1a1d7be91d61db9465ed95e1c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132673

[Libreoffice-commits] core.git: Branch 'feature/cib_contract138c' - 2 commits - include/vcl vcl/inc vcl/source

2022-04-08 Thread Noel Grandin (via logerrit)
 include/vcl/graph.hxx|7 +--
 include/vcl/vectorgraphicdata.hxx|1 +
 vcl/inc/impgraph.hxx |2 ++
 vcl/source/gdi/bitmapex.cxx  |   18 +++---
 vcl/source/gdi/impgraph.cxx  |   27 +++
 vcl/source/gdi/vectorgraphicdata.cxx |6 ++
 6 files changed, 32 insertions(+), 29 deletions(-)

New commits:
commit 4d75bb89c60590b3dc7fb441960e75a57fda3ab2
Author: Noel Grandin 
AuthorDate: Mon May 20 19:08:19 2019 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 8 22:30:59 2022 +0200

tdf#120837 File saving at least 5 times slower

The problem here is that we never actually hit the maExportGraphics
cache in SvXMLGraphicHelper, even though we are passing the same image
down repeatedly.

There are two bugs here:

(1) BitmapEx::operator== does not return true if we instantiate 2
Graphic objects from the same XGraphic, so change it to use the more
expensive operator==. To mitigate the cost, move the expensive checks to
the bottom of the method.

(2) in order to use an object in std::unordered_map, the object must
implement an equality function and a hash function. If two objects are
equal THEY MUST have the same hash value. Using the Impl* as the hash
value does not satisfy that condition, so rather use the checksum, which
does.

After these fixes, the save time drops to less than a second.

Also make the checksum method look more like the operator== method,
and add a checksum calculation method for SVG data that more accurately
reflects the underlying SVG data.

Change-Id: I4ca0c7bee60b2efa6fe42301e582c7b278022b46
Reviewed-on: https://gerrit.libreoffice.org/72615
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 319c57d2af5d26d3910db4b02dca145d8881af44)

diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index 3b91a3269478..8b42ca0cc3d7 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -197,11 +197,6 @@ public:
 
 BitmapChecksum  GetChecksum() const;
 
-SAL_DLLPRIVATE std::size_t getHash() const
-{
-return reinterpret_cast(ImplGetImpGraphic());
-}
-
 OUString getOriginURL() const;
 void setOriginURL(OUString const & rOriginURL);
 
@@ -249,7 +244,7 @@ struct hash
 {
 std::size_t operator()(Graphic const & rGraphic) const
 {
-return rGraphic.getHash();
+return static_cast(rGraphic.GetChecksum());
 }
 };
 
diff --git a/include/vcl/vectorgraphicdata.hxx 
b/include/vcl/vectorgraphicdata.hxx
index ea7615d2bdf6..159dc7afe286 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -103,6 +103,7 @@ public:
 const basegfx::B2DRange& getRange() const;
 const std::deque< css::uno::Reference< css::graphic::XPrimitive2D > >& 
getPrimitive2DSequence() const;
 const BitmapEx& getReplacement() const;
+BitmapChecksum GetChecksum() const;
 };
 
 typedef std::shared_ptr< VectorGraphicData > VectorGraphicDataPtr;
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 30c88594c5d6..133ed2d0de46 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -83,6 +83,8 @@ private:
 bool mbSwapOut;
 bool mbDummyContext;
 VectorGraphicDataPtr maVectorGraphicData;
+// cache checksum computation
+mutable BitmapChecksum   mnChecksum = 0;
 
 /// The PDF stream from which this Graphic is rendered,
 /// as converted (version downgraded) from the original,
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index ccf70a6c4dca..15a176924aec 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -181,9 +181,6 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
 if (meTransparent != rBitmapEx.meTransparent)
 return false;
 
-if (!maBitmap.ShallowEquals(rBitmapEx.maBitmap))
-return false;
-
 if (GetSizePixel() != rBitmapEx.GetSizePixel())
 return false;
 
@@ -197,7 +194,10 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) 
const
 if (mbAlpha != rBitmapEx.mbAlpha)
 return false;
 
-return maMask.ShallowEquals(rBitmapEx.maMask);
+if (maBitmap != rBitmapEx.maBitmap)
+return false;
+
+return maMask == rBitmapEx.maMask;
 }
 
 bool BitmapEx::IsEmpty() const
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 9b6bf0da8d77..825f6b56b852 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1671,6 +1671,9 @@ bool ImpGraphic::ImplIsLink() const
 
 BitmapChecksum ImpGraphic::ImplGetChecksum() const
 {
+if (mnChecksum != 0)
+return mnChecksum;
+
 BitmapChecksum nRet = 0;
 
 ensureAvailable();
@@ -1684,25 +1687,16 @@ BitmapChecksum ImpGraphic::ImplGetChecksum() const
 
 case GraphicTy

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

2022-04-08 Thread Luboš Luňák (via logerrit)
 sw/source/core/inc/fntcache.hxx |7 ---
 sw/source/core/txtnode/fntcache.cxx |   14 +++---
 vcl/source/gdi/impglyphitem.cxx |7 ++-
 3 files changed, 13 insertions(+), 15 deletions(-)

New commits:
commit 7cc4b06fc44c06866cdabb4a8856c7cee3fcfe2d
Author: Luboš Luňák 
AuthorDate: Fri Apr 8 14:35:34 2022 +0200
Commit: Luboš Luňák 
CommitDate: Sat Apr 9 00:37:21 2022 +0200

use helper GetTextArray() in all places

Change-Id: Icec4326cf614574d7dabe6752f985b3ac4462fb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132744
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx
index 3b8934013059..4f58be568951 100644
--- a/sw/source/core/inc/fntcache.hxx
+++ b/sw/source/core/inc/fntcache.hxx
@@ -78,13 +78,6 @@ class SwFntObj final : public SwCacheObj
 bool m_bSymbol : 1;
 bool m_bPaintBlank : 1;
 
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
OUString& rStr,
- std::vector& rDXAry, sal_Int32 nIndex, 
sal_Int32 nLen,
- const vcl::text::TextLayoutCache* layoutCache = 
nullptr);
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry,
- sal_Int32 nLen);
-static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry);
-
 static tools::Long s_nPixWidth;
 static MapMode *s_pPixMap;
 
diff --git a/sw/source/core/txtnode/fntcache.cxx 
b/sw/source/core/txtnode/fntcache.cxx
index 39e23613e669..65a4332b462d 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -756,20 +756,20 @@ static void lcl_DrawLineForWrongListData(
 rInf.GetOut().Pop();
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rDevice, const OUString& rStr, 
std::vector& rDXAry,
-sal_Int32 nIndex, sal_Int32 nLen, const 
vcl::text::TextLayoutCache* layoutCache)
+static void GetTextArray(const OutputDevice& rDevice, const OUString& rStr, 
std::vector& rDXAry,
+ sal_Int32 nIndex, sal_Int32 nLen, const 
vcl::text::TextLayoutCache* layoutCache = nullptr)
 {
 const SalLayoutGlyphs* pLayoutCache = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(&rDevice, rStr, nIndex, nLen,
 0, layoutCache);
 rDevice.GetTextArray(rStr, &rDXAry, nIndex, nLen, layoutCache, 
pLayoutCache);
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry)
+static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry)
 {
 return GetTextArray(rOutputDevice, rInf.GetText(), rDXAry, 
rInf.GetIdx().get(), rInf.GetLen().get(), rInf.GetVclCache());
 }
 
-void SwFntObj::GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry, sal_Int32 nLen)
+static void GetTextArray(const OutputDevice& rOutputDevice, const 
SwDrawTextInfo& rInf, std::vector& rDXAry, sal_Int32 nLen)
 {
 // Substring is fine.
 assert( nLen <= rInf.GetLen().get());
@@ -2246,7 +2246,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
 
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), &aKernArray,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 
 tools::Long nAvgWidthPerChar = aKernArray[sal_Int32(rInf.GetLen()) 
- 1] / sal_Int32(rInf.GetLen());
@@ -2277,7 +2277,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 const tools::Long nGridWidthAdd = EvalGridWidthAdd( pGrid, rInf );
 
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), &aKernArray,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(rInf.GetLen()));
 tools::Long nCurrPos = aKernArray[sal_Int32(nTextBreak)] + 
nGridWidthAdd;
 while (++nTextBreak < rInf.GetLen() && nTextWidth >= nCurrPos)
@@ -2394,7 +2394,7 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const 
& rInf, tools::Long nTe
 else if (nLn > nTextBreak2 + nTextBreak2)
 nLn = nTextBreak2 + nTextBreak2;
 std::vector aKernArray;
-rInf.GetOut().GetTextArray( rInf.GetText(), &aKernArray,
+GetTextArray( rInf.GetOut(), rInf.GetText(), aKernArray,
 sal_Int32(rInf.GetIdx()), sal_Int32(nLn));
 if( rInf.GetScriptInfo()->Compress( aKernArray.data(), rInf.GetIdx(), 
nLn,
 rInf.GetKanaComp(), 
o3tl::narrowing(GetHeight( m_nActual 

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

2022-04-08 Thread Eike Rathke (via logerrit)
 sw/source/core/fields/flddat.cxx |9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit 1c49b677313b94efe17bf8bf8f2952416c2453cc
Author: Eike Rathke 
AuthorDate: Fri Apr 8 21:56:54 2022 +0200
Commit: Eike Rathke 
CommitDate: Sat Apr 9 00:56:04 2022 +0200

Use DateTime(css::util::DateTime&) ctor

Individual fragments set in the given order even raised SAL_WARN
about non-existing year 0 ...

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

diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx
index 99d1ca45e728..51246f6eea0e 100644
--- a/sw/source/core/fields/flddat.cxx
+++ b/sw/source/core/fields/flddat.cxx
@@ -213,14 +213,7 @@ bool SwDateTimeField::PutValue( const uno::Any& rVal, 
sal_uInt16 nWhichId )
 util::DateTime aDateTimeValue;
 if(!(rVal >>= aDateTimeValue))
 return false;
-DateTime aDateTime( DateTime::EMPTY );
-aDateTime.SetNanoSec(aDateTimeValue.NanoSeconds);
-aDateTime.SetSec(aDateTimeValue.Seconds);
-aDateTime.SetMin(aDateTimeValue.Minutes);
-aDateTime.SetHour(aDateTimeValue.Hours);
-aDateTime.SetDay(aDateTimeValue.Day);
-aDateTime.SetMonth(aDateTimeValue.Month);
-aDateTime.SetYear(aDateTimeValue.Year);
+DateTime aDateTime(aDateTimeValue);
 SetDateTime(aDateTime);
 }
 break;


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

2022-04-08 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit ccb78b98e0618cce365562fe326d018892b8104a
Author: Jim Raykowski 
AuthorDate: Thu Apr 7 08:03:19 2022 -0800
Commit: Jim Raykowski 
CommitDate: Sat Apr 9 01:35:46 2022 +0200

SwNavigator: set entry focus and update toolbox items sensitivity

when content tree entry selection is made by the SelectContentType
function

The SelectContentType function is used when the Navigate By control
combo box selection is changed by direct selection. This patch makes
the tree entry cursor position be set to the selected content type
entry so keyboard tab navigation will land on it. It also makes
the move chapter up/down and promote/demote outline level toolbox items
sensitivity update when the selection is made.

Change-Id: I56675592678accc6db3eacb25bf9bccae8eb1cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132689
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 3ee581276a76..583f159d2a33 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -5074,9 +5074,8 @@ void SwContentTree::SelectContentType(std::u16string_view 
rContentTypeName)
 {
 if (m_xTreeView->get_text(*xIter) == rContentTypeName)
 {
-m_xTreeView->unselect_all();
-m_xTreeView->select(*xIter);
-m_xTreeView->scroll_to_row(*xIter);
+m_xTreeView->set_cursor(*xIter);
+Select();
 break;
 }
 } while (m_xTreeView->iter_next_sibling(*xIter));


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

2022-04-08 Thread Eike Rathke (via logerrit)
 svl/source/numbers/zforfind.cxx |   23 +++
 1 file changed, 23 insertions(+)

New commits:
commit 7a16002ede5fd31ae8f3358136ad49de40465ac1
Author: Eike Rathke 
AuthorDate: Fri Apr 8 21:46:47 2022 +0200
Commit: Eike Rathke 
CommitDate: Sat Apr 9 02:23:54 2022 +0200

Resolves: tdf#148052 accept a ". Month " name for matching DMY format

... even if the locale doesn't define such DM order or
LongDateDaySeparator.

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

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 438eacabc893..b0207a4df2be 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -2604,6 +2604,29 @@ bool ImpSvNumberInputScan::ScanMidString( const 
OUString& rString, sal_uInt16 nS
 SkipBlanks(rString, nPos);
 bDate = SkipString( rDate, rString, nPos);  // 10.  10-  10/
 }
+if (!bDate && nStringPos == 1 && mpFormat && (mpFormat->GetType() & 
SvNumFormatType::DATE))
+{
+// If a DMY format was given and a mid string starts with a literal
+// ". " dot+space and could contain a following month name and ends
+// with a space or LongDateMonthSeparator, like it's scanned in
+// `14". AUG "18`, then it may be a date as well. Regardless whether
+// defined such by the locale or not.
+// This *could* check for presence of ". "MMM or ". " in the actual
+// format code for further restriction to match only if present, but..
+
+const sal_uInt32 nExactDateOrder = mpFormat->GetExactDateOrder();
+// Exactly DMY.
+if (((nExactDateOrder & 0xff) == 'Y') && (((nExactDateOrder >> 8) & 
0xff) == 'M')
+&& (((nExactDateOrder >> 16) & 0xff) == 'D'))
+{
+const sal_Int32 nTmpPos = nPos;
+if (SkipChar('.', rString, nPos) && SkipBlanks(rString, nPos) && 
nPos + 2 < rString.getLength()
+&& (rString.endsWith(" ") || rString.endsWith( 
pLoc->getLongDateMonthSep(
+bDate = true;
+else
+nPos = nTmpPos;
+}
+}
 if (bDate || ((MayBeIso8601() || MayBeMonthDate()) &&// 1999-12-31  
31-Dec-1999
   SkipChar( '-', rString, nPos)))
 {