[Libreoffice-commits] core.git: hwpfilter/source lotuswordpro/inc lotuswordpro/source scaddins/source

2021-11-13 Thread Hossein (via logerrit)
 hwpfilter/source/hcode.cxx  |   18 ++-
 hwpfilter/source/hwpreader.cxx  |   45 +---
 lotuswordpro/inc/xfilter/xfdrawobj.hxx  |3 +
 lotuswordpro/inc/xfilter/xfglobal.hxx   |2 -
 lotuswordpro/source/filter/lwpdrawobj.cxx   |3 +
 scaddins/source/analysis/analysis.cxx   |2 -
 scaddins/source/analysis/analysishelper.hxx |6 ---
 7 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit 35c85effecb5a615a361c1b7d92d08447bc83423
Author: Hossein 
AuthorDate: Thu Nov 11 00:00:38 2021 +0100
Commit: Mike Kaganski 
CommitDate: Sun Nov 14 08:14:15 2021 +0100

Use M_PI instead of defined value; use rad2deg()

* Replace defined values of PI with M_PI defined in 
* Use M_PI_2 instead of PI / 2.0
* Instances could be found with:

git grep 3.14 *.cxx *.hxx|grep define

* One instance is ignored:

  sc/source/core/opencl/opinlinefun_statistical.cxx

* Replace *(180 / PI) with basegfx::rad2deg()
* Replace 2*PI/360 with basegfx::deg2rad()
* Use atan2 instead of atan where it was more appropriate
  + atan2() handles all 4 quadrants
  + Extra conditions for different quadrants are removed

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

diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx
index ff133cebd25a..514e594a2c49 100644
--- a/hwpfilter/source/hcode.cxx
+++ b/hwpfilter/source/hcode.cxx
@@ -24,17 +24,16 @@
  * Special johap code => ks code => unicode
  */
 #include "precompile.h"
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include "hcode.h"
 #include "ksc5601.h"
 
-#define PI 3.14159265358979323846
-
 static hchar jaso2ks(hchar hh);
 
 // ccvHH2ASCcode convert HWP20 to ASC(KSSM)
@@ -1445,17 +1444,8 @@ double calcAngle(int x1, int y1, int x2, int y2)
 return 270.;
  }
  double angle;
- angle = (180 / PI) * atan( ( y2 - y1 ) * 1.0 / ( x2 - x1 ));
- if( y2 >= y1 ){ /* 1, 2 quadrant */
-  if( angle < 0. )
-angle += 180.;
- }
- else{ /* 3, 4 quadrants */
-  if( angle > 0 )
-angle += 180.;
-  else
-angle += 360.;
- }
+ // atan2 handles all 4 quadrants
+ angle = basegfx::rad2deg(atan2(y2 - y1 , x2 - x1));
  return angle;
 }
 
diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 43f48d535a0a..54684bb51eec 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -22,11 +22,12 @@
 #include 
 
 #include "hwpreader.hxx"
-#include 
+#include 
 
 #include 
 #include 
 #include 
+#include 
 
 #include "fontmap.hxx"
 #include "formula.h"
@@ -50,8 +51,6 @@
 #define WTMM(x) (static_cast(x) / 1800. * 25.4)  // unit => mm
 #define WTSM(x) (static_cast((x) / 1800. * 2540))   // unit ==> 1/100 
mm
 
-#define PI 3.14159265358979323846
-
 // xmloff/xmlkyd.hxx
 constexpr OUStringLiteral sXML_CDATA = u"CDATA";
 
@@ -4049,14 +4048,14 @@ void HwpReader::makePictureDRAW(HWPDrawingObject 
*drawobj, Picture * hbox)
 /* 2 - rotation angle calculation */
 if( pt[1].x == pt[0].x ){
  if( pt[1].y > pt[0].y )
- rotate = PI/2;
+ rotate = M_PI_2;
  else
- rotate = -(PI/2);
+ rotate = -M_PI_2;
 }
 else
 rotate = atan(static_cast( pt[1].y - pt[0].y 
)/(pt[1].x - pt[0].x ));
 if( pt[1].x < pt[0].x )
-rotate += PI;
+rotate += M_PI;
 
 for( i = 0 ; i < 3 ; i++){
  r_pt[i].x = static_cast(pt[i].x * cos(-rotate) - 
pt[i].y * sin(-rotate));
@@ -4068,10 +4067,10 @@ void HwpReader::makePictureDRAW(HWPDrawingObject 
*drawobj, Picture * hbox)
  skewX = 0;
 else
  skewX = atan(static_cast(r_pt[2].x - 
r_pt[1].x )/( r_pt[2].y - r_pt[1].y ));
-if( skewX >= PI/2 )
- skewX -= PI;
-if( skewX <= -PI/2 )
- skewX += PI;
+if( skewX >= M_PI_2 )
+ skewX -= M_PI;
+if( skewX <= -M_PI_2 )
+ skewX += M_PI;
 
 OUString trans;
 if( skewX != 0.0 && rotate != 0.0 ){
@@ -4264,38 +4263,38 @@ void HwpReader::makePictureDRAW(HWPDrawingObject 
*drawobj, Picture * hbox)
 
 if( pal->pt[1].x == pal->pt[0].x ){
 if( pal->pt[0].y < pal->pt[1].y )
- 

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

2021-11-13 Thread Jim Raykowski (via logerrit)
 sw/source/uibase/utlui/content.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 4d4278b1403d38b34ff80ca2a92164f40abd9c36
Author: Jim Raykowski 
AuthorDate: Fri Nov 12 00:18:07 2021 -0900
Commit: Jim Raykowski 
CommitDate: Sun Nov 14 05:31:32 2021 +0100

SwNavigator: Fix expanded Headings/Outlines not staying expanded

Fixes expanded Headings/Outlines in the Navigator content tree
collapsing to first level children when a change to the document causes
content tree update or when Headings/Outlines is toggled between root
content navigation view.

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

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index f938d8e2617a..19af01d363a8 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -2025,6 +2025,8 @@ bool SwContentTree::RequestingChildren(const 
weld::TreeIter& rParent)
 
 // add this node as a parent candidate for any following 
nodes at a higher outline level
 
aParentCandidates.emplace_back(m_xTreeView->make_iterator(xChild.get()));
+
+bChild = true;
 }
 }
 }


[Libreoffice-commits] core.git: editeng/source embeddedobj/source embedserv/source filter/source libreofficekit/qa libreofficekit/source sw/qa sw/source vcl/win writerfilter/source

2021-11-13 Thread Mike Kaganski (via logerrit)
 editeng/source/items/numitem.cxx|4 +-
 embeddedobj/source/msole/olecomponent.cxx   |   19 +---
 embedserv/source/embed/docholder.cxx|9 +++---
 filter/source/msfilter/eschesdo.cxx |   11 ++-
 filter/source/msfilter/eschesdo.hxx |6 ++--
 libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx |   28 +-
 libreofficekit/source/gtk/tilebuffer.cxx|7 +++-
 libreofficekit/source/gtk/tilebuffer.hxx|2 -
 sw/qa/extras/uiwriter/uiwriter4.cxx |4 ++
 sw/source/core/doc/docdesc.cxx  |   10 +++---
 sw/source/core/doc/number.cxx   |   30 ++--
 vcl/win/dtrans/FmtFilter.cxx|   15 +-
 writerfilter/source/dmapper/ConversionHelper.cxx|2 -
 writerfilter/source/dmapper/PropertyMap.cxx |   29 ++-
 14 files changed, 89 insertions(+), 87 deletions(-)

