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

2022-07-22 Thread Mike Kaganski (via logerrit)
 include/vcl/BitmapPalette.hxx   |   11 +++
 vcl/source/bitmap/bitmap.cxx|   51 
 vcl/source/bitmap/bitmappalette.cxx |9 ++
 3 files changed, 37 insertions(+), 34 deletions(-)

New commits:
commit 1987aa7b597650930e32c274240fdec68617d903
Author: Mike Kaganski 
AuthorDate: Fri Jul 22 17:11:44 2022 +0300
Commit: Mike Kaganski 
CommitDate: Sat Jul 23 07:40:30 2022 +0200

Simplify greyscale palette initialization further

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

diff --git a/include/vcl/BitmapPalette.hxx b/include/vcl/BitmapPalette.hxx
index d470dfbb5521..4f20970e15ec 100644
--- a/include/vcl/BitmapPalette.hxx
+++ b/include/vcl/BitmapPalette.hxx
@@ -24,6 +24,8 @@
 #include 
 #include 
 
+#include 
+
 class ImplBitmapPalette;
 
 class VCL_DLLPUBLIC BitmapPalette
@@ -43,6 +45,7 @@ public:
 BitmapPalette( const BitmapPalette& );
 BitmapPalette( BitmapPalette&& ) noexcept;
 BitmapPalette(std::initializer_list aBitmapColor);
+template  BitmapPalette(const std::array& 
colors);
 explicit BitmapPalette(sal_uInt16 nCount);
 ~BitmapPalette();
 
@@ -72,7 +75,15 @@ public:
 typedef o3tl::cow_wrapper< ImplBitmapPalette > ImplType;
 
 private:
+BitmapPalette(const BitmapColor* first, const BitmapColor* last);
+
 ImplType mpImpl;
 };
 
+template 
+BitmapPalette::BitmapPalette(const std::array& colors)
+: BitmapPalette(colors.data(), colors.data() + N)
+{
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index f96bad8cb0f9..2a9f949ac1fe 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -169,6 +169,19 @@ Bitmap::~Bitmap()
 #endif
 }
 
+namespace
+{
+template 
+constexpr std::enable_if_t<255 % (N - 1) == 0, std::array> 
getGreyscalePalette()
+{
+const int step = 255 / (N - 1);
+std::array a;
+for (size_t i = 0; i < N; ++i)
+a[i] = BitmapColor(i * step, i * step, i * step);
+return a;
+}
+}
+
 const BitmapPalette& Bitmap::GetGreyPalette( int nEntries )
 {
 // Create greyscale palette with 2, 4, 16 or 256 entries
@@ -176,52 +189,22 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries 
)
 {
 case 2:
 {
-static const BitmapPalette aGreyPalette2 = {
-BitmapColor(0, 0, 0),
-BitmapColor(255, 255, 255),
-};
-
+static const BitmapPalette aGreyPalette2 = 
getGreyscalePalette<2>();
 return aGreyPalette2;
 }
 case 4:
 {
-static const BitmapPalette aGreyPalette4 = {
-BitmapColor(0, 0, 0),
-BitmapColor(85, 85, 85),
-BitmapColor(170, 170, 170),
-BitmapColor(255, 255, 255),
-};
-
+static const BitmapPalette aGreyPalette4 = 
getGreyscalePalette<4>();
 return aGreyPalette4;
 }
 case 16:
 {
-static const BitmapPalette aGreyPalette16 = [] {
-sal_uInt8 cGrey = 0;
-sal_uInt8 const cGreyInc = 17;
-
-BitmapPalette aPalette(16);
-
-for (sal_uInt16 i = 0; i < 16; ++i, cGrey += cGreyInc)
-aPalette[i] = BitmapColor(cGrey, cGrey, cGrey);
-
-return aPalette;
-}();
-
+static const BitmapPalette aGreyPalette16 = 
getGreyscalePalette<16>();
 return aGreyPalette16;
 }
 case 256:
 {
-static const BitmapPalette aGreyPalette256 = [] {
-BitmapPalette aPalette(256);
-
-for (sal_uInt16 i = 0; i < 256; ++i)
-aPalette[i] = BitmapColor(static_cast(i), 
static_cast(i),
-  static_cast(i));
-
-return aPalette;
-}();
-
+static const BitmapPalette aGreyPalette256 = 
getGreyscalePalette<256>();
 return aGreyPalette256;
 }
 }
diff --git a/vcl/source/bitmap/bitmappalette.cxx 
b/vcl/source/bitmap/bitmappalette.cxx
index 61a8a8252794..e0bf53db033e 100644
--- a/vcl/source/bitmap/bitmappalette.cxx
+++ b/vcl/source/bitmap/bitmappalette.cxx
@@ -37,6 +37,10 @@ public:
 : maBitmapColor(aBitmapColor)
 {
 }
+ImplBitmapPalette(const BitmapColor* first, const BitmapColor* last)
+: maBitmapColor(first, last)
+{
+}
 ImplBitmapPalette() {}
 ImplBitmapPalette(sal_uInt16 nCount)
 : maBitmapColor(nCount)
@@ -82,6 +86,11 @@ 
BitmapPalette::BitmapPalette(std::initializer_list aBitmapColor)
 {
 }
 
+BitmapPalette::BitmapPalette(const BitmapColor* first, const BitmapColor* last)
+: mpImpl({ first, last })
+{
+}
+
 BitmapPalette::BitmapPalette(sal_uInt16 nCount

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/uiconfig

2022-07-22 Thread Caolán McNamara (via logerrit)
 sc/uiconfig/scalc/ui/scgeneralpage.ui |  534 +-
 1 file changed, 276 insertions(+), 258 deletions(-)

New commits:
commit 7c7d318f5a9afdc8cc08625dd595a74d8d0253e7
Author: Caolán McNamara 
AuthorDate: Fri Jul 22 09:47:18 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Jul 23 05:19:40 2022 +0200

tdf#150093 add scrollbar to calc general options for the case it doesn't fit

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

diff --git a/sc/uiconfig/scalc/ui/scgeneralpage.ui 
b/sc/uiconfig/scalc/ui/scgeneralpage.ui
index 492f425df6a9..c078b2240197 100644
--- a/sc/uiconfig/scalc/ui/scgeneralpage.ui
+++ b/sc/uiconfig/scalc/ui/scgeneralpage.ui
@@ -1,70 +1,70 @@
 
-
+
 
   
   
 0.5
 99.99
 1.25
-0.1
-0.1
+0.10
+0.10
   
   
 True
-False
-6
+False
+6
 vertical
 12
 
   
 True
-False
-0
-none
+False
+0
+none
 
-  
+  
   
 True
-False
-3
-6
+False
 12
 6
+3
+6
 
   
 True
-False
+False
 Measurement _unit:
-True
-unitlb
+True
+unitlb
 0
   
   
-0
-0
+0
+0
   
 
 
   
 True
-False
+False
 _Tab stops:
-True
-tabmf
+True
+tabmf
 0
   
   
-0
-1
+0
+1
   
 
 
   
 True
-True
+True
+True
 adjustment1
 2
-True
 
   
 Defines the tab stops 
distance.
@@ -72,14 +72,14 @@
 
   
   
-1
-1
+1
+1
   
 
 
   
 True
-False
+False
 
   
 Defines the unit of measure in 
spreadsheets.
@@ -87,8 +87,8 @@
 
   
   
-1
-0
+1
+0
   
 
   
@@ -96,7 +96,7 @@
 
   
 True
-False
+False
 Metrics
 
   
@@ -113,26 +113,26 @@
 
   
 True
-False
-0
-none
+False
+0
+none
 
   
 True
-False
-vertical
-3
+False
 12
 6
+vertical
+3
 
   
 _Always (from trusted locations)
 True
-True
-False
-True
+True
+False
+True
 True
-True
+True
   
   
 False
@@ -144,10 +144,10 @@
   
 _On request
 True
-True
-False
-True
-True
+True
+False
+True
+True
 alwaysrb
   
   
@@ -160,10 +160,10 @@
   
 _Never
 True
-True
-False
-True
-True
+True
+False
+True
+True
 alwaysrb
   
   
@@ -177,7 +177,7 @@
 
   
 True
-False
+False
 Update links when opening
 0
 
@@ -195,229 +195,247 @@
 
   
 True
-False
-0
-none
+False
+True
+0
+none
 
-  
-  
+  
 True
-False
-3
-6
-12
-6
-
-  
-Press Enter to switch to _edit 
mode
-True
-True
-False
-  

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

2022-07-22 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx |2 ++
 sw/source/filter/ww8/docxexport.cxx|   29 ++---
 2 files changed, 16 insertions(+), 15 deletions(-)

New commits:
commit fa5d80106080fa305479758dd43d0defb684376a
Author: Justin Luth 
AuthorDate: Fri Jul 22 13:31:33 2022 -0400
Commit: Justin Luth 
CommitDate: Sat Jul 23 04:45:23 2022 +0200

related tdf#145998 docx export: fix writing blank headers/footers

That perpetual m_bHasHdr variable was really confusing,
and it was completely misused (by me). This change should make
it much easier to understand the purpose.

To do this completely efficiently would require multiple variables
for each type, but this is good enough.
(It just means we might create a few more empty headers than is
absolutely necessary.)

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

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index d1c565e1fbc4..5838f8dcb93e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -493,6 +493,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf145998_unnecessaryPageStyles)
 CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName"));
 // CPPUNIT_ASSERT_EQUAL(OUString("Default page style - first page style"),
 //  parseDump("/root/page[3]/header/txt"));
+CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page[3]/footer/txt"));
 
 // Page Style is converted into a page break instead. Shows the "normal" 
header.
 xPara.set(getParagraph(5, "4"), uno::UNO_QUERY_THROW);
@@ -503,6 +504,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf145998_unnecessaryPageStyles)
 // Page Style is retained (with wrong header) in order to preserve page 
re-numbering.
 xPara.set(getParagraph(7, "1"), uno::UNO_QUERY_THROW);
 CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName"));
+CPPUNIT_ASSERT_EQUAL(OUString(), parseDump("/root/page[5]/footer/txt"));
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf135216_evenOddFooter)
diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index eddb4c2ea147..88f397026ff7 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -263,6 +263,10 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 
nHeadFootFlags,
 // Turn ON flag for 'Writing Headers \ Footers'
 m_pAttrOutput->SetWritingHeaderFooter( true );
 
+const bool bPrevSectionHadHeader = m_bHasHdr;
+const bool bPrevSectionHadFooter = m_bHasFtr;
+m_bHasHdr = m_bHasFtr = false;
+
 // headers
 if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN )
 WriteHeaderFooter( &rLeftHeaderFormat, true, "even" );
@@ -270,22 +274,19 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 
nHeadFootFlags,
 {
 if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD )
 WriteHeaderFooter( &rFormat, true, "even" );
-else if ( m_bHasHdr && nBreakCode == 2 )
+else if (bPrevSectionHadHeader && nBreakCode == 2)
 WriteHeaderFooter( nullptr, true, "even" );
 }
 
 if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD )
 WriteHeaderFooter( &rFormat, true, "default" );
+else if (bPrevSectionHadHeader && nBreakCode == 2) // 2: nextPage
+WriteHeaderFooter(nullptr, true, "default");
 
 if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST )
 WriteHeaderFooter( &rFirstPageFormat, true, "first" );
-
-if( (nHeadFootFlags & (nsHdFtFlags::WW8_HEADER_EVEN
- | nsHdFtFlags::WW8_HEADER_ODD
- | nsHdFtFlags::WW8_HEADER_FIRST)) == 0
-&& m_bHasHdr && nBreakCode == 2 ) // 2: nexPage
-WriteHeaderFooter( nullptr, true, "default" );
-
+else if (bPrevSectionHadHeader && nBreakCode == 2)
+WriteHeaderFooter(nullptr, true, "first");
 
 // footers
 if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN )
@@ -294,21 +295,19 @@ void DocxExport::WriteHeadersFooters( sal_uInt8 
nHeadFootFlags,
 {
 if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD )
WriteHeaderFooter( &rFormat, false, "even" );
-else if ( m_bHasFtr && nBreakCode == 2 )
+else if (bPrevSectionHadFooter && nBreakCode == 2)
 WriteHeaderFooter( nullptr, false, "even");
 }
 
 if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD )
 WriteHeaderFooter( &rFormat, false, "default" );
+else if (bPrevSectionHadFooter && nBreakCode == 2)
+WriteHeaderFooter(nullptr, false, "default");
 
 if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST )
 WriteHeaderFooter( &rFirstPageFormat, false, "first" );
-
-if( (nHeadFootFlags & (nsHdFtFlags::WW8_FOOTER_EVEN
-

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

2022-07-22 Thread Eike Rathke (via logerrit)
 wizards/source/euro/Init.xba|   16 
 wizards/source/resources/resources_en_US.properties |1 +
 2 files changed, 17 insertions(+)

New commits:
commit b1a2f727ca99ecd3402d4b051b99cbfd24266e59
Author: Eike Rathke 
AuthorDate: Fri Jul 22 22:17:11 2022 +0200
Commit: Eike Rathke 
CommitDate: Sat Jul 23 02:18:41 2022 +0200

Related: tdf#150011 Add HRK Croatian Kuna to Euro conversion wizard

Maybe just for completeness, it's removed from menu but might be
callable as macro.

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

diff --git a/wizards/source/euro/Init.xba b/wizards/source/euro/Init.xba
index 623a0a53be46..9f56c503a347 100644
--- a/wizards/source/euro/Init.xba
+++ b/wizards/source/euro/Init.xba
@@ -89,6 +89,7 @@ Public sCurrSLOVAK as String
 Public sCurrESTONIAN as String
 Public sCurrLATVIAN as String
 Public sCurrLITHUANIAN as String
+Public sCurrCROATIAN as String
 
 Public sPrgsRETRIEVAL as String
 Public sPrgsCONVERTING as String
@@ -214,6 +215,7 @@ Dim LocWorkPath as String
sCurrESTONIAN = GetResText("CURRENCIES_16")
sCurrLATVIAN = GetResText("CURRENCIES_17")
sCurrLITHUANIAN = GetResText("CURRENCIES_18")
+   sCurrCROATIAN = GetResText("CURRENCIES_19")
.cmdCancel.Label =  sCANCEL
.cmdHelp.Label =  sHELP
.cmdBack.Label =  GetResText("STEP_ZERO_2")
@@ -393,6 +395,11 @@ Sub InitializeLanguages()
 LangIDValue(18,0,1) = "LT"
 LangIDValue(18,0,2) = "-427"
 
+' CURRENCIES_CROATIAN
+LangIDValue(19,0,0) = "hr"
+LangIDValue(19,0,1) = "HR"
+LangIDValue(19,0,2) = "-41A"
+
 End Sub
 
 
@@ -572,6 +579,15 @@ Dim i as Integer
CurrValue(18,4) = "Lt"
CurrValue(18,5) = "LTL"
 
+   CurrValue(19,0) = sCurrCROATIAN
+   ' real conversion rate
+   CurrValue(19,1) = 7.53450
+   ' rounded conversion rate
+   CurrValue(19,2) = 7.5
+   CurrValue(19,3) = "kn"
+   CurrValue(19,4) = "kn"
+   CurrValue(19,5) = "HRK"
+
i = -1
CurrSymbolList(0) = ""
CurrSymbolList(1) = ""
diff --git a/wizards/source/resources/resources_en_US.properties 
b/wizards/source/resources/resources_en_US.properties
index 32f9104e97e0..8649b2500e6a 100644
--- a/wizards/source/resources/resources_en_US.properties
+++ b/wizards/source/resources/resources_en_US.properties
@@ -448,6 +448,7 @@ CURRENCIES_15=Slovak Koruna
 CURRENCIES_16=Estonian Kroon
 CURRENCIES_17=Latvian Lats
 CURRENCIES_18=Lithuanian Litas
+CURRENCIES_19=Croatian Kuna
 STEP_LASTPAGE_0=Progress
 STEP_LASTPAGE_1=Retrieving the relevant documents...
 STEP_LASTPAGE_2=Converting the documents...


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

2022-07-22 Thread Eike Rathke (via logerrit)
 i18npool/source/localedata/data/hr_HR.xml  |8 
 officecfg/registry/data/org/openoffice/Office/Calc.xcu |   11 +++
 sc/source/core/tool/interpr2.cxx   |3 ++-
 3 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 7c4b2db21ef77b37daf234ac1ab9989234606a22
Author: Eike Rathke 
AuthorDate: Fri Jul 22 22:12:02 2022 +0200
Commit: Eike Rathke 
CommitDate: Fri Jul 22 23:04:58 2022 +0200

Resolves: tdf#150011 Add HRK Croatian Kuna conversion to EUR Euro

TODO: switch defaults before 2023-01-01 in
i18npool/source/localedata/data/hr_HR.xml

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

diff --git a/i18npool/source/localedata/data/hr_HR.xml 
b/i18npool/source/localedata/data/hr_HR.xml
index 0c493131e16b..4de83e5535cd 100644
--- a/i18npool/source/localedata/data/hr_HR.xml
+++ b/i18npool/source/localedata/data/hr_HR.xml
@@ -421,6 +421,14 @@
   Hrvatska Kuna
   2
 
+
+
+  EUR
+  €
+  EUR
+  Euro
+  2
+
   
   
 
diff --git a/officecfg/registry/data/org/openoffice/Office/Calc.xcu 
b/officecfg/registry/data/org/openoffice/Office/Calc.xcu
index a62d06512704..eda60fe6c434 100644
--- a/officecfg/registry/data/org/openoffice/Office/Calc.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Calc.xcu
@@ -228,6 +228,17 @@
 3.45280
   
 
+
+  
+EUR
+  
+  
+HRK
+  
+  
+7.53450
+  
+
   
   
 
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 31c42a4b728a..67fcd9f787f8 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -3235,7 +3235,8 @@ static bool lclConvertMoney( const OUString& aSearchUnit, 
double& rfRate, int& r
 { "SKK", 30.1260,  2 },
 { "EEK", 15.6466,  2 },
 { "LVL", 0.702804, 2 },
-{ "LTL", 3.45280,  2 }
+{ "LTL", 3.45280,  2 },
+{ "HRK", 7.53450,  2 }
 };
 
 for (const auto & i : aConvertTable)


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

2022-07-22 Thread Noel Grandin (via logerrit)
 sw/source/core/crsr/pam.cxx |   20 
 1 file changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 2053fac9a81927a92aac016eab1b4525c058ce95
Author: Noel Grandin 
AuthorDate: Fri Jul 22 11:49:07 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 22 22:01:35 2022 +0200

tdf#119840 tweak SwPosition::operator<

It is slightly cheaper to check for == first, because that doesn't
require fetching data via a pointer to another object.

Shaves 7% off load time

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

diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index f771e09f5739..16c7e6ec21d8 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -79,8 +79,7 @@ SwPosition::SwPosition( SwContentNode & rNode, const 
sal_Int32 nOffset )
 
 bool SwPosition::operator<(const SwPosition &rPos) const
 {
-if( nNode < rPos.nNode )
-return true;
+// cheaper to check for == first
 if( nNode == rPos.nNode )
 {
 // note that positions with text node but no SwIndex registered are
@@ -96,13 +95,12 @@ bool SwPosition::operator<(const SwPosition &rPos) const
 return pOtherReg != nullptr;
 }
 }
-return false;
+return nNode < rPos.nNode;
 }
 
 bool SwPosition::operator>(const SwPosition &rPos) const
 {
-if(nNode > rPos.nNode )
-return true;
+// cheaper to check for == first
 if( nNode == rPos.nNode )
 {
 // note that positions with text node but no SwIndex registered are
@@ -118,13 +116,12 @@ bool SwPosition::operator>(const SwPosition &rPos) const
 return pThisReg != nullptr;
 }
 }
-return false;
+return nNode > rPos.nNode;
 }
 
 bool SwPosition::operator<=(const SwPosition &rPos) const
 {
-if(nNode < rPos.nNode )
-return true;
+// cheaper to check for == first
 if( nNode == rPos.nNode )
 {
 // note that positions with text node but no SwIndex registered are
@@ -140,13 +137,12 @@ bool SwPosition::operator<=(const SwPosition &rPos) const
 return pThisReg == nullptr;
 }
 }
-return false;
+return nNode < rPos.nNode;
 }
 
 bool SwPosition::operator>=(const SwPosition &rPos) const
 {
-if(nNode > rPos.nNode )
-return true;
+// cheaper to check for == first
 if( nNode == rPos.nNode )
 {
 // note that positions with text node but no SwIndex registered are
@@ -162,7 +158,7 @@ bool SwPosition::operator>=(const SwPosition &rPos) const
 return pOtherReg == nullptr;
 }
 }
