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

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |4 ++--
 vcl/qa/cppunit/textlayout.cxx  |6 +++---
 vcl/source/text/textlayout.cxx |8 
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 7c1a359663355fac356e1eccf76f3f0247d4e3c6
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 03:27:29 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:34:56 2023 +0100

vcl: BreakLines() -> BreakLine() and BreakLinesSimple() -> BreakLineSimple()

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

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index d05259475d18..7f81fcbeb10a 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -52,13 +52,13 @@ namespace vcl
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 
-std::tuple BreakLines(const tools::Long nWidth, 
OUString const& rStr,
+std::tuple BreakLine(const tools::Long nWidth, 
OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference& xBI,
 const bool bHyphenate, const tools::Long 
nOrigLineWidth,
 const sal_Int32 nPos, const sal_Int32 nLen);
 
-std::tuple BreakLinesSimple(const tools::Long 
nWidth, OUString const& rStr,
+std::tuple BreakLineSimple(const tools::Long 
nWidth, OUString const& rStr,
   const sal_Int32 nPos, sal_Int32 nBreakPos, 
const tools::Long nOrigLineWidth);
 
 tools::Long GetTextLines(tools::Rectangle const& rRect, const 
tools::Long nTextHeight,
diff --git a/vcl/qa/cppunit/textlayout.cxx b/vcl/qa/cppunit/textlayout.cxx
index 3ace6a8b836d..36129aec6920 100644
--- a/vcl/qa/cppunit/textlayout.cxx
+++ b/vcl/qa/cppunit/textlayout.cxx
@@ -49,7 +49,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_invalid_softbreak)
 const auto nTextLen = 13;
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
 
 const sal_Int32 nExpectedBreakPos = 13;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
@@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_hyphens)
 css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
 
 const sal_Int32 nExpectedBreakPos = 13;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_hyphen_word_under_two_cha
 css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 2, 10);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 2, 10);
 
 const sal_Int32 nExpectedBreakPos = 2;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index e90c56b6355a..8797689963c0 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -218,7 +218,7 @@ namespace vcl
 return aStr;
 }
 
-std::tuple TextLayoutCommon::BreakLines(const 
tools::Long nWidth, OUString const& rStr,
+std::tuple TextLayoutCommon::BreakLine(const 
tools::Long nWidth, OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference& xBI,
 const bool bHyphenate, const tools::Long 
nOrigLineWidth,
@@ -228,7 +228,7 @@ namespace vcl
 xBI = vcl::unohelper::CreateBreakIterator();
 
 if (!xBI.is())
-return BreakLinesSimple(nWidth, rStr, nPos, nLen, nOrigLineWidth);
+return BreakLineSimple(nWidth, rStr, nPos, nLen, nOrigLineWidth);
 
 const css::lang::Locale& 
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
 
@@ -338,7 +338,7 @@ namespace vcl
 return { nBreakPos, GetTextWidth(rStr, nPos, nBreakPos - nPos) };
 }
 
-std::tuple TextLayoutCommon::BreakLinesSimple(const 
tools::Long nWidth, OUString const& rStr,
+std::tuple TextLayoutCommon::BreakLineSimple(const 
tools::Long nWidth, OUString const& rStr,
  const sal_Int32 nPos, const 
sal_Int

core.git: vcl/CppunitTest_vcl_textlayout.mk vcl/inc vcl/qa vcl/source

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_textlayout.mk |1 
 vcl/inc/textlayout.hxx|   10 ++---
 vcl/qa/cppunit/textlayout.cxx |   64 +++---
 vcl/source/text/textlayout.cxx|   61 +---
 4 files changed, 96 insertions(+), 40 deletions(-)

New commits:
commit 938d3b35b83093de4e310d32de5137f6bdbcf22b
Author: Chris Sherlock 
AuthorDate: Sun Oct 1 18:08:49 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:33:50 2023 +0100

vcl: test BreakLinesWithIterator with hyphens

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

diff --git a/vcl/CppunitTest_vcl_textlayout.mk 
b/vcl/CppunitTest_vcl_textlayout.mk
index d7ac49a9e6df..57d5177f2a19 100644
--- a/vcl/CppunitTest_vcl_textlayout.mk
+++ b/vcl/CppunitTest_vcl_textlayout.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_CppunitTest_use_components,vcl_textlayout,\
configmgr/source/configmgr \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
+   linguistic/source/lng \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_textlayout))
diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index 58f3bb33469b..d05259475d18 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -52,14 +52,14 @@ namespace vcl
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 
-sal_Int32 BreakLinesWithIterator(const tools::Long nWidth, OUString 
const& rStr,
+std::tuple BreakLines(const tools::Long nWidth, 
OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
-css::uno::Reference const& 
xBI,
-const bool bHyphenate,
+css::uno::Reference& xBI,
+const bool bHyphenate, const tools::Long 
nOrigLineWidth,
 const sal_Int32 nPos, const sal_Int32 nLen);
 
-sal_Int32 BreakLinesSimple(const tools::Long nWidth, OUString const& 
rStr,
-  const sal_Int32 nPos, sal_Int32 nBreakPos, 
tools::Long& nLineWidth);
+std::tuple BreakLinesSimple(const tools::Long 
nWidth, OUString const& rStr,
+  const sal_Int32 nPos, sal_Int32 nBreakPos, 
const tools::Long nOrigLineWidth);
 
 tools::Long GetTextLines(tools::Rectangle const& rRect, const 
tools::Long nTextHeight,
  ImplMultiTextLineInfo& rLineInfo,
diff --git a/vcl/qa/cppunit/textlayout.cxx b/vcl/qa/cppunit/textlayout.cxx
index 147826f19842..3ace6a8b836d 100644
--- a/vcl/qa/cppunit/textlayout.cxx
+++ b/vcl/qa/cppunit/textlayout.cxx
@@ -12,6 +12,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -28,7 +30,7 @@ public:
 
 #if HAVE_MORE_FONTS
 
-CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLinesWithIterator_invalid_softbreak)
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, testBreakLines_invalid_softbreak)
 {
 ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
 device->SetOutputSizePixel(Size(1000, 1000));
@@ -46,9 +48,63 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLinesWithIterator_invalid_softb
 
 const auto nTextLen = 13;
 
-CPPUNIT_ASSERT_EQUAL(
-static_cast(13),
-aTextLayout.BreakLinesWithIterator(nTextWidth, sTestStr, xHyph, xBI, 
false, nTextLen, 15));
+auto[nBreakPos, nLineWidth]
+= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
+
+const sal_Int32 nExpectedBreakPos = 13;
+CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, testBreakLines_hyphens)
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+vcl::DefaultTextLayout aTextLayout(*device);
+
+const OUString sTestStr = u"textline text-moretext"_ustr;
+const auto nTextWidth = device->GetTextWidth("textline text-moretex");
+
+css::uno::Reference xContext(
+comphelper::getProcessComponentContext());
+css::uno::Reference xLinguMgr
+= css::linguistic2::LinguServiceManager::create(xContext);
+
+css::uno::Reference xHyph = 
xLinguMgr->getHyphenator();
+css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
+
+auto[nBreakPos, nLineWidth]
+= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
+
+const sal_Int32 nExpectedBreakPos = 13;
+CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLin

core.git: vcl/CppunitTest_vcl_textlayout.mk vcl/inc vcl/Module_vcl.mk vcl/qa

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_textlayout.mk |   64 ++
 vcl/Module_vcl.mk |1 
 vcl/inc/textlayout.hxx|4 +-
 vcl/qa/cppunit/text.cxx   |   15 
 vcl/qa/cppunit/textlayout.cxx |   58 ++
 5 files changed, 140 insertions(+), 2 deletions(-)

New commits:
commit 9157281deb81522bb02af73a08c4d7beed7aab75
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 01:02:41 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:12:38 2023 +0100

vcl: add test for an invalid index in OutputDevice::GetTextBreak()

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

diff --git a/vcl/CppunitTest_vcl_textlayout.mk 
b/vcl/CppunitTest_vcl_textlayout.mk
new file mode 100644
index ..d7ac49a9e6df
--- /dev/null
+++ b/vcl/CppunitTest_vcl_textlayout.mk
@@ -0,0 +1,64 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_textlayout,\
+$$(INCLUDE) \
+-I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_textlayout, \
+   vcl/qa/cppunit/textlayout \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+   boost_headers \
+   harfbuzz \
+))
+
+ifeq ($(SYSTEM_ICU),TRUE)
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+   icuuc \
+))
+else
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+icu_headers \
+))
+endif
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_textlayout, \
+   comphelper \
+   cppu \
+   cppuhelper \
+   i18nlangtag \
+   sal \
+   svt \
+   test \
+   tl \
+   unotest \
+   vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_textlayout))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_textlayout,\
+   configmgr/source/configmgr \
+   i18npool/util/i18npool \
+   ucb/source/core/ucb1 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_textlayout))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 19ab27106ad0..cc8667cad420 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -224,6 +224,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
 CppunitTest_vcl_fontfeature \
 CppunitTest_vcl_fontmetric \
 CppunitTest_vcl_text \
+CppunitTest_vcl_textlayout \
 CppunitTest_vcl_filters_test \
 CppunitTest_vcl_mnemonic \
 CppunitTest_vcl_outdev \
diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index e90a7ec05858..58f3bb33469b 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -47,7 +47,7 @@ namespace vcl
 ~ITextLayout() COVERITY_NOEXCEPT_FALSE {}
 };
 
-class TextLayoutCommon : public ITextLayout
+class VCL_DLLPUBLIC TextLayoutCommon : public ITextLayout
 {
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
@@ -75,7 +75,7 @@ namespace vcl
 /** is an implementation of the ITextLayout interface which simply 
delegates its calls to the respective
 methods of an OutputDevice instance, without any inbetween magic.
 */
-class DefaultTextLayout final : public TextLayoutCommon
+class VCL_DLLPUBLIC DefaultTextLayout final : public TextLayoutCommon
 {
 public:
 DefaultTextLayout( OutputDevice& _rTargetDevice )
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index cabe502db462..371783759b65 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -719,6 +719,21 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, 
testGetStringWithNewsEllpsis)
 device->GetEllipsisString(u"ab. cde. x y z"_ustr, 50, 
DrawTextFlags::NewsEllipsis));
 }
 
+CPPUNIT_TEST_FIXTURE(VclTextTest, testGetTextBreak_invalid_index)
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+const OUString sTestStr(u"textline_ text_"_ustr);
+const auto nLen = sTestStr.getLength();
+const auto nTextWidth = device->GetTextWidth("text");
+const auto nInvalidIndex = sTestStr.getLength() + 2;
+
+CPPUNIT_ASSERT_EQUAL(st

core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit 755ce3ae9f6c672cc3ac1596fce182cd2c6993db
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 02:07:02 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:48:39 2023 +0100

vcl: remove out of sync comment - the code has since changed!

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 535e0c1c16f1..095c087d5377 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -245,10 +245,7 @@ namespace vcl
 return nBreakPos;
 
 // Whether hyphen or not: Put the word after the hyphen through
-// word boundary.
-
-// nMaxBreakPos the last char that fits into the line
-// nBreakPos is the word's start
+// the word boundary.
 
 // We run into a problem if the doc is so narrow, that a word
 // is broken into more than two lines ...
@@ -264,8 +261,6 @@ namespace vcl
 if ( ( nWordEnd < nSoftBreak ) || ( nWordLen <= 3 ) )
 return nBreakPos;
 
-// #104415# May happen, because getLineBreak may differ from 
getWordBoundary with DICTIONARY_WORD
-// SAL_WARN_IF( nWordEnd < nMaxBreakPos, "vcl", "Hyph: Break?" );
 OUString aWord = rStr.copy( nWordStart, nWordLen );
 sal_Int32 nMinTrail = nWordEnd-nSoftBreak+1;  //+1: Before the "broken 
off" char
 css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord;


core.git: vcl/inc vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |2 +-
 vcl/source/text/textlayout.cxx |   20 
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 144ac97827ddf770c5185549d6dba47f698b9807
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 01:58:05 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:48:18 2023 +0100

vcl: BreakLinesWithIterator() is actually looking for the length of the 
string

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

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index 53462d0cc1a2..e90a7ec05858 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -56,7 +56,7 @@ namespace vcl
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference const& 
xBI,
 const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos);
+const sal_Int32 nPos, const sal_Int32 nLen);
 
 sal_Int32 BreakLinesSimple(const tools::Long nWidth, OUString const& 
rStr,
   const sal_Int32 nPos, sal_Int32 nBreakPos, 
tools::Long& nLineWidth);
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 8e2ddeb55875..535e0c1c16f1 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -222,22 +222,26 @@ namespace vcl
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference const& 
xBI,
 const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos)
+const sal_Int32 nPos, const sal_Int32 nLen)
 {
 const css::lang::Locale& 
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
-sal_Int32 nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - 
nPos );
+
+sal_Int32 nSoftBreak = GetTextBreak(rStr, nWidth, nPos, nLen - nPos);
 if (nSoftBreak == -1)
-{
 nSoftBreak = nPos;
-}
-SAL_WARN_IF( nSoftBreak >= nBreakPos, "vcl", "Break?!" );
+
+SAL_WARN_IF( nSoftBreak >= nLen, "vcl", "Break?!" );
+
 css::i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, 
css::uno::Sequence (), 1 );
 css::i18n::LineBreakUserOptions aUserOptions;
 css::i18n::LineBreakResults aLBR = xBI->getLineBreak( rStr, 
nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions );
-nBreakPos = aLBR.breakIndex;
-if ( nBreakPos <= nPos )
+
+sal_Int32 nBreakPos = aLBR.breakIndex;
+
+if (nBreakPos <= nPos)
 nBreakPos = nSoftBreak;
-if ( !bHyphenate )
+
+if (!bHyphenate)
 return nBreakPos;
 
 // Whether hyphen or not: Put the word after the hyphen through


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0db0662376dd9e89e1ad1e0a5764c69f94f9a059
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 06:15:37 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:45:05 2023 +0100

vcl: move bClipping closer to first use

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index b6f90c6b972d..8e2ddeb55875 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -393,8 +393,6 @@ namespace vcl
 if (rStr.isEmpty())
 return 0;
 
-const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle & 
DrawTextFlags::EndEllipsis);
-
 tools::Long nMaxLineWidth  = 0;
 const bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) 
== DrawTextFlags::WordBreakHyphenation;
 css::uno::Reference< css::linguistic2::XHyphenator > xHyph;
@@ -410,6 +408,7 @@ namespace vcl
 sal_Int32 nPos = 0;
 sal_Int32 nLen = rStr.getLength();
 sal_Int32 nCurrentTextY = 0;
+
 while ( nPos < nLen )
 {
 sal_Int32 nBreakPos = lcl_GetEndOfLine(rStr, nPos, nLen);
@@ -437,6 +436,7 @@ namespace vcl
 
 if ( nBreakPos == nPos )
 nBreakPos++;
+
 nPos = nBreakPos;
 
 if ( nPos < nLen && ( ( rStr[ nPos ] == '\r' ) || ( rStr[ nPos ] 
== '\n' ) ) )
@@ -447,6 +447,9 @@ namespace vcl
 nPos++;
 }
 nCurrentTextY += nTextHeight;
+
+const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle 
& DrawTextFlags::EndEllipsis);
+
 if (bClipping && nCurrentTextY > rRect.GetHeight())
 break;
 }


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 37bd1098fa0b2c5094aee0a48feff260b59681f3
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 05:18:43 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:44:29 2023 +0100

vcl: extract lcl_GetEndOfLine()

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 587060cb8690..b6f90c6b972d 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -365,6 +365,18 @@ namespace vcl
 {
 return ((nLineWidth > nWidth) && (nStyle & 
DrawTextFlags::WordBreak));
 }
+
+sal_Int32 lcl_GetEndOfLine(std::u16string_view rStr, const sal_Int32 
nPos, const sal_Int32 nLen)
+{
+sal_Int32 nBreakPos = nPos;
+
+while ((nBreakPos < nLen) && (rStr[nBreakPos] != '\r') && 
(rStr[nBreakPos] != '\n'))
+{
+nBreakPos++;
+}
+
+return nBreakPos;
+}
 }
 
 tools::Long TextLayoutCommon::GetTextLines(tools::Rectangle const& rRect, 
const tools::Long nTextHeight,
@@ -400,12 +412,8 @@ namespace vcl
 sal_Int32 nCurrentTextY = 0;
 while ( nPos < nLen )
 {
-sal_Int32 nBreakPos = nPos;
-
-while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != '\r' ) && ( 
rStr[ nBreakPos ] != '\n' ) )
-nBreakPos++;
-
-tools::Long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos 
);
+sal_Int32 nBreakPos = lcl_GetEndOfLine(rStr, nPos, nLen);
+tools::Long nLineWidth = GetTextWidth(rStr, nPos, nBreakPos-nPos);
 
 if (lcl_ShouldBreakWord(nLineWidth, nWidth, nStyle))
 {


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 5aad3b5d8c4da23e90869b70907c3e5c5883ceea
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 05:12:06 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:43:39 2023 +0100

vcl: extract lcl_ShouldBreakWord()

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 33232b6f0999..587060cb8690 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -359,6 +359,14 @@ namespace vcl
 return nBreakPos;
 }
 
+namespace
+{
+bool lcl_ShouldBreakWord(const sal_Int32 nLineWidth, const sal_Int32 
nWidth, const DrawTextFlags nStyle)
+{
+return ((nLineWidth > nWidth) && (nStyle & 
DrawTextFlags::WordBreak));
+}
+}
+
 tools::Long TextLayoutCommon::GetTextLines(tools::Rectangle const& rRect, 
const tools::Long nTextHeight,
ImplMultiTextLineInfo& 
rLineInfo,
tools::Long nWidth, OUString 
const& rStr,
@@ -398,12 +406,13 @@ namespace vcl
 nBreakPos++;
 
 tools::Long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos 
);
-if ( ( nLineWidth > nWidth ) && ( nStyle & 
DrawTextFlags::WordBreak ) )
+
+if (lcl_ShouldBreakWord(nLineWidth, nWidth, nStyle))
 {
-if ( !xBI.is() )
+if (!xBI.is())
 xBI = vcl::unohelper::CreateBreakIterator();
 
-if ( xBI.is() )
+if (xBI.is())
 {
 nBreakPos = BreakLinesWithIterator(nWidth, rStr, xHyph, 
xBI, bHyphenate, nPos, nBreakPos);
 nLineWidth = GetTextWidth(rStr, nPos, nBreakPos - nPos);


core.git: vcl/source

2023-12-08 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmap.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 29df1afa1f439bf44a6be1b04ec0190e8f40abe2
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:29:02 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 8 11:49:31 2023 +0100

tdf#43157 vcl: remove DBG_ASSERT() from DrawDeviceAlphaBitmapSlowPath()

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

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index c6855909d312..86ac23137562 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -653,8 +653,8 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const 
Bitmap& rBitmap,
 BitmapScopedReadAccess pBitmapReadAccess(rBitmap);
 BitmapScopedReadAccess pAlphaReadAccess(rAlpha);
 
-DBG_ASSERT( pAlphaReadAccess->GetScanlineFormat() == 
ScanlineFormat::N8BitPal,
-"OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer 
supported!" );
+SAL_WARN_IF(pAlphaReadAccess->GetScanlineFormat() != 
ScanlineFormat::N8BitPal, "vcl.gdi", "non-8bit alpha no longer supported!");
+assert(pAlphaReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal);
 
 // #i38887# reading from screen may sometimes fail
 if (aBmp.ImplGetSalBitmap())


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

2023-12-05 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9b5964cf5931d7c09e4fd624d68595891c2afb58
Author: Chris Sherlock 
AuthorDate: Tue Nov 14 02:13:17 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 5 14:23:50 2023 +0100

vcl: add unit test for cached glyphs based on tdf#103492

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

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index d4eb3db67093..37f4fbc0766c 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -191,6 +191,8 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaching)
 testCachedGlyphs( "test", "Dejavu Sans" );
 // This font does not have latin characters, will need fallback.
 testCachedGlyphs( "test", "Noto Kufi Arabic" );
+// see tdf#103492
+testCachedGlyphs( u"يوسف My name is"_ustr, "Liberation Sans");
 }
 
 static void testCachedGlyphsSubstring( const OUString& aText, const OUString& 
aFontName, bool rtl )


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

2023-12-04 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 ++
 vcl/qa/cppunit/complextext.cxx |   37 ++---
 vcl/source/outdev/font.cxx |   32 +++-
 vcl/source/outdev/outdev.cxx   |6 --
 4 files changed, 71 insertions(+), 6 deletions(-)

New commits:
commit 042dc4a9186f526b625817dde50bb2f5a91fd2c6
Author: Chris Sherlock 
AuthorDate: Thu Nov 9 18:19:41 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 5 04:39:05 2023 +0100

vcl: add unit tests for a mixture of CJK and latin characters

To influence the fallback fonts chosen, I have introduced a new
OutputDevice function ForceFallbackFont() which injects ("forces") a
font as the first one in the font fallback chain.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index bea1e00d9b7f..329364559108 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -184,6 +184,7 @@ private:
 mutable VclPtrmpNextGraphics; ///< Next output 
device in list
 GDIMetaFile*mpMetaFile;
 mutable rtl::Reference mpFontInstance;
+rtl::Reference mpForcedFallbackInstance;
 mutable std::unique_ptr  
mpFontFaceCollection;
 std::vectormaOutDevStateStack;
 std::unique_ptr mpOutDevData;
@@ -1165,6 +1166,7 @@ public:
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
 LogicalFontInstance const* GetFontInstance() const;
+bool ForceFallbackFont(vcl::Font const& rFallbackFont);
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 633dc2210e07..d4eb3db67093 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -491,6 +491,40 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf153440)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(VclComplexTextTest, 
testMixedCJKLatinScript_glyph_advancements)
+{
+#if HAVE_MORE_FONTS
+#if !defined _WIN32
+OUString aTestScript(u"根据10.1(37BA) Eng"_ustr);
+
+ScopedVclPtrInstance pOutDev;
+// note you can only run this once and it was designed for tdf#107718
+bool bAdded = addFont(pOutDev, u"tdf107718.otf", u"Source Han Sans");
+CPPUNIT_ASSERT_EQUAL(true, bAdded);
+
+vcl::Font aFont(u"Source Han Sans"_ustr, u"Regular"_ustr, Size(0, 72));
+pOutDev->SetFont( aFont );
+
+vcl::Font aFallbackFont("DejaVu Sans", "Book", Size(0, 72));
+pOutDev->ForceFallbackFont(aFallbackFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 704;
+std::vector aRefCharWidths = { 72, 144, 190, 236, 259, 305, 
333, 379, 425, 474, 523, 551, 567, 612, 658, 704 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aTestScript, );
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aTestScript));
+CPPUNIT_ASSERT_EQUAL(tools::Long(105), pOutDev->GetTextHeight());
+#endif
+#endif
+}
+
 CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107718)
 {
 #if !defined _WIN32 // TODO: Fails on jenkins but passes locally
@@ -498,9 +532,6 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107718)
 
 ScopedVclPtrInstance pOutDev;
 
-bool bAdded = addFont(pOutDev, u"tdf107718.otf", u"Source Han Sans");
-CPPUNIT_ASSERT_EQUAL(true, bAdded);
-
 OUString aText(u"\u4E16\u1109\u1168\u11BC\u302E"_ustr);
 for (bool bVertical : { false, true })
 {
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ea0727b294f9..0e37c7613ded 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1020,6 +1020,22 @@ std::unique_ptr 
OutputDevice::getFallbackLayout(
 return pFallback;
 }
 
+bool OutputDevice::ForceFallbackFont(vcl::Font const& rFallbackFont)
+{
+vcl::Font aOldFont = GetFont();
+SetFont(rFallbackFont);
+InitFont();
+
+mpForcedFallbackInstance = mpFontInstance;
+SetFont(aOldFont);
+InitFont();
+
+if (mpForcedFallbackInstance)
+return true;
+
+return false;
+}
+
 std::unique_ptr OutputDevice::ImplGlyphFallbackLayout( 
std::unique_ptr pSalLayout,
 vcl::text::ImplLayoutArgs& rLayoutArgs, const SalLayoutGlyphs* pGlyphs ) 
const
 {
@@ -1051,12 +1067,22 @@ std::unique_ptr 
OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
 vcl::font::FontSelectPattern 
aFontSelData(mpFontInstance-

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

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   97 
 1 file changed, 97 insertions(+)

New commits:
commit 4a1fac7c703068a49df897bb635ff98bf22c0468
Author: Chris Sherlock 
AuthorDate: Wed Nov 8 14:21:47 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:24:59 2023 +0100

vcl: add unit tests for simple text 'AV' with kerning and no-kerning enabled

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

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 59e079c963ce..b2e837a32c40 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -224,6 +224,103 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleText)
 CPPUNIT_ASSERT_DOUBLES_EQUAL(width36 / 2, width36pct50, 2);
 }
 
+CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextFontSpecificKerning)
+{
+OUString aAV(u"AV"_ustr);
+
+vcl::Font aFont("DejaVu Sans", "Book", Size(0, 2048));
+
+ScopedVclPtrInstance pOutDev;
+pOutDev->SetFont(aFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 2671;
+std::vector aRefCharWidths = { 1270, 2671 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aAV, );
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], 
aCharWidths.get_subunit_array()[0]);
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], 
aCharWidths.get_subunit_array()[1]);
+// this sporadically returns 75 or 74 on some of the windows tinderboxes 
eg. tb73
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
+CPPUNIT_ASSERT_EQUAL(tools::Long(2384), pOutDev->GetTextHeight());
+
+// exact bounding rectangle, not essentially the same as text width/height
+tools::Rectangle aBoundRect;
+pOutDev->GetTextBoundRect(aBoundRect, aAV);
+CPPUNIT_ASSERT_EQUAL(tools::Long(16), aBoundRect.Left());
+CPPUNIT_ASSERT_EQUAL(tools::Long(408), aBoundRect.Top());
+CPPUNIT_ASSERT_EQUAL(tools::Long(2639), aBoundRect.GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(1493), aBoundRect.getOpenHeight());
+
+// normal orientation
+tools::Rectangle aInput;
+tools::Rectangle aRect = pOutDev->GetTextRect(aInput, aAV);
+
+// now rotate 270 degrees
+vcl::Font aRotated(aFont);
+aRotated.SetOrientation(2700_deg10);
+pOutDev->SetFont(aRotated);
+tools::Rectangle aRectRot = pOutDev->GetTextRect(aInput, aAV);
+
+// Check that we did do the rotation...
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetWidth(), aRect.GetHeight());
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetHeight(), aRect.GetWidth());
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextNoKerning)
+{
+OUString aAV(u"AV"_ustr);
+
+vcl::Font aFont("DejaVu Sans", "Book", Size(0, 2048));
+aFont.SetKerning(FontKerning::NONE);
+
+ScopedVclPtrInstance pOutDev;
+pOutDev->SetFont(aFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 2802;
+std::vector aRefCharWidths = { 1401, 2802 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aAV, );
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], 
aCharWidths.get_subunit_array()[0]);
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], 
aCharWidths.get_subunit_array()[1]);
+// this sporadically returns 75 or 74 on some of the windows tinderboxes 
eg. tb73
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
+CPPUNIT_ASSERT_EQUAL(tools::Long(2384), pOutDev->GetTextHeight());
+
+// exact bounding rectangle, not essentially the same as text width/height
+tools::Rectangle aBoundRect;
+pOutDev->GetTextBoundRect(aBoundRect, aAV);
+CPPUNIT_ASSERT_EQUAL(tools::Long(16), aBoundRect.Left());
+CPPUNIT_ASSERT_EQUAL(tools::Long(408), aBoundRect.Top());
+CPPUNIT_ASSERT_EQUAL(tools::Long(2770), aBoundRect.GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(1493), aBoundRect.getOpenHeight());
+
+// normal orientation
+tools::Rectangle aInput;
+tools::Rectangle aRect = pOutDev->GetTextRect(aInput, aAV);
+
+// now rotate 270 degrees
+vcl::Font aRotated(aFont);
+aRotated.SetOrientation(2700_deg10);
+pOutDev->SetFont(aRotated);
+tools::Rectangle aRectRot = pOutDev->GetTextRect(aInput, aAV);
+
+// Check that we did do the rotation...
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetWidth(), aRect.GetHeight());
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetHeight(), aRect.GetWidth());
+}
+
 C

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

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2195d87e62dae3465554be5a20a45b0a377845d2
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:54:26 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:23:09 2023 +0100