New commits:
commit 7b8f630db30ee0066a9f4b6e540368d2fcad7fa8
Author: Mike Kaganski 
AuthorDate: Sun Nov 14 00:09:43 2021 +0300
Commit: Mike Kaganski 
CommitDate: Sat Nov 13 23:38:37 2021 +0100

Use o3tl::convert

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

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index b862b866c50f..7d897595b0ef 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -698,11 +698,11 @@ SvxNumRule::SvxNumRule( SvxNumRuleFlags nFeatures,
 SvxNumberFormat::LABEL_ALIGNMENT )
 {
 // first line indent of general numbering in inch: -0,25 
inch
-const tools::Long cFirstLineIndent = -1440/4;
+constexpr tools::Long cFirstLineIndent = 
o3tl::toTwips(-0.25, o3tl::Length::in);
 // indent values of general numbering in inch:
 //  0,5 0,751,0 1,251,5
 //  1,752,0 2,252,5 2,75
-const tools::Long cIndentAt = 1440/4;
+constexpr tools::Long cIndentAt = o3tl::toTwips(0.25, 
o3tl::Length::in);
 aFmts[i]->SetPositionAndSpaceMode( 
SvxNumberFormat::LABEL_ALIGNMENT );
 aFmts[i]->SetLabelFollowedBy( SvxNumberFormat::LISTTAB );
 aFmts[i]->SetListtabPos( cIndentAt * (i+2) );
diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index d0b0e65a..1aec0c704926 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -1031,27 +1032,23 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
 if ( pMF )
 {
 // the object uses 0.01 mm as unit, so the metafile size 
should be converted to object unit
-sal_Int64 nMult = 1;
-sal_Int64 nDiv = 1;
+o3tl::Length eFrom = o3tl::Length::mm100;
 switch( pMF->mm )
 {
 case MM_HIENGLISH:
-nMult = 254;
-nDiv = 100;
+eFrom = o3tl::Length::in1000;
 break;
 
 case MM_LOENGLISH:
-nMult = 254;
-nDiv = 10;
+eFrom = o3tl::Length::in100;
 break;
 
 case MM_LOMETRIC:
-nMult = 10;
+eFrom = o3tl::Length::mm10;
 break;
 
 case MM_TWIPS:
-nMult = 254;
-nDiv = 144;
+eFrom = o3tl::Length::twip;
 break;
 
 case MM_ISOTROPIC:
@@ -1061,8 +1058,8 @@ awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
 break;
 }
 
-sal_Int64 nX = static_cast(abs( pMF->xExt )) * 
nMult / nDiv;
-sal_Int64 nY = static_cast(abs( pMF->yExt )) * 
nMult / nDiv;
+sal_Int64 nX = o3tl::convert(abs( pMF->xExt ), eFrom, 
o3tl::Length::mm100);
+sal_Int64 nY = o3tl::convert(abs( pMF->yExt ), eFrom, 
o3tl::Length::mm100);
 if (  nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 )
 {
 aSize.Width = static_cast(nX);
diff --git a/embedserv/sou

Test failed `TestBreakIterator::testLao` with icu 70

2021-11-13 Thread oxalica
Hello,

I'm on NixOS and we recently updated a libreoffice dependency `icu` to 70.



When building libreoffice 7.2.2.2 with `--with-system-libs`, it builds 
successfully but fails exact one unit test.

> /build/libreoffice-7.2.2.2/i18npool/qa/cppunit/test_breakiterator.cxx:865:TestBreakIterator::testLao
> equality assertion failed
> - Expected: 9
> - Actual  : 12

I can confirm that downgrading `icu` back to 69.0 fixes the test 
failure. But I'm not sure what is this test doing and I cannot read Lao. 
Does the test need updating, or there it's an issue of the new `icu` 70.0?

I also notice that the `testLao` is currently guarded and only be 
enabled if icu >51. Does it depends on some icu behaviors and we should 
also exclude it for icu >=70?

The full log of build and test can be seen here,


Thanks,
Oxalica



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

2021-11-13 Thread Henry Castro (via logerrit)
 sw/source/ui/fldui/fldtdlg.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit ead2aa7a7088aa2b41a90746351fdf74822dbbe0
Author: Henry Castro 
AuthorDate: Fri Nov 12 11:30:13 2021 -0400
Commit: Andras Timar 
CommitDate: Sat Nov 13 20:23:34 2021 +0100

lok: sw: remove database tab

It is not functional the database feature yet.

Change-Id: Iea073512424a738dc2d789923740b837d6f3d691
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125113
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Andras Timar 

diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx
index 8c1bb998fb85..5a0a8022262a 100644
--- a/sw/source/ui/fldui/fldtdlg.cxx
+++ b/sw/source/ui/fldui/fldtdlg.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -93,6 +94,9 @@ SwFieldDlg::SwFieldDlg(SfxBindings* pB, SwChildWinWrapper* 
pCW, weld::Window *pP
 RemoveTabPage("functions");
 RemoveTabPage("database");
 }
+
+if (comphelper::LibreOfficeKit::isActive())
+RemoveTabPage("database");
 }
 
 SwFieldDlg::~SwFieldDlg()


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

2021-11-13 Thread Regina Henschel (via logerrit)
 svx/qa/unit/svdraw.cxx |   26 ++
 1 file changed, 2 insertions(+), 24 deletions(-)

New commits:
commit 44f20abf66ce3f9806ad95522d7d9ae698350499
Author: Regina Henschel 
AuthorDate: Sat Nov 13 15:10:52 2021 +0100
Commit: Regina Henschel 
CommitDate: Sat Nov 13 18:42:09 2021 +0100

use new method too in existing unit tests in svdraw.cxx

Commit 87e5cac has introduced a local method for a common part of the
new unit tests. Identical parts are used in two existing unit tests.
The patch replaces them with calls to the new method.

Change-Id: I2945add642ac38048dd1fab4ffc3f2649a261650
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125168
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index f213af12f7de..cab6b56b0ae7 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -127,19 +127,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testSemiTransparentText)
 auto pDrawPage = dynamic_cast(xDrawPage.get());
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
-ScopedVclPtrInstance aVirtualDevice;
-sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
-   { 
pSdrPage->GetObj(0) }, nullptr);
-const sdr::contact::ViewObjectContact& rDrawPageVOContact
-= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
-sdr::contact::DisplayInfo aDisplayInfo;
-drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
-rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, 
xPrimitiveSequence);
+xmlDocUniquePtr pDocument = 
lcl_dumpAndParseFirstObjectWithAssert(pSdrPage);
 
 // Make sure the text is semi-transparent.
-drawinglayer::Primitive2dXmlDump aDumper;
-xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
-
 // Without the accompanying fix in place, this test would have failed with:
 // - Expected: 1
 // - Actual  : 0
@@ -401,19 +391,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testFontWorks)
 auto pDrawPage = dynamic_cast(xDrawPage.get());
 CPPUNIT_ASSERT(pDrawPage);
 SdrPage* pSdrPage = pDrawPage->GetSdrPage();