-return false;
+return nNode > rPos.nNode;
 }
 
 bool SwPosition::operator==(const SwPosition &rPos) const


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

2022-07-22 Thread Caolán McNamara (via logerrit)
 vcl/unx/gtk3/gtkinst.cxx |   53 +++
 1 file changed, 40 insertions(+), 13 deletions(-)

New commits:
commit ed2e37de2d2d26d996e001a3eaade802a2d716fa
Author: Caolán McNamara 
AuthorDate: Fri Jul 22 15:29:34 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 21:06:23 2022 +0200

gtk: honour disabled columns from set_column_editable for start_editing

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

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 08cc2b6a7ef1..05a0622577c2 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -15890,32 +15890,59 @@ public:
 
 virtual void start_editing(const weld::TreeIter& rIter) override
 {
-GtkTreeViewColumn* pColumn = 
GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, m_nTextView));
-assert(pColumn && "wrong column");
-
 const GtkInstanceTreeIter& rGtkIter = static_cast(rIter);
 GtkTreePath* path = gtk_tree_model_get_path(m_pTreeModel, 
const_cast(&rGtkIter.iter));
 
-// allow editing of cells which are not usually editable, so we can 
have double click
-// do its usual row-activate but if we explicitly want to edit (remote 
files dialog)
+GtkTreeViewColumn* pColumn = nullptr;
+
+for (GList* pEntry = g_list_first(m_pColumns); pEntry; pEntry = 
g_list_next(pEntry))
+{
+GtkTreeViewColumn* pTestColumn = 
GTK_TREE_VIEW_COLUMN(pEntry->data);
+
+// see if this column is editable
+gboolean is_editable(false);
+GList *pRenderers = 
gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(pTestColumn));
+for (GList* pRenderer = g_list_first(pRenderers); pRenderer; 
pRenderer = g_list_next(pRenderer))
+{
+GtkCellRenderer* pCellRenderer = 
GTK_CELL_RENDERER(pRenderer->data);
+if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
+{
+g_object_get(pCellRenderer, "editable", &is_editable, 
nullptr);
+if (is_editable)
+{
+pColumn = pTestColumn;
+break;
+}
+}
+}
+g_list_free(pRenderers);
+
+if (is_editable)
+break;
+}
+
+// if nothing explicit editable, allow editing of cells which are not
+// usually editable, so we can have double click do its usual
+// row-activate but if we explicitly want to edit (remote files dialog)
 // we can still do that
-GList *pRenderers = 
gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(pColumn));
-for (GList* pRenderer = g_list_first(pRenderers); pRenderer; pRenderer 
= g_list_next(pRenderer))
+if (!pColumn)
 {
-GtkCellRenderer* pCellRenderer = 
GTK_CELL_RENDERER(pRenderer->data);
-if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
+pColumn = GTK_TREE_VIEW_COLUMN(g_list_nth_data(m_pColumns, 
m_nTextView));
+assert(pColumn && "wrong column");
+
+GList *pRenderers = 
gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(pColumn));
+for (GList* pRenderer = g_list_first(pRenderers); pRenderer; 
pRenderer = g_list_next(pRenderer))
 {
-gboolean is_editable(false);
-g_object_get(pCellRenderer, "editable", &is_editable, nullptr);
-if (!is_editable)
+GtkCellRenderer* pCellRenderer = 
GTK_CELL_RENDERER(pRenderer->data);
+if (GTK_IS_CELL_RENDERER_TEXT(pCellRenderer))
 {
 g_object_set(pCellRenderer, "editable", true, 
"editable-set", true, nullptr);
 g_object_set_data(G_OBJECT(pCellRenderer), 
"g-lo-RestoreNonEditable", reinterpret_cast(true));
 break;
 }
 }
+g_list_free(pRenderers);
 }
-g_list_free(pRenderers);
 
 gtk_tree_view_scroll_to_cell(m_pTreeView, path, pColumn, false, 0, 0);
 gtk_tree_view_set_cursor(m_pTreeView, path, pColumn, true);


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

2022-07-22 Thread Michael Stahl (via logerrit)
 vcl/source/treelist/svtabbx.cxx |   10 ++
 1 file changed, 10 insertions(+)

New commits:
commit fe38553aef2121f358fb58e450ec69314aad851e
Author: Michael Stahl 
AuthorDate: Fri Jul 22 16:19:02 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 21:04:34 2022 +0200

vcl: allow editing a column other than the first one in SvTabListBox

There are 2 members mvTabList and aTabs in SvTabListBox and
SvTreeListBox, and only aTabs is evaluated to determine which column
should be edited when calling start_editing().

This solution is probably not ideal; it would be better to have a
parameter to select the column because one might want multiple editable
columns with multiple buttons...

Also, the native GTK implementation has the same bug (but there
double-clicking the column works).

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

diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx
index d4fb5db37c39..f1277eafd41a 100644
--- a/vcl/source/treelist/svtabbx.cxx
+++ b/vcl/source/treelist/svtabbx.cxx
@@ -153,6 +153,16 @@ void SvTabListBox::SetTabs()
 }
 */
 
+// the 1st column (index 1 or 2 depending on button flags) is always set
+// editable by SvTreeListBox::SetTabs(),
+// which prevents setting a different column to editable as the first
+// one with the flag is picked in SvTreeListBox::ImplEditEntry()
+assert(aTabs.back()->nFlags & SvLBoxTabFlags::EDITABLE);
+if (!(mvTabList[0].nFlags & SvLBoxTabFlags::EDITABLE))
+{
+aTabs.back()->nFlags &= ~SvLBoxTabFlags::EDITABLE;
+}
+
 // append all other tabs to the list
 for( sal_uInt16 nCurTab = 1; nCurTab < sal_uInt16(mvTabList.size()); 
nCurTab++ )
 {


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

2022-07-22 Thread Justin Luth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport15.cxx|   30 
++
 sw/source/filter/ww8/ww8atr.cxx   |   18 +-
 3 files changed, 47 insertions(+), 1 deletion(-)

New commits:
commit c37f62b71fa59917ef85ff98480dff18aa936e41
Author: Justin Luth 
AuthorDate: Wed Jul 20 13:03:13 2022 -0400
Commit: Justin Luth 
CommitDate: Fri Jul 22 20:12:19 2022 +0200

tdf#145998 sw ms export: use page break, not section break

If possible, use a simple page break instead of a section break.

Eliminate unnecessary "page style" changes. If the page will
become that style anyway, then a simple page break will suffice.

The benefit is primarily for LO import, since it is virtually
impossible on import to know if a section is identical
to the previous section. Thus we have previously multiplied
page styles - often redundantly.

This also starts to fix a real problem with first headers showing up
on an unnecessary new page style. Unit test deals with this.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt 
b/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt
new file mode 100644
index ..82087eb6919f
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf145998_unnecessaryPageStyles.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 1537739acd1c..d1c565e1fbc4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -475,6 +475,36 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf98000_changePageStyle)
 CPPUNIT_ASSERT_MESSAGE("Different page1/page2 styles", sPageOneStyle != 
sPageTwoStyle);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf145998_unnecessaryPageStyles)
+{
+loadAndReload("tdf145998_unnecessaryPageStyles.odt");
+
+// Sanity check - always good to test when dealing with page styles and 
breaks.
+CPPUNIT_ASSERT_EQUAL(5, getPages());
+
+// Page Style should be explicitly mentioned - otherwise it would be a 
"follow" style
+uno::Reference xPara(getParagraph(2, "2"), 
uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName"));
+// CPPUNIT_ASSERT_EQUAL(OUString("First Page header"),
+//  parseDump("/root/page[2]/header/txt"));
+
+// Page Style is converted into a page break instead. Still shows "first" 
header.
+xPara.set(getParagraph(3, "3"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName"));
+// CPPUNIT_ASSERT_EQUAL(OUString("Default page style - first page style"),
+//  parseDump("/root/page[3]/header/txt"));
+
+// Page Style is converted into a page break instead. Shows the "normal" 
header.
+xPara.set(getParagraph(5, "4"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT_EQUAL(uno::Any(), xPara->getPropertyValue("PageDescName"));
+CPPUNIT_ASSERT_EQUAL(OUString("Default page style"),
+ parseDump("/root/page[4]/header/txt"));
+
+// Page Style is retained (with wrong header) in order to preserve page 
re-numbering.
+xPara.set(getParagraph(7, "1"), uno::UNO_QUERY_THROW);
+CPPUNIT_ASSERT(uno::Any() != xPara->getPropertyValue("PageDescName"));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf135216_evenOddFooter)
 {
 loadAndReload("tdf135216_evenOddFooter.odt");
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3ee28ea30140..cb86dd31973e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -520,7 +520,23 @@ void MSWordExportBase::OutputSectionBreaks( const 
SfxItemSet *pSet, const SwNode
 if ( pItem && pItem->GetRegisteredIn() != nullptr)
 {
 bBreakSet = true;
-bNewPageDesc = true;
+// Avoid unnecessary section breaks if possible. LO can't notice 
identical
+// sections during import, so minimize unnecessary duplication
+// by substituting a simple page break when the resulting section 
is identical,
+// unless this is needed to re-number the page.
+if (!bNewPageDesc && !pItem->GetNumOffset() && m_pCurrentPageDesc
+&& m_pCurrentPageDesc->GetFollow() == pItem->GetPageDesc())
+{
+// A section break on the very first paragraph is ignored by 
LO/Word
+// and should NOT be turned into a page break.
+SwNodeIndex aDocEnd(m_rDoc.GetNodes().GetEndOfContent());
+SwNodeIndex aStart(*aDocEnd.GetNode().StartOfSectionNode(), 2);
+i

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

2022-07-22 Thread Gülşah Köse (via logerrit)
 sw/source/uibase/dbui/dbmgr.cxx |   37 ++---
 1 file changed, 18 insertions(+), 19 deletions(-)

New commits:
commit e954b945536fdf0fd4aa3d56aec5c1e2ce4c6196
Author: Gülşah Köse 
AuthorDate: Fri Jul 8 14:48:27 2022 +0300
Commit: Aron Budea 
CommitDate: Fri Jul 22 19:06:37 2022 +0200

tdf#149915 Proper creation of vnd.sun.star.pkg:// URL

Using different methods of creation (one using DecodeMechanism::NONE,
another using DecodeMechanism::WithCharset) gave differently encoded
end results, comparing unequal.

The proper way is using DecodeMechanism::NONE on the document's URL,
as implemented in commit 06756e412b2a02030ce3355b3fe4e2ecc71d2301
  Author Mike Kaganski 
  Date   Sat Nov 18 22:41:40 2017 +0300
One more proper construction of vnd.sun.star.pkg URL

Co-authored-by: Mike Kaganski 

Change-Id: I272f277ef8b4bd23e6cb7884e68f3c79f742683a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136901
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 
(cherry picked from commit 9790585a62cb55e0e0024819596592193a6de269)

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 475388d2134e..9ad6184de3ac 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -134,6 +134,21 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 
nStrId, SfxObjectShell* pD
pDocShell));
 }
 
+// Construct vnd.sun.star.pkg:// URL
+OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, 
std::u16string_view rStreamRelPath)
+{
+auto xContext(comphelper::getProcessComponentContext());
+auto xUri = 
css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL);
+assert(xUri.is());
+xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)
+->createVndSunStarPkgUrlReference(xUri);
+assert(xUri.is());
+return xUri->getUriReference() + "/"
++ INetURLObject::encode(
+rStreamRelPath, INetURLObject::PART_FPATH,
+INetURLObject::EncodeMechanism::All);
+}
+
 }
 
 std::vector> 
SwDBManager::m_aUncommittedRegistrations;
@@ -254,10 +269,9 @@ void SAL_CALL 
SwDataSourceRemovedListener::revokedDatabaseLocation(const sdb::Da
 if (!pDocShell)
 return;
 
-OUString aOwnURL = 
pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::WithCharset);
-OUString sTmpName = "vnd.sun.star.pkg://" +
-INetURLObject::encode(aOwnURL, INetURLObject::PART_AUTHORITY, 
INetURLObject::EncodeMechanism::All);
-sTmpName += "/" + m_pDBManager->getEmbeddedName();
+const OUString sTmpName = ConstructVndSunStarPkgUrl(
+
pDocShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::NONE),
+m_pDBManager->getEmbeddedName());
 
 if (sTmpName != rEvent.OldLocation)
 return;
@@ -2760,21 +2774,6 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType 
type, const uno::Reference
 }
 return sFind;
 }