vcl: simplify warning message

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index a9e219099191..33232b6f0999 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -254,7 +254,7 @@ namespace vcl
 css::i18n::Boundary aBoundary = xBI->getWordBoundary( rStr, nBreakPos, 
rDefLocale, css::i18n::WordType::DICTIONARY_WORD, true );
 sal_Int32 nWordStart = nPos;
 sal_Int32 nWordEnd = aBoundary.endPos;
-SAL_WARN_IF( nWordEnd <= nWordStart, "vcl", "ImpBreakLine: Start >= 
End?" );
+SAL_WARN_IF(nWordEnd <= nWordStart, "vcl", "Start >= End?");
 
 sal_Int32 nWordLen = nWordEnd - nWordStart;
 if ( ( nWordEnd < nSoftBreak ) || ( nWordLen <= 3 ) )


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

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 72eaff7b6af01f3b6d9754660ce231e74d501466
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:39:01 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:21:38 2023 +0100

vcl: ImplIsCharIn() -> lcl_IsCharIn()

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index dd05d57f77c3..a9e219099191 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -30,7 +30,7 @@
 #include 
 #include 
 
-static bool ImplIsCharIn(sal_Unicode c, const char* pStr)
+static bool lcl_IsCharIn(sal_Unicode c, const char* pStr)
 {
 while ( *pStr )
 {
@@ -124,11 +124,11 @@ namespace vcl
 {
 nLastContent--;
 
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
+if (lcl_IsCharIn(aStr[nLastContent], pSepChars))
 break;
 }
 
-while (nLastContent && ImplIsCharIn(aStr[nLastContent-1], pSepChars))
+while (nLastContent && lcl_IsCharIn(aStr[nLastContent-1], pSepChars))
 {
 nLastContent--;
 }
@@ -143,11 +143,11 @@ namespace vcl
 while (nFirstContent < nLastContent)
 {
 nFirstContent++;
-if (ImplIsCharIn(aStr[nFirstContent], pSepChars))
+if (lcl_IsCharIn(aStr[nFirstContent], pSepChars))
 break;
 }
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
+while ((nFirstContent < nLastContent) && 
lcl_IsCharIn(aStr[nFirstContent], pSepChars))
 {
 nFirstContent++;
 }
@@ -174,12 +174,12 @@ namespace vcl
 while (nFirstContent < nLastContent)
 {
 nLastContent--;
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
+if (lcl_IsCharIn(aStr[nLastContent], pSepChars))
 break;
 
 }
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
+while ((nFirstContent < nLastContent) && 
lcl_IsCharIn(aStr[nLastContent-1], pSepChars))
 {
 nLastContent--;
 }


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

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit c0aacb30b73405f6d0213fcb85b53b6d0f0854d7
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:36:36 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:19:59 2023 +0100

tdf#124176 vcl: Use pragma once instead of include guards in 
inc/textlayout.hxx

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

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index b5402cc63177..53462d0cc1a2 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_TEXTLAYOUT_HXX
-#define INCLUDED_VCL_INC_TEXTLAYOUT_HXX
+#pragma once
 
 #include 
 #include 
@@ -141,6 +140,4 @@ namespace vcl
 
 } // namespace vcl
 
-#endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 696644462e1f3e43608319068db2bbc167e7b8f8
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:34:46 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:19:35 2023 +0100

vcl: remove unnecessary includes from textlayout.cxx

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 3b084a03115f..dd05d57f77c3 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -20,22 +20,16 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
-#include 
-#include 
 #include 
 #include 
 
 #include 
 #include 
 
-#include 
-#include 
-
 static bool ImplIsCharIn(sal_Unicode c, const char* pStr)
 {
 while ( *pStr )


Re: Testing CJK glyphs

2023-11-09 Thread Chris Sherlock


Sent from my iPhone

> On 9 Nov 2023, at 8:03 pm, Caolán McNamara  
> wrote:
> 
> On Thu, 2023-11-09 at 16:23 +1100, Chris Sherlock wrote:
>> Just a quick question - I want to write a unit test that checks the
>> glyph advancements for CJK glyphs. 
>> 
>> Specifically, I want to test the advancements of the following text:
>> 
>> 根据10.1(37BA) Eng
>> 
>> What font comes bundled with LibreOffice that I can use?
> 
> My understanding is that we don't bundle a CJK font. I think the best
> option is to follow the pattern of:
> https://git.libreoffice.org/core/commit/6b178c6e88ec5a765ad2b3ccd98182286222f550
> where you can see from the little font.readme how to make a small
> testing font with just the subset of glyphs you need from (an
> appropriately licensed) CJK font for the purposes of such a test.

Thanks Caolán, that’s very helpful. 
We seem to bundle Noto Sans in extras, but not the CJK variant. Is this 
something we could look at including?

Chris

Testing CJK glyphs

2023-11-08 Thread Chris Sherlock
Hi all, 

Just a quick question - I want to write a unit test that checks the glyph 
advancements for CJK glyphs. 

Specifically, I want to test the advancements of the following text:

根据10.1(37BA) Eng

What font comes bundled with LibreOffice that I can use?

Chris

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

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 383f666bcad27b2fbea6ac13a42cafd6f035fc5c
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:25:38 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:22:51 2023 +0100

tdf#43157 vcl: remove DBG_ASSERT() from BreakLinesWithIterator()

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 95e5d54a4b3c..3b084a03115f 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -17,6 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -26,14 +33,6 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -523,7 +522,7 @@ namespace vcl
 m_rTargetDevice.Push( PushFlags::MAPMODE | PushFlags::FONT | 
PushFlags::TEXTLAYOUTMODE );
 
 MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() );
-OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), 
"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below 
won't work here ..." );
+SAL_WARN_IF(aTargetMapMode.GetOrigin() != Point(), "vcl", "uhm, the 
code below won't work here ...");
 
 // normally, controls simulate "zoom" by "zooming" the font. This is 
responsible for (part of) the discrepancies
 // between text in Writer and text in controls in Writer, though both 
have the same font.
@@ -534,13 +533,11 @@ namespace vcl
 
 // also, use a higher-resolution map unit than "pixels", which should 
save us some rounding errors when
 // translating coordinates between the reference device and the target 
device.
-OSL_ENSURE( aTargetMapMode.GetMapUnit() == MapUnit::MapPixel,
-"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class 
is not expected to work with such target devices!" );
+SAL_WARN_IF(aTargetMapMode.GetMapUnit() != MapUnit::MapPixel, "vcl", 
"this class is not expected to work with such target devices!");
 // we *could* adjust all the code in this class to handle this 
case, but at the moment, it's not necessary
 const MapUnit eTargetMapUnit = 
m_rReferenceDevice.GetMapMode().GetMapUnit();
 aTargetMapMode.SetMapUnit( eTargetMapUnit );
-OSL_ENSURE( aTargetMapMode.GetMapUnit() != MapUnit::MapPixel,
-"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference 
device which has map mode PIXEL?!" );
+SAL_WARN_IF(aTargetMapMode.GetMapUnit() == MapUnit::MapPixel, "vcl", 
"a reference device which has map mode PIXEL?!");
 
 m_rTargetDevice.SetMapMode( aTargetMapMode );
 


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

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   97 +
 1 file changed, 42 insertions(+), 55 deletions(-)

New commits:
commit 183973ece62c0eefbd841dcf99f7fb8716f0fca1
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:06:59 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:21:23 2023 +0100

vcl: flatten TextLayoutHelper::GetNewsEllipsisString()

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

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index db2226842d09..95e5d54a4b3c 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -144,76 +144,63 @@ namespace vcl
 OUString aTempLastStr1 = "..." + aLastStr;
 
 if (GetTextWidth(aTempLastStr1, 0, aTempLastStr1.getLength()) > 
nMaxWidth)
+return GetEllipsisString(aStr, nMaxWidth, 
DrawTextFlags::EndEllipsis);
+
+sal_Int32 nFirstContent = 0;
+while (nFirstContent < nLastContent)
+{
+nFirstContent++;
+if (ImplIsCharIn(aStr[nFirstContent], pSepChars))
+break;
+}
+
+while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
 {
-aStr = GetEllipsisString(aStr, nMaxWidth, 
DrawTextFlags::EndEllipsis);
+nFirstContent++;
 }
-else
+
+if (nFirstContent >= nLastContent)
+return GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+
+if (nFirstContent > 4)
+nFirstContent = 4;
+
+OUString aFirstStr = OUString::Concat(aStr.subView(0, nFirstContent)) 
+ "...";
+OUString aTempStr = aFirstStr + aLastStr;
+
+if (GetTextWidth(aTempStr, 0, aTempStr.getLength() ) > nMaxWidth)
+return GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+
+do
 {
-sal_Int32 nFirstContent = 0;
+aStr = aTempStr;
+
+if (nLastContent > aStr.getLength())
+nLastContent = aStr.getLength();
+
 while (nFirstContent < nLastContent)
 {
-nFirstContent++;
-if (ImplIsCharIn( aStr[nFirstContent], pSepChars))
+nLastContent--;
+if (ImplIsCharIn(aStr[nLastContent], pSepChars))
 break;
-}
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
-{
-nFirstContent++;
 }
 
-// MEM continue here
-if (nFirstContent >= nLastContent)
+while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
 {
-aStr = GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+nLastContent--;
 }
-else
-{
-if (nFirstContent > 4)
-nFirstContent = 4;
 
-OUString aFirstStr = OUString::Concat(aStr.subView(0, 
nFirstContent)) + "...";
-OUString aTempStr = aFirstStr + aLastStr;
+if (nFirstContent < nLastContent)
+{
+std::u16string_view aTempLastStr = aStr.subView(nLastContent);
+aTempStr = aFirstStr + aTempLastStr;
 
-if (GetTextWidth(aTempStr, 0, aTempStr.getLength() ) > 
nMaxWidth)
-{
-aStr = GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
-}
-else
-{
-do
-{
-aStr = aTempStr;
-
-if (nLastContent > aStr.getLength())
-nLastContent = aStr.getLength();
-
-while (nFirstContent < nLastContent)
-{
-nLastContent--;
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
-break;
-
-}
-
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
-{
-nLastContent--;
-}
-
-if (nFirstContent < nLastContent)
-{
-std::u16string_view aTempLastStr = 
aStr.subView(nLastContent);
-aTempStr = aFirstStr + aTempLastStr;
-
-if (GetTextWidth(aTempStr, 0, 
aTempStr.getLength()) > nMaxWidth)
-  

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

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |5 
 vcl/source/text/textlayout.cxx |  226 +++--
 2 files changed, 135 insertions(+), 96 deletions(-)

New commits:
commit 5886a6faad298cb42fdb4ceb52120bfc569c6e14
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 17:53:10 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:20:28 2023 +0100

vcl: split out functions from TextLayoutCommon::GetEllipsisString()

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

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index ee9eb9e39266..b5402cc63177 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -66,6 +66,11 @@ namespace vcl
  ImplMultiTextLineInfo& rLineInfo,
  tools::Long nWidth, OUString const& rStr,
  DrawTextFlags nStyle);
+
+private:
+OUString GetCenterEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth);
+OUString GetEndEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth, bool bClipText);
+OUString GetNewsEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 };
 
 /** is an implementation of the ITextLayout interface which simply 
delegates its calls to the respective
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index a1597c69793e..db2226842d09 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -69,134 +69,148 @@ void ImplMultiTextLineInfo::Clear()
 
 namespace vcl
 {
+OUString TextLayoutCommon::GetCenterEllipsisString(OUString const& 
rOrigStr, sal_Int32 nIndex, tools::Long nMaxWidth)
+{
+OUStringBuffer aTmpStr(rOrigStr);
 
-OUString TextLayoutCommon::GetEllipsisString(OUString const& rOrigStr, 
tools::Long nMaxWidth, DrawTextFlags nStyle)
+// speed it up by removing all but 1.33x as many as the break pos.
+sal_Int32 nEraseChars = std::max(4, rOrigStr.getLength() - 
(nIndex*4)/3);
+while(nEraseChars < rOrigStr.getLength() && 
GetTextWidth(aTmpStr.toString(), 0, aTmpStr.getLength()) > nMaxWidth)
+{
+aTmpStr = rOrigStr;
+sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
+aTmpStr.remove(i, nEraseChars++);
+aTmpStr.insert(i, "...");
+}
+
+return aTmpStr.makeStringAndClear();
+}
+
+OUString TextLayoutCommon::GetEndEllipsisString(OUString const& rOrigStr, 
sal_Int32 nIndex, tools::Long nMaxWidth, bool bClipText)
 {
 OUString aStr = rOrigStr;
-sal_Int32 nIndex = GetTextBreak( aStr, nMaxWidth, 0, aStr.getLength() 
);
-
-if (nIndex == -1)
-return aStr;
+aStr = aStr.copy(0, nIndex);
 
-if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
+if (nIndex > 1)
 {
-OUStringBuffer aTmpStr( aStr );
-// speed it up by removing all but 1.33x as many as the break pos.
-sal_Int32 nEraseChars = std::max(4, aStr.getLength() - 
(nIndex*4)/3);
-while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
+aStr += "...";
+while (!aStr.isEmpty() && (GetTextWidth(aStr, 0, aStr.getLength()) 
> nMaxWidth))
 {
-aTmpStr = aStr;
-sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
-aTmpStr.remove(i, nEraseChars++);
-aTmpStr.insert(i, "...");
+if ((nIndex > 1) || (nIndex == aStr.getLength()))
+nIndex--;
+
+aStr = aStr.replaceAt(nIndex, 1, u"");
 }
-aStr = aTmpStr.makeStringAndClear();
 }
-else if ( nStyle & DrawTextFlags::EndEllipsis )
+
+if (aStr.isEmpty() && bClipText)
+aStr += OUStringChar(rOrigStr[0]);
+
+return aStr;
+}
+
+namespace
+{
+OUString lcl_GetPathEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex)
 {
-aStr = aStr.copy(0, nIndex);
-if ( nIndex > 1 )
-{
-aStr += "...";
-while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
-{
-if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
-nIndex--;
-aStr = aStr.replaceAt( nIndex, 1, u"");
-}
-}
+

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

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmap.cxx |   64 ++-
 1 file changed, 28 insertions(+), 36 deletions(-)

New commits:
commit 4a6492e155d44ef51fc9a89271f857a6f987182e
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:42:07 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:52:56 2023 +0200

vcl: flatten OutputDevice::BlendBitmap()

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

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index d95c97e8633c..1806635593d2 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -909,8 +909,6 @@ Bitmap OutputDevice::BlendBitmap(
 if( !pP || !pA )
 return aBmp;
 
-Bitmap  res;
-
 if( GetBitCount() <= 8 )
 {
 Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP);
@@ -949,53 +947,47 @@ Bitmap OutputDevice::BlendBitmap(
 
 pB.reset();
 pW.reset();
-res = aDither;
+return aDither;
 }
-else
+
+BitmapScopedWriteAccess pB(aBmp);
+
+bool bFastBlend = false;
+if (!bHMirr && !bVMirr)
 {
-BitmapScopedWriteAccess pB(aBmp);
+SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), 
aBmpRect.GetHeight(),
+nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
 
-bool bFastBlend = false;
-if( !bHMirr && !bVMirr )
+bFastBlend = ImplFastBitmapBlending(*pB, *pP, *pA, aTR);
+}
+
+if (!bFastBlend)
+{
+for (int nY = 0; nY < nDstHeight; nY++)
 {
-SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), 
aBmpRect.GetWidth(), aBmpRect.GetHeight(),
-nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
+tools::Long  nMapY = pMapY[nY];
 
-bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR );
-}
+if (bVMirr)
+nMapY = aBmpRect.Bottom() - nMapY;
 
-if( !bFastBlend )
-{
-for( int nY = 0; nY < nDstHeight; nY++ )
+Scanline pAScan = pA->GetScanline(nMapY);
+Scanline pBScan = pB->GetScanline(nY);
+for(int nX = 0; nX < nDstWidth; nX++)
 {
-tools::Long  nMapY = pMapY[ nY ];
+tools::Long nMapX = pMapX[nX];
 
-if ( bVMirr )
-{
-nMapY = aBmpRect.Bottom() - nMapY;
-}
-Scanline pAScan = pA->GetScanline( nMapY );
-Scanline pBScan = pB->GetScanline(nY);
-for( int nX = 0; nX < nDstWidth; nX++ )
-{
-tools::Long nMapX = pMapX[ nX ];
+if (bHMirr)
+nMapX = aBmpRect.Right() - nMapX;
 
-if ( bHMirr )
-{
-nMapX = aBmpRect.Right() - nMapX;
-}
-BitmapColor aDstCol = pB->GetPixelFromData( pBScan, nX );
-aDstCol.Merge( pP->GetColor( nMapY, nMapX ), pAScan[ nMapX 
] );
-pB->SetPixelOnData( pBScan, nX, aDstCol );
-}
+BitmapColor aDstCol = pB->GetPixelFromData(pBScan, nX);
+aDstCol.Merge(pP->GetColor(nMapY, nMapX), pAScan[nMapX]);
+pB->SetPixelOnData(pBScan, nX, aDstCol);
 }
 }
-
-pB.reset();
-res = aBmp;
 }
 
-return res;
+pB.reset();
+return aBmp;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmapex.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d35236adb3fc561f49134a88c7468411527ee3d5
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:58:17 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:50:44 2023 +0200

vcl: flatten OutputDevice::GetBitmapEx()

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

diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx
index e849f4b73181..b4fa9641a1e5 100644
--- a/vcl/source/outdev/bitmapex.cxx
+++ b/vcl/source/outdev/bitmapex.cxx
@@ -160,8 +160,8 @@ BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, 
const Size& rSize ) con
 
 return BitmapEx(GetBitmap( rSrcPt, rSize ), AlphaMask( aAlphaBitmap ) 
);
 }
-else
-return BitmapEx(GetBitmap( rSrcPt, rSize ));
+
+return BitmapEx(GetBitmap( rSrcPt, rSize ));
 }
 
 void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& 
rDestSize,


[Libreoffice-commits] core.git: solenv/clang-format vcl/Library_vcl.mk vcl/source

2023-10-26 Thread Chris Sherlock (via logerrit)
 solenv/clang-format/excludelist |2 +-
 vcl/Library_vcl.mk  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60abfe9e514d71a14b388f0156b31a4be5896686
Author: Chris Sherlock 
AuthorDate: Sat Sep 30 12:08:32 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:49:53 2023 +0200

vcl: move textlayout.cxx from gdi to text directory

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

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 0b81e5a560d5..5e334c0cbcfd 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14764,7 +14764,6 @@ vcl/source/gdi/salgdilayout.cxx
 vcl/source/gdi/sallayout.cxx
 vcl/source/gdi/salmisc.cxx
 vcl/source/gdi/scrptrun.cxx
-vcl/source/gdi/textlayout.cxx
 vcl/source/gdi/vectorgraphicdata.cxx
 vcl/source/gdi/virdev.cxx
 vcl/source/gdi/wall.cxx
@@ -14817,6 +14816,7 @@ vcl/source/outdev/transparent.cxx
 vcl/source/outdev/vclreferencebase.cxx
 vcl/source/outdev/wallpaper.cxx
 vcl/source/text/ImplLayoutRuns.cxx
+vcl/source/text/textlayout.cxx
 vcl/source/toolkit/group.cxx
 vcl/source/toolkit/morebtn.cxx
 vcl/source/treelist/headbar.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index e15b54c4e918..4c8162459835 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -244,6 +244,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/outdev/map \
 vcl/source/text/ImplLayoutArgs \
 vcl/source/text/TextLayoutCache \
+vcl/source/text/textlayout \
 vcl/source/treelist/headbar \
 vcl/source/treelist/iconview \
 vcl/source/treelist/iconviewimpl \
@@ -303,7 +304,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/gdi/sallayout \
 vcl/source/gdi/salmisc \
 vcl/source/gdi/vectorgraphicdata \
-vcl/source/gdi/textlayout \
 vcl/source/gdi/virdev \
 vcl/source/gdi/wall \
 vcl/source/gdi/scrptrun \
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/text/textlayout.cxx
similarity index 100%
rename from vcl/source/gdi/textlayout.cxx
rename to vcl/source/text/textlayout.cxx


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

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/gdi/textlayout.cxx |  182 ++
 1 file changed, 96 insertions(+), 86 deletions(-)

New commits:
commit adba3022f14d28090a668da10fc3311633535ae8
Author: Chris Sherlock 
AuthorDate: Thu Sep 28 21:14:15 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:48:33 2023 +0200

vcl: flatten TextLayoutCommon::GetEllipsisString()

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

diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index 2eaf5746f30b..a1597c69793e 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -75,117 +75,127 @@ namespace vcl
 OUString aStr = rOrigStr;
 sal_Int32 nIndex = GetTextBreak( aStr, nMaxWidth, 0, aStr.getLength() 
);
 
-if ( nIndex != -1 )
+if (nIndex == -1)
+return aStr;
+
+if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
 {
-if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
+OUStringBuffer aTmpStr( aStr );
+// speed it up by removing all but 1.33x as many as the break pos.
+sal_Int32 nEraseChars = std::max(4, aStr.getLength() - 
(nIndex*4)/3);
+while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
 {
-OUStringBuffer aTmpStr( aStr );
-// speed it up by removing all but 1.33x as many as the break 
pos.
-sal_Int32 nEraseChars = std::max(4, 
aStr.getLength() - (nIndex*4)/3);
-while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
-{
-aTmpStr = aStr;
-sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
-aTmpStr.remove(i, nEraseChars++);
-aTmpStr.insert(i, "...");
-}
-aStr = aTmpStr.makeStringAndClear();
+aTmpStr = aStr;
+sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
+aTmpStr.remove(i, nEraseChars++);
+aTmpStr.insert(i, "...");
 }
-else if ( nStyle & DrawTextFlags::EndEllipsis )
+aStr = aTmpStr.makeStringAndClear();
+}
+else if ( nStyle & DrawTextFlags::EndEllipsis )
+{
+aStr = aStr.copy(0, nIndex);
+if ( nIndex > 1 )
 {
-aStr = aStr.copy(0, nIndex);
-if ( nIndex > 1 )
+aStr += "...";
+while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
 {
-aStr += "...";
-while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
-{
-if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
-nIndex--;
-aStr = aStr.replaceAt( nIndex, 1, u"");
-}
+if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
+nIndex--;
+aStr = aStr.replaceAt( nIndex, 1, u"");
 }
+}
 
-if ( aStr.isEmpty() && (nStyle & DrawTextFlags::Clip) )
-aStr += OUStringChar(rOrigStr[ 0 ]);
+if ( aStr.isEmpty() && (nStyle & DrawTextFlags::Clip) )
+aStr += OUStringChar(rOrigStr[ 0 ]);
+}
+else if ( nStyle & DrawTextFlags::PathEllipsis )
+{
+OUString aPath( rOrigStr );
+OUString aAbbreviatedPath;
+osl_abbreviateSystemPath( aPath.pData, , 
nIndex, nullptr );
+aStr = aAbbreviatedPath;
+}
+else if ( nStyle & DrawTextFlags::NewsEllipsis )
+{
+static char const   pSepChars[] = ".";
+// Determine last section
+sal_Int32 nLastContent = aStr.getLength();
+while ( nLastContent )
+{
+nLastContent--;
+if ( ImplIsCharIn( aStr[ nLastContent ], pSepChars ) )
+break;
 }
-else if ( nStyle & DrawTextFlags::PathEllipsis )
+while ( nLastContent &&
+ImplIsCharIn( aStr[ nLastContent-1 ], pSepChars ) )
+nLastContent--;
+
+OUString aLastStr = aStr.copy(nLastContent);
+OUString aTempLastStr1 = "..." + aLa

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

2023-10-23 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|   23 --
 include/vcl/window.hxx|2 
 vcl/inc/textlayout.hxx|   26 ++
 vcl/source/gdi/pdfwriter_impl.cxx |2 
 vcl/source/gdi/textlayout.cxx |  396 ++-
 vcl/source/outdev/text.cxx|  427 +-
 vcl/source/window/window3.cxx |2 
 7 files changed, 442 insertions(+), 436 deletions(-)

New commits:
commit 41e00b105f004b75451e24043dc85af703c91dd3
Author: Chris Sherlock 
AuthorDate: Mon Sep 25 00:24:32 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 23 09:42:11 2023 +0200

vcl: migrate text layout functions out of OutputDevice

OutputDevice is not where text layout should be done. There are a number
of text layout functions that are used across the text layout classes,
so I have moved them into TextLayoutHelper and made the text layout
classes rely on this. I have made TextLayoutHelper implement the
ITextLayout interface because this is still useful to new classes that
need to implement new text layout functionality.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4a6d217c2cb6..bea1e00d9b7f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -102,7 +102,7 @@ class SalLayoutGlyphs;
 namespace vcl
 {
 class ExtOutDevData;
-class ITextLayout;
+class TextLayoutCommon;
 struct FontCapabilities;
 class Window;
 class WindowOutputDevice;
@@ -869,11 +869,11 @@ public:
 voidDrawText( const tools::Rectangle& rRect,
   const OUString& rStr, DrawTextFlags 
nStyle = DrawTextFlags::NONE,
   std::vector< tools::Rectangle >* 
pVector = nullptr, OUString* pDisplayText = nullptr,
-  vcl::ITextLayout* _pTextLayout = 
nullptr );
+  vcl::TextLayoutCommon* _pTextLayout 
= nullptr );
 
 static void ImplDrawText( OutputDevice& rTargetDevice, 
const tools::Rectangle& rRect,
   const OUString& rOrigStr, 
DrawTextFlags nStyle,
-  std::vector< tools::Rectangle >* 
pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
+  std::vector< tools::Rectangle >* 
pVector, OUString* pDisplayText, vcl::TextLayoutCommon& _rLayout );
 
 voidImplDrawText( SalLayout& );
 
@@ -904,7 +904,7 @@ public:
 tools::Rectangle   GetTextRect( const tools::Rectangle& 
rRect,
  const OUString& rStr, 
DrawTextFlags nStyle = DrawTextFlags::WordBreak,
  TextRectInfo* pInfo = nullptr,
- const vcl::ITextLayout* 
_pTextLayout = nullptr ) const;
+ const vcl::TextLayoutCommon* 
_pTextLayout = nullptr ) const;
 
 /** Return the exact bounding rectangle of rStr.
 
@@ -1073,17 +1073,6 @@ public:
 protected:
 SAL_DLLPRIVATE void ImplInitTextLineSize();
 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
-static
-SAL_DLLPRIVATE tools::Long  ImplGetTextLines( const tools::Rectangle& 
rRect, tools::Long nTextHeight, ImplMultiTextLineInfo& rLineInfo, tools::Long 
nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& 
_rLayout );
-static
-SAL_DLLPRIVATE sal_Int32ImplBreakLinesWithIterator(const tools::Long 
nWidth, const OUString& rStr, const vcl::ITextLayout& _rLayout,
-const 
css::uno::Reference& xHyph,
-const 
css::uno::Reference& xBI,
-const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos);
-static
-SAL_DLLPRIVATE sal_Int32ImplBreakLinesSimple( const tools::Long 
nWidth, const OUString& rStr,
-const vcl::ITextLayout& _rLayout, const 
sal_Int32 nPos, sal_Int32 nBreakPos, tools::Long& nLineWidth );
 SAL_DLLPRIVATE floatapproximate_char_width() const;
 
 virtual bool shouldDrawWavePixelAsRect(tools::Long nLineWidth) const;
@@ -1200,10 +1189,6 @@ private:
 
 SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( 
FontUpdateHandler_t pHdl, bool bNewFontLists );
 
-static
-SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OUString& rStr,
-   

Re: Windows and 256 color displays

2023-10-10 Thread Chris Sherlock


Sent from my iPhone

> On 11 Sep 2023, at 12:45 pm, Thorsten Behrens  wrote:
> 
> Ilmari Lauhakangas wrote:
>>> On 9.9.2023 3.35, Chris Sherlock wrote:
>>> If not, we could remove a huge chunk of dithering code in
>>> ImplInitSalGDI() and vastly simplify multiplatform support.
>> 
>> Win 7 popularity relative to other Win versions is crashing finally, being
>> 3.5% now, which *is* roughly the same that Win XP was in early 2018 when
>> LibreOffice removed support for it and Vista.
>> 
> Sounds like a good plan then. Also since 24.2 will be considered a
> very visible major upgrade.
> 
> But note that there's a chunk of dither & bitmap code to retain for
> paletted images, that we still want to load & save.
> 
> Cheers,
> 
> -- Thorsten

Sorry for the massive delay in responding. So when we drop support for Windows 
7, it looks like we can revisit this code. Does this sound reasonable?

Chris

Re: Consolidating text layout code

2023-10-10 Thread Chris Sherlock
Just a polite ping to the mailing list, is anyone able to review?

Chris

Sent from my iPhone

> On 7 Oct 2023, at 8:47 pm, Chris Sherlock  wrote:
> 
> Hi all,
> 
> I have migrated text layout code from OutputDevice and into a 
> TextLayoutHelper class. This is because OutputDevice’s primary purpose is not 
> working out text layout, and in fact this is what we are attempting to do 
> with the ITextLayout interface.
> 
> Can anyone have a look at https://gerrit.libreoffice.org/c/core/+/157362 for 
> review? 
> 
> Thanks all!
> Chris
> Sent from my iPhone


Consolidating text layout code

2023-10-07 Thread Chris Sherlock
Hi all,

I have migrated text layout code from OutputDevice and into a TextLayoutHelper 
class. This is because OutputDevice’s primary purpose is not working out text 
layout, and in fact this is what we are attempting to do with the ITextLayout 
interface.

Can anyone have a look at https://gerrit.libreoffice.org/c/core/+/157362 for 
review? 

Thanks all!
Chris
Sent from my iPhone

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

2023-09-27 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 +-
 vcl/source/outdev/text.cxx |   14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 47c4d0fbdc681287f2fd9f5240ca1ce7a960ec18
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 02:52:32 2023 +1000
Commit: Noel Grandin 
CommitDate: Wed Sep 27 16:55:10 2023 +0200

vcl: remove rTargetDevice from OutputDevice::ImplGetEllipsisString()

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f2fdf7ab7db7..9b9a80af0fc9 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1201,7 +1201,7 @@ private:
 SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( 
FontUpdateHandler_t pHdl, bool bNewFontLists );
 
 static
-SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& 
rTargetDevice, const OUString& rStr,
+SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OUString& rStr,
tools::Long nMaxWidth, 
DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
 
 SAL_DLLPRIVATE void ImplDrawEmphasisMark( tools::Long nBaseX, 
tools::Long nX, tools::Long nY, const tools::PolyPolygon& rPolyPoly, bool 
bPolyLine, const tools::Rectangle& rRect1, const tools::Rectangle& rRect2 );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index d5509650900a..6e9aacbb4567 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1641,7 +1641,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 aLastLineBuffer[ i ] = ' ';
 }
 aLastLine = aLastLineBuffer.makeStringAndClear();
-aLastLine = ImplGetEllipsisString( rTargetDevice, 
aLastLine, nWidth, nStyle, _rLayout );
+aLastLine = ImplGetEllipsisString( aLastLine, nWidth, 
nStyle, _rLayout );
 nStyle &= ~DrawTextFlags(DrawTextFlags::VCenter | 
DrawTextFlags::Bottom);
 nStyle |= DrawTextFlags::Top;
 }
@@ -1728,7 +1728,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 {
 if ( nStyle & TEXT_DRAW_ELLIPSIS )
 {
-aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, 
nStyle, _rLayout );
+aStr = ImplGetEllipsisString( aStr, nWidth, nStyle, _rLayout );
 nStyle &= ~DrawTextFlags(DrawTextFlags::Center | 
DrawTextFlags::Right);
 nStyle |= DrawTextFlags::Left;
 nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.getLength() 
);
@@ -2018,10 +2018,10 @@ OUString OutputDevice::GetEllipsisString( const 
OUString& rOrigStr, tools::Long
 DrawTextFlags nStyle ) const
 {
 vcl::DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) );
-return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, 
aTextLayout );
+return ImplGetEllipsisString( rOrigStr, nMaxWidth, nStyle, aTextLayout );
 }
 
-OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& 
rTargetDevice, const OUString& rOrigStr, tools::Long nMaxWidth,
+OUString OutputDevice::ImplGetEllipsisString( const OUString& rOrigStr, 
tools::Long nMaxWidth,
DrawTextFlags nStyle, const 
vcl::ITextLayout& _rLayout )
 {
 OUString aStr = rOrigStr;
@@ -2085,7 +2085,7 @@ OUString OutputDevice::ImplGetEllipsisString( const 
OutputDevice& rTargetDevice,
 OUString aLastStr = aStr.copy(nLastContent);
 OUString aTempLastStr1 = "..." + aLastStr;
 if ( _rLayout.GetTextWidth( aTempLastStr1, 0, 
aTempLastStr1.getLength() ) > nMaxWidth )
-aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, 
aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
+aStr = OutputDevice::ImplGetEllipsisString( aStr, nMaxWidth, 
nStyle | DrawTextFlags::EndEllipsis, _rLayout );
 else
 {
 sal_Int32 nFirstContent = 0;
@@ -2100,7 +2100,7 @@ OUString OutputDevice::ImplGetEllipsisString( const 
OutputDevice& rTargetDevice,
 nFirstContent++;
 // MEM continue here
 if ( nFirstContent >= nLastContent )
-aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, 
aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
+aStr = OutputDevice::ImplGetEllipsisString( aStr, 
nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
 else
 {
 

Windows and 256 color displays

2023-09-08 Thread Chris Sherlock
Do we still support Windows on a 256 color display?

If not, we could remove a huge chunk of dithering code in ImplInitSalGDI() and 
vastly simplify multiplatform support.

Chris

Sent from my iPhone

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

2022-11-30 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/clipping.cxx   |4 +---
 vcl/source/outdev/curvedshapes.cxx   |6 ++
 vcl/source/outdev/gradient.cxx   |9 -
 vcl/source/outdev/hatch.cxx  |7 ++-
 vcl/source/outdev/map.cxx|6 +++---
 vcl/source/outdev/mask.cxx   |6 ++
 vcl/source/outdev/nativecontrols.cxx |   13 ++---
 vcl/source/outdev/outdev.cxx |   11 +--
 vcl/source/outdev/pixel.cxx  |6 ++
 vcl/source/outdev/polygon.cxx|   10 --
 vcl/source/outdev/polyline.cxx   |8 +++-
 vcl/source/outdev/rect.cxx   |7 +++
 vcl/source/outdev/stack.cxx  |1 -
 vcl/source/outdev/text.cxx   |   20 ++--
 vcl/source/outdev/textline.cxx   |   19 ---
 15 files changed, 55 insertions(+), 78 deletions(-)

New commits:
commit 1a5d548b96d86ad7ca04c2b23dc18517a538a998
Author: Chris Sherlock 
AuthorDate: Sun Nov 27 03:06:22 2022 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 1 05:01:12 2022 +0100

vcl: remove unnecessary includes

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

diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index 0570719a15fa..ad45b08e1f87 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -19,12 +19,10 @@
 
 #include 
 #include 
-
 #include 
+
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
diff --git a/vcl/source/outdev/curvedshapes.cxx 
b/vcl/source/outdev/curvedshapes.cxx
index de7379dd32bb..b5a13fb721d9 100644
--- a/vcl/source/outdev/curvedshapes.cxx
+++ b/vcl/source/outdev/curvedshapes.cxx
@@ -17,15 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
 #include 
-#include 
 #include 
 
 #include 
 
+#include 
+
 void OutputDevice::DrawEllipse( const tools::Rectangle& rRect )
 {
 assert(!is_double_buffered_window());
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 707ca47d960a..5a60184abfff 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -17,20 +17,19 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
 #include 
-#include 
+
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
+#include 
+#include 
+
 #define GRADIENT_DEFAULT_STEPCOUNT  0
 
 void OutputDevice::DrawGradient( const tools::Rectangle& rRect,
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 3b92f6df5de9..0fc755864a5d 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -17,24 +17,21 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
 #include 
 #include 
 #include 
-
 #include 
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
+#include 
+#include 
 #include 
 
 #define HATCH_MAXPOINTS 1024
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 85b5512a4416..67414cb2976c 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -19,16 +19,16 @@
 
 #include 
 
+#include 
+#include 
 #include 
 #include 
+
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index c1c3e3b018f5..004b248785b5 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -17,16 +17,14 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
+#include 
+
 void OutputDevice::DrawMask( const Point& rDestPt,
  const Bitmap& rBitmap, const Color& rMaskColor )
 {
diff --git a/vcl/source/outdev/nativecontrols.cxx 
b/vcl/source/outdev/nativecontrols.cxx
index a8557259adc7..cee9408d6cfb 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -17,18 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
-#include 
-#include 
 #include 
-#include 
 
-#include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
+#include 
+
+#include 
 
 ImplControlValue::~ImplControlValue()
 {
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index ab677b468f73..b4c1eac4499e 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -18,19 +18,18 @@
  */
 
 #include 
-#include 
 
+#include 
+#include 
 #include 
-#include 
+
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/vcl/sourc

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

2022-11-28 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/map.cxx |   48 +-
 1 file changed, 18 insertions(+), 30 deletions(-)

New commits:
commit 845dd688e5032c83db889cbf2ca033144dd1de32
Author: Chris Sherlock 
AuthorDate: Sun Nov 27 02:35:42 2022 +1100
Commit: Noel Grandin 
CommitDate: Mon Nov 28 11:12:12 2022 +0100

tdf#123419 vcl: remove unneeded ImplMakeFraction() in map.cxx

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

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 02221c345862..85b5512a4416 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -37,16 +37,6 @@
 #include 
 #include 
 
-/*
-Reduces accuracy until it is a fraction (should become
-ctor fraction once); we could also do this with BigInts
-*/
-
-static Fraction ImplMakeFraction( tools::Long nN1, tools::Long nN2, 
tools::Long nD1, tools::Long nD2 )
-{
-return Fraction::MakeFraction(nN1, nN2, nD1, nD2);
-}
-
 static auto setMapRes(ImplMapRes& rMapRes, const o3tl::Length eUnit)
 {
 const auto [nNum, nDen] = o3tl::getConversionMulDiv(eUnit, 
o3tl::Length::in);
@@ -178,11 +168,11 @@ static void ImplCalcMapResolution( const MapMode& 
rMapMode,
 
 // calculate scaling factor according to MapMode
 // aTemp? = rMapRes.mnMapSc? * aScale?
-Fraction aTempX = ImplMakeFraction( rMapRes.mnMapScNumX,
+Fraction aTempX = Fraction::MakeFraction( rMapRes.mnMapScNumX,
 aScaleX.GetNumerator(),
 rMapRes.mnMapScDenomX,
 aScaleX.GetDenominator() );
-Fraction aTempY = ImplMakeFraction( rMapRes.mnMapScNumY,
+Fraction aTempY = Fraction::MakeFraction( rMapRes.mnMapScNumY,
 aScaleY.GetNumerator(),
 rMapRes.mnMapScDenomY,
 aScaleY.GetDenominator() );
@@ -699,24 +689,22 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode 
)
 }
 
 // set new MapMode
-if ( bRelMap )
+if (bRelMap)
 {
-Point aOrigin( maMapRes.mnMapOfsX, maMapRes.mnMapOfsY );
-// aScale? = maMapMode.GetScale?() * rNewMapMode.GetScale?()
-Fraction aScaleX = ImplMakeFraction( 
maMapMode.GetScaleX().GetNumerator(),
- 
rNewMapMode.GetScaleX().GetNumerator(),
- 
maMapMode.GetScaleX().GetDenominator(),
- 
rNewMapMode.GetScaleX().GetDenominator() );
-Fraction aScaleY = ImplMakeFraction( 
maMapMode.GetScaleY().GetNumerator(),
- 
rNewMapMode.GetScaleY().GetNumerator(),
- 
maMapMode.GetScaleY().GetDenominator(),
- 
rNewMapMode.GetScaleY().GetDenominator() );
-maMapMode.SetOrigin( aOrigin );
-maMapMode.SetScaleX( aScaleX );
-maMapMode.SetScaleY( aScaleY );
+maMapMode.SetScaleX(Fraction::MakeFraction(
+maMapMode.GetScaleX().GetNumerator(), 
rNewMapMode.GetScaleX().GetNumerator(),
+maMapMode.GetScaleX().GetDenominator(), 
rNewMapMode.GetScaleX().GetDenominator()));
+
+maMapMode.SetScaleY(Fraction::MakeFraction(
+maMapMode.GetScaleY().GetNumerator(), 
rNewMapMode.GetScaleY().GetNumerator(),
+maMapMode.GetScaleY().GetDenominator(), 
rNewMapMode.GetScaleY().GetDenominator()));
+
+maMapMode.SetOrigin(Point(maMapRes.mnMapOfsX, maMapRes.mnMapOfsY));
 }
 else
+{
 maMapMode = rNewMapMode;
+}
 
 // create new objects (clip region are not re-scaled)
 mbNewFont   = true;
@@ -753,11 +741,11 @@ void OutputDevice::SetRelativeMapMode( const MapMode& 
rNewMapMode )
 MapUnit eNew = rNewMapMode.GetMapUnit();
 
 // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
-Fraction aXF = ImplMakeFraction( rNewMapMode.GetScaleX().GetNumerator(),
+Fraction aXF = Fraction::MakeFraction( 
rNewMapMode.GetScaleX().GetNumerator(),
  maMapMode.GetScaleX().GetDenominator(),
  rNewMapMode.GetScaleX().GetDenominator(),
  maMapMode.GetScaleX().GetNumerator() );
-Fraction aYF = ImplMakeFraction( rNewMapMode.GetScaleY().GetNumerator(),
+Fraction aYF = Fraction::MakeFraction( 
rNewMapMode.GetScaleY().GetNumerator(),
  maMapMode.GetScaleY().GetDenominator(),
  rNewMapMode.GetScaleY().GetDenominator(),
  maMapMode.GetScaleY().GetNumerator() );
@@ -781,9 +769,9 @@ void OutputDevice::SetRelativeMapMod

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

2022-11-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_font.mk|5 ++
 vcl/qa/cppunit/logicalfontinstance.cxx |   64 +
 2 files changed, 69 insertions(+)

New commits:
commit a22047f148c45d34c5ce08d2d9011237287b673f
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 11:20:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 27 10:40:17 2022 +0100

vcl: test getting glyph boundary rect from LogicalFontInstance

MacOS produces a slightly different glyph height.

Quoting from Khaled in dev IRC:

"Currently GetGlyphBoundRect() calls different platform-specific
implementations on each platform, so even with the same font it is
possible to get some difference. So my suggestion is to use a large font
size and allow for some fuzziness".

Consequently I'm using a 110pt font, and taking into account some
fuzziness.

Change-Id: I0dace6bfa0d1f4e6f3b8852e957d2d518d37795b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143322
Tested-by: Jenkins
Reviewed-by: خالد حسني 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 891352508a1c..813ab1c9c009 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
vcl/qa/cppunit/physicalfontfacecollection \
vcl/qa/cppunit/physicalfontfamily \
vcl/qa/cppunit/physicalfontcollection \
+   vcl/qa/cppunit/logicalfontinstance \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,vcl_font,\
@@ -56,4 +57,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_font,\
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_font))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_font))
+
+$(eval $(call gb_CppunitTest_set_non_application_font_use,vcl_font,abort))
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx 
b/vcl/qa/cppunit/logicalfontinstance.cxx
new file mode 100644
index ..2a7a5c83ac27
--- /dev/null
+++ b/vcl/qa/cppunit/logicalfontinstance.cxx
@@ -0,0 +1,64 @@
+/* -*- 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/.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+class VclLogicalFontInstanceTest : public test::BootstrapFixture
+{
+public:
+VclLogicalFontInstanceTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testglyphboundrect();
+
+CPPUNIT_TEST_SUITE(VclLogicalFontInstanceTest);
+CPPUNIT_TEST(testglyphboundrect);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void VclLogicalFontInstanceTest::testglyphboundrect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 110)));
+
+const LogicalFontInstance* pFontInstance = device->GetFontInstance();
+
+tools::Rectangle aBoundRect;
+const auto LATIN_SMALL_LETTER_B = 0x0062;
+
pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B),
 aBoundRect,
+ false);
+
+const tools::Long nExpectedX = 7;
+const tools::Long nExpectedY = -80;
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("x of glyph is wrong", nExpectedX, 
aBoundRect.getX());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("y of glyph is wrong", nExpectedY, 
aBoundRect.getY());
+CPPUNIT_ASSERT_MESSAGE("height of glyph of wrong",
+   aBoundRect.GetWidth() == 50 || 
aBoundRect.GetWidth() == 51);
+CPPUNIT_ASSERT_MESSAGE("width of glyph of wrong",
+   aBoundRect.GetHeight() == 82 || 
aBoundRect.GetHeight() == 83);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: include/vcl Repository.mk vcl/Executable_listglyphs.mk vcl/Module_vcl.mk vcl/workben

2022-11-25 Thread Chris Sherlock (via logerrit)
 Repository.mk|1 
 include/vcl/outdev.hxx   |2 
 vcl/Executable_listglyphs.mk |   41 +++
 vcl/Module_vcl.mk|1 
 vcl/workben/listglyphs.cxx   |  231 +++
 5 files changed, 275 insertions(+), 1 deletion(-)

New commits:
commit 42da7674685c1a82fd655f19c2665030f41d5929
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 21:32:49 2022 +1100
Commit: Michael Stahl 
CommitDate: Fri Nov 25 14:04:20 2022 +0100

vcl: list the glyphs and bound rects of a specified font

Change-Id: Ia635d83a5d3dd257948777e9f6976fecfeb4ee98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141526
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/Repository.mk b/Repository.mk
index 35c7a8e25295..15a75405ee23 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
mtfdemo \
visualbackendtest \
listfonts \
+   listglyphs \
$(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), 
gtktiledviewer) \
$(if $(and $(ENABLE_GTKTILEDVIEWER), $(filter WNT,$(OS))), 
gtktiledviewer) \
 $(if $(filter EMSCRIPTEN,$(OS)),wasm-qt5-mandelbrot) \
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 14c1675e7eed..39bf4f667164 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1176,7 +1176,7 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+LogicalFontInstance const* GetFontInstance() const;
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/Executable_listglyphs.mk b/vcl/Executable_listglyphs.mk
new file mode 100644
index ..acd1fd9b00c1
--- /dev/null
+++ b/vcl/Executable_listglyphs.mk
@@ -0,0 +1,41 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_Executable_Executable,listglyphs))
+
+$(eval $(call gb_Executable_use_api,listglyphs,\
+offapi \
+udkapi \
+))
+
+$(eval $(call gb_Executable_set_include,listglyphs,\
+$$(INCLUDE) \
+-I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Executable_use_externals,listglyphs,\
+   harfbuzz \
+   graphite \
+))
+
+$(eval $(call gb_Executable_use_libraries,listglyphs,\
+tl \
+sal \
+vcl \
+cppu \
+cppuhelper \
+comphelper \
+i18nlangtag \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,listglyphs,\
+vcl/workben/listglyphs \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 81f28dcfdd68..596ed5b8c03a 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
 Executable_fftester \
 Executable_svptest \
 Executable_listfonts \
+Executable_listglyphs \
 Executable_svpclient) \
 ))
 
diff --git a/vcl/workben/listglyphs.cxx b/vcl/workben/listglyphs.cxx
new file mode 100644
index ..def2ff818122
--- /dev/null
+++ b/vcl/workben/listglyphs.cxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+class ListGlyphsWin : public WorkWindow
+{
+public:
+explicit ListGlyphsWin()
+: WorkWindow(nullptr, WB_HIDE)
+{
+}
+};
+
+class ListGlyphs : public Application
+{
+public:
+virtual int Main() override;
+
+private:
+static void showHelp()
+{
+std::cerr << "Usage: listglyphs --help |  FILE\n";
+std::cerr << "Lists the current glyphs in a font installed on the 
system.\n";
+std::cerr << "If outputting to stdout, use -- for FILE.\n";
+std::exit(0);
+}
+
+void Init() override;
+void DeInit() override;
+
+css::uno::Reference xServiceManager;
+bool mbStdOut = false;
+OUString maFilename;
+OUString maFontname;
+};
+
+int ListGlyphs::Main()

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

2022-11-20 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |  102 
 1 file changed, 102 insertions(+)

New commits:
commit e535da3b6d72c0aca312dcf1ca38a3fcc3532a38
Author: Chris Sherlock 
AuthorDate: Sun Oct 2 19:11:11 2022 +1100
Commit: خالد حسني 
CommitDate: Sun Nov 20 16:25:25 2022 +0100

vcl: add unit tests for OutputDevice::GetTextRect()

Change-Id: Ic36d42b0b38083c6a9ce3b6af4d80d5acf3e96e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140906
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index a450c99ee3df..ee7ab8cd5859 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -66,6 +66,13 @@ public:
 void testGetStringWithEndEllpsis();
 void testGetStringWithNewsEllpsis();
 void testGetTextBreak();
+void testGetSingleLineTextRect();
+void testGetSingleLineTextRectWithEndEllipsis();
+void testGetRightBottomAlignedSingleLineTextRect();
+void testGetMultiLineTextRect();
+void testGetMultiLineTextRectWithEndEllipsis();
+void testGetRightBottomAlignedMultiLineTextRect();
+void testGetRotatedSingleLineTextRect();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
 CPPUNIT_TEST(testSimpleText);
@@ -82,6 +89,13 @@ public:
 CPPUNIT_TEST(testGetStringWithEndEllpsis);
 CPPUNIT_TEST(testGetStringWithNewsEllpsis);
 CPPUNIT_TEST(testGetTextBreak);
+CPPUNIT_TEST(testGetSingleLineTextRect);
+CPPUNIT_TEST(testGetSingleLineTextRectWithEndEllipsis);
+CPPUNIT_TEST(testGetRightBottomAlignedSingleLineTextRect);
+CPPUNIT_TEST(testGetMultiLineTextRect);
+CPPUNIT_TEST(testGetMultiLineTextRectWithEndEllipsis);
+CPPUNIT_TEST(testGetRightBottomAlignedMultiLineTextRect);
+CPPUNIT_TEST(testGetRotatedSingleLineTextRect);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -671,6 +685,94 @@ void VclTextTest::testGetTextBreak()
  device->GetTextBreak(sTestStr, nTextWidth, 13, nLen));
 }
 
+void VclTextTest::testGetSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(), Size(75, 12)),
+device->GetTextRect(tools::Rectangle(Point(), Point(100, 100)), "This 
is test text"));
+}
+
+void VclTextTest::testGetSingleLineTextRectWithEndEllipsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(), Size(52, 12)),
+device->GetTextRect(tools::Rectangle(Point(), Point(50, 50)), "This is 
test text",
+DrawTextFlags::WordBreak | 
DrawTextFlags::EndEllipsis));
+}
+
+void VclTextTest::testGetRightBottomAlignedSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(926, 989), Size(75, 12)),
+ device->GetTextRect(tools::Rectangle(Point(), 
Point(1000, 1000)),
+ "This is test text",
+ DrawTextFlags::Right | 
DrawTextFlags::Bottom));
+}
+
+void VclTextTest::testGetRotatedSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+vcl::Font aFont(device->GetFont());
+aFont.SetOrientation(45_deg10);
+device->SetFont(aFont);
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(0, -3), Size(75, 18)),
+device->GetTextRect(tools::Rectangle(Point(), Point(100, 100)), "This 
is test text"));
+}
+
+void VclTextTest::testGetMultiLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(), Size(75, 12)),
+ device->GetTextRect(tools::Rectangle(Point(), 
Point(100, 100)),
+ "This is test text",
+ DrawTextFlags::WordBreak | 
DrawTextFlags::MultiLine));
+}
+
+void VclTextTest::testGetMultiLineTextRectWithEndEllipsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("

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

2022-11-17 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 -
 vcl/CppunitTest_vcl_font.mk|5 ++
 vcl/qa/cppunit/logicalfontinstance.cxx |   59 +
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 0cef06f0a2c0963e8c1579b78975710e6af4471c
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 11:20:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 07:40:46 2022 +0100

vcl: test getting glyph boundary rect from LogicalFontInstance

MacOS produces a slightly different glyph height.

Quoting from Khaled in dev IRC:

"Currently GetGlyphBoundRect() calls different platform-specific
implementations on each platform, so even with the same font it is
possible to get some difference. So my suggestion is to use a large font
size and allow for some fuzziness".

Consequently I'm using a 110pt font.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 14c1675e7eed..b4fdd82e1ab9 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1176,7 +1176,7 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+const LogicalFontInstance* GetFontInstance() const;
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 891352508a1c..813ab1c9c009 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
vcl/qa/cppunit/physicalfontfacecollection \
vcl/qa/cppunit/physicalfontfamily \
vcl/qa/cppunit/physicalfontcollection \
+   vcl/qa/cppunit/logicalfontinstance \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,vcl_font,\
@@ -56,4 +57,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_font,\
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_font))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_font))
+
+$(eval $(call gb_CppunitTest_set_non_application_font_use,vcl_font,abort))
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx 
b/vcl/qa/cppunit/logicalfontinstance.cxx
new file mode 100644
index ..56b9897f0589
--- /dev/null
+++ b/vcl/qa/cppunit/logicalfontinstance.cxx
@@ -0,0 +1,59 @@
+/* -*- 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/.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+class VclLogicalFontInstanceTest : public test::BootstrapFixture
+{
+public:
+VclLogicalFontInstanceTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testglyphboundrect();
+
+CPPUNIT_TEST_SUITE(VclLogicalFontInstanceTest);
+CPPUNIT_TEST(testglyphboundrect);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void VclLogicalFontInstanceTest::testglyphboundrect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 110)));
+
+const LogicalFontInstance* pFontInstance = device->GetFontInstance();
+
+tools::Rectangle aBoundRect;
+const auto LATIN_SMALL_LETTER_B = 0x0062;
+
pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B),
 aBoundRect,
+ false);
+#ifdef MACOSX
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(7, -80), Size(51, 83)), 
aBoundRect);
+#else
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(7, -80), Size(51, 82)), 
aBoundRect);
+#endif
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


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

2022-11-13 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 ++
 vcl/source/animate/Animation.cxx  |   35 ---
 2 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 5ccba00d2007d664b9ffd0f956323a8180cb8e66
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:57:41 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 13 14:04:02 2022 +0100

vcl: extract functions AllRenderersPaused() and PruneMarkedRenderers()

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 307fed73c222..11bb3c894058 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -113,6 +113,8 @@ private:
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void PopulateRenderers();
 SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
+SAL_DLLPRIVATE void PruneMarkedRenderers();
+SAL_DLLPRIVATE bool IsAnyRendererActive();
 
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index e1bd5ba042fc..5d4a208a6b30 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -361,6 +361,24 @@ void Animation::RenderNextFrameInAllRenderers()
 ImplRestartTimer(pCurrentFrameBmp->mnWait);
 }
 
+void Animation::PruneMarkedRenderers()
+{
+// delete all unmarked views
+auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
+  [](const auto& pRenderer) { return 
!pRenderer->isMarked(); });
+maRenderers.erase(removeStart, maRenderers.cend());
+
+// reset marked state
+std::for_each(maRenderers.cbegin(), maRenderers.cend(),
+  [](const auto& pRenderer) { pRenderer->setMarked(false); });
+}
+
+bool Animation::IsAnyRendererActive()
+{
+return std::any_of(maRenderers.cbegin(), maRenderers.cend(),
+   [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -373,21 +391,8 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 maNotifyLink.Call(this);
 PopulateRenderers();
-
-// delete all unmarked views
-auto removeStart
-= std::remove_if(maRenderers.begin(), maRenderers.end(),
- [](const auto& pRenderer) { return 
!pRenderer->isMarked(); });
-maRenderers.erase(removeStart, maRenderers.cend());
-
-// check if every remaining view is paused
-bIsAnyRendererActive
-= std::any_of(maRenderers.cbegin(), maRenderers.cend(),
-  [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
-
-// reset marked state
-std::for_each(maRenderers.cbegin(), maRenderers.cend(),
-  [](const auto& pRenderer) { 
pRenderer->setMarked(false); });
+PruneMarkedRenderers();
+bIsAnyRendererActive = IsAnyRendererActive();
 }
 
 if (maRenderers.empty())


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

2022-11-13 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit d773da0c083b4ee1cf12bd7846cbdbe37ed8
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:44:56 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 13 13:43:50 2022 +0100

vcl: small optimization determining if any renderers are active

Currently we look at every renderer to see if it is paused. However, you
can think of this differently - instead of using a universal quantifier
we can actually use an existential quantifier - if even one renderer is
not paused, then we can say that not every renderer is paused - thus no
global pause. Hence switch to any_of(), which stops the loop at the
first instance of a non-paused renderer.

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

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index c6547f9e7852..e1bd5ba042fc 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -367,7 +367,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (nAnimCount)
 {
-bool bGlobalPause = false;
+bool bIsAnyRendererActive = true;
 
 if (maNotifyLink.IsSet())
 {
@@ -381,8 +381,9 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 maRenderers.erase(removeStart, maRenderers.cend());
 
 // check if every remaining view is paused
-bGlobalPause = std::all_of(maRenderers.cbegin(), 
maRenderers.cend(),
-   [](const auto& pRenderer) { return 
pRenderer->isPaused(); });
+bIsAnyRendererActive
+= std::any_of(maRenderers.cbegin(), maRenderers.cend(),
+  [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
 
 // reset marked state
 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
@@ -391,13 +392,15 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maRenderers.empty())
 Stop();
-else if (bGlobalPause)
+else if (!bIsAnyRendererActive)
 ImplRestartTimer(10);
 else
 RenderNextFrameInAllRenderers();
 }
 else
+{
 Stop();
+}
 }
 
 bool Animation::Insert(const AnimationFrame& rStepBmp)


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-11-06 Thread Chris Sherlock
On Sun, Oct 30, 2022 at 2:26 AM Chris Sherlock 
wrote:

>
>
> Sent from my iPhone
>
> On 23 Oct 2022, at 5:20 am, Caolán McNamara  wrote:
>
> On Sat, 2022-10-22 at 01:42 +1100, Chris Sherlock wrote:
>
> Test name: VclLogicalFontInstanceTest::testglyphboundrect
>
> equality assertion failed
>
> - Expected: 51x82@(7,-80)
>
> - Actual  : 51x83@(7,-80)
>
>
> I’ve had another look at the code, with some help from Khaled. The
>
> issue is the way in which we do our final rounding.
>
>
> On Freetype, it uses 26.6 fixed point, and thus needs it’s own
>
> special FreeType ceil and floor functions. CoreText appears to using
>
> floating point, but the std::ceil and std::floor functions give
>
> slight different results.
>
>
> I presume that for mac its CoreTextStyle::ImplGetGlyphoundRect and the
> CTFontGetBoundingRectsForGlyphs so could print the numbers we get there
> vs the ones we get in FreeTypeFont::GetGlyphBoundRect to verify that.
>
>
> I’ve added some debugging statements. the Freetype library does its own
> floor and ceil calculations. it’s looking like it isn’t a risky a rounding
> error, it is just that Freetype calculates one value and MacOS framework
> for glyphs calculates it differently.
>
> Patch is https://gerrit.libreoffice.org/c/core/+/142006 if anyone would
> like to review :-)
>
> Chris
>

A polite ping to the mailing list as people are now asking me for the
rationale behind the patch, could someone please advise the way forward?

Chris


Re: [BUG] [Libetonyek Build Failed] Please consider updating autotool scripts.

2022-10-30 Thread Chris Sherlock



> On 17 Oct 2022, at 4:17 pm, 南国 微雪  wrote:
> 
> Hello, I'm from ArchRISC-V Team, a community porting Arch Linux software to 
> RISC-V architecture.
>  
> # Description 
>  
> While packaging `Libetonyek`, we found an error.
> (This link is the log about building processing our lord maintained.)
> The `config.guess` file is too old to work.
> So our team gives this advice.
>  
> ## Advice
>  
> - You can find the patch here that how we fix it.
> - Please consider updating the configure script tools(Especially 
> `config.guess` file). As part of our duty, we do suggest our upstreams doing 
> this once and for all instead.
>  
> Sincerely thanks.
> :)
>  
> Sent from Mail for Windows

I ran this through Google Translate. It reads:

"config.guess: unable to guess system type

solution:

1. First report upstream that their config.guessand config.subfiles are too old.
2. Then try to update config.guess with autoreconf -ficommand
3. If the upstream config.guess file is too old to be updated 
/usr/share/autoconf/build-aux/, copy the config.guess and config.subfiles in 
the directory to the local.
4. Submit a PR with a link to your upstream report.
5. Keep track of your upstream reports, and delete patches after upstream 
updates to concurrent releases.”

I checked libetonyek on opengrok, and there doesn’t seem to be a config.guess 
file?

Chris




Re: Date errors in LibreOffice

2022-10-29 Thread Chris Sherlock


Sent from my iPhone

> On 25 Oct 2022, at 9:39 am, Juan C. Sanz  wrote:
> 
> Hi
> 
> A few weeks ago I proposed a patch 
> https://gerrit.libreoffice.org/c/core/+/138845 related to bug tdf#150587, 
> which removed what I felt was an artificial limitation on the range of dates 
> that can be entered in some LibreOffice form controls.
> 
> Due to some comments, I reverted the patch and started to do some testing of 
> the behavior of dates in LibreOffice.
> 

That is some excellent testing! Kudos to you for the hard work. I wonder if it 
might not be best to log the bugs anyway?

FWIW, your proposal to use the Gregorian calendar seems pretty reasonable to 
me.  However, it’s not an area of the code I have any experience with, so take 
this with a grain of salt.

Chris

Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-29 Thread Chris Sherlock


Sent from my iPhone

> On 23 Oct 2022, at 5:20 am, Caolán McNamara  wrote:
> 
> On Sat, 2022-10-22 at 01:42 +1100, Chris Sherlock wrote:
>>> Test name: VclLogicalFontInstanceTest::testglyphboundrect
>>> equality assertion failed
>>> - Expected: 51x82@(7,-80)
>>> - Actual  : 51x83@(7,-80)
>> 
>> I’ve had another look at the code, with some help from Khaled. The
>> issue is the way in which we do our final rounding. 
>> 
>> On Freetype, it uses 26.6 fixed point, and thus needs it’s own
>> special FreeType ceil and floor functions. CoreText appears to using
>> floating point, but the std::ceil and std::floor functions give
>> slight different results. 
> 
> I presume that for mac its CoreTextStyle::ImplGetGlyphoundRect and the
> CTFontGetBoundingRectsForGlyphs so could print the numbers we get there
> vs the ones we get in FreeTypeFont::GetGlyphBoundRect to verify that. 

I’ve added some debugging statements. the Freetype library does its own floor 
and ceil calculations. it’s looking like it isn’t a risky a rounding error, it 
is just that Freetype calculates one value and MacOS framework for glyphs 
calculates it differently.

Patch is https://gerrit.libreoffice.org/c/core/+/142006 if anyone would like to 
review :-)

Chris

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

2022-10-28 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |1 
 vcl/source/animate/Animation.cxx  |   92 ++
 2 files changed, 46 insertions(+), 47 deletions(-)

New commits:
commit 91bc1e6a8c92a7c895f0ba9dcad9ac4d35f3f791
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:21:17 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 28 11:09:32 2022 +0200

vcl: extract function Animation::RenderNextFrameInAllRenderers()

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index b9d9d69e401f..307fed73c222 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -112,6 +112,7 @@ private:
 
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void PopulateRenderers();
+SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
 
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 4ae010c54332..c6547f9e7852 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -317,6 +317,50 @@ void Animation::PopulateRenderers()
 }
 }
 
+void Animation::RenderNextFrameInAllRenderers()
+{
+AnimationFrame* pCurrentFrameBmp
+= (++mnFrameIndex < maFrames.size()) ? maFrames[mnFrameIndex].get() : 
nullptr;
+
+if (!pCurrentFrameBmp)
+{
+if (mnLoops == 1)
+{
+Stop();
+mbLoopTerminated = true;
+mnFrameIndex = mnAnimCount - 1;
+maBitmapEx = maFrames[mnFrameIndex]->maBitmapEx;
+return;
+}
+else
+{
+if (mnLoops)
+mnLoops--;
+
+mnFrameIndex = 0;
+pCurrentFrameBmp = maFrames[mnFrameIndex].get();
+}
+}
+
+// Paint all views.
+std::for_each(maRenderers.cbegin(), maRenderers.cend(),
+  [this](const auto& pRenderer) { 
pRenderer->draw(mnFrameIndex); });
+/*
+ * If a view is marked, remove the view, because
+ * area of output lies out of display area of window.
+ * Mark state is set from view itself.
+ */
+auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
+  [](const auto& pRenderer) { return 
pRenderer->isMarked(); });
+maRenderers.erase(removeStart, maRenderers.cend());
+
+// stop or restart timer
+if (maRenderers.empty())
+Stop();
+else
+ImplRestartTimer(pCurrentFrameBmp->mnWait);
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -346,57 +390,11 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 }
 
 if (maRenderers.empty())
-{
 Stop();
-}
 else if (bGlobalPause)
-{
 ImplRestartTimer(10);
-}
 else
-{
-AnimationFrame* pCurrentFrameBmp
-= (++mnFrameIndex < maFrames.size()) ? 
maFrames[mnFrameIndex].get() : nullptr;
-
-if (!pCurrentFrameBmp)
-{
-if (mnLoops == 1)
-{
-Stop();
-mbLoopTerminated = true;
-mnFrameIndex = nAnimCount - 1;
-maBitmapEx = maFrames[mnFrameIndex]->maBitmapEx;
-return;
-}
-else
-{
-if (mnLoops)
-mnLoops--;
-
-mnFrameIndex = 0;
-pCurrentFrameBmp = maFrames[mnFrameIndex].get();
-}
-}
-
-// Paint all views.
-std::for_each(maRenderers.cbegin(), maRenderers.cend(),
-  [this](const auto& pRenderer) { 
pRenderer->draw(mnFrameIndex); });
-/*
- * If a view is marked, remove the view, because
- * area of output lies out of display area of window.
- * Mark state is set from view itself.
- */
-auto removeStart
-= std::remove_if(maRenderers.begin(), maRenderers.end(),
- [](const auto& pRenderer) { return 
pRenderer->isMarked(); });
-maRenderers.erase(removeStart, maRenderers.cend());
-
-// stop or restart timer
-if (maRenderers.empty())
-Stop();
-else
-ImplRestartTimer(pCurrentFrameBmp->mnWait);
-}
+RenderNextFrameInAllRenderers();
 }
 else
 Stop();


Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-22 Thread Chris Sherlock
On 22 Oct 2022, at 9:36 pm, Paolo Vecchi  
wrote:
> 
> Hi Noel,
> 
> On 22/10/2022 08:27, Noel Grandin wrote:
>> 
>> 
>> On Fri, 21 Oct 2022 at 23:32, Andreas Mantke > > wrote:
>> The whole action was driven by members of the board with a (potential?)
>> Conflict of Interest (CoI) on just this topic.
>> 
>> 
>> This is just another way of attempting to exclude everybody you disagree 
>> with.
>> 
>> The way you define COI, everybody involved with LibreOiffce has a conflict 
>> of interest, so nobody should be commenting.
>> 
> Andreas actually didn't define what a CoI is, laws and regulations do.
> 
Hi Paolo, 

So that I can understand correctly, and as an outside party, are you alleging 
there *was* a conflict of interest in the actions taken by members of the Board?

Chris

Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-22 Thread Chris Sherlock
On Sat, Oct 22, 2022 at 8:24 PM Andreas Mantke  wrote:

> it would have been great, if you'd explained that you are  working for
> the company which forked away from LibreOffice Online
> (https://www.documentfoundation.org/gethelp/developers/).
>
> Thus you have on this specific topic (the online version of LibreOffice
> and the work on that project) a (potential?) CoI.
>

 Sorry to butt in again, but Noel has never made it unclear he works for
Collabora. I don't believe there is any undisclosed conflict of interest.

Chris


Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-21 Thread Chris Sherlock
On 21 Oct 2022, at 11:29 pm, Andreas Mantke  wrote:
> 
> Hi,
> 
> I find it very shameful how much efford the board and it's members with
> a known and possible CoI on this topic invest to not enable further
> contributions and throw away a project which is evaluated important for
> the future of LibreOffice and TDF.
> 
> And this whole topic shows that this board members use other
> contributors and the staff to get their work done. It's a great pity.
> 
> Regards,
> Andreas

I’m not a board member, and I can’t understand why you say that. Stephan is 
correct from what I can see, there aren’t enough significant commits. 

As someone who has made my fair share of insignificant commits, I think I know 
what I’m talking about :-) j/k

Chris



Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-21 Thread Chris Sherlock
On 16 Oct 2022, at 9:03 am, Chris Sherlock  wrote:
> 
> 
> 
> On Sun, Oct 16, 2022 at 2:07 AM Caolán McNamara  <mailto:caol...@redhat.com>> wrote:
> On Sat, 2022-10-15 at 22:13 +1100, Chris Sherlock wrote:
> > So an update… after I shifted to using Liberation Sans as the font
> > face and added gb_CppunitTest_use_more_fonts the only platform that
> > varies is MacOS.
> > 
> > Test name: VclLogicalFontInstanceTest::testglyphboundrect
> > equality assertion failed
> > - Expected: 7x9@(0,-8)
> > - Actual  : 7x10@(0,-8)
> 
> And what if you use a larger font size. say font size 110 instead of
> 11, maybe its a hinting related thing.
> 
> Just tried, looks like it is out by 1. 
> 
> Test name: VclLogicalFontInstanceTest::testglyphboundrect
> equality assertion failed
> - Expected: 51x82@(7,-80)
> - Actual  : 51x83@(7,-80)

I’ve had another look at the code, with some help from Khaled. The issue is the 
way in which we do our final rounding. 

On Freetype, it uses 26.6 fixed point, and thus needs it’s own special FreeType 
ceil and floor functions. CoreText appears to using floating point, but the 
std::ceil and std::floor functions give slight different results. 

I am confused why this might be… does anyone have any ideas?

FWIW, the reasoning for using 26.6 in Freetype can be found here: 
https://lists.nongnu.org/archive/html/freetype/2002-09/msg00076.html 
<https://lists.nongnu.org/archive/html/freetype/2002-09/msg00076.html>

The floor and ceiling functions used are defined here:

https://gitlab.com/freetype/freetype/-/blob/master/include/freetype/internal/ftobjs.h#L91
 
<https://gitlab.com/freetype/freetype/-/blob/master/include/freetype/internal/ftobjs.h#L91>

And the control box function that gets the bounding box is FT_Glyph_Get_CBox(), 
which can be found here:

https://gitlab.com/freetype/freetype/-/blob/master/src/base/ftglyph.c#L733 
<https://gitlab.com/freetype/freetype/-/blob/master/src/base/ftglyph.c#L733>

We basically copied the ceil and floor used in Freetype in an attempt to get 
CoreText as close as possible to FreeType. It’s a pity it is off by 1 in many 
cases… would love it if something with more knowledge than me can see why this 
differs!

I’ve written a utility to get the bounding boxes of all the glyphs of a 
particular font, incidentally. It can be found here:

https://gerrit.libreoffice.org/c/core/+/141526 
<https://gerrit.libreoffice.org/c/core/+/141526>

Chris



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

2022-10-17 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |4 +-
 vcl/source/animate/Animation.cxx  |   52 +++---
 2 files changed, 29 insertions(+), 27 deletions(-)

New commits:
commit 6125be0aa10113d840a1fdbe33cf3174d5896fcb
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:04:14 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 10:28:02 2022 +0200

vcl: extract variable and rename Animation::mnPos to mnFrameIndex

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 249159a36179..b9d9d69e401f 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -92,7 +92,7 @@ public:
 public:
 SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
 SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
-SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; }
+SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnFrameIndex; }
 
 private:
 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
@@ -106,7 +106,7 @@ private:
 Size maGlobalSize;
 sal_uInt32 mnLoopCount;
 sal_uInt32 mnLoops;
-size_t mnPos;
+size_t mnFrameIndex;
 bool mbIsInAnimation;
 bool mbLoopTerminated;
 
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 43583a4a33f5..4ae010c54332 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -37,7 +37,7 @@ Animation::Animation()
 : maTimer("vcl::Animation")
 , mnLoopCount(0)
 , mnLoops(0)
-, mnPos(0)
+, mnFrameIndex(0)
 , mbIsInAnimation(false)
 , mbLoopTerminated(false)
 {
@@ -49,7 +49,7 @@ Animation::Animation(const Animation& rAnimation)
 , maTimer("vcl::Animation")
 , maGlobalSize(rAnimation.maGlobalSize)
 , mnLoopCount(rAnimation.mnLoopCount)
-, mnPos(rAnimation.mnPos)
+, mnFrameIndex(rAnimation.mnFrameIndex)
 , mbIsInAnimation(false)
 , mbLoopTerminated(rAnimation.mbLoopTerminated)
 {
@@ -78,7 +78,7 @@ Animation& Animation::operator=(const Animation& rAnimation)
 maGlobalSize = rAnimation.maGlobalSize;
 maBitmapEx = rAnimation.maBitmapEx;
 mnLoopCount = rAnimation.mnLoopCount;
-mnPos = rAnimation.mnPos;
+mnFrameIndex = rAnimation.mnFrameIndex;
 mbLoopTerminated = rAnimation.mbLoopTerminated;
 mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
 }
@@ -169,7 +169,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 if (!maFrames.empty())
 {
 if ((rOut.GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated
-&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnPos]->mnWait))
+&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnFrameIndex]->mnWait))
 {
 bool differs = true;
 
@@ -197,7 +197,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 {
 maTimer.Stop();
 mbIsInAnimation = false;
-mnPos = 0;
+mnFrameIndex = 0;
 }
 
 if (differs)
@@ -206,7 +206,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 if (!mbIsInAnimation)
 {
-ImplRestartTimer(maFrames[mnPos]->mnWait);
+ImplRestartTimer(maFrames[mnFrameIndex]->mnWait);
 mbIsInAnimation = true;
 }
 }