-
-ScopedVclPtrInstance aVirtualDevice;
-sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice,
-   { 
pSdrPage->GetObj(0) }, nullptr);
-const auto& rDrawPageVOContact
-= pSdrPage->GetViewContact().GetViewObjectContact(aObjectContact);
-sdr::contact::DisplayInfo aDisplayInfo;
-drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence;
-rDrawPageVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, 
xPrimitiveSequence);
-
-drawinglayer::Primitive2dXmlDump aDumper;
-xmlDocUniquePtr pXmlDoc = aDumper.dumpAndParse(xPrimitiveSequence);
-CPPUNIT_ASSERT(pXmlDoc);
+xmlDocUniquePtr pXmlDoc = lcl_dumpAndParseFirstObjectWithAssert(pSdrPage);
 
 assertXPath(pXmlDoc, "/primitive2D", 1);
 


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

2021-11-13 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/physicalfontcollection.cxx |  433 +-
 1 file changed, 426 insertions(+), 7 deletions(-)

New commits:
commit 97ef7881cec4f7baa1ef8e7b6b84b6848f8c5f4a
Author: Chris Sherlock 
AuthorDate: Sat Oct 9 19:46:13 2021 +1100
Commit: Hossein 
CommitDate: Sat Nov 13 17:59:37 2021 +0100

tdf#144961 vcl: test PhysicalFontCollection::FindFontFamilyByAttributes()

Note there are missing tests that I will add in the next patch

Change-Id: I98bfb27c424c615f240c687cb5251fe958b4a032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123308
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/vcl/qa/cppunit/physicalfontcollection.cxx 
b/vcl/qa/cppunit/physicalfontcollection.cxx
index 7a261268119a..98ac902032ff 100644
--- a/vcl/qa/cppunit/physicalfontcollection.cxx
+++ b/vcl/qa/cppunit/physicalfontcollection.cxx
@@ -19,6 +19,8 @@
 
 #include 
 
+constexpr int FONTID = 1;
+
 class VclPhysicalFontCollectionTest : public test::BootstrapFixture
 {
 public:
@@ -32,6 +34,29 @@ public:
 void testShouldNotFindFontFamily();
 void testShouldFindFontFamilyByTokenNames();
 void testShouldFindNoFamilyWithWorthlessAttributes();
+void testShouldFindCJKFamily();
+void testShouldFindStarsymbolFamily();
+void testShouldFindOpensymbolFamilyWithMultipleSymbolFamilies();
+void testShouldFindSymboltypeFamily();
+void testShouldFindSymbolFamilyByMatchType();
+void testImpossibleSymbolFamily();
+void testShouldNotFindSymbolFamily();
+void testShouldMatchFamilyName();
+void testShouldMatchBrushScriptFamily();
+void testShouldNotMatchBrushScriptFamily();
+void testShouldMatchFixedFamily();
+void testShouldNotMatchFixedFamily();
+void testShouldMatchSerifFamily();
+void testShouldNotMatchSerifFamily();
+void testShouldMatchSansSerifFamily();
+void testShouldNotMatchSansSerifFamily();
+void testShouldMatchDecorativeFamily();
+void testShouldFindTitlingFamily();
+void testShouldFindCapitalsFamily();
+void testShouldFindFamilyName();
+void testShouldFindOtherStyleFamily();
+void testShouldNotFindOtherStyleFamily();
+void testShouldFindSchoolbookFamily();
 
 CPPUNIT_TEST_SUITE(VclPhysicalFontCollectionTest);
 CPPUNIT_TEST(testShouldCreateAndAddFontFamilyToCollection);
@@ -39,6 +64,29 @@ public:
 CPPUNIT_TEST(testShouldNotFindFontFamily);
 CPPUNIT_TEST(testShouldFindFontFamilyByTokenNames);
 CPPUNIT_TEST(testShouldFindNoFamilyWithWorthlessAttributes);
+CPPUNIT_TEST(testShouldFindCJKFamily);
+CPPUNIT_TEST(testShouldFindStarsymbolFamily);
+CPPUNIT_TEST(testShouldFindOpensymbolFamilyWithMultipleSymbolFamilies);
+CPPUNIT_TEST(testShouldFindSymboltypeFamily);
+CPPUNIT_TEST(testShouldFindSymbolFamilyByMatchType);
+CPPUNIT_TEST(testImpossibleSymbolFamily);
+CPPUNIT_TEST(testShouldNotFindSymbolFamily);
+CPPUNIT_TEST(testShouldMatchFamilyName);
+CPPUNIT_TEST(testShouldMatchBrushScriptFamily);
+CPPUNIT_TEST(testShouldNotMatchBrushScriptFamily);
+CPPUNIT_TEST(testShouldMatchFixedFamily);
+CPPUNIT_TEST(testShouldNotMatchFixedFamily);
+CPPUNIT_TEST(testShouldMatchSerifFamily);
+CPPUNIT_TEST(testShouldNotMatchSerifFamily);
+CPPUNIT_TEST(testShouldMatchSansSerifFamily);
+CPPUNIT_TEST(testShouldNotMatchSansSerifFamily);
+CPPUNIT_TEST(testShouldMatchDecorativeFamily);
+CPPUNIT_TEST(testShouldFindTitlingFamily);
+CPPUNIT_TEST(testShouldFindCapitalsFamily);
+CPPUNIT_TEST(testShouldFindFamilyName);
+CPPUNIT_TEST(testShouldFindOtherStyleFamily);
+CPPUNIT_TEST(testShouldNotFindOtherStyleFamily);
+CPPUNIT_TEST(testShouldFindSchoolbookFamily);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -51,16 +99,16 @@ void 
VclPhysicalFontCollectionTest::testShouldCreateAndAddFontFamilyToCollection
 // please note that fonts created this way are NOT normalized and will not 
be found if you search for them in the collection
 vcl::font::PhysicalFontFamily* pFontFamily
 = aFontCollection.FindOrCreateFontFamily("Test Font Family Name");
-CPPUNIT_ASSERT_EQUAL_MESSAGE("One font family in collection", 
static_cast(1),
- aFontCollection.Count());
-CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name correct", OUString("Test 
Font Family Name"),
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Does not have only one font family in 
collection",
+ static_cast(1), aFontCollection.Count());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name not correct", 
OUString("Test Font Family Name"),
  pFontFamily->GetSearchName());
 
 vcl::font::PhysicalFontFamily* pFontFamily2
 = aFontCollection.FindOrCreateFontFamily("Test Font Family Name");
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Still only one font family in collection", 
static_cast(1),
  aFontCollection.Count());
-CPPUNIT_ASS

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

2021-11-13 Thread Thorsten Behrens (via logerrit)
 configure.ac |4 
 1 file changed, 4 insertions(+)

New commits:
commit a323857126dd420f73492a82f31bb7c8d5400ffb
Author: Thorsten Behrens 
AuthorDate: Fri Nov 12 00:34:12 2021 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Nov 13 16:39:40 2021 +0100

No auto-usage of [s]ccache on Windows for PCH builds

Since that's a pessimisation. Any manual override
(--enable-ccache, or --disable-pch) will again make configure
auto-enable [s]ccache if binaries are found.

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

diff --git a/configure.ac b/configure.ac
index 23c2beaceefd..2f1764ac09cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5857,6 +5857,10 @@ if test -z "$enable_pch"; then
 if test "$_os" = "WINNT"; then
 # Enabled by default on Windows.
 enable_pch=yes