-
-// Construct vnd.sun.star.pkg:// URL
-OUString ConstructVndSunStarPkgUrl(const OUString& rMainURL, 
std::u16string_view rStreamRelPath)
-{
-auto xContext(comphelper::getProcessComponentContext());
-auto xUri = 
css::uri::UriReferenceFactory::create(xContext)->parse(rMainURL);
-assert(xUri.is());
-xUri = css::uri::VndSunStarPkgUrlReferenceFactory::create(xContext)
-->createVndSunStarPkgUrlReference(xUri);
-assert(xUri.is());
-return xUri->getUriReference() + "/"
-+ INetURLObject::encode(
-rStreamRelPath, INetURLObject::PART_FPATH,
-INetURLObject::EncodeMechanism::All);
-}
 }
 
 OUString SwDBManager::LoadAndRegisterDataSource(weld::Window* pParent, 
SwDocShell* pDocShell)


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

2022-07-22 Thread PoonamShokeen (via logerrit)
 include/framework/interaction.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 053f470316b89b6fcea1fac69e6bffd4f65f91ee
Author: PoonamShokeen 
AuthorDate: Wed Jul 20 22:25:14 2022 -0500
Commit: Ilmari Lauhakangas 
CommitDate: Fri Jul 22 19:53:13 2022 +0200

tdf#143148 Use pragma once instead of include guards

Change-Id: I7061e0985c51910ba6a8b862cd755b8b4f7016bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137279
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/include/framework/interaction.hxx 
b/include/framework/interaction.hxx
old mode 100644
new mode 100755
index 4700d19200c9..33647e241b89
--- a/include/framework/interaction.hxx
+++ b/include/framework/interaction.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_FRAMEWORK_INTERACTION_HXX
-#define INCLUDED_FRAMEWORK_INTERACTION_HXX
+#pragma once
 
 #include 
 #include 
@@ -100,6 +99,4 @@ public:
 
 } //  namespace framework
 
-#endif // #define INCLUDED_FRAMEWORK_INTERACTION_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: configure.ac

2022-07-22 Thread Luboš Luňák (via logerrit)
 configure.ac |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8a97da679bbccf81e73dc5d2e864b5f40adfc0eb
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 17:01:38 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:17:30 2022 +0200

fix clang-cl check on WSL

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

diff --git a/configure.ac b/configure.ac
index f81492852b8c..33dc0fb96316 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12193,9 +12193,9 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != 
TRUE; then
 AC_MSG_CHECKING([for clang-cl])
 if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then
 LO_CLANG_CC=`win_short_path_for_make 
"$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"`
-elif test -n "$PROGRAMFILES" -a -x 
"$PROGRAMFILES/LLVM/bin/clang-cl.exe"; then
+elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u 
"$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then
 LO_CLANG_CC=`win_short_path_for_make 
"$PROGRAMFILES/LLVM/bin/clang-cl.exe"`
-elif test -x "c:/Program Files/LLVM/bin/clang-cl.exe"; then
+elif test -x "$(cygpath -u "c:/Program 
Files/LLVM/bin/clang-cl.exe")"; then
 LO_CLANG_CC=`win_short_path_for_make "c:/Program 
Files/LLVM/bin/clang-cl.exe"`
 fi
 if test -n "$LO_CLANG_CC"; then


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

2022-07-22 Thread Luboš Luňák (via logerrit)
 configure.ac |  112 +--
 1 file changed, 78 insertions(+), 34 deletions(-)

New commits:
commit f6882d91ad8d2219aa6fdc1583507910ee103e2b
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 16:53:32 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:16:59 2022 +0200

fix configure handling of tarball path on WSL

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

diff --git a/configure.ac b/configure.ac
index 3b96ba195226..f81492852b8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -190,7 +190,9 @@ AbsolutePath()
 # Args: $1: A possibly relative pathname
 # Return value: $absolute_path
 
-local rel="$1"
+# Convert to unix path, mkdir would treat c:/path as a relative path.
+PathFormat "$1"
+local rel="$formatted_path_unix"
 absolute_path=""
 test ! -e "$rel" && mkdir -p "$rel"
 if test -d "$rel" ; then
@@ -6081,7 +6083,7 @@ if test -z "$TARFILE_LOCATION"; then
 else
 AbsolutePath "$TARFILE_LOCATION"
 PathFormat "${absolute_path}"
-TARFILE_LOCATION="${formatted_path}"
+TARFILE_LOCATION="${formatted_path_unix}"
 fi
 AC_SUBST(TARFILE_LOCATION)
 
commit c93e40ea0be17b586c30fc3b53c5f8193f26cd79
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 16:31:03 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:16:45 2022 +0200

configure fixes for WSL

- Enabling some Cygwin checks also for WSL.
- Handling of Windows paths as needed for WSL.
- Reading of registry using wsl-lo-helper as WSL doesn't provide registry
  in /proc the way Cygwin does.
Configure now passes for me (with Skia and Java disabled).

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

diff --git a/configure.ac b/configure.ac
index 67493ea442e7..3b96ba195226 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3849,6 +3849,31 @@ reg_get_value_64()
 reg_get_value "64" "$1"
 }
 
+reg_list_values()
+{
+# Return value: $reglist
+unset reglist
+
+if test "$build_os" = "wsl"; then
+reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d 
'\r')
+return
+fi
+
+reglist=$(ls "/proc/registry${1}/${2}")
+}
+
+# List values from the 32-bit side of the Registry
+reg_list_values_32()
+{
+reg_list_values "32" "$1"
+}
+
+# List values from the 64-bit side of the Registry
+reg_list_values_64()
+{
+reg_list_values "64" "$1"
+}
+
 case "$host_os" in
 cygwin*|wsl*)
 COM=MSC
@@ -6510,15 +6535,18 @@ find_al()
 # We need this check to detect 4.6.1 or above.
 for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do
 reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft 
SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder"
-if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f 
"$regvalue/bin/al.exe" \); then
+PathFormat "$regvalue"
+if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f 
"$formatted_path_unix/bin/al.exe" \); then
 altest=$regvalue
 return
 fi
 done
 
-for x in `ls 
/proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ 
SDKs/Windows`; do
+reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft 
SDKs/Windows"
+for x in $reglist; do
 reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft 
SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder"
-if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f 
"$regvalue/bin/al.exe" \); then
+PathFormat "$regvalue"
+if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f 
"$formatted_path_unix/bin/al.exe" \); then
 altest=$regvalue
 return
 fi
@@ -6804,26 +6832,30 @@ AC_SUBST(WINDOWS_SDK_LIB_SUBDIR)
 AC_SUBST(WINDOWS_SDK_VERSION)
 AC_SUBST(WINDOWS_SDK_WILANGID)
 
-if test "$build_os" = "cygwin"; then
+if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then
 dnl Check midl.exe; this being the first check for a tool in the SDK bin
 dnl dir, it also determines that dir's path w/o an arch segment if any,
 dnl WINDOWS_SDK_BINDIR_NO_ARCH:
 AC_MSG_CHECKING([for midl.exe])
 
 find_winsdk
+PathFormat "$winsdktest"
+winsdktest_unix="$formatted_path_unix"
+
 if test -n "$winsdkbinsubdir" \
--a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
+-a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe"
 then
 MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH
-WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir
-elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then
+WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME_u

[Libreoffice-commits] core.git: 2 commits - configure.ac solenv/wsl

2022-07-22 Thread Luboš Luňák (via logerrit)
 configure.ac |   20 +---
 solenv/wsl/README|8 
 solenv/wsl/wsl-lo-helper.cpp |8 
 3 files changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 981ba02267af461792c3ff30b8fecc5cd73497a3
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 15:59:50 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:16:29 2022 +0200

add fallback for $PROGRAMFILESX86

It's not set in my WSL, but since it's going to be c:\program files (x86)
in the vast majority of cases, just hardcode a fallback.

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

diff --git a/configure.ac b/configure.ac
index eca0ab405c85..67493ea442e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4052,6 +4052,9 @@ find_msvc()
 vs_versions_to_check "$1"
 if test "$build_os" = wsl; then
 vswhere="$PROGRAMFILESX86"
+if test -z "$vswhere"; then
+vswhere="c:\\Program Files (x86)"
+fi
 else
 vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')"
 fi
commit 4fbcededefa07a97aa9ca55986241a0dd0146806
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 15:57:53 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:16:16 2022 +0200

require wsl-lo-helper to be preinstalled, like 'make'

It is needed to even find MSVC, so configure cannot easily build it.

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

diff --git a/configure.ac b/configure.ac
index 2bf56df211d9..eca0ab405c85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ PathFormat()
 formatted_path=$(wslpath -w "$formatted_path")
 ;;
 esac
-formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 
"$formatted_path")
+formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path")
 elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then
 formatted_path=`cygpath -sm "$formatted_path"`
 else
@@ -355,7 +355,7 @@ if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i 
Microsoft 2>/dev/null
 ;;
 esac
 if test -n "$opt_d" -o -n "$opt_s"; then
-input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input")
+input=$($WSL_LO_HELPER --8.3 "$input")
 fi
 if test -n "$opt_m"; then
 input="${input//\\//}"
@@ -399,6 +399,17 @@ if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i 
Microsoft 2>/dev/null
 
 exit 0
 fi
+
+if test -z "$WSL_LO_HELPER"; then
+if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then
+WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper"
+elif test -x "/opt/lo/bin/wsl-lo-helper"; then
+WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper"
+fi
+fi
+if test -z "$WSL_LO_HELPER"; then
+AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.])
+fi
 fi
 
 AC_CANONICAL_HOST
@@ -3811,7 +3822,7 @@ reg_get_value()
 unset regvalue
 
 if test "$build_os" = "wsl"; then
-regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 
"$2" 2>/dev/null)
+regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null)
 return
 fi
 
diff --git a/solenv/wsl/README b/solenv/wsl/README
new file mode 100644
index ..a9609f08dce9
--- /dev/null
+++ b/solenv/wsl/README
@@ -0,0 +1,8 @@
+This is a tool that will be useful for various tasks when building LO on WSL.
+
+It is a Win32 program, not a Linux (WSL) one.
+
+Compile using the Developer Command Prompt from MSVC as:
+cl wsl-lo-helper.cpp advapi32.lib
+and the copy the executable to /opt/lo/bin (e.g. from shell as):
+sudo mv wsl-lo-helper.exe /opt/lo/bin/wsl-lo-helper
diff --git a/solenv/wsl/wsl-lo-helper.cpp b/solenv/wsl/wsl-lo-helper.cpp
index 1a90580b6f19..87285dcb1d3c 100644
--- a/solenv/wsl/wsl-lo-helper.cpp
+++ b/solenv/wsl/wsl-lo-helper.cpp
@@ -7,14 +7,6 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-/*
- * This is a tool that will be useful for various tasks if/when we build LO on 
WSL
- *
- * It is a Win32 program, not a Linux (WSL) one.
- *
- * Compile as: cl -MD wsl-lo-helper.cpp advapi32.lib
- */
-
 #include 
 #include 
 


[Libreoffice-commits] core.git: configure.ac

2022-07-22 Thread Luboš Luňák (via logerrit)
 configure.ac |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5a8a1c4a86938b65c5ea7807f60e721946d7d8de
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 14:55:28 2022 +0200
Commit: Luboš Luňák 
CommitDate: Fri Jul 22 19:15:53 2022 +0200

use uname for detecting WSL

There's no wslsys in my WSL setup.

I also don't see why WSL should be at least version 2, they both
should(?) work and it is recommended to use version 1 with NTFS
(and version 2 also doesn't work e.g. inside VirtualBox).

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

diff --git a/configure.ac b/configure.ac
index 6b7070c78d87..2bf56df211d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,9 +288,9 @@ dnl checks build and host OSes
 dnl do this before argument processing to allow for platform dependent defaults
 dnl ===
 
-# Check for WSL (version 2, at least). But if --host is explicitly specified 
(to really do build for
+# Check for WSL. But if --host is explicitly specified (to really do build for
 # Linux on WSL) trust that.
-if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then
+if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i Microsoft 
2>/dev/null)" != ""; then
 ac_cv_host="x86_64-pc-wsl"
 ac_cv_host_cpu="x86_64"
 ac_cv_host_os="wsl"


Re: Import of short values of textDirection, used by OOXML strict

2022-07-22 Thread Regina Henschel

Hi Miklos,

thank you. writerfilter/documentation/ooxml/model.rng makes indeed the 
relationships clearer. I have added a link to your mail to the bug report.


Kind regards,
Regina

Miklos Vajna schrieb am 22.07.2022 um 08:27:

Hi Regina,

On Thu, Jul 21, 2022 at 08:47:14PM +0200, Regina Henschel 
 wrote:

I can fix bug 149556 by adding the missing values to

in core/writerfilter/source/ooxml/model.xml.

Is that really all to do? Or do I miss something?


If you search for ST_TextDirection, there is also a matching .


If that is really all, it would be an Easyhack.

The issue is about the fact, that a short value 'lr' instead of the long
value 'btLr', for example, is not interpreted.


It's likely that you indeed just need a new entry in the relevant
 and  elements, see
writerfilter/documentation/ooxml/model.rng for details, where I tried to
document my understanding of that complex model.xml file.

Regards,

Miklos





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

2022-07-22 Thread Michael Weghorn (via logerrit)
 vcl/source/gdi/jobset.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 5b04eed4d22c9e3caa76e195582b15862e9261b6
Author: Michael Weghorn 
AuthorDate: Fri Jul 22 13:45:53 2022 +0100
Commit: Michael Weghorn 
CommitDate: Fri Jul 22 16:50:02 2022 +0200

tdf#147021 Use std::size in {Read,Write}JobSetup

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

diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index 04ba708ef9a3..04bc9daf98a6 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -259,9 +259,9 @@ SvStream& ReadJobSetup( SvStream& rIStream, JobSetup& 
rJobSetup )
 
 ImplJobSetup& rJobData = rJobSetup.ImplGetData();
 
-pData->cPrinterName[SAL_N_ELEMENTS(pData->cPrinterName) - 1] = 0;
+pData->cPrinterName[std::size(pData->cPrinterName) - 1] = 0;
 rJobData.SetPrinterName( OStringToOUString(pData->cPrinterName, 
aStreamEncoding) );
-pData->cDriverName[SAL_N_ELEMENTS(pData->cDriverName) - 1] = 0;
+pData->cDriverName[std::size(pData->cDriverName) - 1] = 0;
 rJobData.SetDriver( OStringToOUString(pData->cDriverName, 
aStreamEncoding) );
 
 // Are these our new JobSetup files?
@@ -363,9 +363,9 @@ SvStream& WriteJobSetup( SvStream& rOStream, const 
JobSetup& rJobSetup )
 
 ImplOldJobSetupData aOldData = {};
 OString aPrnByteName(OUStringToOString(rJobData.GetPrinterName(), 
RTL_TEXTENCODING_UTF8));
-strncpy(aOldData.cPrinterName, aPrnByteName.getStr(), 
SAL_N_ELEMENTS(aOldData.cPrinterName) - 1);
+strncpy(aOldData.cPrinterName, aPrnByteName.getStr(), 
std::size(aOldData.cPrinterName) - 1);
 OString aDriverByteName(OUStringToOString(rJobData.GetDriver(), 
RTL_TEXTENCODING_UTF8));
-strncpy(aOldData.cDriverName, aDriverByteName.getStr(), 
SAL_N_ELEMENTS(aOldData.cDriverName) - 1);
+strncpy(aOldData.cDriverName, aDriverByteName.getStr(), 
std::size(aOldData.cDriverName) - 1);
 int nPos = rOStream.Tell();
 rOStream.WriteUInt16( 0 );
 rOStream.WriteUInt16( JOBSET_FILE605_SYSTEM );


[Libreoffice-commits] core.git: Branch 'feature/cib_contract57d' - vcl/qa vcl/source

2022-07-22 Thread Miklos Vajna (via logerrit)
 vcl/qa/cppunit/pdfexport/data/reduce-small-image.fodt |   21 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx|   41 ++
 vcl/source/gdi/pdfwriter_impl2.cxx|6 +-
 3 files changed, 66 insertions(+), 2 deletions(-)

New commits:
commit 44f7eed9d4f9f9634e85e757172d5d3b5a5d534a
Author: Miklos Vajna 
AuthorDate: Mon Jan 20 17:53:25 2020 +0100
Commit: Gabor Kelemen 
CommitDate: Fri Jul 22 16:02:35 2022 +0200

PDF export: skip pointless downsampling for very small images

Regression from commit b6588bd7c831ce88a29131ca7ea8d3f3e082564e (Reduce
image resolution by default in PDF Export, 2014-03-02) the problem is
that in case you have small enough bitmaps, then these used to look
OK at reasonable zoom levels, but now we intentionally scale down
bitmaps by default.

That makes little sense for tiny images, do this only for large ones.

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

diff --git a/vcl/qa/cppunit/pdfexport/data/reduce-small-image.fodt 
b/vcl/qa/cppunit/pdfexport/data/reduce-small-image.fodt
new file mode 100644
index ..99ff22746e48
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/reduce-small-image.fodt
@@ -0,0 +1,21 @@
+
+http://www.w3.org/2003/g/data-view#"; 
xmlns:xhtml="http://www.w3.org/1999/xhtml"; 
xmlns:css3t="http://www.w3.org/TR/css3-text/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xforms="http://www.w3.org/2002/xforms"; 
xmlns:dom="http://www.w3.org/2001/xml-events"; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML"; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:oooc="http://openoffice.org/2004/calc"; 
xmlns:ooow="http://openoffice.org/2004/writer"; 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:tableooo="http://openoffice.org/2009/table"; 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.
 0" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/"; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:xlink="http://www.w3.org/1999/xlink"; 
xmlns:ooo="http://openoffice.org/2004/office"; 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office"; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:drawooo="http://openoffice.org/2010/draw"; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:rpt="http://op
 enoffice.org/2005/report" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+  
+
+
+
+
+  
+  
+
+  
+
+  
+  
+
+  iVBORw0KGgoNSUhEUgAAABAQCAYf8/9hMklEQVR42mP4//8/AyWYYXAZ
+   wHSK+z8pbOoaAJIgBWM1gFh/jxqAxwCKYmHgE9KAZSYAhK3Dgc2FxfUASUVORK5CYII=
+  
+
+  
+
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 32288d569728..602dd6a4a0b7 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -149,6 +149,7 @@ public:
 //BAD CPPUNIT_TEST(testTdf106972Pdf17);
 //BAD CPPUNIT_TEST(testTdf107018);
 //BAD CPPUNIT_TEST(testTdf107089);
+void testReduceSmallImage();
 
 CPPUNIT_TEST_SUITE(PdfExportTest);
 // CPPUNIT_TEST(testTdf106059);
@@ -186,6 +187,7 @@ public:
 CPPUNIT_TEST(testTdf115967);
 CPPUNIT_TEST(testTdf121615);
 CPPUNIT_TEST(testTocLink);
+CPPUNIT_TEST(testReduceSmallImage);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1830,6 +1832,45 @@ void PdfExportTest::testTocLink()
 CPPUNIT_ASSERT(FPDFLink_Enumerate(pPdfPage.get(), &nStartPos, 
&pLinkAnnot));
 }
 