@@ -247,7 +247,7 @@ void Animation::Draw(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDest
 if (!nCount)
 return;
 
-AnimationFrame* pObj = maFrames[std::min(mnPos, nCount - 1)].get();
+AnimationFrame* pObj = maFrames[std::min(mnFrameIndex, nCount - 1)].get();
 
 if (rOut.GetConnectMetaFile() || (rOut.GetOutDevType() == OUTDEV_PRINTER))
 {
@@ -259,15 +259,15 @@ void Animation::Draw(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDest
 }
 else
 {
-const size_t nOldPos = mnPos;
+const size_t nOldPos = mnFrameIndex;
 if (mbLoopTerminated)
-const_cast(this)->mnPos = nCount - 1;
+const_cast(this)->mnFrameIndex = nCount - 1;
 
 {
 AnimationRenderer{ const_cast(this), , rDestPt, 
rDestSz, 0 };
 }
 
-const_cast(this)->mnPos = nOldPos;
+const_cast(this)->mnFrameIndex = nOldPos;
 }
 }
 
@@ -355,17 +355,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 }
 else
 {
-AnimationFrame* pStepBmp
-= (++mnPos < maFrames.size()) ? maFrames[mnPos].get(

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

2022-10-17 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 +
 vcl/source/animate/Animation.cxx  |   45 --
 2 files changed, 26 insertions(+), 21 deletions(-)

New commits:
commit 12ebfc4f6d7b77cd77ac9028dddf0554df05c91e
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 09:53:07 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 10:27:19 2022 +0200

vcl: extract Animation function PopulateRenderers()

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 2f13052d084b..249159a36179 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -111,6 +111,8 @@ private:
 bool mbLoopTerminated;
 
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
+SAL_DLLPRIVATE void PopulateRenderers();
+
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 8217978d26ef..43583a4a33f5 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -294,6 +294,29 @@ std::vector> 
Animation::CreateAnimationDataItems(
 return aDataItems;
 }
 
+void Animation::PopulateRenderers()
+{
+for (auto& pDataItem : CreateAnimationDataItems())
+{
+AnimationRenderer* pRenderer = nullptr;
+if (!pDataItem->mpRendererData)
+{
+pRenderer = new AnimationRenderer(this, pDataItem->mpRenderContext,
+  pDataItem->maOriginStartPt, 
pDataItem->maStartSize,
+  pDataItem->mnRendererId);
+
+
maRenderers.push_back(std::unique_ptr(pRenderer));
+}
+else
+{
+pRenderer = 
static_cast(pDataItem->mpRendererData);
+}
+
+pRenderer->pause(pDataItem->mbIsPaused);
+pRenderer->setMarked(true);
+}
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -305,27 +328,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 if (maNotifyLink.IsSet())
 {
 maNotifyLink.Call(this);
-
-// set view state from AnimationData structure
-for (auto& pDataItem : CreateAnimationDataItems())
-{
-AnimationRenderer* pRenderer = nullptr;
-if (!pDataItem->mpRendererData)
-{
-pRenderer = new AnimationRenderer(
-this, pDataItem->mpRenderContext, 
pDataItem->maOriginStartPt,
-pDataItem->maStartSize, pDataItem->mnRendererId);
-
-
maRenderers.push_back(std::unique_ptr(pRenderer));
-}
-else
-{
-pRenderer = 
static_cast(pDataItem->mpRendererData);
-}
-
-pRenderer->pause(pDataItem->mbIsPaused);
-pRenderer->setMarked(true);
-}
+PopulateRenderers();
 
 // delete all unmarked views
 auto removeStart


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock
On Sun, Oct 16, 2022 at 2:07 AM Caolán McNamara  wrote:

> On Sat, 2022-10-15 at 22:13 +1100, Chris Sherlock wrote:
> > So an update… after I shifted to using Liberation Sans as the font
> > face and added gb_CppunitTest_use_more_fonts the only platform that
> > varies is MacOS.
> >
> > Test name: VclLogicalFontInstanceTest::testglyphboundrect
> > equality assertion failed
> > - Expected: 7x9@(0,-8)
> > - Actual  : 7x10@(0,-8)
>
> And what if you use a larger font size. say font size 110 instead of
> 11, maybe its a hinting related thing.
>

Just tried, looks like it is out by 1.

Test name: VclLogicalFontInstanceTest::testglyphboundrect
equality assertion failed
- Expected: 51x82@(7,-80)
- Actual  : 51x83@(7,-80)


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock


> On 15 Oct 2022, at 8:12 pm, Chris Sherlock  wrote:
> 
> 
> I've done some testing of LogicalFontInstance::GetGlyphBoundRect(). Each 
> platform seems to give different values!
> 
> The commit in gerrit is: https://gerrit.libreoffice.org/c/core/+/141234

So an update… after I shifted to using Liberation Sans as the font face and 
added gb_CppunitTest_use_more_fonts the only platform that varies is MacOS.

Test name: VclLogicalFontInstanceTest::testglyphboundrect
equality assertion failed
- Expected: 7x9@(0,-8)
- Actual  : 7x10@(0,-8)



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

2022-10-15 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   71 
 1 file changed, 71 insertions(+)

New commits:
commit 5c2e1c894e6d0ef846d3643ef96c56ab548ef0d0
Author: Chris Sherlock 
AuthorDate: Sun Oct 2 18:33:12 2022 +1100
Commit: Noel Grandin 
CommitDate: Sat Oct 15 12:55:43 2022 +0200

vcl: test generating ellipses

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

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 8ec7597e6a65..a450c99ee3df 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -62,6 +62,9 @@ public:
 void testImplLayoutArgsBiDiRtl();
 void testImplLayoutArgsRightAlign();
 void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
+void testGetStringWithCenterEllpsis();
+void testGetStringWithEndEllpsis();
+void testGetStringWithNewsEllpsis();
 void testGetTextBreak();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
@@ -75,6 +78,9 @@ public:
 CPPUNIT_TEST(testImplLayoutArgsBiDiRtl);
 CPPUNIT_TEST(testImplLayoutArgsRightAlign);
 CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
+CPPUNIT_TEST(testGetStringWithCenterEllpsis);
+CPPUNIT_TEST(testGetStringWithEndEllpsis);
+CPPUNIT_TEST(testGetStringWithNewsEllpsis);
 CPPUNIT_TEST(testGetTextBreak);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -576,6 +582,71 @@ void 
VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
 CPPUNIT_ASSERT(!bRTL);
 }
 
+void VclTextTest::testGetStringWithCenterEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d ...v w x y z"),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w x y z", 100,
+  DrawTextFlags::CenterEllipsis));
+}
+
+void VclTextTest::testGetStringWithEndEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 10,
+   
DrawTextFlags::EndEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d e f g h i j ..."),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w x y z", 100,
+  DrawTextFlags::EndEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 1,
+   
DrawTextFlags::EndEllipsis
+   | 
DrawTextFlags::Clip));
+}
+
+void VclTextTest::testGetStringWithNewsEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 10,
+   
DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b  x y z"),
+device->GetEllipsisString(u"a b c d. e f g. h i j k l m n o p q r s t 
u v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b  x y z"),
+device->GetEllipsisString(u"a b c d. e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d e f g h i j ..."),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a. x y z"),
+device->GetEllipsisString(u"a. b c d e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"ab. cde..."),
+device->GetEllipsisString(u"ab. cde. x y z", 50, 
DrawTextFlags::NewsEllipsis));
+}
+
 void VclTextTest::testGetTextBreak()
 {
 ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);


Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock
I've done some testing of LogicalFontInstance::GetGlyphBoundRect(). Each
platform seems to give different values!