+# never use [s]ccache on auto-enabled PCH builds, except if requested 
explicitely
+if test -z "$enable_ccache"; then
+CCACHE=""
+fi
 else
 enable_pch=no
 fi


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

2021-11-13 Thread Noel Grandin (via logerrit)
 include/oox/token/tokenmap.hxx |4 +---
 oox/source/core/fasttokenhandler.cxx   |2 +-
 oox/source/drawingml/customshapeproperties.cxx |2 +-
 oox/source/mathml/importutils.cxx  |2 +-
 oox/source/token/tokenmap.cxx  |6 ++
 5 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 39f4fd491ca5abaa8a01b75eb500bb82248ff4aa
Author: Noel Grandin 
AuthorDate: Fri Nov 12 19:36:06 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 13 15:59:32 2021 +0100

rtl::Static->thread-safe static

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

diff --git a/include/oox/token/tokenmap.hxx b/include/oox/token/tokenmap.hxx
index 60aeb8082001..db71c24c2371 100644
--- a/include/oox/token/tokenmap.hxx
+++ b/include/oox/token/tokenmap.hxx
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -87,8 +86,7 @@ private:
 };
 
 
-struct StaticTokenMap : public ::rtl::Static< TokenMap, StaticTokenMap > {};
-
+TokenMap& StaticTokenMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fasttokenhandler.cxx 
b/oox/source/core/fasttokenhandler.cxx
index a57be30e0c2c..398772df058f 100644
--- a/oox/source/core/fasttokenhandler.cxx
+++ b/oox/source/core/fasttokenhandler.cxx
@@ -30,7 +30,7 @@ namespace oox::core {
 using namespace ::com::sun::star::uno;
 
 FastTokenHandler::FastTokenHandler() :
-mrTokenMap( StaticTokenMap::get() )
+mrTokenMap( StaticTokenMap() )
 {
 }
 
diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index ac11d2d7eaa6..977afab04a6a 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -55,7 +55,7 @@ CustomShapeProperties::CustomShapeProperties()
 
 uno::Sequence< sal_Int8 > const & 
CustomShapeProperties::getShapePresetTypeName() const
 {
-return StaticTokenMap::get().getUtf8TokenName( mnShapePresetType );
+return StaticTokenMap().getUtf8TokenName( mnShapePresetType );
 }
 
 sal_Int32 CustomShapeProperties::SetCustomShapeGuideValue( std::vector< 
CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide )
diff --git a/oox/source/mathml/importutils.cxx 
b/oox/source/mathml/importutils.cxx
index 962528acba2a..16f527389924 100644
--- a/oox/source/mathml/importutils.cxx
+++ b/oox/source/mathml/importutils.cxx
@@ -51,7 +51,7 @@ AttributeListBuilder::AttributeListBuilder( const 
uno::Reference< xml::sax::XFas
 
 OString tokenToString( int token )
 {
-uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap::get().getUtf8TokenName( token & TOKEN_MASK );
+uno::Sequence< sal_Int8 > const & aTokenNameSeq = 
StaticTokenMap().getUtf8TokenName( token & TOKEN_MASK );
 OString tokenname( reinterpret_cast< const char* >( 
aTokenNameSeq.getConstArray() ), aTokenNameSeq.getLength() );
 if( tokenname.isEmpty())
 tokenname = "???";
diff --git a/oox/source/token/tokenmap.cxx b/oox/source/token/tokenmap.cxx
index 7cbba35009ae..1e51116192c6 100644
--- a/oox/source/token/tokenmap.cxx
+++ b/oox/source/token/tokenmap.cxx
@@ -87,6 +87,12 @@ sal_Int32 TokenMap::getTokenPerfectHash( const char *pStr, 
sal_Int32 nLength )
 return pToken ? pToken->nToken : XML_TOKEN_INVALID;
 }
 
+TokenMap& StaticTokenMap()
+{
+static TokenMap SINGLETON;
+return SINGLETON;
+}
+
 } // namespace oox
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2021-11-13 Thread Mike Kaganski (via logerrit)
 extensions/source/scanner/twain32shim.cxx |   39 +-
 1 file changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 1b6e3efe964eec9110e656a8242f6f4d8b5e7f7e
Author: Mike Kaganski 
AuthorDate: Sat Nov 13 14:05:41 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sat Nov 13 15:55:54 2021 +0100

Simplify m_aAppId initialization

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

diff --git a/extensions/source/scanner/twain32shim.cxx 
b/extensions/source/scanner/twain32shim.cxx
index 8821a3b0cabc..eab704fcb8db 100644
--- a/extensions/source/scanner/twain32shim.cxx
+++ b/extensions/source/scanner/twain32shim.cxx
@@ -169,26 +169,21 @@ HANDLE GetProcOfThread(HANDLE hThread)
 }
 
 ImpTwain::ImpTwain(HANDLE hParentThread)