+void PdfExportTest::testReduceSmallImage()
+{
+// Load the Writer document.
+OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"reduce-small-image.fodt";
+mxComponent = loadFromDesktop(aURL);
+
+// Save as PDF.
+uno::Reference xStorable(mxComponent, uno::UNO_QUERY);
+utl::MediaDescripto

[Libreoffice-commits] core.git: Branch 'private/mert/wip_deepl' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/sfx2 include/svtools include/svx include

2022-07-22 Thread Mert Tumer (via logerrit)
Rebased ref, commits from common ancestor:
commit 4407e3ce7334b179f777b043931ec071dbd7d3b0
Author: Mert Tumer 
AuthorDate: Tue Jul 5 12:03:27 2022 +0300
Commit: Mert Tumer 
CommitDate: Fri Jul 22 16:22:48 2022 +0300

new uno command uno:Translate with deepl api

New Uno command added for translation
right now it is only using deepl translation api

There's a section in the options > language settings
for setting up the api url and auth key

uno:Translate is a menu button under Format tab
which will bring up Language Selection dialog for translation.

DeepL can accept html as the input for translation, this new
feature leverages that by exporting paragraphs/selections to
html and paste them back without losing the formatting (in theory)
This works good in general but we may lose formatting in very complex
styled sentences.

Translation works in two ways;
1) Whole document
when there is no selection, it assumes that we want to translate whole
document. Each paragraphs is sent one by one so that the output timeout
can be minimum for each paragraph.
2) Selection

Signed-off-by: Mert Tumer 
Change-Id: Ia2d3ab2f6757faf565b939e1d670a7dedac33390

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index d455a64ab266..c4c0a52b2ef4 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 cui/source/options/optgenrl \
 cui/source/options/opthtml \
 cui/source/options/optlanguagetool \
+cui/source/options/optdeepl \
 cui/source/options/optinet2 \
 cui/source/options/optjava \
 cui/source/options/optjsearch \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 806779daaa9d..0ed879e2b228 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optgeneralpage \
cui/uiconfig/ui/opthtmlpage \
cui/uiconfig/ui/langtoolconfigpage \
+   cui/uiconfig/ui/deepltabpage \
cui/uiconfig/ui/optionsdialog \
cui/uiconfig/ui/optjsearchpage \
cui/uiconfig/ui/optlanguagespage \
diff --git a/cui/inc/treeopt.hrc b/cui/inc/treeopt.hrc
index 952b79ea92d4..6d5bc4004a53 100644
--- a/cui/inc/treeopt.hrc
+++ b/cui/inc/treeopt.hrc
@@ -55,7 +55,8 @@ const std::pair 
SID_LANGUAGE_OPTIONS_RES[] =
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"),  
RID_SVXPAGE_JSEARCH_OPTIONS },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"),  
RID_SVXPAGE_ASIAN_LAYOUT },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"),  
RID_SVXPAGE_OPTIONS_CTL },
-{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS }
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS },
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server Settings"),  
RID_SVXPAGE_DEEPL_OPTIONS }
 };
 
 const std::pair SID_INET_DLG_RES[] =
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index ..94b48ccc2f43
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include 
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage,
+   weld::DialogController* 
pController,
+   const SfxItemSet& rSet)
+: SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", 
&rSet)
+, m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+, m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get();
+m_xAPIUrl->set_text(rDeeplOptions.getAPIUrl());
+m_xAuthKey->set_text(rDeeplOptions.getAuthKey());
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptio

[Libreoffice-commits] core.git: Branch 'private/mert/wip_deepl' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/sfx2 include/svtools include/svx include

2022-07-22 Thread Mert Tumer (via logerrit)
Rebased ref, commits from common ancestor:
commit dcd9ddaa3f9d5f379fd4d786da825debdbb43db6
Author: Mert Tumer 
AuthorDate: Tue Jul 5 12:03:27 2022 +0300
Commit: Mert Tumer 
CommitDate: Fri Jul 22 16:13:10 2022 +0300

new uno command uno:Translate with deepl api

New Uno command added for translation
right now it is only using deepl translation api

There's a section in the options > language settings
for setting up the api url and auth key

uno:Translate is a menu button under Format tab
which will bring up Language Selection dialog for translation.

DeepL can accept html as the input for translation, this new
feature leverages that by exporting paragraphs/selections to
html and paste them back without losing the formatting (in theory)
This works good in general but we may lose formatting in very complex
styled sentences.

Translation works in two ways;
1) Whole document
when there is no selection, it assumes that we want to translate whole
document. Each paragraphs is sent one by one so that the output timeout
can be minimum for each paragraph.
2) Selection

Signed-off-by: Mert Tumer 
Change-Id: Ia2d3ab2f6757faf565b939e1d670a7dedac33390

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index d455a64ab266..c4c0a52b2ef4 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 cui/source/options/optgenrl \
 cui/source/options/opthtml \
 cui/source/options/optlanguagetool \
+cui/source/options/optdeepl \
 cui/source/options/optinet2 \
 cui/source/options/optjava \
 cui/source/options/optjsearch \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 806779daaa9d..0ed879e2b228 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optgeneralpage \
cui/uiconfig/ui/opthtmlpage \
cui/uiconfig/ui/langtoolconfigpage \
+   cui/uiconfig/ui/deepltabpage \
cui/uiconfig/ui/optionsdialog \
cui/uiconfig/ui/optjsearchpage \
cui/uiconfig/ui/optlanguagespage \
diff --git a/cui/inc/treeopt.hrc b/cui/inc/treeopt.hrc
index 952b79ea92d4..6d5bc4004a53 100644
--- a/cui/inc/treeopt.hrc
+++ b/cui/inc/treeopt.hrc
@@ -55,7 +55,8 @@ const std::pair 
SID_LANGUAGE_OPTIONS_RES[] =
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"),  
RID_SVXPAGE_JSEARCH_OPTIONS },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"),  
RID_SVXPAGE_ASIAN_LAYOUT },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"),  
RID_SVXPAGE_OPTIONS_CTL },
-{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS }
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS },
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server Settings"),  
RID_SVXPAGE_DEEPL_OPTIONS }
 };
 
 const std::pair SID_INET_DLG_RES[] =
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index ..94b48ccc2f43
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include 
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage,
+   weld::DialogController* 
pController,
+   const SfxItemSet& rSet)
+: SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", 
&rSet)
+, m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+, m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get();
+m_xAPIUrl->set_text(rDeeplOptions.getAPIUrl());
+m_xAuthKey->set_text(rDeeplOptions.getAuthKey());
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptio

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

2022-07-22 Thread Mike Kaganski (via logerrit)
 vcl/source/bitmap/bitmap.cxx |   59 ++-
 1 file changed, 31 insertions(+), 28 deletions(-)

New commits:
commit 4be04385c5e9838687ecade94dae9e59fcc30621
Author: Mike Kaganski 
AuthorDate: Fri Jul 22 10:18:26 2022 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jul 22 14:59:27 2022 +0200

Simplify paletted ctor logic

Change-Id: I2c04eaf758fe9050a023061746cb342f2b862952
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137324
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index ff5110a8ded1..f96bad8cb0f9 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -80,22 +80,19 @@ Bitmap::Bitmap( const Size& rSizePixel, vcl::PixelFormat 
ePixelFormat, const Bit
 if (!(rSizePixel.Width() && rSizePixel.Height()))
 return;
 
-BitmapPalette   aPal;
-BitmapPalette*  pRealPal = nullptr;
-
-if (vcl::isPalettePixelFormat(ePixelFormat))
+switch (ePixelFormat)
 {
-if( !pPal )
+case vcl::PixelFormat::N1_BPP:
 {
-if (ePixelFormat == vcl::PixelFormat::N1_BPP)
-{
-aPal.SetEntryCount( 2 );
-aPal[ 0 ] = COL_BLACK;
-aPal[ 1 ] = COL_WHITE;
-}
-else if (ePixelFormat == vcl::PixelFormat::N8_BPP)
-{
-aPal.SetEntryCount(1 << sal_uInt16(ePixelFormat));
+static const BitmapPalette aPalN1_BPP = { COL_BLACK, COL_WHITE };
+if (!pPal)
+pPal = &aPalN1_BPP;
+break;
+}
+case vcl::PixelFormat::N8_BPP:
+{
+static const BitmapPalette aPalN8_BPP = [] {
+BitmapPalette aPal(1 << sal_uInt16(vcl::PixelFormat::N8_BPP));
 aPal[ 0 ] = COL_BLACK;
 aPal[ 1 ] = COL_BLUE;
 aPal[ 2 ] = COL_GREEN;
@@ -114,26 +111,32 @@ Bitmap::Bitmap( const Size& rSizePixel, vcl::PixelFormat 
ePixelFormat, const Bit
 aPal[ 15 ] = COL_WHITE;
 
 // Create dither palette
-if (ePixelFormat == vcl::PixelFormat::N8_BPP)
-{
-sal_uInt16 nActCol = 16;
+sal_uInt16 nActCol = 16;
 
-for( sal_uInt16 nB = 0; nB < 256; nB += 51 )
-for( sal_uInt16 nG = 0; nG < 256; nG += 51 )
-for( sal_uInt16 nR = 0; nR < 256; nR += 51 )
-aPal[ nActCol++ ] = BitmapColor( 
static_cast(nR), static_cast(nG), 
static_cast(nB) );
+for( sal_uInt16 nB = 0; nB < 256; nB += 51 )
+for( sal_uInt16 nG = 0; nG < 256; nG += 51 )
+for( sal_uInt16 nR = 0; nR < 256; nR += 51 )
+aPal[ nActCol++ ] = BitmapColor( 
static_cast(nR), static_cast(nG), 
static_cast(nB) );
 
-// Set standard Office colors
-aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 );
-}
-}
+// Set standard Office colors
+aPal[ nActCol++ ] = BitmapColor( 0, 184, 255 );
+return aPal;
+}();
+if (!pPal)
+pPal = &aPalN8_BPP;
+break;
+}
+default:
+{
+static const BitmapPalette aPalEmpty;
+if (!pPal || !vcl::isPalettePixelFormat(ePixelFormat))
+pPal = &aPalEmpty;
+break;
 }
-else
-pRealPal = const_cast(pPal);
 }
 
 mxSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-mxSalBmp->Create(rSizePixel, ePixelFormat, pRealPal ? *pRealPal : aPal);
+mxSalBmp->Create(rSizePixel, ePixelFormat, *pPal);
 }
 
 #ifdef DBG_UTIL


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

2022-07-22 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |   24 
 sw/source/filter/html/css1atr.cxx  |   11 +++
 sw/source/filter/html/css1kywd.cxx |1 +
 sw/source/filter/html/css1kywd.hxx |1 +
 sw/source/filter/html/wrthtml.cxx  |7 +--
 5 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit 12269c021e785b8dca7e57a378d02023f7863d62
Author: Miklos Vajna 
AuthorDate: Thu Jul 21 15:40:58 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 14:55:05 2022 +0200

sw XHTML export: fix writing of section direction

The XHTML export behavior was the same as the HTML one for section text
direction, the  markup was used.

This shares code with the HTML filter, but it's not valid in
reqif-xhtml, while the CSS markup would be fine: .

Fix the problem by keeping the behavior unchanged for HTML, but switch
to inline CSS for XHTML.

The other similar attribute was "id", but that's fine even in XHTML.

(cherry picked from commit 3b7c18a579f3165c9d425d172d697f8978d6cd84)

Conflicts:
sw/qa/extras/htmlexport/htmlexport.cxx

Change-Id: I5797c90f9cf957dec7fc4074dd6e79dce11fada7

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index af92c6e1859c..7e674160c4f8 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -1734,6 +1734,30 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testLeadingTabHTML)
 assertXPathContent(pHtmlDoc, "/html/body/p", SAL_NEWLINE_STRING u"\xa0\xa0 
test");
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir)
+{
+// Given a document with a section:
+loadURL("private:factory/swriter", nullptr);
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Insert("test");
+pWrtShell->SelAll();
+SwSectionData aSectionData(SectionType::Content, "mysect");
+pWrtShell->InsertSection(aSectionData);
+
+// When exporting to (reqif-)xhtml:
+ExportToReqif();
+
+// Then make sure CSS is used to export the text direction of the section:
+SvMemoryStream aStream;
+HtmlExportTest::wrapFragment(maTempFile, aStream);
+xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+// Without the accompanying fix in place, this test would have failed with:
+// - XPath '//reqif-xhtml:div[@id='mysect']' no attribute 'style' exist
+// i.e. the dir="ltr" HTML attribute was used instead.
+assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", "dir: 
ltr");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 18ee264324f6..8a0bc881e1c8 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2143,6 +2143,17 @@ void SwHTMLWriter::OutCSS1_SectionFormatOptions( const 
SwFrameFormat& rFrameForm
 if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, 
&pItem ) )
 OutCSS1_SvxBrush( *this, *pItem, sw::Css1Background::Section, nullptr 
);
 
