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_Int32 nLen, const tools::Long nOrigLineWidth)
 {
 sal_Int32 nBreakPos = 

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, 
testBreakLines_hyphen_word_under_two_chars)
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
+

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(static_cast(-1),
+ device->GetTextBreak(sTestStr, 

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->GetFontSelectPattern());
 SalLayoutGlyphsImpl* pGlyphsImpl = pGlyphs ? pGlyphs->Impl(1) : nullptr;
 
+bool bHasUsedFallback = false;

[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());
+}
+
 CPPUNIT_TEST_FIXTURE(VclTextTest, testTextLayoutCache)
 {
 OUString sTestString = u"The quick brown fox\n 

[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 )


[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)
-break;
-}
-}
-while (nFirstContent < nLastContent);
-   

[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"");
-}
-}
+OUString aPath(rOrigStr);
+OUString aAbbreviatedPath;
+osl_abbreviateSystemPath(aPath.pData, , 
nIndex, nullptr);
+return aAbbreviatedPath;
+}
+}
 
-if ( 

[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 = "..." + aLastStr;
+if ( GetTextWidth( aTempLastStr1, 0, aTempLastStr1.getLength() ) > 
nMaxWidth )
 {
-OUString aPath( rOrigStr );
-OUString aAbbreviatedPath;
-

[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,
-   tools::Long nMaxWidth, 
DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
-
 

[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
 {
 if ( nFirstContent > 4 )
@@ -2108,7 +2108,7 @@ OUString OutputDevice::ImplGetEllipsisString( const 

[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/source/outdev/pixel.cxx 

[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::SetRelativeMapMode( const MapMode& 

[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()
+{
+try
+{
+VclPtrInstance pWin;
+

[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("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(), Size(52, 48)),
+ 

[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)


[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();


[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() : 
nullptr;
+AnimationFrame* pCurrentFrameBmp
+= (++mnFrameIndex < maFrames.size()) ? 
maFrames[mnFrameIndex].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


[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);


[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;


[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());
 


[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 

[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
--- 

[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 testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese();
 void 

[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 is a test~", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a test~"), sNonMnemonicString);

[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::isSimplifiedChinese(eLang))
+{
+nEmphasisMark |= FontEmphasisMark::PosBelow;
+}
+else
+{
+

[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 MID_HEIGHT: aVal.setHeight( nVal ); break;
+case MID_RECT_LEFT:  maVal.SetPosX( nVal ); break;
+case MID_RECT_RIGHT: maVal.SetPosY( nVal ); break;
+  

[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( -maSzPix.Height() );
+maDispPt.setY( maOriginPt.Y() + maLogicalSize.Height() + 1 );
+

[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 Point( rVal1.nA*nVal2, rVal1.nB*nVal2 );
+return Point( 

[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: */


[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 --include:module 

[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 MINZOOM = 20;
+const sal_uInt16 MAXZOOM = 400;
 
 const 

[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)
 accessibility/source/extended/AccessibleGridControlHeader.cxx |8 -
 chart2/source/controller/accessibility/AccessibleBase.cxx |2 
 chart2/source/controller/main/ChartController_Window.cxx  |6 
 chart2/source/controller/main/PositionAndSizeHelper.cxx   |   38 ++--
 dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx   |2 
 desktop/source/lib/init.cxx   |2 
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx   |4 
 filter/source/msfilter/msdffimp.cxx   |8 -
 framework/source/layoutmanager/toolbarlayoutmanager.cxx   |   80 +-
 include/tools/gen.hxx |   13 -
 oox/source/export/shapes.cxx  |4 
 oox/source/export/vmlexport.cxx   |2 
 reportdesign/source/core/sdr/RptObject.cxx|4 
 reportdesign/source/ui/misc/UITools.cxx   |6 
 reportdesign/source/ui/report/ReportController.cxx|2 
 reportdesign/source/ui/report/ReportSection.cxx   |   18 +-
 reportdesign/source/ui/report/ViewsWindow.cxx |   36 ++--
 sc/qa/unit/filters-test.cxx   |   12 -
 sc/qa/unit/jumbosheets-test.cxx   |8 -
 sc/qa/unit/subsequent_filters_test.cxx|4 
 sc/source/filter/xml/xmlexprt.cxx |   12 -
 sc/source/ui/view/tabview.cxx |2 
 sc/source/ui/view/tabview3.cxx|4 
 sd/qa/unit/misc-tests.cxx |2 
 sd/qa/unit/tiledrendering/tiledrendering.cxx  |   28 +--
 sd/source/ui/accessibility/AccessiblePageShape.cxx|4 
 sd/source/ui/animations/CustomAnimationList.cxx   |2 
 sd/source/ui/dlg/headerfooterdlg.cxx  |4 
 sd/source/ui/table/tablefunction.cxx  |8 -
 sd/source/ui/unoidl/unomodel.cxx  |2 
 sd/source/ui/view/drviewsh.cxx|4 
 sfx2/source/control/recentdocsview.cxx|2 
 sfx2/source/control/thumbnailviewitem.cxx |6 
 slideshow/source/engine/rehearsetimingsactivity.cxx   |4 
 svl/source/items/rectitem.cxx |8 -
 svtools/source/control/tabbar.cxx |6 
 svx/source/accessibility/AccessibleShape.cxx  |4 
 svx/source/customshapes/EnhancedCustomShape3d.cxx |8 -
 svx/source/sdr/contact/viewcontactofe3dscene.cxx  |4 
 svx/source/sdr/properties/defaultproperties.cxx   |4 
 svx/source/svdraw/svdedtv1.cxx|2 
 svx/source/svdraw/svdoashp.cxx|2 
 svx/source/table/accessiblecell.cxx   |2 
 svx/source/table/svdotable.cxx|6 
 svx/source/table/tablelayouter.cxx|   16 +-
 svx/source/tbxctrls/fontworkgallery.cxx   |2 
 svx/source/unodraw/unoshape.cxx   |2 
 sw/qa/extras/tiledrendering/tiledrendering.cxx|4 
 sw/qa/extras/uiwriter/uiwriter.cxx|2 
 sw/source/core/crsr/FormFieldButton.cxx   |2 
 sw/source/core/crsr/contentcontrolbutton.cxx  |2 
 sw/source/core/doc/textboxhelper.cxx  |   10 -
 sw/source/core/draw/dflyobj.cxx   |4 
 sw/source/filter/html/htmlflywriter.cxx   |4 
 sw/source/filter/ww8/docxsdrexport.cxx|   17 +-
 sw/source/filter/ww8/wrtw8esh.cxx |   12 -
 sw/source/uibase/docvw/HeaderFooterWin.cxx|2 
 sw/source/uibase/docvw/PageBreakWin.cxx   |4 
 toolkit/source/awt/vclxtoolkit.cxx|4 
 tools/qa/cppunit/test_rectangle.cxx   |   10 -
 tools/source/generic/gen.cxx  |5 
 vbahelper/source/vbahelper/vbahelper.cxx  |6 
 vcl/qa/cppunit/complextext.cxx|4 
 vcl/source/app/svapp.cxx  |2 
 vcl/source/control/button.cxx |2 
 vcl/source/control/combobox.cxx   |6 
 vcl/source/control/fixedhyper.cxx |4 
 vcl/source/control/imp_listbox.cxx|2 
 vcl/source/control/scrbar.cxx |4 
 vcl/source/filter/ipdf/pdfdocument.cxx  

[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() - 1;
-mnActPos = std::min( nPos, nLastPos );
-const 

[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.


[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 allocated memory.
-

[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 

[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: */


[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;


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

2022-06-21 Thread Chris Sherlock (via logerrit)
 io/source/stm/odata.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 2bf296ddd10f0a56bdf799712bac1ccb10ed8b72
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:09:08 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Tue Jun 21 21:16:26 2022 +0200

io: drop unnecessary cast

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

diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 754cda450a94..7d39a5835852 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -1094,7 +1093,7 @@ Reference< XPersistObject >  
OObjectInputStream::readObject()
 {
 // grow to the right size
 Reference< XPersistObject > xEmpty;
-m_aPersistVector.insert( m_aPersistVector.end(), 
static_cast(nId - nSize + 1), xEmpty );
+m_aPersistVector.insert( m_aPersistVector.end(), nId - 
nSize + 1, xEmpty );
 }
 
 m_aPersistVector[nId] = xLoadedObj;


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

2022-06-21 Thread Chris Sherlock (via logerrit)
 registry/source/keyimpl.cxx  |   57 
 registry/source/reflread.cxx |   53 +
 registry/source/registry.cxx |   42 ---
 registry/source/regkey.cxx   |   76 ---
 4 files changed, 3 insertions(+), 225 deletions(-)

New commits:
commit e02a7a55c23d23dd7afa2627a7e10c70e1cba001
Author: Chris Sherlock 
AuthorDate: Sun Jan 9 06:51:17 2022 +1100
Commit: Stephan Bergmann 
CommitDate: Tue Jun 21 20:22:34 2022 +0200

registry: remove unnecessary comments

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

diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index abf8e0d1ef12..37efeda82ff1 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -34,9 +34,6 @@ using namespace store;
 
 namespace { char const VALUE_PREFIX[] = "$VL_"; }
 
-
-//  ORegKey()
-
 ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg)
 : m_refCount(1)
 , m_name(keyName)
@@ -46,41 +43,26 @@ ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg)
 {
 }
 
-
-//  ~ORegKey()
-
 ORegKey::~ORegKey()
 {
 SAL_WARN_IF(m_refCount != 0, "registry", "registry::ORegKey::dtor(): 
refcount not zero.");
 }
 
-
-//  releaseKey
-
 RegError ORegKey::releaseKey(RegKeyHandle hKey)
 {
 return m_pRegistry->releaseKey(hKey);
 }
 
-
-//  createKey
-
 RegError ORegKey::createKey(std::u16string_view keyName, RegKeyHandle* 
phNewKey)
 {
 return m_pRegistry->createKey(this, keyName, phNewKey);
 }
 
-
-//  openKey
-
 RegError ORegKey::openKey(std::u16string_view keyName, RegKeyHandle* phOpenKey)
 {
 return m_pRegistry->openKey(this, keyName, phOpenKey);
 }
 
-
-//  openSubKeys
-
 RegError ORegKey::openSubKeys(std::u16string_view keyName, RegKeyHandle** 
phOpenSubKeys, sal_uInt32* pnSubKeys)
 {
 RegError _ret = RegError::NO_ERROR;
@@ -139,9 +121,6 @@ RegError ORegKey::openSubKeys(std::u16string_view keyName, 
RegKeyHandle** phOpen
 return RegError::NO_ERROR;
 }
 
-
-//  getKeyNames
-
 RegError ORegKey::getKeyNames(std::u16string_view keyName,
   rtl_uString*** pSubKeyNames,
   sal_uInt32* pnSubKeys)
@@ -196,25 +175,16 @@ RegError ORegKey::getKeyNames(std::u16string_view keyName,
 return RegError::NO_ERROR;
 }
 
-
-//  closeKey
-
 RegError ORegKey::closeKey(RegKeyHandle hKey)
 {
 return m_pRegistry->closeKey(hKey);
 }
 
-
-//  deleteKey
-
 RegError ORegKey::deleteKey(std::u16string_view keyName)
 {
 return m_pRegistry->deleteKey(this, keyName);
 }
 
-
-//  getValueType
-
 RegError ORegKey::getValueInfo(std::u16string_view valueName, RegValueType* 
pValueType, sal_uInt32* pValueSize) const
 {
 OStoreStreamrValue;
@@ -267,9 +237,6 @@ RegError ORegKey::getValueInfo(std::u16string_view 
valueName, RegValueType* pVal
 return RegError::NO_ERROR;
 }
 
-
-//  setValue
-
 RegError ORegKey::setValue(std::u16string_view valueName, RegValueType vType, 
RegValue value, sal_uInt32 vSize)
 {
 OStoreStreamrValue;
@@ -338,9 +305,6 @@ RegError ORegKey::setValue(std::u16string_view valueName, 
RegValueType vType, Re
 return RegError::NO_ERROR;
 }
 
-
-//  setLongListValue
-
 RegError ORegKey::setLongListValue(std::u16string_view valueName, sal_Int32 
const * pValueList, sal_uInt32 len)
 {
 OStoreStreamrValue;
@@ -393,9 +357,6 @@ RegError ORegKey::setLongListValue(std::u16string_view 
valueName, sal_Int32 cons
 return RegError::NO_ERROR;
 }
 
-
-//  setStringListValue
-
 RegError ORegKey::setStringListValue(
 std::u16string_view valueName, char** pValueList, sal_uInt32 len)
 {
@@ -458,9 +419,6 @@ RegError ORegKey::setStringListValue(
 return RegError::NO_ERROR;
 }
 
-
-//  setUnicodeListValue
-
 RegError ORegKey::setUnicodeListValue(std::u16string_view valueName, 
sal_Unicode** pValueList, sal_uInt32 len)
 {
 OStoreStreamrValue;
@@ -522,9 +480,6 @@ RegError ORegKey::setUnicodeListValue(std::u16string_view 
valueName, sal_Unicode
 return RegError::NO_ERROR;
 }
 
-
-//  getValue
-
 RegError ORegKey::getValue(std::u16string_view valueName, RegValue value) const
 {
 OStoreStreamrValue;
@@ -601,9 +556,6 @@ RegError ORegKey::getValue(std::u16string_view valueName, 
RegValue value) const
 return RegError::NO_ERROR;
 }
 
-
-//  getLongListValue
-
 RegError ORegKey::getLongListValue(std::u16string_view valueName, sal_Int32** 
pValueList, sal_uInt32* pLen) const
 {
 OStoreStreamrValue;
@@ -704,9 +656,6 @@ RegError ORegKey::getLongListValue(std::u16string_view 
valueName, sal_Int32** pV
 return RegError::NO_ERROR;
 }
 
-
-//  getStringListValue
-
 RegError ORegKey::getStringListValue(std::u16string_view valueName, char*** 
pValueList, sal_uInt32* pLen) const
 {
 OStoreStreamrValue;
@@ -801,9 +750,6 @@ RegError 

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

2022-06-20 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx|4 ++--
 sw/inc/ndgrf.hxx |6 +++---
 vcl/inc/animate/AnimationRenderer.hxx|8 
 vcl/inc/impgraph.hxx |4 ++--
 vcl/source/animate/Animation.cxx |   18 ++
 vcl/source/animate/AnimationRenderer.cxx |   10 +-
 vcl/source/gdi/graph.cxx |8 
 vcl/source/gdi/impgraph.cxx  |8 
 vcl/source/graphic/GraphicObject.cxx |8 
 9 files changed, 38 insertions(+), 36 deletions(-)

New commits:
commit 903403c1e3d5c0f882189fa87ed2b19c16a9893e
Author: Chris Sherlock 
AuthorDate: Sat Jun 18 16:18:37 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jun 21 07:48:58 2022 +0200

vcl: rename mnExtraData to mnRendererId

The name "extra data" doesn't really describe what this field does. What
it actually does it to specify what animation renderer should be used.

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 57f1c9d6227e..2df9f51d0221 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -43,9 +43,9 @@ public:
 void Clear();
 
 bool Start(OutputDevice& rOutDev, const Point& rDestPt, const Size& 
rDestSz,
-   tools::Long nExtraData, OutputDevice* pFirstFrameOutDev);
+   tools::Long nRendererId, OutputDevice* pFirstFrameOutDev);
 
-void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nExtraData = 
0);
+void Stop(const OutputDevice* pOutDev = nullptr, tools::Long nRendererId = 
0);
 
 void Draw(OutputDevice& rOutDev, const Point& rDestPt) const;
 void Draw(OutputDevice& rOutDev, const Point& rDestPt, const Size& 
rDestSz) const;
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index 391dc82d6623..418b3b49d0c9 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -83,9 +83,9 @@ public:
 void TriggerGraphicArrived();
 
 /// wrappers for non-const calls at GraphicObject
-void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const 
Size& rSz, tools::Long nExtraData, OutputDevice* pFirstFrameOutDev)
-{ maGrfObj.StartAnimation(*pOut, rPt, rSz, nExtraData, pFirstFrameOutDev); 
}
-void StopGraphicAnimation(const OutputDevice* pOut, tools::Long 
nExtraData) { maGrfObj.StopAnimation(pOut, nExtraData); }
+void StartGraphicAnimation(OutputDevice* pOut, const Point& rPt, const 
Size& rSz, tools::Long nRendererId, OutputDevice* pFirstFrameOutDev)
+{ maGrfObj.StartAnimation(*pOut, rPt, rSz, nRendererId, 
pFirstFrameOutDev); }
+void StopGraphicAnimation(const OutputDevice* pOut, tools::Long 
nRendererId) { maGrfObj.StopAnimation(pOut, nRendererId); }
 
 virtual Size GetTwipSize() const override;
 void SetTwipSize( const Size& rSz );
diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index a9fc425e20bb..c7fc42a55aa3 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -34,7 +34,7 @@ struct AInfo
 SizeaStartSize;
 VclPtr   pOutDev;
 void*   pRendererData;
-tools::LongnExtraData;
+tools::Long nRendererId;
 boolbPause;
 
 AInfo();
@@ -49,7 +49,7 @@ private:
 
 Animation*  mpParent;
 VclPtr  mpRenderContext;
-tools::LongmnExtraData;
+tools::Long mnRendererId;
 Point   maPt;
 Point   maDispPt;
 Point   maRestPt;
@@ -69,12 +69,12 @@ private:
 
 public:
 AnimationRenderer( Animation* pParent, OutputDevice* pOut,
-  const Point& rPt, const Size& rSz, sal_uLong 
nExtraData,
+  const Point& rPt, const Size& rSz, sal_uLong 
nRendererId,
   OutputDevice* pFirstFrameOutDev = nullptr );
 AnimationRenderer(AnimationRenderer&&) = delete;
 ~AnimationRenderer();
 
-boolmatches(const OutputDevice* pOut, tools::Long nExtraData) 
const;
+boolmatches(const OutputDevice* pOut, tools::Long nRendererId) 
const;
 voiddrawToPos( sal_uLong nPos );
 voiddraw( sal_uLong nPos, VirtualDevice* pVDev=nullptr );
 voidrepaint();
diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 81db551e4f49..dbeee7208c9d 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -166,10 +166,10 @@ private:
 voidstartAnimation(OutputDevice& rOutDev,
const Point& rDestPt,
const Size& rDestSize,
-   

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

2022-06-20 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx|4 -
 solenv/clang-format/excludelist  |4 -
 vcl/CppunitTest_vcl_animation.mk |2 
 vcl/Library_vcl.mk   |2 
 vcl/inc/animate/AnimationRenderer.hxx|   15 ++---
 vcl/qa/cppunit/animationrenderer.cxx |   46 
 vcl/source/animate/Animation.cxx |   89 ---
 vcl/source/animate/AnimationRenderer.cxx |   20 +++---
 8 files changed, 93 insertions(+), 89 deletions(-)

New commits:
commit a98b0037c6116ed7a0f4f426571bbb361cf2e62f
Author: Chris Sherlock 
AuthorDate: Sat May 28 12:04:32 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jun 21 07:47:29 2022 +0200

vcl: rename ImplAnimView to AnimationRenderer

An ImplAnimView is actually just a way of rendering an animation to an
OutputDevice (RenderContext). Each instance has a unique ID (called
mnExraData, which is quite misleading). ImplAnimView doesn't really
mean much so hence the rename to make this a bit more clear.

In the process, also rename local variables pView to pRenderer in
Animation functions.

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 809b8eac434d..57f1c9d6227e 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -27,7 +27,7 @@
 
 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
 
-class ImplAnimView;
+class AnimationRenderer;
 
 class VCL_DLLPUBLIC Animation
 {
@@ -97,7 +97,7 @@ private:
 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
 
 std::vector> maFrames;
-std::vector> maViewList;
+std::vector> maRenderers;
 
 Link maNotifyLink;
 BitmapEx maBitmapEx;
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 9b508e79ec69..2b91f820013d 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14300,6 +14300,7 @@ vcl/inc/WidgetThemeLibraryTypes.hxx
 vcl/inc/bitmap/bmpfast.hxx
 vcl/inc/accel.hxx
 vcl/inc/accmgr.hxx
+vcl/inc/animate/AnimationRenderer.hxx
 vcl/inc/brdwin.hxx
 vcl/inc/bubblewindow.hxx
 vcl/inc/calendar.hxx
@@ -14330,7 +14331,6 @@ vcl/inc/helpwin.hxx
 vcl/inc/hyperlabel.hxx
 vcl/inc/image.h
 vcl/inc/imagerepository.hxx
-vcl/inc/impanmvw.hxx
 vcl/inc/impdel.hxx
 vcl/inc/impfont.hxx
 vcl/inc/impfontcache.hxx
@@ -14655,6 +14655,7 @@ vcl/quartz/salgdi.cxx
 vcl/quartz/salgdicommon.cxx
 vcl/quartz/salvd.cxx
 vcl/quartz/utils.cxx
+vcl/source/animate/AnimationRenderer.cxx
 vcl/source/app/IconThemeInfo.cxx
 vcl/source/app/IconThemeScanner.cxx
 vcl/source/app/IconThemeSelector.cxx
@@ -14840,7 +14841,6 @@ vcl/source/gdi/gradient.cxx
 vcl/source/gdi/graph.cxx
 vcl/source/gdi/graphictools.cxx
 vcl/source/gdi/hatch.cxx
-vcl/source/gdi/impanmvw.cxx
 vcl/source/gdi/impgraph.cxx
 vcl/source/gdi/impvect.hxx
 vcl/source/gdi/jobset.cxx
diff --git a/vcl/CppunitTest_vcl_animation.mk b/vcl/CppunitTest_vcl_animation.mk
index 659fdbe819ce..3881005e6d4b 100644
--- a/vcl/CppunitTest_vcl_animation.mk
+++ b/vcl/CppunitTest_vcl_animation.mk
@@ -15,7 +15,7 @@ $(eval $(call gb_CppunitTest_set_include,vcl_animation,\
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_animation, \
-   vcl/qa/cppunit/implanimview \
+   vcl/qa/cppunit/animationrenderer \
vcl/qa/cppunit/animation \
 ))
 
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6910927bfde0..5688f1f22ecc 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -101,6 +101,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/skia/SkiaHelper \
 vcl/source/animate/Animation \
 vcl/source/animate/AnimationBitmap \
+vcl/source/animate/AnimationRenderer \
 vcl/source/cnttype/mcnttfactory \
 vcl/source/cnttype/mcnttype \
 vcl/source/printer/Options \
@@ -275,7 +276,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/gdi/graph \
 vcl/source/gdi/graphictools \
 vcl/source/gdi/hatch \
-vcl/source/gdi/impanmvw \
 vcl/source/gdi/impglyphitem \
 vcl/source/gdi/impgraph \
 vcl/source/gdi/jobset \
diff --git a/vcl/inc/impanmvw.hxx b/vcl/inc/animate/AnimationRenderer.hxx
similarity index 89%
rename from vcl/inc/impanmvw.hxx
rename to vcl/inc/animate/AnimationRenderer.hxx
index 5323afbccebc..a9fc425e20bb 100644
--- a/vcl/inc/impanmvw.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX
-#define INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX
+#pragma once
 
 #include 
 #include 
@@ -34,7 +33,7 @@ struct AInfo
 Point   aStartOrg;
 SizeaStartSize;
 VclPtr   pOutDev;
-void*   pViewData;
+void*   pRendererData;
   

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

2022-06-20 Thread Chris Sherlock (via logerrit)
 include/store/store.hxx   |   36 --
 store/source/lockbyte.cxx |   25 --
 store/source/object.cxx   |8 --
 store/source/object.hxx   |4 -
 store/source/storbase.cxx |   25 --
 store/source/storbios.cxx |  165 +++---
 store/source/storbios.hxx |   28 +--
 store/source/storcach.cxx |   25 +-
 store/source/storcach.hxx |9 --
 store/source/stordata.cxx |   56 ---
 store/source/stordir.cxx  |   28 ---
 store/source/stordir.hxx  |8 --
 store/source/store.cxx|   53 --
 store/source/storlckb.cxx |   27 ---
 store/source/storlckb.hxx |6 -
 store/source/storpage.cxx |   15 
 store/source/storpage.hxx |3 
 store/source/stortree.cxx |   42 ---
 store/source/stortree.hxx |   36 --
 19 files changed, 62 insertions(+), 537 deletions(-)

New commits:
commit 983aa4a107bac672497f07b0bbbc752126af2d2a
Author: Chris Sherlock 
AuthorDate: Sun Jan 9 06:22:41 2022 +1100
Commit: Stephan Bergmann 
CommitDate: Mon Jun 20 08:54:08 2022 +0200

store: remove useless comments from store

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

diff --git a/include/store/store.hxx b/include/store/store.hxx
index d32ceefbe76b..ada5579f3660 100644
--- a/include/store/store.hxx
+++ b/include/store/store.hxx
@@ -30,22 +30,16 @@ namespace store
 class OStoreStream
 {
 public:
-/** Construction.
- */
 OStoreStream()
 : m_hImpl (nullptr)
 {}
 
-/** Destruction.
- */
 ~OStoreStream()
 {
 if (m_hImpl)
 (void) store_releaseHandle (m_hImpl);
 }
 
-/** Copy construction.
- */
 OStoreStream (OStoreStream const & rhs)
 : m_hImpl (rhs.m_hImpl)
 {
@@ -53,8 +47,6 @@ public:
 (void) store_acquireHandle (m_hImpl);
 }
 
-/** Assignment.
- */
 OStoreStream & operator= (OStoreStream const & rhs)
 {
 if (rhs.m_hImpl)
@@ -113,30 +105,22 @@ public:
 }
 
 private:
-/** Representation.
- */
 storeStreamHandle m_hImpl;
 };
 
 class OStoreDirectory
 {
 public:
-/** Construction.
- */
 OStoreDirectory()
 : m_hImpl (nullptr)
 {}
 
-/** Destruction.
- */
 ~OStoreDirectory()
 {
 if (m_hImpl)
 (void) store_releaseHandle (m_hImpl);
 }
 
-/** Copy construction.
- */
 OStoreDirectory (OStoreDirectory const & rhs)
 : m_hImpl (rhs.m_hImpl)
 {
@@ -144,16 +128,12 @@ public:
 (void) store_acquireHandle (m_hImpl);
 }
 
-/** Move construction.
- */
 OStoreDirectory (OStoreDirectory && rhs) noexcept
 : m_hImpl (rhs.m_hImpl)
 {
 rhs.m_hImpl = nullptr;
 }
 
-/** Assignment.
- */
 OStoreDirectory & operator= (OStoreDirectory const & rhs)
 {
 if (rhs.m_hImpl)
@@ -164,8 +144,6 @@ public:
 return *this;
 }
 
-/** Move assignment.
- */
 OStoreDirectory & operator= (OStoreDirectory && rhs) noexcept
 {
 if (m_hImpl)
@@ -221,30 +199,22 @@ public:
 }
 
 private:
-/** Representation.
- */
 storeDirectoryHandle m_hImpl;
 };
 
 class OStoreFile
 {
 public:
-/** Construction.
- */
 OStoreFile()
 : m_hImpl (nullptr)
 {}
 
-/** Destruction.
- */
 ~OStoreFile()
 {
 if (m_hImpl)
 (void) store_releaseHandle (m_hImpl);
 }
 
-/** Copy construction.
- */
 OStoreFile (OStoreFile const & rhs)
 : m_hImpl (rhs.m_hImpl)
 {
@@ -252,8 +222,6 @@ public:
 (void) store_acquireHandle (m_hImpl);
 }
 
-/** Assignment.
- */
 OStoreFile & operator= (OStoreFile const & rhs)
 {
 if (rhs.m_hImpl)
@@ -264,8 +232,6 @@ public:
 return *this;
 }
 
-/** Conversion into File Handle.
- */
 operator storeFileHandle() const
 {
 return m_hImpl;
@@ -343,8 +309,6 @@ public:
 }
 
 private:
-/** Representation.
- */
 storeFileHandle m_hImpl;
 };
 
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 4a163fff6c9f..87aefdbe4185 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -34,12 +34,6 @@
 
 using namespace store;
 
-/*
- *
- * ILockBytes (non-virtual interface) implementation.
- *
- *==*/
-
 storeError ILockBytes::initialize (rtl::Reference< PageData::Allocator > & 
rxAllocator, sal_uInt16 nPageSize)
 {
 OSL_PRECOND((STORE_MINIMUM_PAGESIZE <= nPageSize) && (nPageSize <= 
STORE_MAXIMUM_PAGESIZE), "invalid PageSize");
@@ -135,11 +129,6 @@ storeError ILockBytes::flush()
 return flush_Impl();
 }
 

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

2022-06-15 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |6 +-
 vcl/source/animate/Animation.cxx  |   91 +++---
 2 files changed, 49 insertions(+), 48 deletions(-)

New commits:
commit 7e81b2292fa881f5c6efecd259fbbb82a1c75759
Author: Chris Sherlock 
AuthorDate: Sat May 21 03:09:27 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 15 15:28:03 2022 +0200

vcl: change maList in Animation to maFrames

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

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 94cefee2e570..809b8eac434d 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -66,8 +66,8 @@ public:
 void SetNotifyHdl(const Link& rLink) { maNotifyLink = 
rLink; }
 const Link& GetNotifyHdl() const { return maNotifyLink; }
 
-std::vector>& GetAnimationFrames() { 
return maList; }
-size_t Count() const { return maList.size(); }
+std::vector>& GetAnimationFrames() { 
return maFrames; }
+size_t Count() const { return maFrames.size(); }
 bool Insert(const AnimationBitmap& rAnimationBitmap);
 const AnimationBitmap& Get(sal_uInt16 nAnimation) const;
 void Replace(const AnimationBitmap& rNewAnimationBmp, sal_uInt16 
nAnimation);
@@ -96,7 +96,7 @@ public:
 private:
 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
 
-std::vector> maList;
+std::vector> maFrames;
 std::vector> maViewList;
 
 Link maNotifyLink;
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index ae7fc1a214fb..e1086cd8d3eb 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.maList)
-maList.emplace_back(new AnimationBitmap(*i));
+for (auto const& i : rAnimation.maFrames)
+maFrames.emplace_back(new AnimationBitmap(*i));
 
 maTimer.SetInvokeHandler(LINK(this, Animation, ImplTimeoutHdl));
 mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
@@ -72,8 +72,8 @@ Animation& Animation::operator=(const Animation& rAnimation)
 {
 Clear();
 
-for (auto const& i : rAnimation.maList)
-maList.emplace_back(new AnimationBitmap(*i));
+for (auto const& i : rAnimation.maFrames)
+maFrames.emplace_back(new AnimationBitmap(*i));
 
 maGlobalSize = rAnimation.maGlobalSize;
 maBitmapEx = rAnimation.maBitmapEx;
@@ -87,9 +87,9 @@ Animation& Animation::operator=(const Animation& rAnimation)
 
 bool Animation::operator==(const Animation& rAnimation) const
 {
-return maList.size() == rAnimation.maList.size() && maBitmapEx == 
rAnimation.maBitmapEx
+return maFrames.size() == rAnimation.maFrames.size() && maBitmapEx == 
rAnimation.maBitmapEx
&& maGlobalSize == rAnimation.maGlobalSize
-   && std::equal(maList.begin(), maList.end(), 
rAnimation.maList.begin(),
+   && std::equal(maFrames.begin(), maFrames.end(), 
rAnimation.maFrames.begin(),
  [](const std::unique_ptr& pAnim1,
 const std::unique_ptr& pAnim2) -> 
bool {
  return *pAnim1 == *pAnim2;
@@ -102,7 +102,7 @@ void Animation::Clear()
 mbIsInAnimation = false;
 maGlobalSize = Size();
 maBitmapEx.SetEmpty();
-maList.clear();
+maFrames.clear();
 maViewList.clear();
 }
 
@@ -116,7 +116,7 @@ bool Animation::IsTransparent() const
 // graphics due to performance reasons.
 
 return maBitmapEx.IsAlpha()
-   || std::any_of(maList.begin(), maList.end(),
+   || std::any_of(maFrames.begin(), maFrames.end(),
   [](const std::unique_ptr& 
pAnim) -> bool {
   return pAnim->meDisposal == Disposal::Back
  && tools::Rectangle{ 
pAnim->maPositionPixel,
@@ -129,7 +129,7 @@ sal_uLong Animation::GetSizeBytes() const
 {
 sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes();
 
-for (auto const& pAnimationBitmap : maList)
+for (auto const& pAnimationBitmap : maFrames)
 {
 nSizeBytes += pAnimationBitmap->maBitmapEx.GetSizeBytes();
 }
@@ -143,7 +143,7 @@ BitmapChecksum Animation::GetChecksum() const
 BitmapChecksumOctetArray aBCOA;
 BitmapChecksum nCrc = GetBitmapEx().GetChecksum();
 
-UInt32ToSVBT32(maList.size(), aBT32);
+UInt32ToSVBT32(maFrames.size(), aBT32);
 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
 
 Int32ToSVBT32(maGlobalSize.Width(), aBT32);
@@ -152,7 +152,7 @@ BitmapChecksum Animation::GetChecksum() const
 Int32ToSVBT32(maGlobalSize.Height(), aBT32);
 nCrc = vcl_get_checksum(nCrc, aBT32, 4);
 
-for (auto const& i : 

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

2022-05-20 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/eps.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6d2753da83f6f6a953622163f05263993e7915f5
Author: Chris Sherlock 
AuthorDate: Sun May 8 18:24:27 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri May 20 08:05:02 2022 +0200

vcl: move bDrawn variable closer to where it is first used in DrawEPS()

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

diff --git a/vcl/source/outdev/eps.cxx b/vcl/source/outdev/eps.cxx
index f65c8aa97217..e3512652bbb0 100644
--- a/vcl/source/outdev/eps.cxx
+++ b/vcl/source/outdev/eps.cxx
@@ -27,8 +27,6 @@
 bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
 const GfxLink& rGfxLink, GDIMetaFile* pSubst )
 {
-bool bDrawn(true);
-
 if ( mpMetaFile )
 {
 GDIMetaFile aSubst;
@@ -40,13 +38,15 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const 
Size& rSize,
 }
 
 if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
-return bDrawn;
+return true;
 
 if( mbOutputClipped )
-return bDrawn;
+return true;
 
 tools::Rectangle aRect( ImplLogicToDevicePixel( tools::Rectangle( rPoint, 
rSize ) ) );
 
+bool bDrawn = true;
+
 if( !aRect.IsEmpty() )
 {
 // draw the real EPS graphics


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

2022-05-19 Thread Chris Sherlock (via logerrit)
 include/registry/typereg_reader.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8a62f0a2124299709e3cce0463cc6ac2c2a9b12c
Author: Chris Sherlock 
AuthorDate: Sun Jan 9 06:12:36 2022 +1100
Commit: Stephan Bergmann 
CommitDate: Thu May 19 08:10:40 2022 +0200

registry: fix some documentation

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

diff --git a/include/registry/typereg_reader.hxx 
b/include/registry/typereg_reader.hxx
index f6aa5f59b61c..a0af800f0527 100644
--- a/include/registry/typereg_reader.hxx
+++ b/include/registry/typereg_reader.hxx
@@ -139,7 +139,7 @@ REG_DLLPUBLIC RTTypeClass typereg_reader_getTypeClass(void 
* handle);
@param handle a handle on a type reader; may be null
 
@return whether the type reader is published; if handle is 
null,
-   sal_False is returned
+   false is returned
 
@since UDK 3.2.0
  */


[Libreoffice-commits] core.git: 2 commits - store/CppunitTest_store.mk store/Module_store.mk store/qa sw/source sw/uiconfig

2022-05-16 Thread Chris Sherlock (via logerrit)
 store/CppunitTest_store.mk  |   22 +++
 store/Module_store.mk   |4 
 store/qa/store.cxx  |   88 ++
 sw/source/ui/misc/contentcontroldlg.cxx |   92 +++
 sw/source/ui/misc/contentcontrollistitemdlg.cxx |2 
 sw/source/uibase/inc/contentcontroldlg.hxx  |9 +
 sw/uiconfig/swriter/ui/contentcontroldlg.ui |   42 +--
 sw/uiconfig/swriter/ui/contentcontrollistitemdlg.ui |  118 +---
 8 files changed, 306 insertions(+), 71 deletions(-)

New commits:
commit 9d64ab991b378e929c7c62a49bfc9d4016f30a22
Author: Chris Sherlock 
AuthorDate: Wed Dec 29 06:38:50 2021 +1100
Commit: Stephan Bergmann 
CommitDate: Mon May 16 18:23:14 2022 +0200

store: add unit tests

Test:

- create a file in memory
- open a stream
- write a byte to the stream
- read the byte from the stream

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

diff --git a/store/CppunitTest_store.mk b/store/CppunitTest_store.mk
new file mode 100644
index ..e08ebc840c6b
--- /dev/null
+++ b/store/CppunitTest_store.mk
@@ -0,0 +1,22 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,store))
+
+$(eval $(call gb_CppunitTest_use_libraries,store,\
+sal \
+salhelper \
+store \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,store,\
+store/qa/store \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/store/Module_store.mk b/store/Module_store.mk
index 71374e88973e..9eb5ee35aebd 100644
--- a/store/Module_store.mk
+++ b/store/Module_store.mk
@@ -13,4 +13,8 @@ $(eval $(call gb_Module_add_targets,store,\
 Library_store \
 ))
 
+$(eval $(call gb_Module_add_check_targets,store,\
+CppunitTest_store \
+))
+
 # vim:set noet sw=4 ts=4:
diff --git a/store/qa/store.cxx b/store/qa/store.cxx
new file mode 100644
index ..69bc3f8f8674
--- /dev/null
+++ b/store/qa/store.cxx
@@ -0,0 +1,88 @@
+/* -*- 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 
+
+namespace
+{
+class StoreTest : public CppUnit::TestFixture
+{
+public:
+void createMemoryStream();
+void createStream();
+void writeAndReadByte();
+
+CPPUNIT_TEST_SUITE(StoreTest);
+CPPUNIT_TEST(createMemoryStream);
+CPPUNIT_TEST(createStream);
+CPPUNIT_TEST(writeAndReadByte);
+CPPUNIT_TEST_SUITE_END();
+};
+
+void StoreTest::createMemoryStream()
+{
+store::OStoreFile aFile;
+CPPUNIT_ASSERT_EQUAL(store_E_None, aFile.createInMemory());
+}
+
+void StoreTest::createStream()
+{
+store::OStoreFile aFile;
+CPPUNIT_ASSERT_EQUAL(store_E_None, aFile.createInMemory());
+
+store::OStoreStream aStream;
+CPPUNIT_ASSERT_EQUAL(store_E_None,
+ aStream.create(aFile, "testnode", "testname", 
storeAccessMode::Create));
+
+aFile.close();
+}
+
+void StoreTest::writeAndReadByte()
+{
+store::OStoreFile aFile;
+CPPUNIT_ASSERT_EQUAL(store_E_None, aFile.createInMemory());
+
+store::OStoreStream aStream;
+CPPUNIT_ASSERT_EQUAL(store_E_None,
+ aStream.create(aFile, "testnode", "testname", 
storeAccessMode::Create));
+
+{
+std::unique_ptr pWriteBuffer(new sal_uInt8[1]);
+pWriteBuffer[0] = 'a';
+
+sal_uInt32 writtenBytes;
+
+CPPUNIT_ASSERT_EQUAL(store_E_None, aStream.writeAt(0, 
pWriteBuffer.get(), 1, writtenBytes));
+CPPUNIT_ASSERT_EQUAL(static_cast(1), writtenBytes);
+}
+
+{
+std::unique_ptr pReadBuffer(new sal_uInt8[1]);
+sal_uInt32 readBytes;
+
+CPPUNIT_ASSERT_EQUAL(store_E_None, aStream.readAt(0, 
pReadBuffer.get(), 1, readBytes));
+CPPUNIT_ASSERT_EQUAL(static_cast(1), readBytes);
+CPPUNIT_ASSERT_EQUAL(static_cast('a'), pReadBuffer[0]);
+}
+
+aFile.close();
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(StoreTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
commit a1e2fc012113339564b3414d03a6eaf118ff2713
Author: Miklos Vajna 
AuthorDate: Mon May 16 15:11:52 2022 +0200
Commit: 

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

2022-05-06 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_animation.mk |1 
 vcl/qa/cppunit/animation.cxx |   69 +++
 2 files changed, 70 insertions(+)

New commits:
commit 431c692e4e58a4861e4ab7b4d30b1edf0aab0496
Author: Chris Sherlock 
AuthorDate: Fri Jul 19 23:47:32 2019 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sat May 7 02:54:13 2022 +0200

vcl: add some basic Animation unit tests

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

diff --git a/vcl/CppunitTest_vcl_animation.mk b/vcl/CppunitTest_vcl_animation.mk
index 3ff256daa7b2..659fdbe819ce 100644
--- a/vcl/CppunitTest_vcl_animation.mk
+++ b/vcl/CppunitTest_vcl_animation.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_set_include,vcl_animation,\
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_animation, \
vcl/qa/cppunit/implanimview \
+   vcl/qa/cppunit/animation \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,vcl_animation, \
diff --git a/vcl/qa/cppunit/animation.cxx b/vcl/qa/cppunit/animation.cxx
new file mode 100644
index ..e9e308ff7190
--- /dev/null
+++ b/vcl/qa/cppunit/animation.cxx
@@ -0,0 +1,69 @@
+/* -*- 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 
+
+class VclAnimationTest : public test::BootstrapFixture
+{
+public:
+VclAnimationTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testFrameCount();
+void testDisplaySize();
+
+CPPUNIT_TEST_SUITE(VclAnimationTest);
+CPPUNIT_TEST(testFrameCount);
+CPPUNIT_TEST(testDisplaySize);
+CPPUNIT_TEST_SUITE_END();
+};
+
+void VclAnimationTest::testFrameCount()
+{
+Animation aAnimation;
+
+CPPUNIT_ASSERT_EQUAL(size_t(0), aAnimation.Count());
+
+aAnimation.Insert(
+AnimationBitmap(BitmapEx(Size(3, 4), vcl::PixelFormat::N24_BPP), 
Point(0, 0), Size(3, 4)));
+CPPUNIT_ASSERT_EQUAL(size_t(1), aAnimation.Count());
+
+aAnimation.Insert(AnimationBitmap(BitmapEx(Size(3, 3), 
vcl::PixelFormat::N24_BPP), Point(0, 0),
+  Size(10, 10)));
+CPPUNIT_ASSERT_EQUAL(size_t(2), aAnimation.Count());
+
+aAnimation.Clear();
+CPPUNIT_ASSERT_EQUAL(size_t(0), aAnimation.Count());
+}
+
+void VclAnimationTest::testDisplaySize()
+{
+Animation aAnimation;
+CPPUNIT_ASSERT_EQUAL(Size(0, 0), aAnimation.GetDisplaySizePixel());
+
+aAnimation.Insert(
+AnimationBitmap(BitmapEx(Size(3, 4), vcl::PixelFormat::N24_BPP), 
Point(0, 0), Size(3, 4)));
+CPPUNIT_ASSERT_EQUAL(Size(3, 4), aAnimation.GetDisplaySizePixel());
+
+aAnimation.Insert(AnimationBitmap(BitmapEx(Size(10, 10), 
vcl::PixelFormat::N24_BPP),
+  Point(0, 0), Size(10, 10)));
+CPPUNIT_ASSERT_EQUAL(Size(10, 10), aAnimation.GetDisplaySizePixel());
+
+aAnimation.Clear();
+CPPUNIT_ASSERT_EQUAL(Size(0, 0), aAnimation.GetDisplaySizePixel());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclAnimationTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: vcl/CppunitTest_vcl_animation.mk vcl/inc vcl/Module_vcl.mk vcl/qa

2022-05-06 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_animation.mk |   43 +
 vcl/Module_vcl.mk|1 
 vcl/inc/impanmvw.hxx |6 -
 vcl/qa/cppunit/implanimview.cxx  |  121 +++
 4 files changed, 168 insertions(+), 3 deletions(-)

New commits:
commit f4e2d7b006aa86732b30bb7e2f219360481fc724
Author: Chris Sherlock 
AuthorDate: Sun Jul 28 19:16:53 2019 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri May 6 16:06:48 2022 +0200

vcl: test ImplAnimView

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

diff --git a/vcl/CppunitTest_vcl_animation.mk b/vcl/CppunitTest_vcl_animation.mk
new file mode 100644
index ..3ff256daa7b2
--- /dev/null
+++ b/vcl/CppunitTest_vcl_animation.mk
@@ -0,0 +1,43 @@
+# -*- 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_animation))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_animation,\
+-I$(SRCDIR)/vcl/inc \
+$$(INCLUDE) \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_animation, \
+   vcl/qa/cppunit/implanimview \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_animation, \
+   test \
+   unotest \
+   vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,vcl_animation, \
+   boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,vcl_animation))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_animation))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_animation))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_animation,\
+   configmgr/source/configmgr \
+   i18npool/util/i18npool \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_animation))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 33485fefa52a..62660b718ec1 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -218,6 +218,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
 CppunitTest_vcl_backend_test \
 CppunitTest_vcl_blocklistparser_test \
 CppunitTest_vcl_type_serializer_test \
+CppunitTest_vcl_animation \
 $(call gb_Helper_optional, PDFIUM, \
 CppunitTest_vcl_pdfium_library_test) \
 $(if $(filter SKIA,$(BUILD_TYPE)), \
diff --git a/vcl/inc/impanmvw.hxx b/vcl/inc/impanmvw.hxx
index 99bd7cd5dff2..be48421f5abd 100644
--- a/vcl/inc/impanmvw.hxx
+++ b/vcl/inc/impanmvw.hxx
@@ -20,6 +20,7 @@
 #ifndef INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX
 #define INCLUDED_VCL_SOURCE_GDI_IMPANMVW_HXX
 
+#include 
 #include 
 #include 
 
@@ -41,7 +42,7 @@ struct AInfo
 };
 
 
-class ImplAnimView
+class VCL_DLLPUBLIC ImplAnimView
 {
 private:
 
@@ -68,11 +69,10 @@ private:
 boolmbIsMirroredVertically;
 
 public:
-~ImplAnimView();
-private:
 ImplAnimView( Animation* pParent, OutputDevice* pOut,
   const Point& rPt, const Size& rSz, sal_uLong 
nExtraData,
   OutputDevice* pFirstFrameOutDev = nullptr );
+~ImplAnimView();
 
 boolmatches(const OutputDevice* pOut, tools::Long nExtraData) 
const;
 voiddrawToPos( sal_uLong nPos );
diff --git a/vcl/qa/cppunit/implanimview.cxx b/vcl/qa/cppunit/implanimview.cxx
new file mode 100644
index ..01386fac048d
--- /dev/null
+++ b/vcl/qa/cppunit/implanimview.cxx
@@ -0,0 +1,121 @@
+/* -*- 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 
+
+namespace
+{
+class TestRenderingContext : public OutputDevice
+{
+public:
+TestRenderingContext()
+: OutputDevice(OutDevType::OUTDEV_VIRDEV)
+{
+}
+
+void SaveBackground(VirtualDevice&, const Point&, const Size&, const 
Size&) const override {}
+bool AcquireGraphics() const override { return true; }
+void ReleaseGraphics(bool) override {}
+bool UsePolyPolygonForComplexGradient() override { return false; }
+};
+}
+
+class VclImplAnimViewTest : public test::BootstrapFixture
+{
+public:
+VclImplAnimViewTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testMatching();
+void testDrawToPos();
+void testGetPosSizeWindow();
+
+CPPUNIT_TEST_SUITE(VclImplAnimViewTest);
+CPPUNIT_TEST(testMatching);
+

[Libreoffice-commits] core.git: vcl/Executable_minvcl.mk vcl/Executable_mtfdemo.mk vcl/Executable_svdemo.mk vcl/Executable_vcldemo.mk vcl/workben

2022-01-21 Thread Chris Sherlock (via logerrit)
 vcl/Executable_minvcl.mk  |1 +
 vcl/Executable_mtfdemo.mk |6 +-
 vcl/Executable_svdemo.mk  |2 ++
 vcl/Executable_vcldemo.mk |6 --
 vcl/workben/minvcl.cxx|3 ++-
 vcl/workben/mtfdemo.cxx   |   14 +++---
 vcl/workben/svdem.cxx |9 -
 vcl/workben/vcldemo.cxx   |9 +
 8 files changed, 42 insertions(+), 8 deletions(-)

New commits:
commit fced837029123f34a125f5a794e5681ed297fc2a
Author: Chris Sherlock 
AuthorDate: Thu Jan 20 22:57:45 2022 +0100
Commit: Hossein 
CommitDate: Fri Jan 21 12:43:30 2022 +0100

tdf#146478 vcl: vcldemo and other vcl examples segfault on close

We need to call on framework's shutdown to cleanup after ourselves
properly. This has only become apparent after commit 6e35794ca where we
assert if we try to dispose to process's component context before we
shutdown the app properly.

During this we also noticed that we got a warning:


warn:i18nlangtag:1855739:1855739:i18nlangtag/source/isolang/mslangid.cxx:105: 
MsLangId::getConfiguredSystemLanguage() - not configured yet

So I have fixed this by configuring the system language at init.

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

diff --git a/vcl/Executable_minvcl.mk b/vcl/Executable_minvcl.mk
index 8de973dcd1f4..f3b603e8c61b 100644
--- a/vcl/Executable_minvcl.mk
+++ b/vcl/Executable_minvcl.mk
@@ -28,6 +28,7 @@ $(eval $(call gb_Executable_use_libraries,minvcl,\
 cppuhelper \
 comphelper \
 i18nlangtag \
+fwk \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,minvcl,\
diff --git a/vcl/Executable_mtfdemo.mk b/vcl/Executable_mtfdemo.mk
index 92a37af1858f..4b192c14533a 100644
--- a/vcl/Executable_mtfdemo.mk
+++ b/vcl/Executable_mtfdemo.mk
@@ -21,12 +21,16 @@ $(eval $(call gb_Executable_set_include,mtfdemo,\
 ))
 
 $(eval $(call gb_Executable_use_libraries,mtfdemo,\
-   basegfx \
+basegfx \
 tl \
 sal \
 cppu \
 cppuhelper \
 comphelper \
+fwk \
+drawinglayer \
+emfio \
+i18nlangtag \
 ))
 
 $(eval $(call gb_Executable_use_vclmain,mtfdemo))
diff --git a/vcl/Executable_svdemo.mk b/vcl/Executable_svdemo.mk
index 00083247b934..f6d8b9df3afb 100644
--- a/vcl/Executable_svdemo.mk
+++ b/vcl/Executable_svdemo.mk
@@ -27,6 +27,8 @@ $(eval $(call gb_Executable_use_libraries,svdemo,\
 cppu \
 cppuhelper \
 comphelper \
+i18nlangtag \
+fwk \
 ))
 
 $(eval $(call gb_Executable_add_exception_objects,svdemo,\
diff --git a/vcl/Executable_vcldemo.mk b/vcl/Executable_vcldemo.mk
index 19b7ee655af9..e4076ac08231 100644
--- a/vcl/Executable_vcldemo.mk
+++ b/vcl/Executable_vcldemo.mk
@@ -31,13 +31,15 @@ $(eval $(call gb_Executable_set_include,vcldemo,\
 ))
 
 $(eval $(call gb_Executable_use_libraries,vcldemo,\
-   basegfx \
+basegfx \
 comphelper \
 cppu \
 cppuhelper \
 tl \
 sal \
-   salhelper \
+salhelper \
+fwk \
+i18nlangtag \
 ))
 
 $(eval $(call gb_Executable_use_vclmain,vcldemo))
diff --git a/vcl/workben/minvcl.cxx b/vcl/workben/minvcl.cxx
index 9592769879fa..e6beb2f95b4a 100644
--- a/vcl/workben/minvcl.cxx
+++ b/vcl/workben/minvcl.cxx
@@ -7,6 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -67,9 +68,9 @@ static int main_impl()
 TheApplication aApp;
 InitVCL();
 int ret = aApp.Main();
+
framework::getDesktop(::comphelper::getProcessComponentContext())->terminate();
 DeInitVCL();
 
-css::uno::Reference(xContext, 
css::uno::UNO_QUERY_THROW)->dispose();
 comphelper::setProcessServiceFactory(nullptr);
 
 return ret;
diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx
index aae7c092a163..9ed8a2404a5b 100644
--- a/vcl/workben/mtfdemo.cxx
+++ b/vcl/workben/mtfdemo.cxx
@@ -30,6 +30,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -106,6 +109,7 @@ public:
 mpWin->Show();
 
 Application::Execute();
+mpWin.disposeAndClear();
 }
 catch (const css::uno::Exception&)
 {
@@ -124,6 +128,8 @@ private:
 uno::Reference xMSF;
 void Init() override
 {
+
LanguageTag::setConfiguredSystemLanguage(MsLangId::getSystemLanguage());
+
 try
 {
 const sal_uInt16 nCmdParams = GetCommandLineParamCount();
@@ -208,6 +214,8 @@ private:
 
 aMtf.dumpAsXml(rtl::OUStringToOString(sAbsoluteDumpUrl, 
RTL_TEXTENCODING_UTF8).getStr());
 std::cout << "Dumped metaactions as metadump.xml" << std::endl;
+
framework::getDesktop(::comphelper::getProcessComponentContext())->terminate();
+
framework::getDesktop(::comphelper::getProcessComponentContext())->disposing();
 std::exit(0);
 

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

2022-01-18 Thread Chris Sherlock (via logerrit)
 solenv/clang-format/excludelist |1 
 vcl/Library_vcl.mk  |1 
 vcl/source/outdev/eps.cxx   |   84 
 vcl/source/outdev/outdev.cxx|   59 
 4 files changed, 86 insertions(+), 59 deletions(-)

New commits:
commit 4a388f5e01ebb5a512931d11e48c4380382239c8
Author: Chris Sherlock 
AuthorDate: Wed Nov 3 01:35:12 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 19 01:44:01 2022 +0100

vcl: move eps functions to eps.cxx

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

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 10175a4c0422..3d4638abf382 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14942,6 +14942,7 @@ vcl/source/outdev/bitmap.cxx
 vcl/source/outdev/bitmapex.cxx
 vcl/source/outdev/clipping.cxx
 vcl/source/outdev/curvedshapes.cxx
+vcl/source/outdev/eps.cxx
 vcl/source/outdev/fill.cxx
 vcl/source/outdev/font.cxx
 vcl/source/outdev/gradient.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index f201cb273524..7664927c257a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -213,6 +213,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/toolkit/group \
 vcl/source/toolkit/morebtn \
 vcl/source/outdev/background \
+vcl/source/outdev/eps \
 vcl/source/outdev/outdev \
 vcl/source/outdev/stack \
 vcl/source/outdev/clipping \
diff --git a/vcl/source/outdev/eps.cxx b/vcl/source/outdev/eps.cxx
new file mode 100644
index ..f65c8aa97217
--- /dev/null
+++ b/vcl/source/outdev/eps.cxx
@@ -0,0 +1,84 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
+const GfxLink& rGfxLink, GDIMetaFile* pSubst )
+{
+bool bDrawn(true);
+
+if ( mpMetaFile )
+{
+GDIMetaFile aSubst;
+
+if( pSubst )
+aSubst = *pSubst;
+
+mpMetaFile->AddAction( new MetaEPSAction( rPoint, rSize, rGfxLink, 
aSubst ) );
+}
+
+if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() )
+return bDrawn;
+
+if( mbOutputClipped )
+return bDrawn;
+
+tools::Rectangle aRect( ImplLogicToDevicePixel( tools::Rectangle( rPoint, 
rSize ) ) );
+
+if( !aRect.IsEmpty() )
+{
+// draw the real EPS graphics
+if( rGfxLink.GetData() && rGfxLink.GetDataSize() )
+{
+if( !mpGraphics && !AcquireGraphics() )
+return bDrawn;
+assert(mpGraphics);
+
+if( mbInitClipRegion )
+InitClipRegion();
+
+aRect.Justify();
+bDrawn = mpGraphics->DrawEPS( aRect.Left(), aRect.Top(), 
aRect.GetWidth(), aRect.GetHeight(),
+ const_cast(rGfxLink.GetData()), 
rGfxLink.GetDataSize(), *this );
+}
+
+// else draw the substitution graphics
+if( !bDrawn && pSubst )
+{
+GDIMetaFile* pOldMetaFile = mpMetaFile;
+
+mpMetaFile = nullptr;
+Graphic(*pSubst).Draw(*this, rPoint, rSize);
+mpMetaFile = pOldMetaFile;
+}
+}
+
+if( mpAlphaVDev )
+mpAlphaVDev->DrawEPS( rPoint, rSize, rGfxLink, pSubst );
+
+return bDrawn;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 7f8167b5180b..708a283f44a8 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -720,65 +720,6 @@ bool OutputDevice::ImplIsRecordLayout() const
 return mpOutDevData->mpRecordLayout;
 }
 
-// EPS public function
-
-bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
-const GfxLink& rGfxLink, GDIMetaFile* pSubst )
-{
-bool 

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

2022-01-08 Thread Chris Sherlock (via logerrit)
 Repository.mk   |5 
 include/tools/fontenum.hxx  |  374 ++
 vcl/Executable_listfonts.mk |   36 ++
 vcl/Module_vcl.mk   |1 
 vcl/workben/listfonts.cxx   |  541 
 5 files changed, 955 insertions(+), 2 deletions(-)

New commits:
commit dabeab27dae5d3aef2bf41c186a6fc308d617466
Author: Chris Sherlock 
AuthorDate: Sat Jan 8 00:02:30 2022 +0100
Commit: Hossein 
CommitDate: Sat Jan 8 12:58:14 2022 +0100

vcl: Create listfonts utility

The listfonts utility gets the details of all available fonts on the
system. It prints out the information, or stores it in a text file,
if a file name is passed to it as an argument.

An example invocation to store the information in a file named
fonts.txt is:

./bin/run listfonts fonts.txt

To get the correct font metrics, you actually have to get the font
metric from the system, and then set it as the current font of
OutputDevice, then get the font metric (which corrects a variety of
things like the orientation, line, height, slant, etc. - including
converting from logical coords to device coords).

The information is reported for each font family. On the top is the
family name, and then comes other details. Here is a report for an
example font:

FreeSans
Family type: swiss
Style name: Regular
Weight: normal
Italic: none
Pitch: variable
Width type: normal
Alignment: top
Charset: UCS2 (aka Unicode)
Symbol font? no
Ascent: 13
Descent: 3
Internal leading: 0
External leading: 2
Line height: 16
Slant: 0
Bullet offset: 0
Fullstop centered? yes
Orientation: 0 degrees
Quality: 18477

There is a -v (or --verbose) option that output font features.

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

diff --git a/Repository.mk b/Repository.mk
index 6e3834a24259..c6210625338a 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -74,8 +74,9 @@ $(eval $(call gb_Helper_register_executables,NONE, \
$(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)),icontest) \
vcldemo \
tiledrendering \
-mtfdemo \
-visualbackendtest \
+   mtfdemo \
+   visualbackendtest \
+   listfonts \
$(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), 
gtktiledviewer) \
 ))
 
diff --git a/include/tools/fontenum.hxx b/include/tools/fontenum.hxx
index eeb35be1985c..c09ef0838336 100644
--- a/include/tools/fontenum.hxx
+++ b/include/tools/fontenum.hxx
@@ -20,28 +20,223 @@
 #define INCLUDED_TOOLS_FONTENUM_HXX
 
 #include 
+#include 
 #include 
 
+#include 
+
 enum FontFamily { FAMILY_DONTKNOW, FAMILY_DECORATIVE, FAMILY_MODERN,
   FAMILY_ROMAN, FAMILY_SCRIPT, FAMILY_SWISS, FAMILY_SYSTEM, 
FontFamily_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
 
+template< typename charT, typename traits >
+inline std::basic_ostream & operator <<(
+std::basic_ostream & stream, FontFamily const& family)
+{
+switch (family)
+{
+case FAMILY_DONTKNOW:
+return stream << "unknown";
+
+case FAMILY_DECORATIVE:
+return stream << "decorative";
+
+case FAMILY_MODERN:
+return stream << "modern";
+
+case FAMILY_ROMAN:
+return stream << "roman";
+
+case FAMILY_SCRIPT:
+return stream << "script";
+
+case FAMILY_SWISS:
+return stream << "swiss";
+
+case FAMILY_SYSTEM:
+return stream << "system";
+
+default:
+SAL_WARN("vcl.gdi", "FontFamily out of bounds");
+assert(false && "FontFamily out of bounds");
+return stream << "unknown";
+}
+}
+
 enum FontPitch { PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, 
FontPitch_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
 
+template< typename charT, typename traits >
+inline std::basic_ostream & operator <<(
+std::basic_ostream & stream, FontPitch const& pitch)
+{
+switch (pitch)
+{
+case PITCH_DONTKNOW:
+return stream << "unknown";
+
+case PITCH_FIXED:
+return stream << "fixed";
+
+case PITCH_VARIABLE:
+return stream << "variable";
+
+default:
+SAL_WARN("vcl.gdi", "FontPitch out of bounds");
+assert(false && "FontPitch out of bounds");
+return stream << "unknown";
+}
+}
+
 enum TextAlign { ALIGN_TOP, ALIGN_BASELINE, ALIGN_BOTTOM, 
TextAlign_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
 
+template< typename charT, typename traits >
+inline std::basic_ostream & operator <<(
+std::basic_ostream & stream, TextAlign const& align)
+{
+switch (align)
+{
+case ALIGN_TOP:
+

[Libreoffice-commits] core.git: 2 commits - cppcanvas/source filter/source include/vcl sc/inc sc/source vcl/CppunitTest_vcl_gradient.mk vcl/Module_vcl.mk vcl/qa vcl/source

2022-01-04 Thread Chris Sherlock (via logerrit)
 cppcanvas/source/mtfrenderer/implrenderer.cxx |5 
 filter/source/svg/svgwriter.cxx   |8 
 include/vcl/gradient.hxx  |9 
 include/vcl/outdev.hxx|   10 
 sc/inc/unonames.hxx   |1 
 sc/source/ui/unoobj/confuno.cxx   |   14 
 vcl/CppunitTest_vcl_gradient.mk   |   50 +++
 vcl/Module_vcl.mk |1 
 vcl/qa/cppunit/gradient.cxx   |  256 +
 vcl/qa/cppunit/outdev.cxx |  218 --
 vcl/source/filter/eps/eps.cxx |3 
 vcl/source/filter/wmf/emfwr.cxx   |3 
 vcl/source/filter/wmf/wmfwr.cxx   |3 
 vcl/source/gdi/gradient.cxx   |  382 ++
 vcl/source/gdi/pdfwriter_impl2.cxx|3 
 vcl/source/outdev/gradient.cxx|  382 --
 16 files changed, 728 insertions(+), 620 deletions(-)

New commits:
commit 22f52db0be81ceec2aa7a61f7092b54f36e2d00c
Author: Chris Sherlock 
AuthorDate: Sat Dec 18 23:39:25 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 5 05:42:32 2022 +0100

vcl: migrate AddGradientActions() from OutputDevice to Gradient

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

diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx 
b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index 8aa1d1675fa9..f7fe8db551f0 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -720,9 +720,8 @@ namespace cppcanvas::internal
 }
 
 GDIMetaFile aTmpMtf;
-rParms.mrVDev.AddGradientActions( rPoly.GetBoundRect(),
-  rGradient,
-   aTmpMtf );
+Gradient aGradient(rGradient);
+aGradient.AddGradientActions( rPoly.GetBoundRect(), aTmpMtf );
 
 createActions( aTmpMtf, rParms, bSubsettableActions );
 
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 014de0a808b0..a9dcfccbb627 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2255,9 +2255,15 @@ void SVGActionWriter::ImplWritePattern( const 
tools::PolyPolygon& rPolyPoly,
 
 GDIMetaFile aTmpMtf;
 if( pHatch )
+{
 mpVDev->AddHatchActions( rPolyPoly, *pHatch, aTmpMtf );
+}
 else if ( pGradient )
-mpVDev->AddGradientActions( rPolyPoly.GetBoundRect(), 
*pGradient, aTmpMtf );
+{
+Gradient aGradient(*pGradient);
+aGradient.AddGradientActions( rPolyPoly.GetBoundRect(), 
aTmpMtf );
+}
+
 ImplWriteActions( aTmpMtf, nWriteFlags, "" );
 }
 }
diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx
index 5a04616adda5..f7c2bd2ec5f9 100644
--- a/include/vcl/gradient.hxx
+++ b/include/vcl/gradient.hxx
@@ -33,6 +33,7 @@ namespace tools { class Rectangle; }
 
 class Point;
 class SvStream;
+class GDIMetaFile;
 
 class VCL_DLLPUBLIC Gradient
 {
@@ -78,11 +79,19 @@ public:
 
 voidGetBoundRect( const tools::Rectangle& rRect, 
tools::Rectangle , Point& rCenter ) const;
 
+void AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& 
rMetaFile);
+
 Gradient&   operator=( const Gradient& rGradient );
 Gradient&   operator=( Gradient&& rGradient );
 booloperator==( const Gradient& rGradient ) const;
 booloperator!=( const Gradient& rGradient ) const
 { return !(Gradient::operator==( rGradient )); }
+
+private:
+tools::Long GetMetafileSteps(tools::Rectangle const& rRect) const;
+
+void DrawComplexGradientToMetafile(tools::Rectangle const& rRect, 
GDIMetaFile& rMetaFile) const;
+void DrawLinearGradientToMetafile(tools::Rectangle const& rRect, 
GDIMetaFile& rMetaFile) const;
 };
 
 #endif // INCLUDED_VCL_GRADIENT_HXX
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 9c86567865ba..13c8c49064b7 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -795,11 +795,6 @@ public:
 voidDrawGradient( const tools::Rectangle& rRect, 
const Gradient& rGradient );
 voidDrawGradient( const tools::PolyPolygon& 
rPolyPoly, const Gradient& rGradient );
 
-voidAddGradientActions(
-const tools::Rectangle& rRect,
-const Gradient& rGradient,
-GDIMetaFile& rMtf );
-
 protected:
 
 virtual bool  

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

2021-12-26 Thread Chris Sherlock (via logerrit)
 include/vcl/gradient.hxx   |6 +--
 include/vcl/outdev.hxx |3 -
 vcl/source/outdev/gradient.cxx |   69 ++---
 3 files changed, 35 insertions(+), 43 deletions(-)

New commits:
commit 22dd44f479fe9b3c34b03ae55177c7b66170e41b
Author: Chris Sherlock 
AuthorDate: Sat Dec 18 12:34:55 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 27 03:51:41 2021 +0100

vcl: change Get{Linear|Complex}GradientSteps()

No need to have split out the function, we can just check the gradient
style type. However, if we are checking the steps for a metafile we can
make this a static function.

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

diff --git a/include/vcl/gradient.hxx b/include/vcl/gradient.hxx
index 59956138033b..5a04616adda5 100644
--- a/include/vcl/gradient.hxx
+++ b/include/vcl/gradient.hxx
@@ -21,13 +21,13 @@
 #define INCLUDED_VCL_GRADIENT_HXX
 
 #include 
-#include 
 #include 
 #include 
-
-#include 
+#include 
 #include 
 
+#include 
+#include 
 
 namespace tools { class Rectangle; }
 
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index eec957e14973..9c86567865ba 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -815,8 +815,7 @@ private:
 SAL_DLLPRIVATE void DrawLinearGradientToMetafile( const 
tools::Rectangle& rRect, const Gradient& rGradient );
 SAL_DLLPRIVATE void DrawComplexGradientToMetafile( const 
tools::Rectangle& rRect, const Gradient& rGradient );
 
-SAL_DLLPRIVATE tools::Long  GetLinearGradientSteps( const Gradient& 
rGradient, const tools::Rectangle& rRect, bool bMtf);
-SAL_DLLPRIVATE tools::Long  GetComplexGradientSteps( const Gradient& 
rGradient, const tools::Rectangle& rRect, bool bMtf);
+SAL_DLLPRIVATE tools::Long  GetGradientSteps(Gradient const& rGradient, 
tools::Rectangle const& rRect);
 
 SAL_DLLPRIVATE ColorGetSingleColorGradientFill();
 ///@}
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index f1ae13283f9d..9d8e6d8b1830 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -321,7 +321,7 @@ void OutputDevice::DrawLinearGradient( const 
tools::Rectangle& rRect,
 }
 
 // calculate step count
-tools::Long nStepCount = GetLinearGradientSteps(rGradient, aRect, 
false/*bMtf*/);
+tools::Long nStepCount = GetGradientSteps(rGradient, aRect);
 
 // minimal three steps and maximal as max color steps
 tools::Long   nAbsRedSteps   = std::abs( nEndRed   - nStartRed );
@@ -443,7 +443,7 @@ void OutputDevice::DrawComplexGradient( const 
tools::Rectangle& rRect,
 if ( UsePolyPolygonForComplexGradient() )
 xPolyPoly = tools::PolyPolygon( 2 );
 
-tools::Long nStepCount = GetComplexGradientSteps(rGradient, rRect, 
false/*bMtf*/);
+tools::Long nStepCount = GetGradientSteps(rGradient, rRect);
 
 // at least three steps and at most the number of colour differences
 tools::Long nSteps = std::max( nStepCount, tools::Long(2) );
@@ -581,6 +581,20 @@ void OutputDevice::DrawComplexGradient( const 
tools::Rectangle& rRect,
 ImplDrawPolygon( rPoly, pClixPolyPoly );
 }
 
+static tools::Long GetGradientMetafileSteps(Gradient const& rGradient, 
tools::Rectangle const& rRect)
+{
+// calculate step count
+tools::Long nStepCount = rGradient.GetSteps();
+
+if (nStepCount)
+return nStepCount;
+
+if (rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() 
== GradientStyle::Axial)
+return rRect.GetHeight();
+else
+return std::min(rRect.GetWidth(), rRect.GetHeight());
+}
+
 void OutputDevice::DrawLinearGradientToMetafile( const tools::Rectangle& rRect,
  const Gradient& rGradient )
 {
@@ -679,7 +693,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const 
tools::Rectangle& rRect,
 }
 }
 
-tools::LongnStepCount  = GetLinearGradientSteps( rGradient, aRect, 
true/*bMtf*/ );
+tools::Long nStepCount  = GetGradientMetafileSteps(rGradient, aRect);
 
 // minimal three steps and maximal as max color steps
 tools::Long   nAbsRedSteps   = std::abs( nEndRed   - nStartRed );
@@ -780,7 +794,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const 
tools::Rectangle& rRect,
 xPolyPoly = tools::PolyPolygon( 2 );
 
 // last parameter - true if complex gradient, false if linear
-tools::Long nStepCount = GetComplexGradientSteps(rGradient, rRect, true);
+tools::Long nStepCount = GetGradientMetafileSteps(rGradient, rRect);
 
 // at least three steps and at most the number of colour differences
 tools::Long nSteps = std::max(nStepCount, tools::Long(2));
@@ -915,48 +929,27 @@ tools::Long OutputDevice::GetGradientStepCount( 
tools::Long nMinRect )
 return nInc;
 }
 

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

2021-12-26 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/outdev.cxx  |  112 -
 vcl/source/outdev/gradient.cxx |   46 +---
 2 files changed, 106 insertions(+), 52 deletions(-)

New commits:
commit 1de7e1f4640bad725626b574b33eb2db9244f378
Author: Chris Sherlock 
AuthorDate: Tue Dec 14 19:09:39 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Dec 27 03:47:28 2021 +0100

vcl: remove unnecessary actions from DrawGradientToMetafile()

It turns out, we never actually needed to decompose the gradient into
seperate actions in DrawGradientToMetafile(). We still need this for
AddGradientActions() however.

Update tests and add new ones for AddGradientActions().

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

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 469a24521643..dc2ea8ad2ed2 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -10,6 +10,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -93,9 +94,12 @@ public:
 void testDrawGradient_drawmode();
 void testDrawGradient_rect_linear();
 void testDrawGradient_rect_axial();
+void testAddGradientActions_rect_linear();
+void testAddGradientActions_rect_axial();
 void testDrawGradient_polygon_linear();
 void testDrawGradient_polygon_axial();
 void testDrawGradient_rect_complex();
+void testAddGradientActions_rect_complex();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -152,9 +156,12 @@ public:
 CPPUNIT_TEST(testDrawGradient_drawmode);
 CPPUNIT_TEST(testDrawGradient_rect_linear);
 CPPUNIT_TEST(testDrawGradient_rect_axial);
+CPPUNIT_TEST(testAddGradientActions_rect_linear);
+CPPUNIT_TEST(testAddGradientActions_rect_axial);
 CPPUNIT_TEST(testDrawGradient_polygon_linear);
 CPPUNIT_TEST(testDrawGradient_polygon_axial);
 CPPUNIT_TEST(testDrawGradient_rect_complex);
+CPPUNIT_TEST(testAddGradientActions_rect_complex);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -2135,12 +2142,12 @@ static size_t TestLinearStripes(GDIMetaFile& rMtf, 
size_t nTimes, size_t nIndex)
 {
 nIndex++;
 MetaAction* pAction = rMtf.GetAction(nIndex);
-CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action (start)", 
MetaActionType::FILLCOLOR,
  pAction->GetType());
 
 nIndex++;
 pAction = rMtf.GetAction(nIndex);
-CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYGON,
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action (start)", 
MetaActionType::POLYGON,
  pAction->GetType());
 
 for (size_t i = 0; i < nTimes - 1; i++)
@@ -2158,12 +2165,12 @@ static size_t TestLinearStripes(GDIMetaFile& rMtf, 
size_t nTimes, size_t nIndex)
 
 nIndex++;
 pAction = rMtf.GetAction(nIndex);
-CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action (end)", 
MetaActionType::FILLCOLOR,
  pAction->GetType());
 
 nIndex++;
 pAction = rMtf.GetAction(nIndex);
-CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYGON,
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action (end)", 
MetaActionType::POLYGON,
  pAction->GetType());
 
 return nIndex;
@@ -2236,6 +2243,35 @@ void VclOutdevTest::testDrawGradient_rect_linear()
 MetaAction* pAction = aMtf.GetAction(nIndex);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a gradient action (rectangle area)", 
MetaActionType::GRADIENT,
  pAction->GetType());
+}
+
+void VclOutdevTest::testAddGradientActions_rect_linear()
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+
+tools::Rectangle aRect(Point(10, 10), Size(40, 40));
+pVDev->SetOutputSizePixel(Size(100, 100));
+
+Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE);
+aGradient.SetBorder(100);
+
+pVDev->AddGradientActions(aRect, aGradient, aMtf);
+
+size_t nIndex = 0;
+
+MetaAction* pAction = aMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a push action", MetaActionType::PUSH, 
pAction->GetType());
+
+nIndex++;
+pAction = aMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rectangular intersect clip action",
+ MetaActionType::ISECTRECTCLIPREGION, 
pAction->GetType());
+
+nIndex++;
+pAction = aMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a line color action", 
MetaActionType::LINECOLOR,
+ pAction->GetType());
 
 TestLinearStripes(aMtf, 3, nIndex);
 }
@@ -2259,6 +2295,35 @@ void 

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

2021-11-17 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |3 ++-
 vcl/source/outdev/gradient.cxx |   41 ++---
 2 files changed, 32 insertions(+), 12 deletions(-)

New commits:
commit 4c3c94704704e5090c0382476251caee7a904454
Author: Chris Sherlock 
AuthorDate: Sun Oct 31 21:34:49 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Wed Nov 17 20:57:42 2021 +0100

vcl: split GetGradientSteps() into Get{Complex|Linear}GradientSteps()

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index e82bf1e357a6..eec957e14973 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -815,7 +815,8 @@ private:
 SAL_DLLPRIVATE void DrawLinearGradientToMetafile( const 
tools::Rectangle& rRect, const Gradient& rGradient );
 SAL_DLLPRIVATE void DrawComplexGradientToMetafile( const 
tools::Rectangle& rRect, const Gradient& rGradient );
 
-SAL_DLLPRIVATE tools::Long GetGradientSteps( const Gradient& 
rGradient, const tools::Rectangle& rRect, bool bMtf, bool bComplex=false );
+SAL_DLLPRIVATE tools::Long  GetLinearGradientSteps( const Gradient& 
rGradient, const tools::Rectangle& rRect, bool bMtf);
+SAL_DLLPRIVATE tools::Long  GetComplexGradientSteps( const Gradient& 
rGradient, const tools::Rectangle& rRect, bool bMtf);
 
 SAL_DLLPRIVATE ColorGetSingleColorGradientFill();
 ///@}
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 6bb6e8de64fc..7dc5523480db 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -357,7 +357,7 @@ void OutputDevice::DrawLinearGradient( const 
tools::Rectangle& rRect,
 }
 
 // calculate step count
-tools::LongnStepCount  = GetGradientSteps( rGradient, aRect, 
false/*bMtf*/ );
+tools::Long nStepCount = GetLinearGradientSteps(rGradient, aRect, 
false/*bMtf*/);
 
 // minimal three steps and maximal as max color steps
 tools::Long   nAbsRedSteps   = std::abs( nEndRed   - nStartRed );
@@ -479,7 +479,7 @@ void OutputDevice::DrawComplexGradient( const 
tools::Rectangle& rRect,
 if ( UsePolyPolygonForComplexGradient() )
 xPolyPoly = tools::PolyPolygon( 2 );
 
-tools::Long nStepCount = GetGradientSteps( rGradient, rRect, 
false/*bMtf*/, true/*bComplex*/ );
+tools::Long nStepCount = GetComplexGradientSteps(rGradient, rRect, 
false/*bMtf*/);
 
 // at least three steps and at most the number of colour differences
 tools::Long nSteps = std::max( nStepCount, tools::Long(2) );
@@ -715,7 +715,7 @@ void OutputDevice::DrawLinearGradientToMetafile( const 
tools::Rectangle& rRect,
 }
 }
 
-tools::LongnStepCount  = GetGradientSteps( rGradient, aRect, 
true/*bMtf*/ );
+tools::LongnStepCount  = GetLinearGradientSteps( rGradient, aRect, 
true/*bMtf*/ );
 
 // minimal three steps and maximal as max color steps
 tools::Long   nAbsRedSteps   = std::abs( nEndRed   - nStartRed );
@@ -816,7 +816,7 @@ void OutputDevice::DrawComplexGradientToMetafile( const 
tools::Rectangle& rRect,
 xPolyPoly = tools::PolyPolygon( 2 );
 
 // last parameter - true if complex gradient, false if linear
-tools::Long nStepCount = GetGradientSteps(rGradient, rRect, true, true);
+tools::Long nStepCount = GetComplexGradientSteps(rGradient, rRect, true);
 
 // at least three steps and at most the number of colour differences
 tools::Long nSteps = std::max(nStepCount, tools::Long(2));
@@ -951,25 +951,44 @@ tools::Long OutputDevice::GetGradientStepCount( 
tools::Long nMinRect )
 return nInc;
 }
 
-tools::Long OutputDevice::GetGradientSteps( const Gradient& rGradient, const 
tools::Rectangle& rRect, bool bMtf, bool bComplex )
+tools::Long OutputDevice::GetLinearGradientSteps(Gradient const& rGradient, 
tools::Rectangle const& rRect, bool bMtf)
 {
 // calculate step count
 tools::Long nStepCount  = rGradient.GetSteps();
-tools::Long nMinRect;
 
 // generate nStepCount, if not passed
-if (bComplex)
-nMinRect = std::min( rRect.GetWidth(), rRect.GetHeight() );
-else
-nMinRect = rRect.GetHeight();
+tools::Long nMinRect = rRect.GetHeight();
 
 if ( !nStepCount )
 {
 tools::Long nInc;
 
-nInc = GetGradientStepCount (nMinRect);
+nInc = GetGradientStepCount(nMinRect);
 if ( !nInc || bMtf )
 nInc = 1;
+
+nStepCount = nMinRect / nInc;
+}
+
+return nStepCount;
+}
+
+tools::Long OutputDevice::GetComplexGradientSteps(Gradient const& rGradient, 
tools::Rectangle const& rRect, bool bMtf)
+{
+// calculate step count
+tools::Long nStepCount  = rGradient.GetSteps();
+
+// generate nStepCount, if not passed
+tools::Long nMinRect = std::min(rRect.GetWidth(), rRect.GetHeight());
+
+if ( 

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

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

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

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

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

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

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

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

2021-10-22 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/outdev.cxx  |   59 +
 vcl/source/outdev/gradient.cxx |   58 ++--
 2 files changed, 92 insertions(+), 25 deletions(-)

New commits:
commit 82275140a56750302265a5be21236ae7a15f16e6
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 23:04:02 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 22 14:39:36 2021 +0200

vcl: move variable declar's closer to 1st use in 
DrawComplexGradientToMetaFile

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

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 3779d9b96536..5e05a5acd48b 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -95,6 +95,7 @@ public:
 void testDrawGradient_rect_axial();
 void testDrawGradient_polygon_linear();
 void testDrawGradient_polygon_axial();
+void testDrawGradient_rect_complex();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -153,6 +154,7 @@ public:
 CPPUNIT_TEST(testDrawGradient_rect_axial);
 CPPUNIT_TEST(testDrawGradient_polygon_linear);
 CPPUNIT_TEST(testDrawGradient_polygon_axial);
+CPPUNIT_TEST(testDrawGradient_rect_complex);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -2277,6 +2279,7 @@ void VclOutdevTest::testDrawGradient_polygon_linear()
 
 Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE);
 aGradient.SetBorder(100);
+
 pVDev->DrawGradient(aPolyPolygon, aGradient);
 
 size_t nIndex = ClipGradientTest(aMtf, INITIAL_SETUP_ACTION_COUNT);
@@ -2296,6 +2299,7 @@ void VclOutdevTest::testDrawGradient_polygon_axial()
 
 Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE);
 aGradient.SetBorder(100);
+
 pVDev->DrawGradient(aPolyPolygon, aGradient);
 
 size_t nIndex = ClipGradientTest(aMtf, INITIAL_SETUP_ACTION_COUNT);
@@ -2303,6 +2307,61 @@ void VclOutdevTest::testDrawGradient_polygon_axial()
 TestAxialStripes(aMtf, 3, nIndex);
 }
 
+static size_t TestComplexStripes(GDIMetaFile& rMtf, size_t nTimes, size_t 
nIndex)
+{
+nIndex++;
+MetaAction* pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+ pAction->GetType());
+
+for (size_t i = 1; i < nTimes; i++)
+{
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action", 
MetaActionType::POLYPOLYGON,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+ pAction->GetType());
+}
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action", 
MetaActionType::POLYGON,
+ pAction->GetType());
+
+return nIndex;
+}
+
+void VclOutdevTest::testDrawGradient_rect_complex()
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+tools::Rectangle aRect(Point(10, 10), Size(40, 40));
+pVDev->SetOutputSizePixel(Size(1000, 1000));
+
+Gradient aGradient(GradientStyle::Square, COL_RED, COL_WHITE);
+aGradient.SetBorder(10);
+pVDev->DrawGradient(aRect, aGradient);
+
+size_t nIndex = INITIAL_SETUP_ACTION_COUNT;
+
+MetaAction* pAction = aMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a gradient action (rectangle area)", 
MetaActionType::GRADIENT,
+ pAction->GetType());
+
+nIndex = TestComplexStripes(aMtf, 40, nIndex);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclOutdevTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index ea4a60669a64..6bb6e8de64fc 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -808,40 +808,48 @@ void OutputDevice::DrawComplexGradientToMetafile( const 
tools::Rectangle& rRect,
 // Also for printers always use PolyPolygon, as not all printers
 // can print polygons on top of each other.
 
-std::optional xPolyPoly;
-tools::Rectangle   aRect;
-Point   aCenter;
-Color   aStartCol( rGradient.GetStartColor() );
-Color   aEndCol( rGradient.GetEndColor() );
-tools::LongnStartRed = ( 
static_cast(aStartCol.GetRed()) * rGradient.GetStartIntensity() ) 
/ 100;
-tools::LongnStartGreen = ( 
static_cast(aStartCol.GetGreen()) * rGradient.GetStartIntensity() 

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

2021-10-20 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/outdev.cxx  |  290 +
 vcl/source/outdev/gradient.cxx |1 
 2 files changed, 291 insertions(+)

New commits:
commit 85d53dafd8332fc9c7bf71d6cc9da19ab9d8e252
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 18:49:20 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 20 16:04:38 2021 +0200

vcl: test OutputDevice::DrawGradient()

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

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index df5d8b2c9bf4..3779d9b96536 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -16,8 +16,10 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -88,6 +90,11 @@ public:
 void testDrawPolyLine();
 void testDrawPolygon();
 void testDrawPolyPolygon();
+void testDrawGradient_drawmode();
+void testDrawGradient_rect_linear();
+void testDrawGradient_rect_axial();
+void testDrawGradient_polygon_linear();
+void testDrawGradient_polygon_axial();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -141,6 +148,11 @@ public:
 CPPUNIT_TEST(testDrawPolyLine);
 CPPUNIT_TEST(testDrawPolygon);
 CPPUNIT_TEST(testDrawPolyPolygon);
+CPPUNIT_TEST(testDrawGradient_drawmode);
+CPPUNIT_TEST(testDrawGradient_rect_linear);
+CPPUNIT_TEST(testDrawGradient_rect_axial);
+CPPUNIT_TEST(testDrawGradient_polygon_linear);
+CPPUNIT_TEST(testDrawGradient_polygon_axial);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -2013,6 +2025,284 @@ void VclOutdevTest::testDrawPolyPolygon()
 }
 }
 
+static size_t ClipGradientTest(GDIMetaFile& rMtf, size_t nIndex)
+{
+MetaAction* pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a comment action", 
MetaActionType::COMMENT,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a gradientex action", 
MetaActionType::GRADIENTEX,
+ pAction->GetType());
+
+// clip gradient
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a push action", MetaActionType::PUSH, 
pAction->GetType());
+MetaPushAction* pPushAction = dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not using XOR push flags", 
vcl::PushFlags::RASTEROP,
+ pPushAction->GetFlags());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rasterop action", 
MetaActionType::RASTEROP,
+ pAction->GetType());
+MetaRasterOpAction* pRasterOpAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not an XOR rasterop", RasterOp::Xor,
+ pRasterOpAction->GetRasterOp());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a gradient action", 
MetaActionType::GRADIENT,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a fill color action", 
MetaActionType::FILLCOLOR,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rasterop action", 
MetaActionType::RASTEROP,
+ pAction->GetType());
+pRasterOpAction = dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not an N0 rasterop", RasterOp::N0,
+ pRasterOpAction->GetRasterOp());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action", 
MetaActionType::POLYPOLYGON,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a rasterop action", 
MetaActionType::RASTEROP,
+ pAction->GetType());
+pRasterOpAction = dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not an XOR rasterop", RasterOp::Xor,
+ pRasterOpAction->GetRasterOp());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a gradient action", 
MetaActionType::GRADIENT,
+ pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a pop action", MetaActionType::POP, 
pAction->GetType());
+
+nIndex++;
+pAction = rMtf.GetAction(nIndex);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a comment action", 
MetaActionType::COMMENT,
+ pAction->GetType());
+
+return nIndex;
+}
+
+void 

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

2021-10-20 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/wallpaper.cxx |   21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit a9dfe0187f21dce9d7cee4c4e938d8592073e09c
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 15:07:18 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 20 16:04:14 2021 +0200

vcl: move variable declarations closer to first use in DrawBitmapWallpaper()

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

diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index a260af4d9596..2cd655c0e80a 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -131,17 +131,12 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
 {
 assert(!is_double_buffered_window());
 
-BitmapEx aBmpEx;
 const BitmapEx* pCached = rWallpaper.ImplGetCachedBitmap();
-Point aPos;
-Size aSize;
+
 GDIMetaFile* pOldMetaFile = mpMetaFile;
-const WallpaperStyle eStyle = rWallpaper.GetStyle();
 const bool bOldMap = mbMap;
-bool bDrawn = false;
-bool bDrawGradientBackground = false;
-bool bDrawColorBackground = false;
 
+BitmapEx aBmpEx;
 if( pCached )
 aBmpEx = *pCached;
 else
@@ -151,6 +146,11 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
 const tools::Long nBmpHeight = aBmpEx.GetSizePixel().Height();
 const bool bTransparent = aBmpEx.IsAlpha();
 
+const WallpaperStyle eStyle = rWallpaper.GetStyle();
+
+bool bDrawGradientBackground = false;
+bool bDrawColorBackground = false;
+
 // draw background
 if( bTransparent )
 {
@@ -180,13 +180,18 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
 
 // background of bitmap?
 if( bDrawGradientBackground )
+{
 DrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
+}
 else if( bDrawColorBackground && bTransparent )
 {
 DrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper );
 bDrawColorBackground = false;
 }
 
+Point aPos;
+Size aSize;
+
 // calc pos and size
 if( rWallpaper.IsRect() )
 {
@@ -205,6 +210,8 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
 Push( vcl::PushFlags::CLIPREGION );
 IntersectClipRegion( tools::Rectangle( Point( nX, nY ), Size( nWidth, 
nHeight ) ) );
 
+bool bDrawn = false;
+
 switch( eStyle )
 {
 case WallpaperStyle::Scale:


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

2021-10-18 Thread Chris Sherlock (via logerrit)
 include/tools/poly.hxx|   13 +
 include/vcl/metaact.hxx   |2 -
 vcl/qa/cppunit/outdev.cxx |   66 ++
 3 files changed, 80 insertions(+), 1 deletion(-)

New commits:
commit ed92e40aea759d435ec1c05877e6480654a06ab6
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 14:42:01 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 18 20:22:39 2021 +0200

vcl: test OutputDevice::DrawPolyPolygon()

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

diff --git a/include/tools/poly.hxx b/include/tools/poly.hxx
index 3c39f2d6c56b..d2ecf644af39 100644
--- a/include/tools/poly.hxx
+++ b/include/tools/poly.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_TOOLS_POLY_HXX
 #define INCLUDED_TOOLS_POLY_HXX
 
+#include 
 #include 
 #include 
 #include 
@@ -272,6 +273,18 @@ inline std::basic_ostream & operator <<(
 if (i > 0)
 stream << "--";
 stream << poly.GetPoint(i);
+
+OUString aFlag;
+if (poly.GetFlags(i) == PolyFlags::Normal)
+aFlag = "Normal";
+else if (poly.GetFlags(i) == PolyFlags::Smooth)
+aFlag = "Smooth";
+else if (poly.GetFlags(i) == PolyFlags::Control)
+aFlag = "Control";
+else if (poly.GetFlags(i) == PolyFlags::Symmetric)
+aFlag = "Symmetric";
+
+stream << ";f=" << aFlag;
 }
 stream << ">";
 return stream;
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index a80469bca1e5..ed74de84d5cd 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -435,7 +435,7 @@ public:
 voidSetPolygon(const tools::Polygon& rPoly) { maPoly = 
rPoly; }
 };
 
-class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPolyPolygonAction final : public 
MetaAction
+class VCL_DLLPUBLIC MetaPolyPolygonAction final : public MetaAction
 {
 private:
 
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 799a7fdc8708..df5d8b2c9bf4 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -86,6 +87,7 @@ public:
 void testDrawWaveLine();
 void testDrawPolyLine();
 void testDrawPolygon();
+void testDrawPolyPolygon();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -138,6 +140,7 @@ public:
 CPPUNIT_TEST(testDrawWaveLine);
 CPPUNIT_TEST(testDrawPolyLine);
 CPPUNIT_TEST(testDrawPolygon);
+CPPUNIT_TEST(testDrawPolyPolygon);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1947,6 +1950,69 @@ void VclOutdevTest::testDrawPolygon()
 }
 }
 
+static tools::PolyPolygon createPolyPolygon()
+{
+tools::Polygon aPolygon(4);
+
+aPolygon.SetPoint(Point(1, 8), 0);
+aPolygon.SetPoint(Point(2, 7), 1);
+aPolygon.SetPoint(Point(3, 6), 2);
+aPolygon.SetPoint(Point(4, 5), 3);
+
+tools::PolyPolygon aPolyPolygon(aPolygon);
+aPolyPolygon.Optimize(PolyOptimizeFlags::CLOSE);
+
+return aPolyPolygon;
+}
+
+void VclOutdevTest::testDrawPolyPolygon()
+{
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+
+tools::PolyPolygon aPolyPolygon = createPolyPolygon();
+
+pVDev->DrawPolyPolygon(aPolyPolygon);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action", 
MetaActionType::POLYPOLYGON,
+ pAction->GetType());
+
+MetaPolyPolygonAction* pPolyPolygonAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not the same polypolygon in polypolygon 
action", aPolyPolygon,
+ pPolyPolygonAction->GetPolyPolygon());
+}
+
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+
+tools::PolyPolygon aPolyPolygon = createPolyPolygon();
+
+basegfx::B2DPolyPolygon 
aB2DPolyPolygon(aPolyPolygon.getB2DPolyPolygon());
+
+pVDev->DrawPolyPolygon(aB2DPolyPolygon);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polypolygon action", 
MetaActionType::POLYPOLYGON,
+ pAction->GetType());
+
+/* these should match, but the equality operator does not work on 
PolyPolygon for some reason
+
+MetaPolyPolygonAction* pPolyPolygonAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not the same polypolygon in polypolygon 
action", aPolyPolygon,
+ pPolyPolygonAction->GetPolyPolygon());
+*/
+}
+}
+
 

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

2021-10-15 Thread Chris Sherlock (via logerrit)
 include/vcl/metaact.hxx   |2 +-
 vcl/qa/cppunit/outdev.cxx |   46 +-
 2 files changed, 46 insertions(+), 2 deletions(-)

New commits:
commit 6daf40e440e457d1560d7fb13ebda8a17efbfe84
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 12:42:57 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 15 13:11:28 2021 +0200

vcl: test OutputDevice::DrawPolygon()

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

diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx
index c51c1e790a85..a80469bca1e5 100644
--- a/include/vcl/metaact.hxx
+++ b/include/vcl/metaact.hxx
@@ -408,7 +408,7 @@ public:
 voidSetPolygon(const tools::Polygon& rPoly) { maPoly = 
rPoly; }
 };
 
-class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPolygonAction final : public 
MetaAction
+class VCL_DLLPUBLIC MetaPolygonAction final : public MetaAction
 {
 private:
 
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 6429e7c01220..799a7fdc8708 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -11,6 +11,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -84,6 +85,7 @@ public:
 void testDrawBorder();
 void testDrawWaveLine();
 void testDrawPolyLine();
+void testDrawPolygon();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -135,6 +137,7 @@ public:
 CPPUNIT_TEST(testDrawBorder);
 CPPUNIT_TEST(testDrawWaveLine);
 CPPUNIT_TEST(testDrawPolyLine);
+CPPUNIT_TEST(testDrawPolygon);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1875,7 +1878,7 @@ void VclOutdevTest::testDrawPolyLine()
 aLineInfo.SetLineCap(css::drawing::LineCap_BUTT);
 
 pVDev->DrawPolyLine(aPolygon, 3, basegfx::B2DLineJoin::Bevel, 
css::drawing::LineCap_BUTT,
-15.0);
+basegfx::deg2rad(15.0));
 
 MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYLINE,
@@ -1903,6 +1906,47 @@ void VclOutdevTest::testDrawPolyLine()
 }
 }
 
+void VclOutdevTest::testDrawPolygon()
+{
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+tools::Polygon 
aPolygon(vcl::test::OutputDeviceTestCommon::createClosedBezierLoop(
+tools::Rectangle(Point(10, 10), Size(80, 8;
+
+pVDev->DrawPolygon(aPolygon);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYGON,
+ pAction->GetType());
+MetaPolygonAction* pPolygonAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Polygon in polygon action is wrong", 
aPolygon,
+ pPolygonAction->GetPolygon());
+}
+
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+tools::Polygon 
aPolygon(vcl::test::OutputDeviceTestCommon::createClosedBezierLoop(
+tools::Rectangle(Point(10, 10), Size(80, 8;
+
+pVDev->DrawPolygon(aPolygon);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYGON,
+ pAction->GetType());
+MetaPolygonAction* pPolygonAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Polygon in polygon action is wrong", 
aPolygon,
+ pPolygonAction->GetPolygon());
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclOutdevTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


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

2021-10-13 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/outdev.cxx  |2 --
 vcl/source/outdev/polyline.cxx |3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

New commits:
commit be052cbc459266db86c7ddd8daba1d30b7e66d57
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 11:11:32 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 13 19:40:47 2021 +0200

vcl: DrawPolyLine() did not set metaaction line join or cap

basegfx::B2DPolygon version of DrawPolyLine() doesn't set the metafile
line cap or join, this fixes this issue.

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

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index b15bbe1785cb..6429e7c01220 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -1896,12 +1896,10 @@ void VclOutdevTest::testDrawPolyLine()
  
pPolyLineAction->GetLineInfo().GetDotLen());
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Distance wrong", static_cast(0),
  
pPolyLineAction->GetLineInfo().GetDistance());
-/* these aren't set!
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Line join", basegfx::B2DLineJoin::Bevel,
  
pPolyLineAction->GetLineInfo().GetLineJoin());
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Line cap", css::drawing::LineCap_BUTT,
  
pPolyLineAction->GetLineInfo().GetLineCap());
-*/
 }
 }
 
diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx
index aeeb90845bd1..ef4f0a4a5f2d 100644
--- a/vcl/source/outdev/polyline.cxx
+++ b/vcl/source/outdev/polyline.cxx
@@ -149,6 +149,9 @@ void OutputDevice::DrawPolyLine( const basegfx::B2DPolygon& 
rB2DPolygon,
 if( fLineWidth != 0.0 )
 aLineInfo.SetWidth( fLineWidth );
 
+aLineInfo.SetLineJoin(eLineJoin);
+aLineInfo.SetLineCap(eLineCap);
+
 const tools::Polygon aToolsPolygon( rB2DPolygon );
 mpMetaFile->AddAction( new MetaPolyLineAction( aToolsPolygon, 
aLineInfo ) );
 }


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

2021-10-12 Thread Chris Sherlock (via logerrit)
 vcl/quartz/ctfonts.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 8da2af99cc205d7c79cd119ccb32a5f3de4ea204
Author: Chris Sherlock 
AuthorDate: Sun Oct 10 03:45:37 2021 +1100
Commit: Xisco Fauli 
CommitDate: Tue Oct 12 21:36:10 2021 +0200

tdf#144757 - fixed fonts not shown in font list

When in font options, the Fonts in "Font Setting for HTML, Basic and SQL
Sources" were not showing any fixed (non-proportional) fonts in the list
when "Non-proportional fonts only" was ticked.

The reason this was occuring was because we were not populating the
fixed font attribute when getting the CT font descriptor.

Change-Id: I06127ac48bd0f3bc9b70217b36bbf584a1b0fdc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123316
Reviewed-by: Noel Grandin 
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins
(cherry picked from commit d389a54e64accc3f46c1a646f947e9af9badd08e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123412
Reviewed-by: Xisco Fauli 

diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 56408f4f9891..a01216a99304 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -376,6 +376,9 @@ FontAttributes DevFontFromCTFontDescriptor( 
CTFontDescriptorRef pFD, bool* bFont
 {
 CFNumberGetValue( pSymbolNum, kCFNumberSInt64Type,  );
 rDFA.SetSymbolFlag( (nSymbolTrait & kCTFontClassMaskTrait) == 
kCTFontSymbolicClass );
+
+if (nSymbolTrait & kCTFontMonoSpaceTrait)
+rDFA.SetPitch(PITCH_FIXED);
 }
 
 // get the font weight


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

2021-10-11 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/outdev.cxx |  123 ++
 1 file changed, 123 insertions(+)

New commits:
commit 2938f0956744e03ba0cc27a5b3fb1637811b267a
Author: Chris Sherlock 
AuthorDate: Sat Oct 2 11:04:37 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 11 11:58:43 2021 +0200

vcl: test OutputDevice::DrawPolyLine()

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

diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index 41c4e3df8c7a..b15bbe1785cb 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -8,8 +8,10 @@
  */
 
 #include 
+#include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -81,6 +83,7 @@ public:
 void testDrawCheckered();
 void testDrawBorder();
 void testDrawWaveLine();
+void testDrawPolyLine();
 
 CPPUNIT_TEST_SUITE(VclOutdevTest);
 CPPUNIT_TEST(testVirtualDevice);
@@ -131,6 +134,7 @@ public:
 CPPUNIT_TEST(testDrawCheckered);
 CPPUNIT_TEST(testDrawBorder);
 CPPUNIT_TEST(testDrawWaveLine);
+CPPUNIT_TEST(testDrawPolyLine);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1152,6 +1156,7 @@ void VclOutdevTest::testDrawLine()
 aLineInfo.SetDotLen(13);
 aLineInfo.SetDistance(8);
 aLineInfo.SetLineJoin(basegfx::B2DLineJoin::Bevel);
+aLineInfo.SetLineCap(css::drawing::LineCap_BUTT);
 
 pVDev->SetOutputSizePixel(Size(100, 100));
 pVDev->DrawLine(Point(0, 0), Point(0, 50), aLineInfo);
@@ -1175,6 +1180,8 @@ void VclOutdevTest::testDrawLine()
  pLineAction->GetLineInfo().GetDistance());
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Line join", basegfx::B2DLineJoin::Bevel,
  pLineAction->GetLineInfo().GetLineJoin());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Line cap", css::drawing::LineCap_BUTT,
+ pLineAction->GetLineInfo().GetLineCap());
 }
 }
 
@@ -1782,6 +1789,122 @@ void VclOutdevTest::testDrawWaveLine()
  pAction->GetType());
 }
 
+void VclOutdevTest::testDrawPolyLine()
+{
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+tools::Polygon 
aPolygon(vcl::test::OutputDeviceTestCommon::createClosedBezierLoop(
+tools::Rectangle(Point(10, 10), Size(80, 8;
+
+pVDev->DrawPolyLine(aPolygon);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYLINE,
+ pAction->GetType());
+MetaPolyLineAction* pPolyLineAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Polygon in polyline action is wrong", 
aPolygon,
+ pPolyLineAction->GetPolygon());
+}
+
+{
+ScopedVclPtrInstance pVDev;
+GDIMetaFile aMtf;
+aMtf.Record(pVDev.get());
+
+pVDev->SetOutputSizePixel(Size(100, 100));
+
+tools::Polygon 
aPolygon(vcl::test::OutputDeviceTestCommon::createClosedBezierLoop(
+tools::Rectangle(Point(10, 10), Size(80, 8;
+
+LineInfo aLineInfo(LineStyle::Dash, 10);
+aLineInfo.SetDashCount(5);
+aLineInfo.SetDashLen(10);
+aLineInfo.SetDotCount(3);
+aLineInfo.SetDotLen(13);
+aLineInfo.SetDistance(8);
+aLineInfo.SetLineJoin(basegfx::B2DLineJoin::Bevel);
+aLineInfo.SetLineCap(css::drawing::LineCap_BUTT);
+
+pVDev->DrawPolyLine(aPolygon, aLineInfo);
+
+MetaAction* pAction = aMtf.GetAction(INITIAL_SETUP_ACTION_COUNT);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Not a polygon action", 
MetaActionType::POLYLINE,
+ pAction->GetType());
+MetaPolyLineAction* pPolyLineAction = 
dynamic_cast(pAction);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Polygon in polyline action is wrong", 
aPolygon,
+ pPolyLineAction->GetPolygon());
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Dash count wrong", 
static_cast(5),
+ 
pPolyLineAction->GetLineInfo().GetDashCount());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Dash len wrong", static_cast(10),
+ 
pPolyLineAction->GetLineInfo().GetDashLen());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Dot count wrong", 
static_cast(3),
+ 
pPolyLineAction->GetLineInfo().GetDotCount());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Dot len wrong", static_cast(13),
+ 
pPolyLineAction->GetLineInfo().GetDotLen());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("Distance wrong", static_cast(8),
+ 

  1   2   3   >