-: m_nParentThreadId(GetThreadId(hParentThread))
+: m_aAppId{ /* Id  */ 0,
+{ /* Version.MajorNum */ 1,
+  /* Version.MinorNum */ 0,
+  /* Version.Language */ TWLG_USA,
+  /* Version.Country  */ TWCY_USA,
+  /* Version.Info */ "8.0" },
+/* ProtocolMajor   */ TWON_PROTOCOLMAJOR,
+/* ProtocolMinor   */ TWON_PROTOCOLMINOR,
+/* SupportedGroups */ DG_IMAGE | DG_CONTROL,
+/* Manufacturer*/ "Sun Microsystems",
+/* ProductFamily   */ "Office",
+/* ProductName */ "Office" }
+, m_nParentThreadId(GetThreadId(hParentThread))
 , m_hProc(GetProcOfThread(hParentThread))
 {
-m_aAppId.Id = 0;
-m_aAppId.Version.MajorNum = 1;
-m_aAppId.Version.MinorNum = 0;
-m_aAppId.Version.Language = TWLG_USA;
-m_aAppId.Version.Country = TWCY_USA;
-m_aAppId.ProtocolMajor = TWON_PROTOCOLMAJOR;
-m_aAppId.ProtocolMinor = TWON_PROTOCOLMINOR;
-m_aAppId.SupportedGroups = DG_IMAGE | DG_CONTROL;
-strncpy(m_aAppId.Version.Info, "8.0", 32);
-m_aAppId.Version.Info[32] = m_aAppId.Version.Info[33] = 0;
-strncpy(m_aAppId.Manufacturer, "Sun Microsystems", 32);
-m_aAppId.Manufacturer[32] = m_aAppId.Manufacturer[33] = 0;
-strncpy(m_aAppId.ProductFamily, "Office", 32);
-m_aAppId.ProductFamily[32] = m_aAppId.ProductFamily[33] = 0;
-strncpy(m_aAppId.ProductName, "Office", 32);
-m_aAppId.ProductName[32] = m_aAppId.ProductName[33] = 0;
-
 WNDCLASSW aWc = { 0,   &WndProc, 0,   sizeof(WNDCLASSW), 
GetModuleHandleW(nullptr),
   nullptr, nullptr,  nullptr, nullptr,   
sTwainWndClass };
 if (!RegisterClassW(&aWc))
@@ -387,15 +382,17 @@ void ImpTwain::ImplXfer()
 {
 TW_IMAGEINFO aInfo;
 HANDLE hDIB = nullptr;
-TW_INT32 nXRes, nYRes;
+TW_INT32 nWidth, nHeight, nXRes, nYRes;
 
 if (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, 
&aInfo) == TWRC_SUCCESS)
 {
+nWidth = aInfo.ImageWidth;
+nHeight = aInfo.ImageLength;
 nXRes = FixToInt32(aInfo.XResolution);
 nYRes = FixToInt32(aInfo.YResolution);
 }
 else
-nXRes = nYRes = -1;
+nWidth = nHeight = nXRes = nYRes = -1;
 
 switch (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGENATIVEXFER, 
MSG_GET, &hDIB))
 {
@@ -415,7 +412,7 @@ void ImpTwain::ImplXfer()
 {
 if (LPVOID pBmpMem = GlobalLock(hGlob))
 {
-if ((nXRes != -1) && (nYRes != -1))
+if ((nXRes != -1) && (nYRes != -1) && (nWidth != 
-1) && (nHeight != -1))
 {
 // set resolution of bitmap
 BITMAPINFOHEADER* pBIH = 
static_cast(pBmpMem);


[Libreoffice-commits] core.git: solenv/gbuild

2021-11-13 Thread Luboš Luňák (via logerrit)
 solenv/gbuild/LinkTarget.mk |2 +-
 solenv/gbuild/PrecompiledHeaders.mk |   14 ++
 solenv/gbuild/platform/com_GCC_class.mk |   20 +++-
 solenv/gbuild/platform/com_GCC_defs.mk  |5 +
 solenv/gbuild/platform/com_MSC_class.mk |   12 +++-
 5 files changed, 34 insertions(+), 19 deletions(-)

New commits:
commit 359b53acdb14f1661e35c75d8c17fcac9b59faea
Author: Luboš Luňák 
AuthorDate: Sat Nov 13 09:32:15 2021 +0100
Commit: Luboš Luňák 
CommitDate: Sat Nov 13 13:43:39 2021 +0100

do not rebuild PCHs on icecream/ccache change

We turn -Wunused-macros on or off depending on whether icecream/ccache
are used, and since now PCHs rebuild on CXXFLAGS changes, a plain
temporary 'CCACHE_DISABLE=1' caused a rebuild.

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

diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 71be0790b59b..b0b716ace55b 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -1915,7 +1915,7 @@ $(call gb_LinkTarget_get_pch_reuse_timestamp,$(4)) : 
$(call gb_PrecompiledHeader
$(call gb_PrecompiledHeader_check_flags,$(4),$(2),\
$(call gb_PrecompiledHeader_get_target,$(3),$(4)),\
$(call gb_PrecompiledHeader_get_flags_file,$(3),$(4)),\
-   $$(PCH_CXXFLAGS) $$(PCH_DEFS) $$(gb_LinkTarget_EXCEPTIONFLAGS))
+   $(gb_PrecompiledHeader_cxxflags_includes))
$$(call gb_PrecompiledHeader__copy_reuse_files,$(1),$(3),$(4))
mkdir -p $$(dir $$@) && touch $$@
 
diff --git a/solenv/gbuild/PrecompiledHeaders.mk 
b/solenv/gbuild/PrecompiledHeaders.mk
index 28f2308c8e92..73cc86c88ee7 100644
--- a/solenv/gbuild/PrecompiledHeaders.mk
+++ b/solenv/gbuild/PrecompiledHeaders.mk
@@ -36,6 +36,12 @@ ifneq ($(gb_ENABLE_PCH),)
 # for $(1)'s and things that are constant.
 # The defines are needed to get the right version of 
gb_PrecompiledHeader__get_debugdir.
 
+# all cxxflags to use for compilation
+gb_PrecompiledHeader_cxxflags_includes := $$(PCH_DEFS) $$(PCH_CXXFLAGS) 
$$(gb_PrecompiledHeader_EXCEPTIONFLAGS)
+# flags to save to the .flags file to check if they are the same as last time
+gb_PrecompiledHeader_flags_for_flags_file := $$(sort 
$(gb_PrecompiledHeader_cxxflags_includes)) \
+$(if $(gb_PrecompiledHeader_ignore_flags_for_flags_file),| sed 
's/$(gb_PrecompiledHeader_ignore_flags_for_flags_file)//')
+
 # $(call 
gb_PrecompiledHeader_generate_rules,pchtarget,linktarget,linktargetmakefilename,pchcxxfile,compiler)
 define gb_PrecompiledHeader_generate_rules
 
@@ -48,8 +54,8 @@ $(call gb_PrecompiledHeader_get_dep_target,$(1),$(3)) :
 # change, and make the PCH depend on it => the PCH will be rebuilt on any 
flags change
 .PHONY: force
 $(call gb_PrecompiledHeader_get_flags_file,$(1),$(3)) : force
-   echo $$(sort $$(PCH_DEFS) $$(PCH_CXXFLAGS) 
$$(gb_PrecompiledHeader_EXCEPTIONFLAGS)) | cmp -s - $$@ \
-   || echo $$(sort $$(PCH_DEFS) $$(PCH_CXXFLAGS) 
$$(gb_PrecompiledHeader_EXCEPTIONFLAGS)) > $$@
+   echo $(gb_PrecompiledHeader_flags_for_flags_file) | cmp -s - $$@ \
+   || echo $(gb_PrecompiledHeader_flags_for_flags_file) > $$@
 
 # despite this being only one .d file, need to run concat-deps on it to
 # re-write external headers from UnpackedTarball
@@ -57,8 +63,8 @@ $(call gb_PrecompiledHeader_get_target,$(1),$(3)) :
test "$$(PCH_LINKTARGETMAKEFILENAME)" = "$(3)" \
 || ( echo "Error, PCH $(1) built by 
$$(PCH_LINKTARGETMAKEFILENAME) instead of $(3)" >&2; exit 1)
rm -f $$@
-   $$(call 
gb_PrecompiledHeader__command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) 
$$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3),$(5))
-   $$(call 
gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$$(PCH_DEFS),$$(PCH_CXXFLAGS) 
$$(gb_PrecompiledHeader_EXCEPTIONFLAGS),$$(INCLUDE),$(3))
+   $$(call 
gb_PrecompiledHeader__command,$$@,$(1),$$<,$(gb_PrecompiledHeader_cxxflags_includes),$$(INCLUDE),$(3),$(5))
+   $$(call 
gb_PrecompiledHeader__sum_command,$$@,$(1),$$<,$(gb_PrecompiledHeader_cxxflags_includes),$$(INCLUDE),$(3))
 ifeq ($(gb_FULLDEPS),$(true))
$$(call gb_Helper_abbreviate_dirs,\
RESPONSEFILE=$$(call gb_var2file,$$(shell 
$$(gb_MKTEMP)),200,$$(call gb_PrecompiledHeader_get_dep_target_tmp,$(1),$(3))) 
&& \
diff --git a/solenv/gbuild/platform/com_GCC_class.mk 
b/solenv/gbuild/platform/com_GCC_class.mk
index 58ec04c513bb..ba12572f4341 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -129,51 +129,53 @@ endif
 # This is for MSVC's object file built directly as a side-effect of building 
the PCH.
 gb_PrecompiledHeader_get_objectfile =
 
+# $(call 
gb_PrecompiledHeader__command,pchfile,pchtarget,source,cxxflags,includes,linktargetmakefilename,compiler)
 define gb_

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

2021-11-13 Thread Julien Nabet (via logerrit)
 vcl/skia/SkiaHelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7dc558c29841b9934d1fcadc19fa155b38374feb
Author: Julien Nabet 
AuthorDate: Sat Nov 13 12:28:16 2021 +0100
Commit: Julien Nabet 
CommitDate: Sat Nov 13 13:40:09 2021 +0100

loplugin:conststringvar

[CXX] vcl/source/window/keycod.cxx
/home/julien/lo/libreoffice/vcl/skia/SkiaHelper.cxx:664:21: error: variable 
is only used as rvalue, should be const [loplugin:conststringvar]
const char* diff = R"(
^~
1 error generated.

From 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=110fa313628c55fef1d35830358aea7e27c1e3ee
get rid of Skia's 'rasterhack' for Invert()
It seems that manually writing a shader that does the same
as SkBlendMode::kDifference works fine even though the blend mode
crashes e.g. on Windows/AMD. So get rid of the memory<->GPU
conversions and use the shader as a workaround.

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

diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index ed04e5f20ec0..57bde5abf919 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -661,7 +661,7 @@ void setBlendModeDifference(SkPaint* paint)
 // so do that.
 if (!differenceBlender)
 {
-const char* diff = R"(
+const char* const diff = R"(
 vec4 main( vec4 src, vec4 dst )
 {
 return vec4(abs( src.r - dst.r ), abs( src.g - dst.g ), abs( 
src.b - dst.b ), dst.a );


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

2021-11-13 Thread Noel Grandin (via logerrit)
 include/oox/token/namespacemap.hxx |7 ++-
 oox/source/core/fastparser.cxx |2 +-
 oox/source/core/xmlfilterbase.cxx  |2 +-
 oox/source/token/namespacemap.cxx  |7 +++
 4 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit bf2048b1d242c6d5b242f18903612cedf8eaef8e
Author: Noel Grandin 
AuthorDate: Thu Nov 11 20:59:11 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Nov 13 13:01:06 2021 +0100

rtl::Static->thread-safe static in StaticNamespaceMap

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

diff --git a/include/oox/token/namespacemap.hxx 
b/include/oox/token/namespacemap.hxx
index 26e4fdce95f7..c02a39ba7bf8 100644
--- a/include/oox/token/namespacemap.hxx
+++ b/include/oox/token/namespacemap.hxx
@@ -22,7 +22,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -40,10 +39,8 @@ struct NamespaceMap
 typedef std::map::const_iterator const_iterator;
 };
 
-/** Thread-save singleton of a map of all supported XML namespace URLs. */
-struct StaticNamespaceMap : public ::rtl::Static
-{
-};
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap();
 
 } // namespace oox
 
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 9524b1403a90..53e5eb78a849 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -62,7 +62,7 @@ InputStreamCloseGuard::~InputStreamCloseGuard()
 } // namespace
 
 FastParser::FastParser() :
-mrNamespaceMap( StaticNamespaceMap::get() )
+mrNamespaceMap( StaticNamespaceMap() )
 {
 // create a fast parser instance
 mxParser = new sax_fastparser::FastSaxParser;
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 6c7aaac65476..7a9728e88f32 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -188,7 +188,7 @@ struct XmlFilterBaseImpl
 constexpr OUStringLiteral gaBinSuffix( u".bin" );
 
 XmlFilterBaseImpl::XmlFilterBaseImpl() :
-mrNamespaceMap(StaticNamespaceMap::get())
+mrNamespaceMap(StaticNamespaceMap())
 {
 // register XML namespaces
 registerNamespaces(maFastParser);
diff --git a/oox/source/token/namespacemap.cxx 
b/oox/source/token/namespacemap.cxx
index 11e7c9f0e45f..1cfa48a1ca28 100644
--- a/oox/source/token/namespacemap.cxx
+++ b/oox/source/token/namespacemap.cxx
@@ -31,6 +31,13 @@ NamespaceMap::NamespaceMap()
 #include 
 };
 }
+
+/** Thread-safe singleton of a map of all supported XML namespace URLs. */
+NamespaceMap& StaticNamespaceMap()
+{
+static NamespaceMap SINGLETON;
+return SINGLETON;
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


New Defects reported by Coverity Scan for LibreOffice

2021-11-13 Thread scan-admin
Hi,

Please find the latest report on new defect(s) introduced to LibreOffice found 
with Coverity Scan.

1 new defect(s) introduced to LibreOffice found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 1 of 1 defect(s)


** CID 1421164:(UNCAUGHT_EXCEPT)
/sw/source/filter/ww8/ww8par3.cxx: 1483 in WW8ListManager::~WW8ListManager()()
/sw/source/filter/ww8/ww8par3.cxx: 1483 in WW8ListManager::~WW8ListManager()()



*** CID 1421164:(UNCAUGHT_EXCEPT)
/sw/source/filter/ww8/ww8par3.cxx: 1483 in WW8ListManager::~WW8ListManager()()
1477 }
1478 }
1479 // and we're done!
1480 rSt.Seek( nOriginalPos );
1481 }
1482 
>>> CID 1421164:(UNCAUGHT_EXCEPT)
>>> An exception of type "com::sun::star::uno::RuntimeException" is thrown 
>>> but the throw list "noexcept" doesn't allow it to be thrown. This will 
>>> cause a call to unexpected() which usually calls terminate().
1483 WW8ListManager::~WW8ListManager()
1484 {
1485 /*
1486  named lists remain in document
1487  unused automatic lists are removed from document (DelNumRule)
1488 */
/sw/source/filter/ww8/ww8par3.cxx: 1483 in WW8ListManager::~WW8ListManager()()
1477 }
1478 }
1479 // and we're done!
1480 rSt.Seek( nOriginalPos );
1481 }
1482 
>>> CID 1421164:(UNCAUGHT_EXCEPT)
>>> An exception of type "com::sun::star::uno::RuntimeException" is thrown 
>>> but the throw list "noexcept" doesn't allow it to be thrown. This will 
>>> cause a call to unexpected() which usually calls terminate().
1483 WW8ListManager::~WW8ListManager()
1484 {
1485 /*
1486  named lists remain in document
1487  unused automatic lists are removed from document (DelNumRule)
1488 */



To view the defects in Coverity Scan visit, 
https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3DLv75_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJipRvWH7RhCXcVwmSha-2FYGpyCHb5KTJqNvmUc9Dxs1ustq-2FvKRr3g8bYtImVoacj1QpxId-2BiN08TbTcBkyomhOO1Ha4PPFQwCMnp-2F3B9ceq-2FcvmkhjZ36yO39YN9ZWZgxfDypOxgr6LfrGB1466xC7jSrgqa-2FSySUvGdoqjlR2DGE-3D



Re: Errors after pull

2021-11-13 Thread Mike Kaganski

On 11.11.2021 21:44, Juan C. Sanz wrote:
After a "make clean" and a new (very long) "make" I've done a new pull 
and next a new make that works as expected.


Note that after changes like 
https://git.libreoffice.org/core/+/3e8214734f9695d7f16c4a37f1a497aeb229d677, 
which touch headers used in many places, the next incremental build will 
necessarily take long, re-compiling everything dependent on the modified 
headers. Be prepared that the codebase changes often, so if you develop, 
you may want to adopt somewhat conservative approach of pulling e.g. 
once in two weeks. (However, don't delay pulling too long - for the very 
same reason: frequent changes may introduce merge conflicts and/or build 
failures.)



--
Best regards,
Mike Kaganski


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

2021-11-13 Thread Mike Kaganski (via logerrit)
 extensions/source/scanner/twain32shim.cxx |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit a339ebca55f53db5f0b72b26fcfbb3aaa2b2a825
Author: Mike Kaganski 
AuthorDate: Sat Nov 13 12:19:49 2021 +0200
Commit: Mike Kaganski 
CommitDate: Sat Nov 13 12:12:45 2021 +0100

Drop unused variables

nWidth/nHeight (1) are irrelevant here (we get the correct pixel size
right in the hDIB), and (2) should not be -1, because we don't use
ICAP_UNDEFINEDIMAGESIZE capability [1].

[1] 
https://twain.org/wp-content/uploads/2017/03/TWAIN-2.4-Specification.pdf#page=268

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

diff --git a/extensions/source/scanner/twain32shim.cxx 
b/extensions/source/scanner/twain32shim.cxx
index 0a34fa13ce7e..8821a3b0cabc 100644
--- a/extensions/source/scanner/twain32shim.cxx
+++ b/extensions/source/scanner/twain32shim.cxx
@@ -387,17 +387,15 @@ void ImpTwain::ImplXfer()
 {
 TW_IMAGEINFO aInfo;
 HANDLE hDIB = nullptr;
-TW_INT32 nWidth, nHeight, nXRes, nYRes;
+TW_INT32 nXRes, nYRes;
 
 if (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGEINFO, MSG_GET, 
&aInfo) == TWRC_SUCCESS)
 {
-nWidth = aInfo.ImageWidth;
-nHeight = aInfo.ImageLength;
 nXRes = FixToInt32(aInfo.XResolution);
 nYRes = FixToInt32(aInfo.YResolution);
 }
 else
-nWidth = nHeight = nXRes = nYRes = -1;
+nXRes = nYRes = -1;
 
 switch (m_pDSM(&m_aAppId, &m_aSrcId, DG_IMAGE, DAT_IMAGENATIVEXFER, 
MSG_GET, &hDIB))
 {
@@ -417,7 +415,7 @@ void ImpTwain::ImplXfer()
 {
 if (LPVOID pBmpMem = GlobalLock(hGlob))
 {
-if ((nXRes != -1) && (nYRes != -1) && (nWidth != 
-1) && (nHeight != -1))
+if ((nXRes != -1) && (nYRes != -1))
 {
 // set resolution of bitmap
 BITMAPINFOHEADER* pBIH = 
static_cast(pBmpMem);


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

2021-11-13 Thread Miklos Vajna (via logerrit)
 svl/source/undo/undo.cxx   |   18 ++--
 sw/qa/extras/tiledrendering/tiledrendering.cxx |   52 +
 sw/source/core/inc/UndoManager.hxx |4 -
 sw/source/core/undo/docundo.cxx|   26 +---
 sw/source/uibase/shells/basesh.cxx |5 +-
 5 files changed, 90 insertions(+), 15 deletions(-)

New commits:
commit c88c2d40d1a4aebc46b25368b80c02bc2f136658
Author: Miklos Vajna 
AuthorDate: Fri Nov 12 08:39:35 2021 +0100
Commit: Mike Kaganski 
CommitDate: Sat Nov 13 10:35:35 2021 +0100

sw, out of order undo: allow multiple actions from other views

Previously we assumed that the action to be executed is always exactly
the top of the undo stack minus 1 element.

Extend this, so that in case an other view appends two or more elements
to the undo stack, we still find our undo action. Obviously only do this
if all those undo actions are independent from us.

This requires replacing the swap in svl/ with a move-out + move a range
down + move in construct.

(cherry picked from commit 39f231360013e944a8713248359662b9f282d902)

Conflicts:
sw/source/core/undo/docundo.cxx

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

diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 5dca45082fce..6bb7bcd21013 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -688,13 +688,21 @@ bool SfxUndoManager::ImplUndo( SfxUndoContext* 
i_contextOrNull )
 return false;
 }
 
-if (i_contextOrNull && i_contextOrNull->GetUndoOffset() == 1)
+if (i_contextOrNull && i_contextOrNull->GetUndoOffset() > 0)
 {
-if (m_xData->pActUndoArray->nCurUndoAction >= 2)
+size_t nCurrent = m_xData->pActUndoArray->nCurUndoAction;
+size_t nOffset = i_contextOrNull->GetUndoOffset();
+if (nCurrent >= nOffset + 1)
 {
-std::swap(
-
m_xData->pActUndoArray->maUndoActions[m_xData->pActUndoArray->nCurUndoAction - 
1],
-
m_xData->pActUndoArray->maUndoActions[m_xData->pActUndoArray->nCurUndoAction - 
2]);
+// Move out the action we want to execute.
+MarkedUndoAction aAction
+= std::move(m_xData->pActUndoArray->maUndoActions[nCurrent - 1 
- nOffset]);
+// Move the actions after aAction down by one.
+std::move(m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset,
+  m_xData->pActUndoArray->maUndoActions.data() + nCurrent,
+  m_xData->pActUndoArray->maUndoActions.data() + nCurrent 
- nOffset - 1);
+// Move aAction to the top.
+m_xData->pActUndoArray->maUndoActions[nCurrent - 1] = 
std::move(aAction);
 }
 }
 
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx 
b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 9b64b64c78e8..ffc81dbc3d63 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -109,6 +109,7 @@ public:
 void testUndoLimiting();
 void testUndoReordering();
 void testUndoReorderingRedo();
+void testUndoReorderingMulti();
 void testUndoShapeLimiting();
 void testUndoDispatch();
 void testUndoRepairDispatch();
@@ -191,6 +192,7 @@ public:
 CPPUNIT_TEST(testUndoLimiting);
 CPPUNIT_TEST(testUndoReordering);
 CPPUNIT_TEST(testUndoReorderingRedo);
+CPPUNIT_TEST(testUndoReorderingMulti);
 CPPUNIT_TEST(testUndoShapeLimiting);
 CPPUNIT_TEST(testUndoDispatch);
 CPPUNIT_TEST(testUndoRepairDispatch);
@@ -1402,6 +1404,56 @@ void SwTiledRenderingTest::testUndoReorderingRedo()
 SfxViewShell::Current()->setLibreOfficeKitViewCallback(nullptr);
 }
 
+void SwTiledRenderingTest::testUndoReorderingMulti()
+{
+// Create two views and a document of 2 paragraphs.
+SwXTextDocument* pXTextDocument = createDoc();
+SwWrtShell* pWrtShell1 = pXTextDocument->GetDocShell()->GetWrtShell();
+int nView1 = SfxLokHelper::getView();
+int nView2 = SfxLokHelper::createView();
+
pXTextDocument->initializeForTiledRendering(uno::Sequence());
+SwWrtShell* pWrtShell2 = pXTextDocument->GetDocShell()->GetWrtShell();
+pWrtShell2->SplitNode();
+SfxLokHelper::setView(nView1);
+pWrtShell1->SttEndDoc(/*bStt=*/true);
+SwTextNode* pTextNode1 = pWrtShell1->GetCursor()->GetNode().GetTextNode();
+// View 1 types into the first paragraph.
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'a', 0);
+pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'a', 0);
+Scheduler::ProcessEventsToIdle();
+SfxLokHelper::setView(nView2);
+pWrtShell2->SttEndDoc(/*bStt=*/false);
+SwTextNode* pTextNode2 = pWrtShell2->GetCursor()->GetNode

[Libreoffice-commits] core.git: include/vcl vcl/backendtest vcl/inc vcl/qa

2021-11-13 Thread Luboš Luňák (via logerrit)
 include/vcl/test/GraphicsRenderTests.hxx  |2 
 vcl/backendtest/GraphicsRenderTests.cxx   |   44 +++
 vcl/backendtest/VisualBackendTest.cxx |   16 +
 vcl/backendtest/outputdevice/common.cxx   |   73 ++
 vcl/backendtest/outputdevice/outputdevice.cxx |   67 ++-
 vcl/inc/test/outputdevice.hxx |4 +
 vcl/qa/cppunit/BackendTest.cxx|   27 +
 7 files changed, 207 insertions(+), 26 deletions(-)

New commits:
commit 9af1dc8a03958c32d4bd56804166293cc1031828
Author: Luboš Luňák 
AuthorDate: Fri Nov 12 21:06:48 2021 +0100
Commit: Luboš Luňák 
CommitDate: Sat Nov 13 10:19:57 2021 +0100

add more tests for OutputDev::DrawOutDev()

Test also copy to self and clipped copy.

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

diff --git a/include/vcl/test/GraphicsRenderTests.hxx 
b/include/vcl/test/GraphicsRenderTests.hxx
index f1adcc6bb721..86266eebe317 100644
--- a/include/vcl/test/GraphicsRenderTests.hxx
+++ b/include/vcl/test/GraphicsRenderTests.hxx
@@ -99,6 +99,8 @@ class VCL_PLUGIN_PUBLIC GraphicsRenderTests
 void testClipPolyPolygon();
 void testClipB2DPolyPolygon();
 void testDrawOutDev();
+void testDrawOutDevScaledClipped();
+void testDrawOutDevSelf();
 void testDashedLine();
 void testLinearGradient();
 void testLinearGradientAngled();
diff --git a/vcl/backendtest/GraphicsRenderTests.cxx 
b/vcl/backendtest/GraphicsRenderTests.cxx
index fa48087fa03e..794910b0f045 100644
--- a/vcl/backendtest/GraphicsRenderTests.cxx
+++ b/vcl/backendtest/GraphicsRenderTests.cxx
@@ -985,6 +985,48 @@ void GraphicsRenderTests::testDrawOutDev()
 }
 }
 