+if (mbXHTML)
+{
+SvxFrameDirection nDir = GetHTMLDirection(rFrameFormat.GetAttrSet());
+OString sConvertedDirection = convertDirection(nDir);
+if (!sConvertedDirection.isEmpty())
+{
+OutCSS1_Property(sCSS1_P_dir, sConvertedDirection.getStr(), 
nullptr,
+ sw::Css1Background::Section);
+}
+}
+
 if (pCol)
 {
 OString 
sColumnCount(OString::number(static_cast(pCol->GetNumCols(;
diff --git a/sw/source/filter/html/css1kywd.cxx 
b/sw/source/filter/html/css1kywd.cxx
index f8914dedb274..c0299e28c958 100644
--- a/sw/source/filter/html/css1kywd.cxx
+++ b/sw/source/filter/html/css1kywd.cxx
@@ -197,6 +197,7 @@ const char* const sCSS1_P_height = "height";
 const char* const sCSS1_P_float = "float";
 
 const char* const sCSS1_P_column_count = "column-count";
+const char* const sCSS1_P_dir = "dir";
 
 // Strings for positioning
 
diff --git a/sw/source/filter/html/css1kywd.hxx 
b/sw/source/filter/html/css1kywd.hxx
index 7c0e326fd86a..c4609c5659b1 100644
--- a/sw/source/filter/html/css1kywd.hxx
+++ b/sw/source/filter/html/css1kywd.hxx
@@ -200,6 +200,7 @@ extern const char* const sCSS1_P_height;
 extern const char* const sCSS1_P_float;
 
 extern const char* const sCSS1_P_column_count;
+extern const char* const sCSS1_P_dir;
 
 // Strings for positioning
 
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 995b1a291f3e..b8a48c2918f3 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -701,9 +701,12 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& 
rHTMLWrt,
 sOut.append('\"');
 }
 
-SvxFrameDirection nDir = rHTMLWrt.GetHTMLDi

[Libreoffice-commits] core.git: Branch 'private/mert/wip_deepl' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/sfx2 include/svtools include/svx include

2022-07-22 Thread Mert Tumer (via logerrit)
Rebased ref, commits from common ancestor:
commit c7da5fa2929433652b5007eecc0655011f43a3e6
Author: Mert Tumer 
AuthorDate: Tue Jul 5 12:03:27 2022 +0300
Commit: Mert Tumer 
CommitDate: Fri Jul 22 15:50:26 2022 +0300

new uno command uno:Translate with deepl api

New Uno command added for translation
right now it is only using deepl translation api

There's a section in the options > language settings
for setting up the api url and auth key

uno:Translate is a menu button under Format tab
which will bring up Language Selection dialog for translation.

DeepL can accept html as the input for translation, this new
feature leverages that by exporting paragraphs/selections to
html and paste them back without losing the formatting (in theory)
This works good in general but we may lose formatting in very complex
styled sentences.

Translation works in two ways;
1) Whole document
when there is no selection, it assumes that we want to translate whole
document. Each paragraphs is sent one by one so that the output timeout
can be minimum for each paragraph.
2) Selection

Signed-off-by: Mert Tumer 
Change-Id: Ia2d3ab2f6757faf565b939e1d670a7dedac33390

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index d455a64ab266..c4c0a52b2ef4 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 cui/source/options/optgenrl \
 cui/source/options/opthtml \
 cui/source/options/optlanguagetool \
+cui/source/options/optdeepl \
 cui/source/options/optinet2 \
 cui/source/options/optjava \
 cui/source/options/optjsearch \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 806779daaa9d..0ed879e2b228 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optgeneralpage \
cui/uiconfig/ui/opthtmlpage \
cui/uiconfig/ui/langtoolconfigpage \
+   cui/uiconfig/ui/deepltabpage \
cui/uiconfig/ui/optionsdialog \
cui/uiconfig/ui/optjsearchpage \
cui/uiconfig/ui/optlanguagespage \
diff --git a/cui/inc/treeopt.hrc b/cui/inc/treeopt.hrc
index 952b79ea92d4..6d5bc4004a53 100644
--- a/cui/inc/treeopt.hrc
+++ b/cui/inc/treeopt.hrc
@@ -55,7 +55,8 @@ const std::pair 
SID_LANGUAGE_OPTIONS_RES[] =
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"),  
RID_SVXPAGE_JSEARCH_OPTIONS },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"),  
RID_SVXPAGE_ASIAN_LAYOUT },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"),  
RID_SVXPAGE_OPTIONS_CTL },
-{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS }
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS },
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server Settings"),  
RID_SVXPAGE_DEEPL_OPTIONS }
 };
 
 const std::pair SID_INET_DLG_RES[] =
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index ..94b48ccc2f43
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include 
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage,
+   weld::DialogController* 
pController,
+   const SfxItemSet& rSet)
+: SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", 
&rSet)
+, m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+, m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get();
+m_xAPIUrl->set_text(rDeeplOptions.getAPIUrl());
+m_xAuthKey->set_text(rDeeplOptions.getAuthKey());
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptio

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

2022-07-22 Thread Luboš Luňák (via logerrit)
 sw/source/core/layout/layact.cxx |   11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit 4d1135553d47d627cfc63761818e00d9042f9e18
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 13:31:17 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 14:31:56 2022 +0200

Revert "avoid repeated writer layout calls with tiled rendering" 
(tdf#145396)

This was incorrect, the proper fix was my previous Writer commit.

This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37.

Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 9dff8edf97f454f24a40acbed4a9297816f91da6)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137318
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index b2b246e5eb2f..9375ca13cd51 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2275,16 +2275,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp 
*pI ) :
 {
 --rSh.mnStartAction;
 
-// When using tiled rendering, idle painting is disabled and 
paints are done
-// only later by tiled rendering. But paints call 
SwViewShellImp::DeletePaintRegion()
-// to reset this HasPaintRegion(), and if it's done too late,
-// SwTiledRenderingTest::testTablePaintInvalidate() will end up in 
an infinite
-// loop, because the idle layout will call this code repeatedly, 
because there
-// will be no idle paints to reset HasPaintRegion().
-// This code dates back to the initial commit, and I find its 
purpose unclear,
-// so I'm still leaving it here in case it turns out it serves a 
purpose.
-static const bool blockOnRepaints = true;
-if (!blockOnRepaints && rSh.Imp()->HasPaintRegion())
+if ( rSh.Imp()->HasPaintRegion() )
 bActions = true;
 else
 {


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

2022-07-22 Thread Luboš Luňák (via logerrit)
 sw/source/core/view/viewsh.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 50788a6e27e02fdb49f4e43a82b041e6a2a628db
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 13:27:45 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 14:31:32 2022 +0200

Revert "do not draw directly in SwViewShell in LOK mode"

It is actually needed to process SwViewShellImp's paint region,
as otherwise testTablePaintInvalidate::TestBody from
CppunitTest_sw_tiledrendering will end up in an infinite loop
repeatedly calling SwLayIdle ctor. That's what I tried to handle
in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong.

This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154.

Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137317
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b16b2d042727..7c4b55729ca7 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -478,7 +478,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
 CurrShell aCurr( this );
 if ( GetWin() && GetWin()->IsVisible() )
 {
-if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && 
!comphelper::LibreOfficeKit::isActive())
+if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
 {
 //Refresh with virtual device to avoid flickering.
 VclPtrInstance pVout( *mpOut );


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

2022-07-22 Thread Miklos Vajna (via logerrit)
 sw/source/core/txtnode/thints.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5d68b3878fed165bf1bdc6aa47be1df4a8265b96
Author: Miklos Vajna 
AuthorDate: Fri Jul 22 11:50:23 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 14:15:21 2022 +0200

sw: fix heap-use-after-free in SwTextNode::InsertHint()

This is a problem since commit 1dce9ee7e12871ee63434499db805e806b9e9d3c
(sw content controls, plain text: apply formatting to the entire
contents, 2022-07-21), because I forgot to check if pAttr is still a
valid pointer after the input field code is executed.

Below code already uses this flag to make sure it's not accessing a
dangling pointer, apply the same fix here as well.

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

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 3fade71120d2..e7fb33b8a1c8 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1684,6 +1684,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, 
const SetAttrMode nMode )
 }
 }
 
+if (bInsertHint)
 {
 // Handle the invariant that a plain text content control has the same 
character formatting
 // for all of its content.


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

2022-07-22 Thread Tibor Nagy (via logerrit)
 include/oox/export/drawingml.hxx|2 +-
 oox/source/export/drawingml.cxx |6 +++---
 oox/source/export/shapes.cxx|   33 -
 sd/qa/unit/data/pptx/tdf149697.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   25 +
 5 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit 4d153517183193f468dee9148c94fe9d874bacb3
Author: Tibor Nagy 
AuthorDate: Mon Jun 27 09:45:04 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 13:40:25 2022 +0200

tdf#149697 PPTX export: fix changing place of connection points

Place of the connection point of a polygon changed during
a PPTX round-trip, connecting other vertices of e.g. a square
or a hexagon, as before.

See also commit c3f73f75772d076dfb2ed0538e7d515503edc038
"tdf#149128 PPTX export: fix  and  connector properties".

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

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 455676e9c262..c80024ea1fdd 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -231,7 +231,7 @@ public:
 void WriteColorTransformations( const css::uno::Sequence< 
css::beans::PropertyValue >& aTransformations, sal_Int32 nAlpha = MAX_PERCENT );
 void WriteGradientStop(sal_uInt16 nStop, ::Color nColor, sal_Int32 nAlpha 
= MAX_PERCENT);
 void WriteLineArrow( const css::uno::Reference< css::beans::XPropertySet 
>& rXPropSet, bool bLineStart );
-void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, 
sal_Int32 nStartID, sal_Int32 nEndID );
+void WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID );
 
 bool WriteCharColor(const css::uno::Reference& 
xPropertySet);
 bool WriteFillColor(const css::uno::Reference& 
xPropertySet);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d889f475c556..392ce6f4d6aa 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -4747,19 +4747,19 @@ void DrawingML::WritePolyPolygon(const 
css::uno::Reference
 mpFS->endElementNS(XML_a, XML_custGeom);
 }
 
-void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& 
rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
+void DrawingML::WriteConnectorConnections( sal_uInt32 nStartGlueId, sal_Int32 
nEndGlueId, sal_Int32 nStartID, sal_Int32 nEndID )
 {
 if( nStartID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_stCxn,
XML_id, OString::number(nStartID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(true)) );
+   XML_idx, OString::number(nStartGlueId) );
 }
 if( nEndID != -1 )
 {
 mpFS->singleElementNS( XML_a, XML_endCxn,
XML_id, OString::number(nEndID),
-   XML_idx, 
OString::number(rConnectorEntry.GetConnectorRule(false)) );
+   XML_idx, OString::number(nEndGlueId) );
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index f0b446a7eb33..19ef8156f3e3 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -63,6 +63,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -1636,11 +1638,33 @@ static void lcl_GetConnectorAdjustValue(const 
Reference& xShape, tools::
 }
 }
 
+static sal_Int32 lcl_GetGluePointId(const Reference& xShape, 
sal_Int32& nGluePointId)
+{
+uno::Reference xSupplier(xShape, 
uno::UNO_QUERY);
+uno::Reference 
xGluePoints(xSupplier->getGluePoints(),
+ uno::UNO_QUERY);
+sal_uInt32 nCount = xGluePoints->getIdentifiers().size();
+if (nCount > 4)
+nGluePointId -= 4;
+else
+{
+// change id of the bounding box (1 <-> 3)
+if (nGluePointId == 1)
+nGluePointId = 3; // Right
+else if (nGluePointId == 3)
+nGluePointId = 1; // Left
+}
+
+return nGluePointId;
+}
+
 ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& 