The commit in gerrit is: https://gerrit.libreoffice.org/c/core/+/141234

(many thanks to Hossein for some suggestions in a different gerrit patch
about some things around unit tests I didn't know - see comments at
https://gerrit.libreoffice.org/c/core/+/141103/)

Ultimately, the differences boil down to the pure function
LogicalFontInstance::ImplGetGlyphBoundRect(), which each platform must
implement to get the glyph's bounding rect.

To try to understand the differences, I've looked at each platform's
implementation with some notes, if this is at all helpful. Any comments
would be appreciated! I'd love to standardize this function :-)

Chris
---

Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms


WIN32
-

ImplGetGlyphBoundRect() is implemented in WinFontInstance, derived by
from LogicalFontInstance

Located in vcl/win/gdi/salfont.cxx

Process:

Step 1: select the font
---

1. Get the HDC of the current graphics
2. Get the current GDI font's HFONT
3. Get the the HFONT of the font referenced by the WinFontInstance
4. If the current GDI HFONT is not the WinFontInstance's HFONT then
   explicitly select the WinFontInstance's HFONT
5. Setup a guard to restore the original font after
   ImplGetGlyphBoundRect() finishes

Step 2: Setup transformation matrix
---

MAT2 is a 3x3 transformation matrix

If using horizontal text, setup an identity matrix (means that nothing
happens when applying the matrix)

If using vertical writing then matrix appropriately rotates the glyph

Step 3: Setup to get the glyph's bounding rect
--

1. Set the flag for GetGlyphOutlineW to use GGO_METRICS and
   GGO_GLYPH_INDEX

   - GGO_METRICS indicates to retrieve the GLYPHMETRICS structure
   - GGO_GLYPH_INDEX indicates that we use the TrueType glyph index
 instead of the character code

2. Zero initialize the GLYPHMETRICS fields

3. Call on GetGlyphOutlineW using the transformation matrix to
   populate the glyph metrics

Step 4: Get the bounding rect of the glyph
--

The next bit takes the glyph metrics from the previous step.

1. Populate the glyph rectangle with the origin being the x- and y-
   coords of the upper left corner of the smallest rectangle that
   completely encloses the glyph, and the width and height of the
   glyph's "black box", which is the smallest rectangle that
   encloses the glyph

2. Scale the bounding rectangle, adding a point to the right and
   bottom coords of the rectangle

SUMMARY:

Basically, we call on Win32's GetGlyphOutlineW() to get the GLYPHMETRICS.
It is important to quote Microsoft on this structure:

   The GLYPHMETRICS structure specifies the width of the character cell
   and the location of a glyph within the character cell. The origin of
   the character cell is located at the left side of the cell at the
   baseline of the font. The location of the glyph origin is relative to
   the character cell origin. The height of a character cell, the
   baseline, and other metrics global to the font are given by the
   OUTLINETEXTMETRIC structure.

https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getglyphoutlinew


MAC
---

ImplGetGlyphBoundRect() is implemented in CoreTextStyle, derived from
LogicalFontInstance

Located in vcl/quartz/ctfont.cxx

Process:

Step 1: Get the glyph rectangle
---

1. Set the CGGlyph variable nCGGlyph the glyph index
2. Get the font by looking up the mpStyleDict dictionary for the
   kCTFontAttributeName, which gives the font of the text to
   which this attribute applies

Note: Currently does not handle vertical text

3. Get the glyph rectangle in a CGRect by calling on
   CTFontGetBoundingRectsForGlyphs()
4. Apply any font rotation for horizontal text

Step 2: Return the tools::Rectangle bounding rect
-

1. std::floor() the origin x, y (i.e. the top left)
2. std::ceil() the bottom right of the rectangle
   i.e. to get this, aCGRect.origin.x + aCGRect.size.width
 aCGRect.origin.y + aCGRect.size.height

3. so the rectangle gets the positive x origin and a negative y origin (???)
   and for the bottom left a positive x and a negative y (???)

SUMMARY:

Use CTFontGetBoundRectsForGlyphs() to get the bounding rect of
the glyph.

Note that the Core Text documentation says the following:

  The bounding rectangles of the individual glyphs are returned through
  the boundingRects parameter. These are the design metrics from the
  font transformed in font space.

https://developer.apple.com/documentation/coretext/1509419-ctfontgetboundingrectsforglyphs


UNIX


Note there are two variants: Qt and Freetype


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

2022-10-14 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 65b2aa877dd8a9fd42992faf532144d22ae93182
Author: Chris Sherlock 
AuthorDate: Fri Oct 14 04:53:38 2022 +1100
Commit: Miklos Vajna 
CommitDate: Fri Oct 14 08:35:49 2022 +0200

vcl: followup 'vcl: extract function CreateAnimationDataItems'

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

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 5582c3b9a848..8217978d26ef 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -304,10 +304,6 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maNotifyLink.IsSet())
 {
-std::vector> aDataItems;
-for (auto const& i : maRenderers)
-aDataItems.emplace_back(i->createAnimationData());
-
 maNotifyLink.Call(this);
 
 // set view state from AnimationData structure


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

2022-10-12 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 ++
 vcl/source/animate/Animation.cxx  |   15 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 5f88c66b835718c5cc5f07d21825a5ac6880e458
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 09:31:46 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 12 10:11:25 2022 +0200

vcl: extract function CreateAnimationDataItems

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 6c592ba753c1..2f13052d084b 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -28,6 +28,7 @@
 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
 
 class AnimationRenderer;
+struct AnimationData;
 
 class VCL_DLLPUBLIC Animation
 {
@@ -109,6 +110,7 @@ private:
 bool mbIsInAnimation;
 bool mbLoopTerminated;
 
+SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index fb47e9698a3f..5582c3b9a848 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -282,6 +282,18 @@ void Animation::ImplRestartTimer(sal_uLong nTimeout)
 maTimer.Start();
 }
 
+std::vector> 
Animation::CreateAnimationDataItems()
+{
+std::vector> aDataItems;
+
+for (auto const& rItem : maRenderers)
+{
+aDataItems.emplace_back(rItem->createAnimationData());
+}
+
+return aDataItems;
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -293,14 +305,13 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 if (maNotifyLink.IsSet())
 {
 std::vector> aDataItems;
-// create AnimationData-List
 for (auto const& i : maRenderers)
 aDataItems.emplace_back(i->createAnimationData());
 
 maNotifyLink.Call(this);
 
 // set view state from AnimationData structure
-for (auto& pDataItem : aDataItems)
+for (auto& pDataItem : CreateAnimationDataItems())
 {
 AnimationRenderer* pRenderer = nullptr;
 if (!pDataItem->mpRendererData)


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

2022-10-12 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit ff7dd118bdc5d017d2dec28a4e37c3e3a6b97660
Author: Chris Sherlock 
AuthorDate: Wed Jul 20 19:56:51 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 12 10:10:24 2022 +0200

vcl: Animation does not need to be friend of AnimationRenderer

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 0466518dfb1d..f75b88e29541 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -44,9 +44,6 @@ struct AnimationData
 class VCL_DLLPUBLIC AnimationRenderer
 {
 private:
-
-friend class Animation;
-
 Animation*  mpParent;
 VclPtr  mpRenderContext;
 tools::Long mnRendererId;


Re: Minimum system version of ICU

2022-10-10 Thread Chris Sherlock



> On 10 Oct 2022, at 11:56 pm, Stephan Bergmann  wrote:
> 
> On 08/10/2022 19:57, Chris Sherlock wrote:
>> What is the minimum version of ICU that a system must run if the distro 
>> decides not to use our internal ICU?
> 
> At least the relevant configure.ac check appears to be still effectively at 
> <https://git.libreoffice.org/core/+/f20ed8959bc0a984177377a734d34f767653625b%5E!/>
>  "Require icu 4.6 or later with system icu" (however rotten that may be in 
> practice).

Thanks Stephan. Is it maybe time to increase the minimum version from this? 
That was released in 2010!

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

2022-10-09 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 0d463de3adc204af6892cc2b2c2d8a698237fb0c
Author: Chris Sherlock 
AuthorDate: Wed Jul 20 19:53:47 2022 +1000
Commit: Ilmari Lauhakangas 
CommitDate: Sun Oct 9 11:27:36 2022 +0200

vcl: pAnimView to pRenderer (clarify variable name)

Change-Id: I909aa5f3b2dd1c62d4fb1f8eb3ea0f5a2e4d7ed4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136434
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Jenkins

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 9b1165655186..fb47e9698a3f 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -175,8 +175,8 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 auto itAnimView = std::find_if(
 maRenderers.begin(), maRenderers.end(),
-[, nRendererId](const std::unique_ptr& 
pAnimView) -> bool {
-return pAnimView->matches(, nRendererId);
+[, nRendererId](const std::unique_ptr& 
pRenderer) -> bool {
+return pRenderer->matches(, nRendererId);
 });
 
 if (itAnimView != maRenderers.end())
@@ -188,7 +188,9 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 differs = false;
 }
 else
+{
 maRenderers.erase(itAnimView);
+}
 }
 
 if (maRenderers.empty())
@@ -221,8 +223,8 @@ void Animation::Stop(const OutputDevice* pOut, tools::Long 
nRendererId)
 {
 maRenderers.erase(
 std::remove_if(maRenderers.begin(), maRenderers.end(),
-   [=](const std::unique_ptr& 
pAnimView) -> bool {
-   return pAnimView->matches(pOut, nRendererId);
+   [=](const std::unique_ptr& 
pRenderer) -> bool {
+   return pRenderer->matches(pOut, nRendererId);
}),
 maRenderers.end());
 


Minimum system version of ICU

2022-10-08 Thread Chris Sherlock
Hey all,What is the minimum version of ICU that a system must run if the distro decides not to use our internal ICU?I ask because in 2019 we added some checks for ICU < 63 here:libreoffice/core - main, development code repositorycgit.freedesktop.orgIf we require ICU >= 63 then we could scrap the code :-)ChrisSent from my iPhone

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

2022-10-07 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   26 ++
 1 file changed, 26 insertions(+)

New commits:
commit 0cf173ff4a53618e6ddd40a278f375680d92a71f
Author: Chris Sherlock 
AuthorDate: Tue Sep 27 05:37:47 2022 +1000
Commit: Michael Stahl 
CommitDate: Fri Oct 7 10:42:05 2022 +0200

vcl: test OutputDevice::GetTextBreak()

Change-Id: I1618d268ca7495d4aae1bde1a43be6bcf8811869
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140630
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index d233fa9d9aa3..8ec7597e6a65 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -62,6 +62,7 @@ public:
 void testImplLayoutArgsBiDiRtl();
 void testImplLayoutArgsRightAlign();
 void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
+void testGetTextBreak();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
 CPPUNIT_TEST(testSimpleText);
@@ -74,6 +75,7 @@ public:
 CPPUNIT_TEST(testImplLayoutArgsBiDiRtl);
 CPPUNIT_TEST(testImplLayoutArgsRightAlign);
 CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
+CPPUNIT_TEST(testGetTextBreak);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -574,6 +576,30 @@ void 
VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
 CPPUNIT_ASSERT(!bRTL);
 }
 
+void VclTextTest::testGetTextBreak()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+const OUString sTestStr(u"textline_ text_");
+const auto nLen = sTestStr.getLength();
+const auto nTextWidth = device->GetTextWidth("text");
+
+CPPUNIT_ASSERT_EQUAL(static_cast(4),
+ device->GetTextBreak(sTestStr, nTextWidth, 0, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(7),
+ device->GetTextBreak(sTestStr, nTextWidth, 3, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(9),
+ device->GetTextBreak(sTestStr, nTextWidth, 6, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(12),
+ device->GetTextBreak(sTestStr, nTextWidth, 8, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(14),
+ device->GetTextBreak(sTestStr, nTextWidth, 11, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(-1),
+ device->GetTextBreak(sTestStr, nTextWidth, 13, nLen));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclTextTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: unotools/CppunitTest_unotools_fontcvt.mk unotools/Module_unotools.mk unotools/qa

2022-10-05 Thread Chris Sherlock (via logerrit)
 unotools/CppunitTest_unotools_fontcvt.mk |   30 
 unotools/Module_unotools.mk  |1 
 unotools/qa/unit/testRecodeString.cxx|   45 +++
 3 files changed, 76 insertions(+)

New commits:
commit 379ea0bb9e4836b212e004fd93abfc8067ec8929
Author: Chris Sherlock 
AuthorDate: Tue Oct 4 19:56:52 2022 +1100
Commit: Michael Stahl 
CommitDate: Wed Oct 5 11:18:36 2022 +0200

unotools: test ConvertChar::RecodeString()

Change-Id: I1f82afe7e1ac57004723f67412f1a7007d107eff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140938
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/unotools/CppunitTest_unotools_fontcvt.mk 
b/unotools/CppunitTest_unotools_fontcvt.mk
new file mode 100644
index ..16236c16c5d1
--- /dev/null
+++ b/unotools/CppunitTest_unotools_fontcvt.mk
@@ -0,0 +1,30 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,unotools_fontcvt))
+
+$(eval $(call gb_CppunitTest_use_external,unotools_fontcvt,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,unotools_fontcvt))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,unotools_fontcvt, \
+unotools/qa/unit/testRecodeString \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,unotools_fontcvt, \
+   comphelper \
+   cppu \
+   cppuhelper \
+   tl \
+   sal \
+   svt \
+   utl \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/unotools/Module_unotools.mk b/unotools/Module_unotools.mk
index e069960530c3..d2e13a8520d8 100644
--- a/unotools/Module_unotools.mk
+++ b/unotools/Module_unotools.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,unotools,\
 $(eval $(call gb_Module_add_check_targets,unotools,\
 CppunitTest_unotools_configpaths \
 CppunitTest_unotools_fontdefs \
+CppunitTest_unotools_fontcvt \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/unotools/qa/unit/testRecodeString.cxx 
b/unotools/qa/unit/testRecodeString.cxx
new file mode 100644
index ..31e26257b96f
--- /dev/null
+++ b/unotools/qa/unit/testRecodeString.cxx
@@ -0,0 +1,45 @@
+/* -*- 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/.
+ *
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+class Test : public CppUnit::TestFixture
+{
+public:
+void testRecodeString();
+
+CPPUNIT_TEST_SUITE(Test);
+CPPUNIT_TEST(testRecodeString);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testRecodeString()
+{
+// note, the below won't work with mergelibs as the class is not visible to 
the linker
+#if !ENABLE_MERGELIBS
+ConvertChar const* pConversion = ConvertChar::GetRecodeData(u"starbats", 
u"opensymbol");
+OUString aStr(u"u");
+pConversion->RecodeString(aStr, 0, 1);
+CPPUNIT_ASSERT_EQUAL(OUString(u""), aStr);
+#endif
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: basctl/inc chart2/inc comphelper/inc cui/inc drawinglayer/source editeng/inc include/vcl reportdesign/inc sc/inc sd/inc sd/source slideshow/inc slideshow/source svtools

2022-09-16 Thread Chris Sherlock (via logerrit)
 basctl/inc/pch/precompiled_basctl.hxx|4 
 chart2/inc/pch/precompiled_chartcontroller.hxx   |4 
 comphelper/inc/pch/precompiled_comphelper.hxx|   28 +++-
 cui/inc/pch/precompiled_cui.hxx  |4 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   32 ++---
 editeng/inc/pch/precompiled_editeng.hxx  |   52 +++-
 include/vcl/animate/Animation.hxx|   12 -
 include/vcl/animate/AnimationFrame.hxx   |   29 ++--
 reportdesign/inc/pch/precompiled_rpt.hxx |   25 ++-
 reportdesign/inc/pch/precompiled_rptui.hxx   |4 
 sc/inc/pch/precompiled_sc.hxx|6 
 sd/inc/pch/precompiled_sdui.hxx  |4 
 sd/source/ui/dlg/animobjs.cxx|   22 +--
 slideshow/inc/pch/precompiled_slideshow.hxx  |   49 +++
 slideshow/source/engine/shapes/gdimtftools.cxx   |   32 ++---
 svtools/inc/pch/precompiled_svt.hxx  |   62 ++---
 svx/inc/pch/precompiled_svxcore.hxx  |5 
 svx/source/dialog/_bmpmask.cxx   |   12 -
 svx/source/dialog/_contdlg.cxx   |2 
 svx/source/xoutdev/_xoutbmp.cxx  |   14 +-
 sw/inc/pch/precompiled_msword.hxx|   54 +---
 sw/inc/pch/precompiled_swui.hxx  |7 -
 vcl/Library_vcl.mk   |2 
 vcl/inc/animate/AnimationRenderer.hxx|6 
 vcl/qa/cppunit/animation.cxx |   12 -
 vcl/qa/cppunit/animationrenderer.cxx |   12 -
 vcl/source/animate/Animation.cxx |   70 +--
 vcl/source/animate/AnimationFrame.cxx|4 
 vcl/source/animate/AnimationRenderer.cxx |   20 +--
 vcl/source/bitmap/bitmapfilter.cxx   |2 
 vcl/source/filter/egif/egif.cxx  |6 
 vcl/source/filter/etiff/etiff.cxx|6 
 vcl/source/filter/igif/gifread.cxx   |   28 ++--
 vcl/source/filter/itiff/itiff.cxx|4 
 vcl/source/graphic/GraphicObject.cxx |   18 +-
 35 files changed, 347 insertions(+), 306 deletions(-)

New commits:
commit a2aaa6b77457041e08610eb4bced2d050ea7fa4f
Author: Chris Sherlock 
AuthorDate: Tue Jul 19 21:22:23 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 16 10:08:43 2022 +0200

vcl: AnimationBitmap -> AnimationFrame

The emphasis is not quite right. An animation is made up a sequence of
*frames*, not bitmaps. A frame includes such things as position, size,
timeout till the next frame *as well as* a bitmap.

Note: had to regenerate a bunch of precompiled headers

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

diff --git a/basctl/inc/pch/precompiled_basctl.hxx 
b/basctl/inc/pch/precompiled_basctl.hxx
index 248e8b7cbcaa..a92d3a0870f5 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-08-08 12:07:41 using:
+ Generated on 2022-08-13 18:00:51 using:
  ./bin/update_pch basctl basctl --cutoff=3 --exclude:system --include:module 
--exclude:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -110,7 +110,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx 
b/chart2/inc/pch/precompiled_chartcontroller.hxx
index 5a1c5bb77f2f..b87950ae5bf1 100644
--- a/chart2/inc/pch/precompiled_chartcontroller.hxx
+++ b/chart2/inc/pch/precompiled_chartcontroller.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-06-27 18:58:36 using:
+ Generated on 2022-08-13 18:00:53 using:
  ./bin/update_pch chart2 chartcontroller --cutoff=6 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -102,7 +102,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/comphelper/inc/pch/precompiled_comphelper.hxx 
b/comphelper/inc/

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

2022-09-12 Thread Chris Sherlock (via logerrit)
 ucbhelper/source/client/activedatasink.cxx   |5 -
 ucbhelper/source/client/activedatastreamer.cxx   |5 -
 ucbhelper/source/client/commandenvironment.cxx   |7 ---
 ucbhelper/source/provider/cancelcommandexecution.cxx |6 --
 ucbhelper/source/provider/contentidentifier.cxx  |   10 --
 ucbhelper/source/provider/contentinfo.cxx|5 -
 ucbhelper/source/provider/interactionrequest.cxx |6 --
 ucbhelper/source/provider/propertyvalueset.cxx   |7 ---
 ucbhelper/source/provider/registerucb.cxx|4 
 ucbhelper/source/provider/resultset.cxx  |6 --
 ucbhelper/source/provider/resultsethelper.cxx|7 ++-
 ucbhelper/source/provider/resultsetmetadata.cxx  |7 ---
 12 files changed, 2 insertions(+), 73 deletions(-)

New commits:
commit 247bbdf7e071344564af70743eeb5e30f4113601
Author: Chris Sherlock 
AuthorDate: Sun Sep 11 18:49:48 2022 +1000
Commit: Julien Nabet 
CommitDate: Mon Sep 12 18:49:28 2022 +0200

ucb: remove unnecessary comments

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

diff --git a/ucbhelper/source/client/activedatasink.cxx 
b/ucbhelper/source/client/activedatasink.cxx
index fdbcbdccb977..96e75f565bee 100644
--- a/ucbhelper/source/client/activedatasink.cxx
+++ b/ucbhelper/source/client/activedatasink.cxx
@@ -17,11 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-/**
-TODO
- **
-
- */
 #include 
 
 using namespace com::sun::star;
diff --git a/ucbhelper/source/client/activedatastreamer.cxx 
b/ucbhelper/source/client/activedatastreamer.cxx
index 8438cae49f53..fe6be13536d2 100644
--- a/ucbhelper/source/client/activedatastreamer.cxx
+++ b/ucbhelper/source/client/activedatastreamer.cxx
@@ -17,11 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-/**
-TODO
- **
-
- */
 #include "activedatastreamer.hxx"
 
 using namespace com::sun::star;
diff --git a/ucbhelper/source/client/commandenvironment.cxx 
b/ucbhelper/source/client/commandenvironment.cxx
index 13bc254e029e..37956b2c468f 100644
--- a/ucbhelper/source/client/commandenvironment.cxx
+++ b/ucbhelper/source/client/commandenvironment.cxx
@@ -17,13 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
-
 #include 
 #include 
 
diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx 
b/ucbhelper/source/provider/cancelcommandexecution.cxx
index 90c0168c6508..42850c5ee306 100644
--- a/ucbhelper/source/provider/cancelcommandexecution.cxx
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -17,12 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
 #include 
 #include 
 #include 
diff --git a/ucbhelper/source/provider/contentidentifier.cxx 
b/ucbhelper/source/provider/contentidentifier.cxx
index d4c13b2c0144..2a5da953d99c 100644
--- a/ucbhelper/source/provider/contentidentifier.cxx
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -17,12 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
 #include 
 
 using namespace com::sun::star::uno;
@@ -33,10 +27,6 @@ using namespace com::sun::star::ucb;
 namespace ucbhelper
 {
 
-
-// struct ContentIdentifier_Impl.
-
-
 struct ContentIdentifier_Impl
 {
 OUString  m_aContentId;
diff --git a/ucbhelper/source/provider/contentinfo.cxx 
b/ucbhelper/source/provider/contentinfo.cxx
index 561a80e77e1c..1e513604eb19 100644
--- a

[Libreoffice-commits] core.git: include/vcl solenv/clang-format vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source

2022-09-07 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|2 
 solenv/clang-format/excludelist   |1 
 vcl/Library_vcl.mk|1 
 vcl/inc/font/EmphasisMark.hxx |   45 +
 vcl/qa/cppunit/font.cxx   |   71 ++
 vcl/source/font/EmphasisMark.cxx  |  174 +++
 vcl/source/gdi/pdfwriter_impl.cxx |   45 +++--
 vcl/source/outdev/font.cxx|  188 ++
 8 files changed, 319 insertions(+), 208 deletions(-)

New commits:
commit 5791c779635b5d42de3c5691bdbadf4a079e096e
Author: Chris Sherlock 
AuthorDate: Sat Aug 13 17:20:32 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Sep 7 15:26:55 2022 +0200

vcl: convert ImplGetEmphasisMark() to EmphasisMark class

It makes more sense for an emphasis mark to be an object that can be
queried, than it is for it to be a function with lots of output
parameters.

I have added a unit test, note that for now something doesn't seem right
with polypolygon equality checks (test fails, but the disc is generated
the same way) so not testing the shape creation.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 1162ef3c116e..66cd10f2a53f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1133,8 +1133,6 @@ public:
 
 bool GetFontFeatures(std::vector& rFontFeatures) const;
 
-SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& 
rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
- tools::Long& rYOff, 
tools::Long& rWidth, FontEmphasisMark eEmphasis, tools::Long nHeight );
 boolGetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex,
 int nLen, std::vector< 
tools::Rectangle >& rVector ) const;
 
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 4802408e4117..d1239f3a09fa 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14808,6 +14808,7 @@ vcl/source/filter/wmf/wmf.cxx
 vcl/source/filter/wmf/wmfwr.cxx
 vcl/source/filter/wmf/wmfwr.hxx
 vcl/source/font/DirectFontSubstitution.cxx
+vcl/source/font/EmphasisMark.cxx
 vcl/source/font/FontSelectPattern.cxx
 vcl/source/font/PhysicalFontCollection.cxx
 vcl/source/font/PhysicalFontFamily.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index b4135d502b2e..10907d6c420c 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -476,6 +476,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/webp/reader \
 vcl/source/filter/webp/writer \
 vcl/source/font/DirectFontSubstitution \
+vcl/source/font/EmphasisMark \
 vcl/source/font/Feature \
 vcl/source/font/FeatureCollector \
 vcl/source/font/FeatureParser \
diff --git a/vcl/inc/font/EmphasisMark.hxx b/vcl/inc/font/EmphasisMark.hxx
new file mode 100644
index ..5e902da26294
--- /dev/null
+++ b/vcl/inc/font/EmphasisMark.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+namespace vcl::font
+{
+class VCL_DLLPUBLIC EmphasisMark
+{
+public:
+EmphasisMark(FontEmphasisMark eEmphasis, tools::Long nHeight, sal_Int32 
nDPIY);
+
+tools::PolyPolygon GetShape() const { return maPolyPoly; }
+bool IsShapePolyLine() const { return mbIsPolyLine; }
+tools::Rectangle GetRect1() const { return maRect1; }
+tools::Rectangle GetRect2() const { return maRect2; }
+tools::Long GetYOffset() const { return mnYOff; }
+tools::Long GetWidth() const { return mnWidth; }
+
+private:
+tools::PolyPolygon maPolyPoly;
+bool mbIsPolyLine;
+tools::Rectangle maRect1;
+tools::Rectangle maRect2;
+tools::Long mnYOff;
+tools::Long mnWidth;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index 8023de9d6f07..d989b01cb051 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -12,6 +12,8 @@
 
 #include 
 
+#include 
+
 class VclFontTest : public test::BootstrapFixture
 {
 public:
@@ -27,6 +29,11 @@ public:
 void testSymbolFlagAndCharSet();
 void testEmphasisMarkShou

[Libreoffice-commits] core.git: 2 commits - accessibility/source dbaccess/source include/vcl sfx2/source vcl/Library_vcl.mk vcl/qa vcl/source

2022-08-25 Thread Chris Sherlock (via logerrit)
 accessibility/source/standard/accessiblemenuitemcomponent.cxx |5 
 accessibility/source/standard/vclxaccessibleedit.cxx  |3 
 accessibility/source/standard/vclxaccessibletabpage.cxx   |3 
 accessibility/source/standard/vclxaccessibletextcomponent.cxx |5 
 dbaccess/source/ui/misc/datasourceconnector.cxx   |3 
 include/vcl/mnemonic.hxx  |2 
 include/vcl/outdev.hxx|5 
 include/vcl/window.hxx|2 
 sfx2/source/control/thumbnailviewitem.cxx |3 
 vcl/Library_vcl.mk|1 
 vcl/qa/cppunit/mnemonic.cxx   |   70 ++
 vcl/source/control/ctrl.cxx   |5 
 vcl/source/control/tabctrl.cxx|3 
 vcl/source/gdi/pdfwriter_impl.cxx |3 
 vcl/source/outdev/text.cxx|   46 --
 vcl/source/text/mnemonic.cxx  |   53 +++
 vcl/source/window/accessibility.cxx   |3 
 vcl/source/window/menu.cxx|3 
 vcl/source/window/menuitemlist.cxx|4 
 19 files changed, 160 insertions(+), 62 deletions(-)

New commits:
commit 83e53d664f3c4a476e6e855119b019a2ae691a7c
Author: Chris Sherlock 
AuthorDate: Tue Aug 23 22:25:28 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 25 13:05:39 2022 +0200

vcl: test removeMnemonicsFromString()

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

diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index 5a2131da2e3b..fc95fc527068 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -24,9 +24,23 @@ public:
 }
 
 void testMnemonic();
+void testRemoveMnemonicFromString();
+void testRemoveDoubleMarkedMnemonicFromString();
+void testRemoveMultipleMnemonicsFromString();
+void testRemoveDoubleMarkingsThenMnemonicFromString();
+void testRemoveMnemonicThenDoubleMarkingsFromString();
+void testRemoveMnemonicFromEndOfString();
+void testRemoveNoMnemonicFromString();
 
 CPPUNIT_TEST_SUITE(VclMnemonicTest);
 CPPUNIT_TEST(testMnemonic);
+CPPUNIT_TEST(testRemoveMnemonicFromString);
+CPPUNIT_TEST(testRemoveDoubleMarkedMnemonicFromString);
+CPPUNIT_TEST(testRemoveMultipleMnemonicsFromString);
+CPPUNIT_TEST(testRemoveDoubleMarkingsThenMnemonicFromString);
+CPPUNIT_TEST(testRemoveMnemonicThenDoubleMarkingsFromString);
+CPPUNIT_TEST(testRemoveMnemonicFromEndOfString);
+CPPUNIT_TEST(testRemoveNoMnemonicFromString);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -54,6 +68,62 @@ void VclMnemonicTest::testMnemonic()
 }
 }
 
+void VclMnemonicTest::testRemoveMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this is a ~test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(10), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveDoubleMarkedMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this ~~is a test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this ~is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(-1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMultipleMnemonicsFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~his is a ~test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveDoubleMarkingsThenMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~~his is a 
~test", nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("t~his is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(11), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMnemonicThenDoubleMarkingsFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~his is a 
~~test", nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a ~test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMnemonicFromEndOfString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this

[Libreoffice-commits] core.git: 2 commits - editeng/source emfio/source filter/source formula/source include/tools sc/source sd/source svtools/source svx/source toolkit/source tools/qa tools/source vc

2022-08-24 Thread Chris Sherlock (via logerrit)
 editeng/source/editeng/editview.cxx  |2 
 editeng/source/editeng/impedit2.cxx  |4 
 editeng/source/editeng/impedit3.cxx  |6 
 emfio/source/reader/emfreader.cxx|2 
 emfio/source/reader/wmfreader.cxx|8 
 filter/source/msfilter/eschesdo.cxx  |2 
 formula/source/ui/dlg/formula.cxx|4 
 include/tools/gen.hxx|   14 -
 sc/source/core/data/drwlayer.cxx |2 
 sc/source/core/data/postit.cxx   |2 
 sc/source/core/tool/detfunc.cxx  |8 
 sc/source/filter/excel/xichart.cxx   |2 
 sc/source/ui/condformat/condformatdlg.cxx|2 
 sc/source/ui/miscdlgs/optsolver.cxx  |2 
 sc/source/ui/miscdlgs/simpref.cxx|2 
 sc/source/ui/pagedlg/areasdlg.cxx|2 
 sc/source/ui/view/gridwin4.cxx   |4 
 sc/source/ui/view/output2.cxx|4 
 sd/source/filter/eppt/epptso.cxx |2 
 sd/source/ui/func/fuzoom.cxx |2 
 sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx |2 
 svtools/source/brwbox/brwbox2.cxx|2 
 svx/source/customshapes/EnhancedCustomShape2d.cxx|6 
 svx/source/dialog/contwnd.cxx|2 
 svx/source/engine3d/scene3d.cxx  |6 
 svx/source/svdraw/svdmrkv.cxx|8 
 svx/source/svdraw/svdoashp.cxx   |2 
 svx/source/svdraw/svdobj.cxx |   14 -
 svx/source/svdraw/svdocirc.cxx   |4 
 svx/source/svdraw/svdomeas.cxx   |2 
 svx/source/svdraw/svdopath.cxx   |2 
 svx/source/svdraw/svdorect.cxx   |2 
 svx/source/svdraw/svdotext.cxx   |2 
 svx/source/svdraw/svdotxdr.cxx   |4 
 svx/source/svdraw/svdotxtr.cxx   |2 
 svx/source/svdraw/svdtrans.cxx   |2 
 svx/source/table/svdotable.cxx   |4 
 toolkit/source/hatchwindow/ipwin.cxx |4 
 tools/qa/cppunit/test_rectangle.cxx  |   98 +++
 tools/source/generic/gen.cxx |8 
 tools/source/generic/poly.cxx|6 
 vcl/source/bitmap/BitmapEx.cxx   |2 
 vcl/source/bitmap/bitmappaint.cxx|2 
 vcl/source/control/edit.cxx  |   22 +-
 vcl/source/control/field.cxx |2 
 vcl/source/control/field2.cxx|   14 -
 vcl/source/control/fmtfield.cxx  |4 
 vcl/source/control/imivctl1.cxx  |6 
 vcl/source/control/scrbar.cxx|6 
 vcl/source/control/slider.cxx|2 
 vcl/source/control/spinbtn.cxx   |2 
 vcl/source/gdi/gdimtf.cxx|2 
 vcl/source/gdi/gradient.cxx  |2 
 vcl/source/gdi/metaact.cxx   |2 
 vcl/source/gdi/print.cxx |4 
 vcl/source/outdev/eps.cxx|2 
 vcl/source/outdev/gradient.cxx   |2 
 vcl/source/outdev/rect.cxx   |4 
 vcl/source/outdev/transparent.cxx|2 
 vcl/source/outdev/wallpaper.cxx  |   10 -
 vcl/source/window/window2.cxx|2 
 vcl/source/window/winproc.cxx|2 
 vcl/unx/generic/window/salframe.cxx  |2 
 63 files changed, 227 insertions(+), 129 deletions(-)

New commits:
commit 6c0bb0f9b846b3f1fee3ff07fb67409708449e0a
Author: Chris Sherlock 
AuthorDate: Tue Aug 23 19:30:02 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 24 10:55:29 2022 +0200

tools: test Rectangle::Normalize()

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

diff --git a/tools/qa/cppunit/test_rectangle.cxx 
b/tools/qa/cppunit/test_rectangle.cxx

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

2022-08-23 Thread Chris Sherlock (via logerrit)
 include/vcl/font.hxx  |1 +
 include/vcl/outdev.hxx|3 ---
 vcl/qa/cppunit/font.cxx   |   24 
 vcl/source/font/font.cxx  |   30 ++
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 vcl/source/outdev/font.cxx|   30 ++
 6 files changed, 58 insertions(+), 32 deletions(-)

New commits:
commit fe2fcbf0e564e2b0d8f3dbec326d3423bc5fbcf5
Author: Chris Sherlock 
AuthorDate: Thu Aug 11 21:46:56 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 23 08:30:39 2022 +0200

vcl: move ImplEmphasisMarkStyle() to vcl::Font and add unit test

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

diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 824d5c0666c4..b371990ba11c 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -70,6 +70,7 @@ public:
 FontWidth   GetWidthType() const;
 TextAlign   GetAlignment() const;
 rtl_TextEncodingGetCharSet() const;
+FontEmphasisMarkGetEmphasisMarkStyle() const;
 
 boolIsSymbolFont() const;
 
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 9cef5f435aaf..5dab75f230d4 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1145,9 +1145,6 @@ public:
 
 SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& 
rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
  tools::Long& rYOff, 
tools::Long& rWidth, FontEmphasisMark eEmphasis, tools::Long nHeight );
-SAL_DLLPRIVATE static FontEmphasisMark
-ImplGetEmphasisMarkStyle( const vcl::Font& 
rFont );
-
 boolGetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex,
 int nLen, std::vector< 
tools::Rectangle >& rVector ) const;
 
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index e99bf12a5124..8023de9d6f07 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -25,6 +25,8 @@ public:
 void testAlignment();
 void testQuality();
 void testSymbolFlagAndCharSet();
+void testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese();
+void testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese();
 
 CPPUNIT_TEST_SUITE(VclFontTest);
 CPPUNIT_TEST(testName);
@@ -35,6 +37,8 @@ public:
 CPPUNIT_TEST(testAlignment);
 CPPUNIT_TEST(testQuality);
 CPPUNIT_TEST(testSymbolFlagAndCharSet);
+CPPUNIT_TEST(testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese);
+CPPUNIT_TEST(testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -154,6 +158,26 @@ void VclFontTest::testSymbolFlagAndCharSet()
 RTL_TEXTENCODING_UNICODE, aFont.GetCharSet() );
 }
 
+void VclFontTest::testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese()
+{
+vcl::Font aFont;
+aFont.SetLanguage(LANGUAGE_CHINESE_SIMPLIFIED);
+aFont.SetEmphasisMark(FontEmphasisMark::Accent);
+
+CPPUNIT_ASSERT_MESSAGE("Emphasis not positioned below", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::PosBelow));
+CPPUNIT_ASSERT_MESSAGE("Accent mark not kept", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::Accent));
+}
+
+void VclFontTest::testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese()
+{
+vcl::Font aFont;
+aFont.SetLanguage(LANGUAGE_ENGLISH);
+aFont.SetEmphasisMark(FontEmphasisMark::Accent);
+
+CPPUNIT_ASSERT_MESSAGE("Emphasis not positioned above", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::PosAbove));
+CPPUNIT_ASSERT_MESSAGE("Accent mark not kept", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::Accent));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclFontTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 7aff5af1f7f8..941fe3d6fc0a 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -324,6 +325,35 @@ Font& Font::operator=( vcl::Font&& rFont ) noexcept
 return *this;
 }
 
+FontEmphasisMark Font::GetEmphasisMarkStyle() const
+{
+FontEmphasisMark nEmphasisMark = GetEmphasisMark();
+
+// If no Position is set, then calculate the default position, which
+// depends on the language
+if (!(nEmphasisMark & (FontEmphasisMark::PosAbove | 
FontEmphasisMark::PosBelow)))
+{
+LanguageType eLang = GetLanguage();
+// In Chinese Simplified the EmphasisMarks are below/left
+if (MsLangId::isS

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

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |   79 -
 1 file changed, 40 insertions(+), 39 deletions(-)

New commits:
commit 44f64ca9e71bd15e385ac40bf4e726472b107f70
Author: Chris Sherlock 
AuthorDate: Sat Jul 30 22:15:59 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 13:00:59 2022 +0200

vcl: make mapping functions private in OutputDevice

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index af55ebd3d614..9cef5f435aaf 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1710,34 +1710,6 @@ public:
 SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel( 
tools::Long nWidth ) const;
 SAL_DLLPRIVATE double  
ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const;
 
-SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long 
nWidth ) const;
-
-/** Convert a logical X coordinate to a device pixel's X coordinate.
-
- To get the device's X coordinate, it must calculate the mapping offset
- coordinate X position (if there is one - if not then it just adds
- the pseudo-window offset to the logical X coordinate), the X-DPI of
- the device and the mapping's X scaling factor.
-
- @param nX  Logical X coordinate
-
- @returns Device's X pixel coordinate
- */
-SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
-
-/** Convert a logical Y coordinate to a device pixel's Y coordinate.
-
- To get the device's Y coordinate, it must calculate the mapping offset
- coordinate Y position (if there is one - if not then it just adds
- the pseudo-window offset to the logical Y coordinate), the Y-DPI of
- the device and the mapping's Y scaling factor.
-
- @param nY  Logical Y coordinate
-
- @returns Device's Y pixel coordinate
- */
-SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel( tools::Long nY 
) const;
-
 /** Convert a logical height to a height in units of device pixels.
 
  To get the number of device pixels, it must calculate the Y-DPI of the 
device and
@@ -1772,17 +1744,6 @@ public:
  */
 SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicHeight( 
tools::Long nHeight ) const;
 
-/** Convert logical height to device pixels, with exact sub-pixel value.
-
- To get the \em exact pixel height, it must calculate the Y-DPI of the 
device and the
- map scaling factor.
-
- @param fLogicHeight Exact height in logical units.
-
- @returns Exact height in pixels - returns as a float to provide for 
subpixel value.
- */
-SAL_DLLPRIVATE floatImplFloatLogicHeightToDevicePixel( float 
fLogicHeight ) const;
-
 /** Convert a logical size to the size on the physical device.
 
  @param rLogicSize  Const reference to a size in logical units
@@ -1850,6 +1811,46 @@ public:
  @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
  */
 SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
+
+private:
+SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long 
nWidth ) const;
+
+/** Convert a logical X coordinate to a device pixel's X coordinate.
+
+ To get the device's X coordinate, it must calculate the mapping offset
+ coordinate X position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical X coordinate), the X-DPI of
+ the device and the mapping's X scaling factor.
+
+ @param nX  Logical X coordinate
+
+ @returns Device's X pixel coordinate
+ */
+SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
+
+/** Convert a logical Y coordinate to a device pixel's Y coordinate.
+
+ To get the device's Y coordinate, it must calculate the mapping offset
+ coordinate Y position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical Y coordinate), the Y-DPI of
+ the device and the mapping's Y scaling factor.
+
+ @param nY  Logical Y coordinate
+
+ @returns Device's Y pixel coordinate
+ */
+SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel( tools::Long nY 
) const;
+
+/** Convert logical height to device pixels, with exact sub-pixel value.
+
+ To get the \em exact pixel height, it must calculate the Y-DPI of the 
device and the
+ map scaling factor.
+
+ @param fLogicHeight Exact height in logical units.
+
+ @returns Exact height in pixels - returns as a float to provide for 
subpixel value.
+ */
+SAL_DLLPRIVATE floatImplFloatLogicHeightToDevicePixel( float 
fLogicHeight ) const;
 ///@}
 
 


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

2022-08-19 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|   12 ++--
 vcl/source/animate/Animation.cxx |   16 
 vcl/source/animate/AnimationRenderer.cxx |   10 +-
 3 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit c61d9e70b1bf4948408392217b9fbed9a2dc5ab1
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:28:21 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:20:55 2022 +0200

vcl: rename AnimationData fields to more sane names

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 95de08014a21..bd4bdc61019e 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -30,12 +30,12 @@ struct AnimationBitmap;
 
 struct AnimationData
 {
-Point   aStartOrg;
-SizeaStartSize;
-VclPtr   pOutDev;
-void*   pRendererData;
-tools::Long nRendererId;
-boolmbIsPaused;
+Point maOriginStartPt;
+Size maStartSize;
+VclPtr mpRenderContext;
+void* mpRendererData;
+tools::Long mnRendererId;
+bool mbIsPaused;
 
 AnimationData();
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 831532d5977a..baa9c186023d 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -301,17 +301,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 for (auto& pDataItem : aDataItems)
 {
 AnimationRenderer* pRenderer = nullptr;
-if (!pDataItem->pRendererData)
+if (!pDataItem->mpRendererData)
 {
-pRenderer
-= new AnimationRenderer(this, pDataItem->pOutDev, 
pDataItem->aStartOrg,
-pDataItem->aStartSize, 
pDataItem->nRendererId);
+pRenderer = new AnimationRenderer(
+this, pDataItem->mpRenderContext, 
pDataItem->maOriginStartPt,
+pDataItem->maStartSize, pDataItem->mnRendererId);
 
 
maRenderers.push_back(std::unique_ptr(pRenderer));
 }
 else
 {
-pRenderer = 
static_cast(pDataItem->pRendererData);
+pRenderer = 
static_cast(pDataItem->mpRendererData);
 }
 
 pRenderer->pause(pDataItem->mbIsPaused);
@@ -682,9 +682,9 @@ SvStream& ReadAnimation(SvStream& rIStm, Animation& 
rAnimation)
 }
 
 AnimationData::AnimationData()
-: pOutDev(nullptr)
-, pRendererData(nullptr)
-, nRendererId(0)
+: mpRenderContext(nullptr)
+, mpRendererData(nullptr)
+, mnRendererId(0)
 , mbIsPaused(false)
 {
 }
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 9bb5efc38ae9..21b43c3c08d6 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -311,11 +311,11 @@ AnimationData* AnimationRenderer::createAnimationData() 
const
 {
 AnimationData* pDataItem = new AnimationData;
 
-pDataItem->aStartOrg = maOriginPt;
-pDataItem->aStartSize = maLogicalSize;
-pDataItem->pOutDev = mpRenderContext;
-pDataItem->pRendererData = const_cast(this);
-pDataItem->nRendererId = mnRendererId;
+pDataItem->maOriginStartPt = maOriginPt;
+pDataItem->maStartSize = maLogicalSize;
+pDataItem->mpRenderContext = mpRenderContext;
+pDataItem->mpRendererData = const_cast(this);
+pDataItem->mnRendererId = mnRendererId;
 pDataItem->mbIsPaused = mbIsPaused;
 
 return pDataItem;


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

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit f57a7b374e0f2d878cee1fa020af3323145b56a8
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:55:34 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:19:48 2022 +0200

tools: use std::swap() in gen.hxx

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

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 8182676e0731..ea2c8de2c0e7 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -377,11 +377,7 @@ inline bool Range::Contains( tools::Long nIs ) const
 inline void Range::Justify()
 {
 if ( mnA > mnB )
-{
-tools::Long nHelp = mnA;
-mnA = mnB;
-mnB = nHelp;
-}
+std::swap(mnA, mnB);
 }
 
 inline bool operator ==(Range const & r1, Range const & r2)
@@ -444,11 +440,7 @@ inline bool Selection::Contains( tools::Long nIs ) const
 inline void Selection::Justify()
 {
 if ( mnA > mnB )
-{
-tools::Long nHelp = mnA;
-mnA = mnB;
-mnB = nHelp;
-}
+std::swap(mnA, mnB);
 }
 
 inline bool operator ==(Selection const & s1, Selection const & s2)


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

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/svl/rectitem.hxx  |4 +--
 svl/source/items/rectitem.cxx |   44 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit e1ab83cbc47ff581dd826d757dd2997743f47d58
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 00:00:12 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:18:35 2022 +0200

svl: rename SfxRectangleItem::aVal to maVal

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

diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx
index 94465bad4149..26c2acd37b65 100644
--- a/include/svl/rectitem.hxx
+++ b/include/svl/rectitem.hxx
@@ -27,7 +27,7 @@ class SvStream;
 
 class SVL_DLLPUBLIC SfxRectangleItem final : public SfxPoolItem
 {
-tools::RectangleaVal;
+tools::RectanglemaVal;
 
 public:
  static SfxPoolItem* CreateDefault();
@@ -43,7 +43,7 @@ public:
 virtual bool operator==( const SfxPoolItem& ) const override;
 virtual SfxRectangleItem* Clone( SfxItemPool *pPool = nullptr ) const 
override;
 
-const tools::Rectangle& GetValue() const { return aVal; }
+const tools::Rectangle& GetValue() const { return maVal; }
 virtual bool QueryValue( css::uno::Any& rVal,
   sal_uInt8 nMemberId = 0 ) const 
override;
 virtual bool PutValue( const css::uno::Any& rVal,
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index 9f6789d3b707..f6a5db309d4b 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -37,7 +37,7 @@ SfxRectangleItem::SfxRectangleItem()
 
 SfxRectangleItem::SfxRectangleItem( sal_uInt16 nW, const tools::Rectangle& 
rVal ) :
 SfxPoolItem( nW ),
-aVal( rVal )
+maVal( rVal )
 {
 }
 
@@ -51,10 +51,10 @@ bool SfxRectangleItem::GetPresentation
 const IntlWrapper&
 )   const
 {
-rText = OUString::number(aVal.Top())+ ", " +
-OUString::number(aVal.Left())   + ", " +
-OUString::number(aVal.Bottom()) + ", " +
-OUString::number(aVal.Right());
+rText = OUString::number(maVal.Top())+ ", " +
+OUString::number(maVal.Left())   + ", " +
+OUString::number(maVal.Bottom()) + ", " +
+OUString::number(maVal.Right());
 return true;
 }
 
@@ -62,7 +62,7 @@ bool SfxRectangleItem::GetPresentation
 bool SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const
 {
 assert(SfxPoolItem::operator==(rItem));
-return static_cast(rItem).aVal == aVal;
+return static_cast(rItem).maVal == maVal;
 }
 
 SfxRectangleItem* SfxRectangleItem::Clone(SfxItemPool *) const
@@ -78,16 +78,16 @@ bool SfxRectangleItem::QueryValue( css::uno::Any& rVal,
 {
 case 0:
 {
-rVal <<= css::awt::Rectangle( aVal.Left(),
- aVal.Top(),
- aVal.getOpenWidth(),
- aVal.getOpenHeight() );
+rVal <<= css::awt::Rectangle( maVal.Left(),
+ maVal.Top(),
+ maVal.getOpenWidth(),
+ maVal.getOpenHeight() );
 break;
 }
-case MID_RECT_LEFT:  rVal <<= aVal.Left(); break;
-case MID_RECT_RIGHT: rVal <<= aVal.Top(); break;
-case MID_WIDTH: rVal <<= aVal.getOpenWidth(); break;
-case MID_HEIGHT: rVal <<= aVal.getOpenHeight(); break;
+case MID_RECT_LEFT:  rVal <<= maVal.Left(); break;
+case MID_RECT_RIGHT: rVal <<= maVal.Top(); break;
+case MID_WIDTH: rVal <<= maVal.getOpenWidth(); break;
+case MID_HEIGHT: rVal <<= maVal.getOpenHeight(); break;
 default: OSL_FAIL("Wrong MemberID!"); return false;
 }
 
@@ -112,15 +112,15 @@ bool SfxRectangleItem::PutValue( const css::uno::Any& 
rVal,
 switch ( nMemberId )
 {
 case 0:
-aVal.SetLeft( aValue.X );
-aVal.SetTop( aValue.Y );
-aVal.setWidth( aValue.Width );
-aVal.setHeight( aValue.Height );
+maVal.SetLeft( aValue.X );
+maVal.SetTop( aValue.Y );
+maVal.setWidth( aValue.Width );
+maVal.setHeight( aValue.Height );
 break;
-case MID_RECT_LEFT:  aVal.SetPosX( nVal ); break;
-case MID_RECT_RIGHT: aVal.SetPosY( nVal ); break;
-case MID_WIDTH: aVal.setWidth( nVal ); break;
-case

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

2022-08-10 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit bdf98cbb55aa89a15e194a48a7f248abb9465cb7
Author: Chris Sherlock 
AuthorDate: Sat Jul 30 22:01:42 2022 +1000
Commit: Caolán McNamara 
CommitDate: Wed Aug 10 11:46:09 2022 +0200

vcl: remove unused GLYPH_FONT_HEIGHT

GLYPH_FONT_HEIGHT not used since:

Commit: d538d3d84172a74dfe97d59a6d3daf9a45459cab
Short title: This fallback code makes no sense any more

Change-Id: I9c87e2fb2eb33abbc2a7e4d82435704f1a895c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137631
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ea14e3d018b7..2595415db1b5 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -138,12 +138,6 @@ namespace com::sun::star::i18n {
 class XBreakIterator;
 }
 
-#if defined UNX
-#define GLYPH_FONT_HEIGHT   128
-#else
-#define GLYPH_FONT_HEIGHT   256
-#endif
-
 // OutputDevice-Types
 
 enum OutDevType { OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV, OUTDEV_PDF };


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

2022-08-09 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|   10 ++---
 vcl/source/animate/Animation.cxx |2 -
 vcl/source/animate/AnimationRenderer.cxx |   62 +++
 3 files changed, 37 insertions(+), 37 deletions(-)

New commits:
commit 91d77d65190e7cf11dd7cd0b29d5de6b66061faf
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:16:21 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 10 07:53:08 2022 +0200

vcl: AnimationRenderer::getOutPos() -> GetOriginPosition()

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index bc98f9ac3093..95de08014a21 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -50,11 +50,11 @@ private:
 Animation*  mpParent;
 VclPtr  mpRenderContext;
 tools::Long mnRendererId;
-Point   maPt;
+Point   maOriginPt;
 Point   maDispPt;
 Point   maRestPt;
-SizemaSz;
-SizemaSzPix;
+SizemaLogicalSize;
+SizemaSizePx;
 SizemaDispSz;
 SizemaRestSz;
 vcl::Region maClip;
@@ -82,9 +82,9 @@ public:
 
 voidgetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, 
Size& rSizePix );
 
-const Point&getOutPos() const { return maPt; }
+const Point&getOriginPosition() const { return maOriginPt; }
 
-const Size& getOutSizePix() const { return maSzPix; }
+const Size& getOutSizePix() const { return maSizePx; }
 
 voidpause( bool bIsPaused ) { mbIsPaused = bIsPaused; }
 boolisPaused() const { return mbIsPaused; }
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 0922dec2bf37..831532d5977a 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -181,7 +181,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 if (itAnimView != maRenderers.end())
 {
-if ((*itAnimView)->getOutPos() == rDestPt
+if ((*itAnimView)->getOriginPosition() == rDestPt
 && (*itAnimView)->getOutSizePix() == 
rOut.LogicToPixel(rDestSz))
 {
 (*itAnimView)->repaint();
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index e4ce509a694d..9bb5efc38ae9 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -32,10 +32,10 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 OutputDevice* pFirstFrameOutDev ) :
 mpParent( pParent ),
 mpRenderContext ( pFirstFrameOutDev ? pFirstFrameOutDev : pOut ),
-mnRendererId ( nRendererId ),
-maPt( rPt ),
-maSz( rSz ),
-maSzPix ( mpRenderContext->LogicToPixel( maSz ) ),
+mnRendererId( nRendererId ),
+maOriginPt  ( rPt ),
+maLogicalSize   ( rSz ),
+maSizePx( mpRenderContext->LogicToPixel( maLogicalSize ) ),
 maClip  ( mpRenderContext->GetClipRegion() ),
 mpBackground( VclPtr::Create() ),
 mpRestore   ( VclPtr::Create() ),
@@ -43,40 +43,40 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 meLastDisposal  ( Disposal::Back ),
 mbIsPaused  ( false ),
 mbIsMarked  ( false ),
-mbIsMirroredHorizontally ( maSz.Width() < 0 ),
-mbIsMirroredVertically ( maSz.Height() < 0 )
+mbIsMirroredHorizontally( maLogicalSize.Width() < 0 ),
+mbIsMirroredVertically( maLogicalSize.Height() < 0 )
 {
 Animation::ImplIncAnimCount();
 
 // Mirrored horizontally?
 if( mbIsMirroredHorizontally )
 {
-maDispPt.setX( maPt.X() + maSz.Width() + 1 );
-maDispSz.setWidth( -maSz.Width() );
-maSzPix.setWidth( -maSzPix.Width() );
+maDispPt.setX( maOriginPt.X() + maLogicalSize.Width() + 1 );
+maDispSz.setWidth( -maLogicalSize.Width() );
+maSizePx.setWidth( -maSizePx.Width() );
 }
 else
 {
-maDispPt.setX( maPt.X() );
-maDispSz.setWidth( maSz.Width() );
+maDispPt.setX( maOriginPt.X() );
+maDispSz.setWidth( maLogicalSize.Width() );
 }
 
 // Mirrored vertically?
 if( mbIsMirroredVertically )
 {
-maDispPt.setY( maPt.Y() + maSz.Height() + 1 );
-maDispSz.setHeight( -maSz.Height() );
-maSzPix.setHeight( -maS

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

2022-08-09 Thread Chris Sherlock (via logerrit)
 tools/qa/cppunit/test_json_writer.cxx |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 57fddf3e644c99715fb3bdf2e107aa2495c0ecf9
Author: Chris Sherlock 
AuthorDate: Sun Jun 19 20:38:44 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Tue Aug 9 15:28:30 2022 +0200

tools: json writer test does not need to use test::BootstrapFixture

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

diff --git a/tools/qa/cppunit/test_json_writer.cxx 
b/tools/qa/cppunit/test_json_writer.cxx
index 188b22f9c617..2e0706605745 100644
--- a/tools/qa/cppunit/test_json_writer.cxx
+++ b/tools/qa/cppunit/test_json_writer.cxx
@@ -9,24 +9,18 @@
 
 #include 
 
+#include 
 #include 
+
 #include 
-#include 
 #include 
 #include 
 
 namespace
 {
-class JsonWriterTest : public test::BootstrapFixture
+class JsonWriterTest : public CppUnit::TestFixture
 {
 public:
-JsonWriterTest()
-: BootstrapFixture(true, false)
-{
-}
-
-virtual void setUp() override {}
-
 void test1();
 void test2();
 void testArray();


[Libreoffice-commits] core.git: include/tools solenv/gdb solenv/vs tools/source

2022-08-09 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx|  260 +--
 solenv/gdb/libreoffice/tl.py |   16 +-
 solenv/vs/LibreOffice.natvis |   18 +-
 tools/source/generic/gen.cxx |   74 ++--
 4 files changed, 184 insertions(+), 184 deletions(-)

New commits:
commit fd9763cb7ecb05c43bcd23f6aedf73489e1bccb8
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:52:21 2022 +1000
Commit: Michael Stahl 
CommitDate: Tue Aug 9 10:51:53 2022 +0200

tools: prefix member variables with an 'm'

Also updated debug pretty-printers

Change-Id: I5204bb8f1c6a47677ad3c49d6579c090ea69aedc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137388
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 35a510124749..8182676e0731 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -42,14 +42,14 @@ enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, 
TRISTATE_INDET };
 class SAL_WARN_UNUSED Pair
 {
 public:
-constexpr Pair() : nA(0), nB(0) {}
-constexpr Pair( tools::Long _nA, tools::Long _nB ) : nA(_nA), nB(_nB) {}
+constexpr Pair() : mnA(0), mnB(0) {}
+constexpr Pair( tools::Long nA, tools::Long nB ) : mnA(nA), mnB(nB) {}
 
-tools::LongA() const { return nA; }
-tools::LongB() const { return nB; }
+tools::LongA() const { return mnA; }
+tools::LongB() const { return mnB; }
 
-tools::Long&   A() { return nA; }
-tools::Long&   B() { return nB; }
+tools::Long&   A() { return mnA; }
+tools::Long&   B() { return mnB; }
 
 TOOLS_DLLPUBLIC rtl::OStringtoString() const;
 
@@ -57,8 +57,8 @@ public:
 TOOLS_DLLPUBLIC size_t GetHashValue() const;
 
 protected:
-tools::LongnA;
-tools::LongnB;
+tools::LongmnA;
+tools::LongmnB;
 };
 
 namespace tools::detail {
@@ -80,13 +80,13 @@ public:
 constexpr Point() {}
 constexpr Point( tools::Long nX, tools::Long nY ) : Pair( nX, nY ) {}
 
-constexpr tools::Long  X() const { return nA; }
-constexpr tools::Long  Y() const { return nB; }
+constexpr tools::Long  X() const { return mnA; }
+constexpr tools::Long  Y() const { return mnB; }
 
 voidMove( tools::Long nHorzMove, tools::Long nVertMove );
 voidMove( Size const & s );
-tools::LongAdjustX( tools::Long nHorzMove ) { nA += 
nHorzMove; return nA; }
-tools::LongAdjustY( tools::Long nVertMove ) { nB += 
nVertMove; return nB; }
+tools::LongAdjustX( tools::Long nHorzMove ) { mnA += 
nHorzMove; return mnA; }
+tools::LongAdjustY( tools::Long nVertMove ) { mnB += 
nVertMove; return mnB; }
 
 voidRotateAround( tools::Long& rX, tools::Long& rY, 
Degree10 nOrientation ) const;
 voidRotateAround( Point&, Degree10 nOrientation ) const;
@@ -103,8 +103,8 @@ public:
 
 constexpr tools::Long  getX() const { return X(); }
 constexpr tools::Long  getY() const { return Y(); }
-voidsetX(tools::Long nX)  { nA = nX; }
-voidsetY(tools::Long nY)  { nB = nY; }
+voidsetX(tools::Long nX)  { mnA = nX; }
+voidsetY(tools::Long nY)  { mnB = nY; }
 
 Pair const &toPair() const { return *this; }
 Pair &  toPair() { return *this; }
@@ -119,56 +119,56 @@ public:
 
 inline void Point::Move( tools::Long nHorzMove, tools::Long nVertMove )
 {
-nA += nHorzMove;
-nB += nVertMove;
+mnA += nHorzMove;
+mnB += nVertMove;
 }
 
 inline Point& Point::operator += ( const Point& rPoint )
 {
-nA += rPoint.nA;
-nB += rPoint.nB;
+mnA += rPoint.mnA;
+mnB += rPoint.mnB;
 return *this;
 }
 
 inline Point& Point::operator -= ( const Point& rPoint )
 {
-nA -= rPoint.nA;
-nB -= rPoint.nB;
+mnA -= rPoint.mnA;
+mnB -= rPoint.mnB;
 return *this;
 }
 
 inline Point& Point::operator *= ( const tools::Long nVal )
 {
-nA *= nVal;
-nB *= nVal;
+mnA *= nVal;
+mnB *= nVal;
 return *this;
 }
 
 inline Point& Point::operator /= ( const tools::Long nVal )
 {
-nA /= nVal;
-nB /= nVal;
+mnA /= nVal;
+mnB /= nVal;
 return *this;
 }
 
 inline Point operator+( const Point , const Point  )
 {
-return Point( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
+return Point( rVal1.mnA+rVal2.mnA, rVal1.mnB+rVal2.mnB );
 }
 
 inline Point operator-( const Point , const Point  )
 {
-return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
+return Point( rVal1.mnA-rVal2.mnA, rVal1.mnB-rVal2.mnB );
 }
 
 inline Point operator*( const Point , const tools::Long nVal2 )
 {
-return P

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

2022-07-28 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|4 ++--
 vcl/source/animate/Animation.cxx |6 +++---
 vcl/source/animate/AnimationRenderer.cxx |2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 756ff6f6dfb24048c43b682a95241d5548a1bb8f
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:25:37 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:27:19 2022 +0200

vcl: Animation - cleanup pause functions and fields

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 6b86d07bb2de..bc98f9ac3093 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -35,7 +35,7 @@ struct AnimationData
 VclPtr   pOutDev;
 void*   pRendererData;
 tools::Long nRendererId;
-boolbPause;
+boolmbIsPaused;
 
 AnimationData();
 };
@@ -87,7 +87,7 @@ public:
 const Size& getOutSizePix() const { return maSzPix; }
 
 voidpause( bool bIsPaused ) { mbIsPaused = bIsPaused; }
-boolisPause() const { return mbIsPaused; }
+boolisPaused() const { return mbIsPaused; }
 
 voidsetMarked( bool bIsMarked ) { mbIsMarked = bIsMarked; }
 boolisMarked() const { return mbIsMarked; }
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index f7d6a4f27a93..0922dec2bf37 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -314,7 +314,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 pRenderer = 
static_cast(pDataItem->pRendererData);
 }
 
-pRenderer->pause(pDataItem->bPause);
+pRenderer->pause(pDataItem->mbIsPaused);
 pRenderer->setMarked(true);
 }
 
@@ -326,7 +326,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 // check if every remaining view is paused
 bGlobalPause = std::all_of(maRenderers.cbegin(), 
maRenderers.cend(),
-   [](const auto& pRenderer) { return 
pRenderer->isPause(); });
+   [](const auto& pRenderer) { return 
pRenderer->isPaused(); });
 
 // reset marked state
 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
@@ -685,7 +685,7 @@ AnimationData::AnimationData()
 : pOutDev(nullptr)
 , pRendererData(nullptr)
 , nRendererId(0)
-, bPause(false)
+, mbIsPaused(false)
 {
 }
 
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 51aaa590d24b..e4ce509a694d 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -316,7 +316,7 @@ AnimationData* AnimationRenderer::createAnimationData() 
const
 pDataItem->pOutDev = mpRenderContext;
 pDataItem->pRendererData = const_cast(this);
 pDataItem->nRendererId = mnRendererId;
-pDataItem->bPause = mbIsPaused;
+pDataItem->mbIsPaused = mbIsPaused;
 
 return pDataItem;
 }


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

2022-07-28 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 2732115080036e4333fd025ca00396b3ff48c624
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:56:34 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:24:28 2022 +0200

tdf#143148 tools: Use pragma once instead of include guards

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

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 5ed473c62857..35a510124749 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_TOOLS_GEN_HXX
-#define INCLUDED_TOOLS_GEN_HXX
+
+#pragma once
 
 #include 
 
@@ -823,6 +823,4 @@ inline std::basic_ostream & operator <<(
 }
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


Justify() vs Normalize()

2022-07-24 Thread Chris Sherlock
Hi all,

I only recently discovered that tools::Rectangle::Justify() really means that 
the 
rectangle is normalized (I.e. the points are arranged in such a way that the 
width is always positive, and the x and y coordinates are in the the top left 
corner).

Would it be possible to rename it to Normalize(), or at least add Normalize() 
as an an alias that calls on Justify()?

Chris


[Libreoffice-commits] core.git: accessibility/inc basctl/inc basic/inc basic/source chart2/inc cui/inc dbaccess/inc forms/source framework/source include/dbaccess include/svtools include/svx include/t

2022-07-20 Thread Chris Sherlock (via logerrit)
 accessibility/inc/helper/IComboListBoxHelper.hxx |2 
 accessibility/inc/pch/precompiled_acc.hxx|   13 ++-
 basctl/inc/pch/precompiled_basctl.hxx|9 ++
 basic/inc/pch/precompiled_sb.hxx |   51 +++---
 basic/source/runtime/methods.cxx |2 
 chart2/inc/pch/precompiled_chartcontroller.hxx   |   25 +++
 cui/inc/pch/precompiled_cui.hxx  |   33 -
 dbaccess/inc/pch/precompiled_dbu.hxx |   11 +--
 forms/source/richtext/richtextcontrol.hxx|2 
 framework/source/helper/tagwindowasmodified.cxx  |2 
 include/dbaccess/dataview.hxx|2 
 include/svtools/valueset.hxx |2 
 include/svx/fmgridif.hxx |2 
 include/vcl/builder.hxx  |2 
 include/vcl/stdtext.hxx  |2 
 include/vcl/toolkit/vclmedit.hxx |2 
 include/vcl/window.hxx   |2 
 include/vcl/wintypes.hxx |6 -
 reportdesign/inc/pch/precompiled_rptui.hxx   |   21 --
 sc/inc/pch/precompiled_sc.hxx|   17 +++-
 sd/inc/pch/precompiled_sd.hxx|   57 +++-
 sd/inc/pch/precompiled_sdui.hxx  |   28 
 sfx2/source/control/listview.cxx |2 
 solenv/clang-format/excludelist  |2 
 svx/inc/pch/precompiled_svxcore.hxx  |   16 +++-
 sw/inc/pch/precompiled_swui.hxx  |   53 +++
 sw/inc/pch/precompiled_vbaswobj.hxx  |   79 +++
 toolkit/inc/helper/imagealign.hxx|2 
 toolkit/source/awt/vclxtoolkit.cxx   |2 
 vcl/source/treelist/svimpbox.cxx |2 
 30 files changed, 247 insertions(+), 204 deletions(-)

New commits:
commit 845393b9aa9057c5ace3c41ad5ac629b895d7f7f
Author: Chris Sherlock 
AuthorDate: Mon Jun 27 19:04:24 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Jul 20 12:20:59 2022 +0200

move wintypes.hxx from tools to vcl

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

diff --git a/accessibility/inc/helper/IComboListBoxHelper.hxx 
b/accessibility/inc/helper/IComboListBoxHelper.hxx
index e786311fd0df..eed2a757c1e4 100644
--- a/accessibility/inc/helper/IComboListBoxHelper.hxx
+++ b/accessibility/inc/helper/IComboListBoxHelper.hxx
@@ -21,7 +21,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 namespace com::sun::star::datatransfer::clipboard {
diff --git a/accessibility/inc/pch/precompiled_acc.hxx 
b/accessibility/inc/pch/precompiled_acc.hxx
index 33dcf9125def..07f6fa2c8e8d 100644
--- a/accessibility/inc/pch/precompiled_acc.hxx
+++ b/accessibility/inc/pch/precompiled_acc.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2021-11-29 09:45:37 using:
+ Generated on 2022-06-27 18:57:49 using:
  ./bin/update_pch accessibility acc --cutoff=4 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #endif // PCH_LEVEL >= 1
@@ -69,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +94,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -142,7 +145,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -157,6 +160,7 @@
 #include 
 #include 
 #include 
+#include 
 #endif // PCH_LEVEL >= 2
 #if PCH_LEVEL >= 3
 #include 
@@ -166,6 +170,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -238,7 +243,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -291,7 +295,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -316,7 +319,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -336,7 +338,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/basctl/inc/pch/precompiled_basctl.hxx 
b/basctl/inc/pch/precompiled_basctl.hxx
index 30f9f2560029..9728e1df71b2 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-01-26 09:11:03 using:
+ Generated on 2022-06-27 18:59:37 using:
  ./bin/update_pch basctl basctl --cutoff=3 --exclude:system --inclu

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

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|6 +++---
 vcl/source/animate/Animation.cxx |   23 ---
 vcl/source/animate/AnimationRenderer.cxx |   18 +-
 3 files changed, 24 insertions(+), 23 deletions(-)

New commits:
commit 44422b97e9d6398919445363b81b4cd1ab184ce3
Author: Chris Sherlock 
AuthorDate: Fri Jun 24 18:16:07 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 19:52:11 2022 +0200

vcl: AInfo -> AnimationData

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 18128558a44e..6b86d07bb2de 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -28,7 +28,7 @@ class OutputDevice;
 class VirtualDevice;
 struct AnimationBitmap;
 
-struct AInfo
+struct AnimationData
 {
 Point   aStartOrg;
 SizeaStartSize;
@@ -37,7 +37,7 @@ struct AInfo
 tools::Long nRendererId;
 boolbPause;
 
-AInfo();
+AnimationData();
 };
 
 
@@ -78,7 +78,7 @@ public:
 voiddrawToIndex( sal_uLong nIndex );
 voiddraw( sal_uLong nIndex, VirtualDevice* pVDev=nullptr );
 voidrepaint();
-AInfo*  createAInfo() const;
+AnimationData*  createAnimationData() const;
 
 voidgetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, 
Size& rSizePix );
 
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index b0270c194c95..f7d6a4f27a93 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -290,30 +290,31 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maNotifyLink.IsSet())
 {
-std::vector> aAInfoList;
-// create AInfo-List
+std::vector> aDataItems;
+// create AnimationData-List
 for (auto const& i : maRenderers)
-aAInfoList.emplace_back(i->createAInfo());
+aDataItems.emplace_back(i->createAnimationData());
 
 maNotifyLink.Call(this);
 
-// set view state from AInfo structure
-for (auto& pAInfo : aAInfoList)
+// set view state from AnimationData structure
+for (auto& pDataItem : aDataItems)
 {
 AnimationRenderer* pRenderer = nullptr;
-if (!pAInfo->pRendererData)
+if (!pDataItem->pRendererData)
 {
-pRenderer = new AnimationRenderer(this, pAInfo->pOutDev, 
pAInfo->aStartOrg,
-  pAInfo->aStartSize, 
pAInfo->nRendererId);
+pRenderer
+= new AnimationRenderer(this, pDataItem->pOutDev, 
pDataItem->aStartOrg,
+pDataItem->aStartSize, 
pDataItem->nRendererId);
 
 
maRenderers.push_back(std::unique_ptr(pRenderer));
 }
 else
 {
-pRenderer = 
static_cast(pAInfo->pRendererData);
+pRenderer = 
static_cast(pDataItem->pRendererData);
 }
 
-pRenderer->pause(pAInfo->bPause);
+pRenderer->pause(pDataItem->bPause);
 pRenderer->setMarked(true);
 }
 
@@ -680,7 +681,7 @@ SvStream& ReadAnimation(SvStream& rIStm, Animation& 
rAnimation)
 return rIStm;
 }
 
-AInfo::AInfo()
+AnimationData::AnimationData()
 : pOutDev(nullptr)
 , pRendererData(nullptr)
 , nRendererId(0)
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 59843e19c893..51aaa590d24b 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -307,18 +307,18 @@ void AnimationRenderer::repaint()
 mbIsPaused = bOldPause;
 }
 
-AInfo* AnimationRenderer::createAInfo() const
+AnimationData* AnimationRenderer::createAnimationData() const
 {
-AInfo* pAInfo = new AInfo;
+AnimationData* pDataItem = new AnimationData;
 
-pAInfo->aStartOrg = maPt;
-pAInfo->aStartSize = maSz;
-pAInfo->pOutDev = mpRenderContext;
-pAInfo->pRendererData = const_cast(this);
-pAInfo->nRendererId = mnRendererId;
-pAInfo->bPause = mbIsPaused;
+pDataItem->aStartOrg = maPt;
+pDataItem->aStartSize = maSz;
+pDataItem->pOutDev = mpRenderContext;
+pDataItem->pRendererData = const_cast(this);
+pDataItem->nRendererId = mnRendererId;
+pDataItem->bPause = mbIsPaused;
 
-return pAInfo;
+return pDataItem;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |   14 +++---
 vcl/source/outdev/text.cxx |8 
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 4d9e9ff5f4cb199844eb1d2b4000bb837089347f
Author: Chris Sherlock 
AuthorDate: Thu Jun 30 21:07:26 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 12:59:54 2022 +0200

vcl: allow OutputDevice::GetTextRect() cater for rotated fonts

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

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a7cf83d4edfd..d6c624fa7406 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -98,27 +98,19 @@ void VclComplexTextTest::testArabic()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.GetWidth(), 2); // This 
sometimes equals to 70
 CPPUNIT_ASSERT_DOUBLES_EQUAL(15, aBoundRect.getOpenHeight(), 1);
 
-#if 0
-// FIXME: This seems to be wishful thinking, GetTextRect() does not take
-// rotation into account.
-
 // normal orientation
 tools::Rectangle aInput;
 tools::Rectangle aRect = pOutDev->GetTextRect( aInput, aOneTwoThree );
 
 // now rotate 270 degrees
 vcl::Font aRotated( aFont );
-aRotated.SetOrientation( 2700 );
+aRotated.SetOrientation( 2700_deg10 );
 pOutDev->SetFont( aRotated );
 tools::Rectangle aRectRot = pOutDev->GetTextRect( aInput, aOneTwoThree );
 
 // Check that we did do the rotation...
-fprintf( stderr, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " 
%" SAL_PRIdINT64 "\n",
- sal_Int64(aRect.GetWidth()), sal_Int64(aRect.GetHeight()),
- sal-Int64(aRectRot.GetWidth()), sal_Int64(aRectRot.GetHeight()) );
-CPPUNIT_ASSERT( aRectRot.GetWidth() == aRect.GetHeight() );
-CPPUNIT_ASSERT( aRectRot.GetHeight() == aRect.GetWidth() );
-#endif
+CPPUNIT_ASSERT_EQUAL( aRectRot.GetWidth(), aRect.GetHeight() );
+CPPUNIT_ASSERT_EQUAL( aRectRot.GetHeight(), aRect.GetWidth() );
 #endif
 }
 
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index e82d89930b6d..2f7199fa3fa3 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2042,6 +2042,14 @@ tools::Rectangle OutputDevice::GetTextRect( const 
tools::Rectangle& rRect,
 aRect.AdjustLeft( -1 );
 else
 aRect.AdjustRight( 1 );
+
+if (maFont.GetOrientation() != 0_deg10)
+{
+tools::Polygon aRotatedPolygon(aRect);
+aRotatedPolygon.Rotate(Point(aRect.GetWidth() / 2, aRect.GetHeight() / 
2), maFont.GetOrientation());
+return aRotatedPolygon.GetBoundRect();
+}
+
 return aRect;
 }
 


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

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |2 +-
 vcl/source/app/svapp.cxx   |2 +-
 vcl/source/control/scrbar.cxx  |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9e7aee7c85b5ef341705d2969461bc96743fcbcc
Author: Chris Sherlock 
AuthorDate: Mon Jul 18 19:46:22 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 12:05:10 2022 +0200

vcl: migrate from getOpenHeight/Width() to GetWidth/Height()

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

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a79fe420884d..a7cf83d4edfd 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -95,7 +95,7 @@ void VclComplexTextTest::testArabic()
 pOutDev->GetTextBoundRect(aBoundRect, aOneTwoThree);
 CPPUNIT_ASSERT_DOUBLES_EQUAL(0, aBoundRect.Left(), 1); // This sometimes 
equals to 1
 CPPUNIT_ASSERT_DOUBLES_EQUAL(1, aBoundRect.Top(), 1);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.getOpenWidth(), 1); // This 
sometimes equals to 70
+CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.GetWidth(), 2); // This 
sometimes equals to 70
 CPPUNIT_ASSERT_DOUBLES_EQUAL(15, aBoundRect.getOpenHeight(), 1);
 
 #if 0
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c315c35f0fd1..36beccb6bcb5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1375,7 +1375,7 @@ tools::Rectangle Application::GetScreenPosSizePixel( 
unsigned int nScreen )
 return tools::Rectangle();
 }
 tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen);
-if (aRect.getOpenHeight() == 0)
+if (aRect.GetHeight() == 0)
 SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen 
<< " returned 0 height.");
 return aRect;
 }
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 7ef7174ee714..79fb1d4c11df 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1118,12 +1118,12 @@ IMPL_LINK_NOARG(ScrollBar, ImplAutoTimerHdl, Timer *, 
void)
 void ScrollBar::ImplInvert()
 {
 tools::Rectangle aRect( maThumbRect );
-if( aRect.getOpenWidth() > 4 )
+if( aRect.GetWidth() > 5 )
 {
 aRect.AdjustLeft(2 );
 aRect.AdjustRight( -2 );
 }
-if( aRect.getOpenHeight() > 4 )
+if( aRect.GetHeight() > 5 )
 {
 aRect.AdjustTop(2 );
 aRect.AdjustBottom( -2 );


[Libreoffice-commits] core.git: basegfx/source include/basegfx sc/inc sc/source sd/source svx/source sw/source

2022-07-13 Thread Chris Sherlock (via logerrit)
 basegfx/source/tools/zoomtools.cxx |   16 
 include/basegfx/utils/zoomtools.hxx|5 ++---
 sc/inc/global.hxx  |4 ++--
 sc/source/ui/view/prevwsh.cxx  |   10 +-
 sc/source/ui/view/tabview.cxx  |8 
 sc/source/ui/view/tabvwsh3.cxx |8 
 sd/source/ui/view/viewshel.cxx |8 
 svx/source/stbctrls/zoomsliderctrl.cxx |4 ++--
 sw/source/uibase/uiview/view2.cxx  |2 +-
 sw/source/uibase/uiview/viewport.cxx   |6 +++---
 10 files changed, 35 insertions(+), 36 deletions(-)

New commits:
commit ac2a6ee9618e377806e529ed641f67e88684f7e7
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:20:15 2022 +1000
Commit: Thorsten Behrens 
CommitDate: Wed Jul 13 18:54:28 2022 +0200

basegfx: zoomIn() and zoomOut() should be sal_uInt16

All zoom functions use sal_uInt16 values. For some reason, basegfx used
long when zoomIn and zoomOut were created in 2012 (see commit
315d2ddc16: "optimized zoom to use more common intervals"), this then
got mass converted to tools::Long in commit 387a88fa25: "use tools::Long
in basegfx..chart2".

So fix is to change zoomIn/Out() to use sal_uInt16.

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

diff --git a/basegfx/source/tools/zoomtools.cxx 
b/basegfx/source/tools/zoomtools.cxx
index 4fedb8ee848c..dd4c7a6cbbd3 100644
--- a/basegfx/source/tools/zoomtools.cxx
+++ b/basegfx/source/tools/zoomtools.cxx
@@ -26,7 +26,7 @@ const double ZOOM_FACTOR = 1.12246205;
 * @param nCurrent current value
 * @param nMultiple multiple against which the current value is rounded
 */
-static tools::Long roundMultiple(tools::Long nCurrent, int nMultiple)
+static sal_uInt16 roundMultiple(sal_uInt16 nCurrent, int nMultiple)
 {
 // round zoom to a multiple of nMultiple
 return (( nCurrent + nMultiple / 2 ) - ( nCurrent + nMultiple / 2 ) % 
nMultiple);
@@ -39,10 +39,10 @@ static tools::Long roundMultiple(tools::Long nCurrent, int 
nMultiple)
 *
 * @param nCurrent current zoom factor
 */
-static tools::Long roundZoom(double nCurrent)
+static sal_uInt16 roundZoom(double nCurrent)
 {
 // convert nCurrent properly to int
-tools::Long nNew = nCurrent + 0.5;
+sal_uInt16 nNew = nCurrent + 0.5;
 
 // round to more common numbers above 50
 if (nNew > 1000) {
@@ -66,7 +66,7 @@ static tools::Long roundZoom(double nCurrent)
 * @param nPrevious previous zoom factor
 * @param nStep step which shouldn't be skipped
 */
-static tools::Long enforceStep(tools::Long nCurrent, tools::Long nPrevious, 
int nStep)
+static sal_uInt16 enforceStep(sal_uInt16 nCurrent, sal_uInt16 nPrevious, 
unsigned int nStep)
 {
 if ((( nCurrent > nStep ) && ( nPrevious < nStep ))
 || (( nCurrent < nStep ) && ( nPrevious > nStep )))
@@ -80,9 +80,9 @@ static tools::Long enforceStep(tools::Long nCurrent, 
tools::Long nPrevious, int
 *
 * @param nCurrent current zoom factor
 */
-tools::Long zoomIn(tools::Long nCurrent)
+sal_uInt16 zoomIn(sal_uInt16 nCurrent)
 {
-tools::Long nNew = roundZoom( nCurrent * ZOOM_FACTOR );
+sal_uInt16 nNew = roundZoom( nCurrent * ZOOM_FACTOR );
 // make sure some values are not skipped
 nNew = enforceStep(nNew, nCurrent, 200);
 nNew = enforceStep(nNew, nCurrent, 100);
@@ -97,9 +97,9 @@ tools::Long zoomIn(tools::Long nCurrent)
 *
 * @param nCurrent current zoom factor
 */
-tools::Long zoomOut(tools::Long nCurrent)
+sal_uInt16 zoomOut(sal_uInt16 nCurrent)
 {
-tools::Long nNew = roundZoom( nCurrent / ZOOM_FACTOR );
+sal_uInt16 nNew = roundZoom( nCurrent / ZOOM_FACTOR );
 // make sure some values are not skipped
 nNew = enforceStep(nNew, nCurrent, 200);
 nNew = enforceStep(nNew, nCurrent, 100);
diff --git a/include/basegfx/utils/zoomtools.hxx 
b/include/basegfx/utils/zoomtools.hxx
index 242c10e6dafc..16a36448af49 100644
--- a/include/basegfx/utils/zoomtools.hxx
+++ b/include/basegfx/utils/zoomtools.hxx
@@ -10,14 +10,13 @@
 #pragma once
 
 #include 
-#include 
 
 namespace basegfx::zoomtools
 {
 /** This namespace provides functions for optimized geometric zooming
 */
-BASEGFX_DLLPUBLIC tools::Long zoomOut(tools::Long nCurrent);
-BASEGFX_DLLPUBLIC tools::Long zoomIn(tools::Long nCurrent);
+BASEGFX_DLLPUBLIC sal_uInt16 zoomOut(sal_uInt16 nCurrent);
+BASEGFX_DLLPUBLIC sal_uInt16 zoomIn(sal_uInt16 nCurrent);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 47b93c845296..8401ca4c6f7e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -75,8 +75,8 @@ const sal_Unicode CHAR_NNBSP= 0x202F; //NARROW NO-BREAK 
SPACE
 #define MINDOUBLE   1.7e-307
 #define MAXDOUBLE   1.7e307
 
-#define MINZOOM 20
-#define MAXZOOM 400
+const sal_uInt16 MINZ

[Libreoffice-commits] core.git: accessibility/source chart2/source dbaccess/source desktop/source drawinglayer/source filter/source framework/source include/tools oox/source reportdesign/source sc/qa

2022-07-11 Thread Chris Sherlock (via logerrit)
|8 -
 vcl/source/filter/ipict/ipict.cxx |4 
 vcl/source/helper/canvasbitmap.cxx|   10 -
 vcl/source/outdev/transparent.cxx |2 
 vcl/source/treelist/svlbitm.cxx   |4 
 vcl/source/window/cursor.cxx  |2 
 vcl/source/window/menu.cxx|8 -
 vcl/source/window/splitwin.cxx|4 
 vcl/source/window/toolbox.cxx |   14 -
 vcl/workben/minvcl.cxx|2 
 vcl/workben/vcldemo.cxx   |6 
 writerfilter/source/dmapper/GraphicImport.cxx |   12 -
 81 files changed, 300 insertions(+), 297 deletions(-)

New commits:
commit 934985becc567114c3f38a72322056a628aad7c9
Author: Chris Sherlock 
AuthorDate: Wed Jun 29 00:06:03 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Jul 11 11:06:53 2022 +0200

tools: rename getHeight/Width() to GetOpenHeight/Width()

By default Rectangle uses closed interval, if we really want to use half
open intervals then we should specifically say as such in the name.

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

diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx 
b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index d88b3421812d..077e3ea5b6dd 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -192,9 +192,9 @@ tools::Rectangle 
AccessibleGridControlHeader::implGetBoundingBox()
 tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( pParent ) );
 tools::Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
 if(isColumnBar())
-return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
+return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
 else
-return tools::Rectangle(aGridRect.TopLeft(), 
Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
+return tools::Rectangle(aGridRect.TopLeft(), 
Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight()));
 
 }
 
@@ -203,9 +203,9 @@ tools::Rectangle 
AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
 tools::Rectangle aGridRect( m_aTable.GetWindowExtentsRelative( nullptr ) );
 tools::Rectangle aHeaderRect (m_aTable.calcHeaderRect(isColumnBar()));
 if(isColumnBar())
-return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getWidth(),aHeaderRect.getHeight()));
+return tools::Rectangle(aGridRect.TopLeft(), 
Size(aGridRect.getOpenWidth(),aHeaderRect.getOpenHeight()));
 else
-return tools::Rectangle(aGridRect.TopLeft(), 
Size(aHeaderRect.getWidth(),aGridRect.getHeight()));
+return tools::Rectangle(aGridRect.TopLeft(), 
Size(aHeaderRect.getOpenWidth(),aGridRect.getOpenHeight()));
 }
 
 // internal helper methods 
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx 
b/chart2/source/controller/accessibility/AccessibleBase.cxx
index e3949a1bac8e..47159ddd29e3 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -638,7 +638,7 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds()
 aParentLocOnScreen.Y - aULOnScreen.Y );
 
 return awt::Rectangle( aRect.Left() - aOffset.X, aRect.Top() - 
aOffset.Y,
-   aRect.getWidth(), aRect.getHeight());
+   aRect.getOpenWidth(), 
aRect.getOpenHeight());
 }
 }
 
diff --git a/chart2/source/controller/main/ChartController_Window.cxx 
b/chart2/source/controller/main/ChartController_Window.cxx
index c50749c42a87..510420c91a2c 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -871,9 +871,9 @@ void ChartController::execute_MouseButtonUp( const 
MouseEvent& rMEvt )
 
 bool bMoved = PositionAndSizeHelper::moveObject( 
m_aSelection.getSelectedCID()
 , xModel
-, 
awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getWidth(),aObjectRect.getHeight())
+, 
awt::Rectangle(aObjectRect.Left(),aObjectRect.Top(),aObjectRect.getOpenWidth(),aObjectRect.getOpenHeight())
 , 
awt::Rectangle(aOldObjectRect.Left(), aOldObjectRect.Top(), 

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

2022-07-11 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|6 +++---
 vcl/qa/cppunit/animationrenderer.cxx |8 
 vcl/source/animate/AnimationRenderer.cxx |   20 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

New commits:
commit a19e01812b60580c656cf31619e212803e2ca0fa
Author: Chris Sherlock 
AuthorDate: Fri Jun 24 17:52:41 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Jul 11 11:05:33 2022 +0200

vcl: change drawToPos() to drawToIndex()

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index c7fc42a55aa3..18128558a44e 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -60,7 +60,7 @@ private:
 vcl::Region maClip;
 VclPtr  mpBackground;
 VclPtr  mpRestore;
-sal_uLong   mnActPos;
+sal_uLong   mnActIndex;
 DisposalmeLastDisposal;
 boolmbIsPaused;
 boolmbIsMarked;
@@ -75,8 +75,8 @@ public:
 ~AnimationRenderer();
 
 boolmatches(const OutputDevice* pOut, tools::Long nRendererId) 
const;
-voiddrawToPos( sal_uLong nPos );
-voiddraw( sal_uLong nPos, VirtualDevice* pVDev=nullptr );
+voiddrawToIndex( sal_uLong nIndex );
+voiddraw( sal_uLong nIndex, VirtualDevice* pVDev=nullptr );
 voidrepaint();
 AInfo*  createAInfo() const;
 
diff --git a/vcl/qa/cppunit/animationrenderer.cxx 
b/vcl/qa/cppunit/animationrenderer.cxx
index 25dfdc44dab5..b4e7f235e883 100644
--- a/vcl/qa/cppunit/animationrenderer.cxx
+++ b/vcl/qa/cppunit/animationrenderer.cxx
@@ -76,10 +76,10 @@ void VclAnimationRendererTest::testDrawToPos()
 
 AnimationRenderer* pAnimationRenderer
 = new AnimationRenderer(, pTestRC.get(), Point(0, 0), 
Size(10, 10), 5);
-pAnimationRenderer->drawToPos(0);
-pAnimationRenderer->drawToPos(1);
-pAnimationRenderer->drawToPos(2);
-pAnimationRenderer->drawToPos(10);
+pAnimationRenderer->drawToIndex(0);
+pAnimationRenderer->drawToIndex(1);
+pAnimationRenderer->drawToIndex(2);
+pAnimationRenderer->drawToIndex(10);
 
 CPPUNIT_ASSERT_EQUAL(Size(1, 1), pTestRC->GetOutputSizePixel());
 }
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 611d1c71fd6e..59843e19c893 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -39,7 +39,7 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 maClip  ( mpRenderContext->GetClipRegion() ),
 mpBackground( VclPtr::Create() ),
 mpRestore   ( VclPtr::Create() ),
-mnActPos( 0 ),
+mnActIndex  ( 0 ),
 meLastDisposal  ( Disposal::Back ),
 mbIsPaused  ( false ),
 mbIsMarked  ( false ),
@@ -79,7 +79,7 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 mpRenderContext->SaveBackground(*mpBackground, maDispPt, maDispSz, 
maSzPix);
 
 // Initialize drawing to actual position
-drawToPos( mpParent->ImplGetCurPos() );
+drawToIndex( mpParent->ImplGetCurPos() );
 
 // If first frame OutputDevice is set, update variables now for real 
OutputDevice
 if( pFirstFrameOutDev )
@@ -139,7 +139,7 @@ void AnimationRenderer::getPosSize( const AnimationBitmap& 
rAnimationBitmap, Poi
 rPosPix.setY( maSzPix.Height() - 1 - aPt2.Y() );
 }
 
-void AnimationRenderer::drawToPos( sal_uLong nPos )
+void AnimationRenderer::drawToIndex( sal_uLong nIndex )
 {
 VclPtr pRenderContext = mpRenderContext;
 
@@ -157,9 +157,9 @@ void AnimationRenderer::drawToPos( sal_uLong nPos )
 xOldClip = pRenderContext->GetClipRegion();
 
 aVDev->SetOutputSizePixel( maSzPix, false );
-nPos = std::min( nPos, static_cast(mpParent->Count()) - 1 );
+nIndex = std::min( nIndex, static_cast(mpParent->Count()) - 1 );
 
-for( sal_uLong i = 0; i <= nPos; i++ )
+for( sal_uLong i = 0; i <= nIndex; i++ )
 draw( i, aVDev.get() );
 
 if (xOldClip)
@@ -173,7 +173,7 @@ void AnimationRenderer::drawToPos( sal_uLong nPos )
 pRenderContext->SetClipRegion(*xOldClip);
 }
 
-void AnimationRenderer::draw( sal_uLong nPos, VirtualDevice* pVDev )
+void AnimationRenderer::draw( sal_uLong nIndex, VirtualDevice* pVDev )
 {
 VclPtr pRenderContext = mpRenderContext;
 
@@ -198,8 +198,8 @@ void AnimationRenderer::draw( sal_uLong nPos, 
VirtualDevice* pVDev )
 SizeaSizePix;
 SizeaBmpSizePix;
 const sal_uLong nLastPos = mpParent->Count() 

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

2022-07-08 Thread Chris Sherlock (via logerrit)
 comphelper/source/misc/graphicmimetype.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 19347d219fb017eeffb998c7ebd857585f263752
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:21:43 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Fri Jul 8 09:28:30 2022 +0200

comphelper: replace tools::Long with size_t

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

diff --git a/comphelper/source/misc/graphicmimetype.cxx 
b/comphelper/source/misc/graphicmimetype.cxx
index bfa7e5c6adf6..f9c6034ac8f9 100644
--- a/comphelper/source/misc/graphicmimetype.cxx
+++ b/comphelper/source/misc/graphicmimetype.cxx
@@ -53,8 +53,8 @@ OUString 
GraphicMimeTypeHelper::GetMimeTypeForExtension(std::string_view rExt)
 
 OUString aMimeType;
 
-tools::Long const nCount = std::size(aMapper);
-for (tools::Long i = 0; (i < nCount) && aMimeType.isEmpty(); ++i)
+size_t const nCount = std::size(aMapper);
+for (size_t i = 0; (i < nCount) && aMimeType.isEmpty(); ++i)
 {
 if (rExt == aMapper[i].pExt)
 aMimeType = OUString(aMapper[i].pMimeType, 
strlen(aMapper[i].pMimeType),


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

2022-07-07 Thread Chris Sherlock (via logerrit)
 i18nlangtag/source/languagetag/languagetag.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 09a3e24a8e4c0f11c62f104b0bfa9d31180003fd
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:12:10 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Thu Jul 7 17:51:40 2022 +0200

i18nlangtag: replace tools::Long with long

Revert to long as originally used in commit e81359a9a324:
"added registerImpl() re-entered warning" and then apparently
accidentally broken in the mass conversion commit
e25fd7782ad04: "long->tools::Long in hwpfilter..oox".

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

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index 7d881dd37de3..6d20c7304639 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -853,7 +852,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
 std::unique_lock aGuard( theMutex());
 
 #if OSL_DEBUG_LEVEL > 0
-static tools::Long nRunning = 0;
+static long nRunning = 0;
 // Entering twice here is ok, which is needed for fallback init in
 // getKnowns() in canonicalize() via pImpl->convertBcp47ToLocale() below,
 // everything else is suspicious.


Re: Tools module geometry classes

2022-07-07 Thread Chris Sherlock
On Thu, Jun 30, 2022 at 6:16 PM Chris Sherlock 
wrote:

>
>
> On Wed, Jun 29, 2022 at 7:37 PM Luboš Luňák  wrote:
>
>>  So I think a good question to ask is what it is you want to achieve and
>> how
>> much time and energy are you willing to spend on it. I don't want to
>> demoralize or stop you, it certainly would be really nice if this madness
>> finally got sorted out, it's just that it hasn't got sorted out yet
>> because
>> nobody so far has been willing to give it all the effort it'd need.
>>
>
> I'd be happy to work on it. I'd like to see us remove this confusion and
> use the basegfx module.
>
> I'll update the patch to use GetOpenWidth() as a start.
>
> Chris
>

A polite ping to the mailing list: would anyone be able to review my patch
that does this?

https://gerrit.libreoffice.org/c/core/+/136575


[Libreoffice-commits] core.git: include/osl include/rtl

2022-07-05 Thread Chris Sherlock (via logerrit)
 include/osl/mutex.hxx   |4 +++-
 include/osl/profile.hxx |3 ++-
 include/osl/security.h  |1 -
 include/osl/socket.h|3 ++-
 include/osl/socket_decl.hxx |4 +++-
 include/rtl/alloc.h |   20 +---
 include/rtl/cipher.h|4 +++-
 include/rtl/digest.h|1 -
 include/rtl/random.h|1 -
 include/rtl/ustring.h   |1 -
 10 files changed, 22 insertions(+), 20 deletions(-)

New commits:
commit 18dacc47b212bec440a5f729a2787aa91db89b44
Author: Chris Sherlock 
AuthorDate: Sun Jul 3 01:28:18 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Tue Jul 5 12:36:32 2022 +0200

sal: fix invalid doxygen

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

diff --git a/include/osl/mutex.hxx b/include/osl/mutex.hxx
index 96bfd3e02178..481a2bb55002 100644
--- a/include/osl/mutex.hxx
+++ b/include/osl/mutex.hxx
@@ -36,7 +36,9 @@ namespace osl
 
 public:
 /** Create a mutex.
-@return 0 if the mutex could not be created, otherwise a handle to 
the mutex.
+
+The mutex value is 0 if it could not be created, otherwise a 
handle to the mutex.
+
 @see ::osl_createMutex()
 */
 Mutex()
diff --git a/include/osl/profile.hxx b/include/osl/profile.hxx
index ec75e3ce3470..e83fef0c665c 100644
--- a/include/osl/profile.hxx
+++ b/include/osl/profile.hxx
@@ -48,7 +48,8 @@ namespace osl {
 
 public:
 /** Open or create a configuration profile.
-@retval 0 if the profile could not be created, otherwise a handle 
to the profile.
+
+Sets a handle to the profile, otherwise if the profile could not 
be opened then throw an exception.
 */
 Profile(const rtl::OUString & strProfileName, oslProfileOption Options 
= Profile_DEFAULT )
 {
diff --git a/include/osl/security.h b/include/osl/security.h
index 56674027ea19..9c56f20971f4 100644
--- a/include/osl/security.h
+++ b/include/osl/security.h
@@ -162,7 +162,6 @@ SAL_DLLPUBLIC sal_Bool SAL_CALL osl_loadUserProfile(
 /** Unload a User Profile
 Implemented just for Windows
 @param[in] Security previously fetch Security of the User
-@return nothing is returned!
 */
 
 SAL_DLLPUBLIC void SAL_CALL osl_unloadUserProfile(
diff --git a/include/osl/socket.h b/include/osl/socket.h
index 7f87da312d4e..474860b14701 100644
--- a/include/osl/socket.h
+++ b/include/osl/socket.h
@@ -832,7 +832,8 @@ SAL_DLLPUBLIC void SAL_CALL osl_destroyHostAddr(oslHostAddr 
Addr);
 
 
 /** Get the hostname member of Addr.
-@return The hostname or 0 upon failure.
+@param Addr address for host name
+@param strHostname The host name or 0 upon failure.
 */
 SAL_DLLPUBLIC void SAL_CALL osl_getHostnameOfHostAddr(const oslHostAddr Addr, 
rtl_uString **strHostname);
 
diff --git a/include/osl/socket_decl.hxx b/include/osl/socket_decl.hxx
index de6442b273b2..1ff2bababa29 100644
--- a/include/osl/socket_decl.hxx
+++ b/include/osl/socket_decl.hxx
@@ -174,8 +174,10 @@ namespace osl
 static inline ::rtl::OUString SAL_CALL getLocalHostname( 
oslSocketResult *pResult = NULL);
 
 /** Tries to find an address for a host.
+
 @see osl_resolveHostname()
-@return A new created socket-address or 0 if the name could not be 
found.
+@param strHostName hostname
+@param Addr A newly created socket-address or 0 if the name could 
not be found.
 */
 static inline void SAL_CALL resolveHostname(
 const ::rtl::OUString & strHostName , SocketAddr & Addr );
diff --git a/include/rtl/alloc.h b/include/rtl/alloc.h
index 79a94704c222..4ce01cf1bcb4 100644
--- a/include/rtl/alloc.h
+++ b/include/rtl/alloc.h
@@ -68,8 +68,10 @@ SAL_DLLPUBLIC void * SAL_CALL rtl_reallocateMemory (
 
 
 /** Free memory.
+
+Memory is released, and the pointer is invalidated.
+
 @param[in] Ptr pointer to the previously allocated memory.
-@return none. Memory is released. Ptr is invalid.
  */
 SAL_DLLPUBLIC void SAL_CALL rtl_freeMemory (
 void * Ptr
@@ -103,10 +105,12 @@ SAL_DLLPUBLIC void SAL_CALL rtl_secureZeroMemory (
 
 
 /** Zero and free memory.
+
+Memory is zero'ed with rtl_secureZeroMemory() and released.
+The original pointer is no longer valid.
+
 @param[in] Ptr   pointer to the previously allocated memory.
 @param[in] Bytes memory size.
-@return none. Memory is zero'ed with rtl_secureZeroMemory() and released.
-  Ptr is invalid.
  */
 SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory (
 void *   Ptr,
@@ -136,8 +140,9 @@ SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory (
 
 /** Free memory allocated with rtl_allocateAlignedMemory().
 
+Memory is released, and the pointer invalidated.
+
 @param[in] Ptr pointer to the previously allo

[Libreoffice-commits] core.git: .git-blame-ignore-revs

2022-07-04 Thread Chris Sherlock (via logerrit)
 .git-blame-ignore-revs |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 591b9daf8cf89dc4e7a01cec9bf9623747094a3d
Author: Chris Sherlock 
AuthorDate: Sun Jul 3 02:47:32 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Mon Jul 4 09:09:50 2022 +0200

tdf#123936 Add formatting commit to .git-blame-ignore-revs

We need to ignore commit e02a7a55c23d:

"registry: remove unnecessary comments"

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

diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 7298b0ab85b6..3da2ece0c59f 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -128,4 +128,5 @@ dd6e0ab30a120512e39f0d9b2e422243deae7b5f
 4391c275df68b409a9bf7295934350bffd1abc00
 80139bf7977d2e78e3c619956813893f5933f929
 e05af8af958c9caa4bb7a4f6d8600ddf0a22c54b
-b53fa6344d033f8b8f03b9274dbdd811251c2c1a
\ No newline at end of file
+b53fa6344d033f8b8f03b9274dbdd811251c2c1a
+e02a7a55c23d23dd7afa2627a7e10c70e1cba001


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

2022-07-04 Thread Chris Sherlock (via logerrit)
 include/registry/reader.hxx |5 +
 include/registry/refltype.hxx   |5 +
 include/registry/regdllapi.h|5 +
 include/registry/regtype.h  |5 +
 include/registry/typereg_reader.hxx |5 +
 include/registry/types.hxx  |5 +
 include/registry/version.h  |5 +
 registry/source/reflcnst.hxx|6 +-
 registry/source/regimpl.hxx |5 +
 registry/source/regkey.hxx  |5 +
 10 files changed, 10 insertions(+), 41 deletions(-)

New commits:
commit 6952be913510c63716940648a06163c19622187e
Author: Chris Sherlock 
AuthorDate: Sun Jan 9 06:34:39 2022 +1100
Commit: Stephan Bergmann 
CommitDate: Mon Jul 4 10:07:17 2022 +0200

tdf#143148 registry: Use pragma once instead of include guards

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

diff --git a/include/registry/reader.hxx b/include/registry/reader.hxx
index b804ba3ed559..27b3cb50e8d7 100644
--- a/include/registry/reader.hxx
+++ b/include/registry/reader.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_READER_HXX
-#define INCLUDED_REGISTRY_READER_HXX
+#pragma once
 
 #include 
 #include 
@@ -601,6 +600,4 @@ private:
 
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/refltype.hxx b/include/registry/refltype.hxx
index 5278e37c01b5..14fc81fe88a7 100644
--- a/include/registry/refltype.hxx
+++ b/include/registry/refltype.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_REFLTYPE_HXX
-#define INCLUDED_REGISTRY_REFLTYPE_HXX
+#pragma once
 
 #include 
 #include 
@@ -47,6 +46,4 @@ public:
 /// specifies the calling convention for type reader/writer api
 #define TYPEREG_CALLTYPE SAL_CALL
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regdllapi.h b/include/registry/regdllapi.h
index 603eea11dba8..4a324e93cb04 100644
--- a/include/registry/regdllapi.h
+++ b/include/registry/regdllapi.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_REGDLLAPI_H
-#define INCLUDED_REGISTRY_REGDLLAPI_H
+#pragma once
 
 #include 
 
@@ -28,6 +27,4 @@
 #define REG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
 #endif
 
-#endif // INCLUDED_REGISTRY_REGDLLAPI_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/regtype.h b/include/registry/regtype.h
index 89fdcc940aaf..8b72931d3847 100644
--- a/include/registry/regtype.h
+++ b/include/registry/regtype.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_REGTYPE_H
-#define INCLUDED_REGISTRY_REGTYPE_H
+#pragma once
 
 #include 
 #include 
@@ -136,6 +135,4 @@ enum class SAL_DLLPUBLIC_RTTI RegError
 /// specify the calling convention for the registry API
 #define REGISTRY_CALLTYPE SAL_CALL
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/typereg_reader.hxx 
b/include/registry/typereg_reader.hxx
index a0af800f0527..88d683c7dd34 100644
--- a/include/registry/typereg_reader.hxx
+++ b/include/registry/typereg_reader.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_READER_H
-#define INCLUDED_REGISTRY_READER_H
+#pragma once
 
 #include 
 #include 
@@ -560,6 +559,4 @@ REG_DLLPUBLIC RTReferenceType 
typereg_reader_getReferenceSort(
 REG_DLLPUBLIC void typereg_reader_getReferenceTypeName(
 void * handle, rtl_uString ** result, sal_uInt16 index);
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/types.hxx b/include/registry/types.hxx
index a9763f5ea6bb..820e342a7323 100644
--- a/include/registry/types.hxx
+++ b/include/registry/types.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_TYPES_H
-#define INCLUDED_REGISTRY_TYPES_H
+#pragma once
 
 #include 
 #include 
@@ -334,6 +333,4 @@ enum class RTReferenceType
 TYPE_PARAMETER
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/registry/version.h b/include/registry/version.h
index b7c066d4177f..59988d7cdcdb 100644
--- a/include/registry/version.h
+++ b/include/registry/version.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_REGISTRY_VERSION_H
-#define INCLUDED_REGISTRY_VERSION_H
+#pragma once
 
 #include 
 
@@ -64,6 +63,4 @@ enum typereg_Version {
 }
 #endif
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx
index 529d02f9d68a

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

2022-07-04 Thread Chris Sherlock (via logerrit)
 store/source/lockbyte.hxx |5 +
 store/source/object.hxx   |5 +
 store/source/storbase.hxx |5 +
 store/source/stortree.hxx |5 +
 4 files changed, 4 insertions(+), 16 deletions(-)

New commits:
commit c28455b899fa7e9d88f843cd59663aa522a28a33
Author: Chris Sherlock 
AuthorDate: Sun Jan 9 06:29:09 2022 +1100
Commit: Julien Nabet 
CommitDate: Sun Jul 3 09:13:11 2022 +0200

tdf#143148 store: Use pragma once instead of include guards

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

diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx
index 04634328a922..41c6145f1674 100644
--- a/store/source/lockbyte.hxx
+++ b/store/source/lockbyte.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
-#define INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
+#pragma once
 
 #include 
 
@@ -152,6 +151,4 @@ storeError MemoryLockBytes_createInstance (
 
 } // namespace store
 
-#endif // INCLUDED_STORE_SOURCE_LOCKBYTE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/store/source/object.hxx b/store/source/object.hxx
index b450d7446ff4..c68f9b8f8a11 100644
--- a/store/source/object.hxx
+++ b/store/source/object.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_STORE_SOURCE_OBJECT_HXX
-#define INCLUDED_STORE_SOURCE_OBJECT_HXX
+#pragma once
 
 #include 
 #include 
@@ -52,6 +51,4 @@ store_handle_type* SAL_CALL query(OStoreObject* pHandle, 
store_handle_type*);
 
 } // namespace store
 
-#endif // INCLUDED_STORE_SOURCE_OBJECT_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 20f6f3245638..4963ee2ddcfb 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_STORE_SOURCE_STORBASE_HXX
-#define INCLUDED_STORE_SOURCE_STORBASE_HXX
+#pragma once
 
 #include 
 #include 
@@ -605,6 +604,4 @@ inline sal_uInt32 OStorePageObject::location() const
 
 } // namespace store
 
-#endif // INCLUDED_STORE_SOURCE_STORBASE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/store/source/stortree.hxx b/store/source/stortree.hxx
index 9eeb8dfcae4e..609d1d1ba8d3 100644
--- a/store/source/stortree.hxx
+++ b/store/source/stortree.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_STORE_SOURCE_STORTREE_HXX
-#define INCLUDED_STORE_SOURCE_STORTREE_HXX
+#pragma once
 
 #include 
 
@@ -246,6 +245,4 @@ private:
 
 } // namespace store
 
-#endif // INCLUDED_STORE_SOURCE_STORTREE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


Re: Tools module geometry classes

2022-06-30 Thread Chris Sherlock
On Thu, Jun 30, 2022 at 8:08 PM Chris Sherlock 
wrote:

>
>
> On Thu, Jun 30, 2022 at 6:16 PM Chris Sherlock 
> wrote:
>
>>
>>
>> On Wed, Jun 29, 2022 at 7:37 PM Luboš Luňák 
>> wrote:
>>
>>>  So I think a good question to ask is what it is you want to achieve and
>>> how
>>> much time and energy are you willing to spend on it. I don't want to
>>> demoralize or stop you, it certainly would be really nice if this
>>> madness
>>> finally got sorted out, it's just that it hasn't got sorted out yet
>>> because
>>> nobody so far has been willing to give it all the effort it'd need.
>>>
>>
>> I'd be happy to work on it. I'd like to see us remove this confusion and
>> use the basegfx module.
>>
>> I'll update the patch to use GetOpenWidth() as a start.
>>
>> Chris
>>
>
> Does anyone know if com::sun::star::awt::Rectangle uses half-open or
> closed intervals?
>
> Chris
>

Sorry, silly question.

Chris


Re: Tools module geometry classes

2022-06-30 Thread Chris Sherlock
On Thu, Jun 30, 2022 at 6:16 PM Chris Sherlock 
wrote:

>
>
> On Wed, Jun 29, 2022 at 7:37 PM Luboš Luňák  wrote:
>
>>  So I think a good question to ask is what it is you want to achieve and
>> how
>> much time and energy are you willing to spend on it. I don't want to
>> demoralize or stop you, it certainly would be really nice if this madness
>> finally got sorted out, it's just that it hasn't got sorted out yet
>> because
>> nobody so far has been willing to give it all the effort it'd need.
>>
>
> I'd be happy to work on it. I'd like to see us remove this confusion and
> use the basegfx module.
>
> I'll update the patch to use GetOpenWidth() as a start.
>
> Chris
>

Does anyone know if com::sun::star::awt::Rectangle uses half-open or closed
intervals?

Chris


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

2022-06-30 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 8f16718731ee47535a62e61af99b43a09626c65f
Author: Chris Sherlock 
AuthorDate: Sat Jul 20 15:55:15 2019 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 30 11:33:58 2022 +0200

vcl: clarify variable in Animation::Animation() loop

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

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 05924660fb16..b0270c194c95 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -53,8 +53,8 @@ Animation::Animation(const Animation& rAnimation)
 , mbIsInAnimation(false)
 , mbLoopTerminated(rAnimation.mbLoopTerminated)
 {
-for (auto const& i : rAnimation.maFrames)
-maFrames.emplace_back(new AnimationBitmap(*i));
+for (auto const& rFrame : rAnimation.maFrames)
+maFrames.emplace_back(new AnimationBitmap(*rFrame));
 
 maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
 mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
@@ -248,9 +248,13 @@ void Animation::Draw(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDest
 AnimationBitmap* pObj = maFrames[std::min(mnPos, nCount - 1)].get();
 
 if (rOut.GetConnectMetaFile() || (rOut.GetOutDevType() == OUTDEV_PRINTER))
+{
 maFrames[0]->maBitmapEx.Draw(, rDestPt, rDestSz);
+}
 else if (ANIMATION_TIMEOUT_ON_CLICK == pObj->mnWait)
+{
 pObj->maBitmapEx.Draw(, rDestPt, rDestSz);
+}
 else
 {
 const size_t nOldPos = mnPos;


Re: Tools module geometry classes

2022-06-30 Thread Chris Sherlock
On Wed, Jun 29, 2022 at 7:37 PM Luboš Luňák  wrote:

>  So I think a good question to ask is what it is you want to achieve and
> how
> much time and energy are you willing to spend on it. I don't want to
> demoralize or stop you, it certainly would be really nice if this madness
> finally got sorted out, it's just that it hasn't got sorted out yet
> because
> nobody so far has been willing to give it all the effort it'd need.
>

I'd be happy to work on it. I'd like to see us remove this confusion and
use the basegfx module.

I'll update the patch to use GetOpenWidth() as a start.

Chris


Re: Tools module geometry classes

2022-06-28 Thread Chris Sherlock
On Wed, Jun 29, 2022 at 9:06 AM Chris Sherlock 
wrote:

>
> On Mon, Jun 27, 2022 at 4:52 PM Miklos Vajna 
> wrote:
>
>> Hi Chris,
>>
>> On Mon, Jun 13, 2022 at 01:03:30PM +1000, Chris Sherlock <
>> chris.sherloc...@gmail.com> wrote:
>> > LibreOffice has seperate implementations for points, lines, rectangle,
>> polygons and polypolygons - one is in the tools module, and the other is in
>> the basegfx module.
>> >
>> > Are there any plans for deprecating the usage of the tools geometry
>> primitives? I understand it will be needed for deserialising some legacy
>> svm files, but is the intention to ever start replacing the tools
>> primitives with the basegfx primitives?
>>
>> The trouble with e.g. tools::Rectangle is that it can have both a closed
>> or a half-open interval, and you need to read the surrounding code to
>> understand which mode is in use. basegfx::B2IRange is explicitly closed.
>>
>> So it would help readability to go with basegfx::B2IRange everywhere,
>> but it's not an easy hack to do such conversions.
>>
>> Regards,
>>
>> Miklos
>>
>
> Thanks Miklos. I read the comment above the Rectangle header definition
> which starts with "Note: this class is a true marvel of engineering:
> because the author could not decide whether it's better to have a closed or
> half-open interval, they just implemented *both* in the same class!"
>
> What is the feasibility of changing this class to be only explicitly
> closed?
>
> Is this the main issue with not converting over to basegfx?
>
> Chris
>

A quick followup - I have changed the getWidth() and getHeight() functions
in tools::Rectangle to getHalfOpenWidth/getHalfOpenHeight() - it seems
needlessly confusing to have functions with the same name except
capitalizing the first letter (!!) and have differing functionality.

The gerrit commit is here:

https://gerrit.libreoffice.org/c/core/+/136575

Is this reasonable?

Chris


Re: Tools module geometry classes

2022-06-28 Thread Chris Sherlock
On Mon, Jun 27, 2022 at 4:52 PM Miklos Vajna  wrote:

> Hi Chris,
>
> On Mon, Jun 13, 2022 at 01:03:30PM +1000, Chris Sherlock <
> chris.sherloc...@gmail.com> wrote:
> > LibreOffice has seperate implementations for points, lines, rectangle,
> polygons and polypolygons - one is in the tools module, and the other is in
> the basegfx module.
> >
> > Are there any plans for deprecating the usage of the tools geometry
> primitives? I understand it will be needed for deserialising some legacy
> svm files, but is the intention to ever start replacing the tools
> primitives with the basegfx primitives?
>
> The trouble with e.g. tools::Rectangle is that it can have both a closed
> or a half-open interval, and you need to read the surrounding code to
> understand which mode is in use. basegfx::B2IRange is explicitly closed.
>
> So it would help readability to go with basegfx::B2IRange everywhere,
> but it's not an easy hack to do such conversions.
>
> Regards,
>
> Miklos
>

Thanks Miklos. I read the comment above the Rectangle header definition
which starts with "Note: this class is a true marvel of engineering:
because the author could not decide whether it's better to have a closed or
half-open interval, they just implemented *both* in the same class!"

What is the feasibility of changing this class to be only explicitly
closed?

Is this the main issue with not converting over to basegfx?

Chris


Re: Tools module geometry classes

2022-06-26 Thread Chris Sherlock
Anyone?

Sent from my iPhone

> On 13 Jun 2022, at 1:03 pm, Chris Sherlock  wrote:
> 
> LibreOffice has seperate implementations for points, lines, rectangle, 
> polygons and polypolygons - one is in the tools module, and the other is in 
> the basegfx module.
> 
> Are there any plans for deprecating the usage of the tools geometry 
> primitives? I understand it will be needed for deserialising some legacy svm 
> files, but is the intention to ever start replacing the tools primitives with 
> the basegfx primitives?
> 
> Chris
> 
> Sent from my iPhone


  1   2   3   4   5   6   7   8   9   10   >