+void GraphicsRenderTests::testDrawOutDevScaledClipped()
+{
+vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
+Bitmap aBitmap = aOutDevTest.setupDrawOutDevScaledClipped();
+OUString aTestName = "testDrawOutDevScaledClipped";
+if (!SHOULD_ASSERT)
+{
+appendTestResult(aTestName, "SKIPPED");
+return;
+}
+vcl::test::TestResult eResult
+= 
vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDevScaledClipped(aBitmap);
+appendTestResult(aTestName, returnTestStatus(eResult),
+ (m_aStoreResultantBitmap ? aBitmap : Bitmap()));
+if (m_aStoreResultantBitmap)
+{
+BitmapEx aBitmapEx(aBitmap);
+exportBitmapExToImage(m_aUserInstallPath + aTestName + ".png", 
aBitmapEx);
+}
+}
+
+void GraphicsRenderTests::testDrawOutDevSelf()
+{
+vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
+Bitmap aBitmap = aOutDevTest.setupDrawOutDevSelf();
+OUString aTestName = "testDrawOutDevSelf";
+if (!SHOULD_ASSERT)
+{
+appendTestResult(aTestName, "SKIPPED");
+return;
+}
+vcl::test::TestResult eResult
+= 
vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDevSelf(aBitmap);
+appendTestResult(aTestName, returnTestStatus(eResult),
+ (m_aStoreResultantBitmap ? aBitmap : Bitmap()));
+if (m_aStoreResultantBitmap)
+{
+BitmapEx aBitmapEx(aBitmap);
+exportBitmapExToImage(m_aUserInstallPath + aTestName + ".png", 
aBitmapEx);
+}
+}
+
 void GraphicsRenderTests::testDashedLine()
 {
 vcl::test::OutputDeviceTestLine aOutDevTest;
@@ -2197,6 +2239,8 @@ void GraphicsRenderTests::runALLTests()
 testClipPolyPolygon();
 testClipB2DPolyPolygon();
 testDrawOutDev();
+testDrawOutDevScaledClipped();
+testDrawOutDevSelf();
 testDashedLine();
 testLinearGradient();
 testLinearGradientAngled();
diff --git a/vcl/backendtest/VisualBackendTest.cxx 
b/vcl/backendtest/VisualBackendTest.cxx
index 4ab745c73af0..4ba2cf63897b 100644
--- a/vcl/backendtest/VisualBackendTest.cxx
+++ b/vcl/backendtest/VisualBackendTest.cxx
@@ -764,7 +764,7 @@ public:
 }
 else if (mnTest % gnNumberOfTests == 10)
 {
-std::vector aRegions = setupRegions(2, 1, 
nWidth, nHeight);
+std::vector aRegions = setupRegions(2, 2, 
nWidth, nHeight);
 size_t index = 0;
 
 tools::Rectangle aRectangle = aRegions[index++];
@@ -775,6 +775,20 @@ public:
 drawBitmapScaledAndCentered(aRectangle, aBitmap, 
rRenderContext);
 }
 aRectangle = aRegions[index++];
