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

2023-12-05 Thread Noel Grandin (via logerrit)
 include/vcl/BitmapInfoAccess.hxx   |9 +
 include/vcl/BitmapPalette.hxx  |6 +
 vcl/source/bitmap/BitmapInfoAccess.cxx |6 +
 vcl/source/bitmap/bitmappaint.cxx  |  171 +++--
 vcl/source/bitmap/bitmappalette.cxx|   20 +++
 5 files changed, 140 insertions(+), 72 deletions(-)

New commits:
commit bb3157e38bfffd23505abc35f790043392f43d2c
Author: Noel Grandin 
AuthorDate: Tue Dec 5 10:45:33 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 6 07:08:18 2023 +0100

Remove the special-casing in Bitmap::Invert (and fix)

and rather rely on the backends doing the right thing, which is
considerably faster.

Which uncovers a bug in the existing code - it is not legal
to simply invert the value when dealing with palette-based
images. Fix this by sharing some code with Bitmap::ReplaceMask.

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

diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx
index c0ef7fb5be1e..6e255c97e7ec 100644
--- a/include/vcl/BitmapInfoAccess.hxx
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -77,6 +77,9 @@ public:
 return mpBuffer ? mpBuffer->mnBitCount : 0;
 }
 
+/// Returns the BitmapColor (i.e. palette index) that is either an exact 
match
+/// of the required color, or failing that, the entry that is the closest 
i.e. least error
+/// as measured by Color::GetColorError.
 BitmapColor GetBestMatchingColor(const BitmapColor& rBitmapColor) const
 {
 if (HasPalette())
@@ -121,7 +124,13 @@ public:
 return pBuffer->maPalette[nColor];
 }
 
+/// Returns the BitmapColor (i.e. palette index) that is either an exact 
match
+/// of the required color, or failing that, the entry that is the closest 
i.e. least error
+/// as measured by Color::GetColorError.
 sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
+/// Returns the BitmapColor (i.e. palette index) that is an exact match
+/// of the required color. Returns SAL_MAX_UINT16 if nothing found.
+sal_uInt16 GetMatchingPaletteIndex(const BitmapColor& rBitmapColor) const;
 
 const ColorMask& GetColorMask() const
 {
diff --git a/include/vcl/BitmapPalette.hxx b/include/vcl/BitmapPalette.hxx
index 4f20970e15ec..1d5f79de5adf 100644
--- a/include/vcl/BitmapPalette.hxx
+++ b/include/vcl/BitmapPalette.hxx
@@ -65,7 +65,13 @@ public:
 const BitmapColor& operator[](sal_uInt16 nIndex) const;
 BitmapColor& operator[](sal_uInt16 nIndex);
 
+/// Returns the BitmapColor (i.e. palette index) that is either an exact 
match
+/// of the required color, or failing that, the entry that is the closest 
i.e. least error
+/// as measured by Color::GetColorError.
 sal_uInt16 GetBestIndex(const BitmapColor& rCol) const;
+/// Returns the BitmapColor (i.e. palette index) that is an exact match
+/// of the required color. Returns SAL_MAX_UINT16 if nothing found.
+sal_uInt16 GetMatchingIndex(const BitmapColor& rCol) const;
 
 /// Returns true if the palette is 8-bit grey palette.
 bool IsGreyPalette8Bit() const;
diff --git a/vcl/source/bitmap/BitmapInfoAccess.cxx 
b/vcl/source/bitmap/BitmapInfoAccess.cxx
index 50607e94dde3..318317519928 100644
--- a/vcl/source/bitmap/BitmapInfoAccess.cxx
+++ b/vcl/source/bitmap/BitmapInfoAccess.cxx
@@ -77,4 +77,10 @@ sal_uInt16 BitmapInfoAccess::GetBestPaletteIndex(const 
BitmapColor& rBitmapColor
 return (HasPalette() ? pBuffer->maPalette.GetBestIndex(rBitmapColor) : 0);
 }
 
+sal_uInt16 BitmapInfoAccess::GetMatchingPaletteIndex(const BitmapColor& 
rBitmapColor) const
+{
+assert(HasPalette());
+return mpBuffer->maPalette.GetMatchingIndex(rBitmapColor);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 5d405322e6ed..758f36bc1e93 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -31,6 +31,12 @@
 #include 
 #include 
 
+static BitmapColor UpdatePaletteForNewColor(BitmapScopedWriteAccess& pAcc,
+const sal_uInt16 nActColors,
+const sal_uInt16 nMaxColors, const 
tools::Long nHeight,
+const tools::Long nWidth,
+const BitmapColor& rWantedColor);
+
 bool Bitmap::Erase(const Color& rFillColor)
 {
 if (IsEmpty())
@@ -63,32 +69,6 @@ bool Bitmap::Invert()
 if (!mxSalBmp)
 return false;
 
-// For alpha masks, we need to actually invert the underlying data
-// or the optimisations elsewhere do not work right.
-if (typeid(*this) != typeid(AlphaMask))
-{
-// We want to avoid using ScopedReadAccess until we real

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

2023-11-07 Thread Noel Grandin (via logerrit)
 include/vcl/toolkit/treelistbox.hxx |2 +-
 vcl/source/treelist/treelistbox.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 33897a3dce5d31d0b869bc1507eed2ddcd3b1664
Author: Noel Grandin 
AuthorDate: Tue Nov 7 14:44:11 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 08:18:03 2023 +0100

loplugin:fieldcast in SvTreeListBox

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

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index da6785679ad5..ecbd489fd853 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -229,7 +229,7 @@ class VCL_DLLPUBLIC SvTreeListBox
 sal_Int8mnDragAction;
 
 SvTreeListEntry*pEdEntry;
-SvLBoxItem* pEdItem;
+SvLBoxString*   pEdItem;
 
 rtl::Reference m_xTransferHelper;
 
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index e944214c5b88..b97abc3b 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -2459,7 +2459,7 @@ void SvTreeListBox::EditedText( const OUString& rStr )
 {
 if( EditedEntry( pEdEntry, rStr ) )
 {
-static_cast(pEdItem)->SetText( rStr );
+pEdItem->SetText( rStr );
 pModel->InvalidateEntry( pEdEntry );
 }
 if( GetSelectionCount() == 0 )


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

2023-10-27 Thread Noel Grandin (via logerrit)
 include/vcl/checksum.hxx   |3 ---
 vcl/source/bitmap/checksum.cxx |8 
 2 files changed, 11 deletions(-)

New commits:
commit 4a30ea52e5e98d2c455e69194fa401a8275bd111
Author: Noel Grandin 
AuthorDate: Fri Oct 27 11:08:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 27 15:21:39 2023 +0200

remove unused vcl_get_crc64_table

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

diff --git a/include/vcl/checksum.hxx b/include/vcl/checksum.hxx
index 34d8ed77ad0f..351820e1aefe 100644
--- a/include/vcl/checksum.hxx
+++ b/include/vcl/checksum.hxx
@@ -64,9 +64,6 @@ VCL_DLLPUBLIC sal_uInt64 vcl_crc64 (
 const void *Data, sal_uInt32 DatLen
 )   SAL_THROW_EXTERN_C();
 
-
-const sal_uInt64* vcl_get_crc64_table();
-
 }
 
 inline BitmapChecksum vcl_get_checksum (
diff --git a/vcl/source/bitmap/checksum.cxx b/vcl/source/bitmap/checksum.cxx
index a5c92c5559d4..cac81a88822e 100644
--- a/vcl/source/bitmap/checksum.cxx
+++ b/vcl/source/bitmap/checksum.cxx
@@ -143,12 +143,4 @@ sal_uInt64 vcl_crc64 (
 return Crc;
 }
 
-/*
- * vcl_get_crc64_table.
- */
-const sal_uInt64* vcl_get_crc64_table()
-{
-return vcl_crc64Table;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-10-11 Thread Noel Grandin (via logerrit)
 include/vcl/glyphitemcache.hxx  |   10 +-
 include/vcl/rendercontext/State.hxx |2 +-
 vcl/source/gdi/impglyphitem.cxx |4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 286bbda9cd991c0a31c1cb88916507e586469434
Author: Noel Grandin 
AuthorDate: Tue Oct 10 13:25:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 12 07:57:20 2023 +0200

cool#7318 Calc rendering acceleration (part2)

we are spending a lot of time in SalLayoutGlyphsCache::GetLayoutGlyphs,
and most of that is inserting into the GlyphsCache, which has a very
very large key.

Shrink that key a little bit

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 6c4c1ea1294b..a5a8ec1518e4 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -80,12 +80,12 @@ private:
 double fontScaleX;
 double fontScaleY;
 MapMode mapMode;
-bool rtl;
-bool disabledLigatures; // because of fixed pitch
-bool artificialItalic;
-bool artificialBold;
-vcl::text::ComplexTextLayoutFlags layoutMode;
 LanguageType digitLanguage;
+vcl::text::ComplexTextLayoutFlags layoutMode;
+bool rtl : 1;
+bool disabledLigatures : 1; // because of fixed pitch
+bool artificialItalic : 1;
+bool artificialBold : 1;
 size_t hashValue;
 CachedGlyphsKey(const VclPtr& dev, OUString t, 
sal_Int32 i, sal_Int32 l,
 tools::Long w);
diff --git a/include/vcl/rendercontext/State.hxx 
b/include/vcl/rendercontext/State.hxx
index 042eb2deca7a..0359a486e4b2 100644
--- a/include/vcl/rendercontext/State.hxx
+++ b/include/vcl/rendercontext/State.hxx
@@ -73,7 +73,7 @@ namespace vcl::text
 {
 // Layout flags for Complex Text Layout
 // These are flag values, i.e they can be combined
-enum class ComplexTextLayoutFlags
+enum class ComplexTextLayoutFlags : sal_uInt8
 {
 Default = 0x,
 BiDiRtl = 0x0001,
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 1de52c7597ce..ca8016a1925d 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -490,9 +490,9 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 // That would occasionally lead to rounding errors (at least differences 
that would
 // make checkGlyphsEqual() fail).
 , mapMode(outputDevice->GetMapMode())
-, rtl(outputDevice->IsRTLEnabled())
-, layoutMode(outputDevice->GetLayoutMode())
 , digitLanguage(outputDevice->GetDigitLanguage())
+, layoutMode(outputDevice->GetLayoutMode())
+, rtl(outputDevice->IsRTLEnabled())
 {
 const LogicalFontInstance* fi = outputDevice->GetFontInstance();
 fi->GetScale(&fontScaleX, &fontScaleY);


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

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

2023-09-12 Thread sahil (via logerrit)
 include/vcl/font.hxx |2 ++
 vcl/source/font/font.cxx |   34 ++
 2 files changed, 20 insertions(+), 16 deletions(-)

New commits:
commit bf81be2641e8c66d78374289497b117fe3dfb024
Author: sahil 
AuthorDate: Mon Sep 11 04:40:26 2023 +0530
Commit: Mike Kaganski 
CommitDate: Wed Sep 13 06:30:59 2023 +0200

tdf#90341 Clean up excessive const_cast'ing

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

diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 8f7363d816b7..944b43fae22f 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -108,6 +108,8 @@ public:
 tools::LongGetFontHeight() const;
 voidSetAverageFontWidth( tools::Long nWidth );
 tools::LongGetAverageFontWidth() const;
+const Size& GetAverageFontSize() const;
+const FontFamily&   GetFontFamily() const;
 
 // tdf#127471 for corrections on EMF/WMF we need the AvgFontWidth in 
Windows-specific notation
 tools::Long GetOrCalculateAverageFontWidth() const;
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 5c2857770a73..7b48855f247a 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -70,8 +70,8 @@ Font::Font( vcl::Font&& rFont ) noexcept : mpImplFont( 
std::move(rFont.mpImplFon
 
 Font::Font( const OUString& rFamilyName, const Size& rSize )
 {
-if (const_cast(mpImplFont)->maFamilyName != rFamilyName
-|| const_cast(mpImplFont)->maAverageFontSize != rSize)
+if (GetFamilyName() != rFamilyName
+|| GetAverageFontSize() != rSize)
 {
 mpImplFont->SetFamilyName( rFamilyName );
 mpImplFont->SetFontSize( rSize );
@@ -80,9 +80,9 @@ Font::Font( const OUString& rFamilyName, const Size& rSize )
 
 Font::Font( const OUString& rFamilyName, const OUString& rStyleName, const 
Size& rSize )
 {
-if (const_cast(mpImplFont)->maFamilyName != rFamilyName
-|| const_cast(mpImplFont)->maStyleName != rStyleName
-|| const_cast(mpImplFont)->maAverageFontSize != rSize)
+if (GetFamilyName() != rFamilyName
+|| GetStyleName() != rStyleName
+|| GetAverageFontSize() != rSize)
 {
 mpImplFont->SetFamilyName( rFamilyName );
 mpImplFont->SetStyleName( rStyleName );
@@ -92,8 +92,8 @@ Font::Font( const OUString& rFamilyName, const OUString& 
rStyleName, const Size&
 
 Font::Font( FontFamily eFamily, const Size& rSize )
 {
-if (const_cast(mpImplFont)->meFamily != eFamily
-|| const_cast(mpImplFont)->maAverageFontSize != rSize)
+if (GetFontFamily() != eFamily
+|| GetAverageFontSize() != rSize)
 {
 mpImplFont->SetFamilyType( eFamily );
 mpImplFont->SetFontSize( rSize );
@@ -106,7 +106,7 @@ Font::~Font()
 
 void Font::SetColor( const Color& rColor )
 {
-if (const_cast(mpImplFont)->maColor != rColor)
+if (GetColor() != rColor)
 {
 mpImplFont->maColor = rColor;
 }
@@ -114,7 +114,7 @@ void Font::SetColor( const Color& rColor )
 
 void Font::SetFillColor( const Color& rColor )
 {
-if (const_cast(mpImplFont)->maFillColor != rColor)
+if (GetFillColor() != rColor)
 {
 mpImplFont->maFillColor = rColor;
 if ( rColor.IsTransparent() )
@@ -124,7 +124,7 @@ void Font::SetFillColor( const Color& rColor )
 
 void Font::SetTransparent( bool bTransparent )
 {
-if (const_cast(mpImplFont)->mbTransparent != bTransparent)
+if (IsTransparent() != bTransparent)
 mpImplFont->mbTransparent = bTransparent;
 }
 
@@ -136,13 +136,13 @@ void Font::SetAlignment( TextAlign eAlign )
 
 void Font::SetFamilyName( const OUString& rFamilyName )
 {
-if (const_cast(mpImplFont)->maFamilyName != rFamilyName)
+if (GetFamilyName() != rFamilyName)
 mpImplFont->SetFamilyName( rFamilyName );
 }
 
 void Font::SetStyleName( const OUString& rStyleName )
 {
-if (const_cast(mpImplFont)->maStyleName != rStyleName)
+if (GetStyleName() != rStyleName)
 mpImplFont->maStyleName = rStyleName;
 }
 
@@ -166,25 +166,25 @@ void Font::SetCharSet( rtl_TextEncoding eCharSet )
 
 void Font::SetLanguageTag( const LanguageTag& rLanguageTag )
 {
-if (const_cast(mpImplFont)->maLanguageTag != rLanguageTag)
+if (GetLanguageTag() != rLanguageTag)
 mpImplFont->maLanguageTag = rLanguageTag;
 }
 
 void Font::SetCJKContextLanguageTag( const LanguageTag& rLanguageTag )
 {
-if (const_cast(mpImplFont)->maCJKLanguageTag != 
rLanguageTag)
+if (GetCJKContextLanguageTag() != rLanguageTag)
 mpImplFont->maCJKLanguageTag = rLanguageTag;
 }
 
 void Font::SetLanguage( LanguageType eLanguage )
 {
-if (const_cast(mpImplFont)->maLanguageTag.getLanguageType(false) != eLanguage)
+if (GetLanguage() != eLanguage)
 mpImplFont->maLanguageTag.reset( eLanguage);
 }
 
 void Font::Set

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

2023-08-17 Thread Michael Weghorn (via logerrit)
 include/vcl/vclenum.hxx|3 +--
 vcl/source/window/dockmgr.cxx  |   20 
 vcl/source/window/floatwin.cxx |   15 ---
 3 files changed, 5 insertions(+), 33 deletions(-)

New commits:
commit 230789766b364bf995e6659dd589cdf902c69f2c
Author: Michael Weghorn 
AuthorDate: Thu Aug 17 15:39:10 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Aug 18 06:05:49 2023 +0200

tdf#156561 tdf#141101 Revert "tdf#140762 tdf#152671 Make dock win ..." et al

Revert

commit dc0706cabfe39ddb6ea23d60ccfb756f2b9e6efb
Author: Michael Weghorn 
Date:   Wed Mar 15 17:00:27 2023 +0100

tdf#140762 tdf#152671 Make dock win visible before showing popup

and 2 follow-up commits, since it's no longer necessary to
have the window visible already when the popup shows in order
for NVDA on Windows to announce the content.

This unifies the code path between gtk and non-gtk again,
as already pointed out in

commit 3bb762c53ea79f8915a1b8fa39f3f5f57aa68c84
Date:   Tue Aug 1 09:44:56 2023 +0200

tdf#156100 tdf#156561 Revert to previous behavior for gtk popups

> Further analysis of the root causes is planned in the context of
> tdf#156561, so hopefully the code paths can be unified again in
> the future.

The underlying issues have now been addressed by these
commits instead now:

commit 1d92445fcac1c51c17d8dbfd1a4017430fe7bc46
Author: Michael Weghorn 
Date:   Tue Aug 1 09:26:37 2023 +0100

tdf#156561 wina11y: Handle CHILD event

Change-Id I83cf5732bfc9d4886e4f7fa75d4ff462e4d4af6d
tdf#141101 tdf#156561 a11y: Handle a11y child events in win parent

Change-Id I69c6066127c8b853a27cc1f692f139572541f8eb
tdf#156561 a11y: Create VCLXTopWindow peer for border win frame

Change-Id If374032387babf41b28067d5df54d5f6ce682c48
tdf#156561 a11y: Don't ignore child events in AccessibleListBox

Change-Id Ifbe27de01739103d1da04951475db32aa50d429d
tdf#156561 svtools, a11y: Return created popup win for focus handling

Together with the above-mentioned commits, this also makes NVDA
announce the font color popup in the "Character" (character style)
dialog. (Announcement starts as soon as Tab is pressed once,
not yet for the initially focused item right away.)

Reverted commits:

commit 3bb762c53ea79f8915a1b8fa39f3f5f57aa68c84
Date:   Tue Aug 1 09:44:56 2023 +0200

tdf#156100 tdf#156561 Revert to previous behavior for gtk popups

commit 70642bb7afd2cee6f7ae6eff2936a35978bd0597
Date:   Thu Apr 6 15:07:15 2023 +0100

tdf#154470 try moving the Show of the client to after the float 
positioning

commit dc0706cabfe39ddb6ea23d60ccfb756f2b9e6efb
Date:   Wed Mar 15 17:00:27 2023 +0100

tdf#140762 tdf#152671 Make dock win visible before showing popup

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

diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 4b754d1b66b1..5ea0c77127d6 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -333,11 +333,10 @@ enum class FloatWinPopupFlags
 NoMouseUpClose   = 0x000200,
 GrabFocus= 0x000400,
 NoHorzPlacement  = 0x000800,
-MakeClientWindowVisibleBeforePopup  = 0x001000,
 };
 namespace o3tl
 {
-template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 
 // Flags for Window::Show()
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index cc122a71dd0d..ba9aa2aa9450 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -821,21 +821,8 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox 
*pParentToolBox, FloatWin
 if( pParentToolBox->IsKeyEvent() )
 nFlags |= FloatWinPopupFlags::GrabFocus;
 
-// tdf#140762, tdf#152671, tdf#154470, tdf#156100: Without client window 
being visible
-// before showing popup, at least NVDA on Windows does not announce items 
in the popup,
-// so make the client window visible first. This is problematic for gtk 
VCL plugins though,
-// so don't do it there and use different code paths for now.
-// For further analysis of the root causes, there's tdf#156561.
-const OUString sToolkit = Application::GetToolkitName();
-if (sToolkit == "gtk3" || sToolkit == "gtk4")
-{
-mpFloatWin->StartPopupMode( pParentToolBox, nFlags);
-GetWindow()->Show();
-}
-else
-{
-mpFloatWin->StartPopupMode( pParentToolBox, nFlags | 
FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup);
-}
+mpFloatW

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

2023-08-11 Thread Noel Grandin (via logerrit)
 include/vcl/toolbox.hxx   |1 -
 vcl/source/app/idle.cxx   |2 +-
 vcl/source/app/salvtables.cxx |8 
 vcl/source/control/PriorityMergedHBox.cxx |   10 +-
 vcl/source/control/combobox.cxx   |8 
 vcl/source/control/imp_listbox.cxx|2 +-
 vcl/source/control/spinfld.cxx|2 +-
 vcl/source/edit/vclmedit.cxx  |4 ++--
 vcl/source/uitest/uiobject.cxx|6 +++---
 vcl/source/window/menubarwindow.cxx   |2 +-
 vcl/source/window/toolbox.cxx |5 -
 vcl/unx/gtk3/gtkinst.cxx  |2 +-
 12 files changed, 23 insertions(+), 29 deletions(-)

New commits:
commit 69972719542cd686687ddd91f2b5284483513608
Author: Noel Grandin 
AuthorDate: Fri Aug 11 15:01:21 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 11 18:47:15 2023 +0200

clang-tidy bugprone-parent-virtual-call in vcl

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

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 6cf448a30b1d..aa24a6d5c2c4 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -291,7 +291,6 @@ public:
 virtual voidResizing( Size& rSize ) override;
 virtual SizeGetOptimalSize() const override;
 virtual voiddoDeferredInit(WinBits nBits) override;
-virtual voidqueue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
 
 /// Insert a command (like '.uno:Save').
 virtual voidInsertItem( const OUString& rCommand,
diff --git a/vcl/source/app/idle.cxx b/vcl/source/app/idle.cxx
index 7e5756537164..0aed942beb79 100644
--- a/vcl/source/app/idle.cxx
+++ b/vcl/source/app/idle.cxx
@@ -33,7 +33,7 @@ Idle::Idle( const char *pDebugName )
 
 void Idle::Start(const bool bStartTimer)
 {
-Task::Start(false);
+Timer::Start(false);
 
 sal_uInt64 nPeriod = Scheduler::ImmediateTimeoutMs;
 if (Scheduler::GetDeterministicMode())
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 80772536adeb..1ce6cf936316 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6227,22 +6227,22 @@ void SalInstanceDrawingArea::queue_draw_area(int x, int 
y, int width, int height
 
 void SalInstanceDrawingArea::connect_size_allocate(const Link& rLink)
 {
-weld::Widget::connect_size_allocate(rLink);
+SalInstanceWidget::connect_size_allocate(rLink);
 }
 
 void SalInstanceDrawingArea::connect_key_press(const Link& rLink)
 {
-weld::Widget::connect_key_press(rLink);
+SalInstanceWidget::connect_key_press(rLink);
 }
 
 void SalInstanceDrawingArea::connect_key_release(const Link& rLink)
 {
-weld::Widget::connect_key_release(rLink);
+SalInstanceWidget::connect_key_release(rLink);
 }
 
 void SalInstanceDrawingArea::connect_style_updated(const Link& 
rLink)
 {
-weld::Widget::connect_style_updated(rLink);
+SalInstanceWidget::connect_style_updated(rLink);
 }
 
 void SalInstanceDrawingArea::set_cursor(PointerStyle ePointerStyle)
diff --git a/vcl/source/control/PriorityMergedHBox.cxx 
b/vcl/source/control/PriorityMergedHBox.cxx
index fd5aa5814dac..5d5e6249ed16 100644
--- a/vcl/source/control/PriorityMergedHBox.cxx
+++ b/vcl/source/control/PriorityMergedHBox.cxx
@@ -46,18 +46,18 @@ PriorityMergedHBox::PriorityMergedHBox(vcl::Window* pParent)
 void PriorityMergedHBox::Resize()
 {
 if (comphelper::LibreOfficeKit::isActive())
-return VclHBox::Resize();
+return PriorityHBox::Resize();
 
 if (!m_bInitialized)
 Initialize();
 
 if (!m_bInitialized)
 {
-return VclHBox::Resize();
+return PriorityHBox::Resize();
 }
 
 tools::Long nWidth = GetSizePixel().Width();
-tools::Long nCurrentWidth = VclHBox::calculateRequisition().getWidth() + 
BUTTON_WIDTH;
+tools::Long nCurrentWidth = 
PriorityHBox::calculateRequisition().getWidth() + BUTTON_WIDTH;
 
 // Hide lower priority controls
 for (int i = GetChildCount() - 1; i >= 0; i--)
@@ -104,7 +104,7 @@ void PriorityMergedHBox::Resize()
 }
 }
 
-VclHBox::Resize();
+PriorityHBox::Resize();
 
 if (GetHiddenCount())
 m_pButton->Show();
@@ -138,7 +138,7 @@ Size PriorityMergedHBox::calculateRequisition() const
 {
 if (!m_bInitialized)
 {
-return VclHBox::calculateRequisition();
+return PriorityHBox::calculateRequisition();
 }
 
 sal_uInt16 nVisibleChildren = 0;
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 05b7a50006b9..ac817ce2a426 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -575,7 +575,7 @@ void ComboBox::setPosSizePixel( tools::Long nX, tools::Long 
nY, tools::Long nWid
 
 void ComboBox::Resize()
 {
-Control::Res

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

2023-07-18 Thread Noel Grandin (via logerrit)
 include/vcl/window.hxx   |4 
 vcl/source/window/dndeventdispatcher.cxx |   10 +-
 vcl/source/window/dockmgr.cxx|   10 +-
 vcl/source/window/dockwin.cxx|   10 +-
 vcl/source/window/mouse.cxx  |   12 ++--
 vcl/source/window/scrwnd.cxx |2 +-
 vcl/source/window/window2.cxx|   14 ++
 vcl/source/window/winproc.cxx|   14 +++---
 8 files changed, 31 insertions(+), 45 deletions(-)

New commits:
commit 8fc4c3504947d0e5c34978cb8ae9bdd2a2196fd1
Author: Noel Grandin 
AuthorDate: Tue Jul 18 16:28:17 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 18 19:10:29 2023 +0200

remove ImplFrameToOutput and ImplOutputToFrame

in favour of ScreenToOutputPixel and OutputToScreenPixel, since their
implementation is exactly the same

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

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index ba380cb8817d..c6ba57ef7e35 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -527,8 +527,6 @@ public:
 
 SAL_DLLPRIVATE WindowImpl*  ImplGetWindowImpl() const { return 
mpWindowImpl.get(); }
 
-SAL_DLLPRIVATE PointImplFrameToOutput( const Point& rPos );
-
 SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags );
 SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags 
nFlags );
 SAL_DLLPRIVATE void ImplInvertFocus( const 
tools::Rectangle& rRect );
@@ -571,8 +569,6 @@ protected:
 
 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, 
WinBits nStyle, SystemParentData* pSystemParentData );
 
-SAL_DLLPRIVATE PointImplOutputToFrame( const Point& rPos );
-
 SAL_DLLPRIVATE void ImplInvalidateParentFrameRegion( const 
vcl::Region& rRegion );
 SAL_DLLPRIVATE void ImplValidateFrameRegion( const 
vcl::Region* rRegion, ValidateFlags nFlags );
 SAL_DLLPRIVATE void ImplValidate();
diff --git a/vcl/source/window/dndeventdispatcher.cxx 
b/vcl/source/window/dndeventdispatcher.cxx
index b8190a118fd5..a5a89928e616 100644
--- a/vcl/source/window/dndeventdispatcher.cxx
+++ b/vcl/source/window/dndeventdispatcher.cxx
@@ -263,7 +263,7 @@ sal_Int32 DNDEventDispatcher::fireDragEnterEvent( 
vcl::Window *pWindow,
 if( xDropTarget.is() )
 {
 // retrieve relative mouse position
-Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
 aSolarGuard.clear();
 
 n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDragEnterEvent(
@@ -291,7 +291,7 @@ sal_Int32 DNDEventDispatcher::fireDragOverEvent( 
vcl::Window *pWindow,
 if( xDropTarget.is() )
 {
 // retrieve relative mouse position
-Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
 aSolarGuard.clear();
 
 n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDragOverEvent(
@@ -339,7 +339,7 @@ sal_Int32 DNDEventDispatcher::fireDropActionChangedEvent( 
vcl::Window *pWindow,
 if( xDropTarget.is() )
 {
 // retrieve relative mouse position
-Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
 aGuard.clear();
 
 n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDropActionChangedEvent(
@@ -370,7 +370,7 @@ sal_Int32 DNDEventDispatcher::fireDropEvent( vcl::Window 
*pWindow,
 if( xDropTarget.is() )
 {
 // retrieve relative mouse position
-Point relLoc = pWindow->ImplFrameToOutput( rLocation );
+Point relLoc = pWindow->ScreenToOutputPixel( rLocation );
 aGuard.clear();
 
 n = static_cast < DNDListenerContainer * > ( xDropTarget.get() 
)->fireDropEvent(
@@ -398,7 +398,7 @@ sal_Int32 DNDEventDispatcher::fireDragGestureEvent( 
vcl::Window *pWindow,
 if( xDragGestureRecognizer.is() )
 {
 // retrieve relative mouse position
-Point relLoc = pWindow->ImplFrameToOutput( rOrigin );
+Point relLoc = pWindow->ScreenToOutputPixel( rOrigin );
 aGuard.clear();
 
 n = static_cast < DNDListenerContainer * > ( 
xDragGestureRecognizer.get() )->fireDragGestureEvent(
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index d64f7cd8f208..5112c322abda 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -527,7 +527,7 @@ v

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

2023-07-04 Thread Noel Grandin (via logerrit)
 include/vcl/window.hxx   |2 +-
 vcl/source/window/window.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 2d1d1279790807235b1edcee8f807d594636fda7
Author: Noel Grandin 
AuthorDate: Mon Jul 3 21:35:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 4 09:12:10 2023 +0200

ImplGetUnmirroredOutOffX can be const

which avoids some unnecessary const_cast

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

diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 2a94c3bd414c..ba380cb8817d 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -692,7 +692,7 @@ private:
 
 SAL_DLLPRIVATE tools::Rectangle 
ImplOutputToUnmirroredAbsoluteScreenPixel( const tools::Rectangle& rRect ) 
const;
 SAL_DLLPRIVATE tools::Rectangle 
ImplUnmirroredAbsoluteScreenToOutputPixel( const tools::Rectangle& rRect ) 
const;
-SAL_DLLPRIVATE tools::Long ImplGetUnmirroredOutOffX();
+SAL_DLLPRIVATE tools::Long  ImplGetUnmirroredOutOffX() const;
 
 // retrieves the list of owner draw decorated windows for this window 
hierarchy
 SAL_DLLPRIVATE ::std::vector >& ImplGetOwnerDrawList();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index f79918fd7f52..c07433173287 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2818,11 +2818,11 @@ Point Window::ScreenToOutputPixel( const Point& rPos ) 
const
 return Point( rPos.X() - GetOutDev()->mnOutOffX, rPos.Y() - 
GetOutDev()->mnOutOffY );
 }
 
-tools::Long Window::ImplGetUnmirroredOutOffX()
+tools::Long Window::ImplGetUnmirroredOutOffX() const
 {
 // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow
 tools::Long offx = GetOutDev()->mnOutOffX;
-OutputDevice *pOutDev = GetOutDev();
+const OutputDevice *pOutDev = GetOutDev();
 if( pOutDev->HasMirroredGraphics() )
 {
 if( mpWindowImpl->mpParent && 
!mpWindowImpl->mpParent->mpWindowImpl->mbFrame && 
mpWindowImpl->mpParent->GetOutDev()->ImplIsAntiparallel() )
@@ -2844,14 +2844,14 @@ tools::Long Window::ImplGetUnmirroredOutOffX()
 Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const
 {
 // relative to top level parent
-tools::Long offx = 
const_cast(this)->ImplGetUnmirroredOutOffX();
+tools::Long offx = ImplGetUnmirroredOutOffX();
 return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->mnOutOffY );
 }
 
 Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const
 {
 // relative to top level parent
-tools::Long offx = 
const_cast(this)->ImplGetUnmirroredOutOffX();
+tools::Long offx = ImplGetUnmirroredOutOffX();
 return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->mnOutOffY );
 }
 


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

2023-06-30 Thread Noel Grandin (via logerrit)
 include/vcl/menubarupdateicon.hxx  |   93 +
 vcl/source/window/bubblewindow.cxx |  374 +
 2 files changed, 467 insertions(+)

New commits:
commit 263264315102519a0557bbf69beeaffb7ed6c873
Author: Noel Grandin 
AuthorDate: Fri Jun 30 08:34:01 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 30 09:53:05 2023 +0200

partially revert "loplugin:unusedmethods"

partially revert
commit 74cd0d0b281f8df75612bfb600df2eae62c4d21d
Author: Noel Grandin 
Date:   Thu Jun 29 13:53:30 2023 +0200
loplugin:unusedmethods

It generates

/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/extensions/source/update/ui/updatecheckui.cxx:35:10:
fatal error: vcl/menubarupdateicon.hxx: No such file or directory
10054  #include 
10055   ^~~

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

diff --git a/include/vcl/menubarupdateicon.hxx 
b/include/vcl/menubarupdateicon.hxx
new file mode 100644
index ..99aea9581a4f
--- /dev/null
+++ b/include/vcl/menubarupdateicon.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include 
+#include 
+#include 
+
+class BubbleWindow;
+class MenuBar;
+class SystemWindow;
+class VclSimpleEvent;
+class VclWindowEvent;
+struct MenuBarButtonCallbackArg;
+
+class VCL_DLLPUBLIC MenuBarUpdateIconManager
+{
+private:
+OUString maBubbleTitle;
+OUString maBubbleText;
+Image maBubbleImage;
+VclPtr mpBubbleWin;
+VclPtr mpActiveSysWin;
+VclPtr mpActiveMBar;
+std::vector> maIconMBars;
+std::vector maIconIDs;
+
+Link maWindowEventHdl;
+Link maApplicationEventHdl;
+Link maClickHdl;
+
+Timer maTimeoutTimer;
+Idle maWaitIdle;
+
+bool mbShowMenuIcon;
+bool mbShowBubble;
+bool mbBubbleChanged;
+
+DECL_DLLPRIVATE_LINK(UserEventHdl, void*, void);
+DECL_DLLPRIVATE_LINK(TimeOutHdl, Timer*, void);
+DECL_DLLPRIVATE_LINK(WindowEventHdl, VclWindowEvent&, void);
+DECL_DLLPRIVATE_LINK(ApplicationEventHdl, VclSimpleEvent&, void);
+DECL_DLLPRIVATE_LINK(WaitTimeOutHdl, Timer*, void);
+DECL_DLLPRIVATE_LINK(ClickHdl, MenuBarButtonCallbackArg&, bool);
+DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBarButtonCallbackArg&, bool);
+
+VclPtr GetBubbleWindow();
+void SetBubbleChanged();
+
+sal_uInt16 GetIconID(MenuBar* pMenuBar) const;
+
+void AddMenuBarIcon(SystemWindow& rSysWin, bool bAddEventHdl);
+void RemoveMenuBarIcon(MenuBar* pMenuBar);
+void RemoveMenuBarIcons();
+
+public:
+MenuBarUpdateIconManager();
+~MenuBarUpdateIconManager();
+
+void SetShowMenuIcon(bool bShowMenuIcon);
+void SetShowBubble(bool bShowBubble);
+void SetBubbleImage(const Image& rImage);
+void SetBubbleTitle(const OUString& rTitle);
+void SetBubbleText(const OUString& rText);
+
+void SetClickHdl(const Link& rHdl) { maClickHdl = 
rHdl; }
+
+bool GetShowMenuIcon() const { return mbShowMenuIcon; }
+bool GetShowBubble() const { return mbShowBubble; }
+const OUString& GetBubbleTitle() const { return maBubbleTitle; }
+const OUString& GetBubbleText() const { return maBubbleText; }
+
+void RemoveBubbleWindow();
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/bubblewindow.cxx 
b/vcl/source/window/bubblewindow.cxx
index fa04cec00fa3..9b8432a14a9a 100644
--- a/vcl/source/window/bubblewindow.cxx
+++ b/vcl/source/window/bubblewindow.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -214,4 +215,377 @@ void BubbleWindow::RecalcTextRects()
 maTextRect.Move( 2*BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT + 
maTitleRect.GetHeight() + aBoldFont.GetFontHeight() * 3 / 4 );
 }
 
+MenuBarUpdateIconManager::MenuBarUpdateIconManager()
+: maTimeoutTimer("MenuBarUpdateIconManager")
+, maWaitIdle("vcl MenuBarUpdateIconManager maWaitIdle")
+,

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

2023-06-28 Thread Noel Grandin (via logerrit)
 include/vcl/tabctrl.hxx|9 -
 vcl/source/control/tabctrl.cxx |   31 +--
 2 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit 88fcc30cf2f130168eb522a2a2b5f8e5725378b8
Author: Noel Grandin 
AuthorDate: Wed Jun 28 14:17:19 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jun 28 15:49:48 2023 +0200

these TAB_ constants do not need to be in the header file

they can be inside the .cxx file

Also rename slightly and document.

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

diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index c6dc7f2fcb23..3da709d77807 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -39,15 +39,6 @@ class ToolBox;
 #define TAB_PAGE_NOTFOUND   (sal_uInt16(0x))
 #endif /* !TAB_APPEND */
 
-#define TAB_OFFSET  3
-#define TAB_TABOFFSET_X 3
-#define TAB_TABOFFSET_Y 3
-#define TAB_EXTRASPACE_X6
-#define TAB_BORDER_LEFT 1
-#define TAB_BORDER_TOP  1
-#define TAB_BORDER_RIGHT2
-#define TAB_BORDER_BOTTOM   2
-
 class VCL_DLLPUBLIC TabControl : public Control
 {
 protected:
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index d44554b80b83..f59431401137 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -44,6 +44,17 @@
 #include 
 #include 
 
+#define TAB_OFFSET  3
+/// Space to the left and right of the tabitem
+#define TAB_ITEM_OFFSET_X 3
+/// Space to the top and bottom of the tabitem
+#define TAB_ITEM_OFFSET_Y 3
+#define TAB_EXTRASPACE_X6
+#define TAB_BORDER_LEFT 1
+#define TAB_BORDER_TOP  1
+#define TAB_BORDER_RIGHT2
+#define TAB_BORDER_BOTTOM   2
+
 class ImplTabItem final
 {
 sal_uInt16 m_nId;
@@ -239,14 +250,14 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, 
tools::Long nMaxWidth )
 if( aImageSize.Height() > aSize.Height() )
 aSize.setHeight( aImageSize.Height() );
 
-aSize.AdjustWidth(TAB_TABOFFSET_X*2 );
-aSize.AdjustHeight(TAB_TABOFFSET_Y*2 );
+aSize.AdjustWidth(TAB_ITEM_OFFSET_X*2 );
+aSize.AdjustHeight(TAB_ITEM_OFFSET_Y*2 );
 
 tools::Rectangle aCtrlRegion( Point( 0, 0 ), aSize );
 tools::Rectangle aBoundingRgn, aContentRgn;
-const TabitemValue aControlValue(tools::Rectangle(TAB_TABOFFSET_X, 
TAB_TABOFFSET_Y,
-   aSize.Width() - TAB_TABOFFSET_X 
* 2,
-   aSize.Height() - 
TAB_TABOFFSET_Y * 2));
+const TabitemValue aControlValue(tools::Rectangle(TAB_ITEM_OFFSET_X, 
TAB_ITEM_OFFSET_Y,
+   aSize.Width() - 
TAB_ITEM_OFFSET_X * 2,
+   aSize.Height() - 
TAB_ITEM_OFFSET_Y * 2));
 if(GetNativeControlRegion( ControlType::TabItem, ControlPart::Entire, 
aCtrlRegion,
ControlState::ENABLED, 
aControlValue,
aBoundingRgn, aContentRgn ) )
@@ -270,7 +281,7 @@ Size TabControl::ImplGetItemSize( ImplTabItem* pItem, 
tools::Long nMaxWidth )
 pItem->maFormatText = pItem->maFormatText.replaceAt( 
pItem->maFormatText.getLength()-aAppendStr.getLength()-1, 1, u"" );
 aSize.setWidth( GetOutDev()->GetCtrlTextWidth( pItem->maFormatText 
) );
 aSize.AdjustWidth(aImageSize.Width() );
-aSize.AdjustWidth(TAB_TABOFFSET_X*2 );
+aSize.AdjustWidth(TAB_ITEM_OFFSET_X*2 );
 }
 while ( (aSize.Width()+4 >= nMaxWidth) && 
(pItem->maFormatText.getLength() > aAppendStr.getLength()) );
 if ( aSize.Width()+4 >= nMaxWidth )
@@ -879,10 +890,10 @@ void TabControl::ImplDrawItem(vcl::RenderContext& 
rRenderContext, ImplTabItem co
 bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::TabItem, 
ControlPart::Entire);
 if ( bNativeOK )
 {
-TabitemValue tiValue(tools::Rectangle(pItem->maRect.Left() + 
TAB_TABOFFSET_X,
-   pItem->maRect.Top() + TAB_TABOFFSET_Y,
-   pItem->maRect.Right() - TAB_TABOFFSET_X,
-   pItem->maRect.Bottom() - 
TAB_TABOFFSET_Y));
+TabitemValue tiValue(tools::Rectangle(pItem->maRect.Left() + 
TAB_ITEM_OFFSET_X,
+   pItem->maRect.Top() + TAB_ITEM_OFFSET_Y,
+   pItem->maRect.Right() - 
TAB_ITEM_OFFSET_X,
+   pItem->maRect.Bottom() - 
TAB_ITEM_OFFSET_Y));
 if (pItem->maRect.Left() < 5)
 tiValue.mnAlignment |= TabitemFlags::LeftAligned;
 if (pItem->maRect.Right() > mnLastWidth - 5)


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

2023-06-14 Thread Paris Oplopoios (via logerrit)
 include/vcl/filter/PngImageReader.hxx   |   17 +
 vcl/source/filter/GraphicFormatDetector.cxx |   11 ++-
 vcl/source/filter/png/PngImageReader.cxx|   15 ---
 3 files changed, 23 insertions(+), 20 deletions(-)

New commits:
commit 427769a751d3f45e41e5a0f4aed385bb2727998c
Author: Paris Oplopoios 
AuthorDate: Wed Jun 14 02:45:43 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Wed Jun 14 13:23:11 2023 +0200

Remove duplicate constants relating to PNGs

The PNG signature constant was defined in multiple places

Change-Id: Ia90636819341295129a37a91199857a612d62177
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153032
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/filter/PngImageReader.hxx 
b/include/vcl/filter/PngImageReader.hxx
index 01fdc2915e54..201e3a08b8c0 100644
--- a/include/vcl/filter/PngImageReader.hxx
+++ b/include/vcl/filter/PngImageReader.hxx
@@ -21,6 +21,23 @@
 
 #include 
 
+constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
+constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
+constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
+constexpr sal_uInt32 PNG_PHYS_SIGNATURE = 0x70485973;
+constexpr sal_uInt32 PNG_TRNS_SIGNATURE = 0x74524E53;
+constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
+constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
+constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
+constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
+constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
+constexpr int PNG_SIGNATURE_SIZE = 8;
+constexpr int PNG_IHDR_SIZE = 13;
+constexpr int PNG_TYPE_SIZE = 4;
+constexpr int PNG_SIZE_SIZE = 4;
+constexpr int PNG_CRC_SIZE = 4;
+constexpr int PNG_IEND_SIZE = 0;
+
 namespace com::sun::star::task
 {
 class XStatusIndicator;
diff --git a/vcl/source/filter/GraphicFormatDetector.cxx 
b/vcl/source/filter/GraphicFormatDetector.cxx
index fc5a0fdc79c3..4fc2c85c2a4e 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -849,13 +849,14 @@ bool GraphicFormatDetector::checkGIF()
 bool GraphicFormatDetector::checkPNG()
 {
 SeekGuard aGuard(mrStream, mnStreamPosition);
-if (mnFirstLong == 0x89504e47 && mnSecondLong == 0x0d0a1a0a)
+uint64_t nSignature = (static_cast(mnFirstLong) << 32) | 
mnSecondLong;
+if (nSignature == PNG_SIGNATURE)
 {
 maMetadata.mnFormat = GraphicFileFormat::PNG;
 if (mbExtendedInfo)
 {
 sal_uInt32 nTemp32;
-mrStream.Seek(mnStreamPosition + 8);
+mrStream.Seek(mnStreamPosition + PNG_SIGNATURE_SIZE);
 do
 {
 sal_uInt8 cByte = 0;
@@ -901,9 +902,9 @@ bool GraphicFormatDetector::checkPNG()
 // read up to the start of the image
 mrStream.ReadUInt32(nLen32);
 mrStream.ReadUInt32(nTemp32);
-while (mrStream.good() && nTemp32 != 0x49444154)
+while (mrStream.good() && nTemp32 != PNG_IDAT_SIGNATURE)
 {
-if (nTemp32 == 0x70485973) // physical pixel dimensions
+if (nTemp32 == PNG_PHYS_SIGNATURE) // physical pixel 
dimensions
 {
 sal_uLong nXRes;
 sal_uLong nYRes;
@@ -935,7 +936,7 @@ bool GraphicFormatDetector::checkPNG()
 
 nLen32 -= 9;
 }
-else if (nTemp32 == 0x74524e53) // transparency
+else if (nTemp32 == PNG_TRNS_SIGNATURE) // transparency
 {
 maMetadata.mbIsTransparent = true;
 maMetadata.mbIsAlpha = (cColType != 0 && cColType != 
2);
diff --git a/vcl/source/filter/png/PngImageReader.cxx 
b/vcl/source/filter/png/PngImageReader.cxx
index 1cb72bdbe6b5..7e3fdbe44d71 100644
--- a/vcl/source/filter/png/PngImageReader.cxx
+++ b/vcl/source/filter/png/PngImageReader.cxx
@@ -51,21 +51,6 @@ void lclReadStream(png_structp pPng, png_bytep pOutBytes, 
png_size_t nBytesToRea
 }
 }
 
-constexpr int PNG_SIGNATURE_SIZE = 8;
-constexpr int PNG_IHDR_SIZE = 13;
-constexpr int PNG_TYPE_SIZE = 4;
-constexpr int PNG_SIZE_SIZE = 4;
-constexpr int PNG_CRC_SIZE = 4;
-constexpr int PNG_IEND_SIZE = 0;
-constexpr sal_uInt64 PNG_SIGNATURE = 0x89504E470D0A1A0A;
-constexpr sal_uInt32 PNG_IHDR_SIGNATURE = 0x49484452;
-constexpr sal_uInt32 PNG_IDAT_SIGNATURE = 0x49444154;
-constexpr sal_uInt32 PNG_ACTL_SIGNATURE = 0x6163544C;
-constexpr sal_uInt32 PNG_FCTL_SIGNATURE = 0x6663544C;
-constexpr sal_uInt32 PNG_FDAT_SIGNATURE = 0x66644154;
-constexpr sal_uInt32 PNG_IEND_SIGNATURE = 0x49454E44;
-constexpr sal_uInt32 PNG_IEND_CRC = 0xAE426082;
-
 bool isPng(SvStream& rStream)
 {
 // Check signature bytes


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

2023-06-10 Thread Paris Oplopoios (via logerrit)
 include/vcl/bitmapex.hxx |1 +
 vcl/source/bitmap/BitmapEx.cxx   |5 +
 vcl/source/filter/png/PngImageWriter.cxx |8 ++--
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 7588c1f33cdaab58a6b84f4f4e75922c5d4a8a7f
Author: Paris Oplopoios 
AuthorDate: Sat Jun 10 21:33:39 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Sun Jun 11 01:13:39 2023 +0200

tdf#154168 Export no transparency PNGs correctly

When bTranslucent was false the function would simply return, causing a
0 byte png. Now we just remove the alpha channel.

Change-Id: Ie2578185ac12fb38b6f1b674758e564721e3973f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152840
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 5838ef8d6e40..9d7a104264ef 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -56,6 +56,7 @@ public:
 boolIsEmpty() const;
 voidSetEmpty();
 voidClear();
+voidClearAlpha();
 
 voidDraw( OutputDevice* pOutDev,
   const Point& rDestPt ) const;
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index af712a0561a5..ad4adca6319e 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -190,6 +190,11 @@ void BitmapEx::Clear()
 SetEmpty();
 }
 
+void BitmapEx::ClearAlpha()
+{
+maAlphaMask.SetEmpty();
+}
+
 bool BitmapEx::IsAlpha() const
 {
 return !maAlphaMask.IsEmpty();
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 914302223d6a..e68c6155826b 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -60,8 +60,6 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
  bool bInterlaced, bool bTranslucent,
  const std::vector& aAdditionalChunks)
 {
-if (rBitmapEx.IsAlpha() && !bTranslucent)
-return false;
 if (rBitmapEx.IsEmpty())
 return false;
 
@@ -88,6 +86,12 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 aBitmapEx = rBitmapEx;
 }
 
+if (!bTranslucent)
+{
+// Clear alpha channel
+aBitmapEx.ClearAlpha();
+}
+
 Bitmap aBitmap;
 AlphaMask aAlphaMask;
 Bitmap::ScopedReadAccess pAccess;


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

2023-06-10 Thread خالد حسني (via logerrit)
 include/vcl/outdev.hxx |2 +-
 vcl/source/outdev/textline.cxx |   21 ++---
 2 files changed, 11 insertions(+), 12 deletions(-)

New commits:
commit 4ceac7d67d3f3e09dc3f4a03b330d779e6a71e4c
Author: خالد حسني 
AuthorDate: Thu Jun 8 15:22:58 2023 +0200
Commit: خالد حسني 
CommitDate: Sat Jun 10 17:14:52 2023 +0200

Revert "tdf#151968: Fix vertical position of RTL spelling wavy line"

This reverts commit 5899b27e71430e490c2d3a6b87ae52c10f383ba7.

Reason for revert: tdf#155001

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4075f28abf99..d550ecfce293 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -758,7 +758,7 @@ private:
 SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const 
basegfx::B2DPolyPolygon& rB2DPolyPoly);
 ///@}
 
-SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, 
tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long 
nWaveHeight, Degree10 nOrientation, tools::Long nLineWidth);
+SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, 
tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long 
nWaveHeight, double fOrientation, tools::Long nLineWidth);
 
 
 /** @name Curved shape functions
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index d539f4fc77ca..84afc56a6cef 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -1012,13 +1012,14 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 tools::Long nStartY = aStartPt.Y();
 tools::Long nEndX = aEndPt.X();
 tools::Long nEndY = aEndPt.Y();
-auto nOrientation = mpFontInstance->mnOrientation;
+double fOrientation = 0.0;
 
 // handle rotation
-if (nOrientation)
+if (nStartY != nEndY || nStartX > nEndX)
 {
+fOrientation = basegfx::rad2deg(std::atan2(nStartY - nEndY, nEndX - 
nStartX));
 // un-rotate the end point
-aStartPt.RotateAround(nEndX, nEndY, nOrientation);
+aStartPt.RotateAround(nEndX, nEndY, 
Degree10(static_cast(-fOrientation * 10.0)));
 }
 
 // Handle HiDPI
@@ -1045,9 +1046,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 nLineWidth = 0;
 }
 
-// The code below does not work for RTL text, that is what nEndX > nStartX
-// check is for.
-if ( nOrientation == 0_deg10 && nEndX > nStartX )
+if ( fOrientation == 0.0 )
 {
 static vcl::DeleteOnDeinit< WavyLineCache > snLineCache {};
 if ( !snLineCache.get() )
@@ -1065,7 +1064,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 pVirtDev->SetBackground( Wallpaper( COL_TRANSPARENT ) );
 pVirtDev->Erase();
 pVirtDev->SetAntialiasing( AntialiasingFlags::Enable );
-pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, 
nWaveHeight, nOrientation, nLineWidth );
+pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, 
nWaveHeight, fOrientation, nLineWidth );
 BitmapEx aBitmapEx(pVirtDev->GetBitmapEx(Point(0, 0), 
pVirtDev->GetOutputSize()));
 
 // Ideally we don't need this block, but in the split rgb surface 
+ separate alpha surface
@@ -1086,10 +1085,10 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 return;
 }
 
-ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, 
nOrientation, nLineWidth );
+ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, 
fOrientation, nLineWidth );
 }
 
-void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long 
nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, 
Degree10 nOrientation, tools::Long nLineWidth)
+void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long 
nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, double 
fOrientation, tools::Long nLineWidth)
 {
 // we need a graphics
 if( !mpGraphics && !AcquireGraphics() )
@@ -1107,7 +1106,7 @@ void OutputDevice::ImplDrawWaveLineBezier(tools::Long 
nStartX, tools::Long nStar
 
 const basegfx::B2DRectangle aWaveLineRectangle(nStartX, nStartY, nEndX, 
nEndY + nWaveHeight);
 const basegfx::B2DPolygon aWaveLinePolygon = 
basegfx::createWaveLinePolygon(aWaveLineRectangle);
-const basegfx::B2DHomMatrix aRotationMatrix = 
basegfx::utils::createRotateAroundPoint(nStartX, nStartY, 
toRadians(nOrientation));
+const basegfx::B2DHomMatrix aRotationMatrix = 
basegfx::utils::createRotateAroundPoint(nStartX, nStartY, 
basegfx::deg2rad(-fOrientation));
 const bool bPixelSnapHairline(mnAntialiasing & 
Antial

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

2023-05-11 Thread Caolán McNamara (via logerrit)
 include/vcl/formatter.hxx   |3 ++-
 vcl/source/control/fmtfield.cxx |7 ++-
 vcl/unx/gtk3/gtkinst.cxx|   13 -
 3 files changed, 20 insertions(+), 3 deletions(-)

New commits:
commit 4ae776b842a8b6f065206d3250113493fd688756
Author: Caolán McNamara 
AuthorDate: Thu May 11 16:03:57 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 11 21:39:21 2023 +0200

tdf#155241 keep current MetricSpinButton value if unparseable junk input

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

diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx
index 2049d1e12a6f..4aa81ea1be30 100644
--- a/include/vcl/formatter.hxx
+++ b/include/vcl/formatter.hxx
@@ -117,6 +117,7 @@ protected:
 boolm_bAutoColor : 1;
 boolm_bEnableNaN : 1;
 boolm_bDisableRemainderFactor : 1;
+boolm_bDefaultValueSet : 1;
 enum valueState { valueDirty, valueString, valueDouble };
 valueState  m_ValueState;
 double  m_dCurrentValue;
@@ -181,7 +182,7 @@ public:
 voidEnableEmptyField(bool bEnable);
 // If disabled, the value will be reset to the last valid value on leave
 
-voidSetDefaultValue(double dDefault){ m_dDefaultValue = dDefault; 
m_ValueState = valueDirty; }
+voidSetDefaultValue(double dDefault){ m_dDefaultValue = dDefault; 
m_ValueState = valueDirty; m_bDefaultValueSet = true; }
 // If the current String is invalid, GetValue() returns this value
 double  GetDefaultValue() const { return m_dDefaultValue; }
 
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index ed73accd3c7c..de5713261e83 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -266,6 +266,7 @@ Formatter::Formatter()
 ,m_bAutoColor(false)
 ,m_bEnableNaN(false)
 ,m_bDisableRemainderFactor(false)
+,m_bDefaultValueSet(false)
 ,m_ValueState(valueDirty)
 ,m_dCurrentValue(0)
 ,m_dDefaultValue(0)
@@ -791,7 +792,11 @@ bool Formatter::ImplGetValue(double& dNewVal)
 if (m_ValueState == valueDouble)
 return true;
 
-dNewVal = m_dDefaultValue;
+// tdf#155241 default to m_dDefaultValue only if explicitly set
+// otherwise default to m_dCurrentValue
+if (m_bDefaultValueSet)
+dNewVal = m_dDefaultValue;
+
 OUString sText(GetEntryText());
 if (sText.isEmpty())
 return true;
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 0106507edad6..adea2d9a7c10 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -17494,6 +17494,11 @@ public:
 m_aCustomFont.use_custom_font(&rFont, u"spinbutton");
 }
 
+void set_update_policy_if_valid()
+{
+gtk_spin_button_set_update_policy(m_pButton, GTK_UPDATE_IF_VALID);
+}
+
 virtual void disable_notify_events() override
 {
 g_signal_handler_block(m_pButton, m_nValueChangedSignalId);
@@ -24323,7 +24328,13 @@ public:
 
 virtual std::unique_ptr 
weld_metric_spin_button(const OUString& id, FieldUnit eUnit) override
 {
-return std::make_unique(weld_spin_button(id), 
eUnit);
+std::unique_ptr xButton(weld_spin_button(id));
+if (xButton)
+{
+GtkInstanceSpinButton& rButton = 
dynamic_cast(*xButton);
+rButton.set_update_policy_if_valid();
+}
+return std::make_unique(std::move(xButton), 
eUnit);
 }
 
 virtual std::unique_ptr 
weld_formatted_spin_button(const OUString &id) override


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

2023-05-10 Thread Noel Grandin (via logerrit)
 include/vcl/print.hxx|2 +-
 vcl/source/gdi/print.cxx |   39 +++
 2 files changed, 12 insertions(+), 29 deletions(-)

New commits:
commit 9d5d7b021db791b309469bc946d59502d47e6bef
Author: Noel Grandin 
AuthorDate: Wed May 10 15:29:08 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 10 18:54:12 2023 +0200

ImplPrintTransparent is always called with an empty mask

which we can use to simplify it

Change-Id: I8fa38a9f414d8d720e31bd1f71fd722f6a95fdbc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151635
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 84a8c4d9dc95..d6ce7728f9a6 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -107,7 +107,7 @@ private:
 ImplSalPrinterErrorCodeToVCL( SalPrinterError 
nError );
 
 SAL_DLLPRIVATE void ImplPrintTransparent (
-const Bitmap& rBmp, const Bitmap& rMask,
+const Bitmap& rBmp,
 const Point& rDestPt, const Size& 
rDestSize,
 const Point& rSrcPtPixel, const Size& 
rSrcSizePixel );
 
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 95525639e493..3e92abd02487 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -94,7 +94,7 @@ void ImplUpdateJobSetupPaper( JobSetup& rJobSetup )
 }
 }
 
-void Printer::ImplPrintTransparent( const Bitmap& rBmp, const Bitmap& rMask,
+void Printer::ImplPrintTransparent( const Bitmap& rBmp,
  const Point& rDestPt, const Size& 
rDestSize,
  const Point& rSrcPtPixel, const Size& 
rSrcSizePixel )
 {
@@ -107,12 +107,9 @@ void Printer::ImplPrintTransparent( const Bitmap& rBmp, 
const Bitmap& rMask,
 if( rBmp.IsEmpty() || !aSrcRect.GetWidth() || !aSrcRect.GetHeight() || 
!aDestSz.Width() || !aDestSz.Height() )
 return;
 
-Bitmap  aPaint( rBmp ), aMask( rMask );
+Bitmap  aPaint( rBmp );
 BmpMirrorFlags nMirrFlags = BmpMirrorFlags::NONE;
 
-if (aMask.getPixelFormat() >= vcl::PixelFormat::N8_BPP)
-aMask.Convert( BmpConversion::N1BitThreshold );
-
 // mirrored horizontally
 if( aDestSz.Width() < 0 )
 {
@@ -133,22 +130,17 @@ void Printer::ImplPrintTransparent( const Bitmap& rBmp, 
const Bitmap& rMask,
 if( aSrcRect != tools::Rectangle( Point(), aPaint.GetSizePixel() ) )
 {
 aPaint.Crop( aSrcRect );
-aMask.Crop( aSrcRect );
 }
 
 // destination mirrored
 if( nMirrFlags != BmpMirrorFlags::NONE )
 {
 aPaint.Mirror( nMirrFlags );
-aMask.Mirror( nMirrFlags );
 }
 
 // we always want to have a mask
-if( aMask.IsEmpty() )
-{
-aMask = Bitmap(aSrcRect.GetSize(), vcl::PixelFormat::N8_BPP, 
&Bitmap::GetGreyPalette(256));
-aMask.Erase( COL_BLACK );
-}
+AlphaMask aAlphaMask(aSrcRect.GetSize());
+aAlphaMask.Erase( 0 );
 
 // do painting
 const tools::Long nSrcWidth = aSrcRect.GetWidth(), nSrcHeight = 
aSrcRect.GetHeight();
@@ -166,24 +158,15 @@ void Printer::ImplPrintTransparent( const Bitmap& rBmp, 
const Bitmap& rMask,
 for( nY = 0; nY <= nSrcHeight; nY++ )
 pMapY[ nY ] = aDestPt.Y() + FRound( 
static_cast(aDestSz.Height()) * nY / nSrcHeight );
 
-// walk through all rectangles of mask
-const vcl::Region aWorkRgn(aMask.CreateRegion(COL_BLACK, 
tools::Rectangle(Point(), aMask.GetSizePixel(;
-RectangleVector aRectangles;
-aWorkRgn.GetRegionRectangles(aRectangles);
-
-for (auto const& rectangle : aRectangles)
-{
-const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
-const Size aMapSz( pMapX[rectangle.Right() + 1] - aMapPt.X(),  // 
pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
-   pMapY[rectangle.Bottom() + 1] - aMapPt.Y());// 
same for Y
-Bitmap aBandBmp(aPaint);
+tools::Rectangle rectangle { Point(0,0), aSrcRect.GetSize() };
+const Point aMapPt(pMapX[rectangle.Left()], pMapY[rectangle.Top()]);
+const Size aMapSz( pMapX[rectangle.Right() + 1] - aMapPt.X(),  // 
pMapX[L + W] -> L + ((R - L) + 1) -> R + 1
+   pMapY[rectangle.Bottom() + 1] - aMapPt.Y());// same 
for Y
+Bitmap aBandBmp(aPaint);
 
-aBandBmp.Crop(rectangle);
-DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
-}
+DrawBitmap(aMapPt, aMapSz, Point(), aBandBmp.GetSizePixel(), aBandBmp);
 
 mbMap = bOldMap;
-
 }
 
 bool Printer::DrawTransformBitmapExDirect(
@@ -221,7 +204,7 @@ void Printer::DrawDeviceBitmapEx( const Point& rDestPt, 
const Size& rDestSize,
 else
 {
 Bitmap aBmp( rBmpEx.GetBitmap() );
-ImplPrintTransparent( aBmp, Bitmap(), rDestPt, rDestSize, rS

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

2023-05-05 Thread Michael Meeks (via logerrit)
 include/vcl/BinaryDataContainer.hxx|   15 ++-
 include/vcl/gfxlink.hxx|3 
 vcl/source/gdi/impgraph.cxx|5 +
 vcl/source/graphic/BinaryDataContainer.cxx |  117 +
 4 files changed, 123 insertions(+), 17 deletions(-)

New commits:
commit 0f2581204a70038ed7ca78089a9bd96d158e02c0
Author: Michael Meeks 
AuthorDate: Mon Apr 3 09:34:54 2023 +0100
Commit: Michael Meeks 
CommitDate: Fri May 5 18:47:03 2023 +0200

BinaryDataContainer swap out implementation.

We can easily accumulate a large number of in-memory graphic
objects, and swapping these as well as the un-compressed
images can become important.

For now we swap out the container when the image is swapped
out, however it seems unlikely it will ever need to be swapped
in again.

Despite the shared pImpl, we retained the reference counting
on the underling vector to keep this immutable while we hand
out a MemoryStream reference to it.

Change-Id: Ib7ca45afb8499460b1852461f7c11afca3f3cdfa
Signed-off-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151359
Tested-by: Jenkins

diff --git a/include/vcl/BinaryDataContainer.hxx 
b/include/vcl/BinaryDataContainer.hxx
index e9e46a04e667..f6f07f0c5ef6 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -13,6 +13,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -26,9 +27,11 @@
  */
 class VCL_DLLPUBLIC BinaryDataContainer final
 {
-private:
-// the binary data
-std::shared_ptr> mpData;
+struct Impl;
+
+std::shared_ptr mpImpl;
+
+void ensureSwappedIn() const;
 
 public:
 BinaryDataContainer() = default;
@@ -53,6 +56,12 @@ public:
 /// writes the contents to the given stream
 std::size_t writeToStream(SvStream& rStream) const;
 
+/// return the in-memory size in bytes as of now.
+std::size_t getSizeBytes() const;
+
+/// swap out to disk for now
+void swapOut() const;
+
 size_t calculateHash() const;
 };
 
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 8c0f5fd32b05..531633b3f738 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -85,6 +85,9 @@ public:
 sal_uInt32  GetDataSize() const { return 
maDataContainer.getSize(); }
 const sal_uInt8*GetData() const;
 
+/// return the in-memory size as of now.
+size_t  getSizeBytes() const { return 
maDataContainer.getSizeBytes(); }
+
 const BinaryDataContainer& getDataContainer() const
 {
 return maDataContainer;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 84df1765569c..41f921228d34 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1250,6 +1250,9 @@ bool ImpGraphic::swapOutGraphic(SvStream& rStream)
 break;
 }
 
+if (mpGfxLink)
+mpGfxLink->getDataContainer().swapOut();
+
 return true;
 }
 
@@ -1431,6 +1434,8 @@ void ImpGraphic::dumpState(rtl::OStringBuffer &rState)
 rState.append(static_cast(meType));
 rState.append("\tsize:\t");
 rState.append(static_cast(mnSizeBytes));
+rState.append("\tgfxl:\t");
+rState.append(static_cast(mpGfxLink ? mpGfxLink->getSizeBytes() 
: -1));
 rState.append("\t");
 rState.append(static_cast(maSwapInfo.maSizePixel.Width()));
 rState.append("x");
diff --git a/vcl/source/graphic/BinaryDataContainer.cxx 
b/vcl/source/graphic/BinaryDataContainer.cxx
index b35195b7d27e..f395497f9449 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -10,21 +10,76 @@
 
 #include 
 #include 
+#include 
+#include 
+#include 
+
+struct BinaryDataContainer::Impl
+{
+// temp file to store the data out of RAM if necessary
+std::unique_ptr mpFile;
+// the binary data
+std::shared_ptr> mpData;
+
+Impl(SvStream& stream, size_t size) { readData(stream, size); }
+
+/// Populate mpData from the stream
+void readData(SvStream& stream, size_t size)
+{
+auto pData = std::make_shared>(size);
+if (stream.ReadBytes(pData->data(), pData->size()) == size)
+mpData = std::move(pData);
+}
+
+/// ensure the data is in-RAM
+void ensureSwappedIn()
+{
+if (mpData || !mpFile)
+return;
+
+auto pStream = mpFile->GetStream(StreamMode::READ);
+pStream->Seek(0);
+readData(*pStream, pStream->remainingSize());
+
+// Horrifying data loss ...
+SAL_WARN_IF(pStream->GetError(), "vcl",
+"Inconsistent system - failed to swap image back in");
+SAL_DEBUG("Swap in: " << pStream->GetError());
+}
+
+void swapOut()
+{
+if (mpFile)
+{
+// we already have it swapped out.
+mpData.reset();
+return;
+}
+
+if (!mpData || mpData-

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

2023-04-13 Thread Michael Meeks (via logerrit)
 include/vcl/BinaryDataContainer.hxx   |5 ++---
 vcl/source/gdi/vectorgraphicdata.cxx  |7 ++-
 vcl/source/graphic/BinaryDataContainer.cxx|   12 
 vcl/source/graphic/UnoBinaryDataContainer.cxx |   11 +--
 4 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 689f0da67b063284991d758a4f0c66a305dcad37
Author: Michael Meeks 
AuthorDate: Sat Apr 1 15:06:30 2023 +0100
Commit: Michael Meeks 
CommitDate: Thu Apr 13 22:22:47 2023 +0200

BinaryDataContainer: pure re-factor - encapsulate cbegin/cend

Change-Id: Ic8dbf0afdb96a0f1be210eedfbd12ef6467dd29f
Signed-off-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149916
Tested-by: Jenkins

diff --git a/include/vcl/BinaryDataContainer.hxx 
b/include/vcl/BinaryDataContainer.hxx
index 0d5be69f512c..2e2e5d4b6264 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -12,6 +12,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -44,15 +45,13 @@ public:
 size_t getSize() const;
 bool isEmpty() const;
 const sal_uInt8* getData() const;
+css::uno::Sequence getCopyAsByteSequence() const;
 
 // Returns the data as a stream open for reading
 SvMemoryStream getMemoryStream();
 std::size_t writeToStream(SvStream& rStream) const;
 
 size_t calculateHash() const;
-
-auto cbegin() const { return mpData->cbegin(); }
-auto cend() const { return mpData->cend(); }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/vectorgraphicdata.cxx 
b/vcl/source/gdi/vectorgraphicdata.cxx
index d2a0aa06a682..979fd4f18ad0 100644
--- a/vcl/source/gdi/vectorgraphicdata.cxx
+++ b/vcl/source/gdi/vectorgraphicdata.cxx
@@ -196,11 +196,9 @@ void VectorGraphicData::ensureSequenceAndRange()
 {
 case VectorGraphicDataType::Svg:
 {
-css::uno::Sequence 
aDataSequence(maDataContainer.getSize());
-std::copy(maDataContainer.cbegin(), maDataContainer.cend(), 
aDataSequence.getArray());
+css::uno::Sequence aDataSequence = 
maDataContainer.getCopyAsByteSequence();
 const uno::Reference xInputStream(new 
comphelper::SequenceInputStream(aDataSequence));
 
-
 const uno::Reference< graphic::XSvgParser > xSvgParser = 
graphic::SvgTools::create(xContext);
 
 if (xInputStream.is())
@@ -213,8 +211,7 @@ void VectorGraphicData::ensureSequenceAndRange()
 {
 const uno::Reference< graphic::XEmfParser > xEmfParser = 
graphic::EmfTools::create(xContext);
 
-css::uno::Sequence 
aDataSequence(maDataContainer.getSize());
-std::copy(maDataContainer.cbegin(), maDataContainer.cend(), 
aDataSequence.getArray());
+css::uno::Sequence aDataSequence = 
maDataContainer.getCopyAsByteSequence();
 const uno::Reference xInputStream(new 
comphelper::SequenceInputStream(aDataSequence));
 
 if (xInputStream.is())
diff --git a/vcl/source/graphic/BinaryDataContainer.cxx 
b/vcl/source/graphic/BinaryDataContainer.cxx
index 0264fec09983..deb676a553f9 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -30,6 +30,18 @@ size_t BinaryDataContainer::calculateHash() const
 return nSeed;
 }
 
+css::uno::Sequence BinaryDataContainer::getCopyAsByteSequence() const
+{
+if (isEmpty())
+return css::uno::Sequence();
+
+css::uno::Sequence aData(getSize());
+
+std::copy(mpData->cbegin(), mpData->cend(), aData.getArray());
+
+return aData;
+}
+
 SvMemoryStream BinaryDataContainer::getMemoryStream()
 {
 return SvMemoryStream(mpData ? mpData->data() : nullptr, getSize(), 
StreamMode::READ);
diff --git a/vcl/source/graphic/UnoBinaryDataContainer.cxx 
b/vcl/source/graphic/UnoBinaryDataContainer.cxx
index 4d6a0de9f796..3fe277024a6e 100644
--- a/vcl/source/graphic/UnoBinaryDataContainer.cxx
+++ b/vcl/source/graphic/UnoBinaryDataContainer.cxx
@@ -16,16 +16,7 @@ using namespace css;
 
 css::uno::Sequence SAL_CALL 
UnoBinaryDataContainer::getCopyAsByteSequence()
 {
-if (maBinaryDataContainer.isEmpty())
-return css::uno::Sequence();
-
-size_t nSize = maBinaryDataContainer.getSize();
-
-css::uno::Sequence aData(nSize);
-
-std::copy(maBinaryDataContainer.cbegin(), maBinaryDataContainer.cend(), 
aData.getArray());
-
-return aData;
+return maBinaryDataContainer.getCopyAsByteSequence();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-04-07 Thread Caolán McNamara (via logerrit)
 include/vcl/vclenum.hxx|3 ++-
 vcl/source/window/dockmgr.cxx  |6 ++
 vcl/source/window/floatwin.cxx |   15 +++
 3 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit 70642bb7afd2cee6f7ae6eff2936a35978bd0597
Author: Caolán McNamara 
AuthorDate: Thu Apr 6 15:07:15 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 7 10:13:18 2023 +0200

tdf#154470 try moving the Show of the client to after the float positioning

Change-Id: I785120bdad1a3c3311aeca0c8ec5b8b014999872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150108
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 11fa32791a5f..75437f8772e5 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -341,10 +341,11 @@ enum class FloatWinPopupFlags
 NoMouseUpClose   = 0x000200,
 GrabFocus= 0x000400,
 NoHorzPlacement  = 0x000800,
+MakeClientWindowVisibleBeforePopup  = 0x001000,
 };
 namespace o3tl
 {
-template<> struct typed_flags : 
is_typed_flags {};
+template<> struct typed_flags : 
is_typed_flags {};
 }
 
 // Flags for Window::Show()
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 3ab98c596183..d64f7cd8f208 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -821,8 +821,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox 
*pParentToolBox, FloatWin
 if( pParentToolBox->IsKeyEvent() )
 nFlags |= FloatWinPopupFlags::GrabFocus;
 
-GetWindow()->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate);
-mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
+mpFloatWin->StartPopupMode( pParentToolBox, nFlags | 
FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup);
 
 if( pParentToolBox->IsKeyEvent() )
 {
@@ -839,8 +838,7 @@ void ImplDockingWindowWrapper::StartPopupMode( const 
tools::Rectangle& rRect, Fl
 return;
 
 ImplPreparePopupMode();
-GetWindow()->Show(true, ShowFlags::NoFocusChange | ShowFlags::NoActivate);
-mpFloatWin->StartPopupMode( rRect, nFlags );
+mpFloatWin->StartPopupMode( rRect, nFlags | 
FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup);
 }
 
 IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 6fd221b4f0ca..7455a3bbb90c 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -795,6 +795,21 @@ void FloatingWindow::StartPopupMode( const 
tools::Rectangle& rRect, FloatWinPopu
 SetPosPixel( mpImplData->maPos );
 ImplGetFrame()->PositionByToolkit(rRect, nFlags);
 
+/*
+tdf#140762 tdf#152671 Make dock win visible before showing popup
+
+Make them visible again *before* starting popup mode for the floating
+window.  This e.g. makes NVDA announce popups in the toolbar or the Calc
+autofilter dropdown.
+*/
+if (nFlags & FloatWinPopupFlags::MakeClientWindowVisibleBeforePopup)
+{
+if (vcl::Window* pClientWindow = ImplGetClientWindow())
+{
+pClientWindow->Show(true, ShowFlags::NoFocusChange | 
ShowFlags::NoActivate);
+}
+}
+
 // set data and display window
 // convert maFloatRect to absolute device coordinates
 // so they can be compared across different frames


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

2023-03-11 Thread Abdallah Elhdad (via logerrit)
 include/vcl/pdfwriter.hxx|2 +-
 vcl/source/gdi/pdfwriter.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1927c6687ffc45a639aa5aaed1e6c7d2f9892b85
Author: Abdallah Elhdad 
AuthorDate: Thu Mar 2 18:02:51 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Sat Mar 11 13:26:56 2023 +

tdf#114441 Convert sal_uLong to sal_uInt32

Change-Id: Iab17a199d15204a6944b415b170e813d4f9d7bfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148137
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 21f44e491b4a..f415fa59699f 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -796,7 +796,7 @@ The following structure describes the permissions used in 
PDF security
 voidDrawPolyPolygon( const tools::PolyPolygon& rPolyPoly );
 voidDrawRect( const tools::Rectangle& rRect );
 voidDrawRect( const tools::Rectangle& rRect,
-  sal_uLong nHorzRount, sal_uLong nVertRound );
+  sal_uInt32 nHorzRount, sal_uInt32 nVertRound 
);
 voidDrawEllipse( const tools::Rectangle& rRect );
 voidDrawArc( const tools::Rectangle& rRect,
  const Point& rStartPt, const Point& rEndPt );
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 2582b392b1ae..23d986313c5b 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -132,7 +132,7 @@ void PDFWriter::DrawRect( const tools::Rectangle& rRect )
 xImplementation->drawRectangle( rRect );
 }
 
-void PDFWriter::DrawRect( const tools::Rectangle& rRect, sal_uLong nHorzRound, 
sal_uLong nVertRound )
+void PDFWriter::DrawRect( const tools::Rectangle& rRect, sal_uInt32 
nHorzRound, sal_uInt32 nVertRound )
 {
 xImplementation->drawRectangle( rRect, nHorzRound, nVertRound );
 }


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

2023-03-08 Thread Michael Stahl (via logerrit)
 include/vcl/pdfwriter.hxx |2 +-
 vcl/source/gdi/pdfwriter_impl.cxx |   34 +++---
 2 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 806e8f0232b9761e2d1896f0e4cda1d6ce0e258c
Author: Michael Stahl 
AuthorDate: Tue Mar 7 10:57:07 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 8 11:12:22 2023 +

vcl: PDF export: remove versions PDF_1_2, PDF_1_3

These cannot be selected by any means, so this is all dead code.

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

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index bbb2d861fe56..21f44e491b4a 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -106,7 +106,7 @@ public:
 enum class Orientation { Portrait, Inherit };
 
 // in case the below enum is added PDF_2_0, please add just after PDF_1_7
-enum class PDFVersion { PDF_1_2, PDF_1_3, PDF_1_4, PDF_1_5, PDF_1_6, 
PDF_1_7, PDF_A_1, PDF_A_2, PDF_A_3 };//i59651, PDF/A-1b & -1a, only -1b 
implemented for now
+enum class PDFVersion { PDF_1_4, PDF_1_5, PDF_1_6, PDF_1_7, PDF_A_1, 
PDF_A_2, PDF_A_3 };//i59651, PDF/A-1b & -1a, only -1b implemented for now
 // for the meaning of DestAreaType please look at PDF Reference Manual
 // version 1.4 section 8.2.1, page 475
 enum class DestAreaType { XYZ, FitRectangle };
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index cbc0c20bc21f..c5b873565611 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -303,7 +303,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 
i_nWidgetIndex, const PDFWr
however we need a slightly different coding scheme than the normal
name encoding for field names
 */
-const OUString& rName = (m_aContext.Version > 
PDFWriter::PDFVersion::PDF_1_2) ? i_rControl.Name : i_rControl.Text;
+const OUString& rName = i_rControl.Name;
 OString aStr( OUStringToOString( rName, RTL_TEXTENCODING_UTF8 ) );
 int nLen = aStr.getLength();
 
@@ -631,8 +631,6 @@ PDFPage::PDFPage( PDFWriterImpl* pWriter, double 
nPageWidth, double nPageHeight,
 default:
 m_nUserUnit = std::ceil(std::max(nPageWidth, nPageHeight) / 
14400.0);
 break;
-case PDFWriter::PDFVersion::PDF_1_2:
-case PDFWriter::PDFVersion::PDF_1_3:
 case PDFWriter::PDFVersion::PDF_1_4:
 case PDFWriter::PDFVersion::PDF_1_5:
 case PDFWriter::PDFVersion::PDF_A_1:
@@ -1295,8 +1293,6 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
 aBuffer.append( "%PDF-" );
 switch( m_aContext.Version )
 {
-case PDFWriter::PDFVersion::PDF_1_2: aBuffer.append( "1.2" );break;
-case PDFWriter::PDFVersion::PDF_1_3: aBuffer.append( "1.3" );break;
 case PDFWriter::PDFVersion::PDF_A_1:
 case PDFWriter::PDFVersion::PDF_1_4: aBuffer.append( "1.4" );break;
 case PDFWriter::PDFVersion::PDF_1_5: aBuffer.append( "1.5" );break;
@@ -4687,7 +4683,7 @@ bool PDFWriterImpl::emitWidgetAnnotations()
 appendLiteralStringEncrypt( rWidget.m_aName, rWidget.m_nObject, 
aLine );
 aLine.append( "\n" );
 }
-if( m_aContext.Version > PDFWriter::PDFVersion::PDF_1_2 && 
!rWidget.m_aDescription.isEmpty() )
+if (!rWidget.m_aDescription.isEmpty())
 {
 // the alternate field name should be unicode able since it is
 // supposed to be used in UI
@@ -4838,12 +4834,10 @@ bool PDFWriterImpl::emitWidgetAnnotations()
 nFlags |= 4;
 break;
 case PDFWriter::XML:
-if( m_aContext.Version > 
PDFWriter::PDFVersion::PDF_1_3 )
-nFlags |= 32;
+nFlags |= 32;
 break;
 case PDFWriter::PDF:
-if( m_aContext.Version > 
PDFWriter::PDFVersion::PDF_1_3 )
-nFlags |= 256;
+nFlags |= 256;
 break;
 case PDFWriter::FDF:
 default:
@@ -5270,7 +5264,7 @@ bool PDFWriterImpl::emitCatalog()
 
 // viewer preferences, if we had some, then emit
 if( m_aContext.HideViewerToolbar ||
-( m_aContext.Version > PDFWriter::PDFVersion::PDF_1_3 && 
!m_aContext.DocumentInfo.Title.isEmpty() && m_aContext.DisplayPDFDocumentTitle 
) ||
+(!m_aContext.DocumentInfo.Title.isEmpty() && 
m_aContext.DisplayPDFDocumentTitle) ||
 m_aContext.HideViewerMenubar ||
 m_aContext.HideViewerWindowControls || m_aContext.FitWindow ||
 m_aContext.CenterWindow || (m_aContext.FirstPageLeft  &&  
m_aContext.PageLayout == PDFWriter::ContinuousFacing ) ||
@@

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

2023-03-07 Thread Mike Kaganski (via logerrit)
 include/vcl/vectorgraphicdata.hxx|2 --
 vcl/source/filter/graphicfilter.cxx  |   20 ++--
 vcl/source/gdi/vectorgraphicdata.cxx |7 +++
 3 files changed, 13 insertions(+), 16 deletions(-)

New commits:
commit a31f61e233a08025c0acaeabd02c12981258c83d
Author: Mike Kaganski 
AuthorDate: Tue Mar 7 09:50:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Tue Mar 7 08:30:54 2023 +

Drop VectorGraphicDataArray

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

diff --git a/include/vcl/vectorgraphicdata.hxx 
b/include/vcl/vectorgraphicdata.hxx
index 0e9f9fec20e7..bfa30b7af3bc 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -32,8 +32,6 @@
 
 namespace com::sun::star::graphic { class XPrimitive2D; }
 
-typedef css::uno::Sequence VectorGraphicDataArray;
-
 
 // helper to convert any Primitive2DSequence to a good quality BitmapEx,
 // using default parameters and graphic::XPrimitive2DRenderer
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index ef9f45485565..aab76c8968de 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1054,18 +1054,18 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, 
Graphic & rGraphic, GfxLinkTy
 
 if (!rStream.GetError() && nMemoryLength >= 0)
 {
-VectorGraphicDataArray aNewData(nMemoryLength);
+auto aNewData = 
std::make_unique>(nMemoryLength);
 aMemStream.Seek(STREAM_SEEK_TO_BEGIN);
-aMemStream.ReadBytes(aNewData.getArray(), nMemoryLength);
+aMemStream.ReadBytes(aNewData->data(), aNewData->size());
 
 // Make a uncompressed copy for GfxLink
 rGraphicContentSize = nMemoryLength;
 rpGraphicContent.reset(new sal_uInt8[rGraphicContentSize]);
-std::copy(std::cbegin(aNewData), std::cend(aNewData), 
rpGraphicContent.get());
+std::copy(std::cbegin(*aNewData), std::cend(*aNewData), 
rpGraphicContent.get());
 
 if (!aMemStream.GetError())
 {
-BinaryDataContainer aDataContainer(reinterpret_cast(aNewData.getConstArray()), aNewData.getLength());
+BinaryDataContainer aDataContainer(std::move(aNewData));
 auto aVectorGraphicDataPtr = 
std::make_shared(aDataContainer, VectorGraphicDataType::Svg);
 rGraphic = Graphic(aVectorGraphicDataPtr);
 bOkay = true;
@@ -1074,12 +1074,12 @@ ErrCode GraphicFilter::readSVG(SvStream & rStream, 
Graphic & rGraphic, GfxLinkTy
 }
 else
 {
-VectorGraphicDataArray aNewData(nStreamLength);
-rStream.ReadBytes(aNewData.getArray(), nStreamLength);
+auto aNewData = 
std::make_unique>(nStreamLength);
+rStream.ReadBytes(aNewData->data(), aNewData->size());
 
 if (!rStream.GetError())
 {
-BinaryDataContainer aDataContainer(reinterpret_cast(aNewData.getConstArray()), aNewData.getLength());
+BinaryDataContainer aDataContainer(std::move(aNewData));
 auto aVectorGraphicDataPtr = 
std::make_shared(aDataContainer, VectorGraphicDataType::Svg);
 rGraphic = Graphic(aVectorGraphicDataPtr);
 bOkay = true;
@@ -1137,12 +1137,12 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
 aNewStream = &aMemStream;
 }
 }
-VectorGraphicDataArray aNewData(nStreamLength);
-aNewStream->ReadBytes(aNewData.getArray(), nStreamLength);
+auto aNewData = std::make_unique>(nStreamLength);
+aNewStream->ReadBytes(aNewData->data(), aNewData->size());
 if (!aNewStream->GetError())
 {
 const VectorGraphicDataType aDataType(eType);
-BinaryDataContainer aDataContainer(reinterpret_cast(aNewData.getConstArray()), aNewData.getLength());
+BinaryDataContainer aDataContainer(std::move(aNewData));
 
 auto aVectorGraphicDataPtr = 
std::make_shared(aDataContainer, aDataType);
 
diff --git a/vcl/source/gdi/vectorgraphicdata.cxx 
b/vcl/source/gdi/vectorgraphicdata.cxx
index 27479f3b0c34..e55cd14784e0 100644
--- a/vcl/source/gdi/vectorgraphicdata.cxx
+++ b/vcl/source/gdi/vectorgraphicdata.cxx
@@ -319,13 +319,12 @@ VectorGraphicData::VectorGraphicData(
 const sal_uInt32 nStmLen(rIStm.remainingSize());
 if (nStmLen)
 {
-VectorGraphicDataArray aVectorGraphicDataArray(nStmLen);
-auto pData = aVectorGraphicDataArray.getArray();
-rIStm.ReadBytes(pData, nStmLen);
+auto pData = std::make_unique>(nStmLen);
+rIStm.ReadBytes(pData->data(), pData->size());
 
 if (!rIStm.GetError())
 {
- 

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

2023-03-06 Thread Caolán McNamara (via logerrit)
 include/vcl/toolkit/field.hxx |2 +-
 vcl/source/control/field2.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit cc45d748e241ea96fd0c81154e3dd49f9fc58357
Author: Caolán McNamara 
AuthorDate: Mon Mar 6 17:10:31 2023 +
Commit: Noel Grandin 
CommitDate: Tue Mar 7 06:59:52 2023 +

eFormat modified inside GetDateArea, but change not propogated to the caller

regression from:

commit 6e7e19d9c300dbdd279789b09f94781e946fad52
Date:   Wed Jul 15 12:10:32 2020 +0100

weld DateControl

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

diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx
index 10f9cc3b571d..c127f91ccbb4 100644
--- a/include/vcl/toolkit/field.hxx
+++ b/include/vcl/toolkit/field.hxx
@@ -423,7 +423,7 @@ protected:
 public:
 static OUString FormatDate(const Date& rNewDate, 
ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleData, const 
Formatter::StaticFormatter& rStaticFormatter);
 static bool TextToDate(const OUString& rStr, Date& rTime, 
ExtDateFieldFormat eFormat, const LocaleDataWrapper& rLocaleDataWrapper, const 
CalendarWrapper& rCalendarWrapper);
-static int  GetDateArea(ExtDateFieldFormat eFormat, 
std::u16string_view rText, int nCursor, const LocaleDataWrapper& 
rLocaleDataWrapper);
+static int  GetDateArea(ExtDateFieldFormat& eFormat, 
std::u16string_view rText, int nCursor, const LocaleDataWrapper& 
rLocaleDataWrapper);
 
 virtual ~DateFormatter() override;
 
diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx
index bc84c381d3b7..be02536ef513 100644
--- a/vcl/source/control/field2.cxx
+++ b/vcl/source/control/field2.cxx
@@ -1618,7 +1618,7 @@ bool DateFormatter::ImplAllowMalformedInput() const
 return !IsEnforceValidValue();
 }
 
-int DateFormatter::GetDateArea(ExtDateFieldFormat eFormat, std::u16string_view 
rText, int nCursor, const LocaleDataWrapper& rLocaleDataWrapper)
+int DateFormatter::GetDateArea(ExtDateFieldFormat& eFormat, 
std::u16string_view rText, int nCursor, const LocaleDataWrapper& 
rLocaleDataWrapper)
 {
 sal_Int8 nDateArea = 0;
 


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

2023-02-27 Thread Noel Grandin (via logerrit)
 include/vcl/uitest/uitest.hxx|   14 ++
 vcl/source/uitest/uno/uitest_uno.cxx |6 +-
 2 files changed, 7 insertions(+), 13 deletions(-)

New commits:
commit 450d195bb8c09866c6988a3b3ac82dbe349f7849
Author: Noel Grandin 
AuthorDate: Mon Feb 27 09:43:59 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Feb 27 11:05:42 2023 +

UITest does not need to be a class

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

diff --git a/include/vcl/uitest/uitest.hxx b/include/vcl/uitest/uitest.hxx
index 53bdded590aa..189df1de55e8 100644
--- a/include/vcl/uitest/uitest.hxx
+++ b/include/vcl/uitest/uitest.hxx
@@ -19,20 +19,18 @@ namespace com::sun::star::uno { template  class 
Sequence; }
 
 class UIObject;
 
-class UITest
+namespace UITest
 {
-public:
+bool executeCommand(const OUString& rCommand);
 
-static bool executeCommand(const OUString& rCommand);
-
-static bool executeCommandWithParameters(const OUString& rCommand,
+bool executeCommandWithParameters(const OUString& rCommand,
 const css::uno::Sequence< css::beans::PropertyValue >& rArgs);
 
-static bool executeDialog(const OUString& rCommand);
+bool executeDialog(const OUString& rCommand);
 
-static std::unique_ptr getFocusTopWindow();
+std::unique_ptr getFocusTopWindow();
 
-static std::unique_ptr getFloatWindow();
+std::unique_ptr getFloatWindow();
 };
 
 #endif
diff --git a/vcl/source/uitest/uno/uitest_uno.cxx 
b/vcl/source/uitest/uno/uitest_uno.cxx
index 9efbd3c3772d..9886b049a43a 100644
--- a/vcl/source/uitest/uno/uitest_uno.cxx
+++ b/vcl/source/uitest/uno/uitest_uno.cxx
@@ -29,9 +29,6 @@ namespace
 
 class UITestUnoObj : public UITestBase
 {
-private:
-std::unique_ptr mpUITest;
-
 public:
 
 UITestUnoObj();
@@ -56,8 +53,7 @@ public:
 
 }
 
-UITestUnoObj::UITestUnoObj():
-mpUITest(new UITest)
+UITestUnoObj::UITestUnoObj()
 {
 }
 


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

2023-02-22 Thread Khaled Hosny (via logerrit)
 include/vcl/outdev.hxx |2 +-
 vcl/source/outdev/textline.cxx |   21 +++--
 2 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 5899b27e71430e490c2d3a6b87ae52c10f383ba7
Author: Khaled Hosny 
AuthorDate: Wed Feb 22 19:45:51 2023 +0200
Commit: خالد حسني 
CommitDate: Wed Feb 22 21:10:19 2023 +

tdf#151968: Fix vertical position of RTL spelling wavy line

The code was guessing orientation based on the start and end points and
mistakenly considered Arabic text to be 180° rotated which ended up
raising the wavy line above baseline and covering the RTL text.

Use font orientation instead of guessing it. Caching wavy line seems
broken with RTL text as well (it was skipped for RTL before because of
the wrong guessed orientation, so probably never worked), so we skip it
explicitly as well for now.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index d550ecfce293..4075f28abf99 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -758,7 +758,7 @@ private:
 SAL_DLLPRIVATE void ImplDrawPolyPolygonWithB2DPolyPolygon(const 
basegfx::B2DPolyPolygon& rB2DPolyPoly);
 ///@}
 
-SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, 
tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long 
nWaveHeight, double fOrientation, tools::Long nLineWidth);
+SAL_DLLPRIVATE void ImplDrawWaveLineBezier(tools::Long nStartX, 
tools::Long nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long 
nWaveHeight, Degree10 nOrientation, tools::Long nLineWidth);
 
 
 /** @name Curved shape functions
diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx
index 3bd69a2ec994..03f6019dc2b3 100644
--- a/vcl/source/outdev/textline.cxx
+++ b/vcl/source/outdev/textline.cxx
@@ -1012,14 +1012,13 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 tools::Long nStartY = aStartPt.Y();
 tools::Long nEndX = aEndPt.X();
 tools::Long nEndY = aEndPt.Y();
-double fOrientation = 0.0;
+auto nOrientation = mpFontInstance->mnOrientation;
 
 // handle rotation
-if (nStartY != nEndY || nStartX > nEndX)
+if (nOrientation)
 {
-fOrientation = basegfx::rad2deg(std::atan2(nStartY - nEndY, nEndX - 
nStartX));
 // un-rotate the end point
-aStartPt.RotateAround(nEndX, nEndY, 
Degree10(static_cast(-fOrientation * 10.0)));
+aStartPt.RotateAround(nEndX, nEndY, nOrientation);
 }
 
 // Handle HiDPI
@@ -1046,7 +1045,9 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 nLineWidth = 0;
 }
 
-if ( fOrientation == 0.0 )
+// The code below does not work for RTL text, that is what nEndX > nStartX
+// check is for.
+if ( nOrientation == 0_deg10 && nEndX > nStartX )
 {
 static vcl::DeleteOnDeinit< WavyLineCache > snLineCache {};
 if ( !snLineCache.get() )
@@ -1064,7 +1065,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 pVirtDev->SetBackground( Wallpaper( COL_TRANSPARENT ) );
 pVirtDev->Erase();
 pVirtDev->SetAntialiasing( AntialiasingFlags::Enable );
-pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, 
nWaveHeight, fOrientation, nLineWidth );
+pVirtDev->ImplDrawWaveLineBezier( 0, 0, nWordLength, 0, 
nWaveHeight, nOrientation, nLineWidth );
 BitmapEx aBitmapEx(pVirtDev->GetBitmapEx(Point(0, 0), 
pVirtDev->GetOutputSize()));
 
 // Ideally we don't need this block, but in the split rgb surface 
+ separate alpha surface
@@ -1085,10 +1086,10 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, 
const Point& rEndPos, to
 return;
 }
 
-ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, 
fOrientation, nLineWidth );
+ImplDrawWaveLineBezier( nStartX, nStartY, nEndX, nEndY, nWaveHeight, 
nOrientation, nLineWidth );
 }
 
-void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long 
nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, double 
fOrientation, tools::Long nLineWidth)
+void OutputDevice::ImplDrawWaveLineBezier(tools::Long nStartX, tools::Long 
nStartY, tools::Long nEndX, tools::Long nEndY, tools::Long nWaveHeight, 
Degree10 nOrientation, tools::Long nLineWidth)
 {
 // we need a graphics
 if( !mpGraphics && !AcquireGraphics() )
@@ -1106,7 +1107,7 @@ void OutputDevice::ImplDrawWaveLineBezier(tools::Long 
nStartX, tools::Long nStar
 
 const basegfx::B2DRectangle aWaveLineRectangle(nStartX, nStartY, nEndX, 
nEndY + nWaveHeight);
 const basegfx::B2DPolygon aWaveLinePolygon = 
basegfx::createWaveLinePol

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

2023-02-21 Thread Caolán McNamara (via logerrit)
 include/vcl/ctrl.hxx |1 +
 include/vcl/toolkit/calendar.hxx |1 +
 vcl/source/control/calendar.cxx  |7 +++
 vcl/source/control/ctrl.cxx  |7 ++-
 4 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 87d756f3f5dfb55ee9edbcd5349f8107ee5945eb
Author: Caolán McNamara 
AuthorDate: Tue Feb 21 13:40:43 2023 +
Commit: Caolán McNamara 
CommitDate: Tue Feb 21 19:56:26 2023 +

tdf#142783 consider the Calendar Edit and DropDown as one compound control

for the purpose of notification of loss of focus from the control

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

diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index 17c40ae66067..6300e27a747a 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -151,6 +151,7 @@ protected:
 
 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
 
+virtual bool FocusWindowBelongsToControl(const vcl::Window* pFocusWin) 
const;
 public:
 SAL_DLLPRIVATE void ImplClearLayoutData() const;
 /** draws a frame around the give rectangle, onto the given device
diff --git a/include/vcl/toolkit/calendar.hxx b/include/vcl/toolkit/calendar.hxx
index a1a1cd90105a..9652bb44640f 100644
--- a/include/vcl/toolkit/calendar.hxx
+++ b/include/vcl/toolkit/calendar.hxx
@@ -93,6 +93,7 @@ public:
 
 private:
 virtual voidStateChanged( StateChangedType nStateChange ) override;
+virtual boolFocusWindowBelongsToControl(const vcl::Window* pFocusWin) 
const override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/calendar.cxx b/vcl/source/control/calendar.cxx
index 421e159eee81..5f437ff0300e 100644
--- a/vcl/source/control/calendar.cxx
+++ b/vcl/source/control/calendar.cxx
@@ -1724,4 +1724,11 @@ void CalendarField::StateChanged( StateChangedType 
nStateChange )
 }
 }
 
+// tdf#142783 consider the Edit and its DropDown as one compound control for 
the purpose of
+// notification of loss of focus from the control
+bool CalendarField::FocusWindowBelongsToControl(const vcl::Window* pFocusWin) 
const
+{
+return DateField::FocusWindowBelongsToControl(pFocusWin) || (mpFloatWin && 
mpFloatWin->ImplIsWindowOrChild(pFocusWin));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 09fb464e662e..6d6843b9c6e4 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -223,6 +223,11 @@ OUString Control::GetDisplayText() const
 return mxLayoutData ? mxLayoutData->m_aDisplayText : GetText();
 }
 
+bool Control::FocusWindowBelongsToControl(const vcl::Window* pFocusWin) const
+{
+return ImplIsWindowOrChild(pFocusWin);
+}
+
 bool Control::EventNotify( NotifyEvent& rNEvt )
 {
 if ( rNEvt.GetType() == NotifyEventType::GETFOCUS )
@@ -241,7 +246,7 @@ bool Control::EventNotify( NotifyEvent& rNEvt )
 if ( rNEvt.GetType() == NotifyEventType::LOSEFOCUS )
 {
 vcl::Window* pFocusWin = Application::GetFocusWindow();
-if ( !pFocusWin || !ImplIsWindowOrChild( pFocusWin ) )
+if ( !pFocusWin || !FocusWindowBelongsToControl(pFocusWin) )
 {
 mbHasControlFocus = false;
 CompatStateChanged( StateChangedType::ControlFocus );


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

2023-01-10 Thread Noel Grandin (via logerrit)
 include/vcl/bitmapex.hxx  |2 +-
 vcl/source/bitmap/BitmapEx.cxx|   12 ++--
 vcl/source/graphic/UnoGraphic.cxx |3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit b00c1ea3c41aabd47f4965620e60462627f8ed26
Author: Noel Grandin 
AuthorDate: Mon Jan 9 14:06:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 10 10:45:58 2023 +

rename setAlphaFrom->ChangeColorAlpha and fix parameter

The nAlphaTo parameter was actually transparency. Change the
implementation and the call sites to actually use alpha.

Also remove one of the calls in Graphic::colorChange, because if the
BitmapEx has no alpha channel, the call was going to do nothing anyway.

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

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index f847c9f6dcb2..6d86d0633f64 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -434,7 +434,7 @@ public:
 const css::uno::Reference< 
css::rendering::XBitmapCanvas > &xBitmapCanvas,
 const Size &rSize );
 
-voidsetAlphaFrom( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo 
);
+voidChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 
nAlphaTo );
 
 voidAdjustTransparency( sal_uInt8 cTrans );
 
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index a770f2acfc8d..2aeccf83c879 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -1357,24 +1357,24 @@ tools::Polygon  BitmapEx::GetContour( bool 
bContourEdgeDetect,
 return aRetPoly;
 }
 
-void BitmapEx::setAlphaFrom( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
+void BitmapEx::ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 nAlphaTo )
 {
 AlphaMask aAlphaMask(GetAlpha());
-BitmapScopedWriteAccess pWriteAccess(aAlphaMask);
+BitmapScopedWriteAccess pAlphaWriteAccess(aAlphaMask);
 Bitmap::ScopedReadAccess pReadAccess(maBitmap);
-assert( pReadAccess.get() && pWriteAccess.get() );
-if ( !(pReadAccess.get() && pWriteAccess.get()) )
+assert( pReadAccess.get() && pAlphaWriteAccess.get() );
+if ( !(pReadAccess.get() && pAlphaWriteAccess.get()) )
 return;
 
 for ( tools::Long nY = 0; nY < pReadAccess->Height(); nY++ )
 {
-Scanline pScanline = pWriteAccess->GetScanline( nY );
+Scanline pScanline = pAlphaWriteAccess->GetScanline( nY );
 Scanline pScanlineRead = pReadAccess->GetScanline( nY );
 for ( tools::Long nX = 0; nX < pReadAccess->Width(); nX++ )
 {
 const sal_uInt8 cIndex = pReadAccess->GetPixelFromData( 
pScanlineRead, nX ).GetIndex();
 if ( cIndex == cIndexFrom )
-pWriteAccess->SetPixelOnData( pScanline, nX, 
BitmapColor(nAlphaTo) );
+pAlphaWriteAccess->SetPixelOnData( pScanline, nX, 
BitmapColor(255 - nAlphaTo) );
 }
 }
 *this = BitmapEx( GetBitmap(), aAlphaMask );
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index 4d5f42dfcf82..60d6d9cce86e 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -211,7 +211,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL 
Graphic::colorChange(
 
 if (aBitmapEx.IsAlpha())
 {
-aBitmapEx.setAlphaFrom( cIndexFrom, 0xff - nAlphaTo );
+aBitmapEx.ChangeColorAlpha( cIndexFrom, nAlphaTo );
 aBitmapEx.Replace(aColorFrom, aColorTo, nTolerance);
 aReturnGraphic = ::Graphic(aBitmapEx);
 }
@@ -226,7 +226,6 @@ uno::Reference< graphic::XGraphic > SAL_CALL 
Graphic::colorChange(
 }
 else
 {
-aBitmapEx.setAlphaFrom(cIndexFrom, nAlphaTo);
 aBitmapEx.Replace(aColorFrom, aColorTo, nTolerance);
 aReturnGraphic = ::Graphic(aBitmapEx);
 }


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

2023-01-02 Thread Noel Grandin (via logerrit)
 include/vcl/bitmap.hxx|   15 ++
 vcl/source/bitmap/bitmappaint.cxx |  253 --
 2 files changed, 150 insertions(+), 118 deletions(-)

New commits:
commit 5244e7cab70a3c1f567e2e3cda41bd753e5cb530
Author: Noel Grandin 
AuthorDate: Mon Jan 2 19:21:34 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 2 20:23:10 2023 +

split OutputDevice::CreateMask method

to make it easier to understand, very little of the code is shared
between the nTol == 0 and the nTol != 0 cases.

Also flatten the code structure a little.

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

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 123b48fcd752..a732e77f3a97 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -343,6 +343,19 @@ public:
  */
 boolRotate( Degree10 nAngle10, const Color& rFillColor 
);
 
+/** Create on-off mask from bitmap
+
+This method creates a bitmask from the bitmap, where every
+pixel that equals rTransColor is set transparent, the rest
+opaque.
+
+@param rTransColor
+Color value where the bitmask should be transparent
+
+@return the resulting bitmask.
+ */
+Bitmap  CreateMask( const Color& rTransColor ) const;
+
 /** Create on-off mask from bitmap
 
 This method creates a bitmask from the bitmap, where every
@@ -359,7 +372,7 @@ public:
 
 @return the resulting bitmask.
  */
-Bitmap  CreateMask( const Color& rTransColor, sal_uInt8 
nTol = 0 ) const;
+Bitmap  CreateMask( const Color& rTransColor, sal_uInt8 
nTol ) const;
 
 /** Create region of similar colors in a given rectangle
 
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index c0f6715238e7..cdece0f438ed 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -433,18 +433,19 @@ bool Bitmap::Rotate(Degree10 nAngle10, const Color& 
rFillColor)
 return bRet;
 };
 
-Bitmap Bitmap::CreateMask(const Color& rTransColor, sal_uInt8 nTol) const
+Bitmap Bitmap::CreateMask(const Color& rTransColor) const
 {
 ScopedReadAccess pReadAcc(const_cast(*this));
+if (!pReadAcc)
+return Bitmap();
 
 // Historically LO used 1bpp masks, but 8bpp masks are much faster,
 // better supported by hardware, and the memory savings are not worth
 // it anymore.
 // TODO: Possibly remove the 1bpp code later.
 
-if (!nTol && pReadAcc
-&& (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal
-|| pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal)
+if ((pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal
+ || pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal)
 && pReadAcc->GetBestMatchingColor(COL_WHITE) == 
pReadAcc->GetBestMatchingColor(rTransColor))
 {
 // if we're a 1 bit pixel already, and the transcolor matches the 
color that would replace it
@@ -455,146 +456,164 @@ Bitmap Bitmap::CreateMask(const Color& rTransColor, 
sal_uInt8 nTol) const
 auto ePixelFormat = vcl::PixelFormat::N8_BPP;
 Bitmap aNewBmp(GetSizePixel(), ePixelFormat, &Bitmap::GetGreyPalette(256));
 BitmapScopedWriteAccess pWriteAcc(aNewBmp);
-bool bRet = false;
+if (!pWriteAcc)
+return Bitmap();
 
-if (pWriteAcc && pReadAcc)
-{
-const tools::Long nWidth = pReadAcc->Width();
-const tools::Long nHeight = pReadAcc->Height();
-const BitmapColor aBlack(pWriteAcc->GetBestMatchingColor(COL_BLACK));
-const BitmapColor aWhite(pWriteAcc->GetBestMatchingColor(COL_WHITE));
+const tools::Long nWidth = pReadAcc->Width();
+const tools::Long nHeight = pReadAcc->Height();
+const BitmapColor aBlack(pWriteAcc->GetBestMatchingColor(COL_BLACK));
+const BitmapColor aWhite(pWriteAcc->GetBestMatchingColor(COL_WHITE));
+
+const BitmapColor aTest(pReadAcc->GetBestMatchingColor(rTransColor));
 
-if (!nTol)
+if (pWriteAcc->GetScanlineFormat() == pReadAcc->GetScanlineFormat() && 
aWhite.GetIndex() == 1
+&& (pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitLsbPal
+|| pReadAcc->GetScanlineFormat() == ScanlineFormat::N1BitMsbPal))
+{
+for (tools::Long nY = 0; nY < nHeight; ++nY)
 {
-const BitmapColor 
aTest(pReadAcc->GetBestMatchingColor(rTransColor));
+Scanline pSrc = pReadAcc->GetScanline(nY);
+Scanline pDst = pWriteAcc->GetScanline(nY);
+assert(pWriteAcc->GetScanlineSize() == 
pReadAcc->GetScanlineSize());
+const tools::Long nScanlineSize = pWriteAcc->GetScanlineSize();
+for (tools::Long nX = 0; nX < nScanlineSize; ++nX)
+  

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

2022-11-29 Thread Caolán McNamara (via logerrit)
 include/vcl/vcllayout.hxx |2 -
 vcl/source/gdi/pdfwriter_impl.cxx |2 -
 vcl/source/gdi/sallayout.cxx  |   59 ++--
 vcl/source/outdev/text.cxx|   70 --
 vcl/source/outdev/textline.cxx|4 +-
 5 files changed, 16 insertions(+), 121 deletions(-)

New commits:
commit e231cf313d8b3be672d32b9201b37fb20e646758
Author: Caolán McNamara 
AuthorDate: Tue Nov 29 10:18:38 2022 +
Commit: Caolán McNamara 
CommitDate: Tue Nov 29 12:37:39 2022 +0100

SalLayout::mnUnitsPerPixel is always 1

since

commit 368de904974b18dc5a8d237e046c0ed005f7c85d
Date:   Thu Nov 24 09:21:56 2016 +0200

Kill PspFontLayout

removed the last SetUnitsPerPixel

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

diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index b76c789fb16b..4705a44d9b92 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -80,7 +80,6 @@ public:
 virtual voidInitFont() const {}
 virtual voidDrawText( SalGraphics& ) const = 0;
 
-int GetUnitsPerPixel() const{ return 
mnUnitsPerPixel; }
 Degree10GetOrientation() const  { return 
mnOrientation; }
 
 voidSetTextRenderModeForResolutionIndependentLayout(bool 
bTextRenderModeForResolutionIndependentLayout)
@@ -121,7 +120,6 @@ protected:
 int mnEndCharPos;
 LanguageTag maLanguageTag;
 
-int mnUnitsPerPixel;
 Degree10mnOrientation;
 
 mutable Point   maDrawOffset;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 34785e2da3f7..18f9032529c9 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6834,7 +6834,7 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const 
OUString& rText, bool
 else
 {
 DevicePoint aStartPt = rLayout.GetDrawPosition();
-int nWidth = rLayout.GetTextWidth() / rLayout.GetUnitsPerPixel();
+int nWidth = rLayout.GetTextWidth();
 drawTextLine( SubPixelToLogic(aStartPt),
   ImplDevicePixelToLogicWidth( nWidth ),
   eStrikeout, eUnderline, eOverline, bUnderlineAbove );
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index cd27a2cb8a0c..521cbb3d6007 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -125,7 +125,6 @@ SalLayout::SalLayout()
 :   mnMinCharPos( -1 ),
 mnEndCharPos( -1 ),
 maLanguageTag( LANGUAGE_DONTKNOW ),
-mnUnitsPerPixel( 1 ),
 mnOrientation( 0 ),
 maDrawOffset( 0, 0 ),
 mbTextRenderModeForResolutionIndependentLayout(false)
@@ -288,7 +287,6 @@ DeviceCoordinate GenericSalLayout::GetTextWidth() const
 
 void GenericSalLayout::Justify( DeviceCoordinate nNewWidth )
 {
-nNewWidth *= mnUnitsPerPixel;
 DeviceCoordinate nOldWidth = GetTextWidth();
 if( !nOldWidth || nNewWidth==nOldWidth )
 return;
@@ -536,8 +534,6 @@ bool GenericSalLayout::GetNextGlyph(const GlyphItem** 
pGlyph,
 // calculate absolute position in pixel units
 DevicePoint aRelativePos = pGlyphIter->linearPos();
 
-aRelativePos.setX( aRelativePos.getX() / mnUnitsPerPixel );
-aRelativePos.setY( aRelativePos.getY() / mnUnitsPerPixel );
 rPos = GetDrawPosition( aRelativePos );
 
 return true;
@@ -605,7 +601,6 @@ MultiSalLayout::MultiSalLayout( std::unique_ptr 
pBaseLayout )
 assert(dynamic_cast(pBaseLayout.get()));
 
 mpLayouts[ 0 
].reset(static_cast(pBaseLayout.release()));
-mnUnitsPerPixel = mpLayouts[ 0 ]->GetUnitsPerPixel();
 }
 
 std::unique_ptr MultiSalLayout::ReleaseBaseLayout()
@@ -656,7 +651,6 @@ void MultiSalLayout::AdjustLayout( 
vcl::text::ImplLayoutArgs& rArgs )
 // for stretched text in a MultiSalLayout the target width needs to be
 // distributed by individually adjusting its virtual character widths
 DeviceCoordinate nTargetWidth = aMultiArgs.mnLayoutWidth;
-nTargetWidth *= mnUnitsPerPixel; // convert target width to base font 
units
 aMultiArgs.mnLayoutWidth = 0;
 
 // we need to get the original unmodified layouts ready
@@ -699,18 +693,6 @@ void MultiSalLayout::AdjustLayout( 
vcl::text::ImplLayoutArgs& rArgs )
 if( nWidthSum != nTargetWidth )
 aJustificationArray[ nCharCount-1 ] = nTargetWidth;
 
-// the justification array is still in base level units
-// => convert it to pixel units
-if( mnUnitsPerPixel > 1 )
-{
-for( int i = 0; i < nCharCount; ++i )
-{
-DeviceCoordinate nVal = aJustificationArray[ i ];
- 

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

2022-11-27 Thread Caolán McNamara (via logerrit)
 include/vcl/menubarupdateicon.hxx  |2 +-
 vcl/source/window/bubblewindow.cxx |   24 ++--
 2 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 8c6a9daaf99830e1a2a560a9dd0abf3c1e4cfa48
Author: Caolán McNamara 
AuthorDate: Sun Nov 27 16:25:42 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 27 18:16:43 2022 +0100

cid#1517055 Dereference before null check

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

diff --git a/include/vcl/menubarupdateicon.hxx 
b/include/vcl/menubarupdateicon.hxx
index 8e04c3f65a72..99aea9581a4f 100644
--- a/include/vcl/menubarupdateicon.hxx
+++ b/include/vcl/menubarupdateicon.hxx
@@ -66,7 +66,7 @@ private:
 
 sal_uInt16 GetIconID(MenuBar* pMenuBar) const;
 
-void AddMenuBarIcon(SystemWindow* pSysWin, bool bAddEventHdl);
+void AddMenuBarIcon(SystemWindow& rSysWin, bool bAddEventHdl);
 void RemoveMenuBarIcon(MenuBar* pMenuBar);
 void RemoveMenuBarIcons();
 
diff --git a/vcl/source/window/bubblewindow.cxx 
b/vcl/source/window/bubblewindow.cxx
index dd11dce12ae6..9b8432a14a9a 100644
--- a/vcl/source/window/bubblewindow.cxx
+++ b/vcl/source/window/bubblewindow.cxx
@@ -295,10 +295,8 @@ IMPL_LINK(MenuBarUpdateIconManager, WindowEventHdl, 
VclWindowEvent&, rEvent, voi
 if ( pWindow )
 {
 SystemWindow *pSysWin = pWindow->GetSystemWindow();
-if ( pSysWin )
-{
-AddMenuBarIcon( pSysWin, false );
-}
+if (pSysWin)
+AddMenuBarIcon(*pSysWin, false);
 }
 }
 else if ( VclEventId::WindowMenubarRemoved == nEventID )
@@ -343,9 +341,7 @@ IMPL_LINK(MenuBarUpdateIconManager, ApplicationEventHdl, 
VclSimpleEvent&, rEvent
 SystemWindow *pSysWin = pWindow->GetSystemWindow();
 MenuBar *pMBar = pSysWin ? pSysWin->GetMenuBar() : nullptr;
 if (pMBar)
-{
-AddMenuBarIcon( pSysWin, true );
-}
+AddMenuBarIcon(*pSysWin, true);
 }
 break;
 }
@@ -378,7 +374,7 @@ IMPL_LINK_NOARG(MenuBarUpdateIconManager, UserEventHdl, 
void*, void)
 }
 
 if ( pActiveSysWin )
-AddMenuBarIcon( pActiveSysWin, true );
+AddMenuBarIcon(*pActiveSysWin, true);
 }
 
 IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, MenuBarButtonCallbackArg&, 
bool)
@@ -500,13 +496,13 @@ Image GetMenuBarIcon( MenuBar const * pMBar )
 }
 }
 
-void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow *pSysWin, bool 
bAddEventHdl)
+void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow& rSysWin, bool 
bAddEventHdl)
 {
 if (!mbShowMenuIcon)
 return;
 
-MenuBar *pActiveMBar = pSysWin->GetMenuBar();
-if (pSysWin != mpActiveSysWin || pActiveMBar != mpActiveMBar)
+MenuBar *pActiveMBar = rSysWin.GetMenuBar();
+if (&rSysWin != mpActiveSysWin || pActiveMBar != mpActiveMBar)
 RemoveBubbleWindow();
 
 auto aI = std::find(maIconMBars.begin(), maIconMBars.end(), pActiveMBar);
@@ -532,8 +528,8 @@ void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow 
*pSysWin, bool bAddEv
 maIconIDs.push_back(nIconID);
 }
 
-if (bAddEventHdl && pSysWin)
-pSysWin->AddEventListener( maWindowEventHdl );
+if (bAddEventHdl)
+rSysWin.AddEventListener( maWindowEventHdl );
 }
 
 if (mpActiveMBar != pActiveMBar)
@@ -551,7 +547,7 @@ void MenuBarUpdateIconManager::AddMenuBarIcon(SystemWindow 
*pSysWin, bool bAddEv
 }
 }
 
-mpActiveSysWin = pSysWin;
+mpActiveSysWin = &rSysWin;
 
 if (mbShowBubble && pActiveMBar)
 {


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

2022-11-24 Thread Szymon Kłos (via logerrit)
 include/vcl/filter/PDFiumLibrary.hxx |3 +-
 vcl/source/filter/ipdf/pdfread.cxx   |   14 --
 vcl/source/pdf/PDFiumLibrary.cxx |   49 ++-
 3 files changed, 45 insertions(+), 21 deletions(-)

New commits:
commit a5c1cbcbb506e1c33c7e80673bfc01a34c834ed5
Author: Szymon Kłos 
AuthorDate: Mon Nov 21 15:23:59 2022 +0100
Commit: Szymon Kłos 
CommitDate: Fri Nov 25 08:01:20 2022 +0100

pdfium: reduce size if cannot create bitmap

In files with large pages it was rendering white, empty
content. That was because bitmap creation in the PDFium
failed. This reduces the size to possible value.

Signed-off-by: Szymon Kłos 
Change-Id: I093a6aff94104cdc8223d7b8cbc00ff9217021b8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143037
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143243
Tested-by: Jenkins

diff --git a/include/vcl/filter/PDFiumLibrary.hxx 
b/include/vcl/filter/PDFiumLibrary.hxx
index 7b319a727259..347b64619045 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -61,7 +61,8 @@ public:
  const OString& 
rPassword)
 = 0;
 virtual PDFErrorType getLastErrorCode() = 0;
-virtual std::unique_ptr createBitmap(int nWidth, int 
nHeight, int nAlpha) = 0;
+/// createBitmap can reduce requested size to possible value
+virtual std::unique_ptr createBitmap(int& nWidth, int& 
nHeight, int nAlpha) = 0;
 };
 
 class PDFiumPage;
diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index 296e5ba69a5c..deb341157137 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -65,12 +65,10 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, 
std::vector& r
 
 // Returned unit is points, convert that to pixel.
 
-const size_t nPageWidth
-= std::round(vcl::pdf::pointToPixel(nPageWidthPoints, 
fResolutionDPI)
- * PDF_INSERT_MAGIC_SCALE_FACTOR);
-const size_t nPageHeight
-= std::round(vcl::pdf::pointToPixel(nPageHeightPoints, 
fResolutionDPI)
- * PDF_INSERT_MAGIC_SCALE_FACTOR);
+int nPageWidth = std::round(vcl::pdf::pointToPixel(nPageWidthPoints, 
fResolutionDPI)
+* PDF_INSERT_MAGIC_SCALE_FACTOR);
+int nPageHeight = std::round(vcl::pdf::pointToPixel(nPageHeightPoints, 
fResolutionDPI)
+ * PDF_INSERT_MAGIC_SCALE_FACTOR);
 std::unique_ptr pPdfBitmap
 = pPdfium->createBitmap(nPageWidth, nPageHeight, /*nAlpha=*/1);
 if (!pPdfBitmap)
@@ -97,12 +95,12 @@ size_t RenderPDFBitmaps(const void* pBuffer, int nSize, 
std::vector& r
 ConstScanline pPdfBuffer = pPdfBitmap->getBuffer();
 const int nStride = pPdfBitmap->getStride();
 std::vector aScanlineAlpha(nPageWidth);
-for (size_t nRow = 0; nRow < nPageHeight; ++nRow)
+for (int nRow = 0; nRow < nPageHeight; ++nRow)
 {
 ConstScanline pPdfLine = pPdfBuffer + (nStride * nRow);
 // pdfium byte order is BGRA.
 pWriteAccess->CopyScanline(nRow, pPdfLine, 
ScanlineFormat::N32BitTcBgra, nStride);
-for (size_t nCol = 0; nCol < nPageWidth; ++nCol)
+for (int nCol = 0; nCol < nPageWidth; ++nCol)
 {
 // Invert alpha (source is alpha, target is opacity).
 aScanlineAlpha[nCol] = ~pPdfLine[3];
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index ad2f3332bea9..9fa291898f8c 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -12,6 +12,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -466,7 +467,8 @@ public:
 std::unique_ptr openDocument(const void* pData, int nSize,
  const OString& rPassword) 
override;
 PDFErrorType getLastErrorCode() override;
-std::unique_ptr createBitmap(int nWidth, int nHeight, int 
nAlpha) override;
+/// @brief creates bitmap, can reduce size if needed, check nWidth and 
nHeight
+std::unique_ptr createBitmap(int& nWidth, int& nHeight, int 
nAlpha) override;
 };
 }
 
@@ -537,13 +539,36 @@ PDFErrorType PDFiumImpl::getLastErrorCode()
 return static_cast(FPDF_GetLastError());
 }
 
-std::unique_ptr PDFiumImpl::createBitmap(int nWidth, int 
nHeight, int nAlpha)
+std::unique_ptr PDFiumImpl::createBitmap(int& nWidth, int& 
nHeight, int nAlpha)
 {
 std::unique_ptr pPDFiumBitmap;
+
 FPDF_BITMAP pPdfBitmap = FPDFBitmap_Create(nWidth, nHeight, nAlpha);
+if (!pPdfBitmap)
+{
+int nOriginal = nHeight;
+// PDFium cannot create big bitmaps,

[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: 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-20 Thread Noel Grandin (via logerrit)
 include/vcl/mnemonic.hxx   |3 +++
 vcl/source/window/mnemonic.cxx |3 +++
 2 files changed, 6 insertions(+)

New commits:
commit 449117499ed4ce621057c7b6470b5be40d626d4d
Author: Noel Grandin 
AuthorDate: Thu Oct 20 09:16:31 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 20 11:04:28 2022 +0200

workaround VisualStudio2022 compile error

only seems to hit with --disable-pch

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

diff --git a/include/vcl/mnemonic.hxx b/include/vcl/mnemonic.hxx
index b730311481dd..2a14415033e3 100644
--- a/include/vcl/mnemonic.hxx
+++ b/include/vcl/mnemonic.hxx
@@ -64,6 +64,9 @@ class VCL_DLLPUBLIC MnemonicGenerator
 public:
 MnemonicGenerator(sal_Unicode cMnemonic = 
MNEMONIC_CHAR);
 
+MnemonicGenerator& operator=(MnemonicGenerator const &); //MSVC2022 
workaround
+MnemonicGenerator(MnemonicGenerator const&); //MSVC2022 workaround
+
 voidRegisterMnemonic( const OUString& rKey );
 [[nodiscard]] OUString CreateMnemonic(const OUString& rKey);
 css::uno::Reference< css::i18n::XCharacterClassification > const & 
GetCharClass();
diff --git a/vcl/source/window/mnemonic.cxx b/vcl/source/window/mnemonic.cxx
index 6e4b155c2af5..e4f4cf8cf7cd 100644
--- a/vcl/source/window/mnemonic.cxx
+++ b/vcl/source/window/mnemonic.cxx
@@ -37,6 +37,9 @@ MnemonicGenerator::MnemonicGenerator(sal_Unicode cMnemonic)
 memset( maMnemonics, 1, sizeof( maMnemonics ) );
 }
 
+MnemonicGenerator& MnemonicGenerator::operator=(MnemonicGenerator const &) = 
default; //MSVC2022 workaround
+MnemonicGenerator::MnemonicGenerator(MnemonicGenerator const&) = default; 
//MSVC2022 workaround
+
 sal_uInt16 MnemonicGenerator::ImplGetMnemonicIndex( sal_Unicode c )
 {
 static sal_uInt16 const aImplMnemonicRangeTab[MNEMONIC_RANGES*2] =


[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), &rOut, 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() : nu

[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: include/vcl vcl/source

2022-10-14 Thread Khaled Hosny (via logerrit)
 include/vcl/svapp.hxx|2 --
 vcl/source/gdi/sallayout.cxx |9 -
 2 files changed, 11 deletions(-)

New commits:
commit 720a093461aadff044ac0b1b7b45cf3d416b3785
Author: Khaled Hosny 
AuthorDate: Fri Oct 14 20:00:56 2022 +0200
Commit: خالد حسني 
CommitDate: Fri Oct 14 20:59:12 2022 +0200

vcl: Remove recently unused GetMirroredChar()

Unused since:

commit 69e9925ded584113e52f84ef0ed7c224079fa061
Author: Kevin Suo 
Date:   Tue Oct 11 10:04:16 2022 +0800

sdext.pdfimport: resolves tdf#104597: RTL script text runs are reversed

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

diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx
index 5400157ffa57..b7afb9589b3b 100644
--- a/include/vcl/svapp.hxx
+++ b/include/vcl/svapp.hxx
@@ -80,8 +80,6 @@ namespace com::sun::star::awt {
 class XWindow;
 }
 
-// helper needed by SalLayout implementations as well as 
svx/source/dialog/svxbmpnumbalueset.cxx
-VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
 VCL_DLLPUBLIC sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
 
 enum class SystemWindowFlags {
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index cffa4cd8ecbe..cd27a2cb8a0c 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -38,9 +38,6 @@
 
 #include 
 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -51,12 +48,6 @@
 #define GF_FONTSHIFT 28
 
 
-sal_UCS4 GetMirroredChar( sal_UCS4 nChar )
-{
-nChar = u_charMirror( nChar );
-return nChar;
-}
-
 sal_UCS4 GetLocalizedChar( sal_UCS4 nChar, LanguageType eLang )
 {
 // currently only conversion from ASCII digits is interesting


[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: include/vcl vcl/source

2022-09-19 Thread Julien Nabet (via logerrit)
 include/vcl/BitmapPopArtFilter.hxx   |2 +-
 vcl/source/bitmap/BitmapPopArtFilter.cxx |   21 +
 2 files changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 5a6914af4678a24c794055ba23dd9cf0857f0254
Author: Julien Nabet 
AuthorDate: Mon Sep 19 20:57:19 2022 +0200
Commit: Julien Nabet 
CommitDate: Tue Sep 20 08:18:21 2022 +0200

Simplify a bit by using sal_uInt16 in vcl/BitmapPopArtFilter

Since we're in the "if (bRet)" block, it means
 22 bool bRet = isPalettePixelFormat(aBitmap.getPixelFormat())
 23 || aBitmap.Convert(BmpConversion::N8BitColors);
is verified.

isPalettePixelFormat implementation is:
29  constexpr bool isPalettePixelFormat(PixelFormat ePixelFormat)
30  {
31  assert(ePixelFormat != PixelFormat::INVALID);
32  return sal_uInt16(ePixelFormat) <= 8;
33  }

So we know we're using 8 bits max and this line:
pWriteAcc->GetBitCount()
can't give more than 8 and we can safely declare nEntryCount as sal_uInt16 
(idem for "n" just below)

Since "nFirstEntry" and "nLastEntry" are related to "nEntryCount", idem for 
mnIndex
they can also be sal_uInt16.

Thanks to these, we can avoid all sal::static_int_cast 
conversions.

Change-Id: I8cac2d01f00be33c86058c7a6eb7b9e25fb2635e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140206
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/BitmapPopArtFilter.hxx 
b/include/vcl/BitmapPopArtFilter.hxx
index e5733f7338cc..c25804d359fb 100644
--- a/include/vcl/BitmapPopArtFilter.hxx
+++ b/include/vcl/BitmapPopArtFilter.hxx
@@ -23,7 +23,7 @@ public:
 private:
 struct PopArtEntry
 {
-sal_uInt32 mnIndex;
+sal_uInt16 mnIndex;
 sal_uInt32 mnCount;
 };
 };
diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx 
b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index ce37c91fdd58..39856cf8b6eb 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -32,14 +32,14 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
 {
 const sal_Int32 nWidth = pWriteAcc->Width();
 const sal_Int32 nHeight = pWriteAcc->Height();
-const int nEntryCount = 1 << pWriteAcc->GetBitCount();
-int n = 0;
+const sal_uInt16 nEntryCount = 1 << pWriteAcc->GetBitCount();
+sal_uInt16 n = 0;
 std::vector aPopArtTable(nEntryCount);
 
 for (n = 0; n < nEntryCount; n++)
 {
 PopArtEntry& rEntry = aPopArtTable[n];
-rEntry.mnIndex = static_cast(n);
+rEntry.mnIndex = n;
 rEntry.mnCount = 0;
 }
 
@@ -60,8 +60,8 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
   });
 
 // get last used entry
-sal_uLong nFirstEntry;
-sal_uLong nLastEntry = 0;
+sal_uInt16 nFirstEntry;
+sal_uInt16 nLastEntry = 0;
 
 for (n = 0; n < nEntryCount; n++)
 {
@@ -70,19 +70,16 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
 }
 
 // rotate palette (one entry)
-const BitmapColor aFirstCol(pWriteAcc->GetPaletteColor(
-sal::static_int_cast(aPopArtTable[0].mnIndex)));
+const BitmapColor 
aFirstCol(pWriteAcc->GetPaletteColor(aPopArtTable[0].mnIndex));
 
 for (nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++)
 {
 pWriteAcc->SetPaletteColor(
-
sal::static_int_cast(aPopArtTable[nFirstEntry].mnIndex),
-pWriteAcc->GetPaletteColor(
-
sal::static_int_cast(aPopArtTable[nFirstEntry + 1].mnIndex)));
+aPopArtTable[nFirstEntry].mnIndex,
+pWriteAcc->GetPaletteColor(aPopArtTable[nFirstEntry + 
1].mnIndex));
 }
 
-pWriteAcc->SetPaletteColor(
-
sal::static_int_cast(aPopArtTable[nLastEntry].mnIndex), aFirstCol);
+pWriteAcc->SetPaletteColor(aPopArtTable[nLastEntry].mnIndex, 
aFirstCol);
 
 // cleanup
 pWriteAcc.reset();


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

2022-09-16 Thread Caolán McNamara (via logerrit)
 include/vcl/status.hxx   |2 ++
 vcl/source/window/status.cxx |   32 
 2 files changed, 26 insertions(+), 8 deletions(-)

New commits:
commit 6c32fade56c56dcb7ef3101d27dbba0226825c69
Author: Caolán McNamara 
AuthorDate: Fri Sep 9 09:26:15 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 16 18:30:59 2022 +0200

only "PaintImmediately" the statusbar itself (and optional children)

PaintImmediately normally checks to see if there are paints pending
on any of the original candidates parents, and if there are, optimizes
painting by painting from the top windows that is avaiting being
painted.

But in JunitTest_sc_unoapi_3 sometimes the ScGridWindow parent of the
StatusBar happens to have outstanding paint requests when the immediate
paint of the StatusBar is requested and there is deadlock on calling
ScGridWindow::Paint where the soffice main thread wants to lock the
SolarMutex at

> #0: 0x0001a110e270 libsystem_kernel.dylib`__psynch_cvwait + 8
> #1: 0x0001a114883c libsystem_pthread.dylib`_pthread_cond_wait + 1236
> #2: 0x000101081dd8 
libc++.1.0.dylib`std::__1::condition_variable::wait at 
~/llvm/build/include/c++/v1/__threading_support:337:10
> #3: 0x000101081dd4 
libc++.1.0.dylib`std::__1::condition_variable::wait at 
~/github.com/llvm/llvm-project/libcxx/src/condition_variable.cpp:46:14
> #4: 0x000112a011d4 libvclplug_osxlo.dylib`void 
std::__1::condition_variable::wait 
at ~/llvm/inst/include/c++/v1/__mutex_base:398:9
> #5: 0x000112a00f98 libvclplug_osxlo.dylib`SalYieldMutex::doAcquire at 
vcl/osx/salinst.cxx:221:36
> #6: 0x000115e6b920 libvcllo.dylib`comphelper::SolarMutex::acquire at 
include/comphelper/solarmutex.hxx:86:5
> #7: 0x000116637178 libvcllo.dylib`SalInstance::AcquireYieldMutex at 
vcl/source/app/salvtables.cxx:149:73
> #8: 0x0001166f0c38 libvcllo.dylib`Application::AcquireSolarMutex at 
vcl/source/app/svapp.cxx:594:25
> #9: 0x000112a07b38 
libvclplug_osxlo.dylib`SolarMutexReleaser::~SolarMutexReleaser at 
include/vcl/svapp.hxx:1447:29
> #10: 0x000112a03320 
libvclplug_osxlo.dylib`SolarMutexReleaser::~SolarMutexReleaser at 
include/vcl/svapp.hxx:1447:27
> #11: 0x000112a02d40 libvclplug_osxlo.dylib`AquaSalInstance::DoYield 
at vcl/osx/salinst.cxx:559:9
> #12: 0x0001166f01c0 libvcllo.dylib`ImplYield at 
vcl/source/app/svapp.cxx:475:48
> #13: 0x0001166efbc8 libvcllo.dylib`Application::Yield at 
vcl/source/app/svapp.cxx:559:5
> #14: 0x0001166ef958 libvcllo.dylib`Application::Execute at 
vcl/source/app/svapp.cxx:453:13
> #15: 0x0001017a41a8 libsofficeapp.dylib`desktop::Desktop::Main at 
desktop/source/app/app.cxx:1604:13

while another thread

> #0: 0x0001a110e270 libsystem_kernel.dylib`__psynch_cvwait + 8
> #1: 0x0001a114883c libsystem_pthread.dylib`_pthread_cond_wait + 1236
> #2: 0x0001a20e87c8 Foundation`-[NSOperation waitUntilFinished] + 580
> #3: 0x0001a11d8210 CoreFoundation`_CFXNotificationPost + 812
> #4: 0x0001a209dc98 Foundation`-[NSNotificationCenter 
postNotificationName:object:userInfo:] + 96
> #5: 0x0001a3d6de0c AppKit`-[NSMenu insertItem:atIndex:] + 624
> #6: 0x0001a3f92784 AppKit`-[NSApplication(NSServicesMenuPrivate) 
_fillSpellCheckerPopupButton:] + 1888
> #7: 0x0001a3f91bf0 AppKit`-[NSSpellChecker 
_fillSpellCheckerPopupButton:] + 84
> #8: 0x0001a3f90ae8 AppKit`-[NSSpellChecker init] + 284
> #9: 0x0001a3f909bc AppKit`__36+[NSSpellChecker 
sharedSpellChecker]_block_invoke + 20
> #10: 0x0001a0f841b4 libdispatch.dylib`_dispatch_client_callout + 20
> #11: 0x0001a0f85a34 libdispatch.dylib`_dispatch_once_callout + 32
> #12: 0x0001a3f909a4 AppKit`+[NSSpellChecker sharedSpellChecker] + 140
> #13: 0x00028e51d364 
libMacOSXSpelllo.dylib`MacSpellChecker::getLocales at 
lingucomponent/source/spellcheck/macosxspell/macspellimp.mm:117:42
> #14: 0x0001120a99d8 
liblnglo.dylib`LngSvcMgr::GetAvailableSpellSvcs_Impl at 
linguistic/source/lngsvcmgr.cxx:963:67
> #15: 0x0001120ad1dc liblnglo.dylib`LngSvcMgr::getAvailableServices at 
linguistic/source/lngsvcmgr.cxx:1381:9
> #16: 0x0001120ada4c liblnglo.dylib`LngSvcMgr::getAvailableLocales at 
linguistic/source/lngsvcmgr.cxx:1445:42
> #17: 0x0001120a1d28 liblnglo.dylib`LngSvcMgr::UpdateAll at 
linguistic/source/lngsvcmgr.cxx:657:49
> #18: 0x0001120a0fec liblnglo.dylib`LngSvcMgr::LngSvcMgr at 
linguistic/source/lngsvcmgr.cxx:414:5
> #19: 0x0001120a2c50 liblnglo.dylib`LngSvcMgr::LngSvcMgr at 
linguistic/source/lngsvcmgr.cxx:402:1
> #20: 0x0001120b1248 
liblnglo.dylib`::linguistic_LngSvcMgr_get_implementation at 
linguistic/source/lngsvcmgr.cxx:1826:30
[...]
> #30: 0x00010449a164 
libeditenglo.dylib`com::sun::star::linguistic2::LinguSer

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

2022-09-07 Thread Julien Nabet (via logerrit)
 include/vcl/graphicfilter.hxx   |1 +
 vcl/source/filter/graphicfilter.cxx |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit e485d917058ff3c5ebf348c1e0ec28f0fa9b1b93
Author: Julien Nabet 
AuthorDate: Tue Sep 6 21:35:03 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Sep 7 18:04:37 2022 +0200

tdf#150808: General error importing svgz file

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

diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 8985b09eab32..72a767b3d551 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -79,6 +79,7 @@ namespace o3tl
 #define IMP_XBM "SVIXBM"
 #define IMP_XPM "SVIXPM"
 #define IMP_SVG "SVISVG"
+#define IMP_SVGZ"SVISVGZ"
 #define IMP_PDF "SVIPDF"
 #define IMP_TIFF"SVTIFF"
 #define IMP_TGA "SVTGA"
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 6aa2af7d23aa..e616c09853f4 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1428,7 +1428,7 @@ ErrCode GraphicFilter::ImportGraphic(Graphic& rGraphic, 
std::u16string_view rPat
 {
 nStatus = readJPEG(rIStream, rGraphic, eLinkType, nImportFlags);
 }
-else if (aFilterName.equalsIgnoreAsciiCase(IMP_SVG))
+else if (aFilterName.equalsIgnoreAsciiCase(IMP_SVG) || 
aFilterName.equalsIgnoreAsciiCase(IMP_SVGZ))
 {
 nStatus = readSVG(rIStream, rGraphic, eLinkType, pGraphicContent, 
nGraphicContentSize);
 }


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

2022-08-31 Thread Caolán McNamara (via logerrit)
 include/vcl/glyphitemcache.hxx  |2 ++
 vcl/source/gdi/impglyphitem.cxx |   16 
 2 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 8b8810343dc25eb44c2a5500648b9afbc94ab7b8
Author: Caolán McNamara 
AuthorDate: Wed Aug 31 16:50:08 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 31 22:21:33 2022 +0200

glyph cache considered artificial italic the same as regular

The "true" font metrics are the same so it matches, though the
result when rendered is different. Do the same with artificial
emboldening too.

seen with Bahnschrift font from tdf#103596 and tdf#108497

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 7541718f1135..6c151ffaabaf 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -76,6 +76,8 @@ private:
 MapMode mapMode;
 bool rtl;
 bool disabledLigatures; // because of fixed pitch
+bool artificialItalic;
+bool artificialBold;
 vcl::text::ComplexTextLayoutFlags layoutMode;
 LanguageType digitLanguage;
 size_t hashValue;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index df35d5a5fe37..53f9b1d18b9a 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -484,7 +484,11 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 {
 const LogicalFontInstance* fi = outputDevice->GetFontInstance();
 fi->GetScale(&fontScaleX, &fontScaleY);
-disabledLigatures = fi->GetFontSelectPattern().GetPitch() == PITCH_FIXED;
+
+const vcl::font::FontSelectPattern& rFSD = fi->GetFontSelectPattern();
+disabledLigatures = rFSD.GetPitch() == PITCH_FIXED;
+artificialItalic = rFSD.GetItalic() != ITALIC_NONE && 
fontMetric.GetItalic() == ITALIC_NONE;
+artificialBold = rFSD.GetWeight() > WEIGHT_MEDIUM && 
fontMetric.GetWeight() <= WEIGHT_MEDIUM;
 
 hashValue = 0;
 o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
@@ -502,6 +506,8 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 o3tl::hash_combine(hashValue, mapMode.GetHashValue());
 o3tl::hash_combine(hashValue, rtl);
 o3tl::hash_combine(hashValue, disabledLigatures);
+o3tl::hash_combine(hashValue, artificialItalic);
+o3tl::hash_combine(hashValue, artificialBold);
 o3tl::hash_combine(hashValue, layoutMode);
 o3tl::hash_combine(hashValue, digitLanguage.get());
 }
@@ -510,9 +516,11 @@ inline bool 
SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const CachedGlyphs
 {
 return hashValue == other.hashValue && index == other.index && len == 
other.len
&& logicWidth == other.logicWidth && mapMode == other.mapMode && 
rtl == other.rtl
-   && disabledLigatures == other.disabledLigatures && layoutMode == 
other.layoutMode
-   && digitLanguage == other.digitLanguage && fontScaleX == 
other.fontScaleX
-   && fontScaleY == other.fontScaleY && 
fontMetric.EqualIgnoreColor(other.fontMetric)
+   && disabledLigatures == other.disabledLigatures
+   && artificialItalic == other.artificialItalic && artificialBold == 
other.artificialBold
+   && layoutMode == other.layoutMode && digitLanguage == 
other.digitLanguage
+   && fontScaleX == other.fontScaleX && fontScaleY == other.fontScaleY
+   && fontMetric.EqualIgnoreColor(other.fontMetric)
&& vcl::text::FastStringCompareEqual()(text, other.text);
 // Slower things last in the comparison.
 }


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

2022-08-29 Thread Caolán McNamara (via logerrit)
 include/vcl/glyphitemcache.hxx  |1 +
 vcl/source/gdi/impglyphitem.cxx |8 +---
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit b91d4cf7ec844cc638dd8e02cc20e02d8f96998b
Author: Caolán McNamara 
AuthorDate: Mon Aug 29 15:25:28 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 29 17:32:28 2022 +0200

crashtesting: various checkGlyphsEqual asserts

since:

commit b9f0caad5d9e628f82d5148dfc7d2436d32817e2
Date:   Tue Aug 23 04:13:28 2022 +0200

tdf#66819: Disable ligatures with character spacing

add the item causing the differing SalLayoutFlags::DisableLigatures mode
to the key

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 0b2c4a43b793..7541718f1135 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -75,6 +75,7 @@ private:
 double fontScaleY;
 MapMode mapMode;
 bool rtl;
+bool disabledLigatures; // because of fixed pitch
 vcl::text::ComplexTextLayoutFlags layoutMode;
 LanguageType digitLanguage;
 size_t hashValue;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 6cbb245e922b..df35d5a5fe37 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -484,6 +484,7 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 {
 const LogicalFontInstance* fi = outputDevice->GetFontInstance();
 fi->GetScale(&fontScaleX, &fontScaleY);
+disabledLigatures = fi->GetFontSelectPattern().GetPitch() == PITCH_FIXED;
 
 hashValue = 0;
 o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
@@ -500,6 +501,7 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 o3tl::hash_combine(hashValue, fontScaleY);
 o3tl::hash_combine(hashValue, mapMode.GetHashValue());
 o3tl::hash_combine(hashValue, rtl);
+o3tl::hash_combine(hashValue, disabledLigatures);
 o3tl::hash_combine(hashValue, layoutMode);
 o3tl::hash_combine(hashValue, digitLanguage.get());
 }
@@ -508,9 +510,9 @@ inline bool 
SalLayoutGlyphsCache::CachedGlyphsKey::operator==(const CachedGlyphs
 {
 return hashValue == other.hashValue && index == other.index && len == 
other.len
&& logicWidth == other.logicWidth && mapMode == other.mapMode && 
rtl == other.rtl
-   && layoutMode == other.layoutMode && digitLanguage == 
other.digitLanguage
-   && fontScaleX == other.fontScaleX && fontScaleY == other.fontScaleY
-   && fontMetric.EqualIgnoreColor(other.fontMetric)
+   && disabledLigatures == other.disabledLigatures && layoutMode == 
other.layoutMode
+   && digitLanguage == other.digitLanguage && fontScaleX == 
other.fontScaleX
+   && fontScaleY == other.fontScaleY && 
fontMetric.EqualIgnoreColor(other.fontMetric)
&& vcl::text::FastStringCompareEqual()(text, other.text);
 // Slower things last in the comparison.
 }


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

2022-08-03 Thread Caolán McNamara (via logerrit)
 include/vcl/scrbar.hxx|   10 --
 include/vcl/vclenum.hxx   |8 
 include/vcl/weld.hxx  |2 ++
 vcl/source/app/salvtables.cxx |2 ++
 vcl/unx/gtk3/gtkinst.cxx  |5 +
 5 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit e40f9ec9680a350e8e44dcbbd7decbe9603bcc51
Author: Caolán McNamara 
AuthorDate: Wed Aug 3 11:03:02 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 3 15:42:34 2022 +0200

export scroll type when possible

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

diff --git a/include/vcl/scrbar.hxx b/include/vcl/scrbar.hxx
index 77cbbb657b5a..240a1c7e8aa9 100644
--- a/include/vcl/scrbar.hxx
+++ b/include/vcl/scrbar.hxx
@@ -24,16 +24,6 @@
 #include 
 #include 
 
-
-enum class ScrollType
-{
-DontKnow,
-LineUp, LineDown,
-PageUp, PageDown,
-Drag
-};
-
-
 struct ImplScrollBarData;
 
 class VCL_DLLPUBLIC ScrollBar : public Control
diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 9f1a3c8f6b08..11fa32791a5f 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -374,6 +374,14 @@ namespace o3tl
 template<> struct typed_flags : 
is_typed_flags {};
 }
 
+enum class ScrollType
+{
+DontKnow,
+LineUp, LineDown,
+PageUp, PageDown,
+Drag
+};
+
 #endif // INCLUDED_VCL_VCLENUM_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 2f5a76cb8bdb..1c3f19ab94ae 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2515,6 +2515,8 @@ public:
 virtual int adjustment_get_lower() const = 0;
 virtual void adjustment_set_lower(int upper) = 0;
 
+virtual ScrollType get_scroll_type() const = 0;
+
 void connect_adjustment_changed(const Link& rLink) { 
m_aChangeHdl = rLink; }
 };
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2f5d542b0fc5..3f35337339cd 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2551,6 +2551,8 @@ public:
 return m_xScrollBar->SetLineSize(size);
 }
 
+virtual ScrollType get_scroll_type() const override { return 
m_xScrollBar->GetType(); }
+
 virtual ~SalInstanceScrollbar() override { 
m_xScrollBar->SetScrollHdl(m_aOrigScrollHdl); }
 };
 }
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 7412c0c0742d..57e76f4f2eed 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -8510,6 +8510,11 @@ public:
 g_signal_handler_unblock(m_pAdjustment, m_nAdjustChangedSignalId);
 }
 
+virtual ScrollType get_scroll_type() const override
+{
+return ScrollType::DontKnow;
+}
+
 virtual ~GtkInstanceScrollbar() override
 {
 g_signal_handler_disconnect(m_pAdjustment, m_nAdjustChangedSignalId);


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

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

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

Simplify greyscale palette initialization further

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

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

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

2022-07-19 Thread offtkp (via logerrit)
 include/vcl/filter/PngImageWriter.hxx|2 
 vcl/source/filter/png/PngImageWriter.cxx |   66 +--
 2 files changed, 55 insertions(+), 13 deletions(-)

New commits:
commit fac9dfa19b3853e4b1b6ec62baf1645a8b1194c9
Author: offtkp 
AuthorDate: Sun Jul 17 21:42:53 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 10:10:37 2022 +0200

Add 32bpp export support in PngImageWriter

Also added support for "Translucent" property

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

diff --git a/include/vcl/filter/PngImageWriter.hxx 
b/include/vcl/filter/PngImageWriter.hxx
index 4fb11b1ca48a..c788f19bf4db 100644
--- a/include/vcl/filter/PngImageWriter.hxx
+++ b/include/vcl/filter/PngImageWriter.hxx
@@ -32,7 +32,7 @@ class VCL_DLLPUBLIC PngImageWriter
 css::uno::Reference mxStatusIndicator;
 
 sal_Int32 mnCompressionLevel;
-bool mbInterlaced;
+bool mbInterlaced, mbTranslucent;
 std::vector maAdditionalChunks;
 
 public:
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 516c21a555df..7d9221c75112 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace
 {
@@ -20,7 +21,7 @@ void combineScanlineChannels(Scanline pRGBScanline, Scanline 
pAlphaScanline, Sca
 assert(pRGBScanline && "RGB scanline is null");
 assert(pAlphaScanline && "Alpha scanline is null");
 
-for (sal_uInt32 i = 0; i < nSize; i++)
+for (sal_uInt32 i = 0; i < nSize; i += 3)
 {
 *pResult++ = *pRGBScanline++; // R
 *pResult++ = *pRGBScanline++; // G
@@ -48,8 +49,14 @@ static void lclWriteStream(png_structp pPng, png_bytep 
pData, png_size_t pDataSi
 }
 
 static bool pngWrite(SvStream& rStream, const BitmapEx& rBitmapEx, int 
nCompressionLevel,
+ bool bInterlaced, bool bTranslucent,
  const std::vector& aAdditionalChunks)
 {
+if (rBitmapEx.IsAlpha() && !bTranslucent)
+return false;
+if (rBitmapEx.IsEmpty())
+return false;
+
 png_structp pPng = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, 
nullptr, nullptr);
 
 if (!pPng)
@@ -62,6 +69,17 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 return false;
 }
 
+BitmapEx aBitmapEx;
+if (rBitmapEx.GetBitmap().getPixelFormat() == vcl::PixelFormat::N32_BPP)
+{
+if (!vcl::bitmap::convertBitmap32To24Plus8(rBitmapEx, aBitmapEx))
+return false;
+}
+else
+{
+aBitmapEx = rBitmapEx;
+}
+
 Bitmap aBitmap;
 AlphaMask aAlphaMask;
 Bitmap::ScopedReadAccess pAccess;
@@ -78,13 +96,14 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 // Set our custom stream writer
 png_set_write_fn(pPng, &rStream, lclWriteStream, nullptr);
 
-aBitmap = rBitmapEx.GetBitmap();
-aAlphaMask = rBitmapEx.GetAlpha();
+aBitmap = aBitmapEx.GetBitmap();
+aAlphaMask = aBitmapEx.GetAlpha();
 
 {
+bool bCombineChannels = false;
 pAccess = Bitmap::ScopedReadAccess(aBitmap);
 pAlphaAccess = Bitmap::ScopedReadAccess(aAlphaMask);
-Size aSize = rBitmapEx.GetSizePixel();
+Size aSize = aBitmapEx.GetSizePixel();
 
 int bitDepth = -1;
 int colorType = -1;
@@ -127,7 +146,21 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 colorType = PNG_COLOR_TYPE_RGB;
 bitDepth = 8;
 if (pAlphaAccess)
+{
 colorType = PNG_COLOR_TYPE_RGBA;
+bCombineChannels = true;
+}
+break;
+}
+case ScanlineFormat::N32BitTcBgra:
+{
+png_set_bgr(pPng);
+[[fallthrough]];
+}
+case ScanlineFormat::N32BitTcRgba:
+{
+colorType = PNG_COLOR_TYPE_RGBA;
+bitDepth = 8;
 break;
 }
 default:
@@ -136,9 +169,9 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& 
rBitmapEx, int nCompress
 }
 }
 
-if (rBitmapEx.GetPrefMapMode().GetMapUnit() == MapUnit::Map100thMM)
+if (aBitmapEx.GetPrefMapMode().GetMapUnit() == MapUnit::Map100thMM)
 {
-Size aPrefSize(rBitmapEx.GetPrefSize());
+Size aPrefSize(aBitmapEx.GetPrefSize());
 sal_uInt32 nPrefSizeX = o3tl::convert(aSize.Width(), 10, 
aPrefSize.Width());
 sal_uInt32 nPrefSizeY = o3tl::convert(aSize.Height(), 10, 
aPrefSize.Height());
 png_set_pHYs(pPng, pInfo, nPrefSizeX, nPrefSizeY, 1);
@@ -146,7 

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

2022-06-22 Thread offtkp (via logerrit)
 include/vcl/graphicfilter.hxx   |1 +
 vcl/source/filter/graphicfilter.cxx |   16 
 2 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 29252e78627db79662d89919f77746824c6563c3
Author: offtkp 
AuthorDate: Sun Jun 19 00:42:44 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 22 14:12:23 2022 +0200

Add support for exporting SVGZ in Writer

When exporting a graphic through Writer, graphicfilters ExportGraphic
is called, which didn't have SVGZ exporting functionality before this
commit. With this commit a valid Z compressed SVG file is exported,
using the functionality that already exists in ExportGraphic.

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

diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 27388da41c28..fb237bc780a4 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -101,6 +101,7 @@ namespace o3tl
 #define EXP_EMZ "SVEMZ"
 #define EXP_JPEG"SVEJPEG"
 #define EXP_SVG "SVESVG"
+#define EXP_SVGZ"SVESVGZ"
 #define EXP_PDF "SVEPDF"
 #define EXP_PNG "SVEPNG"
 #define EXP_TIFF"SVTIFF"
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index bfe1d3b7d506..f7e3765f4e94 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1844,9 +1844,17 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 if( rOStm.GetError() )
 nStatus = ERRCODE_GRFILTER_IOERROR;
 }
-else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVG ) )
+else if( aFilterName.equalsIgnoreAsciiCase( EXP_SVG ) || 
aFilterName.equalsIgnoreAsciiCase( EXP_SVGZ ) )
 {
 bool bDone(false);
+SvStream* rTempStm = &rOStm;
+if (aFilterName.equalsIgnoreAsciiCase(EXP_SVGZ))
+{
+// Write to a different stream so that we can compress to 
rOStm later
+rCompressableStm.SetBufferSize(rOStm.GetBufferSize());
+rTempStm = &rCompressableStm;
+bShouldCompress = true;
+}
 
 // do we have a native Vector Graphic Data RenderGraphic, 
whose data can be written directly?
 auto const & 
rVectorGraphicDataPtr(rGraphic.getVectorGraphicData());
@@ -1856,9 +1864,9 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 && 
!rVectorGraphicDataPtr->getBinaryDataContainer().isEmpty())
 {
 auto & aDataContainer = 
rVectorGraphicDataPtr->getBinaryDataContainer();
-rOStm.WriteBytes(aDataContainer.getData(), 
aDataContainer.getSize());
+rTempStm->WriteBytes(aDataContainer.getData(), 
aDataContainer.getSize());
 
-if( rOStm.GetError() )
+if( rTempStm->GetError() )
 {
 nStatus = ERRCODE_GRFILTER_IOERROR;
 }
@@ -1890,7 +1898,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 if( xActiveDataSource.is() )
 {
 const css::uno::Reference< 
css::uno::XInterface > xStmIf(
-static_cast< ::cppu::OWeakObject* >( new 
ImpFilterOutputStream( rOStm ) ) );
+static_cast< ::cppu::OWeakObject* >( new 
ImpFilterOutputStream( *rTempStm ) ) );
 
 SvMemoryStream aMemStm( 65535, 65535 );
 


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

2022-06-21 Thread Jan-Marek Glogowski (via logerrit)
 include/vcl/menu.hxx   |5 +
 vcl/source/window/menu.cxx |  149 +
 2 files changed, 89 insertions(+), 65 deletions(-)

New commits:
commit fb9af884de622cdac23887417ccb32cfd34860c3
Author: Jan-Marek Glogowski 
AuthorDate: Sat Nov 20 15:06:35 2021 +0100
Commit: Jan-Marek Glogowski 
CommitDate: Tue Jun 21 18:43:03 2022 +0200

Refactor PopupMenu::ImplExecute for async support

Splits ImplExecute into PrepareRun, Run and FinishRun.

Change-Id: Ifddb1e968b468c9757eeece0bb19513cc26a9c8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125597
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski 

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 538cc4c88b80..bb0ef8cee6db 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -495,7 +495,10 @@ class VCL_DLLPUBLIC PopupMenu final : public Menu
 
 private:
 SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const;
-SAL_DLLPRIVATE sal_uInt16 ImplExecute( const VclPtr& pW, 
const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* 
pSFrom, bool bPreSelectFirst );
+SAL_DLLPRIVATE bool PrepareRun(const VclPtr& pParentWin, 
tools::Rectangle& rRect, FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom, 
bool& bRealExecute, VclPtr&);
+SAL_DLLPRIVATE bool Run(const VclPtr&, bool 
bRealExecute, bool bPreSelectFirst, FloatWinPopupFlags nPopupModeFlags, Menu* 
pSFrom, const tools::Rectangle& rRect);
+SAL_DLLPRIVATE void FinishRun(const VclPtr&, const 
VclPtr& pParentWin, bool bRealExecute, bool bIsNativeMenu);
+SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr& 
pParentWin, const tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, 
Menu* pSFrom, bool bPreSelectFirst);
 SAL_DLLPRIVATE void ImplFlushPendingSelect();
 SAL_DLLPRIVATE tools::Long ImplCalcHeight( sal_uInt16 nEntries ) const;
 SAL_DLLPRIVATE sal_uInt16 ImplCalcVisEntries( tools::Long nMaxHeight, 
sal_uInt16 nStartEntry, sal_uInt16* pLastVisible = nullptr ) const;
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index bd244319e136..9f680b9071c1 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2740,10 +2740,8 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, 
const Point& rPopupPos
 return Execute( pExecWindow, tools::Rectangle( rPopupPos, rPopupPos ), 
PopupMenuFlags::ExecuteDown );
 }
 
-sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const 
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+static FloatWinPopupFlags lcl_TranslateFlags(PopupMenuFlags nFlags)
 {
-ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL 
window!", 0 );
-
 FloatWinPopupFlags nPopupModeFlags = FloatWinPopupFlags::NONE;
 if ( nFlags & PopupMenuFlags::ExecuteDown )
 nPopupModeFlags = FloatWinPopupFlags::Down;
@@ -2757,7 +2755,13 @@ sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, 
const tools::Rectangle&
 if (nFlags & PopupMenuFlags::NoMouseUpClose )  // 
allow popup menus to stay open on mouse button up
 nPopupModeFlags |= FloatWinPopupFlags::NoMouseUpClose;// useful if 
the menu was opened on mousebutton down (eg toolbox configuration)
 
-return ImplExecute( pExecWindow, rRect, nPopupModeFlags, nullptr, false );
+return nPopupModeFlags;
+}
+
+sal_uInt16 PopupMenu::Execute( vcl::Window* pExecWindow, const 
tools::Rectangle& rRect, PopupMenuFlags nFlags )
+{
+ENSURE_OR_RETURN( pExecWindow, "PopupMenu::Execute: need a non-NULL 
window!", 0 );
+return ImplExecute( pExecWindow, rRect, lcl_TranslateFlags(nFlags), 
nullptr, false );
 }
 
 void PopupMenu::ImplFlushPendingSelect()
@@ -2773,10 +2777,14 @@ void PopupMenu::ImplFlushPendingSelect()
 }
 }
 
-sal_uInt16 PopupMenu::ImplExecute( const VclPtr& pW, const 
tools::Rectangle& rRect, FloatWinPopupFlags nPopupModeFlags, Menu* pSFrom, bool 
bPreSelectFirst )
+bool PopupMenu::PrepareRun(const VclPtr& pParentWin, 
tools::Rectangle& rRect,
+   FloatWinPopupFlags& nPopupModeFlags, Menu* pSFrom,
+   bool& bRealExecute, VclPtr& 
pWin)
 {
-if ( !pSFrom && ( vcl::IsInPopupMenuExecute() || !GetItemCount() ) )
-return 0;
+bRealExecute = false;
+const sal_uInt16 nItemCount = GetItemCount();
+if (!pSFrom && (vcl::IsInPopupMenuExecute() || !nItemCount))
+return false;
 
 mpLayoutData.reset();
 
@@ -2788,7 +2796,6 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const tools::R
 bCanceled = false;
 
 VclPtr xFocusId;
-bool bRealExecute = false;
 if ( !pStartedFrom )
 {
 pSVData->mpWinData->mbNoDeactivate = true;
@@ -2804,25 +2811,24 @@ sal_uInt16 PopupMenu::ImplExecute( const 
VclPtr& pW, const tools::R
 }
 
 SAL_WARN_IF( ImplGetWindow(), "vcl", "Win?!" );
-tools::Rectangle aRect( rRect );
-aRect.SetPos( pW->OutputToScreenPixel( aRect

[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(),
   [&aRect](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&

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

2022-06-10 Thread Mike Kaganski (via logerrit)
 include/vcl/toolkit/treelistbox.hxx |2 --
 vcl/source/treelist/treelistbox.cxx |   12 +++-
 vcl/source/treelist/uiobject.cxx|4 +---
 3 files changed, 4 insertions(+), 14 deletions(-)

New commits:
commit e52a805172914164912066a65c6e95988d8b2131
Author: Mike Kaganski 
AuthorDate: Fri Jun 10 12:51:29 2022 +0300
Commit: Mike Kaganski 
CommitDate: Fri Jun 10 14:08:49 2022 +0200

Entry may have no text

... after the changes made to IconView.

This partially reverts commit 54725f6e5f06b074d1c08d8efbd16518b96882d5
  Author Mike Kaganski 
  Date   Tue May 03 09:49:07 2022 +0100
Don't add empty labels to fontwork's icon view

and instead, makes SvTreeListBox::GetEntryText tolerate absent text.

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

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 216ffd55d83c..9ae148a9448b 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -564,8 +564,6 @@ public:
 voidSetCheckButtonState( SvTreeListEntry*, SvButtonState );
 SvButtonState   GetCheckButtonState( SvTreeListEntry* ) const;
 
-static bool HasEntryText(const SvTreeListEntry* pEntry);
-
 voidSetEntryText(SvTreeListEntry*, const OUString& );
 voidSetExpandedEntryBmp( SvTreeListEntry* _pEntry, const 
Image& _rImage );
 voidSetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const 
Image& _rImage );
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index 925900dc0e2d..7260cb69f078 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1510,8 +1510,9 @@ OUString SvTreeListBox::GetEntryText(SvTreeListEntry* 
pEntry) const
 {
 assert(pEntry);
 SvLBoxString* pItem = 
static_cast(pEntry->GetFirstItem(SvLBoxItemType::String));
-assert(pItem);
-return pItem->GetText();
+if (pItem) // There may be entries without text items, e.g. in IconView
+return pItem->GetText();
+return {};
 }
 
 const Image& SvTreeListBox::GetExpandedEntryBmp(const SvTreeListEntry* pEntry)
@@ -1569,13 +1570,6 @@ SvTreeListEntry* SvTreeListBox::InsertEntry(
 return pEntry;
 }
 
-// static
-bool SvTreeListBox::HasEntryText(const SvTreeListEntry* pEntry)
-{
-assert(pEntry);
-return pEntry->GetFirstItem(SvLBoxItemType::String) != nullptr;
-}
-
 void SvTreeListBox::SetEntryText(SvTreeListEntry* pEntry, const OUString& rStr)
 {
 SvLBoxString* pItem = 
static_cast(pEntry->GetFirstItem(SvLBoxItemType::String));
diff --git a/vcl/source/treelist/uiobject.cxx b/vcl/source/treelist/uiobject.cxx
index bcb161e03ecb..ccc066804139 100644
--- a/vcl/source/treelist/uiobject.cxx
+++ b/vcl/source/treelist/uiobject.cxx
@@ -38,9 +38,7 @@ StringMap TreeListUIObject::get_state()
 aMap["LevelChildren"] = 
OUString::number(mxTreeList->GetLevelChildCount(nullptr));
 aMap["CheckBoxList"] = OUString::boolean(isCheckBoxList(mxTreeList));
 SvTreeListEntry* pEntry = mxTreeList->FirstSelected();
-aMap["SelectEntryText"] = (pEntry && SvTreeListBox::HasEntryText(pEntry))
-  ? mxTreeList->GetEntryText(pEntry)
-  : OUString();
+aMap["SelectEntryText"] = pEntry ? mxTreeList->GetEntryText(pEntry) : 
OUString();
 
 return aMap;
 }


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

2022-06-03 Thread Caolán McNamara (via logerrit)
 include/vcl/tabctrl.hxx|3 +
 vcl/source/control/tabctrl.cxx |   70 +++--
 2 files changed, 56 insertions(+), 17 deletions(-)

New commits:
commit 6697257931f8e9ed76b2c6a32b310456c94f2848
Author: Caolán McNamara 
AuthorDate: Fri Jun 3 10:01:37 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 3 12:27:48 2022 +0200

implement "show-tabs" for TabControl

defaults to the current status of "true"

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

diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 1597845df562..40fdd54f285c 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -57,6 +57,7 @@ protected:
 sal_uInt16  mnActPageId;
 sal_uInt16  mnCurPageId;
 boolmbFormat;
+boolmbShowTabs;
 boolmbRestoreHelpId;
 boolmbSmallInvalidate;
 boolmbLayoutDirty;
@@ -188,6 +189,8 @@ public:
 
 virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
 
+virtual bool set_property(const OString &rKey, const OUString &rValue) 
override;
+
 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
 };
 
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index a379679ba37d..762587210f52 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -105,6 +105,7 @@ void TabControl::ImplInit( vcl::Window* pParent, WinBits 
nStyle )
 mnActPageId = 0;
 mnCurPageId = 0;
 mbFormat= true;
+mbShowTabs  = true;
 mbRestoreHelpId = false;
 mbSmallInvalidate   = false;
 mpTabCtrlData.reset(new ImplTabCtrlData);
@@ -576,10 +577,15 @@ tools::Rectangle TabControl::ImplGetTabRect( sal_uInt16 
nItemPos, tools::Long nW
 if (aRect.IsEmpty())
 return aRect;
 
+// with show-tabs of true (the usual) the page rect is from under the
+// visible tab to the bottom of the TabControl, otherwise it extends
+// from the top of the TabControl
+tools::Long nTabBottom = mbShowTabs ? aRect.Bottom() : 0;
+
 tools::Long nW = nWidth-TAB_OFFSET*2;
-tools::Long nH = nHeight-aRect.Bottom()-TAB_OFFSET*2;
+tools::Long nH = nHeight - nTabBottom - TAB_OFFSET*2;
 return (nW > 0 && nH > 0)
-? tools::Rectangle( Point( TAB_OFFSET, aRect.Bottom()+TAB_OFFSET 
), Size( nW, nH ) )
+? tools::Rectangle( Point( TAB_OFFSET, nTabBottom + TAB_OFFSET ), 
Size( nW, nH ) )
 : tools::Rectangle();
 }
 
@@ -1122,7 +1128,7 @@ void TabControl::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rectang
 
 if (rRenderContext.IsNativeControlSupported(ControlType::TabPane, 
ControlPart::Entire))
 {
-const bool bPaneWithHeader = 
rRenderContext.IsNativeControlSupported(ControlType::TabPane, 
ControlPart::TabPaneWithHeader);
+const bool bPaneWithHeader = mbShowTabs && 
rRenderContext.IsNativeControlSupported(ControlType::TabPane, 
ControlPart::TabPaneWithHeader);
 tools::Rectangle aHeaderRect(aRect.Left(), 0, aRect.Right(), 
aRect.Top());
 if (bPaneWithHeader)
 {
@@ -1161,7 +1167,7 @@ void TabControl::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rectang
 rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
 else
 rRenderContext.SetLineColor(COL_BLACK);
-if (pCurItem && !pCurItem->maRect.IsEmpty())
+if (mbShowTabs && pCurItem && !pCurItem->maRect.IsEmpty())
 {
 aCurRect = pCurItem->maRect;
 rRenderContext.DrawLine(aRect.TopLeft(), Point(aCurRect.Left() - 
2, aRect.Top()));
@@ -1203,7 +1209,7 @@ void TabControl::Paint( vcl::RenderContext& 
rRenderContext, const tools::Rectang
 }
 }
 
-if (!mpTabCtrlData->maItemList.empty() && mpTabCtrlData->mpListBox == 
nullptr)
+if (mbShowTabs && !mpTabCtrlData->maItemList.empty() && 
mpTabCtrlData->mpListBox == nullptr)
 {
 // Some native toolkits (GTK+) draw tabs right-to-left, with an
 // overlap between adjacent tabs
@@ -1344,14 +1350,29 @@ void TabControl::GetFocus()
 {
 if( ! mpTabCtrlData->mpListBox )
 {
-ImplShowFocus();
-SetInputContext( InputContext( GetFont() ) );
+if (mbShowTabs)
+{
+ImplShowFocus();
+SetInputContext( InputContext( GetFont() ) );
+}
+else
+{
+// no tabs, focus first thing in current page
+ImplTabItem* pItem = ImplGetItem(GetCurPageId());
+if (pItem && pItem->mpTabPage)
+{
+vcl::Window* pFirstChild = 
pItem->mpTa

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

2022-05-31 Thread Stephan Bergmann (via logerrit)
 include/vcl/glyphitemcache.hxx  |2 +-
 vcl/source/gdi/impglyphitem.cxx |2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e1bac51546138aa5b138f73fd61430cb8582b9c6
Author: Stephan Bergmann 
AuthorDate: Tue May 31 16:50:34 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 31 20:32:37 2022 +0200

clang-cl wants VCL_DLLPUBLIC SalLayoutGlyphsCache::clear not to be inline

...to avoid

> [build DEP] LNK:CppunitTest/test_vcl_text.dll.d
> complextext.o : error LNK2019: unresolved external symbol "public: 
unsigned __int64 __cdecl SalLayoutGlyphsCache::GlyphsCost::operator()(class 
SalLayoutGlyphs const &)const " 
(??RGlyphsCost@SalLayoutGlyphsCache@@QEBA_KAEBVSalLayoutGlyphs@@@Z) referenced 
in function "private: void __cdecl o3tl::lru_map,struct 
SalLayoutGlyphsCache::GlyphsCost>::removeSize(class SalLayoutGlyphs const &)" 
(?removeSize@?$lru_map@UCachedGlyphsKey@SalLayoutGlyphsCache@@VSalLayoutGlyphs@@UCachedGlyphsHash@2@U?$equal_to@UCachedGlyphsKey@SalLayoutGlyphsCache@@@std@@UGlyphsCost@2@@o3tl@@AEAAXAEBVSalLayoutGlyphs@@@Z)

(Not sure why MSVC itself doesn't complain; maybe LLVM 15 trunk clang-cl
accidentally diverges from the MSVC semantics here.)

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 28c38d42ed07..30921e6920a0 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -55,7 +55,7 @@ public:
const OUString& text, sal_Int32 
nIndex, sal_Int32 nLen,
tools::Long nLogicWidth = 0,
const vcl::text::TextLayoutCache* 
layoutCache = nullptr);
-void clear() { mCachedGlyphs.clear(); }
+void clear();
 
 static SalLayoutGlyphsCache* self();
 SalLayoutGlyphsCache(int size) // needs to be public for 
vcl::DeleteOnDeinit
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 39c01699ea4e..124ae16f2e20 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -230,6 +230,8 @@ bool SalLayoutGlyphsImpl::IsValid() const
 return true;
 }
 
+void SalLayoutGlyphsCache::clear() { mCachedGlyphs.clear(); }
+
 SalLayoutGlyphsCache* SalLayoutGlyphsCache::self()
 {
 static vcl::DeleteOnDeinit cache(


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

2022-05-30 Thread Caolán McNamara (via logerrit)
 include/vcl/toolkit/spinfld.hxx |9 -
 vcl/source/control/fmtfield.cxx |7 +++
 vcl/source/control/spinfld.cxx  |   31 +--
 3 files changed, 44 insertions(+), 3 deletions(-)

New commits:
commit 2896c5dad1799addd72b626d93d7e89b1cf19ff6
Author: Caolán McNamara 
AuthorDate: Sun May 29 21:25:09 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon May 30 10:17:07 2022 +0200

Related: tdf#89131 draw up/down spins disabled if value is at max/min

if there is a max/min set.

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

diff --git a/include/vcl/toolkit/spinfld.hxx b/include/vcl/toolkit/spinfld.hxx
index f6de1202a45d..d82348bd44bb 100644
--- a/include/vcl/toolkit/spinfld.hxx
+++ b/include/vcl/toolkit/spinfld.hxx
@@ -61,6 +61,11 @@ public:
 
 virtual FactoryFunction GetUITestFactory() const override;
 
+SAL_DLLPRIVATE void SetUpperEnabled(bool bEnabled);
+SAL_DLLPRIVATE void SetLowerEnabled(bool bEnabled);
+SAL_DLLPRIVATE bool IsUpperEnabled() const { return mbUpperEnabled; }
+SAL_DLLPRIVATE bool IsLowerEnabled() const { return mbLowerEnabled; }
+
 protected:
 tools::Rectangle   maUpperRect;
 tools::Rectangle   maLowerRect;
@@ -91,7 +96,9 @@ private:
 mbInitialDown:1,
 mbUpperIn:1,
 mbLowerIn:1,
-mbInDropDown:1;
+mbInDropDown:1,
+mbUpperEnabled:1,
+mbLowerEnabled:1;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index c07b7e3ab3c5..3aee3317c829 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -922,6 +922,13 @@ namespace
 {
 m_rSpinButton.SpinField::Modify();
 }
+
+virtual void UpdateCurrentValue(double dCurrentValue) override
+{
+Formatter::UpdateCurrentValue(dCurrentValue);
+m_rSpinButton.SetUpperEnabled(!m_bHasMax || dCurrentValue < 
m_dMaxValue);
+m_rSpinButton.SetLowerEnabled(!m_bHasMin || dCurrentValue > 
m_dMinValue);
+}
 };
 
 class DoubleNumericFormatter : public FieldFormatter
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 8db25dfbc699..6bc1fac297a9 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -298,6 +298,8 @@ void SpinField::ImplInitSpinFieldData()
 mbInitialUp = false;
 mbInitialDown   = false;
 mbInDropDown= false;
+mbUpperEnabled  = true;
+mbLowerEnabled  = true;
 }
 
 void SpinField::ImplInit(vcl::Window* pParent, WinBits nWinStyle)
@@ -578,13 +580,38 @@ void SpinField::FillLayoutData() const
 Edit::FillLayoutData();
 }
 
+void SpinField::SetUpperEnabled(bool bEnabled)
+{
+if (mbUpperEnabled == bEnabled)
+return;
+
+mbUpperEnabled = bEnabled;
+
+if (mbSpin)
+Invalidate(maUpperRect);
+}
+
+void SpinField::SetLowerEnabled(bool bEnabled)
+{
+if (mbLowerEnabled == bEnabled)
+return;
+
+mbLowerEnabled = bEnabled;
+
+if (mbSpin)
+Invalidate(maLowerRect);
+}
+
 void SpinField::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect)
 {
 if (mbSpin)
 {
-bool bEnable = IsEnabled();
+bool bEnabled = IsEnabled();
+bool bUpperEnabled = bEnabled && IsUpperEnabled();
+bool bLowerEnabled = bEnabled && IsLowerEnabled();
 ImplDrawSpinButton(rRenderContext, this, maUpperRect, maLowerRect,
-   mbUpperIn, mbLowerIn, bEnable, bEnable);
+   mbUpperIn && bUpperEnabled, mbLowerIn && 
bLowerEnabled,
+   bUpperEnabled, bLowerEnabled);
 }
 
 if (GetStyle() & WB_DROPDOWN)


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

2022-05-19 Thread Julien Nabet (via logerrit)
 include/vcl/graphicfilter.hxx |   10 --
 vcl/source/filter/graphicfilter.cxx   |   25 +
 vcl/source/graphic/GraphicLoader.cxx  |3 +--
 vcl/source/graphic/UnoGraphicProvider.cxx |5 +
 xmlsecurity/workben/pdfverify.cxx |3 +--
 5 files changed, 16 insertions(+), 30 deletions(-)

New commits:
commit 1c25d22bfa072eb78da8930a3877f37a70ff707b
Author: Julien Nabet 
AuthorDate: Wed May 18 21:52:52 2022 +0200
Commit: Julien Nabet 
CommitDate: Thu May 19 10:55:06 2022 +0200

Simplify an "ImportGraphic" method by removing useless pExtHeader 
(WmfExternal)

Change-Id: I2916610e08c3157e0438ec90592fb5b8f921cc24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134574
Reviewed-by: Bartosz Kosiorek 
Tested-by: Jenkins

diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index f1568680660c..0e0351dc4d50 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -314,8 +314,7 @@ public:
 ErrCode ImportGraphic( Graphic& rGraphic, std::u16string_view 
rPath,
SvStream& rStream,
sal_uInt16 nFormat = 
GRFILTER_FORMAT_DONTKNOW,
-   sal_uInt16 * pDeterminedFormat = nullptr, 
GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE,
-   WmfExternal const *pExtHeader = nullptr );
+   sal_uInt16 * pDeterminedFormat = nullptr, 
GraphicFilterImportFlags nImportFlags = GraphicFilterImportFlags::NONE );
 
 /// Imports multiple graphics.
 ///
@@ -353,10 +352,9 @@ public:
 static ErrCode readXBM(SvStream & rStream, Graphic & rGraphic);
 static ErrCode readXPM(SvStream & rStream, Graphic & rGraphic);
 
-static ErrCode readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType,
-WmfExternal const* pExtHeader, VectorGraphicDataType 
eType);
-static ErrCode readWMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType, WmfExternal const* pExtHeader);
-static ErrCode readEMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType, WmfExternal const* pExtHeader);
+static ErrCode readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, VectorGraphicDataType eType);
+static ErrCode readWMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
+static ErrCode readEMF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
 
 static ErrCode readPDF(SvStream & rStream, Graphic & rGraphic, GfxLinkType 
& rLinkType);
 static ErrCode readTIFF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType);
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index da436ed634f2..d208c7d81e72 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1149,8 +1149,7 @@ ErrCode GraphicFilter::readXPM(SvStream & rStream, 
Graphic & rGraphic)
 return ERRCODE_GRFILTER_FILTERERROR;
 }
 
-ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType,
-   WmfExternal const *pExtHeader, 
VectorGraphicDataType eType)
+ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, VectorGraphicDataType eType)
 {
 // use new UNO API service, do not directly import but create a
 // Graphic that contains the original data and decomposes to
@@ -1181,11 +1180,6 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
 
 auto aVectorGraphicDataPtr = 
std::make_shared(aDataContainer, aDataType);
 
-if (pExtHeader)
-{
-aVectorGraphicDataPtr->setWmfExternalHeader(*pExtHeader);
-}
-
 rGraphic = Graphic(aVectorGraphicDataPtr);
 rLinkType = GfxLinkType::NativeWmf;
 aReturnCode = ERRCODE_NONE;
@@ -1194,14 +1188,14 @@ ErrCode GraphicFilter::readWMF_EMF(SvStream & rStream, 
Graphic & rGraphic, GfxLi
 return aReturnCode;
 }
 
-ErrCode GraphicFilter::readWMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, WmfExternal const* pExtHeader)
+ErrCode GraphicFilter::readWMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType)
 {
-return readWMF_EMF(rStream, rGraphic, rLinkType, pExtHeader, 
VectorGraphicDataType::Wmf);
+return readWMF_EMF(rStream, rGraphic, 
rLinkType,VectorGraphicDataType::Wmf);
 }
 
-ErrCode GraphicFilter::readEMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType, WmfExternal const* pExtHeader)
+ErrCode GraphicFilter::readEMF(SvStream & rStream, Graphic & rGraphic, 
GfxLinkType & rLinkType)
 {
-return readWMF_EMF(rStream, rGraphic, rLinkType, pExtHeader, 
VectorGraphicDataType::Emf);
+return readWMF_EMF(rStream, rGraph

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

2022-05-16 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |3 +-
 include/vcl/metric.hxx  |9 
 vcl/source/font/fontmetric.cxx  |   44 +---
 vcl/source/gdi/impglyphitem.cxx |6 ++---
 4 files changed, 55 insertions(+), 7 deletions(-)

New commits:
commit be441f1a8c40ecbd99653043aa443fc1130d91c2
Author: Luboš Luňák 
AuthorDate: Mon May 16 13:11:17 2022 +0200
Commit: Luboš Luňák 
CommitDate: Mon May 16 21:14:47 2022 +0200

use FontMetric as SalLayoutGlyphsCache key rather than vcl::Font

Apparently even calling OutputDevice::GetFontMetric() rather than
GetFont() makes a difference with e.g. tdf#65046-1, when only
vcl::Font is used it triggers the assert in checkGlyphsEqual()
because of the fonts actually being different.

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 138adb7bb40a..28c38d42ed07 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -69,7 +70,7 @@ private:
 sal_Int32 index;
 sal_Int32 len;
 tools::Long logicWidth;
-vcl::Font font;
+FontMetric fontMetric;
 double fontScaleX;
 double fontScaleY;
 MapMode mapMode;
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index b08403da81a3..c8d95f88d6ef 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -68,7 +68,16 @@ public:
 booloperator==( const FontMetric& rMetric ) const;
 booloperator!=( const FontMetric& rMetric ) const
 { return !operator==( rMetric ); }
+
+boolEqualIgnoreColor( const FontMetric& ) const;
+
+// Compute value usable as hash.
+size_t  GetHashValue() const;
+size_t  GetHashValueIgnoreColor() const;
+
 private:
+boolEqualNoBase( const FontMetric& ) const;
+size_t  GetHashValueNoBase() const;
 tools::LongmnAscent;  // Ascent
 tools::LongmnDescent; // Descent
 tools::LongmnIntLeading;  // Internal 
Leading
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index dfc005b6a9d6..1fddb1195ab7 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -78,10 +78,8 @@ FontMetric& FontMetric::operator=(const FontMetric& 
rFontMetric) = default;
 
 FontMetric& FontMetric::operator=(FontMetric&& rFontMetric) = default;
 
-bool FontMetric::operator==( const FontMetric& r ) const
+bool FontMetric::EqualNoBase( const FontMetric& r ) const
 {
-if( Font::operator!=(r) )
-return false;
 if (mbFullstopCentered != r.mbFullstopCentered)
 return false;
 if( mnAscent != r.mnAscent )
@@ -98,6 +96,46 @@ bool FontMetric::operator==( const FontMetric& r ) const
 return true;
 }
 
+bool FontMetric::operator==( const FontMetric& r ) const
+{
+if( Font::operator!=(r) )
+return false;
+return EqualNoBase(r);
+}
+
+bool FontMetric::EqualIgnoreColor( const FontMetric& r ) const
+{
+if( !Font::EqualIgnoreColor(r) )
+return false;
+return EqualNoBase(r);
+}
+
+size_t FontMetric::GetHashValueNoBase() const
+{
+size_t hash = 0;
+o3tl::hash_combine( hash, mbFullstopCentered );
+o3tl::hash_combine( hash, mnAscent );
+o3tl::hash_combine( hash, mnDescent );
+o3tl::hash_combine( hash, mnIntLeading );
+o3tl::hash_combine( hash, mnExtLeading );
+o3tl::hash_combine( hash, mnSlant );
+return hash;
+}
+
+size_t FontMetric::GetHashValue() const
+{
+size_t hash = GetHashValueNoBase();
+o3tl::hash_combine( hash, Font::GetHashValue());
+return hash;
+}
+
+size_t FontMetric::GetHashValueIgnoreColor() const
+{
+size_t hash = GetHashValueNoBase();
+o3tl::hash_combine( hash, Font::GetHashValueIgnoreColor());
+return hash;
+}
+
 ImplFontMetricData::ImplFontMetricData( const vcl::font::FontSelectPattern& 
rFontSelData )
 : FontAttributes( rFontSelData )
 , mnHeight ( rFontSelData.mnHeight )
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 648696a55107..6ab5663ddef6 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -450,7 +450,7 @@ SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
 , logicWidth(w)
 // we also need to save things used in 
OutputDevice::ImplPrepareLayoutArgs(), in case they
 // change in the output device, plus mapMode affects the sizes.
-, font(outputDevice->GetFont())
+, fontMetric(outputDevice->GetFontMetric())
 // TODO It would b

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

2022-05-12 Thread Caolán McNamara (via logerrit)
 include/vcl/toolkit/treelistbox.hxx |9 +
 vcl/source/treelist/treelistbox.cxx |6 +++---
 2 files changed, 4 insertions(+), 11 deletions(-)

New commits:
commit 39d011376b9bcf020bcb9e05121bb0dfb01f8822
Author: Caolán McNamara 
AuthorDate: Wed May 11 20:35:30 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu May 12 09:54:22 2022 +0200

merge SetNodeBitmaps and SetNodeDefaultImages

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

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index e280e9043ce3..d5633df7049e 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -530,7 +530,6 @@ public:
 
 voidEnableCheckButton( SvLBoxButtonData* );
 voidSetCheckButtonData( SvLBoxButtonData* );
-voidSetNodeBitmaps( const Image& rCollapsedNodeBmp, const 
Image& rExpandedNodeBmp );
 
 /** Returns the default image which clients should use for expanded nodes, 
to have a consistent user
 interface experience in the whole product.
@@ -544,13 +543,7 @@ public:
 
 /** Sets default bitmaps for collapsed and expanded nodes.
 */
-voidSetNodeDefaultImages( )
-{
-SetNodeBitmaps(
-GetDefaultCollapsedNodeImage( ),
-GetDefaultExpandedNodeImage( )
-);
-}
+voidSetNodeDefaultImages();
 
 virtual SvTreeListEntry*InsertEntry( const OUString& rText, 
SvTreeListEntry* pParent = nullptr,
  bool bChildrenOnDemand = false,
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index 3e231d257f93..7c093a6f6a61 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -1808,10 +1808,10 @@ const Image& 
SvTreeListBox::GetDefaultCollapsedNodeImage( )
 return SvImpLBox::GetDefaultCollapsedNodeImage( );
 }
 
-void SvTreeListBox::SetNodeBitmaps( const Image& rCollapsedNodeBmp, const 
Image& rExpandedNodeBmp )
+void SvTreeListBox::SetNodeDefaultImages()
 {
-SetExpandedNodeBmp( rExpandedNodeBmp );
-SetCollapsedNodeBmp( rCollapsedNodeBmp );
+SetExpandedNodeBmp(GetDefaultExpandedNodeImage());
+SetCollapsedNodeBmp(GetDefaultCollapsedNodeImage());
 SetTabs();
 }
 


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

2022-05-04 Thread Caolán McNamara (via logerrit)
 include/vcl/toolkit/treelistbox.hxx |2 ++
 vcl/source/treelist/treelistbox.cxx |8 
 2 files changed, 10 insertions(+)

New commits:
commit b1ea5cc2ee0b50651c7cac4d85a49a199693ed1c
Author: Caolán McNamara 
AuthorDate: Tue May 3 20:38:04 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 4 09:57:28 2022 +0200

Related: tdf#131725 if SvTreeListBox RTL set, set scrollbars to match

so if we have a RTL SvTreeListBox in a LTR environ then we get RTL
scrollbars

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

diff --git a/include/vcl/toolkit/treelistbox.hxx 
b/include/vcl/toolkit/treelistbox.hxx
index 0a9ea9da5a22..e280e9043ce3 100644
--- a/include/vcl/toolkit/treelistbox.hxx
+++ b/include/vcl/toolkit/treelistbox.hxx
@@ -690,6 +690,8 @@ public:
 virtual FactoryFunction GetUITestFactory() const override;
 
 voidSetDragHelper(const rtl::Reference& 
rHelper, sal_uInt8 eDNDConstants);
+
+virtual voidEnableRTL(bool bEnable = true) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/treelist/treelistbox.cxx 
b/vcl/source/treelist/treelistbox.cxx
index 896e1c78dbe7..51c9d1f4c57c 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -3567,6 +3567,14 @@ bool SvTreeListBox::set_property(const OString &rKey, 
const OUString &rValue)
 return true;
 }
 
+void SvTreeListBox::EnableRTL(bool bEnable)
+{
+Control::EnableRTL(bEnable);
+pImpl->m_aHorSBar->EnableRTL(bEnable);
+pImpl->m_aVerSBar->EnableRTL(bEnable);
+pImpl->m_aScrBarBox->EnableRTL(bEnable);
+}
+
 FactoryFunction SvTreeListBox::GetUITestFactory() const
 {
 return TreeListUIObject::create;


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

2022-05-03 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |4 +-
 vcl/source/gdi/impglyphitem.cxx |   60 ++--
 2 files changed, 41 insertions(+), 23 deletions(-)

New commits:
commit 2cb75eb504e3fedb9c93bbfee3609021f583f849
Author: Luboš Luňák 
AuthorDate: Wed May 4 06:37:08 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed May 4 08:43:21 2022 +0200

lay out entire strings in SalLayoutGlyphsCache more often (tdf#148911)

The document has parts of paragraphs e.g. underlined, which changes
the vcl::Font part of the hash key. So if a paragraph starts that way
but the rest is not underlined, the optimization of laying out
the entire string would be missed. So do the optimization if there
are subsequent calls for adjacent parts of the string (or starting
at the same index and different length).

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index a17f53c61e56..138adb7bb40a 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -96,8 +96,8 @@ private:
 // Last temporary glyphs returned (pointer is returned, so the object 
needs to be kept somewhere).
 std::optional mLastTemporaryKey;
 SalLayoutGlyphs mLastTemporaryGlyphs;
-// If set, info about the last call which wanted a prefix of the full text.
-std::optional mLastPrefixKey;
+// If set, info about the last call which wanted a substring of the full 
text.
+std::optional mLastSubstringKey;
 
 SalLayoutGlyphsCache(const SalLayoutGlyphsCache&) = delete;
 SalLayoutGlyphsCache& operator=(const SalLayoutGlyphsCache&) = delete;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index ed7e2895310e..b22170c80c60 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -304,7 +304,8 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 const SalLayoutFlags glyphItemsOnlyLayout
 = SalLayoutFlags::GlyphItemsOnly | SalLayoutFlags::BiDiStrong;
 #endif
-bool resetLastPrefixKey = true;
+bool resetLastSubstringKey = true;
+const sal_Unicode nbSpace = 0xa0; // non-breaking space
 if (nIndex != 0 || nLen != text.getLength())
 {
 // The glyphs functions are often called first for an entire string
@@ -319,9 +320,13 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 {
 // This function may often be called repeatedly for segments of 
the same string,
 // in which case it is more efficient to cache glyphs for the 
entire string
-// and then return subsets of them. So if the first call is for a 
prefix of the string,
-// remember that, and if the next call follows the previous part 
of the string,
-// cache the entire string.
+// and then return subsets of them. So if a second call either 
starts at the same
+// position or starts at the end of the previous call, cache the 
entire string.
+// This used to do this only for the first two segments of the 
string,
+// but that missed the case when the font slightly changed e.g. 
because of the first
+// part being underlined. Doing this for any two segments allows 
this optimization
+// even when the prefix of the string would use a different font.
+// TODO: Can those font differences be ignored?
 // Writer layouts tests enable 
SAL_ABORT_ON_NON_APPLICATION_FONT_USE in order
 // to make PrintFontManager::Substitute() abort if font fallback 
happens. When
 // laying out the entire string the chance this happens increases 
(e.g. testAbi11870
@@ -330,28 +335,35 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 // does not change result of this function, simply disable it for 
those tests.
 static bool bAbortOnFontSubstitute
 = getenv("SAL_ABORT_ON_NON_APPLICATION_FONT_USE") != nullptr;
-if (nIndex == 0)
+if (mLastSubstringKey.has_value() && !bAbortOnFontSubstitute)
 {
-mLastPrefixKey = key;
-resetLastPrefixKey = false;
+sal_Int32 pos = nIndex;
+if (mLastSubstringKey->len < pos && text[pos - 1] == nbSpace)
+--pos; // Writer skips a non-breaking space, so skip that 
character too.
+if ((mLastSubstringKey->len == pos || mLastSubstringKey->index 
== nIndex)
+&& mLastSubstringKey
+   == CachedGlyphsKey(outputDevice, text, 
mLastSubstringKey->index,
+  mLastSubstringKey->len, 
nLogicWidth))
+{
+std::unique_ptr lay

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

2022-05-03 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |2 ++
 vcl/source/gdi/impglyphitem.cxx |   30 ++
 2 files changed, 32 insertions(+)

New commits:
commit 0a6d946694e4fcb39228c5e1fec58fcfd8a45989
Author: Luboš Luňák 
AuthorDate: Wed Apr 27 09:52:04 2022 +0200
Commit: Luboš Luňák 
CommitDate: Tue May 3 09:08:44 2022 +0200

optimize repeated calls for the same string in SalLayoutGlyphsCache

It often happens that the entire text will be laid out in parts,
so if the first call is a prefix and another one follows that,
lay out the entire string and then use the glyph subset optimization.
Doing this only for the second segment instead immediately for
the prefix is more efficient, as sometimes there is only the prefix
call and there's no call for the rest of the string. This also
avoids failures in CppunitTest_sw_layoutwriter, as a number of tests
such as testAbi11870 lay out only a prefix and doing a layout
for the entire string leads to font fallback, on which
CppunitTest_sw_layoutwriter aborts in PrintFontManager::Substitute().

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index 998dcf97f915..a17f53c61e56 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -96,6 +96,8 @@ private:
 // Last temporary glyphs returned (pointer is returned, so the object 
needs to be kept somewhere).
 std::optional mLastTemporaryKey;
 SalLayoutGlyphs mLastTemporaryGlyphs;
+// If set, info about the last call which wanted a prefix of the full text.
+std::optional mLastPrefixKey;
 
 SalLayoutGlyphsCache(const SalLayoutGlyphsCache&) = delete;
 SalLayoutGlyphsCache& operator=(const SalLayoutGlyphsCache&) = delete;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 769c1afb9743..81553622a132 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -301,6 +301,7 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 const SalLayoutFlags glyphItemsOnlyLayout
 = SalLayoutFlags::GlyphItemsOnly | SalLayoutFlags::BiDiStrong;
 #endif
+bool resetLastPrefixKey = true;
 if (nIndex != 0 || nLen != text.getLength())
 {
 // The glyphs functions are often called first for an entire string
@@ -311,8 +312,34 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 return &mLastTemporaryGlyphs;
 const CachedGlyphsKey keyWhole(outputDevice, text, 0, 
text.getLength(), nLogicWidth);
 GlyphsCache::const_iterator itWhole = mCachedGlyphs.find(keyWhole);
+if (itWhole == mCachedGlyphs.end())
+{
+// This function may often be called repeatedly for segments of 
the same string,
+// in which case it is more efficient to cache glyphs for the 
entire string
+// and then return subsets of them. So if the first call is for a 
prefix of the string,
+// remember that, and if the next call follows the previous part 
of the string,
+// cache the entire string.
+if (nIndex == 0)
+{
+mLastPrefixKey = key;
+resetLastPrefixKey = false;
+}
+else if (mLastPrefixKey.has_value() && mLastPrefixKey->len == 
nIndex
+ && mLastPrefixKey
+== CachedGlyphsKey(outputDevice, text, 
mLastPrefixKey->index,
+   mLastPrefixKey->len, 
nLogicWidth))
+{
+assert(mLastPrefixKey->index == 0);
+std::unique_ptr layout
+= outputDevice->ImplLayout(text, nIndex, nLen, Point(0, 
0), nLogicWidth, {},
+   glyphItemsOnlyLayout, 
layoutCache);
+GetLayoutGlyphs(outputDevice, text, 0, text.getLength(), 
nLogicWidth, layoutCache);
+itWhole = mCachedGlyphs.find(keyWhole);
+}
+}
 if (itWhole != mCachedGlyphs.end() && itWhole->second.IsValid())
 {
+mLastPrefixKey.reset();
 mLastTemporaryGlyphs
 = makeGlyphsSubset(itWhole->second, outputDevice, text, 
nIndex, nLen);
 if (mLastTemporaryGlyphs.IsValid())
@@ -337,6 +364,9 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 }
 }
 }
+if (resetLastPrefixKey)
+mLastPrefixKey.reset();
+
 std::shared_ptr tmpLayoutCache;
 if (layoutCache == nullptr)
 {


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

2022-05-01 Thread Szymon Kłos (via logerrit)
 include/vcl/toolkit/button.hxx |2 +
 vcl/source/control/button.cxx  |   47 +
 2 files changed, 49 insertions(+)

New commits:
commit db2e2e555b26c92af38be13f68d494423fc236e3
Author: Szymon Kłos 
AuthorDate: Sat Apr 9 22:50:51 2022 +0200
Commit: Szymon Kłos 
CommitDate: Sun May 1 20:19:02 2022 +0200

jsdialog: export symbol for buttons

Change-Id: I412961bd59855dcb4204dfb917b30539dac0eac2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132756
Tested-by: Jenkins CollaboraOffice 
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133653
Tested-by: Jenkins

diff --git a/include/vcl/toolkit/button.hxx b/include/vcl/toolkit/button.hxx
index 28024d8c7d0b..e894f9e28bfb 100644
--- a/include/vcl/toolkit/button.hxx
+++ b/include/vcl/toolkit/button.hxx
@@ -179,6 +179,8 @@ public:
 return mbIsAction;
 }
 
+void DumpAsPropertyTree(tools::JsonWriter&) override;
+
 protected:
 PushButtonDropdownStyle mnDDStyle;
 boolmbIsActive;
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index e6e731f79ee5..210d2b6290e0 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -578,6 +578,46 @@ FactoryFunction Button::GetUITestFactory() const
 return ButtonUIObject::create;
 }
 
+namespace
+{
+
+const char* symbolTypeName(SymbolType eSymbolType)
+{
+switch (eSymbolType)
+{
+case SymbolType::DONTKNOW: return "DONTKNOW";
+case SymbolType::IMAGE:return "IMAGE";
+case SymbolType::ARROW_UP: return "ARROW_UP";
+case SymbolType::ARROW_DOWN:   return "ARROW_DOWN";
+case SymbolType::ARROW_LEFT:   return "ARROW_LEFT";
+case SymbolType::ARROW_RIGHT:  return "ARROW_RIGHT";
+case SymbolType::SPIN_UP:  return "SPIN_UP";
+case SymbolType::SPIN_DOWN:return "SPIN_DOWN";
+case SymbolType::SPIN_LEFT:return "SPIN_LEFT";
+case SymbolType::SPIN_RIGHT:   return "SPIN_RIGHT";
+case SymbolType::FIRST:return "FIRST";
+case SymbolType::LAST: return "LAST";
+case SymbolType::PREV: return "PREV";
+case SymbolType::NEXT: return "NEXT";
+case SymbolType::PAGEUP:   return "PAGEUP";
+case SymbolType::PAGEDOWN: return "PAGEDOWN";
+case SymbolType::PLAY: return "PLAY";
+case SymbolType::STOP: return "STOP";
+case SymbolType::CLOSE:return "CLOSE";
+case SymbolType::CHECKMARK:return "CHECKMARK";
+case SymbolType::RADIOCHECKMARK:   return "RADIOCHECKMARK";
+case SymbolType::FLOAT:return "FLOAT";
+case SymbolType::DOCK: return "DOCK";
+case SymbolType::HIDE: return "HIDE";
+case SymbolType::HELP: return "HELP";
+case SymbolType::PLUS: return "PLUS";
+}
+
+return "UNKNOWN";
+}
+
+}
+
 void Button::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 {
 Control::DumpAsPropertyTree(rJsonWriter);
@@ -598,6 +638,13 @@ void Button::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
 rJsonWriter.put("has_default", true);
 }
 
+void PushButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+Button::DumpAsPropertyTree(rJsonWriter);
+if (GetSymbol() != SymbolType::DONTKNOW)
+rJsonWriter.put("symbol", symbolTypeName(GetSymbol()));
+}
+
 IMPL_STATIC_LINK( Button, dispatchCommandHandler, Button*, pButton, void )
 {
 if (pButton == nullptr)


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

2022-04-30 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |1 -
 vcl/source/gdi/impglyphitem.cxx |   20 
 2 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit 339fbb7bc30f227b9d4c9b9eea03b25f49533dee
Author: Luboš Luňák 
AuthorDate: Mon Apr 11 12:46:21 2022 +0200
Commit: Luboš Luňák 
CommitDate: Sun May 1 05:46:50 2022 +0200

SalLayoutGlyphsCache no longer needs to hash OutputDevice pointer

It seems now the cache key contains all the necessary info and
results can be shared even between different OutputDevice instances,
as long as they are "the same".

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index ea6d9fca7ffb..a7a49ca7a8f2 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -69,7 +69,6 @@ private:
 sal_Int32 index;
 sal_Int32 len;
 tools::Long logicWidth;
-VclPtr outputDevice;
 vcl::Font font;
 double fontScaleX;
 double fontScaleY;
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index e66a5bad1a2d..0ae4e979e141 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -367,18 +367,15 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 return nullptr;
 }
 
-SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr& d,
-   const OUString& t, 
sal_Int32 i, sal_Int32 l,
-   tools::Long w)
+SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(
+const VclPtr& outputDevice, const OUString& t, 
sal_Int32 i, sal_Int32 l,
+tools::Long w)
 : text(t)
 , index(i)
 , len(l)
 , logicWidth(w)
-, outputDevice(d)
 // we also need to save things used in 
OutputDevice::ImplPrepareLayoutArgs(), in case they
-// change in the output device
-// TODO there is still something missing, otherwise it wouldn't be 
necessary to compare
-// also the OutputDevice pointers
+// change in the output device, plus mapMode affects the sizes.
 , font(outputDevice->GetFont())
 // TODO It would be possible to get a better hit ratio if mapMode wasn't 
part of the key
 // and results that differ only in mapmode would have coordinates adjusted 
based on that.
@@ -397,7 +394,6 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr

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

2022-04-28 Thread Luboš Luňák (via logerrit)
 include/vcl/glyphitemcache.hxx  |2 ++
 include/vcl/outdev.hxx  |3 ++-
 vcl/source/gdi/impglyphitem.cxx |   15 +++
 3 files changed, 15 insertions(+), 5 deletions(-)

New commits:
commit 12dcfc191bc258b51f5d00f46ea44a6a1c6fda91
Author: Luboš Luňák 
AuthorDate: Thu Apr 28 08:38:17 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Apr 28 12:36:23 2022 +0200

include LogicalFontInstance font scale in SalLayoutGlyphsCache key

For some reason it may differ even if vcl::Font is the same.
Without this ScExportTest2::testTdf8 fails.

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

diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx
index ab9ad877059a..ea6d9fca7ffb 100644
--- a/include/vcl/glyphitemcache.hxx
+++ b/include/vcl/glyphitemcache.hxx
@@ -71,6 +71,8 @@ private:
 tools::Long logicWidth;
 VclPtr outputDevice;
 vcl::Font font;
+double fontScaleX;
+double fontScaleY;
 MapMode mapMode;
 bool rtl;
 vcl::text::ComplexTextLayoutFlags layoutMode;
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index bf4985622fad..ea14e3d018b7 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1192,8 +1192,9 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-protected:
 SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+
+protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
 SAL_DLLPRIVATE tools::Long GetEmphasisDescent() const { return 
mnEmphasisDescent; }
 
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 09acbae46150..93f70a853a74 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -364,6 +364,9 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtrGetLayoutMode())
 , digitLanguage(outputDevice->GetDigitLanguage())
 {
+const LogicalFontInstance* fi = outputDevice->GetFontInstance();
+fi->GetScale(&fontScaleX, &fontScaleY);
+
 hashValue = 0;
 o3tl::hash_combine(hashValue, vcl::text::FirstCharsStringHash()(text));
 o3tl::hash_combine(hashValue, index);
@@ -371,7 +374,13 @@ 
SalLayoutGlyphsCache::CachedGlyphsKey::CachedGlyphsKey(const VclPtr

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

2022-04-27 Thread Luboš Luňák (via logerrit)
 include/vcl/outdev.hxx  |4 +++
 vcl/source/gdi/impglyphitem.cxx |   27 ++--
 vcl/source/outdev/text.cxx  |   53 +++-
 3 files changed, 59 insertions(+), 25 deletions(-)

New commits:
commit 3a407fc49490a348a8147a59dae242aa21708c31
Author: Luboš Luňák 
AuthorDate: Wed Apr 27 12:27:52 2022 +0200
Commit: Luboš Luňák 
CommitDate: Wed Apr 27 22:45:52 2022 +0200

make SalLayoutFlags match after makeGlyphsSubset()

SalLayoutFlags::BiDiStrong would be set by ImplLayout() if the entire
subset had no RTL, but the entire string may not be that, so when
creating a subset make sure to also set this flag. Similarly
SalLayoutFlags::KashidaJustification should be set only if any
glyph in the range has GlyphItemFlags::ALLOW_KASHIDA.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 7dacb68d55ad..bf4985622fad 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1078,6 +1078,10 @@ public:
   const SalLayoutGlyphs* pGlyphs = 
nullptr) const;
 static std::shared_ptr 
CreateTextLayoutCache(OUString const&);
 
+SAL_DLLPRIVATE SalLayoutFlags GetBiDiLayoutFlags( std::u16string_view rStr,
+  const sal_Int32 
nMinIndex,
+  const sal_Int32 
nEndIndex ) const;
+
 protected:
 SAL_DLLPRIVATE void ImplInitTextLineSize();
 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 83c044ce176c..5c4acbc6859c 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -164,8 +164,9 @@ SalLayoutGlyphsCache* SalLayoutGlyphsCache::self()
 return cache.get();
 }
 
-static SalLayoutGlyphs makeGlyphsSubset(const SalLayoutGlyphs& source, 
sal_Int32 index,
-sal_Int32 len)
+static SalLayoutGlyphs makeGlyphsSubset(const SalLayoutGlyphs& source,
+const OutputDevice* outputDevice, 
std::u16string_view text,
+sal_Int32 index, sal_Int32 len)
 {
 SalLayoutGlyphs ret;
 for (int level = 0;; ++level)
@@ -177,6 +178,25 @@ static SalLayoutGlyphs makeGlyphsSubset(const 
SalLayoutGlyphs& source, sal_Int32
 // If the glyphs range cannot be cloned, bail out.
 if (cloned == nullptr)
 return SalLayoutGlyphs();
+// If the entire string is mixed LTR/RTL but the subset is only LTR,
+// then make sure the flags match that, otherwise checkGlyphsEqual()
+// would assert on flags being different.
+cloned->SetFlags(cloned->GetFlags()
+ | outputDevice->GetBiDiLayoutFlags(text, index, index 
+ len));
+// SalLayoutFlags::KashidaJustification is set only if any glyph
+// in the range has GlyphItemFlags::ALLOW_KASHIDA (otherwise unset it).
+bool hasKashida = false;
+for (const GlyphItem& item : *cloned)
+{
+if (item.AllowKashida())
+{
+assert(cloned->GetFlags() & 
SalLayoutFlags::KashidaJustification);
+hasKashida = true;
+break;
+}
+}
+if (!hasKashida)
+cloned->SetFlags(cloned->GetFlags() & 
~SalLayoutFlags::KashidaJustification);
 ret.AppendImpl(cloned);
 }
 return ret;
@@ -236,7 +256,8 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr outputDevice, c
 GlyphsCache::const_iterator itWhole = mCachedGlyphs.find(keyWhole);
 if (itWhole != mCachedGlyphs.end() && itWhole->second.IsValid())
 {
-mLastTemporaryGlyphs = makeGlyphsSubset(itWhole->second, nIndex, 
nLen);
+mLastTemporaryGlyphs
+= makeGlyphsSubset(itWhole->second, outputDevice, text, 
nIndex, nLen);
 if (mLastTemporaryGlyphs.IsValid())
 {
 mLastTemporaryKey = std::move(key);
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 840341502beb..7d3662d0604d 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1170,28 +1170,7 @@ vcl::text::ImplLayoutArgs 
OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
 if( nEndIndex < nMinIndex )
 nEndIndex = nMinIndex;
 
-if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl )
-nLayoutFlags |= SalLayoutFlags::BiDiRtl;
-if( mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiStrong )
-nLayoutFlags |= SalLayoutFlags::BiDiStrong;
-else if( !(mnTextLayoutMode & vcl::text::ComplexTextLayoutFlags::BiDiRtl) )
-{
-// D

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

2022-04-14 Thread Caolán McNamara (via logerrit)
 include/vcl/syswin.hxx|2 +-
 vcl/source/app/salvtables.cxx |6 +++---
 vcl/source/window/layout.cxx  |2 +-
 vcl/source/window/syswin.cxx  |9 -
 4 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 0d5c5c17a43726c1407d100e440a87ed06966d30
Author: Caolán McNamara 
AuthorDate: Thu Apr 14 10:37:04 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 14 17:15:56 2022 +0200

Resolves: tdf#148476 allow dialog resize buttons to "shrink" again

a problem since:

commit 5d388b94735e34ba445d65e1d5030a646aad7dbe
Date:   Thu Jan 27 12:17:48 2022 +

Related: tdf#146648 let SetWindowState size trump the initial layout 
pref size

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

diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 03d79f2e3497..24f41331eb21 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -159,7 +159,7 @@ public:
 virtual SizeGetOptimalSize() const override;
 virtual voidqueue_resize(StateChangedType eReason = 
StateChangedType::Layout) override;
 boolisLayoutEnabled() const;
-voidsetOptimalLayoutSize();
+voidsetOptimalLayoutSize(bool bAllowWindowShrink);
 boolisCalculatingInitialLayoutSize() const { return 
mbIsCalculatingInitialLayoutSize; }
 
 voidSetIcon( sal_uInt16 nIcon );
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 7d0a62057231..fad841f45787 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1439,7 +1439,7 @@ void resize_to_request(vcl::Window* pWindow)
 {
 if (SystemWindow* pSysWin = dynamic_cast(pWindow))
 {
-pSysWin->setOptimalLayoutSize();
+pSysWin->setOptimalLayoutSize(true);
 return;
 }
 if (DockingWindow* pDockWin = dynamic_cast(pWindow))
@@ -1695,7 +1695,7 @@ void SalInstanceDialog::collapse(weld::Widget* pEdit, 
weld::Widget* pButton)
 m_xDialog->set_border_width(0);
 if (vcl::Window* pActionArea = m_xDialog->get_action_area())
 pActionArea->Hide();
-m_xDialog->setOptimalLayoutSize();
+m_xDialog->setOptimalLayoutSize(true);
 m_xRefEdit = pRefEdit;
 }
 
@@ -1713,7 +1713,7 @@ void SalInstanceDialog::undo_collapse()
 m_xDialog->set_border_width(m_nOldBorderWidth);
 if (vcl::Window* pActionArea = m_xDialog->get_action_area())
 pActionArea->Show();
-m_xDialog->setOptimalLayoutSize();
+m_xDialog->setOptimalLayoutSize(true);
 }
 
 void SalInstanceDialog::SetInstallLOKNotifierHdl(
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 99b60673b7c0..b67ffeabbfd4 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1812,7 +1812,7 @@ IMPL_LINK( VclExpander, ClickHdl, CheckBox&, rBtn, void )
 queue_resize();
 Dialog* pResizeDialog = m_bResizeTopLevel ? GetParentDialog() : 
nullptr;
 if (pResizeDialog)
-pResizeDialog->setOptimalLayoutSize();
+pResizeDialog->setOptimalLayoutSize(true);
 }
 maExpandedHdl.Call(*this);
 }
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index bf6be3b0ab10..40fff00aa7d9 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -1070,7 +1070,7 @@ void SystemWindow::settingOptimalLayoutSize(Window* 
/*pBox*/)
 {
 }
 
-void SystemWindow::setOptimalLayoutSize()
+void SystemWindow::setOptimalLayoutSize(bool bAllowWindowShrink)
 {
 maLayoutIdle.Stop();
 
@@ -1088,9 +1088,7 @@ void SystemWindow::setOptimalLayoutSize()
 
 SetMinOutputSizePixel(aSize);
 
-if (!mbInitialLayoutSizeCalculated)
-mbInitialLayoutSizeCalculated = true;
-else
+if (!bAllowWindowShrink)
 {
 Size aCurrentSize = GetSizePixel();
 aSize.setWidth(std::max(aSize.Width(), aCurrentSize.Width()));
@@ -1110,7 +1108,8 @@ void SystemWindow::DoInitialLayout()
 {
 mbIsCalculatingInitialLayoutSize = true;
 setDeferredProperties();
-setOptimalLayoutSize();
+setOptimalLayoutSize(!mbInitialLayoutSizeCalculated);
+mbInitialLayoutSizeCalculated = true;
 mbIsCalculatingInitialLayoutSize = false;
 }
 }


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

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

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

ignore Point logicalPos argument in SalLayoutGlyphsCache

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

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

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

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

2022-04-07 Thread Caolán McNamara (via logerrit)
 include/vcl/settings.hxx  |3 +++
 vcl/source/app/salvtables.cxx |3 ++-
 vcl/source/app/settings.cxx   |   18 ++
 vcl/unx/gtk3/gtkinst.cxx  |2 +-
 vcl/unx/gtk3/salnativewidgets-gtk.cxx |5 +
 5 files changed, 29 insertions(+), 2 deletions(-)

New commits:
commit 39076309c6583e62f6ee8e1558074a54b797637a
Author: Caolán McNamara 
AuthorDate: Thu Apr 7 17:05:28 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 7 23:59:26 2022 +0200

Related: tdf#148448 add a separate WarningColor settings

instead of a hard-coded yellow. For gtk we can use the named color
"warning_color" to populate it: 
https://docs.gtk.org/gtk4/css-properties.html

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

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 523fe6bc13f9..6795150819a7 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -345,6 +345,9 @@ public:
 voidSetDisableColor( const Color& rColor );
 const Color&GetDisableColor() const;
 
+voidSetWarningColor( const Color& rColor );
+const Color&GetWarningColor() const;
+
 voidSetHelpColor( const Color& rColor );
 const Color&GetHelpColor() const;
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index c21d66a15d0a..88b50c50c203 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5727,7 +5727,8 @@ void SalInstanceLabel::set_label_type(weld::LabelType 
eType)
 break;
 case weld::LabelType::Warning:
 m_xLabel->SetControlForeground();
-m_xLabel->SetControlBackground(COL_YELLOW);
+m_xLabel->SetControlBackground(
+m_xLabel->GetSettings().GetStyleSettings().GetWarningColor());
 break;
 case weld::LabelType::Error:
 m_xLabel->SetControlForeground();
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 9660efc09c53..122b2ae6f576 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -131,6 +131,7 @@ struct ImplStyleData
 Color   maMonoColor;
 Color   maRadioCheckTextColor;
 Color   maShadowColor;
+Color   maWarningColor;
 Color   maVisitedLinkColor;
 Color   maToolTextColor;
 Color   maWindowColor;
@@ -551,6 +552,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
 maMonoColor( rData.maMonoColor ),
 maRadioCheckTextColor( rData.maRadioCheckTextColor ),
 maShadowColor( rData.maShadowColor ),
+maWarningColor( rData.maWarningColor ),
 maVisitedLinkColor( rData.maVisitedLinkColor ),
 maToolTextColor( rData.maToolTextColor ),
 maWindowColor( rData.maWindowColor ),
@@ -651,6 +653,8 @@ void ImplStyleData::SetStandardStyles()
 maShadowColor   = COL_GRAY;
 maDarkShadowColor   = COL_BLACK;
 
+maWarningColor  = COL_YELLOW;
+
 maDefaultButtonTextColor  = COL_BLACK;
 maButtonTextColor = COL_BLACK;
 maDefaultActionButtonTextColor= COL_BLACK;
@@ -784,6 +788,19 @@ StyleSettings::GetLightBorderColor() const
 return mxData->maLightBorderColor;
 }
 
+void
+StyleSettings::SetWarningColor( const Color& rColor )
+{
+CopyData();
+mxData->maWarningColor = rColor;
+}
+
+const Color&
+StyleSettings::GetWarningColor() const
+{
+return mxData->maWarningColor;
+}
+
 void
 StyleSettings::SetShadowColor( const Color& rColor )
 {
@@ -2429,6 +2446,7 @@ bool StyleSettings::operator ==( const StyleSettings& 
rSet ) const
  (mxData->maLightBorderColor== 
rSet.mxData->maLightBorderColor) &&
  (mxData->maShadowColor == rSet.mxData->maShadowColor) 
 &&
  (mxData->maDarkShadowColor == rSet.mxData->maDarkShadowColor) 
 &&
+ (mxData->maWarningColor== rSet.mxData->maWarningColor)
 &&
  (mxData->maButtonTextColor == rSet.mxData->maButtonTextColor) 
 &&
  (mxData->maDefaultActionButtonTextColor == 
rSet.mxData->maDefaultActionButtonTextColor) &&
  (mxData->maActionButtonTextColor   == 
rSet.mxData->maActionButtonTextColor)&&
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 4875bc64e7d7..ff024e662037 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -16909,7 +16909,7 @@ public:
 gtk_label_set_attributes(m_pLabel,

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

2022-04-01 Thread Xisco Fauli (via logerrit)
 include/vcl/layout.hxx  |1 
 include/vcl/uitest/uiobject.hxx |   22 
 vcl/source/uitest/uiobject.cxx  |   43 
 vcl/source/window/layout.cxx|5 
 4 files changed, 71 insertions(+)

New commits:
commit 1403a335b43089af7ed25fc67bd44df932dc9611
Author: Xisco Fauli 
AuthorDate: Fri Apr 1 11:57:31 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Apr 1 14:12:05 2022 +0200

uitest: add wrapper for VclExpander

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

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 19eca5b5cf40..2296f8097a4a 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -470,6 +470,7 @@ public:
 virtual void StateChanged(StateChangedType nType) override;
 void  SetExpandedHdl( const Link& rLink ) { 
maExpandedHdl = rLink; }
 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+virtual FactoryFunction GetUITestFactory() const override;
 private:
 virtual Size calculateRequisition() const override;
 virtual void setAllocation(const Size &rAllocation) override;
diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index c46218d68423..c9a932ec672f 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -36,6 +36,7 @@ class SvTreeListEntry;
 class SpinButton;
 class SpinField;
 class VerticalTabControl;
+class VclExpander;
 class VclDrawingArea;
 class VclMultiLineEdit;
 class MenuButton;
@@ -234,6 +235,27 @@ private:
 virtual OUString get_name() const override;
 };
 
+class ExpanderUIObject : public WindowUIObject
+{
+VclPtr mxExpander;
+
+public:
+
+ExpanderUIObject(const VclPtr& xExpander);
+virtual ~ExpanderUIObject() override;
+
+virtual void execute(const OUString& rAction,
+const StringMap& rParameters) override;
+
+virtual StringMap get_state() override;
+
+static std::unique_ptr create(vcl::Window* pWindow);
+private:
+
+virtual OUString get_name() const override;
+};
+
+
 // TODO: moggi: maybe let it inherit from the button case
 class CheckBoxUIObject final : public WindowUIObject
 {
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index da71b7d3e41d..d44134cb7996 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -894,6 +894,49 @@ std::unique_ptr 
MultiLineEditUIObject::create(vcl::Window* pWindow)
 return std::unique_ptr(new MultiLineEditUIObject(pEdit));
 }
 
+ExpanderUIObject::ExpanderUIObject(const VclPtr& xExpander)
+: WindowUIObject(xExpander)
+, mxExpander(xExpander)
+{
+}
+
+ExpanderUIObject::~ExpanderUIObject()
+{
+}
+
+void ExpanderUIObject::execute(const OUString& rAction, const StringMap& 
rParameters)
+{
+if (rAction == "EXPAND")
+{
+mxExpander->set_expanded(true);
+}
+else if (rAction == "COLLAPSE")
+{
+mxExpander->set_expanded(false);
+}
+else
+WindowUIObject::execute(rAction, rParameters);
+}
+
+StringMap ExpanderUIObject::get_state()
+{
+StringMap aMap = WindowUIObject::get_state();
+aMap["Expanded"] = OUString::boolean(mxExpander->get_expanded());
+return aMap;
+}
+
+OUString ExpanderUIObject::get_name() const
+{
+return "ExpanderUIObject";
+}
+
+std::unique_ptr ExpanderUIObject::create(vcl::Window* pWindow)
+{
+VclExpander* pVclExpander = dynamic_cast(pWindow);
+assert(pVclExpander);
+return std::unique_ptr(new ExpanderUIObject(pVclExpander));
+}
+
 CheckBoxUIObject::CheckBoxUIObject(const VclPtr& xCheckbox):
 WindowUIObject(xCheckbox),
 mxCheckBox(xCheckbox)
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 5cd885ed2556..99b60673b7c0 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1798,6 +1798,11 @@ void VclExpander::DumpAsPropertyTree(tools::JsonWriter& 
rJsonWriter)
 rJsonWriter.put("type", "expander");
 }
 
+FactoryFunction VclExpander::GetUITestFactory() const
+{
+return ExpanderUIObject::create;
+}
+
 IMPL_LINK( VclExpander, ClickHdl, CheckBox&, rBtn, void )
 {
 vcl::Window *pChild = get_child();


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

2022-03-30 Thread Caolán McNamara (via logerrit)
 include/vcl/mapmod.hxx|2 +-
 vcl/source/gdi/TypeSerializer.cxx |9 -
 vcl/source/gdi/gdimtf.cxx |7 ---
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 910251c05059d0c31d9556f6c8e8dbffc8998f89
Author: Caolán McNamara 
AuthorDate: Wed Mar 30 10:25:51 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Mar 30 16:34:36 2022 +0200

use the device dpi

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

diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
index 9d14fe60ae79..591db8d8c1c0 100644
--- a/include/vcl/mapmod.hxx
+++ b/include/vcl/mapmod.hxx
@@ -83,7 +83,7 @@ inline std::basic_ostream & operator <<(
 return rStream;
 }
 
-bool TooLargeScaleForMapMode(const Fraction& rScale);
+bool TooLargeScaleForMapMode(const Fraction& rScale, int nDPI);
 
 #endif // INCLUDED_VCL_MAPMOD_HXX
 
diff --git a/vcl/source/gdi/TypeSerializer.cxx 
b/vcl/source/gdi/TypeSerializer.cxx
index dfaf300c7801..cad183128570 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -425,14 +425,13 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
 }
 }
 
-bool TooLargeScaleForMapMode(const Fraction& rScale)
+bool TooLargeScaleForMapMode(const Fraction& rScale, int nDPI)
 {
 // ImplLogicToPixel will multiply its values by this numerator * dpi and 
then double that
 // result before dividing
-constexpr sal_Int32 nTypicalDPI = 96;
-if (rScale.GetNumerator() > std::numeric_limits::max() / 
nTypicalDPI / 2)
+if (rScale.GetNumerator() > std::numeric_limits::max() / nDPI / 
2)
 return true;
-if (rScale.GetNumerator() < std::numeric_limits::min() / 
nTypicalDPI / 2)
+if (rScale.GetNumerator() < std::numeric_limits::min() / nDPI / 
2)
 return true;
 return false;
 }
@@ -441,7 +440,7 @@ static bool UselessScaleForMapMode(const Fraction& rScale)
 {
 if (!rScale.IsValid())
 return true;
-if (TooLargeScaleForMapMode(rScale))
+if (TooLargeScaleForMapMode(rScale, 96))
 return true;
 if (static_cast(rScale) < 0.0)
 return true;
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3fa9ea3d24e3..68c48bf6e01f 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -486,11 +486,12 @@ void GDIMetaFile::Play(OutputDevice& rOut, const Point& 
rPos,
 aScaleY *= aDrawMap.GetScaleY();
 // try reducing inaccurary first and abandon if the scaling
 // still cannot be achieved
-if (TooLargeScaleForMapMode(aScaleX))
+if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()))
 aScaleX.ReduceInaccurate(10);
-if (TooLargeScaleForMapMode(aScaleY))
+if (TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
 aScaleY.ReduceInaccurate(10);
-if (TooLargeScaleForMapMode(aScaleX) || TooLargeScaleForMapMode(aScaleY))
+if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()) ||
+TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
 {
 SAL_WARN("vcl", "GDIMetaFile Scaling is too high");
 return;


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

2022-03-22 Thread Stephan Bergmann (via logerrit)
 include/vcl/opengl/OpenGLHelper.hxx |2 ++
 vcl/source/opengl/OpenGLHelper.cxx  |   17 -
 2 files changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 3076b4f009cd1ba8c7f71454436001def34d9bd0
Author: Stephan Bergmann 
AuthorDate: Tue Mar 22 07:45:46 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Mar 22 09:24:50 2022 +0100

OpenGLHelper::GetDigest is only used on Windows

This is in preparation of getting rid of X11OpenGLDeviceInfo for non-Windows
platforms.

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

diff --git a/include/vcl/opengl/OpenGLHelper.hxx 
b/include/vcl/opengl/OpenGLHelper.hxx
index e85bb351fb2f..45383bd6fb9d 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -48,7 +48,9 @@ struct VCL_DLLPUBLIC OpenGLHelper
 
 public:
 
+#if defined _WIN32
 static OString GetDigest(const OUString& rVertexShaderName, const 
OUString& rFragmentShaderName, std::string_view preamble );
+#endif
 
 static GLint LoadShaders(const OUString& rVertexShaderName, const 
OUString& rFragmentShaderName, const OUString& rGeometryShaderName, 
std::string_view preamble, std::string_view rDigest );
 static GLint LoadShaders(const OUString& rVertexShaderName, const 
OUString& rFragmentShaderName, std::string_view preamble, std::string_view 
rDigest );
diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index bf37940511ff..5bd10ebf353d 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -171,6 +171,7 @@ namespace
 {
 const sal_uInt32 GLenumSize = sizeof(GLenum);
 
+#if defined _WIN32
 OString getHexString(const sal_uInt8* pData, sal_uInt32 nLength)
 {
 static const char* const pHexData = "0123456789ABCDEF";
@@ -203,24 +204,11 @@ namespace
 
 OString getDeviceInfoString()
 {
-#if USING_X11
-const X11OpenGLDeviceInfo aInfo;
-return aInfo.GetOS() +
-aInfo.GetOSRelease() +
-aInfo.GetRenderer() +
-aInfo.GetVendor() +
-aInfo.GetVersion();
-#elif defined( _WIN32 )
 const WinOpenGLDeviceInfo aInfo;
 return OUStringToOString(aInfo.GetAdapterVendorID(), 
RTL_TEXTENCODING_UTF8) +
 OUStringToOString(aInfo.GetAdapterDeviceID(), 
RTL_TEXTENCODING_UTF8) +
 OUStringToOString(aInfo.GetDriverVersion(), RTL_TEXTENCODING_UTF8) 
+
 OString::number(DriverBlocklist::GetWindowsVersion());
-#else
-return OString::Concat(reinterpret_cast(glGetString(GL_VENDOR))) +
-reinterpret_cast(glGetString(GL_RENDERER)) +
-reinterpret_cast(glGetString(GL_VERSION));
-#endif
 }
 
 OString getStringDigest( const OUString& rVertexShaderName,
@@ -241,6 +229,7 @@ namespace
 
 return generateMD5(aMessage.getStr(), aMessage.getLength());
 }
+#endif
 
 OString getCacheFolder()
 {
@@ -374,12 +363,14 @@ namespace
 }
 }
 
+#if defined _WIN32
 OString OpenGLHelper::GetDigest( const OUString& rVertexShaderName,
   const OUString& rFragmentShaderName,
   std::string_view rPreamble )
 {
 return getStringDigest(rVertexShaderName, rFragmentShaderName, rPreamble);
 }
+#endif
 
 GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,
 const OUString& rFragmentShaderName,


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

2022-03-13 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx |1 +
 vcl/source/outdev/font.cxx |   40 
 2 files changed, 25 insertions(+), 16 deletions(-)

New commits:
commit 0898179afc9334bc2370cdccbf3392337585b860
Author: Caolán McNamara 
AuthorDate: Sun Mar 13 13:41:31 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 13 20:53:19 2022 +0100

ofz: Divide-by-zero

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index a777f9d73569..fe1d9583e2ba 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1113,6 +1113,7 @@ private:
 SAL_DLLPRIVATE void ImplDrawStrikeoutChar( tools::Long nBaseX, 
tools::Long nBaseY, tools::Long nX, tools::Long nY, tools::Long nWidth, 
FontStrikeout eStrikeout, Color aColor );
 SAL_DLLPRIVATE void ImplDrawMnemonicLine( tools::Long nX, 
tools::Long nY, tools::Long nWidth );
 
+SAL_DLLPRIVATE bool AttemptOLEFontScaleFix(vcl::Font& rFont, 
tools::Long nHeight) const;
 
 ///@}
 
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 71e4091e754e..ba487b0198c3 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -990,24 +990,32 @@ bool OutputDevice::ImplNewFont() const
 bool bRet = true;
 
 // #95414# fix for OLE objects which use scale factors very creatively
-if( mbMap && !aSize.Width() )
+if (mbMap && !aSize.Width())
+bRet = AttemptOLEFontScaleFix(const_cast(maFont), 
aSize.Height());
+
+return bRet;
+}
+
+bool OutputDevice::AttemptOLEFontScaleFix(vcl::Font& rFont, tools::Long 
nHeight) const
+{
+const float fDenominator = static_cast(maMapRes.mnMapScNumY) * 
maMapRes.mnMapScDenomX;
+if (fDenominator == 0.0)
+return false;
+const float fNumerator = static_cast(maMapRes.mnMapScNumX) * 
maMapRes.mnMapScDenomY;
+float fStretch = fNumerator / fDenominator;
+int nOrigWidth = mpFontInstance->mxFontMetric->GetWidth();
+int nNewWidth = static_cast(nOrigWidth * fStretch + 0.5);
+bool bRet = true;
+if (nNewWidth != nOrigWidth && nNewWidth != 0)
 {
-int nOrigWidth = pFontInstance->mxFontMetric->GetWidth();
-float fStretch = static_cast(maMapRes.mnMapScNumX) * 
maMapRes.mnMapScDenomY;
-fStretch /= static_cast(maMapRes.mnMapScNumY) * 
maMapRes.mnMapScDenomX;
-int nNewWidth = static_cast(nOrigWidth * fStretch + 0.5);
-if( (nNewWidth != nOrigWidth) && (nNewWidth != 0) )
-{
-Size aOrigSize = maFont.GetFontSize();
-const_cast(maFont).SetFontSize( Size( nNewWidth, 
aSize.Height() ) );
-mbMap = false;
-mbNewFont = true;
-bRet = ImplNewFont();  // recurse once using stretched width
-mbMap = true;
-const_cast(maFont).SetFontSize( aOrigSize );
-}
+Size aOrigSize = rFont.GetFontSize();
+rFont.SetFontSize(Size(nNewWidth, nHeight));
+mbMap = false;
+mbNewFont = true;
+bRet = ImplNewFont();  // recurse once using stretched width
+mbMap = true;
+rFont.SetFontSize(aOrigSize);
 }
-
 return bRet;
 }
 


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

2022-01-27 Thread Caolán McNamara (via logerrit)
 include/vcl/syswin.hxx   |1 +
 vcl/source/window/syswin.cxx |   16 
 2 files changed, 17 insertions(+)

New commits:
commit 5d388b94735e34ba445d65e1d5030a646aad7dbe
Author: Caolán McNamara 
AuthorDate: Thu Jan 27 12:17:48 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 27 15:03:53 2022 +0100

Related: tdf#146648 let SetWindowState size trump the initial layout pref 
size

so a size can be restored from config and overrule the initial layout
size which is calculated on first show.

for existing cases, this changes behaviour if a dialog is shown,
hidden, layout changed and then reshown and the new layout is smaller
than the old layout. But that should align the behaviour of vcl
layout-enabled widgets with gtk ones.

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

diff --git a/include/vcl/syswin.hxx b/include/vcl/syswin.hxx
index 0c35073aec09..71661908fd86 100644
--- a/include/vcl/syswin.hxx
+++ b/include/vcl/syswin.hxx
@@ -103,6 +103,7 @@ private:
 boolmbHideBtn;
 boolmbSysChild;
 boolmbIsCalculatingInitialLayoutSize;
+boolmbInitialLayoutSizeCalculated;
 boolmbPaintComplete;
 MenuBarMode mnMenuBarMode;
 sal_uInt16  mnIcon;
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index c624c373aa77..f691f62dfda3 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -70,6 +70,7 @@ SystemWindow::SystemWindow(WindowType nType, const char* 
pIdleDebugName)
 , mbHideBtn(false)
 , mbSysChild(false)
 , mbIsCalculatingInitialLayoutSize(false)
+, mbInitialLayoutSizeCalculated(false)
 , mbPaintComplete(false)
 , mnMenuBarMode(MenuBarMode::Normal)
 , mnIcon(0)
@@ -746,6 +747,11 @@ void SystemWindow::SetWindowStateData( const 
WindowStateData& rData )
 nY = rGeom.nHeight - nHeight;
 setPosSizePixel( nX, nY, nWidth, nHeight, nPosSize );
 }
+
+// tdf#146648 if an explicit size state was set, then use it as the 
preferred
+// size for layout
+if (nValidMask & WindowStateMask::Size)
+mbInitialLayoutSizeCalculated = true;
 }
 
 void SystemWindow::GetWindowStateData( WindowStateData& rData ) const
@@ -1081,6 +1087,16 @@ void SystemWindow::setOptimalLayoutSize()
 aSize.setHeight( std::min(aMax.Height(), aSize.Height()) );
 
 SetMinOutputSizePixel(aSize);
+
+if (!mbInitialLayoutSizeCalculated)
+mbInitialLayoutSizeCalculated = true;
+else
+{
+Size aCurrentSize = GetSizePixel();
+aSize.setWidth(std::max(aSize.Width(), aCurrentSize.Width()));
+aSize.setHeight(std::max(aSize.Height(), aCurrentSize.Height()));
+}
+
 SetSizePixel(aSize);
 setPosSizeOnContainee(aSize, *pBox);
 }


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

2022-01-16 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx |4 ++--
 vcl/source/outdev/map.cxx  |   17 ++---
 vcl/source/outdev/text.cxx |   11 ++-
 3 files changed, 18 insertions(+), 14 deletions(-)

New commits:
commit 95ade11df658d73e90d196f041d0839895aca3f0
Author: Caolán McNamara 
AuthorDate: Sun Jan 16 17:27:26 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Jan 16 20:22:45 2022 +0100

tdf#146453 retain precise vertical base pos with ResolutionIndependentLayout

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4b9d1e7e626a..7e1a0fad7dcd 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1685,6 +1685,7 @@ public:
  @returns Physical point on the device.
  */
 SAL_DLLPRIVATE PointImplLogicToDevicePixel( const Point& rLogicPt 
) const;
+SAL_DLLPRIVATE DevicePoint  ImplLogicToDeviceFontCoordinate(const Point& 
rLogicPt) const;
 
 /** Convert a logical width to a width in units of device pixels.
 
@@ -1697,9 +1698,9 @@ public:
  @returns Width in units of device pixels.
  */
 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;
-SAL_DLLPRIVATE double LogicWidthToDeviceFontCoordinate( tools::Long nWidth 
) const;
 
 /** Convert a logical X coordinate to a device pixel's X coordinate.
 
@@ -1713,7 +1714,6 @@ public:
  @returns Device's X pixel coordinate
  */
 SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
-SAL_DLLPRIVATE double LogicXToDeviceFontCoordinate( tools::Long nWidth ) 
const;
 
 /** Convert a logical Y coordinate to a device pixel's Y coordinate.
 
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 5144f0f89f9f..918d8a5a77df 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -1830,7 +1830,7 @@ DeviceCoordinate 
OutputDevice::LogicWidthToDeviceCoordinate( tools::Long nWidth
 #endif
 }
 
-double OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const
+double OutputDevice::ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const
 {
 if (!mbMap)
 return nWidth;
@@ -1839,14 +1839,17 @@ double 
OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const
 maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX);
 }
 
-double OutputDevice::LogicXToDeviceFontCoordinate(tools::Long nX) const
+DevicePoint OutputDevice::ImplLogicToDeviceFontCoordinate(const Point& rPoint) 
const
 {
 if (!mbMap)
-return nX + mnOutOffX;
-
-return ImplLogicToPixel(static_cast(nX + maMapRes.mnMapOfsX), 
mnDPIX,
-maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX)
-+ mnOutOffX + mnOutOffOrigX;
+return DevicePoint(rPoint.X() + mnOutOffX, rPoint.Y() + mnOutOffY);
+
+return DevicePoint(ImplLogicToPixel(static_cast(rPoint.X() + 
maMapRes.mnMapOfsX), mnDPIX,
+maMapRes.mnMapScNumX, 
maMapRes.mnMapScDenomX)
++ mnOutOffX + mnOutOffOrigX,
+   ImplLogicToPixel(static_cast(rPoint.Y() + 
maMapRes.mnMapOfsY), mnDPIY,
+maMapRes.mnMapScNumY, 
maMapRes.mnMapScDenomY)
++ mnOutOffY + mnOutOffOrigY);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 49ca790b8aec..3d773e56d488 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1359,7 +1359,7 @@ std::unique_ptr OutputDevice::ImplLayout(const 
OUString& rOrigStr,
 xNaturalDXPixelArray.reset(new double[nLen]);
 
 for (int i = 0; i < nLen; ++i)
-xNaturalDXPixelArray[i] = 
LogicWidthToDeviceFontCoordinate(pDXArray[i]);
+xNaturalDXPixelArray[i] = 
ImplLogicWidthToDeviceFontWidth(pDXArray[i]);
 
 aLayoutArgs.SetAltNaturalDXArray(xNaturalDXPixelArray.get());
 nEndGlyphCoord = std::lround(xNaturalDXPixelArray[nLen - 1]);
@@ -1426,12 +1426,13 @@ std::unique_ptr 
OutputDevice::ImplLayout(const OUString& rOrigStr,
 // position, justify, etc. the layout
 pSalLayout->AdjustLayout( aLayoutArgs );
 
-Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos);
 if (bTextRenderModeForResolutionIndependentLayout)
-
pSalLayout->DrawBase().setX(LogicXToDeviceFontCoordinate(rLogicalPos.X()));
+pSalLayout->DrawBase() = ImplLogicToDeviceFontCoordinate(rLogicalPos);
 

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

2022-01-16 Thread Caolán McNamara (via logerrit)
 include/vcl/vcllayout.hxx|7 +++
 vcl/source/gdi/sallayout.cxx |   18 ++
 vcl/source/outdev/text.cxx   |2 ++
 3 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit 99460be87a11a404ce6c055fc540ec7ece404fb6
Author: Caolán McNamara 
AuthorDate: Sun Jan 16 17:24:08 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Jan 16 20:22:22 2022 +0100

Related: tdf#146453 retain accurate positioning in rotated text rendering

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

diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index b766a0b4ccd6..87d9345f4b9b 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -82,6 +82,11 @@ public:
 int GetUnitsPerPixel() const{ return 
mnUnitsPerPixel; }
 Degree10GetOrientation() const  { return 
mnOrientation; }
 
+voidSetTextRenderModeForResolutionIndependentLayout(bool 
bTextRenderModeForResolutionIndependentLayout)
+{
+mbTextRenderModeForResolutionIndependentLayout = 
bTextRenderModeForResolutionIndependentLayout;
+}
+
 // methods using string indexing
 virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, 
DeviceCoordinate nCharExtra, int nFactor) const = 0;
 virtual DeviceCoordinate FillDXArray( std::vector* 
pDXArray ) const = 0;
@@ -115,6 +120,8 @@ protected:
 
 mutable Point   maDrawOffset;
 DevicePoint maDrawBase;
+
+boolmbTextRenderModeForResolutionIndependentLayout;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 64b1d22480e5..be020c2f11ae 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -135,7 +135,8 @@ SalLayout::SalLayout()
 mnEndCharPos( -1 ),
 mnUnitsPerPixel( 1 ),
 mnOrientation( 0 ),
-maDrawOffset( 0, 0 )
+maDrawOffset( 0, 0 ),
+mbTextRenderModeForResolutionIndependentLayout(false)
 {}
 
 SalLayout::~SalLayout()
@@ -171,9 +172,18 @@ DevicePoint SalLayout::GetDrawPosition(const DevicePoint& 
rRelative) const
 
 double fX = aOfs.getX();
 double fY = aOfs.getY();
-tools::Long nX = static_cast( +fCos * fX + fSin * fY );
-tools::Long nY = static_cast( +fCos * fY - fSin * fX );
-aPos += DevicePoint(nX, nY);
+if (mbTextRenderModeForResolutionIndependentLayout)
+{
+double nX = +fCos * fX + fSin * fY;
+double nY = +fCos * fY - fSin * fX;
+aPos += DevicePoint(nX, nY);
+}
+else
+{
+tools::Long nX = static_cast( +fCos * fX + fSin * fY 
);
+tools::Long nY = static_cast( +fCos * fY - fSin * fX 
);
+aPos += DevicePoint(nX, nY);
+}
 }
 
 return aPos;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index f9f0fd54b673..49ca790b8aec 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1411,6 +1411,8 @@ std::unique_ptr OutputDevice::ImplLayout(const 
OUString& rOrigStr,
 if( !pSalLayout )
 return nullptr;
 
+
pSalLayout->SetTextRenderModeForResolutionIndependentLayout(bTextRenderModeForResolutionIndependentLayout);
+
 // do glyph fallback if needed
 // #105768# avoid fallback for very small font sizes
 if (aLayoutArgs.HasFallbackRun() && 
mpFontInstance->GetFontSelectPattern().mnHeight >= 3)


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

2022-01-16 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx|1 
 include/vcl/vcllayout.hxx |6 +--
 vcl/source/gdi/pdfwriter_impl.cxx |4 +-
 vcl/source/gdi/sallayout.cxx  |6 +--
 vcl/source/outdev/font.cxx|2 -
 vcl/source/outdev/map.cxx |   13 +++-
 vcl/source/outdev/text.cxx|   59 ++
 vcl/source/outdev/textline.cxx|   12 +++
 8 files changed, 63 insertions(+), 40 deletions(-)

New commits:
commit dab0d4e1f36faace21145a51733bd3a946992624
Author: Caolán McNamara 
AuthorDate: Sat Jan 15 21:47:02 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Jan 16 12:23:29 2022 +0100

tdf#146439 retain precise base start pos when using 
ResolutionIndependentLayout

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 0282ea8458b5..4b9d1e7e626a 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1713,6 +1713,7 @@ public:
  @returns Device's X pixel coordinate
  */
 SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
+SAL_DLLPRIVATE double LogicXToDeviceFontCoordinate( tools::Long nWidth ) 
const;
 
 /** Convert a logical Y coordinate to a device pixel's Y coordinate.
 
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index 957d18cebd95..b766a0b4ccd6 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -68,8 +68,8 @@ class VCL_DLLPUBLIC SalLayout
 public:
 virtual ~SalLayout();
 // used by upper layers
-Point&  DrawBase()  { return 
maDrawBase; }
-const Point&DrawBase() const{ return 
maDrawBase; }
+DevicePoint&DrawBase()  { return 
maDrawBase; }
+const DevicePoint& DrawBase() const { return 
maDrawBase; }
 Point&  DrawOffset(){ return 
maDrawOffset; }
 const Point&DrawOffset() const  { return 
maDrawOffset; }
 DevicePoint GetDrawPosition( const DevicePoint& rRelative = 
DevicePoint(0,0) ) const;
@@ -114,7 +114,7 @@ protected:
 Degree10mnOrientation;
 
 mutable Point   maDrawOffset;
-Point   maDrawBase;
+DevicePoint maDrawBase;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index b85592e8fa51..0af6cc78f221 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -5804,9 +5804,9 @@ void PDFWriterImpl::drawShadow( SalLayout& rLayout, const 
OUString& rText, bool
 tools::Long nOff = 1 + ((GetFontInstance()->mnLineHeight-24)/24);
 if( rFont.IsOutline() )
 nOff++;
-rLayout.DrawBase() += Point( nOff, nOff );
+rLayout.DrawBase() += DevicePoint(nOff, nOff);
 drawLayout( rLayout, rText, bTextLines );
-rLayout.DrawBase() -= Point( nOff, nOff );
+rLayout.DrawBase() -= DevicePoint(nOff, nOff);
 
 setFont( aSaveFont );
 setTextLineColor( aSaveTextLineColor );
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 8c7542a3b79f..64b1d22480e5 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -150,7 +150,7 @@ void SalLayout::AdjustLayout( vcl::text::ImplLayoutArgs& 
rArgs )
 
 DevicePoint SalLayout::GetDrawPosition(const DevicePoint& rRelative) const
 {
-DevicePoint aPos(maDrawBase.X(), maDrawBase.Y());
+DevicePoint aPos(maDrawBase);
 DevicePoint aOfs(rRelative.getX() + maDrawOffset.X(),
  rRelative.getY() + maDrawOffset.Y());
 
@@ -1124,8 +1124,8 @@ bool MultiSalLayout::GetNextGlyph(const GlyphItem** 
pGlyph,
 nStart |= nFontTag;
 if (pFallbackFont)
 *pFallbackFont = pFontFace;
-rPos.adjustX(maDrawBase.X() + maDrawOffset.X());
-rPos.adjustY(maDrawBase.Y() + maDrawOffset.Y());
+rPos.adjustX(maDrawBase.getX() + maDrawOffset.X());
+rPos.adjustY(maDrawBase.getY() + maDrawOffset.Y());
 return true;
 }
 }
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 1182ac96a6b9..71e4091e754e 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1138,7 +1138,7 @@ void OutputDevice::ImplDrawEmphasisMarks( SalLayout& 
rSalLayout )
 }
 aOutPoint.adjustX(aAdjPoint.X() - nEmphasisWidth2);
 aOutPoint.adjustY(aAdjPoint.Y() - nEmphasisHeight2);
-ImplDrawEmphasisMark( rSalLayout.DrawBase().X(),
+ImplDrawEmphasisMark( rSalLayout.DrawBase().getX(),
   aOutPoint.getX(), aOutPoint.getY(),
  

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

2022-01-13 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx |3 ++-
 vcl/source/outdev/text.cxx |   11 ++-
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 3d27b1148b7ac54c39632baef16e9695c5e92d85
Author: Caolán McNamara 
AuthorDate: Thu Jan 13 10:45:01 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Jan 13 13:50:48 2022 +0100

split up ImplPrepareLayoutArgs a little

no logic change intended

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 13c8c49064b7..02faeb1477fb 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1230,8 +1230,9 @@ public:
 o3tl::span 
pLogicDXArray={}, SalLayoutFlags flags = SalLayoutFlags::NONE,
 vcl::text::TextLayoutCache const* 
= nullptr,
 const SalLayoutGlyphs* pGlyphs = 
nullptr) const;
+
 SAL_DLLPRIVATE vcl::text::ImplLayoutArgs ImplPrepareLayoutArgs( OUString&, 
const sal_Int32 nIndex, const sal_Int32 nLen,
- DeviceCoordinate 
nPixelWidth, const DeviceCoordinate* pPixelDXArray,
+ DeviceCoordinate 
nPixelWidth,
  SalLayoutFlags flags 
= SalLayoutFlags::NONE,
  
vcl::text::TextLayoutCache const* = nullptr) const;
 SAL_DLLPRIVATE std::unique_ptr
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 0e9cf85492e3..916bff7cab2d 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1149,7 +1149,7 @@ void OutputDevice::DrawStretchText( const Point& 
rStartPt, sal_uLong nWidth,
 
 vcl::text::ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
 const sal_Int32 nMinIndex, 
const sal_Int32 nLen,
-DeviceCoordinate 
nPixelWidth, const DeviceCoordinate* pDXArray,
+DeviceCoordinate 
nPixelWidth,
 SalLayoutFlags 
nLayoutFlags,
  vcl::text::TextLayoutCache const*const pLayoutCache) const
 {
@@ -1242,7 +1242,6 @@ vcl::text::ImplLayoutArgs 
OutputDevice::ImplPrepareLayoutArgs( OUString& rStr,
 aLayoutArgs.SetOrientation( nOrientation );
 
 aLayoutArgs.SetLayoutWidth( nPixelWidth );
-aLayoutArgs.SetDXArray( pDXArray );
 
 return aLayoutArgs;
 }
@@ -1339,6 +1338,9 @@ std::unique_ptr OutputDevice::ImplLayout(const 
OUString& rOrigStr,
 nPixelWidth = LogicWidthToDeviceCoordinate( nLogicalWidth );
 }
 
+vcl::text::ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, 
nMinIndex, nLen,
+nPixelWidth, flags, pLayoutCache);
+
 std::unique_ptr xDXPixelArray;
 DeviceCoordinate* pDXPixelArray(nullptr);
 if( !pDXArray.empty() )
@@ -1370,8 +1372,7 @@ std::unique_ptr OutputDevice::ImplLayout(const 
OUString& rOrigStr,
 }
 }
 
-vcl::text::ImplLayoutArgs aLayoutArgs = ImplPrepareLayoutArgs( aStr, 
nMinIndex, nLen,
-nPixelWidth, pDXPixelArray, flags, pLayoutCache);
+aLayoutArgs.SetDXArray(pDXPixelArray);
 
 // get matching layout object for base font
 std::unique_ptr pSalLayout = mpGraphics->GetTextLayout(0);
@@ -1426,7 +1427,7 @@ std::shared_ptr 
OutputDevice::CreateTextLayoutCache(
 bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, 
sal_Int32 nLen ) const
 {
 OUString aStr( rString );
-vcl::text::ImplLayoutArgs aArgs = ImplPrepareLayoutArgs( aStr, nIndex, 
nLen, 0, nullptr );
+vcl::text::ImplLayoutArgs aArgs = ImplPrepareLayoutArgs(aStr, nIndex, 
nLen, 0);
 bool bRTL = false;
 int nCharPos = -1;
 if (!aArgs.GetNextPos(&nCharPos, &bRTL))


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

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

2021-12-13 Thread Caolán McNamara (via logerrit)
 include/vcl/menu.hxx   |2 --
 vcl/source/window/menu.cxx |   22 --
 2 files changed, 24 deletions(-)

New commits:
commit 416e38c589635b6817a550cb9272e68ddc9bc9e9
Author: Caolán McNamara 
AuthorDate: Sun Dec 12 21:28:01 2021 +
Commit: Caolán McNamara 
CommitDate: Mon Dec 13 10:03:26 2021 +0100

remove newly unused Menu::InsertItem variant

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

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 7fd2e34492bd..a6ceb70d405b 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -241,8 +241,6 @@ public:
 MenuItemBits nItemBits = MenuItemBits::NONE,
 const OString &rIdent = OString(),
 sal_uInt16 nPos = MENU_APPEND);
-void InsertItem(const OUString& rCommand,
-const css::uno::Reference& rFrame);
 void InsertSeparator(const OString &rIdent = OString(), sal_uInt16 nPos = 
MENU_APPEND);
 void RemoveItem( sal_uInt16 nPos );
 void Clear();
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 68e01be87c65..e671341a8292 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -469,28 +469,6 @@ void Menu::InsertItem(sal_uInt16 nItemId, const OUString& 
rStr,
 SetItemImage( nItemId, rImage );
 }
 
-void Menu::InsertItem(const OUString& rCommand, const 
css::uno::Reference& rFrame)
-{
-sal_uInt16 nItemId = GetItemCount() + 1;
-
-if (rFrame.is())
-{
-OUString 
aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
-auto aProperties = 
vcl::CommandInfoProvider::GetCommandProperties(rCommand, aModuleName);
-OUString 
aLabel(CommandInfoProvider::GetPopupLabelForCommand(aProperties));
-OUString aTooltip(CommandInfoProvider::GetTooltipForCommand(rCommand, 
aProperties, rFrame));
-Image aImage(CommandInfoProvider::GetImageForCommand(rCommand, 
rFrame));
-
-InsertItem(nItemId, aLabel, aImage);
-SetHelpText(nItemId, aTooltip);
-}
-else
-InsertItem(nItemId, OUString());
-
-SetItemCommand(nItemId, rCommand);
-}
-
-
 void Menu::InsertSeparator(const OString &rIdent, sal_uInt16 nPos)
 {
 // do nothing if it's a menu bar


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

2021-12-11 Thread Andreas Heinisch (via logerrit)
 include/vcl/textview.hxx |1 +
 vcl/source/edit/textview.cxx |   17 -
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 809236ed826b67328409e008313dea87de6d5243
Author: Andreas Heinisch 
AuthorDate: Wed Dec 8 16:09:23 2021 +0100
Commit: Andreas Heinisch 
CommitDate: Sat Dec 11 16:57:57 2021 +0100

tdf#145764 - BASIC IDE Home Key: move cursor to the beginning/first 
character

Pressing the Home Key moves the cursor to the first character in the
line, whereas pressing it at line start moves it to the first character
in that line.

Change-Id: I8eabb6d01b1a4de0d24bf064f82c83342ca91396
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126548
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/include/vcl/textview.hxx b/include/vcl/textview.hxx
index 0983fa8eb660..29bc302d4d43 100644
--- a/include/vcl/textview.hxx
+++ b/include/vcl/textview.hxx
@@ -196,6 +196,7 @@ public:
 TextPaM CursorDown( const TextPaM& rPaM );
 TextPaM CursorLeft( const TextPaM& rPaM, sal_uInt16 
nCharacterIteratorMode );
 TextPaM CursorRight( const TextPaM& rPaM, sal_uInt16 
nCharacterIteratorMode );
+TextPaM CursorFirstWord( const TextPaM& rPaM );
 TextPaM CursorWordLeft( const TextPaM& rPaM );
 TextPaM CursorWordRight( const TextPaM& rPaM );
 TextPaM CursorStartOfLine( const TextPaM& rPaM );
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 3c94e6fa6e1e..b295b78af8b0 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -1016,7 +1016,11 @@ TextSelection const & TextView::ImpMoveCursor( const 
KeyEvent& rKeyEvent )
 break;
 case KEY_DOWN:  aPaM = CursorDown( aPaM );
 break;
-case KEY_HOME:  aPaM = bCtrl ? CursorStartOfDoc() : 
CursorStartOfLine( aPaM );
+case KEY_HOME:
+// tdf#145764 - move cursor to the beginning or first character in 
the same line
+aPaM = bCtrl  ? CursorStartOfDoc()
+   : aPaM.GetIndex() == 0 ? CursorFirstWord( aPaM )
+  : CursorStartOfLine( aPaM );
 break;
 case KEY_END:   aPaM = bCtrl ? CursorEndOfDoc() : CursorEndOfLine( 
aPaM );
 break;
@@ -1156,6 +1160,17 @@ TextPaM TextView::CursorRight( const TextPaM& rPaM, 
sal_uInt16 nCharacterIterato
 return aPaM;
 }
 
+TextPaM TextView::CursorFirstWord( const TextPaM& rPaM )
+{
+TextPaM aPaM(rPaM);
+TextNode* pNode = 
mpImpl->mpTextEngine->mpDoc->GetNodes()[aPaM.GetPara()].get();
+
+css::uno::Reference xBI = 
mpImpl->mpTextEngine->GetBreakIterator();
+aPaM.GetIndex() = xBI->nextWord(pNode->GetText(), 0, 
mpImpl->mpTextEngine->GetLocale(), 
css::i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos;
+
+return aPaM;
+}
+
 TextPaM TextView::CursorWordLeft( const TextPaM& rPaM )
 {
 TextPaM aPaM( rPaM );


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

2021-11-28 Thread Caolán McNamara (via logerrit)
 include/vcl/menu.hxx|   15 ---
 include/vcl/menubarupdateicon.hxx   |7 ---
 vcl/source/window/bubblewindow.cxx  |4 ++--
 vcl/source/window/menu.cxx  |4 ++--
 vcl/source/window/menubarwindow.cxx |   10 +-
 vcl/source/window/menubarwindow.hxx |8 
 6 files changed, 25 insertions(+), 23 deletions(-)

New commits:
commit b98ff21fa7132a3eb606a6441f5ebd0162453baa
Author: Caolán McNamara 
AuthorDate: Sat Nov 27 20:51:10 2021 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 28 11:14:09 2021 +0100

don't need to include vcl/menu.hxx from vcl/menubarupdateicon.hxx

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

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 7834fe22519e..b0d7245cf72c 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -399,6 +399,12 @@ public:
 const OUString& get_id() const { return maID; }
 };
 
+struct MenuBarButtonCallbackArg
+{
+sal_uInt16 nId;// Id of the button
+bool bHighlight;   // highlight on/off
+};
+
 class VCL_DLLPUBLIC MenuBar final : public Menu
 {
 Link maCloseHdl;
@@ -456,19 +462,14 @@ public:
 void SetDisplayable( bool bDisplayable );
 bool IsDisplayable() const   { return mbDisplayable; }
 
-struct MenuBarButtonCallbackArg
-{
-sal_uInt16 nId;// Id of the button
-bool bHighlight;   // highlight on/off
-};
 // add an arbitrary button to the menubar (will appear next to closer)
 // passed link will be call with a MenuBarButtonCallbackArg on press
 // passed string will be set as tooltip
-sal_uInt16 AddMenuBarButton( const Image&, const 
Link&, const OUString& );
+sal_uInt16 AddMenuBarButton( const Image&, const 
Link&, const OUString& );
 // set the highlight link for additional button with ID nId
 // highlight link will be called with a MenuBarButtonHighlightArg
 // the bHighlight member of that struct shall contain the new state
-void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const 
Link& );
+void SetMenuBarButtonHighlightHdl( sal_uInt16 nId, const 
Link& );
 // returns the rectangle occupied by the additional button named nId
 // coordinates are relative to the systemwindow the menubar is attached to
 // if the menubar is unattached an empty rectangle is returned
diff --git a/include/vcl/menubarupdateicon.hxx 
b/include/vcl/menubarupdateicon.hxx
index 9cb3b397dfa1..f9b2932aa55c 100644
--- a/include/vcl/menubarupdateicon.hxx
+++ b/include/vcl/menubarupdateicon.hxx
@@ -22,12 +22,13 @@
 #include 
 #include 
 #include 
-#include 
 
 class BubbleWindow;
+class MenuBar;
 class SystemWindow;
 class VclSimpleEvent;
 class VclWindowEvent;
+struct MenuBarButtonCallbackArg;
 
 class VCL_DLLPUBLIC MenuBarUpdateIconManager
 {
@@ -57,8 +58,8 @@ private:
 DECL_DLLPRIVATE_LINK(WindowEventHdl, VclWindowEvent&, void);
 DECL_DLLPRIVATE_LINK(ApplicationEventHdl, VclSimpleEvent&, void);
 DECL_DLLPRIVATE_LINK(WaitTimeOutHdl, Timer*, void);
-DECL_DLLPRIVATE_LINK(ClickHdl, MenuBar::MenuBarButtonCallbackArg&, bool);
-DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBar::MenuBarButtonCallbackArg&, 
bool);
+DECL_DLLPRIVATE_LINK(ClickHdl, MenuBarButtonCallbackArg&, bool);
+DECL_DLLPRIVATE_LINK(HighlightHdl, MenuBarButtonCallbackArg&, bool);
 
 VclPtr GetBubbleWindow();
 void SetBubbleChanged();
diff --git a/vcl/source/window/bubblewindow.cxx 
b/vcl/source/window/bubblewindow.cxx
index 76fcf308d7a6..1a4a46a3fea2 100644
--- a/vcl/source/window/bubblewindow.cxx
+++ b/vcl/source/window/bubblewindow.cxx
@@ -365,7 +365,7 @@ IMPL_LINK_NOARG(MenuBarUpdateIconManager, UserEventHdl, 
void*, void)
 AddMenuBarIcon( pActiveSysWin, true );
 }
 
-IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, 
MenuBar::MenuBarButtonCallbackArg&, bool)
+IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, MenuBarButtonCallbackArg&, 
bool)
 {
 maWaitIdle.Stop();
 if ( mpBubbleWin )
@@ -376,7 +376,7 @@ IMPL_LINK_NOARG(MenuBarUpdateIconManager, ClickHdl, 
MenuBar::MenuBarButtonCallba
 return false;
 }
 
-IMPL_LINK(MenuBarUpdateIconManager, HighlightHdl, 
MenuBar::MenuBarButtonCallbackArg&, rData, bool)
+IMPL_LINK(MenuBarUpdateIconManager, HighlightHdl, MenuBarButtonCallbackArg&, 
rData, bool)
 {
 if ( rData.bHighlight )
 maWaitIdle.Start();
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 96797979558c..591a429108b0 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2635,13 +2635,13 @@ bool Menu::HandleMenuCommandEvent( Menu *pMenu, 
sal_uInt16 nCommandEventId ) con
 return false;
 }
 
-sal_uInt16 MenuBar::AddMenuBarButton( const Image& i_rImage, const 
Link& i_rLink, const OUString& 
i_rToolTip )
+sal_uInt16 MenuBar::AddMenuBarButton( const Ima

[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 ( !nStepCou

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

2021-11-09 Thread Tor Lillqvist (via logerrit)
 include/vcl/print.hxx|3 +++
 vcl/source/gdi/print.cxx |5 +
 2 files changed, 8 insertions(+)

New commits:
commit 1134aad621a96a23af88aaa50e10e328ea58a502
Author: Tor Lillqvist 
AuthorDate: Tue Nov 9 13:16:29 2021 +0200
Commit: Tor Lillqvist 
CommitDate: Tue Nov 9 13:44:24 2021 +0100

Add Printer::GetSizeOfPaper() with semantics to match GetPaper()

Will be used in follow-up commits.

Change-Id: I18b167a217a4f82d8b6605e2ba14f1ddc6e98324
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124910
Reviewed-by: Tor Lillqvist 
Tested-by: Tor Lillqvist 

diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index f67145335357..83f4170c241c 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -230,7 +230,10 @@ public:
 sal_uInt16  GetPaperBin() const;
 voidSetPaper( Paper ePaper );
 boolSetPaperSizeUser( const Size& rSize );
+/** @return The paper format of the printer's current "jobsetup". Note 
that if PAPER_USER the actual size can be anything. */
 Paper   GetPaper() const;
+/** @return Size of the paper of the printer's current "jobsetup". */
+SizeGetSizeOfPaper() const;
 static OUString GetPaperName( Paper ePaper );
 
 /** @return Number of available paper formats */
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 88143e27ce29..0d6cf081ce41 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1471,6 +1471,11 @@ Paper Printer::GetPaper() const
 return maJobSetup.ImplGetConstData().GetPaperFormat();
 }
 
+Size Printer::GetSizeOfPaper() const
+{
+return Size(maJobSetup.ImplGetConstData().GetPaperWidth(), 
maJobSetup.ImplGetConstData().GetPaperHeight());
+}
+
 sal_uInt16 Printer::GetPaperBinCount() const
 {
 if ( IsDisplayPrinter() )


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

2021-10-31 Thread Noel Grandin (via logerrit)
 include/vcl/outdev.hxx   |8 
 vcl/source/outdev/bitmap.cxx |   36 ++--
 2 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit c7a4aed8d908fda1465c4b39003e910770c62cae
Author: Noel Grandin 
AuthorDate: Sat Oct 30 18:54:56 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Oct 31 09:03:10 2021 +0100

tools::Long->sal_Int32 in OutputDevice::Blend*

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 151ab8236c6c..e9b8d3540cd1 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1436,8 +1436,8 @@ private:
 const Size& aOutSz,
 const bool  bHMirr,
 const bool  bVMirr,
-const tools::Long* pMapX,
-const tools::Long* pMapY );
+const sal_Int32* pMapX,
+const sal_Int32* pMapY );
 
 SAL_DLLPRIVATE Bitmap   BlendBitmapWithAlpha(
 Bitmap& aBmp,
@@ -1448,8 +1448,8 @@ private:
 const sal_Int32 nDstHeight,
 const sal_Int32 nOffX,
 const sal_Int32 nDstWidth,
-const tools::Long* pMapX,
-const tools::Long* pMapY );
+const sal_Int32* pMapX,
+const sal_Int32* pMapY );
 
 ///@}
 
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 09e6091de8d6..53a9f774b71d 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -375,19 +375,19 @@ namespace
 
 struct LinearScaleContext
 {
-std::unique_ptr mpMapX;
-std::unique_ptr mpMapY;
+std::unique_ptr mpMapX;
+std::unique_ptr mpMapY;
 
-std::unique_ptr mpMapXOffset;
-std::unique_ptr mpMapYOffset;
+std::unique_ptr mpMapXOffset;
+std::unique_ptr mpMapYOffset;
 
 LinearScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle 
const & aBitmapRect,
  Size const & aOutSize, tools::Long nOffX, tools::Long nOffY)
 
-: mpMapX(new tools::Long[aDstRect.GetWidth()])
-, mpMapY(new tools::Long[aDstRect.GetHeight()])
-, mpMapXOffset(new tools::Long[aDstRect.GetWidth()])
-, mpMapYOffset(new tools::Long[aDstRect.GetHeight()])
+: mpMapX(new sal_Int32[aDstRect.GetWidth()])
+, mpMapY(new sal_Int32[aDstRect.GetHeight()])
+, mpMapXOffset(new sal_Int32[aDstRect.GetWidth()])
+, mpMapYOffset(new sal_Int32[aDstRect.GetHeight()])
 {
 const tools::Long nSrcWidth = aBitmapRect.GetWidth();
 const tools::Long nSrcHeight = aBitmapRect.GetHeight();
@@ -404,7 +404,7 @@ struct LinearScaleContext
 private:
 
 static void generateSimpleMap(tools::Long nSrcDimension, tools::Long 
nDstDimension, tools::Long nDstLocation,
-  tools::Long nOutDimension, tools::Long 
nOffset, tools::Long* pMap, tools::Long* pMapOffset)
+  tools::Long nOutDimension, tools::Long 
nOffset, sal_Int32* pMap, sal_Int32* pMapOffset)
 {
 
 const double fReverseScale = (std::abs(nOutDimension) > 1) ? 
(nSrcDimension - 1) / double(std::abs(nOutDimension) - 1) : 0.0;
@@ -542,14 +542,14 @@ public:
 
 struct TradScaleContext
 {
-std::unique_ptr mpMapX;
-std::unique_ptr mpMapY;
+std::unique_ptr mpMapX;
+std::unique_ptr mpMapY;
 
 TradScaleContext(tools::Rectangle const & aDstRect, tools::Rectangle const 
& aBitmapRect,
  Size const & aOutSize, tools::Long nOffX, tools::Long nOffY)
 
-: mpMapX(new tools::Long[aDstRect.GetWidth()])
-, mpMapY(new tools::Long[aDstRect.GetHeight()])
+: mpMapX(new sal_Int32[aDstRect.GetWidth()])
+, mpMapY(new sal_Int32[aDstRect.GetHeight()])
 {
 const tools::Long nSrcWidth = aBitmapRect.GetWidth();
 const tools::Long nSrcHeight = aBitmapRect.GetHeight();
@@ -569,7 +569,7 @@ struct TradScaleContext
 private:
 
 static void generateSimpleMap(tools::Long nSrcDimension, tools::Long 
nDstDimension, tools::Long nDstLocation,
-  tools::Long nOutDimension, tools::Long 
nOffset, bool bMirror, tools::Long* pMap)
+  tools::Long nOutDimension, tools::Long 
nOffset, bool bMirror, sal_Int32* pMap)
 {
 tools::Long nMirrorOffset = 0;
 
@@ -786,8 +786,8 @@ Bitmap OutputDevice::BlendBit

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

2021-10-31 Thread Noel Grandin (via logerrit)
 include/vcl/toolbox.hxx   |2 +-
 vcl/source/window/toolbox.cxx |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit d57617b79db35b1005007a16b84f17e699d59022
Author: Noel Grandin 
AuthorDate: Sat Oct 30 18:53:16 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Oct 31 09:02:54 2021 +0100

tools::Long->sal_Int32 in Toolbox

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

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index cdbc032ea509..fe15d3b978f7 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -185,7 +185,7 @@ private:
 SAL_DLLPRIVATE voidImplInitSettings( bool bFont, bool 
bForeground, bool bBackground );
 SAL_DLLPRIVATE ImplToolItem*   ImplGetItem( ToolBoxItemId nId ) const;
 SAL_DLLPRIVATE boolImplCalcItem();
-SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long 
nWidth, tools::Long* pMaxLineWidth, bool bCalcHorz ) const;
+SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long 
nWidth, sal_Int32* pMaxLineWidth, bool bCalcHorz ) const;
 SAL_DLLPRIVATE voidImplFormat( bool bResize = false );
 SAL_DLLPRIVATE voidImplDrawSpin(vcl::RenderContext& 
rRenderContext);
 SAL_DLLPRIVATE voidImplDrawSeparator(vcl::RenderContext& 
rRenderContext, ImplToolItems::size_type nPos, const tools::Rectangle& rRect);
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 37f9595561cd..e41c1288fbeb 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -638,7 +638,7 @@ const ImplToolItem *ToolBox::ImplGetFirstClippedItem() const
 
 Size ToolBox::ImplCalcSize( ImplToolItems::size_type nCalcLines, sal_uInt16 
nCalcMode )
 {
-tools::LongnMax;
+sal_Int32nMax;
 tools::LongnLeft = 0;
 tools::LongnTop = 0;
 tools::LongnRight = 0;
@@ -784,7 +784,7 @@ void ToolBox::ImplCalcFloatSizes()
 ImplToolItems::size_type nLines;
 ImplToolItems::size_type nCalcLines;
 ImplToolItems::size_type nTempLines;
-tools::LongnMaxLineWidth;
+sal_Int32nMaxLineWidth;
 nCalcLines = ImplCalcBreaks( nCalcSize, &nMaxLineWidth, true );
 
 maFloatSizes.reserve( nCalcLines );
@@ -1658,7 +1658,7 @@ bool ToolBox::ImplCalcItem()
 return false;
 }
 
-ToolBox::ImplToolItems::size_type ToolBox::ImplCalcBreaks( tools::Long nWidth, 
tools::Long* pMaxLineWidth, bool bCalcHorz ) const
+ToolBox::ImplToolItems::size_type ToolBox::ImplCalcBreaks( tools::Long nWidth, 
sal_Int32* pMaxLineWidth, bool bCalcHorz ) const
 {
 sal_uLong   nLineStart = 0;
 sal_uLong   nGroupStart = 0;
@@ -1831,7 +1831,7 @@ Size ToolBox::ImplGetOptimalFloatingSize()
 int nBorderX = 2*TB_BORDER_OFFSET1 + mnLeftBorder + mnRightBorder;
 int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder;
 Size aSz( aCurrentSize );
-tools::Long maxX;
+sal_Int32 maxX;
 ImplToolItems::size_type nLines = ImplCalcBreaks( aSz.Width()-nBorderX, 
&maxX, mbHorz );
 
 ImplToolItems::size_type manyLines = 1000;


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

2021-10-27 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx|1 -
 vcl/source/outdev/transparent.cxx |   20 +---
 2 files changed, 1 insertion(+), 20 deletions(-)

New commits:
commit 3529f28c679b117bf914e56a95a6e4d16cfbae4e
Author: Caolán McNamara 
AuthorDate: Wed Oct 27 10:07:31 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Oct 27 16:44:40 2021 +0200

ignoring transparency for border doesn't seem to make sense

If we are filling *and* drawing border then we do the border
transparently, but if we're not filling we draw the border
without transparency? I can't see that this is intentional.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index eb3f6acf7096..ed9e38f9fdbd 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1491,7 +1491,6 @@ public:
 protected:
 
 virtual voidEmulateDrawTransparent( const 
tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
-voidDrawInvisiblePolygon( const 
tools::PolyPolygon& rPolyPoly );
 
 virtual voidClipAndDrawGradientMetafile ( const Gradient 
&rGradient, const tools::PolyPolygon &rPolyPoly );
 
diff --git a/vcl/source/outdev/transparent.cxx 
b/vcl/source/outdev/transparent.cxx
index fd0410f0e9e6..cf1bb63d1931 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -191,21 +191,6 @@ void OutputDevice::DrawTransparent(
 static_cast(fTransparency * 100.0));
 }
 
-void OutputDevice::DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly )
-{
-assert(!is_double_buffered_window());
-
-// short circuit if the polygon border is invisible too
-if( !mbLineColor )
-return;
-
-// we assume that the border is NOT to be drawn transparently???
-Push( vcl::PushFlags::FILLCOLOR );
-SetFillColor();
-DrawPolyPolygon( rPolyPoly );
-Pop();
-}
-
 bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& 
rPolyPoly,
  sal_uInt16 nTransparencePercent )
 {
@@ -538,11 +523,8 @@ void OutputDevice::DrawTransparent( const 
tools::PolyPolygon& rPolyPoly,
 }
 
 // short circuit for drawing an invisible polygon
-if( !mbFillColor || (nTransparencePercent >= 100) )
-{
-DrawInvisiblePolygon( rPolyPoly );
+if( (!mbFillColor && !mbLineColor) || (nTransparencePercent >= 100) )
 return; // tdf#84294: do not record it in metafile
-}
 
 // handle metafile recording
 if( mpMetaFile )


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

2021-10-26 Thread Noel Grandin (via logerrit)
 include/vcl/outdev.hxx|2 +-
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 vcl/source/outdev/text.cxx|   13 ++---
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 95cc31f15712bcd2b9829a4f9708374647af6e74
Author: Noel Grandin 
AuthorDate: Tue Oct 26 13:59:26 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 26 18:16:02 2021 +0200

tdf#144513 improve perf when breaking long lines

use the clip rectangle to stop early when the text exceeds the height
of the cell

Change-Id: I63dadc5b63c1f6c0852e0ba86a58f18c2b207cca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124221
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ce988ab60719..eb3f6acf7096 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1082,7 +1082,7 @@ protected:
 SAL_DLLPRIVATE void ImplInitTextLineSize();
 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
 static
-SAL_DLLPRIVATE tools::Long  ImplGetTextLines( ImplMultiTextLineInfo& 
rLineInfo, tools::Long nWidth, const OUString& rStr, DrawTextFlags nStyle, 
const vcl::ITextLayout& _rLayout );
+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,
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 45e2a844da18..a342cba1854d 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6571,7 +6571,7 @@ void PDFWriterImpl::drawText( const tools::Rectangle& 
rRect, const OUString& rOr
 {
 vcl::DefaultTextLayout aLayout( *this );
 OUString   aLastLine;
-OutputDevice::ImplGetTextLines( aMultiLineInfo, nWidth, aStr, 
nStyle, aLayout );
+OutputDevice::ImplGetTextLines( rRect, nTextHeight, 
aMultiLineInfo, nWidth, aStr, nStyle, aLayout );
 sal_Int32  nLines = nHeight/nTextHeight;
 nFormatLines = aMultiLineInfo.Count();
 if ( !nLines )
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 58e0b0e6a8b9..ed3eefba56e2 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -478,7 +478,8 @@ void OutputDevice::ImplDrawText( SalLayout& rSalLayout )
 ImplDrawTextDirect( rSalLayout, mbTextLines );
 }
 
-tools::Long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
+tools::Long OutputDevice::ImplGetTextLines( const tools::Rectangle& rRect, 
const tools::Long nTextHeight,
+ ImplMultiTextLineInfo& rLineInfo,
  tools::Long nWidth, const OUString& rStr,
  DrawTextFlags nStyle, const 
vcl::ITextLayout& _rLayout )
 {
@@ -491,6 +492,8 @@ tools::Long OutputDevice::ImplGetTextLines( 
ImplMultiTextLineInfo& rLineInfo,
 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;
@@ -505,6 +508,7 @@ tools::Long OutputDevice::ImplGetTextLines( 
ImplMultiTextLineInfo& rLineInfo,
 css::uno::Reference xBI;
 sal_Int32 nPos = 0;
 sal_Int32 nLen = rStr.getLength();
+sal_Int32 nCurrentTextY = 0;
 while ( nPos < nLen )
 {
 sal_Int32 nBreakPos = nPos;
@@ -541,6 +545,9 @@ tools::Long OutputDevice::ImplGetTextLines( 
ImplMultiTextLineInfo& rLineInfo,
 if ( ( nPos < nLen ) && ( rStr[ nPos ] == '\n' ) && ( rStr[ nPos-1 
] == '\r' ) )
 nPos++;
 }
+nCurrentTextY += nTextHeight;
+if (bClipping && nCurrentTextY > rRect.GetHeight())
+break;
 }
 
 #ifdef DBG_UTIL
@@ -1528,7 +1535,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 
 if ( nTextHeight )
 {
-tools::Long nMaxTextWidth = ImplGetTextLines( aMultiLineInfo, 
nWidth, aStr, nStyle, _rLayout );
+tools::Long nMaxTextWidth = ImplGetTextLines( rRect, nTextHeight, 
aMultiLineInfo, nWidth, aStr, nStyle, _rLayout );
 sal_Int32 nLines = static_cast(nHeight/nTextHeight);
 OUString aLastLine;
 nFormatLines = aMultiLineInfo.Count();
@@ -1814,7 +1821,7 @@ tools::Rectangle OutputDevice::GetTextRect( const 
tools

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

2021-10-26 Thread Noel Grandin (via logerrit)
 include/vcl/outdev.hxx |   17 ++
 vcl/source/outdev/text.cxx |  358 +++--
 2 files changed, 202 insertions(+), 173 deletions(-)

New commits:
commit 4fc1b3fb659be916167518b49ffe8193e9033f30
Author: Noel Grandin 
AuthorDate: Tue Oct 26 09:15:17 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 26 10:31:44 2021 +0200

flatten ImplGetTextLines

Change-Id: Iefbbcb186b2811748abf49546351a2c68e8af462
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124155
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 6f85e0d51fef..ce988ab60719 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -130,6 +130,12 @@ namespace com::sun::star::rendering {
 class XCanvas;
 class XSpriteCanvas;
 }
+namespace com::sun::star::linguistic2 {
+class XHyphenator;
+}
+namespace com::sun::star::i18n {
+class XBreakIterator;
+}
 
 #if defined UNX
 #define GLYPH_FONT_HEIGHT   128
@@ -1076,7 +1082,16 @@ protected:
 SAL_DLLPRIVATE void ImplInitTextLineSize();
 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
 static
-SAL_DLLPRIVATE tools::Long ImplGetTextLines( 
ImplMultiTextLineInfo& rLineInfo, tools::Long nWidth, const OUString& rStr, 
DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
+SAL_DLLPRIVATE tools::Long  ImplGetTextLines( 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;
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 0b37b8fc743f..58e0b0e6a8b9 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -487,191 +487,62 @@ tools::Long OutputDevice::ImplGetTextLines( 
ImplMultiTextLineInfo& rLineInfo,
 if ( nWidth <= 0 )
 nWidth = 1;
 
-tools::Long nMaxLineWidth  = 0;
 rLineInfo.Clear();
-if (!rStr.isEmpty())
-{
-const bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) 
== DrawTextFlags::WordBreakHyphenation;
-css::uno::Reference< css::linguistic2::XHyphenator > xHyph;
-if (bHyphenate)
-{
-// get service provider
-css::uno::Reference 
xContext(comphelper::getProcessComponentContext());
-css::uno::Reference 
xLinguMgr = css::linguistic2::LinguServiceManager::create(xContext);
-xHyph = xLinguMgr->getHyphenator();
-}
-
-css::uno::Reference xBI;
-sal_Int32 nPos = 0;
-sal_Int32 nLen = rStr.getLength();
-while ( nPos < nLen )
-{
-sal_Int32 nBreakPos = nPos;
-
-while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != '\r' ) && ( 
rStr[ nBreakPos ] != '\n' ) )
-nBreakPos++;
-
-tools::Long nLineWidth = _rLayout.GetTextWidth( rStr, nPos, 
nBreakPos-nPos );
-if ( ( nLineWidth > nWidth ) && ( nStyle & 
DrawTextFlags::WordBreak ) )
-{
-if ( !xBI.is() )
-xBI = vcl::unohelper::CreateBreakIterator();
+if (rStr.isEmpty())
+return 0;
 
-if ( xBI.is() )
-{
-const css::lang::Locale& 
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
-sal_Int32 nSoftBreak = _rLayout.GetTextBreak( rStr, 
nWidth, nPos, nBreakPos - nPos );
-if (nSoftBreak == -1)
-{
-nSoftBreak = nPos;
-}
-SAL_WARN_IF( nSoftBreak >= nBreakPos, "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 )
-nBreakPos = nSoftBreak;
- 

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

2021-09-30 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |   59 +
 vcl/source/outdev/bitmap.cxx   |8 +
 vcl/source/outdev/bitmapex.cxx |   18 
 vcl/source/outdev/mask.cxx |   10 ++
 4 files changed, 56 insertions(+), 39 deletions(-)

New commits:
commit 52a07baebf7d1bfeda7a74dd0eac22b9e349fb56
Author: Chris Sherlock 
AuthorDate: Sun Sep 26 12:07:51 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 30 10:01:19 2021 +0200

vcl: remove MetaActionType param from DrawBitmap/DrawBitmapEx/DrawMask

This is needed to allow for a clean abstract class DrawingInterface,
which I will introduce in a followup patch.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 87a69647d2ba..286a64b48bda 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1253,77 +1253,54 @@ public:
 ///@{
 
 public:
-
-/** @overload
-void DrawBitmap(
-const Point& rDestPt,
-const Size& rDestSize,
-const Point& rSrcPtPixel,
-const Size& rSecSizePixel,
-const Bitmap& rBitmap,
-MetaActionType nAction = MetaActionType::BMPSCALEPART)
-  */
 voidDrawBitmap(
 const Point& rDestPt,
 const Bitmap& rBitmap );
 
-/** @overload
-void DrawBitmap(
-const Point& rDestPt,
-const Size& rDestSize,
-const Point& rSrcPtPixel,
-const Size& rSecSizePixel,
-const Bitmap& rBitmap,
-MetaActionType nAction = MetaActionType::BMPSCALEPART)
-  */
 voidDrawBitmap(
 const Point& rDestPt,
 const Size& rDestSize,
 const Bitmap& rBitmap );
 
+voidDrawBitmap(
+const Point& rDestPt,
+const Size& rDestSize,
+const Point& rSrcPtPixel,
+const Size& rSrcSizePixel,
+const Bitmap& rBitmap);
+
 voidDrawBitmap(
 const Point& rDestPt,
 const Size& rDestSize,
 const Point& rSrcPtPixel,
 const Size& rSrcSizePixel,
 const Bitmap& rBitmap,
-MetaActionType nAction = 
MetaActionType::BMPSCALEPART );
+MetaActionType nAction );
 
-/** @overload
-void DrawBitmapEx(
-const Point& rDestPt,
-const Size& rDestSize,
-const Point& rSrcPtPixel,
-const Size& rSecSizePixel,
-const BitmapEx& rBitmapEx,
-MetaActionType nAction = MetaActionType::BMPEXSCALEPART)
- */
 voidDrawBitmapEx(
 const Point& rDestPt,
 const BitmapEx& rBitmapEx );
 
 
-/** @overload
-void DrawBitmapEx(
-const Point& rDestPt,
-const Size& rDestSize,
-const Point& rSrcPtPixel,
-const Size& rSecSizePixel,
-const BitmapEx& rBitmapEx,
-MetaActionType nAction = MetaActionType::BMPEXSCALEPART)
- */
 voidDrawBitmapEx(
 const Point& rDestPt,
 const Size& rDestSize,
 const BitmapEx& rBitmapEx );
 
+voidDrawBitmapEx(
+const Point& rDestPt,
+const Size& rDestSize,
+const Point& rSrcPtPixel,
+const Size& rSrcSizePixel,
+const BitmapEx& rBitmapEx);
+
 voidDrawBitmapEx(
 const Point& rDestPt,
 const Size& rDestSize,
 const Point& rSrcPtPixel,
 const Size& rSrcSizePixel,
 const BitmapEx& rBitmapEx,
-MetaActionType nAction = 
MetaActionType::BMPEXSCALEPART );
+MetaActionType nAction );
 
 /** @overload

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

2021-09-10 Thread Caolán McNamara (via logerrit)
 include/vcl/BitmapInfoAccess.hxx   |   27 ++-
 vcl/source/bitmap/BitmapInfoAccess.cxx |4 +++-
 2 files changed, 21 insertions(+), 10 deletions(-)

New commits:
commit 7d4142269e2deb756f03774a9d6d2861fe9eba04
Author: Caolán McNamara 
AuthorDate: Fri Sep 10 16:12:02 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 10 19:01:33 2021 +0200

crashtesting: threaded scaling crash on re-export of ooo24840-1.sxw to odt

 #13 0x7f1cb843752a in o3tl::cow_wrapper::operator->() (this=0x5596086d5968) at 
include/o3tl/cow_wrapper.hxx:329
 __PRETTY_FUNCTION__ = "BitmapColor& 
BitmapPalette::operator[](sal_uInt16)"
 #14 0x7f1cb843752a in BitmapPalette::operator[](unsigned short) 
(this=0x5596086d5968, nIndex=nIndex@entry=0) at 
vcl/source/bitmap/bitmappalette.cxx:139
 __PRETTY_FUNCTION__ = "BitmapColor& 
BitmapPalette::operator[](sal_uInt16)"
 #15 0x7f1cb849f5f5 in BitmapInfoAccess::GetPaletteColor(unsigned 
short) const (nColor=0, this=0x5596085989f0) at 
include/vcl/BitmapInfoAccess.hxx:114
 __PRETTY_FUNCTION__ = "const BitmapColor& 
BitmapInfoAccess::GetPaletteColor(sal_uInt16) const"

the mpBuffer member of BitmapInfoAccess is

BitmapBuffer* mpBuffer;

not

const BitmapBuffer* mpBuffer;

so mpBuffer->maPalette.foo() calls non-const variants of foo(),
(BitmapPalette::operator[](unsigned short) in this case), which
is presumably non the expected outcome, as the copy-on-write mpImpl of
BitmapPalette unsafely creates a new copy its internals on the first
dereference of mpImpl in a non-const method.

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

diff --git a/include/vcl/BitmapInfoAccess.hxx b/include/vcl/BitmapInfoAccess.hxx
index 4c20e72e9c67..a6bca5627aa2 100644
--- a/include/vcl/BitmapInfoAccess.hxx
+++ b/include/vcl/BitmapInfoAccess.hxx
@@ -87,40 +87,49 @@ public:
 
 bool HasPalette() const
 {
-assert(mpBuffer && "Access is not valid!");
+const BitmapBuffer* pBuffer = mpBuffer;
+
+assert(pBuffer && "Access is not valid!");
 
-return mpBuffer && !!mpBuffer->maPalette;
+return pBuffer && !!pBuffer->maPalette;
 }
 
 const BitmapPalette& GetPalette() const
 {
-assert(mpBuffer && "Access is not valid!");
+const BitmapBuffer* pBuffer = mpBuffer;
+
+assert(pBuffer && "Access is not valid!");
 
-return mpBuffer->maPalette;
+return pBuffer->maPalette;
 }
 
 sal_uInt16 GetPaletteEntryCount() const
 {
+const BitmapBuffer* pBuffer = mpBuffer;
+
 assert(HasPalette() && "Bitmap has no palette!");
 
-return HasPalette() ? mpBuffer->maPalette.GetEntryCount() : 0;
+return HasPalette() ? pBuffer->maPalette.GetEntryCount() : 0;
 }
 
 const BitmapColor& GetPaletteColor(sal_uInt16 nColor) const
 {
-assert(mpBuffer && "Access is not valid!");
+const BitmapBuffer* pBuffer = mpBuffer;
+assert(pBuffer && "Access is not valid!");
 assert(HasPalette() && "Bitmap has no palette!");
 
-return mpBuffer->maPalette[nColor];
+return pBuffer->maPalette[nColor];
 }
 
 sal_uInt16 GetBestPaletteIndex(const BitmapColor& rBitmapColor) const;
 
 const ColorMask& GetColorMask() const
 {
-assert(mpBuffer && "Access is not valid!");
+const BitmapBuffer* pBuffer = mpBuffer;
+
+assert(pBuffer && "Access is not valid!");
 
-return mpBuffer->maColorMask;
+return pBuffer->maColorMask;
 }
 
 private:
diff --git a/vcl/source/bitmap/BitmapInfoAccess.cxx 
b/vcl/source/bitmap/BitmapInfoAccess.cxx
index 595d5cbbbcc5..50607e94dde3 100644
--- a/vcl/source/bitmap/BitmapInfoAccess.cxx
+++ b/vcl/source/bitmap/BitmapInfoAccess.cxx
@@ -72,7 +72,9 @@ BitmapInfoAccess::~BitmapInfoAccess()
 
 sal_uInt16 BitmapInfoAccess::GetBestPaletteIndex(const BitmapColor& 
rBitmapColor) const
 {
-return (HasPalette() ? mpBuffer->maPalette.GetBestIndex(rBitmapColor) : 0);
+const BitmapBuffer* pBuffer = mpBuffer;
+
+return (HasPalette() ? pBuffer->maPalette.GetBestIndex(rBitmapColor) : 0);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2021-09-09 Thread Caolán McNamara (via logerrit)
 include/vcl/outdev.hxx |8 
 vcl/source/outdev/map.cxx  |   41 +
 vcl/source/outdev/polyline.cxx |9 +
 3 files changed, 54 insertions(+), 4 deletions(-)

New commits:
commit e5ced8a0e875226152ceae2ad84bac0292e20c4f
Author: Caolán McNamara 
AuthorDate: Thu Sep 9 20:02:55 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Sep 9 22:21:33 2021 +0200

crashtesting: assert making thumbnail on reexport of tdf127770-1.ods to ods

convert to B2DPolygon earlier and do scaling on B2DPolygon's doubles

 #18 0x7f534e1093bc in ImplLogicToPixel(tools::Long, tools::Long, 
tools::Long, tools::Long) (n=, nDPI=, 
nMapNum=, nMapDenom=) at 
vcl/source/outdev/map.cxx:268
 __PRETTY_FUNCTION__ = "tools::Long ImplLogicToPixel(tools::Long, 
tools::Long, tools::Long, tools::Long)"
 n64 = 
 #19 0x7f534e10a4ff in 
OutputDevice::ImplLogicToDevicePixel(tools::Polygon const&) const 
(this=this@entry=0x55c3ebbb9f60, rLogicPoly=...) at include/tools/gen.hxx:80
 rPt = Point = {x = -794275722273860480, y = 0}
 i = 0
 nPoints = 2
 aPoly = {mpImplPolygon = {m_pimpl = 0x55c3e9fdc250}}
 pPointAry = 0x55c3e9c9b970
 #20 0x7f534e0ff4d4 in OutputDevice::drawPolyLine(tools::Polygon 
const&, LineInfo const&) (this=this@entry=0x55c3ebbb9f60, rPoly=..., 
rLineInfo=...) at vcl/source/outdev/polyline.cxx:251
 nPoints = 2
 aPoly = {mpImplPolygon = {m_pimpl = 0x7f534e0bfde8 
<__gnu_debug::_Safe_sequence > 
>::_M_invalidate_if<__gnu_debug::_Equal_to<__gnu_cxx::__normal_iterator > > > 
>(__gnu_debug::_Equal_to<__gnu_cxx::__normal_iterator > > >)+208>}}
 __PRETTY_FUNCTION__ = "void OutputDevice::drawPolyLine(const 
tools::Polygon&, const LineInfo&)"
 aInfo = {mpImplLineInfo = {m_pimpl = 0x55c3eaa4ca68}}
 bDashUsed = 
 bLineWidthUsed = 
 #21 0x7f534e0ff3d8 in OutputDevice::DrawPolyLine(tools::Polygon 
const&, LineInfo const&) (this=this@entry=0x55c3ebbb9f60, rPoly=..., 
rLineInfo=...) at vcl/source/outdev/polyline.cxx:135
 __PRETTY_FUNCTION__ = "void OutputDevice::DrawPolyLine(const 
tools::Polygon&, const LineInfo&)"
 #22 0x7f534e1f1d56 in MetaPolyLineAction::Execute(OutputDevice*) 
(this=0x55c3e998e300, pOut=0x55c3ebbb9f60) at vcl/source/gdi/metaact.cxx:481
 #23 0x7f534e1be27a in GDIMetaFile::Play(OutputDevice&, unsigned long) 
(this=this@entry=0x55c3e9e4c700, rOut=..., nPos=86, nPos@entry=4294967295) at 
vcl/source/gdi/gdimtf.cxx:371
 nCurPos = 48
 i = 48
 pAction = 0x55c3e998e300
 nObjCount = 
 nSyncCount = 4294967295
 #24 0x7f534e1be4e1 in GDIMetaFile::Play(OutputDevice&, Point const&, 
Size const&) (this=this@entry=0x55c3e9e4c700, rOut=..., rPos=Point = {...}, 
rSize=Size = {...}) at vcl/source/gdi/gdimtf.cxx:512
 aDrawMap = {mpImplMapMode = {m_pimpl = 0x55c3e9f338d0}}
 aDestSize = Size = {width = 756, height = 1020}
 pMtf = 0x0
 aScaleX = {mnNumerator = 756, mnDenominator = 341, mbValid = true}
 aScaleY = {mnNumerator = 1020, mnDenominator = 461, mbValid = true}
 rOldOffset = Size = {width = 0, height = 0}
 aEmptySize = Size = {width = 0, height = 0}
 bIsRecord = false
 #25 0x7f534e1be9c5 in GDIMetaFile::CreateThumbnail(BitmapEx&, 
BmpConversion, BmpScaleFlag) const (this=this@entry=0x55c3e9e4c700, 
rBitmapEx=..., 
eColorConversion=eColorConversion@entry=BmpConversion::N8BitColors, 
nScaleFlag=nScaleFlag@entry=BmpScaleFlag::Default) at include/rtl/ref.hxx:206
 aAntialias = Size = {width = 756, height = 1020}
 aBitmap = {maBitmap = , maAlphaMask = , maBitmapSize = Size = {width = 94299930324064, height = 139995769668141}}
 aVDev = {> = {> 
= {m_rInnerRef = rtl::Reference to 0x55c3ebbb9f60}, }, }
 aNullPt = Point = {x = 0, y = 0}
 aDrawSize = Size = {width = 189, height = 255}
 aSizePix = 
 nMaximumExtent = 256
 aAntialiasSize = Size = {width = 760, height = 1024}

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f5f398a1e0b9..a80b49c2239b 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1787,6 +1787,14 @@ public:
  */
 SAL_DLLPRIVATE tools::Polygon ImplLogicToDevicePixel( const 
tools::Polygon& rLogicPoly ) const;
 
+/** Convert a logical B2DPolygon to a B2DPolygon in physical device pixel 
units.
+
+ @param rLogicSize  Const reference to a B2DPolygon in logical 
units
+
+ @returns B2DPolyPolygon based on physical device pixel coordinate

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

2021-09-08 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|4 +++-
 vcl/source/outdev/bitmap.cxx  |6 ++
 vcl/source/outdev/transparent.cxx |4 +---
 3 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit f83d1b824c1abd07d24318adda6c876b9471ccec
Author: Chris Sherlock 
AuthorDate: Fri Sep 3 17:20:41 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Sep 8 10:10:12 2021 +0200

vcl: make GetDownsampledBitmap() take destination size in units of twips

This removes the need to use OutputDevice functions, which means we can
later move this function to bitmaptools.cxx

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 2995769bd060..fbebf0a1a3d8 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1415,11 +1415,13 @@ protected:
 double &fMaximumArea);
 
 /** Retrieve downsampled and cropped bitmap
+ 
+Takes destination size in twips units.
 
 @attention This method ignores negative rDstSz values, thus
 mirroring must happen outside this method (e.g. in DrawBitmap)
  */
-Bitmap  GetDownsampledBitmap(
+static Bitmap   GetDownsampledBitmap(
 const Size& rDstSz,
 const Point& rSrcPt,
 const Size& rSrcSz,
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index e86055d9df1e..5466340c2bfe 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -170,7 +170,7 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const 
Size& rDestSize,
 }
 }
 
-Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
+Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSizeTwip,
const Point& rSrcPt, const Size& 
rSrcSz,
const Bitmap& rBmp, tools::Long 
nMaxBmpDPIX, tools::Long nMaxBmpDPIY )
 {
@@ -193,10 +193,8 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& 
rDstSz,
 if( !aBmp.IsEmpty() )
 {
 // do downsampling if necessary
-Size aDstSizeTwip( PixelToLogic(LogicToPixel(rDstSz), 
MapMode(MapUnit::MapTwip)) );
-
 // #103209# Normalize size (mirroring has to happen outside of 
this method)
-aDstSizeTwip = Size( std::abs(aDstSizeTwip.Width()), 
std::abs(aDstSizeTwip.Height()) );
+Size aDstSizeTwip(std::abs(rDstSizeTwip.Width()), 
std::abs(rDstSizeTwip.Height()));
 
 const Size  aBmpSize( aBmp.GetSizePixel() );
 const doublefBmpPixelX = aBmpSize.Width();
diff --git a/vcl/source/outdev/transparent.cxx 
b/vcl/source/outdev/transparent.cxx
index 6a7921b43814..8cb2cf51632f 100644
--- a/vcl/source/outdev/transparent.cxx
+++ b/vcl/source/outdev/transparent.cxx
@@ -1836,11 +1836,9 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( 
const GDIMetaFile& rInMtf,
 
 // scale down bitmap, if requested
 if( bDownsampleBitmaps )
-{
-aBandBmp = GetDownsampledBitmap( 
aDstSzPix,
+aBandBmp = GetDownsampledBitmap( 
PixelToLogic(LogicToPixel(aDstSzPix), MapMode(MapUnit::MapTwip)),
  
Point(), aBandBmp.GetSizePixel(),
  
aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY );
-}
 
 rOutMtf.AddAction( new MetaCommentAction( 
"PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) );
 rOutMtf.AddAction( new MetaBmpScaleAction( 
aDstPtPix, aDstSzPix, aBandBmp ) );


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

2021-09-07 Thread Caolán McNamara (via logerrit)
 include/vcl/layout.hxx   |2 --
 vcl/source/window/layout.cxx |   20 
 2 files changed, 4 insertions(+), 18 deletions(-)

New commits:
commit 99141aea4d81d89ff5d14087e6647b25f7018e8b
Author: Caolán McNamara 
AuthorDate: Fri Sep 3 21:16:13 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 7 10:51:24 2021 +0200

Related: tdf#142458 don't change border size during Paint

so GetOptimalSize/get_preferred_size before/after paint has the same result

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

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 14c85938d639..19eca5b5cf40 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -500,8 +500,6 @@ public:
 private:
 virtual Size calculateRequisition() const override;
 virtual void setAllocation(const Size &rAllocation) override;
-// sets new border size and adapts scrollbar and child widget 
position/size as needed
-void updateBorderWidth(tools::Long nBorderWidth);
 int CalcBorderWidth() const;
 DECL_LINK(ScrollBarHdl, ScrollBar*, void);
 void InitScrollBars(const Size &rRequest);
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 680a650f34f2..d9f479ee39e6 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2100,27 +2100,15 @@ bool VclScrolledWindow::EventNotify(NotifyEvent& rNEvt)
 return bDone || VclBin::EventNotify( rNEvt );
 }
 
-void VclScrolledWindow::updateBorderWidth(tools::Long nBorderWidth)
-{
-if (m_nBorderWidth == nBorderWidth || nBorderWidth < 1)
-return;
-
-m_nBorderWidth = nBorderWidth;
-// update scrollbars and child window
-doSetAllocation(GetSizePixel(), false);
-};
-
 void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect)
 {
+VclBin::Paint(rRenderContext, rRect);
 const tools::Rectangle aRect(tools::Rectangle(Point(0,0), GetSizePixel()));
 DecorationView aDecoView(&rRenderContext);
 const tools::Rectangle aContentRect = aDecoView.DrawFrame(aRect, 
m_eDrawFrameStyle, m_eDrawFrameFlags);
-
-// take potentially changed frame size into account before rendering 
content
-const tools::Long nFrameWidth = (aRect.GetWidth() - 
aContentRect.GetWidth()) / 2;
-updateBorderWidth(nFrameWidth);
-
-VclBin::Paint(rRenderContext, rRect);
+const auto nBorderWidth = (aRect.GetWidth() - aContentRect.GetWidth()) / 2;
+SAL_WARN_IF(nBorderWidth > m_nBorderWidth, "vcl.layout", "desired border 
at paint " <<
+nBorderWidth << " is larger than expected " << m_nBorderWidth);
 }
 
 void VclViewport::setAllocation(const Size &rAllocation)


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

2021-09-03 Thread Caolán McNamara (via logerrit)
 include/vcl/layout.hxx   |1 
 vcl/source/window/layout.cxx |   58 +--
 2 files changed, 41 insertions(+), 18 deletions(-)

New commits:
commit b9a3ab00dfe64c7bb19277dbad3545b83aacdc21
Author: Caolán McNamara 
AuthorDate: Fri Sep 3 17:27:54 2021 +0100
Commit: Caolán McNamara 
CommitDate: Fri Sep 3 22:19:33 2021 +0200

tdf#142458 Set correct ScrolledWindow BorderWidth in the ctor

and keep it updated when the relevant properties that affect it change.
This avoids the problem that the borderwidth can change during "Paint"
(which is something we strongly want to avoid) since...

since:

commit f39f21d92ec83c3a5062f29dd26214fc83012c06
Date:   Thu Nov 19 11:51:13 2020 +0100

tdf#138010 (IV) VclScrolledWindow: Use actual border width

hopefully after this we can then double-check to see if we can remove
the potential change of BorderWidth during paint.

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

diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 7f3f37a479fa..14c85938d639 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -502,6 +502,7 @@ private:
 virtual void setAllocation(const Size &rAllocation) override;
 // sets new border size and adapts scrollbar and child widget 
position/size as needed
 void updateBorderWidth(tools::Long nBorderWidth);
+int CalcBorderWidth() const;
 DECL_LINK(ScrollBarHdl, ScrollBar*, void);
 void InitScrollBars(const Size &rRequest);
 virtual bool EventNotify(NotifyEvent& rNEvt) override;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 6ce711bea1aa..680a650f34f2 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1809,7 +1809,6 @@ IMPL_LINK( VclExpander, ClickHdl, CheckBox&, rBtn, void )
 VclScrolledWindow::VclScrolledWindow(vcl::Window *pParent)
 : VclBin(pParent, WB_HIDE | WB_CLIPCHILDREN | WB_AUTOHSCROLL | 
WB_AUTOVSCROLL | WB_TABSTOP)
 , m_bUserManagedScrolling(false)
-, m_nBorderWidth(1)
 , m_eDrawFrameStyle(DrawFrameStyle::NONE)
 , m_eDrawFrameFlags(DrawFrameFlags::NONE)
 , m_pVScroll(VclPtr::Create(this, WB_HIDE | WB_VERT))
@@ -1827,6 +1826,18 @@ VclScrolledWindow::VclScrolledWindow(vcl::Window 
*pParent)
 Link aLink( LINK( this, VclScrolledWindow, ScrollBarHdl ) 
);
 m_pVScroll->SetScrollHdl(aLink);
 m_pHScroll->SetScrollHdl(aLink);
+
+m_nBorderWidth = CalcBorderWidth();
+}
+
+int VclScrolledWindow::CalcBorderWidth() const
+{
+const tools::Rectangle aRect(tools::Rectangle(Point(0, 0), Size(100, 
100)));
+DecorationView aDecoView(const_cast(GetOutDev()));
+// don't actually draw anything, just measure what size it would be and 
the diff is the desired border size to reserve
+const tools::Rectangle aContentRect = aDecoView.DrawFrame(aRect, 
m_eDrawFrameStyle, m_eDrawFrameFlags | DrawFrameFlags::NoDraw);
+const auto nBorderWidth = (aRect.GetWidth() - aContentRect.GetWidth()) / 2;
+return std::max(nBorderWidth, 1);
 }
 
 void VclScrolledWindow::dispose()
@@ -2030,24 +2041,35 @@ Size VclScrolledWindow::getVisibleChildSize() const
 
 bool VclScrolledWindow::set_property(const OString &rKey, const OUString 
&rValue)
 {
-if (rKey == "shadow-type")
-{
-// despite the style names, this looks like the best mapping
-if (rValue == "in")
-m_eDrawFrameStyle = DrawFrameStyle::Out;
-else if (rValue == "out")
-m_eDrawFrameStyle = DrawFrameStyle::In;
-else if (rValue == "etched-in")
-m_eDrawFrameStyle = DrawFrameStyle::DoubleOut;
-else if (rValue == "etched-out")
-m_eDrawFrameStyle = DrawFrameStyle::DoubleIn;
-else if (rValue == "none")
-m_eDrawFrameStyle = DrawFrameStyle::NONE;
-return true;
-}
-else if (rKey == "name")
+if (rKey == "shadow-type" || rKey == "name")
 {
-m_eDrawFrameFlags = rValue == "monoborder" ? DrawFrameFlags::Mono : 
DrawFrameFlags::NONE;
+if (rKey == "shadow-type")
+{
+// despite the style names, this looks like the best mapping
+if (rValue == "in")
+m_eDrawFrameStyle = DrawFrameStyle::Out;
+else if (rValue == "out")
+m_eDrawFrameStyle = DrawFrameStyle::In;
+else if (rValue == "etched-in")
+m_eDrawFrameStyle = DrawFrameStyle::DoubleOut;
+else if (rValue == "etched-out")
+m_eDrawFrameStyle = DrawFrameStyle::DoubleIn;
+else if (rValue == "none")
+m_eDrawFrameStyle = DrawFrameStyle::NONE;
+}
+else if (rKey == "name")
+{
+m_eDrawFrameFlags = rValue == "monoborder" ? DrawFrameFlags::Mono 
: DrawFr

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

2021-09-02 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |4 ++--
 vcl/source/outdev/fill.cxx |4 
 2 files changed, 2 insertions(+), 6 deletions(-)

New commits:
commit 13263005dc415b29a82ad12d452c313439668c3d
Author: Chris Sherlock 
AuthorDate: Thu Sep 2 06:39:54 2021 +1000
Commit: Mike Kaganski 
CommitDate: Thu Sep 2 17:31:10 2021 +0200

vcl: make GetFillColor() and IsFillColor() inline class functions

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index e2a4b4d190d1..a68655c073c8 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -507,8 +507,8 @@ public:
 
 voidSetFillColor();
 voidSetFillColor( const Color& rColor );
-const Color&GetFillColor() const;
-boolIsFillColor() const;
+const Color&GetFillColor() const { return maFillColor; }
+boolIsFillColor() const { return mbFillColor; }
 
 voidSetBackground();
 voidSetBackground( const Wallpaper& rBackground );
diff --git a/vcl/source/outdev/fill.cxx b/vcl/source/outdev/fill.cxx
index ea00990cbece..bbe6270632dc 100644
--- a/vcl/source/outdev/fill.cxx
+++ b/vcl/source/outdev/fill.cxx
@@ -26,10 +26,6 @@
 #include 
 #include 
 
-Color const& OutputDevice::GetFillColor() const { return maFillColor; }
-
-bool OutputDevice::IsFillColor() const { return mbFillColor; }
-
 void OutputDevice::SetFillColor()
 {
 


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

2021-08-30 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 +-
 include/vcl/print.hxx  |2 +-
 vcl/source/gdi/print.cxx   |2 +-
 vcl/source/outdev/bitmapex.cxx |4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8b3d5a79c0f70cb3bdfa4cbe8adf91521a28d89c
Author: Chris Sherlock 
AuthorDate: Wed May 12 19:47:00 2021 +1000
Commit: Mike Kaganski 
CommitDate: Mon Aug 30 18:29:32 2021 +0200

vcl: DrawDeviceBitmap() -> DrawDeviceBitmapEx()

The function actually draws a BitmapEx and not a Bitmap, so it
was named wrongly.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 2cd65db1a81e..95df09d055bf 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1373,7 +1373,7 @@ public:
 
 protected:
 
-virtual voidDrawDeviceBitmap(
+virtual voidDrawDeviceBitmapEx(
 const Point& rDestPt, const Size& 
rDestSize,
 const Point& rSrcPtPixel, const Size& 
rSrcSizePixel,
 BitmapEx& rBitmapEx );
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 6ffdc077dff6..1ffce121bba1 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -239,7 +239,7 @@ protected:
 boolTransformAndReduceBitmapExToTargetRange( const 
basegfx::B2DHomMatrix& aFullTransform,
 basegfx::B2DRange &aVisibleRange, double 
&fMaximumArea) override;
 
-voidDrawDeviceBitmap( const Point& rDestPt, const 
Size& rDestSize,
+voidDrawDeviceBitmapEx( const Point& rDestPt, 
const Size& rDestSize,
 const Point& rSrcPtPixel, const Size& 
rSrcSizePixel,
 BitmapEx& rBitmapEx ) override;
 
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 84a2a27a92b2..593744b4e321 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -290,7 +290,7 @@ bool Printer::TransformAndReduceBitmapExToTargetRange(
 return true;
 }
 
-void Printer::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
+void Printer::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSize,
 const Point& rSrcPtPixel, const Size& 
rSrcSizePixel,
 BitmapEx& rBmpEx )
 {
diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx
index d0016e81635d..a8afded98b0c 100644
--- a/vcl/source/outdev/bitmapex.cxx
+++ b/vcl/source/outdev/bitmapex.cxx
@@ -124,7 +124,7 @@ void OutputDevice::DrawBitmapEx( const Point& rDestPt, 
const Size& rDestSize,
 if ( mbOutputClipped )
 return;
 
-DrawDeviceBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, 
aBmpEx );
+DrawDeviceBitmapEx( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, 
aBmpEx );
 }
 }
 
@@ -146,7 +146,7 @@ BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, 
const Size& rSize ) con
 return BitmapEx(GetBitmap( rSrcPt, rSize ));
 }
 
-void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& 
rDestSize,
+void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& 
rDestSize,
  const Point& rSrcPtPixel, const Size& 
rSrcSizePixel,
  BitmapEx& rBitmapEx )
 {


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

2021-08-28 Thread Julien Nabet (via logerrit)
 include/vcl/outdevstate.hxx   |3 +--
 vcl/source/gdi/mtfxmldump.cxx |2 --
 2 files changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 74d35e143d557a7e65c4443f5b80cb9d406b1fa1
Author: Julien Nabet 
AuthorDate: Sat Aug 28 12:19:06 2021 +0200
Commit: Julien Nabet 
CommitDate: Sat Aug 28 20:17:46 2021 +0200

No need to keep PUSH_ALLTEXT (vcl)

Change-Id: Ied83de6e2768998a76aaf28972c45e82f9a95a57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121192
Tested-by: Jenkins
Reviewed-by: Chris Sherlock 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index b1104a28f34f..e058ad7dd45d 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -57,8 +57,7 @@ namespace o3tl
 {
 template<> struct typed_flags : is_typed_flags {};
 }
-#define PUSH_ALLTEXT  (PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR | 
PushFlags::TEXTLINECOLOR | PushFlags::OVERLINECOLOR | PushFlags::TEXTALIGN | 
PushFlags::TEXTLAYOUTMODE | PushFlags::TEXTLANGUAGE)
-#define PUSH_ALLFONT  (PUSH_ALLTEXT | PushFlags::FONT)
+#define PUSH_ALLFONT  (PushFlags::TEXTCOLOR | PushFlags::TEXTFILLCOLOR | 
PushFlags::TEXTLINECOLOR | PushFlags::OVERLINECOLOR | PushFlags::TEXTALIGN | 
PushFlags::TEXTLAYOUTMODE | PushFlags::TEXTLANGUAGE | PushFlags::FONT)
 
 // Layout flags for Complex Text Layout
 // These are flag values, i.e they can be combined
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 64df808a..4ad870cb019c 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -27,8 +27,6 @@ OUString collectPushFlags(PushFlags nFlags)
 return "PushAll";
 else if ((nFlags & PUSH_ALLFONT) == PUSH_ALLFONT)
 return "PushAllFont";
-else if ((nFlags & PUSH_ALLTEXT) == PUSH_ALLTEXT)
-return "PushAllText";
 
 std::vector aStrings;
 


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

2021-08-28 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|   10 ++
 vcl/source/gdi/pdfwriter_impl.cxx |   14 ++
 vcl/source/gdi/pdfwriter_impl.hxx |1 +
 vcl/source/outdev/font.cxx|9 -
 4 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 9a58ec3f6f65da27e3b26e1173b6661b743e66a4
Author: Chris Sherlock 
AuthorDate: Sun Mar 7 11:19:29 2021 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sat Aug 28 14:10:51 2021 +0200

tdf#74702 vcl: remove GetOutDevType() from ImplNewFont()

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 011fc5445e0c..144a52308a3e 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -177,8 +177,6 @@ private:
 mutable VclPtrmpNextGraphics; ///< Next output 
device in list
 GDIMetaFile*mpMetaFile;
 mutable rtl::Reference mpFontInstance;
-mutable std::shared_ptr mxFontCache;
-mutable std::shared_ptr mxFontCollection;
 mutable std::unique_ptr mpDeviceFontList;
 mutable std::unique_ptr mpDeviceFontSizeList;
 std::vectormaOutDevStateStack;
@@ -253,6 +251,10 @@ private:
 mutable boolmbRefPoint : 1;
 mutable boolmbEnableRTL : 1;
 
+protected:
+mutable std::shared_ptr mxFontCollection;
+mutable std::shared_ptr mxFontCache;
+
 /** @name Initialization and accessor functions
  */
 ///@{
@@ -1178,12 +1180,12 @@ protected:
 void SetFontCollectionFromSVData();
 void ResetNewFontCache();
 
+SAL_DLLPRIVATE bool ImplNewFont() const;
+
 private:
 
 typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
 
-SAL_DLLPRIVATE bool ImplNewFont() const;
-
 SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( 
FontUpdateHandler_t pHdl, bool bNewFontLists );
 
 static
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 41fc6b88d4ef..a099ef87bde1 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -68,6 +68,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -1341,6 +1342,19 @@ void PDFWriterImpl::dispose()
 VirtualDevice::dispose();
 }
 
+bool PDFWriterImpl::ImplNewFont() const
+{
+const ImplSVData* pSVData = ImplGetSVData();
+
+if( mxFontCollection == pSVData->maGDIData.mxScreenFontList
+||  mxFontCache == pSVData->maGDIData.mxScreenFontCache )
+{
+const_cast(*this).ImplUpdateFontData();
+}
+
+return OutputDevice::ImplNewFont();
+}
+
 void PDFWriterImpl::setupDocInfo()
 {
 std::vector< sal_uInt8 > aId;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 43a55ad23196..e594d6332683 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -643,6 +643,7 @@ public:
 static void convertLineInfoToExtLineInfo( const LineInfo& rIn, 
PDFWriter::ExtLineInfo& rOut );
 
 protected:
+bool ImplNewFont() const;
 void ImplClearFontData(bool bNewFontLists) override;
 void ImplRefreshFontData(bool bNewFontLists) override;
 vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override;
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 1db0ad16207f..bfaa0226b1ce 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -914,15 +914,6 @@ bool OutputDevice::ImplNewFont() const
 {
 DBG_TESTSOLARMUTEX();
 
-// get correct font list on the PDF writer if necessary
-if (GetOutDevType() == OUTDEV_PDF)
-{
-const ImplSVData* pSVData = ImplGetSVData();
-if( mxFontCollection == pSVData->maGDIData.mxScreenFontList
-||  mxFontCache == pSVData->maGDIData.mxScreenFontCache )
-const_cast(*this).ImplUpdateFontData();
-}
-
 if ( !mbNewFont )
 return true;
 


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

2021-08-27 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|5 -
 vcl/source/outdev/outdevstate.cxx |7 +--
 2 files changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 6146409978e1a2834c85acff33485f69164ae735
Author: Chris Sherlock 
AuthorDate: Wed May 12 18:25:33 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 27 13:29:25 2021 +0200

vcl: remove unnecessary OutputDevice::GetGCStackDepth()

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 7d4a7e533356..011fc5445e0c 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -463,11 +463,6 @@ public:
 
 voidPush( PushFlags nFlags = PushFlags::ALL );
 voidPop();
-
-// returns the current stack depth; that is the number of Push() calls 
minus the number of Pop() calls
-// this should not normally be used since Push and Pop must always be used 
symmetrically
-// however this may be e.g. a help when debugging code in which this 
somehow is not the case
-sal_uInt32  GetGCStackDepth() const;
 voidClearStack();
 
 voidEnableOutput( bool bEnable = true );
diff --git a/vcl/source/outdev/outdevstate.cxx 
b/vcl/source/outdev/outdevstate.cxx
index 41ee775a84e6..108d57dff9e2 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -194,14 +194,9 @@ void OutputDevice::Pop()
 mpMetaFile = pOldMetaFile;
 }
 
-sal_uInt32 OutputDevice::GetGCStackDepth() const
-{
-return maOutDevStateStack.size();
-}
-
 void OutputDevice::ClearStack()
 {
-sal_uInt32 nCount = GetGCStackDepth();
+sal_uInt32 nCount = maOutDevStateStack.size();
 while( nCount-- )
 Pop();
 }


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

2021-08-25 Thread Chris Sherlock (via logerrit)
 include/vcl/outdevstate.hxx   |   56 +-
 vcl/source/outdev/outdevstate.cxx |   26 -
 2 files changed, 26 insertions(+), 56 deletions(-)

New commits:
commit 0484630164275e2828f1420b055f05e94b8c73ee
Author: Chris Sherlock 
AuthorDate: Tue Aug 24 21:29:16 2021 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 26 04:27:39 2021 +0200

vcl: make OutDevState constructor default, no need for destructor

There is no value of having the OutDevState constructor and destructor
being in its own file, so move to header. Also, resetting the variables
in the destructor is rather pointless as they are destroyed in the next
step anyhow. This removes the need to define an empty destructor.

Use C++11 magic to make a default constructor - many thanks to Mike
Kaganski for the tip on this one.

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

diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 36f02e2f2e42..b1104a28f34f 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -17,22 +17,21 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_OUTDEVSTATE_HXX
-#define INCLUDED_VCL_OUTDEVSTATE_HXX
-
-#include 
-#include 
-#include 
+#pragma once
 
 #include 
 #include 
 #include 
+#include 
 #include 
+
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
-#include 
-
-namespace vcl { class Region; }
 
 // Flags for OutputDevice::Push() and OutDevState
 enum class PushFlags {
@@ -77,28 +76,25 @@ namespace o3tl {
 
 struct OutDevState
 {
-OutDevState();
-OutDevState(OutDevState&&);
-~OutDevState();
+OutDevState() = default;
+OutDevState(OutDevState&&) = default;
 
-std::optionalmpMapMode;
-boolmbMapActive;
-std::unique_ptrmpClipRegion;
-std::optional  mpLineColor;
-std::optional  mpFillColor;
-std::optional  mpFont;
-std::optional  mpTextColor;
-std::optional  mpTextFillColor;
-std::optional  mpTextLineColor;
-std::optional  mpOverlineColor;
-std::optional  mpRefPoint;
-TextAlign   meTextAlign;
-RasterOpmeRasterOp;
-ComplexTextLayoutFlags  mnTextLayoutMode;
-LanguageTypemeTextLanguage;
-PushFlags   mnFlags;
+std::optional mpMapMode;
+bool mbMapActive = false;
+std::unique_ptr mpClipRegion;
+std::optional mpLineColor;
+std::optional mpFillColor;
+std::optional mpFont;
+std::optional mpTextColor;
+std::optional mpTextFillColor;
+std::optional mpTextLineColor;
+std::optional mpOverlineColor;
+std::optional mpRefPoint;
+TextAlign meTextAlign = ALIGN_TOP;
+RasterOp meRasterOp = RasterOp::OverPaint;
+ComplexTextLayoutFlags mnTextLayoutMode = ComplexTextLayoutFlags::Default;
+LanguageType meTextLanguage = LANGUAGE_SYSTEM;
+PushFlags mnFlags = PushFlags::NONE;
 };
 
-#endif // INCLUDED_VCL_OUTDEVSTATE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/outdevstate.cxx 
b/vcl/source/outdev/outdevstate.cxx
index 0c0d1afbb955..fa1af5ab576d 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -31,32 +31,6 @@
 #include 
 #include 
 
-OutDevState::OutDevState()
-: mbMapActive(false)
-, meTextAlign(ALIGN_TOP)
-, meRasterOp(RasterOp::OverPaint)
-, mnTextLayoutMode(ComplexTextLayoutFlags::Default)
-, meTextLanguage(0)
-, mnFlags(PushFlags::NONE)
-{
-}
-
-OutDevState::OutDevState(OutDevState&&) = default;
-
-OutDevState::~OutDevState()
-{
-mpLineColor.reset();
-mpFillColor.reset();
-mpFont.reset();
-mpTextColor.reset();
-mpTextFillColor.reset();
-mpTextLineColor.reset();
-mpOverlineColor.reset();
-mpMapMode.reset();
-mpClipRegion.reset();
-mpRefPoint.reset();
-}
-
 void OutputDevice::Push( PushFlags nFlags )
 {
 


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

2021-08-22 Thread Noel Grandin (via logerrit)
 include/vcl/region.hxx|   15 +-
 vcl/source/gdi/region.cxx |   48 +++---
 2 files changed, 39 insertions(+), 24 deletions(-)

New commits:
commit d2bf9e56310fe40eac700afa974483d704e4c70a
Author: Noel Grandin 
AuthorDate: Sat Aug 21 20:29:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 22 14:45:33 2021 +0200

no need to use shared_ptr for these fields in Region

they are already COW types

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

diff --git a/include/vcl/region.hxx b/include/vcl/region.hxx
index e6c7448e36c1..cf48fbdff6e1 100644
--- a/include/vcl/region.hxx
+++ b/include/vcl/region.hxx
@@ -21,17 +21,14 @@
 #define INCLUDED_VCL_REGION_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 class RegionBand;
 
-namespace tools {
-class Polygon;
-class PolyPolygon;
-}
-
 namespace vcl { class Window; }
 class OutputDevice;
 class Bitmap;
@@ -48,9 +45,9 @@ private:
 friend class ::Bitmap;
 
 // possible contents
-std::shared_ptr< basegfx::B2DPolyPolygon >
+std::optional< basegfx::B2DPolyPolygon >
 mpB2DPolyPolygon;
-std::shared_ptr< tools::PolyPolygon >
+std::optional< tools::PolyPolygon >
 mpPolyPolygon;
 std::shared_ptr< RegionBand >
 mpRegionBand;
@@ -76,8 +73,8 @@ public:
 ~Region();
 
 // direct access to contents
-const basegfx::B2DPolyPolygon* getB2DPolyPolygon() const { return 
mpB2DPolyPolygon.get(); }
-const tools::PolyPolygon* getPolyPolygon() const { return 
mpPolyPolygon.get(); }
+const std::optional& getB2DPolyPolygon() const { 
return mpB2DPolyPolygon; }
+const std::optional& getPolyPolygon() const { return 
mpPolyPolygon; }
 const RegionBand* getRegionBand() const { return mpRegionBand.get(); }
 
 // access with converters, the asked data will be created from the most
diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx
index 0f80a717c5f6..2dbea8db1f0d 100644
--- a/vcl/source/gdi/region.cxx
+++ b/vcl/source/gdi/region.cxx
@@ -396,7 +396,7 @@ void vcl::Region::ImplCreatePolyPolyRegion( const 
tools::PolyPolygon& rPolyPoly
 }
 else
 {
-mpPolyPolygon = std::make_shared(rPolyPoly);
+mpPolyPolygon = rPolyPoly;
 }
 
 mbIsNull = false;
@@ -406,7 +406,7 @@ void vcl::Region::ImplCreatePolyPolyRegion( const 
basegfx::B2DPolyPolygon& rPoly
 {
 if(rPolyPoly.count() && !rPolyPoly.getB2DRange().isEmpty())
 {
-mpB2DPolyPolygon = 
std::make_shared(rPolyPoly);
+mpB2DPolyPolygon = rPolyPoly;
 mbIsNull = false;
 }
 }
@@ -430,7 +430,10 @@ void vcl::Region::Move( tools::Long nHorzMove, tools::Long 
nVertMove )
 basegfx::B2DPolyPolygon aPoly(*getB2DPolyPolygon());
 
 aPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(nHorzMove, 
nVertMove));
-mpB2DPolyPolygon.reset(aPoly.count() ? new 
basegfx::B2DPolyPolygon(aPoly) : nullptr);
+if (aPoly.count())
+mpB2DPolyPolygon = aPoly;
+else
+mpB2DPolyPolygon.reset();
 mpPolyPolygon.reset();
 mpRegionBand.reset();
 }
@@ -440,7 +443,10 @@ void vcl::Region::Move( tools::Long nHorzMove, tools::Long 
nVertMove )
 
 aPoly.Move(nHorzMove, nVertMove);
 mpB2DPolyPolygon.reset();
-mpPolyPolygon.reset(aPoly.Count() ? new tools::PolyPolygon(aPoly) : 
nullptr);
+if (aPoly.Count())
+mpPolyPolygon = aPoly;
+else
+mpPolyPolygon.reset();
 mpRegionBand.reset();
 }
 else if(getRegionBand())
@@ -477,7 +483,10 @@ void vcl::Region::Scale( double fScaleX, double fScaleY )
 basegfx::B2DPolyPolygon aPoly(*getB2DPolyPolygon());
 
 aPoly.transform(basegfx::utils::createScaleB2DHomMatrix(fScaleX, 
fScaleY));
-mpB2DPolyPolygon.reset(aPoly.count() ? new 
basegfx::B2DPolyPolygon(aPoly) : nullptr);
+if (aPoly.count())
+mpB2DPolyPolygon = aPoly;
+else
+mpB2DPolyPolygon.reset();
 mpPolyPolygon.reset();
 mpRegionBand.reset();
 }
@@ -487,7 +496,10 @@ void vcl::Region::Scale( double fScaleX, double fScaleY )
 
 aPoly.Scale(fScaleX, fScaleY);
 mpB2DPolyPolygon.reset();
-mpPolyPolygon.reset(aPoly.Count() ? new tools::PolyPolygon(aPoly) : 
nullptr);
+if (aPoly.Count())
+mpPolyPolygon = aPoly;
+else
+mpPolyPolygon.reset();
 mpRegionBand.reset();
 }
 else if(getRegionBand())
@@ -619,7 +631,10 @@ void vcl::Region::Intersect( const tools::Rectangle& rRect 
)
 true,
 false));
 
-mpB2DPolyPolygon.reset(aPoly.count() ? new 
basegfx::B2DPolyPolygon(aPoly) : nu

  1   2   3   4   5   6   7   8   9   >