xShape )
 {
 bool bFlipH = false;
 bool bFlipV = false;
 sal_Int32 nAngle = 0;
+sal_Int32 nStartGlueId = 0;
+sal_Int32 nEndGlueId = 0;
 
 SAL_INFO("oox.shape", "write connector shape");
 
@@ -1680,6 +1704,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const 
Reference< XShape >& xShape
 GET( rXShapeA, EdgeStartConnection );
 GET( rXShapeB, EdgeEndConnection );
 
+GET(nStartGlueId, StartGluePointIndex);
+if (nStartGlueId != -1)
+lcl_GetGluePointId(rXShapeA, nStartGlueId);
+GET(nEndGlueId, EndGlueP

[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - drawinglayer/source

2022-07-22 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   13 +---
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |2 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |   44 +-
 3 files changed, 35 insertions(+), 24 deletions(-)

New commits:
commit 7d74030da5b20d8f379544bdb56b26a316801c51
Author: Mike Kaganski 
AuthorDate: Thu Jul 21 14:40:54 2022 +0300
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 13:26:58 2022 +0200

tdf#144916: expand range to avoid unwanted effects on viewport edges

This also allows to avoid clipping of impBufferDevice to the passed
OutputDevice, because the expanded range couldn't otherwise be processed
on the buffer device.

Change-Id: I0d778365b09937c1a2ecee06477b0b17efcce44b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137296
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
(cherry picked from commit 8c15835762f2b16e7c8f5acd2d52f562c7dec9a4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137322
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137339
Reviewed-by: Miklos Vajna 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 927dacd12b65..d3b4ff10bc49 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -269,7 +269,7 @@ VDevBuffer& getVDevBuffer()
 return *aVDevBuffer.get();
 }
 
-impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange)
+impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange, bool bCrop)
 : mrOutDev(rOutDev)
 , mpContent(nullptr)
 , mpMask(nullptr)
@@ -277,13 +277,10 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, 
const basegfx::B2DRange&
 {
 basegfx::B2DRange aRangePixel(rRange);
 aRangePixel.transform(mrOutDev.GetViewTransformation());
-const ::tools::Rectangle 
aRectPixel(static_cast(floor(aRangePixel.getMinX())),
-
static_cast(floor(aRangePixel.getMinY())),
-
static_cast(ceil(aRangePixel.getMaxX())),
-
static_cast(ceil(aRangePixel.getMaxY(;
-const Point aEmptyPoint;
-maDestPixel = ::tools::Rectangle(aEmptyPoint, 
mrOutDev.GetOutputSizePixel());
-maDestPixel.Intersection(aRectPixel);
+maDestPixel = tools::Rectangle(floor(aRangePixel.getMinX()), 
floor(aRangePixel.getMinY()),
+   ceil(aRangePixel.getMaxX()), 
ceil(aRangePixel.getMaxY()));
+if (bCrop)
+maDestPixel.Intersection({ {}, mrOutDev.GetOutputSizePixel() });
 
 if (!isVisible())
 return;
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index 90d351eac50f..1002a930681a 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -39,7 +39,7 @@ class impBufferDevice
 tools::Rectangle maDestPixel;
 
 public:
-impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange);
+impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange, 
bool bCrop = true);
 ~impBufferDevice();
 
 void paint(double fTrans = 0.0);
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 10845409b9ec..ba187de18cd8 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1019,13 +1019,29 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, 
double fErodeDilateRadius
 
 return AlphaMask(mask.GetBitmap());
 }
+
+drawinglayer::geometry::ViewInformation2D
+expandRange(const drawinglayer::geometry::ViewInformation2D& rViewInfo, double 
nAmount)
+{
+basegfx::B2DRange viewport(rViewInfo.getViewport());
+viewport.grow(nAmount);
+return { rViewInfo.getObjectTransformation(),
+ rViewInfo.getViewTransformation(),
+ viewport,
+ rViewInfo.getVisualizedPage(),
+ rViewInfo.getViewTime(),
+ rViewInfo.getExtendedInformationSequence() };
+}
 }
 
 void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitive2D& rCandidate)
 {
-basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
+const double nGlowRadius(rCandidate.getGlowRadius());
+// Avoid wrong effect on the cut-off side; so expand by radius
+const auto aExpandedViewInfo(expandRange(getViewInformation2D(), 
nGlowRadius));
+basegfx::B2DRange aRange(rCandidate.getB2DRange(aExpandedViewInfo));
 aRange.transform(maCurrentTransformation);
-basegfx::B2DVector aGlowRadiusVector(rC

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

2022-07-22 Thread Miklos Vajna (via logerrit)
 sw/qa/extras/htmlexport/htmlexport.cxx |   24 
 sw/source/filter/html/css1atr.cxx  |   11 +++
 sw/source/filter/html/css1kywd.cxx |1 +
 sw/source/filter/html/css1kywd.hxx |1 +
 sw/source/filter/html/wrthtml.cxx  |7 +--
 5 files changed, 42 insertions(+), 2 deletions(-)

New commits:
commit 7a8665b51f911835a593cfe754c3e10b6cdab662
Author: Miklos Vajna 
AuthorDate: Thu Jul 21 15:40:58 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 13:22:34 2022 +0200

sw XHTML export: fix writing of section direction

The XHTML export behavior was the same as the HTML one for section text
direction, the  markup was used.

This shares code with the HTML filter, but it's not valid in
reqif-xhtml, while the CSS markup would be fine: .

Fix the problem by keeping the behavior unchanged for HTML, but switch
to inline CSS for XHTML.

The other similar attribute was "id", but that's fine even in XHTML.

(cherry picked from commit 3b7c18a579f3165c9d425d172d697f8978d6cd84)

Change-Id: I5797c90f9cf957dec7fc4074dd6e79dce11fada7

diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 1d03d107fd09..851d8409b549 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2286,6 +2286,30 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testImageKeepRatio)
 assertXPath(pDoc, "/html/body/p/img", "height", "auto");
 }
 
+CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testSectionDir)
+{
+// Given a document with a section:
+loadURL("private:factory/swriter", nullptr);
+SwXTextDocument* pTextDoc = 
dynamic_cast(mxComponent.get());
+SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell();
+pWrtShell->Insert("test");
+pWrtShell->SelAll();
+SwSectionData aSectionData(SectionType::Content, "mysect");
+pWrtShell->InsertSection(aSectionData);
+
+// When exporting to (reqif-)xhtml:
+ExportToReqif();
+
+// Then make sure CSS is used to export the text direction of the section:
+SvMemoryStream aStream;
+HtmlExportTest::wrapFragment(maTempFile, aStream);
+xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
+// Without the accompanying fix in place, this test would have failed with:
+// - XPath '//reqif-xhtml:div[@id='mysect']' no attribute 'style' exist
+// i.e. the dir="ltr" HTML attribute was used instead.
+assertXPath(pXmlDoc, "//reqif-xhtml:div[@id='mysect']", "style", "dir: 
ltr");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/css1atr.cxx 
b/sw/source/filter/html/css1atr.cxx
index 18ee264324f6..8a0bc881e1c8 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -2143,6 +2143,17 @@ void SwHTMLWriter::OutCSS1_SectionFormatOptions( const 
SwFrameFormat& rFrameForm
 if( SfxItemState::SET==rItemSet.GetItemState( RES_BACKGROUND, false, 
&pItem ) )
 OutCSS1_SvxBrush( *this, *pItem, sw::Css1Background::Section, nullptr 
);
 
+if (mbXHTML)
+{
+SvxFrameDirection nDir = GetHTMLDirection(rFrameFormat.GetAttrSet());
+OString sConvertedDirection = convertDirection(nDir);
+if (!sConvertedDirection.isEmpty())
+{
+OutCSS1_Property(sCSS1_P_dir, sConvertedDirection.getStr(), 
nullptr,
+ sw::Css1Background::Section);
+}
+}
+
 if (pCol)
 {
 OString 
sColumnCount(OString::number(static_cast(pCol->GetNumCols(;
diff --git a/sw/source/filter/html/css1kywd.cxx 
b/sw/source/filter/html/css1kywd.cxx
index f8914dedb274..c0299e28c958 100644
--- a/sw/source/filter/html/css1kywd.cxx
+++ b/sw/source/filter/html/css1kywd.cxx
@@ -197,6 +197,7 @@ const char* const sCSS1_P_height = "height";
 const char* const sCSS1_P_float = "float";
 
 const char* const sCSS1_P_column_count = "column-count";
+const char* const sCSS1_P_dir = "dir";
 
 // Strings for positioning
 
diff --git a/sw/source/filter/html/css1kywd.hxx 
b/sw/source/filter/html/css1kywd.hxx
index 7c0e326fd86a..c4609c5659b1 100644
--- a/sw/source/filter/html/css1kywd.hxx
+++ b/sw/source/filter/html/css1kywd.hxx
@@ -200,6 +200,7 @@ extern const char* const sCSS1_P_height;
 extern const char* const sCSS1_P_float;
 
 extern const char* const sCSS1_P_column_count;
+extern const char* const sCSS1_P_dir;
 
 // Strings for positioning
 
diff --git a/sw/source/filter/html/wrthtml.cxx 
b/sw/source/filter/html/wrthtml.cxx
index 238dbf36060a..8aeaf9c32fac 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -715,9 +715,12 @@ static void lcl_html_OutSectionStartTag( SwHTMLWriter& 
rHTMLWrt,
 sOut.append('\"');
 }
 
-SvxFrameDirection nDir = rHTMLWrt.GetHTMLDirection( rFormat.GetAttrSet() );
 rHTMLWrt.Strm().WriteOString( sOut.makeStringAndClear() );
-rH

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

2022-07-22 Thread Balazs Varga (via logerrit)
 sc/qa/uitest/calc_tests7/tdf150044.py |   69 ++
 sfx2/source/doc/docfile.cxx   |   13 +++---
 2 files changed, 76 insertions(+), 6 deletions(-)

New commits:
commit b8ddf710a778fe26d553c086787ee27aa1501797
Author: Balazs Varga 
AuthorDate: Thu Jul 21 08:27:47 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Jul 22 13:02:26 2022 +0200

tdf#150044 sc import: fix editing password in shared mode

Set the readonly state back after we create the tempfile
for shared files. It is necessary for later, when we checking
the file is readonly or not and we need to give the editing password.

TODO: filesave IO error is another bug

Change-Id: Iafc4dc6e7ce825fc3b7fe18abaee65c014c49a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137281
Tested-by: Jenkins
Reviewed-by: Tünde Tóth 
Tested-by: Gabor Kelemen 
Tested-by: Balazs Varga 
Reviewed-by: Balazs Varga 
(cherry picked from commit c7b6c9407ce109ab27257f4c1ec66b86b48622df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137320
Reviewed-by: Thorsten Behrens 
Tested-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/calc_tests7/tdf150044.py 
b/sc/qa/uitest/calc_tests7/tdf150044.py
new file mode 100644
index ..6e42358d7b81
--- /dev/null
+++ b/sc/qa/uitest/calc_tests7/tdf150044.py
@@ -0,0 +1,69 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from tempfile import TemporaryDirectory
+import os.path
+
+class save_shared_readonly_with_password(UITestCase):
+
+   def test_save_to_shared_ods(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, 
"shared_readonly_with_password_tmp.ods")
+
+with self.ui_test.create_doc_in_start_center("calc"):
+with 
self.ui_test.execute_dialog_through_command(".uno:ShareDocument", 
close_button="") as xShareDocumentDialog:
+xShareCheckButton = xShareDocumentDialog.getChild("share")
+xShareCheckButton.executeAction("CLICK", tuple())
+xOk = xShareDocumentDialog.getChild("ok")
+# Save the document
+with self.ui_test.execute_dialog_through_action(xOk, 
"CLICK", close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"TEXT": xFilePath}))
+xPasswordCheckButton = xSaveDialog.getChild("password")
+xPasswordCheckButton.executeAction("CLICK", tuple())
+xOpen = xSaveDialog.getChild("open")
+
+with self.ui_test.execute_dialog_through_action(xOpen, 
"CLICK") as xPasswordDialog:
+xReadonly = xPasswordDialog.getChild("readonly")
+xReadonly.executeAction("CLICK", tuple())
+xNewPassword = 
xPasswordDialog.getChild("newpassroEntry")
+xNewPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+xConfirmPassword = 
xPasswordDialog.getChild("confirmropassEntry")
+xConfirmPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+
+self.ui_test.wait_until_file_is_available(xFilePath)
+
+with self.ui_test.execute_dialog_through_command(".uno:Open", 
close_button="") as xOpenDialog:
+# Open document
+xFileName = xOpenDialog.getChild("file_name")
+xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
xFilePath}))
+xOpenBtn = xOpenDialog.getChild("open")
+xOpenBtn.executeAction("CLICK", tuple())
+
+xDialog = 
self.ui_test.wait_for_top_focus_window('SharedWarningDialog')
+xOk = xDialog.getChild("ok")
+xOk.executeAction("CLICK", tuple())
+
+document = self.ui_test.get_component()
+self.assertTrue(document.isReadonly())
+
+with 
self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+# check that we have a password dialog for ed

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

2022-07-22 Thread Balazs Varga (via logerrit)
 sc/qa/uitest/calc_tests7/tdf150044.py |   69 ++
 sfx2/source/doc/docfile.cxx   |   13 +++---
 2 files changed, 76 insertions(+), 6 deletions(-)

New commits:
commit 42a355514cc9a8bee238ad456e9a30249beea715
Author: Balazs Varga 
AuthorDate: Thu Jul 21 08:27:47 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Fri Jul 22 12:56:01 2022 +0200

tdf#150044 sc import: fix editing password in shared mode

Set the readonly state back after we create the tempfile
for shared files. It is necessary for later, when we checking
the file is readonly or not and we need to give the editing password.

TODO: filesave IO error is another bug

Change-Id: Iafc4dc6e7ce825fc3b7fe18abaee65c014c49a0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137281
Tested-by: Jenkins
Reviewed-by: Tünde Tóth 
Tested-by: Gabor Kelemen 
Tested-by: Balazs Varga 
Reviewed-by: Balazs Varga 
(cherry picked from commit c7b6c9407ce109ab27257f4c1ec66b86b48622df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137319
Reviewed-by: Thorsten Behrens 

diff --git a/sc/qa/uitest/calc_tests7/tdf150044.py 
b/sc/qa/uitest/calc_tests7/tdf150044.py
new file mode 100644
index ..6e42358d7b81
--- /dev/null
+++ b/sc/qa/uitest/calc_tests7/tdf150044.py
@@ -0,0 +1,69 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from tempfile import TemporaryDirectory
+import os.path
+
+class save_shared_readonly_with_password(UITestCase):
+
+   def test_save_to_shared_ods(self):
+
+with TemporaryDirectory() as tempdir:
+xFilePath = os.path.join(tempdir, 
"shared_readonly_with_password_tmp.ods")
+
+with self.ui_test.create_doc_in_start_center("calc"):
+with 
self.ui_test.execute_dialog_through_command(".uno:ShareDocument", 
close_button="") as xShareDocumentDialog:
+xShareCheckButton = xShareDocumentDialog.getChild("share")
+xShareCheckButton.executeAction("CLICK", tuple())
+xOk = xShareDocumentDialog.getChild("ok")
+# Save the document
+with self.ui_test.execute_dialog_through_action(xOk, 
"CLICK", close_button="") as xSaveDialog:
+xFileName = xSaveDialog.getChild("file_name")
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+xFileName.executeAction("TYPE", 
mkPropertyValues({"TEXT": xFilePath}))
+xPasswordCheckButton = xSaveDialog.getChild("password")
+xPasswordCheckButton.executeAction("CLICK", tuple())
+xOpen = xSaveDialog.getChild("open")
+
+with self.ui_test.execute_dialog_through_action(xOpen, 
"CLICK") as xPasswordDialog:
+xReadonly = xPasswordDialog.getChild("readonly")
+xReadonly.executeAction("CLICK", tuple())
+xNewPassword = 
xPasswordDialog.getChild("newpassroEntry")
+xNewPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+xConfirmPassword = 
xPasswordDialog.getChild("confirmropassEntry")
+xConfirmPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
+
+self.ui_test.wait_until_file_is_available(xFilePath)
+
+with self.ui_test.execute_dialog_through_command(".uno:Open", 
close_button="") as xOpenDialog:
+# Open document
+xFileName = xOpenDialog.getChild("file_name")
+xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
xFilePath}))
+xOpenBtn = xOpenDialog.getChild("open")
+xOpenBtn.executeAction("CLICK", tuple())
+
+xDialog = 
self.ui_test.wait_for_top_focus_window('SharedWarningDialog')
+xOk = xDialog.getChild("ok")
+xOk.executeAction("CLICK", tuple())
+
+document = self.ui_test.get_component()
+self.assertTrue(document.isReadonly())
+
+with 
self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+# check that we have a password dialog for editing the 
shared document
+ 

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

2022-07-22 Thread Tünde Tóth (via logerrit)
 sw/qa/extras/ooxmlexport/data/tdf139128.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport17.cxx   |   12 
 sw/source/filter/ww8/docxattributeoutput.cxx |2 ++
 3 files changed, 14 insertions(+)

New commits:
commit b7a294af40521d71e6583dad2908e09f3758649c
Author: Tünde Tóth 
AuthorDate: Tue Jul 12 11:50:35 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 12:49:32 2022 +0200

tdf#139128 DOCX: fix export of line break in text frames

Line breaks (text:line-break) of ODF text frames
(draw:text-box) were lost during DOCX export.

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

diff --git a/sw/qa/extras/ooxmlexport/data/tdf139128.odt 
b/sw/qa/extras/ooxmlexport/data/tdf139128.odt
new file mode 100644
index ..544527c069a2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf139128.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 038dca7cc92b..f139837b822a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -1077,6 +1077,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149089, "tdf149089.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int16(text::TextGridMode::LINES), nGridMode);   
// was LINES_AND_CHARS
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf139128)
+{
+loadAndReload("tdf139128.odt");
+xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+CPPUNIT_ASSERT(pXmlDoc);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 2
+// - Actual  : 0
+// i.e. the line break was lost on export.
+assertXPath(pXmlDoc, "//w:br", 2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 28097d40c411..abbe2f8bb06f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -150,6 +150,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -3396,6 +3397,7 @@ void DocxAttributeOutput::RunText( const OUString& rText, 
rtl_TextEncoding /*eCh
 prevUnicode = *pIt;
 break;
 case 0x0b: // line break
+case static_cast(text::ControlCharacter::LINE_BREAK):
 {
 if (impl_WriteRunText( m_pSerializer, nTextToken, pBegin, 
pIt ) || prevUnicode < 0x0020)
 {


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

2022-07-22 Thread Luboš Luňák (via logerrit)
 sw/source/core/view/viewsh.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c5e2611cff9ab0e436b66c39330c8d994e746cb0
Author: Luboš Luňák 
AuthorDate: Thu Jul 21 13:27:45 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 12:45:28 2022 +0200

Revert "do not draw directly in SwViewShell in LOK mode"

It is actually needed to process SwViewShellImp's paint region,
as otherwise testTablePaintInvalidate::TestBody from
CppunitTest_sw_tiledrendering will end up in an infinite loop
repeatedly calling SwLayIdle ctor. That's what I tried to handle
in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong.

This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154.

Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137193
Reviewed-by: Caolán McNamara 

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 3358043a2b8d..057b69878e10 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -485,7 +485,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev )
 CurrShell aCurr( this );
 if ( GetWin() && GetWin()->IsVisible() )
 {
-if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && 
!comphelper::LibreOfficeKit::isActive())
+if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() )
 {
 //Refresh with virtual device to avoid flickering.
 VclPtrInstance pVout( *mpOut );


[Libreoffice-commits] core.git: Branch 'private/mert/wip_deepl' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/sfx2 include/svtools include/svx include

2022-07-22 Thread Mert Tumer (via logerrit)
Rebased ref, commits from common ancestor:
commit f2e65b98ebb000faad71e7f1b6794d6f590c20a4
Author: Mert Tumer 
AuthorDate: Tue Jul 5 12:03:27 2022 +0300
Commit: Mert Tumer 
CommitDate: Fri Jul 22 12:56:30 2022 +0300

new uno command uno:Translate with deepl api

New Uno command added for translation
right now it is only using deepl translation api

There's a section in the options > language settings
for setting up the api url and auth key

uno:Translate is a menu button under Format tab
which will bring up Language Selection dialog for translation.

DeepL can accept html as the input for translation, this new
feature leverages that by exporting paragraphs/selections to
html and paste them back without losing the formatting (in theory)
This works good in general but we may lose formatting in very complex
styled sentences.

Translation works in two ways;
1) Whole document
when there is no selection, it assumes that we want to translate whole
document. Each paragraphs is sent one by one so that the output timeout
can be minimum for each paragraph.
2) Selection

Signed-off-by: Mert Tumer 
Change-Id: Ia2d3ab2f6757faf565b939e1d670a7dedac33390

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index d455a64ab266..c4c0a52b2ef4 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 cui/source/options/optgenrl \
 cui/source/options/opthtml \
 cui/source/options/optlanguagetool \
+cui/source/options/optdeepl \
 cui/source/options/optinet2 \
 cui/source/options/optjava \
 cui/source/options/optjsearch \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 806779daaa9d..0ed879e2b228 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optgeneralpage \
cui/uiconfig/ui/opthtmlpage \
cui/uiconfig/ui/langtoolconfigpage \
+   cui/uiconfig/ui/deepltabpage \
cui/uiconfig/ui/optionsdialog \
cui/uiconfig/ui/optjsearchpage \
cui/uiconfig/ui/optlanguagespage \
diff --git a/cui/inc/treeopt.hrc b/cui/inc/treeopt.hrc
index 952b79ea92d4..6d5bc4004a53 100644
--- a/cui/inc/treeopt.hrc
+++ b/cui/inc/treeopt.hrc
@@ -55,7 +55,8 @@ const std::pair 
SID_LANGUAGE_OPTIONS_RES[] =
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"),  
RID_SVXPAGE_JSEARCH_OPTIONS },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"),  
RID_SVXPAGE_ASIAN_LAYOUT },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"),  
RID_SVXPAGE_OPTIONS_CTL },
-{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS }
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS },
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server Settings"),  
RID_SVXPAGE_DEEPL_OPTIONS }
 };
 
 const std::pair SID_INET_DLG_RES[] =
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index ..94b48ccc2f43
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include 
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage,
+   weld::DialogController* 
pController,
+   const SfxItemSet& rSet)
+: SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", 
&rSet)
+, m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+, m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get();
+m_xAPIUrl->set_text(rDeeplOptions.getAPIUrl());
+m_xAuthKey->set_text(rDeeplOptions.getAuthKey());
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptio

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

2022-07-22 Thread Caolán McNamara (via logerrit)
 sc/uiconfig/scalc/ui/scgeneralpage.ui |  534 +-
 1 file changed, 276 insertions(+), 258 deletions(-)

New commits:
commit 40efe03817805eee5eeaf7cba54d18963e02a370
Author: Caolán McNamara 
AuthorDate: Fri Jul 22 09:47:18 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 11:36:34 2022 +0200

tdf#150093 add scrollbar to calc general options for the case it doesn't fit

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

diff --git a/sc/uiconfig/scalc/ui/scgeneralpage.ui 
b/sc/uiconfig/scalc/ui/scgeneralpage.ui
index 492f425df6a9..c078b2240197 100644
--- a/sc/uiconfig/scalc/ui/scgeneralpage.ui
+++ b/sc/uiconfig/scalc/ui/scgeneralpage.ui
@@ -1,70 +1,70 @@
 
-
+
 
   
   
 0.5
 99.99
 1.25
-0.1
-0.1
+0.10
+0.10
   
   
 True
-False
-6
+False
+6
 vertical
 12
 
   
 True
-False
-0
-none
+False
+0
+none
 
-  
+  
   
 True
-False
-3
-6
+False
 12
 6
+3
+6
 
   
 True
-False
+False
 Measurement _unit:
-True
-unitlb
+True
+unitlb
 0
   
   
-0
-0
+0
+0
   
 
 
   
 True
-False
+False
 _Tab stops:
-True
-tabmf
+True
+tabmf
 0
   
   
-0
-1
+0
+1
   
 
 
   
 True
-True
+True
+True
 adjustment1
 2
-True
 
   
 Defines the tab stops 
distance.
@@ -72,14 +72,14 @@
 
   
   
-1
-1
+1
+1
   
 
 
   
 True
-False
+False
 
   
 Defines the unit of measure in 
spreadsheets.
@@ -87,8 +87,8 @@
 
   
   
-1
-0
+1
+0
   
 
   
@@ -96,7 +96,7 @@
 
   
 True
-False
+False
 Metrics
 
   
@@ -113,26 +113,26 @@
 
   
 True
-False
-0
-none
+False
+0
+none
 
   
 True
-False
-vertical
-3
+False
 12
 6
+vertical
+3
 
   
 _Always (from trusted locations)
 True
-True
-False
-True
+True
+False
+True
 True
-True
+True
   
   
 False
@@ -144,10 +144,10 @@
   
 _On request
 True
-True
-False
-True
-True
+True
+False
+True
+True
 alwaysrb
   
   
@@ -160,10 +160,10 @@
   
 _Never
 True
-True
-False
-True
-True
+True
+False
+True
+True
 alwaysrb
   
   
@@ -177,7 +177,7 @@
 
   
 True
-False
+False
 Update links when opening
 0
 
@@ -195,229 +195,247 @@
 
   
 True
-False
-0
-none
+False
+True
+0
+none
 
-  
-  
+  
 True
-False
-3
-6
-12
-6
-
-  
-Press Enter to switch to _edit 
mode
-True
-True
-False
-True
-

[Libreoffice-commits] core.git: oox/source pyuno/source sax/source sdext/source sd/source

2022-07-22 Thread Noel Grandin (via logerrit)
 oox/source/core/xmlfilterbase.cxx  |2 +-
 oox/source/dump/dumperbase.cxx |   10 +-
 oox/source/export/drawingml.cxx|3 +--
 pyuno/source/module/pyuno_util.cxx |6 +++---
 sax/source/tools/converter.cxx |3 ++-
 sd/source/filter/html/htmlex.cxx   |   21 -
 sd/source/ui/remotecontrol/ImagePreparer.cxx   |5 ++---
 sd/source/ui/view/frmview.cxx  |7 +--
 sdext/source/pdfimport/pdfparse/pdfentries.cxx |2 +-
 9 files changed, 32 insertions(+), 27 deletions(-)

New commits:
commit e7903c01b112665a300350b7e86c2bf65f81b8a7
Author: Noel Grandin 
AuthorDate: Thu Jul 21 18:49:47 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 22 11:14:37 2022 +0200

elide some makeStringAndClear() calls

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

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index e8e1a138984b..d415a739fe3e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -610,7 +610,7 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 
nXmlElement, const Sequence< OU
 ::comphelper::intersperse(aItems.begin(), aItems.end(),
   ::comphelper::OUStringBufferAppender(sRep), 
OUString(" "));
 
-writeElement( pDoc, nXmlElement, sRep.makeStringAndClear() );
+writeElement( pDoc, nXmlElement, sRep );
 }
 
 static void
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index 61d603228b42..9633352d85c6 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -523,7 +523,7 @@ void StringHelper::appendIndex( OUStringBuffer& rStr, 
sal_Int64 nIdx )
 {
 OUStringBuffer aToken;
 appendDec( aToken, nIdx );
-rStr.append( '[' ).append( aToken.makeStringAndClear() ).append( ']' );
+rStr.append( '[' ).append( aToken ).append( ']' );
 }
 
 std::u16string_view StringHelper::getToken( std::u16string_view rData, 
sal_Int32& rnPos, sal_Unicode cSep )
@@ -575,7 +575,7 @@ OUString lclTrimQuotedStringList( const OUString& rStr )
 }
 while( (nPos < nLen) && (rStr[ nPos ] != OOX_DUMP_CFG_QUOTE) );
 // add token, seek to list separator, ignore text following 
closing quote
-aBuffer.append( aToken.makeStringAndClear() );
+aBuffer.append( aToken );
 nPos = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
 if( nPos < nLen )
 aBuffer.append( OOX_DUMP_LF );
@@ -1100,7 +1100,7 @@ OUString FlagsList::implGetName( const Config& /*rCfg*/, 
sal_Int64 nKey ) const
 aUnknown.append( OOX_DUMP_ITEMSEP );
 StringHelper::appendShortHex( aUnknown, nKey );
 StringHelper::enclose( aUnknown, '(', ')' );
-StringHelper::appendToken( aName, aUnknown.makeStringAndClear() );
+StringHelper::appendToken( aName, aUnknown );
 }
 return aName.makeStringAndClear();
 }
@@ -1203,14 +1203,14 @@ OUString CombiList::implGetName( const Config& rCfg, 
sal_Int64 nKey ) const
 case DATATYPE_DOUBLE:   StringHelper::appendValue( aValue, 
static_cast< double >( nSValue ), rItemFmt.meFmtType );  break;
 default:;
 }