+{
+vcl::test::OutputDeviceTestAnotherOutDev aOutDevTest;
+Bitmap aBitmap = aOutDevTest.setupDrawOutDevScaledClipped();
+
assertAndSetBackground(vcl::test::OutputDeviceTestAnotherOutDev::checkDrawOutDevScaledClipped(aBitmap),
 aRectangle, rRenderContext);
+drawBitmapScaledAndCentered(aRectangle, aBitmap, 
rRenderContext);
+}
+aRectangle = aRegions[index++];
+{
+ 

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

2021-11-13 Thread Vasily Melenchuk (via logerrit)
 editeng/source/items/numitem.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit a4485bd8e03ad4487fe47a4480a9aacfbaf61980
Author: Vasily Melenchuk 
AuthorDate: Thu Nov 11 10:33:08 2021 +0300
Commit: Vasily Melenchuk 
CommitDate: Sat Nov 13 09:58:46 2021 +0100

tdf#145610: lists should not have includeUpperLevels < 1

Unlike its name, this variable stores *total* amount of levels
to includes, so during conversion even empty list format to
prefix/suffix/includeupperlevels we should keep last one above
zero so list even in future will not have issues with levels
to display.

Change-Id: I4992c1ac0194f381df9f7b965ecdb2d688892b30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125022
Tested-by: Jenkins
Reviewed-by: Vasily Melenchuk 

diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index ca454d92f894..b862b866c50f 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -640,6 +640,13 @@ void 
SvxNumberFormat::SetListFormat(std::optional oSet)
 nPercents++;
 }
 nInclUpperLevels = nPercents/2;
+if (nInclUpperLevels < 1)
+{
+// There should be always at least one level. This will be not required
+// in future (when we get rid of prefix/suffix), but nowadays there
+// are too many conversions "list format" <-> 
"prefix/suffix/inclUpperLevel"
+nInclUpperLevels = 1;
+}
 }
 
 OUString SvxNumberFormat::GetListFormat(bool bIncludePrefixSuffix /*= true*/) 
const