-StringHelper::appendToken( aItem, aValue.makeStringAndClear(), 
OOX_DUMP_ITEMSEP );
+StringHelper::appendToken( aItem, aValue, OOX_DUMP_ITEMSEP );
 if( !rItemFmt.maListName.isEmpty() )
 {
 OUString aValueName = rCfg.getName( rItemFmt.maListName, 
static_cast< sal_Int64 >( nUValue ) );
 StringHelper::appendToken( aItem, aValueName, OOX_DUMP_ITEMSEP 
);
 }
 StringHelper::enclose( aItem, '(', ')' );
-StringHelper::appendToken( aName, aItem.makeStringAndClear() );
+StringHelper::appendToken( aName, aItem );
 setFlag( nFound, nMask );
 }
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index df9b039640d4..d889f475c556 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -5644,8 +5644,7 @@ OString DrawingML::WriteWdpPicture( const OUString& 
rFileId, const Sequence< sal
  oox::getRelationship(Relationship::HDPHOTO),
  OUStringBuffer()
  .appendAscii( GetRelationCompPrefix() )
- .append( sFileName )
- .makeStringAndClear() );
+ .append( sFileName ) );
 
 maWdpCache[rFileId] = sId;
 return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 );
diff --git a/pyuno/source/module/pyuno_util.cxx 
b/pyuno/source/module/pyuno_util.cxx
index 12d58f0ec

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

2022-07-22 Thread Noel Grandin (via logerrit)
 sw/source/core/crsr/crstrvl.cxx   |2 +-
 sw/source/core/doc/doc.cxx|4 +++-
 sw/source/core/edit/acorrect.cxx  |2 +-
 sw/source/core/edit/edfcol.cxx|2 +-
 sw/source/core/layout/dbg_lay.cxx |2 +-
 5 files changed, 7 insertions(+), 5 deletions(-)

New commits:
commit e7cc97d1e95fae3271fddafaa7a13bdf7c62b6ee
Author: Noel Grandin 
AuthorDate: Thu Jul 21 18:51:40 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 22 11:14:20 2022 +0200

elide some makeStringAndClear() calls

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

diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index adf7617428d4..d636cd27165e 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1964,7 +1964,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
 {
 if( !rContentAtPos.sStr.isEmpty() )
 rContentAtPos.sStr += "\n";
-rContentAtPos.sStr += "Attr: " + 
sAttrs.makeStringAndClear();
+rContentAtPos.sStr += "Attr: " + sAttrs;
 }
 }
 bRet = true;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 800c264588b6..3e2c57b2c4b8 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -90,6 +90,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -620,7 +621,8 @@ OUString UIPages2PhyPages(const OUString& rUIPageRange, 
const std::map< sal_Int3
 aNumber.append(*pInput++);
 if (!aNumber.isEmpty())
 {
-sal_Int32 nNumber = aNumber.makeStringAndClear().toInt32();
+sal_Int32 nNumber = o3tl::toInt32(aNumber);
+aNumber.setLength(0);
 if (nNumber < nUIPageMin)
 nNumber = nPhyPageMin-1;
 else if (nNumber > nUIPageMax)
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 75b45488465d..9c3ee63ff863 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -565,7 +565,7 @@ bool SwAutoCorrDoc::TransliterateRTLWord( sal_Int32& 
rSttPos, sal_Int32 nEndPos,
 {
 const Color* pColor = nullptr;
 // Send text as NatNum12 prefix
-OUString sPrefix("[NatNum12 " + 
sDisambiguatedWord.makeStringAndClear() + "]0");
+OUString sPrefix("[NatNum12 " + sDisambiguatedWord + "]0");
 if (pFormatter->GetPreviewString(sPrefix, 0, sConverted, &pColor, 
LANGUAGE_USER_HUNGARIAN_ROVAS))
 bRet = true;
 }
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 4d7f80d6d3d1..8dc1610a597a 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1789,7 +1789,7 @@ void SwEditShell::SignParagraph()
 if (!signing.Sign(sigBuf))
 return;
 
-const OUString signature = OStringToOUString(sigBuf.makeStringAndClear(), 
RTL_TEXTENCODING_UTF8, 0);
+const OUString signature = OStringToOUString(sigBuf, 
RTL_TEXTENCODING_UTF8, 0);
 
 auto it = std::find_if(std::as_const(aProperties).begin(), 
std::as_const(aProperties).end(), [](const beans::PropertyValue& rValue)
 {
diff --git a/sw/source/core/layout/dbg_lay.cxx 
b/sw/source/core/layout/dbg_lay.cxx
index d1d012c6418c..37d4c5271557 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -816,7 +816,7 @@ void SwImplProtocol::Record_( const SwFrame* pFrame, PROT 
nFunction, DbgAction n
 }
 
 SAL_INFO("sw.layout.debug", aOut.getStr());
-m_pStream->WriteOString(aOut.makeStringAndClear());
+m_pStream->WriteOString(aOut);
 (*m_pStream) << endl; // output
 m_pStream->Flush(); // to the disk, so we can read it immediately
 if (++m_nLineCount >= m_nMaxLines) // max number of lines reached?


[Libreoffice-commits] core.git: 2 commits - sfx2/source shell/source starmath/source svgio/source svtools/source unoidl/source unotools/source writerfilter/source

2022-07-22 Thread Noel Grandin (via logerrit)
 sfx2/source/appl/sfxhelp.cxx   |2 -
 sfx2/source/bastyp/frmhtmlw.cxx|   15 +---
 shell/source/unix/exec/shellexec.cxx   |2 -
 starmath/source/ooxmlexport.cxx|2 -
 starmath/source/ooxmlimport.cxx|4 +-
 svgio/source/svgreader/svgnode.cxx |3 +
 svgio/source/svgreader/svgstylenode.cxx|   12 ---
 svtools/source/svhtml/htmlout.cxx  |   41 
 svtools/source/svhtml/parhtml.cxx  |8 ++--
 svtools/source/svrtf/parrtf.cxx|   10 -
 unoidl/source/sourcetreeprovider.cxx   |2 -
 unotools/source/i18n/localedatawrapper.cxx |2 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   42 ++---
 writerfilter/source/rtftok/rtftokenizer.cxx|3 +
 14 files changed, 93 insertions(+), 55 deletions(-)

New commits:
commit 42572c6d0d1f1c84b3774f6c790e28e8abc7b45a
Author: Noel Grandin 
AuthorDate: Thu Jul 21 18:51:02 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Jul 22 11:13:45 2022 +0200

elide some makeStringAndClear() calls

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

diff --git a/unoidl/source/sourcetreeprovider.cxx 
b/unoidl/source/sourcetreeprovider.cxx
index 399329f30e40..629e50fbf8f3 100644
--- a/unoidl/source/sourcetreeprovider.cxx
+++ b/unoidl/source/sourcetreeprovider.cxx
@@ -284,7 +284,7 @@ rtl::Reference 
SourceTreeProvider::findEntity(OUString const & name)
 throw FileFormatException( //TODO
 "", "Illegal UNOIDL identifier \"" + name + "\"");
 }
-OUString uri(uri_ + buf.makeStringAndClear());
+OUString uri(uri_ + buf);
 rtl::Reference ent;
 // Prevent conflicts between foo/ and Foo.idl on case-preserving file
 // systems:
diff --git a/unotools/source/i18n/localedatawrapper.cxx 
b/unotools/source/i18n/localedatawrapper.cxx
index 55cde4a360a4..220d850885cb 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -353,7 +353,7 @@ const std::vector< LanguageType >& 
LocaleDataWrapper::getInstalledLanguageTypes(
 
aMsg.append(static_cast(static_cast(eLang)), 16);
 aMsg.append("  ->  ");
 aMsg.append(aBackLanguageTag.getBcp47());
-outputCheckMessage( aMsg.makeStringAndClear() );
+outputCheckMessage( aMsg );
 }
 eLang = LANGUAGE_DONTKNOW;
 }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e8db8d68f12e..71e25f4571f8 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -855,8 +855,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, 
uno::ReferencemakeStringAndClear(),
-rState.getCurrentEncoding());
+OString aStr
+= OUStringToOString(*pCurrentDestinationText, 
rState.getCurrentEncoding());
+pCurrentDestinationText->setLength(0);
 // decode hex dump
 OStringBuffer aBuf;
 int b = 0;
@@ -2638,8 +2640,13 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& 
rState)
 != m_aStates.top().getCurrentDestinationText())
 break; // not for nested group
 if (m_xDocumentProperties.is())
-
m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(
-
m_aStates.top().getCurrentDestinationText()->makeStringAndClear()));
+{
+OUStringBuffer* pCurrentDestinationText
+= m_aStates.top().getCurrentDestinationText();
+m_xDocumentProperties->setKeywords(
+
comphelper::string::convertCommaSeparated(*pCurrentDestinationText));
+pCurrentDestinationText->setLength(0);
+}
 break;
 case Destination::COMMENT:
 if (&m_aStates.top().getDestinationText()
@@ -2757,13 +2764,12 @@ RTFError 
RTFDocumentImpl::beforePopState(RTFParserState& rState)
 break;
 case Destination::ANNOTATIONDATE:
 {
-if (&m_aStates.top().getDestinationText()
-!= m_aStates.top().getCurrentDestinationText())
+OUStringBuffer* pCurrentDestinationText = 
m_aStates.top().getCurrentDestinationText();
+if (&m_aStates.top().getDestinationText() != 
pCurrentDestinationText)
 break; // not for nested group
-OUString aStr(OStringToOUString(
-DTTM22OString(
-
m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()),
-rState

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

2022-07-22 Thread László Németh (via logerrit)
 sw/qa/core/docnode/data/tdf150086.docx |binary
 sw/qa/core/docnode/docnode.cxx |   15 +++
 sw/source/core/docnode/ndsect.cxx  |3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 7335d912de04eaa279dc805ee0ed5be0fcac5326
Author: László Németh 
AuthorDate: Thu Jul 21 17:56:34 2022 +0200
Commit: László Németh 
CommitDate: Fri Jul 22 10:57:29 2022 +0200

tdf#150086 DOCX import: fix ToC redline with lost content

Inserted Table of Contents lost its redline partially,
e.g. the redline contained only "Conte" instead of "Content".

Regression from commit 69edfcf789db1920273191d93fae0bc03f385b81
"DOCX import: fix assertion failure when redline ends right before a ToC".

Note: it seems, it's enough to limit the original fix for
delete redlines, because that was the main target of the
interoperability fix.

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

diff --git a/sw/qa/core/docnode/data/tdf150086.docx 
b/sw/qa/core/docnode/data/tdf150086.docx
new file mode 100644
index ..063e68df6857
Binary files /dev/null and b/sw/qa/core/docnode/data/tdf150086.docx differ
diff --git a/sw/qa/core/docnode/docnode.cxx b/sw/qa/core/docnode/docnode.cxx
index bcda50c8de7a..4dbf3630f3f4 100644
--- a/sw/qa/core/docnode/docnode.cxx
+++ b/sw/qa/core/docnode/docnode.cxx
@@ -10,6 +10,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -29,6 +30,20 @@ CPPUNIT_TEST_FIXTURE(Test, testRedlineEndsBeforeToC)
 // Without the accompanying fix in place, this test would have resulted in 
an assertion failure
 // in InsertCnt_(), because the start of the section was hidden, but not 
its end.
 CPPUNIT_ASSERT_EQUAL(static_cast(2), 
rTable.size());
+
+// The redline contained the newline, too
+CPPUNIT_ASSERT_EQUAL(OUString(""), 
rTable[0]->GetText());
+}
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf150086)
+{
+// Load a document where an insert redline ends right before a ToC
+SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf150086.docx");
+const SwRedlineTable& rTable = 
pDoc->getIDocumentRedlineAccess().GetRedlineTable();
+CPPUNIT_ASSERT_EQUAL(static_cast(9), 
rTable.size());
+
+// This was "Conte" (stripped redline)
+CPPUNIT_ASSERT_EQUAL(OUString("Content"), rTable[6]->GetText());
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/docnode/ndsect.cxx 
b/sw/source/core/docnode/ndsect.cxx
index 6c7fb8b6ecec..76831ae61925 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -834,7 +834,8 @@ SwSectionNode* SwNodes::InsertTextSection(SwNodeIndex 
const& rNdIdx,
 for (SwRedlineTable::size_type nIndex = 0; nIndex < rRedlines.size(); 
++nIndex)
 {
 SwRangeRedline* pRedline = rRedlines[nIndex];
-if (!pRedline->HasMark() || pRedline->GetMark()->nNode != aInsPos)
+if ( RedlineType::Delete != pRedline->GetType() ||
+ !pRedline->HasMark() || pRedline->GetMark()->nNode != aInsPos 
)
 {
 continue;
 }


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

2022-07-22 Thread Mike Kaganski (via logerrit)
 vcl/source/bitmap/bitmap.cxx |   24 ++--
 1 file changed, 10 insertions(+), 14 deletions(-)

New commits:
commit 02a6d37131ab0b522d5b7551b2b24e98291ecf1c
Author: Mike Kaganski 
AuthorDate: Fri Jul 22 09:22:52 2022 +0200
Commit: Mike Kaganski 
CommitDate: Fri Jul 22 10:27:10 2022 +0200

Simplify small grey palette initialization

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

diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index a02179aea0f6..ff5110a8ded1 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -173,25 +173,21 @@ const BitmapPalette& Bitmap::GetGreyPalette( int nEntries 
)
 {
 case 2:
 {
-static const BitmapPalette aGreyPalette2 = [] {
-BitmapPalette aPalette(2);
-aPalette[0] = BitmapColor(0, 0, 0);
-aPalette[1] = BitmapColor(255, 255, 255);
-return aPalette;
-}();
+static const BitmapPalette aGreyPalette2 = {
+BitmapColor(0, 0, 0),
+BitmapColor(255, 255, 255),
+};
 
 return aGreyPalette2;
 }
 case 4:
 {
-static const BitmapPalette aGreyPalette4 = [] {
-BitmapPalette aPalette(4);
-aPalette[0] = BitmapColor(0, 0, 0);
-aPalette[1] = BitmapColor(85, 85, 85);
-aPalette[2] = BitmapColor(170, 170, 170);
-aPalette[3] = BitmapColor(255, 255, 255);
-return aPalette;
-}();
+static const BitmapPalette aGreyPalette4 = {
+BitmapColor(0, 0, 0),
+BitmapColor(85, 85, 85),
+BitmapColor(170, 170, 170),
+BitmapColor(255, 255, 255),
+};
 
 return aGreyPalette4;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sal/osl

2022-07-22 Thread Christian Lohmaier (via logerrit)
 sal/osl/unx/thread.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit ec8485dec71fe27908f25eaa3186af2d17215b64
Author: Christian Lohmaier 
AuthorDate: Wed Jul 20 17:42:30 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 10:20:35 2022 +0200

tdf#141421 xml export: default stacksize for threads on macOS is too small

libxslt usage means lots of recursion for the sample document and the 
default
for non-main threads is 512kB, see
https://developer.apple.com/library/archive/qa/qa1419/_index.html
and contrary to linux it doesn't default to the value set via ulimit.

https://docs.microsoft.com/en-us/windows/win32/procthread/thread-stack-size
says default for Windows is 1MB, so use that as a new default.
(on linux it effectively is 8MB via ulimit, if not specified it would 
default
to 2MB for most architectures)

Change-Id: I10bd25301b0aea83e5bbb0c2103a0dd47a7e0736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137269
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 1844326df477eb379f281e6f027fc8e6475f28bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137191
Reviewed-by: Caolán McNamara 

diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index ce5ece7c1d59..ff073ecddb00 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -279,7 +279,7 @@ static oslThread osl_thread_create_Impl (
 short nFlags)
 {
 Thread_Impl* pImpl;
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 pthread_attr_t attr;
 size_t stacksize;
 #endif
@@ -295,14 +295,16 @@ static oslThread osl_thread_create_Impl (
 
 pthread_mutex_lock (&(pImpl->m_Lock));
 
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 if (pthread_attr_init(&attr) != 0)
 return nullptr;
 
 #if defined OPENBSD
 stacksize = 262144;
-#else
+#elif !ENABLE_RUNTIME_OPTIMIZATIONS
 stacksize = 12 * 1024 * 1024; // 8MB is not enough for ASAN on x86-64
+#else
+stacksize = 1 * 1024 * 1024; // macOS default for non-main threads (512kB) 
is not enough...
 #endif
 if (pthread_attr_setstacksize(&attr, stacksize) != 0) {
 pthread_attr_destroy(&attr);
@@ -312,7 +314,7 @@ static oslThread osl_thread_create_Impl (
 
 if ((nRet = pthread_create (
 &(pImpl->m_hThread),
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 &attr,
 #else
 PTHREAD_ATTR_DEFAULT,
@@ -330,7 +332,7 @@ static oslThread osl_thread_create_Impl (
 return nullptr;
 }
 
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 pthread_attr_destroy(&attr);
 #endif
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sal/osl

2022-07-22 Thread Christian Lohmaier (via logerrit)
 sal/osl/unx/thread.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 13d08e0fbe644ed2ebf1e21a68456313939f475f
Author: Christian Lohmaier 
AuthorDate: Wed Jul 20 17:42:30 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 22 10:20:21 2022 +0200

tdf#141421 xml export: default stacksize for threads on macOS is too small

libxslt usage means lots of recursion for the sample document and the 
default
for non-main threads is 512kB, see
https://developer.apple.com/library/archive/qa/qa1419/_index.html
and contrary to linux it doesn't default to the value set via ulimit.

https://docs.microsoft.com/en-us/windows/win32/procthread/thread-stack-size
says default for Windows is 1MB, so use that as a new default.
(on linux it effectively is 8MB via ulimit, if not specified it would 
default
to 2MB for most architectures)

Change-Id: I10bd25301b0aea83e5bbb0c2103a0dd47a7e0736
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137269
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 
(cherry picked from commit 1844326df477eb379f281e6f027fc8e6475f28bf)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137190
Reviewed-by: Caolán McNamara 

diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx
index 54e674dd4de5..b122c5f31f3f 100644
--- a/sal/osl/unx/thread.cxx
+++ b/sal/osl/unx/thread.cxx
@@ -280,7 +280,7 @@ static oslThread osl_thread_create_Impl (
 short nFlags)
 {
 Thread_Impl* pImpl;
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 pthread_attr_t attr;
 size_t stacksize;
 #endif
@@ -296,14 +296,16 @@ static oslThread osl_thread_create_Impl (
 
 pthread_mutex_lock (&(pImpl->m_Lock));
 
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 if (pthread_attr_init(&attr) != 0)
 return nullptr;
 
 #if defined OPENBSD
 stacksize = 262144;
-#else
+#elif !ENABLE_RUNTIME_OPTIMIZATIONS
 stacksize = 12 * 1024 * 1024; // 8MB is not enough for ASAN on x86-64
+#else
+stacksize = 1 * 1024 * 1024; // macOS default for non-main threads (512kB) 
is not enough...
 #endif
 if (pthread_attr_setstacksize(&attr, stacksize) != 0) {
 pthread_attr_destroy(&attr);
@@ -313,7 +315,7 @@ static oslThread osl_thread_create_Impl (
 
 if ((nRet = pthread_create (
 &(pImpl->m_hThread),
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 &attr,
 #else
 PTHREAD_ATTR_DEFAULT,
@@ -331,7 +333,7 @@ static oslThread osl_thread_create_Impl (
 return nullptr;
 }
 
-#if defined OPENBSD || ((defined MACOSX || defined LINUX) && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
+#if defined OPENBSD || defined MACOSX || (defined LINUX && 
!ENABLE_RUNTIME_OPTIMIZATIONS)
 pthread_attr_destroy(&attr);
 #endif
 


[Libreoffice-commits] core.git: Branch 'private/mert/wip_deepl' - cui/inc cui/Library_cui.mk cui/source cui/uiconfig cui/UIConfig_cui.mk desktop/source include/sfx2 include/svtools include/svx include

2022-07-22 Thread Mert Tumer (via logerrit)
Rebased ref, commits from common ancestor:
commit e8225b1022a0f0f199f864b136da7383e7f63b7a
Author: Mert Tumer 
AuthorDate: Tue Jul 5 12:03:27 2022 +0300
Commit: Mert Tumer 
CommitDate: Fri Jul 22 10:38:56 2022 +0300

new uno command uno:Translate with deepl api

New Uno command added for translation
right now it is only using deepl translation api

There's a section in the options > language settings
for setting up the api url and auth key

uno:Translate is a menu button under Format tab
which will bring up Language Selection dialog for translation.

DeepL can accept html as the input for translation, this new
feature leverages that by exporting paragraphs/selections to
html and paste them back without losing the formatting (in theory)
This works good in general but we may lose formatting in very complex
styled sentences.

Translation works in two ways;
1) Whole document
when there is no selection, it assumes that we want to translate whole
document. Each paragraphs is sent one by one so that the output timeout
can be minimum for each paragraph.
2) Selection

Signed-off-by: Mert Tumer 
Change-Id: Ia2d3ab2f6757faf565b939e1d670a7dedac33390

diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk
index d455a64ab266..c4c0a52b2ef4 100644
--- a/cui/Library_cui.mk
+++ b/cui/Library_cui.mk
@@ -181,6 +181,7 @@ $(eval $(call gb_Library_add_exception_objects,cui,\
 cui/source/options/optgenrl \
 cui/source/options/opthtml \
 cui/source/options/optlanguagetool \
+cui/source/options/optdeepl \
 cui/source/options/optinet2 \
 cui/source/options/optjava \
 cui/source/options/optjsearch \
diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk
index 806779daaa9d..0ed879e2b228 100644
--- a/cui/UIConfig_cui.mk
+++ b/cui/UIConfig_cui.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\
cui/uiconfig/ui/optgeneralpage \
cui/uiconfig/ui/opthtmlpage \
cui/uiconfig/ui/langtoolconfigpage \
+   cui/uiconfig/ui/deepltabpage \
cui/uiconfig/ui/optionsdialog \
cui/uiconfig/ui/optjsearchpage \
cui/uiconfig/ui/optlanguagespage \
diff --git a/cui/inc/treeopt.hrc b/cui/inc/treeopt.hrc
index 952b79ea92d4..6d5bc4004a53 100644
--- a/cui/inc/treeopt.hrc
+++ b/cui/inc/treeopt.hrc
@@ -55,7 +55,8 @@ const std::pair 
SID_LANGUAGE_OPTIONS_RES[] =
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Searching in Japanese"),  
RID_SVXPAGE_JSEARCH_OPTIONS },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Asian Layout"),  
RID_SVXPAGE_ASIAN_LAYOUT },
 { NC_("SID_LANGUAGE_OPTIONS_RES", "Complex Text Layout"),  
RID_SVXPAGE_OPTIONS_CTL },
-{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS }
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "LanguageTool Server Settings"),  
RID_SVXPAGE_LANGTOOL_OPTIONS },
+{ NC_("SID_LANGUAGE_OPTIONS_RES", "DeepL Server Settings"),  
RID_SVXPAGE_DEEPL_OPTIONS }
 };
 
 const std::pair SID_INET_DLG_RES[] =
diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx
new file mode 100644
index ..94b48ccc2f43
--- /dev/null
+++ b/cui/source/options/optdeepl.cxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "optdeepl.hxx"
+#include 
+
+OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage,
+   weld::DialogController* 
pController,
+   const SfxItemSet& rSet)
+: SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", 
&rSet)
+, m_xAPIUrl(m_xBuilder->weld_entry("apiurl"))
+, m_xAuthKey(m_xBuilder->weld_entry("authkey"))
+{
+
+}
+
+OptDeeplTabPage::~OptDeeplTabPage() {}
+
+void OptDeeplTabPage::Reset(const SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get();
+m_xAPIUrl->set_text(rDeeplOptions.getAPIUrl());
+m_xAuthKey->set_text(rDeeplOptions.getAuthKey());
+}
+
+bool OptDeeplTabPage::FillItemSet(SfxItemSet*)
+{
+SvxDeeplOptions& rDeeplOptio

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

2022-07-22 Thread Miklos Vajna (via logerrit)
 include/xmloff/xmltoken.hxx |1 
 schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng |6 +
 xmloff/qa/unit/data/content-control-plain-text.fodt |8 +
 xmloff/qa/unit/text.cxx |   66 
 xmloff/source/core/xmltoken.cxx |1 
 xmloff/source/text/txtparae.cxx |9 +
 xmloff/source/text/xmlcontentcontrolcontext.cxx |   13 ++
 xmloff/source/text/xmlcontentcontrolcontext.hxx |1 
 xmloff/source/token/tokens.txt  |1 
 9 files changed, 106 insertions(+)

New commits:
commit 33cf26c8b6dc6cf38edf2d22cfefbd00904d9da8
Author: Miklos Vajna 
AuthorDate: Fri Jul 22 08:35:10 2022 +0200
Commit: Miklos Vajna 
CommitDate: Fri Jul 22 09:39:00 2022 +0200

sw content controls, date: add ODT filter

Map the PlainText UNO property to:



on export, and do the opposite on import.

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

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 77f9c605b707..3a13ef6ff1d4 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3501,6 +3501,7 @@ namespace xmloff::token {
 XML_PICTURE,
 XML_DATE_FORMAT,
 XML_DATE_RFC_LANGUAGE_TAG,
+XML_PLAIN_TEXT,
 
 XML_FILL_USE_SLIDE_BACKGROUND,
 
diff --git a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng 
b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
index c92b5c6330bf..c524533fd178 100644
--- a/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
+++ b/schema/libreoffice/OpenDocument-v1.3+libreoffice-schema.rng
@@ -2916,6 +2916,12 @@ 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
   
 
   
+  
+
+
+  
+
+  
   
 
   
diff --git a/xmloff/qa/unit/data/content-control-plain-text.fodt 
b/xmloff/qa/unit/data/content-control-plain-text.fodt
new file mode 100644
index ..03dbdc8a7a8e
--- /dev/null
+++ b/xmloff/qa/unit/data/content-control-plain-text.fodt
@@ -0,0 +1,8 @@
+
+
+  
+
+  test
+
+  
+
diff --git a/xmloff/qa/unit/text.cxx b/xmloff/qa/unit/text.cxx
index 2aed79376fe0..3bc6cd668135 100644
--- a/xmloff/qa/unit/text.cxx
+++ b/xmloff/qa/unit/text.cxx
@@ -796,6 +796,72 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, 
testDateContentControlImport)
 CPPUNIT_ASSERT_EQUAL(OUString("2022-05-25T00:00:00Z"), aCurrentDate);
 }
 
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlExport)
+{
+// Given a document with a plain text content control around a text 
portion:
+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("PlainText", uno::Any(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::Any(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 test would have failed with:
+// - XPath '//loext:content-control' no attribute 'plain-text' exist
+// i.e. the plain text content control was turned into a rich text one on 
export.
+assertXPath(pXmlDoc, "//loext:content-control", "plain-text", "true");
+}
+
+CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testPlainTextContentControlImport)
+{
+// Given an ODF document with a plain-text content control:
+OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + 
"content-control-plain-text.fodt";
+
+// When loading that document:
+getComponent() = loadFromDesktop(aURL);
+
+// Then make sure th