[Libreoffice-commits] core.git: include/vcl offapi/com sd/source vcl/qt5 vcl/unx vcl/win

2023-12-06 Thread Gabor Kelemen (via logerrit)
 include/vcl/keycodes.hxx  |2 +
 offapi/com/sun/star/awt/Key.idl   |6 +
 sd/source/console/PresenterController.cxx |2 +
 sd/source/ui/slideshow/slideshowimpl.cxx  |2 +
 vcl/qt5/QtFrame.cxx   |6 +
 vcl/qt5/QtWidget.cxx  |6 +
 vcl/unx/generic/app/saldisp.cxx   |   12 +++
 vcl/unx/gtk3/gtkframe.cxx |4 +++
 vcl/win/window/salframe.cxx   |   32 --
 9 files changed, 70 insertions(+), 2 deletions(-)

New commits:
commit 9e8df5bfe804943a8662b52ff2afed936b79657d
Author: Gabor Kelemen 
AuthorDate: Sun Dec 3 11:07:23 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Wed Dec 6 15:51:42 2023 +0100

tdf#148986 Support XF86Forward / XF86Back key events

Multimedia keys found on certain presentation clicker devices.
Not added to the Customize dialog, as that was not yet asked for.
As I have no access to a MAC, did not add support for that in vcl.

Inspiration for code taken from
commit ca74511985981444dbd72ade7244484c131e36a7

Change-Id: I417e6ba7e79c5f6e774a56ba747803a156d5f50f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160255
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/include/vcl/keycodes.hxx b/include/vcl/keycodes.hxx
index 2efe29a55fbb..8eb1a0ec8c2c 100644
--- a/include/vcl/keycodes.hxx
+++ b/include/vcl/keycodes.hxx
@@ -156,6 +156,8 @@ constexpr sal_uInt16 KEY_SEMICOLON = 
css::awt::Key::SEMICOLON;
 constexpr sal_uInt16 KEY_QUOTERIGHT = css::awt::Key::QUOTERIGHT;
 constexpr sal_uInt16 KEY_RIGHTCURLYBRACKET = css::awt::Key::RIGHTCURLYBRACKET;
 constexpr sal_uInt16 KEY_NUMBERSIGN = css::awt::Key::NUMBERSIGN;
+constexpr sal_uInt16 KEY_XF86FORWARD = css::awt::Key::XF86FORWARD;
+constexpr sal_uInt16 KEY_XF86BACK = css::awt::Key::XF86BACK;
 constexpr sal_uInt16 KEY_COLON = css::awt::Key::COLON;
 
 constexpr sal_uInt16 KEY_CAPSLOCK = css::awt::Key::CAPSLOCK;
diff --git a/offapi/com/sun/star/awt/Key.idl b/offapi/com/sun/star/awt/Key.idl
index d9f45257ce8c..b07ff78dab54 100644
--- a/offapi/com/sun/star/awt/Key.idl
+++ b/offapi/com/sun/star/awt/Key.idl
@@ -375,6 +375,12 @@ published constants Key
 /* # sign. @since LibreOffice 24.2 */
 const short NUMBERSIGN = 191;
 
+/* XF86Forward @since LibreOffice 24.2 */
+const short XF86FORWARD = 167;
+
+/* XF86Back @since LibreOffice 24.2 */
+const short XF86BACK = 166;
+
 /** The following values don't correspond to physical keys on any
 keyboard but are used in the macOS implementation of VCL. They
 correspond to some of the action messages of the NSResponder
diff --git a/sd/source/console/PresenterController.cxx 
b/sd/source/console/PresenterController.cxx
index 2a0e6d25aa47..7bb137d8c03b 100644
--- a/sd/source/console/PresenterController.cxx
+++ b/sd/source/console/PresenterController.cxx
@@ -845,6 +845,7 @@ void SAL_CALL PresenterController::keyReleased (const 
awt::KeyEvent& rEvent)
 case awt::Key::RIGHT:
 case awt::Key::SPACE:
 case awt::Key::DOWN:
+case awt::Key::XF86FORWARD:
 if (mxSlideShowController.is())
 {
 mxSlideShowController->gotoNextEffect();
@@ -864,6 +865,7 @@ void SAL_CALL PresenterController::keyReleased (const 
awt::KeyEvent& rEvent)
 case awt::Key::LEFT:
 case awt::Key::UP:
 case awt::Key::BACKSPACE:
+case awt::Key::XF86BACK:
 if (mxSlideShowController.is())
 {
 mxSlideShowController->gotoPreviousEffect();
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx 
b/sd/source/ui/slideshow/slideshowimpl.cxx
index 7619624544b4..1e739ab97f26 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1848,6 +1848,7 @@ bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
 case KEY_SPACE:
 case KEY_RIGHT:
 case KEY_DOWN:
+case KEY_XF86FORWARD:
 gotoNextEffect();
 break;
 
@@ -1893,6 +1894,7 @@ bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
 case KEY_LEFT:
 case KEY_UP:
 case KEY_BACKSPACE:
+case KEY_XF86BACK:
 gotoPreviousEffect();
 break;
 
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index cde1a06b3dd8..24dcb5ff6f61 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -952,6 +952,12 @@ OUString QtFrame::GetKeyName(sal_uInt16 nKeyCode)
 case KEY_NUMBERSIGN:
 nRetCode = Qt::Key_NumberSign;
 break;
+case KEY_XF86FORWARD:
+nRetCode = Qt::Key_Forward;
+break;
+case KEY_XF86BACK:
+nRetCode = Qt::Key_Back;
+break;
 case KEY_COLON:
 nRetCode 

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

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

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

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

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

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

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

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

2023-12-04 Thread Andrea Gelmini (via logerrit)
 include/vcl/bitmap.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4852c601be832c4b70a08a05a8abb921e13ab6a6
Author: Andrea Gelmini 
AuthorDate: Sun Dec 3 21:39:38 2023 +0100
Commit: Julien Nabet 
CommitDate: Mon Dec 4 09:26:15 2023 +0100

Fix typo

Change-Id: I55e1b250f35adb11169267d5f8f1dbaca9ad802d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160282
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index b7059654e016..3b7f39480027 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -242,7 +242,7 @@ public:
 bitmap dimensions.
 
 @param rRectSrc
-Source rectangl. This is clipped to the
+Source rectangle. This is clipped to the
 bitmap dimensions. Note further that no scaling takes place
 during this copy operation, i.e. only the minimum of source
 and destination rectangle's width and height are used.


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

2023-12-02 Thread Noel Grandin (via logerrit)
 include/vcl/alpha.hxx   |2 +-
 vcl/qa/cppunit/BackendTest.cxx  |2 +-
 vcl/qa/cppunit/canvasbitmaptest.cxx |4 ++--
 vcl/source/bitmap/BitmapTools.cxx   |2 +-
 vcl/source/bitmap/alpha.cxx |   11 ---
 vcl/unx/generic/window/salframe.cxx |2 +-
 6 files changed, 6 insertions(+), 17 deletions(-)

New commits:
commit 1c1806724dd9010d365fa64cc741a1e94dc9b065
Author: Noel Grandin 
AuthorDate: Sat Dec 2 15:28:47 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 2 20:20:40 2023 +0100

AlphaMask::ReleaseAccess is unnecessary

There is no way the format can change via the Bitmap*Access
mechanisms, and we already perform these asserts in
the constructor and operator=.

The code has been there since
commit 8ab086b6cc054501bfbf7ef6fa509c393691e860
Author: Jens-Heiner Rechtien 
Date:   Mon Sep 18 16:07:07 2000 +
   initial import

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

diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 9c6b1070ed53..8de4ea113d01 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -66,7 +66,7 @@ public:
 BitmapReadAccess*  AcquireAlphaReadAccess() { return 
Bitmap::AcquireReadAccess(); }
 BitmapWriteAccess* AcquireAlphaWriteAccess() { return 
Bitmap::AcquireWriteAccess(); }
 
-voidReleaseAccess( BitmapReadAccess* pAccess );
+using Bitmap::ReleaseAccess;
 
 typedef vcl::ScopedBitmapAccess ScopedReadAccess;
 
diff --git a/vcl/qa/cppunit/BackendTest.cxx b/vcl/qa/cppunit/BackendTest.cxx
index e5013d244335..c4cc184fb7ad 100644
--- a/vcl/qa/cppunit/BackendTest.cxx
+++ b/vcl/qa/cppunit/BackendTest.cxx
@@ -1182,7 +1182,7 @@ public:
 alpha.Erase(255); // transparent
 BitmapWriteAccess* alphaWrite = alpha.AcquireAlphaWriteAccess();
 alphaWrite->SetPixelIndex(0, 0, 255); // opaque
-alpha.ReleaseAccess(alphaWrite);
+Bitmap::ReleaseAccess(alphaWrite);
 device->DrawBitmapEx(Point(2, 2), BitmapEx(bitmap, alpha));
 exportDevice("blend_extended_04.png", device);
 CPPUNIT_ASSERT_EQUAL(COL_BLUE, device->GetPixel(Point(2, 2)));
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx 
b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 78eb033f90b0..5aba5982427e 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -701,7 +701,7 @@ void CanvasBitmapTest::runTest()
 pAcc->SetPixel(0,0,BitmapColor(0));
 pAcc->SetPixel(0,1,BitmapColor(255));
 pAcc->SetPixel(0,2,BitmapColor(0));
-aAlpha.ReleaseAccess(pAcc);
+Bitmap::ReleaseAccess(pAcc);
 }
 }
 
@@ -772,7 +772,7 @@ void CanvasBitmapTest::runTest()
 CPPUNIT_ASSERT_EQUAL_MESSAGE("(9,2) correct alpha content",
BitmapColor(2), pAlphaAcc->GetPixel(2,9));
 
-aBitmapAlpha.ReleaseAccess(pAlphaAcc);
+Bitmap::ReleaseAccess(pAlphaAcc);
 Bitmap::ReleaseAccess(pBmpAcc);
 }
 }
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 7caf1f12f328..1b67ea06ac1a 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -992,7 +992,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, 
Bitmap & aBitmap, un
 
 ::Bitmap::ReleaseAccess( pBitmapReadAcc );
 if( pAlphaReadAcc )
-aAlpha.ReleaseAccess( pAlphaReadAcc );
+::Bitmap::ReleaseAccess( pAlphaReadAcc );
 
 bHasAlpha = bIsAlpha;
 
diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx
index b250f4170a74..65b63dd1ffd0 100644
--- a/vcl/source/bitmap/alpha.cxx
+++ b/vcl/source/bitmap/alpha.cxx
@@ -176,17 +176,6 @@ bool AlphaMask::hasAlpha() const
 return false;
 }
 
-void AlphaMask::ReleaseAccess( BitmapReadAccess* pAccess )
-{
-if( pAccess )
-{
-Bitmap::ReleaseAccess( pAccess );
-Convert( BmpConversion::N8BitNoConversion );
-}
-assert( getPixelFormat() == vcl::PixelFormat::N8_BPP && "alpha bitmap 
should be 8bpp" );
-assert( HasGreyPalette8Bit() && "alpha bitmap should have greyscale 
palette" );
-}
-
 bool AlphaMask::AlphaCombineOr(const AlphaMask& rMask)
 {
 ScopedReadAccess pMaskAcc(const_cast(rMask));
diff --git a/vcl/unx/generic/window/salframe.cxx 
b/vcl/unx/generic/window/salframe.cxx
index d634bddb1eab..8d1691ee212d 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -282,7 +282,7 @@ static void CreateNetWmAppIcon( sal_uInt16 nIcon, 
NetWmIconData& netwm_icon )
 netwm_icon[ pos++ ] =  255 - alpha.GetBlue()) * 256U ) + 
col.GetRed()) * 256 + col.GetGreen()) * 256 + col.GetBlue();
 }
 Bitmap::ReleaseAccess( iconData );
-mask.Releas

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

2023-12-02 Thread Noel Grandin (via logerrit)
 include/vcl/BitmapBuffer.hxx |2 -
 vcl/headless/BitmapHelper.cxx|2 -
 vcl/headless/CairoCommon.cxx |   12 +++
 vcl/headless/svpbmp.cxx  |   63 ---
 vcl/inc/headless/CairoCommon.hxx |3 -
 vcl/inc/headless/svpbmp.hxx  |7 ++--
 vcl/source/gdi/salmisc.cxx   |   16 -
 vcl/win/gdi/salbmp.cxx   |   12 +++
 8 files changed, 54 insertions(+), 63 deletions(-)

New commits:
commit c4228a798ef63ea6d3a2e822cd8d1cccf46837af
Author: Noel Grandin 
AuthorDate: Fri Dec 1 10:34:20 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 2 09:07:15 2023 +0100

pass BitmapBuffer around by std::optional

instead of allocating on the heap, it is small

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

diff --git a/include/vcl/BitmapBuffer.hxx b/include/vcl/BitmapBuffer.hxx
index 54efeea5e1bc..a02a459489b5 100644
--- a/include/vcl/BitmapBuffer.hxx
+++ b/include/vcl/BitmapBuffer.hxx
@@ -45,7 +45,7 @@ struct VCL_DLLPUBLIC BitmapBuffer
 sal_uInt16  mnBitCount;
 };
 
-VCL_DLLPUBLIC std::unique_ptr StretchAndConvert(
+VCL_DLLPUBLIC std::optional StretchAndConvert(
 const BitmapBuffer& rSrcBuffer, const SalTwoRect& rTwoRect,
 ScanlineFormat nDstBitmapFormat, std::optional pDstPal = 
std::nullopt, const ColorMask* pDstMask = nullptr );
 
diff --git a/vcl/headless/BitmapHelper.cxx b/vcl/headless/BitmapHelper.cxx
index 8ed0cac09fcb..2cdf502fc9f2 100644
--- a/vcl/headless/BitmapHelper.cxx
+++ b/vcl/headless/BitmapHelper.cxx
@@ -38,7 +38,7 @@ BitmapHelper::BitmapHelper(const SalBitmap& rSourceBitmap, 
const bool bForceARGB
 const BitmapBuffer* pSrc = rSrcBmp.GetBuffer();
 const SalTwoRect aTwoRect
 = { 0, 0, pSrc->mnWidth, pSrc->mnHeight, 0, 0, pSrc->mnWidth, 
pSrc->mnHeight };
-std::unique_ptr pTmp
+std::optional pTmp
 = (pSrc->mnFormat == SVP_24BIT_FORMAT
? FastConvert24BitRgbTo32BitCairo(pSrc)
: StretchAndConvert(*pSrc, aTwoRect, SVP_CAIRO_FORMAT));
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 5e97de6aa5d6..2af8e0d892e2 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1988,15 +1988,15 @@ bool CairoCommon::supportsOperation(OutDevSupportType 
eType)
 return false;
 }
 
-std::unique_ptr FastConvert24BitRgbTo32BitCairo(const 
BitmapBuffer* pSrc)
+std::optional FastConvert24BitRgbTo32BitCairo(const 
BitmapBuffer* pSrc)
 {
 if (pSrc == nullptr)
-return nullptr;
+return std::nullopt;
 
 assert(pSrc->mnFormat == SVP_24BIT_FORMAT);
 const tools::Long nWidth = pSrc->mnWidth;
 const tools::Long nHeight = pSrc->mnHeight;
-std::unique_ptr pDst(new BitmapBuffer);
+std::optional pDst(std::in_place);
 pDst->mnFormat = (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown);
 pDst->mnWidth = nWidth;
 pDst->mnHeight = nHeight;
@@ -2010,7 +2010,7 @@ std::unique_ptr 
FastConvert24BitRgbTo32BitCairo(const BitmapBuffer
 {
 SAL_WARN("vcl.gdi", "checked multiply failed");
 pDst->mpBits = nullptr;
-return nullptr;
+return std::nullopt;
 }
 
 pDst->mnScanlineSize = AlignedWidth4Bytes(nScanlineBase);
@@ -2018,7 +2018,7 @@ std::unique_ptr 
FastConvert24BitRgbTo32BitCairo(const BitmapBuffer
 {
 SAL_WARN("vcl.gdi", "scanline calculation wraparound");
 pDst->mpBits = nullptr;
-return nullptr;
+return std::nullopt;
 }
 
 try
@@ -2029,7 +2029,7 @@ std::unique_ptr 
FastConvert24BitRgbTo32BitCairo(const BitmapBuffer
 {
 // memory exception, clean up
 pDst->mpBits = nullptr;
-return nullptr;
+return std::nullopt;
 }
 
 for (tools::Long y = 0; y < nHeight; ++y)
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index bb8153fb87ef..178ea129c655 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -43,25 +43,16 @@ SvpSalBitmap::~SvpSalBitmap()
 Destroy();
 }
 
-static std::unique_ptr ImplCreateDIB(
+static std::optional ImplCreateDIB(
 const Size& rSize,
 vcl::PixelFormat ePixelFormat,
 const BitmapPalette& rPal,
 bool bClear)
 {
 if (!rSize.Width() || !rSize.Height())
-return nullptr;
+return std::nullopt;
 
-std::unique_ptr pDIB;
-
-try
-{
-pDIB.reset(new BitmapBuffer);
-}
-catch (const std::bad_alloc&)
-{
-return nullptr;
-}
+std::optional pDIB(std::in_place);
 
 switch (ePixelFormat)
 {
@@ -92,13 +83,13 @@ static std::unique_ptr ImplCreateDIB(
 if (bFail)
 {
 SAL_WARN("vcl.gdi", "checked multiply failed");
-return nullptr;
+return std::nullopt;
 }
 pDIB->mnScanlineSize = AlignedWidth4Bytes(nScanlineBase

[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/jsdialog vcl/qa vcl/source vcl/unx vcl/workben

2023-11-19 Thread Stephan Bergmann (via logerrit)
 include/vcl/ITiledRenderable.hxx |2 
 vcl/inc/jsdialog/jsdialogbuilder.hxx |6 
 vcl/jsdialog/jsdialogbuilder.cxx |   39 
 vcl/qa/cppunit/GraphicFormatDetectorTest.cxx |   45 
 vcl/qa/cppunit/PDFDocumentTest.cxx   |  129 -
 vcl/qa/cppunit/PDFiumLibraryTest.cxx |2 
 vcl/qa/cppunit/TypeSerializerTest.cxx|2 
 vcl/qa/cppunit/filter/ipdf/ipdf.cxx  |4 
 vcl/qa/cppunit/graphicfilter/filters-pict-test.cxx   |8 
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |  689 +++
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx  | 1376 +++
 vcl/qa/cppunit/svm/svmtest.cxx   |  328 +--
 vcl/qa/cppunit/widgetdraw/WidgetDefinitionReaderTest.cxx |   22 
 vcl/source/filter/GraphicFormatDetector.cxx  |   14 
 vcl/source/filter/graphicfilter.cxx  |2 
 vcl/source/filter/idxf/dxfentrd.cxx  |   10 
 vcl/source/filter/ieps/ieps.cxx  |2 
 vcl/source/filter/ipdf/pdfdocument.cxx   |   88 
 vcl/source/gdi/WidgetDefinition.cxx  |2 
 vcl/source/gdi/WidgetDefinitionReader.cxx|   68 
 vcl/source/gdi/gdimetafiletools.cxx  |4 
 vcl/source/gdi/gdimtf.cxx|4 
 vcl/source/gdi/mtfxmldump.cxx|  116 -
 vcl/source/gdi/pdfobjectcopier.cxx   |   12 
 vcl/source/gdi/pdfwriter_impl.cxx|   52 
 vcl/source/gdi/pdfwriter_impl2.cxx   |4 
 vcl/source/outdev/gradient.cxx   |4 
 vcl/source/outdev/transparent.cxx|4 
 vcl/source/pdf/XmpMetadata.cxx   |   81 
 vcl/source/treelist/iconview.cxx |2 
 vcl/source/treelist/imap2.cxx|4 
 vcl/source/window/DocWindow.cxx  |2 
 vcl/source/window/floatwin.cxx   |2 
 vcl/unx/generic/app/sm.cxx   |8 
 vcl/unx/generic/fontmanager/helper.cxx   |2 
 vcl/unx/generic/printer/cpdmgr.cxx   |   26 
 vcl/unx/generic/printer/printerinfomanager.cxx   |   34 
 vcl/unx/gtk3/fpicker/SalGtkFilePicker.cxx|2 
 vcl/workben/svpclient.cxx|4 
 39 files changed, 1649 insertions(+), 1556 deletions(-)

New commits:
commit 56c89190a2c717d6c24f2826f3b82ffe41b0ab6e
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 13:22:44 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 19 15:23:35 2023 +0100

Extended loplugin:ostr: vcl

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

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 9b76eb11200e..be6c050ad36d 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -223,7 +223,7 @@ public:
 virtual OString getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, 
bool /*bSizes*/,
  bool /*bHidden*/, bool /*bFiltered*/, 
bool /*bGroups*/)
 {
-return "";
+return ""_ostr;
 }
 
 /**
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 030638e06e75..6e611c4f962c 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -396,7 +396,7 @@ public:
 {
 std::unique_ptr pMap
 = std::make_unique();
-(*pMap)[ACTION_TYPE] = "show";
+(*pMap)[ACTION_TYPE ""_ostr] = "show";
 sendAction(std::move(pMap));
 }
 }
@@ -409,7 +409,7 @@ public:
 {
 std::unique_ptr pMap
 = std::make_unique();
-(*pMap)[ACTION_TYPE] = "hide";
+(*pMap)[ACTION_TYPE ""_ostr] = "hide";
 sendAction(std::move(pMap));
 }
 }
@@ -448,7 +448,7 @@ public:
 {
 BaseInstanceClass::grab_focus();
 std::unique_ptr pMap = 
std::make_unique();
-(*pMap)[ACTION_TYPE] = "grab_focus";
+(*pMap)[ACTION_TYPE ""_ostr] = "grab_focus";
 sendAction(std::move(pMap));
 }
 
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index f694a5778fe7..def963b0510e 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -300,12 +300,13 @@ void JSDialogNotifyIdle::Invoke()
 break;
 
 case jsdialog::MessageType::Popup:
-send(*generatePopupMessage(rMessage.m_pWindow, 
(

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

2023-11-08 Thread Noel Grandin (via logerrit)
 include/vcl/event.hxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 491d62a90a951fcba483c14900eb21213de73e22
Author: Noel Grandin 
AuthorDate: Tue Nov 7 15:01:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 09:22:05 2023 +0100

loplugin:fieldcast in DataChangedEvent

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

diff --git a/include/vcl/event.hxx b/include/vcl/event.hxx
index 58a90b2a764a..83ff1f059e0e 100644
--- a/include/vcl/event.hxx
+++ b/include/vcl/event.hxx
@@ -350,13 +350,13 @@ enum class DataChangedEventType {
 class VCL_DLLPUBLIC DataChangedEvent
 {
 private:
-void*   mpData;
+const AllSettings*  mpData;
 AllSettingsFlagsmnFlags;
 DataChangedEventTypemnType;
 
 public:
 explicitDataChangedEvent( DataChangedEventType nType,
-  const void* pData = nullptr,
+  const AllSettings* pData = 
nullptr,
   AllSettingsFlags nFlags = 
AllSettingsFlags::NONE );
 
 DataChangedEventTypeGetType() const { return mnType; }
@@ -366,10 +366,10 @@ public:
 };
 
 inline DataChangedEvent::DataChangedEvent( DataChangedEventType nType,
-   const void* pData,
+   const AllSettings* pData,
AllSettingsFlags nChangeFlags )
 {
-mpData  = const_cast(pData);
+mpData  = pData;
 mnFlags = nChangeFlags;
 mnType  = nType;
 }
@@ -377,7 +377,7 @@ inline DataChangedEvent::DataChangedEvent( 
DataChangedEventType nType,
 inline const AllSettings* DataChangedEvent::GetOldSettings() const
 {
 if ( mnType == DataChangedEventType::SETTINGS )
-return static_cast(mpData);
+return mpData;
 else
 return nullptr;
 }


[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/Library_vcl.mk vcl/qa vcl/source

2023-10-27 Thread Noel Grandin (via logerrit)
 include/vcl/checksum.hxx  |   44 --
 vcl/Library_vcl.mk|1 
 vcl/qa/cppunit/svm/svmtest.cxx|   22 ++---
 vcl/source/animate/Animation.cxx  |9 +-
 vcl/source/animate/AnimationFrame.cxx |   17 ++-
 vcl/source/bitmap/BitmapEx.cxx|3 
 vcl/source/bitmap/bitmappalette.cxx   |3 
 vcl/source/bitmap/checksum.cxx|  146 -
 vcl/source/bitmap/salbmp.cxx  |7 -
 vcl/source/filter/svm/SvmWriter.cxx   |  149 --
 vcl/source/gdi/pdfwriter_impl.cxx |3 
 vcl/source/gdi/vectorgraphicdata.cxx  |3 
 vcl/source/graphic/GraphicID.cxx  |5 -
 13 files changed, 117 insertions(+), 295 deletions(-)

New commits:
commit 1d86a0b632813efb2259b795b272f8aa40a7c768
Author: Noel Grandin 
AuthorDate: Fri Oct 27 11:18:13 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Oct 27 22:03:24 2023 +0200

tdf#152571 speedup slow draw file save

with lots of images, we seem to spend lots of time calculating
CRC. Replace the vcl checksum/CRC with rtl_crc32 in sal/, which
forwards to the zlib implementation, which has all kinds of
nice SIMD code for performance.

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

diff --git a/include/vcl/checksum.hxx b/include/vcl/checksum.hxx
index 351820e1aefe..ea2c9adb2e51 100644
--- a/include/vcl/checksum.hxx
+++ b/include/vcl/checksum.hxx
@@ -16,18 +16,15 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-
-
-#ifndef INCLUDED_VCL_INC_CHECKSUM_HXX
-#define INCLUDED_VCL_INC_CHECKSUM_HXX
+#pragma once
 
 #include 
 #include 
 #include 
 
-#define BITMAP_CHECKSUM_SIZE 8
+#define BITMAP_CHECKSUM_SIZE 4
 
-typedef sal_uInt64   BitmapChecksum;
+typedef sal_uInt32   BitmapChecksum;
 typedef sal_uInt8   BitmapChecksumOctetArray[BITMAP_CHECKSUM_SIZE];
 
 template< sal_uInt8 N = 0 >
@@ -43,39 +40,4 @@ inline void BCToBCOA< BITMAP_CHECKSUM_SIZE >( 
BitmapChecksum, BitmapChecksumOcte
 return;
 }
 
-extern "C" {
-
-/*
- *
- * vcl_crc64 interface.
- *
- *==*/
-/** Evaluate CRC64 over given data.
-
-This function evaluates the CRC polynomial 0xEDB88320.
-
-@param  Crc[in] CRC64 over previous data or zero.
-@param  Data   [in] data buffer.
-@param  DatLen [in] data buffer length.
-@return new CRC64 value.
- */
-VCL_DLLPUBLIC sal_uInt64 vcl_crc64 (
-sal_uInt64  Crc,
-const void *Data, sal_uInt32 DatLen
-)   SAL_THROW_EXTERN_C();
-
-}
-
-inline BitmapChecksum vcl_get_checksum (
-BitmapChecksum  Checksum,
-const void *Data,
-sal_uInt32 DatLen
-)
-{
-return static_cast(vcl_crc64( Checksum, Data, DatLen ));
-}
-
-
-#endif // INCLUDED_VCL_INC_CHECKSUM_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 4c8162459835..fb9687dc47c0 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -370,7 +370,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/bitmap/BitmapColorQuantizationFilter \
 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter \
 vcl/source/bitmap/BitmapTools \
-vcl/source/bitmap/checksum \
 vcl/source/bitmap/Octree \
 vcl/source/bitmap/salbmp \
 vcl/source/image/Image \
diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx
index d89f2f93118d..2f1ccfd9ecef 100644
--- a/vcl/qa/cppunit/svm/svmtest.cxx
+++ b/vcl/qa/cppunit/svm/svmtest.cxx
@@ -943,11 +943,11 @@ void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile)
 #if defined OSL_BIGENDIAN
 "5e01ddcc"
 #else
-"b8dee5da"
+"469f0820"
 #endif
 }});
 assertXPathAttrs(pDoc, "/metafile/bmpscale[1]", {
-{"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"}, {"crc", 
"281fc589"}
+{"x", "1"}, {"y", "2"}, {"width", "3"}, {"height", "4"}, {"crc", 
"4937e32d"}
 });
 assertXPathAttrs(pDoc, "/metafile/bmpscalepart[1]", {
 {"destx", "1"}, {"desty", "2"}, {"destwidth", "3"}, {"destheight", 
"4"},
@@ -956,7 +956,7 @@ void SvmTest::checkBitmaps(const GDIMetaFile& rMetaFile)
 #if defined OSL_BIGENDIAN
  "b8dee5da"
 #else
- "5e01ddcc"
+ "3789377b"
 #endif
 }
 });
@@ -1018,14 +1018,14 @@ void SvmTest::checkBitmapExs(const GDIMetaFile& 
rMetaFile, bool bIsSvmFile)
 "33b4a07c",
 "742c3e35",
 #else
-"d8377d4f",
-"281fc589",
-"5e01ddcc",
-"4df0e464",
-"17df308f", // 1-bit
-"3c80d829", // 4-bit color bitmap - same as 8-bit color bitmap
-"3c80d829",
-"71efc447",
+"

[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 sw/inc sw/source vcl/source

2023-10-25 Thread Michael Stahl (via logerrit)
 include/vcl/pdfwriter.hxx   |6 +
 sw/inc/EnhancedPDFExportHelper.hxx  |   14 ++-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |  107 +++-
 sw/source/core/text/itrpaint.cxx|4 
 sw/source/core/text/pormulti.cxx|   32 ++-
 vcl/source/gdi/pdfwriter_impl.cxx   |   38 
 6 files changed, 192 insertions(+), 9 deletions(-)

New commits:
commit 949f0d9cf2fe7953691160103139a16473dd3171
Author: Michael Stahl 
AuthorDate: Tue Oct 24 20:05:37 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 25 11:31:01 2023 +0200

vcl,sw: PDF/UA export: produce Ruby and Warichu SEs

These need to generate multiple elements in
SwTextPainter::PaintMultiPortion() and it's not altogether obvious.

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

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index acc491efdfa9..cd8be2a50581 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -132,6 +132,7 @@ public:
 
 // inline level elements
 Span, Quote, Note, Reference, BibEntry, Code, Link, Annot,
+Ruby, RB, RT, RP, Warichu, WT, WP,
 
 // illustration elements
 Figure, Formula, Form
@@ -146,6 +147,7 @@ public:
 TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
 LineHeight, BaselineShift, TextDecorationType, ListNumbering,
 RowSpan, ColSpan, Scope, Role,
+RubyAlign, RubyPosition,
 
 // link destination is an artificial attribute that sets
 // the link annotation ID of a Link element
@@ -186,6 +188,10 @@ public:
 Row, Column, Both,
 // Role
 Rb, Cb, Pb, Tv,
+// RubyAlign
+RStart, RCenter, REnd, RJustify, RDistribute,
+// RubyPosition
+RBefore, RAfter, RWarichu, RInline,
 // ListNumbering
 Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, 
LowerAlpha
 };
diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index 542138157d2f..be3c45383061 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -113,10 +113,15 @@ struct Por_Info
 {
 const SwLinePortion& mrPor;
 const SwTextPainter& mrTextPainter;
-bool const m_isNumberingLabel;
-
-Por_Info(const SwLinePortion& rPor, const SwTextPainter& rTextPainer, bool 
const isNumberingLabel)
-: mrPor(rPor), mrTextPainter(rTextPainer), 
m_isNumberingLabel(isNumberingLabel) {};
+/** this can be used to generate multiple different SE for the same 
portion:
+  FootnoteNum: 0-> Link 1-> Lbl
+  Double: 0-> Warichu 1-> WP 2-> WT
+  Ruby: 0-> Ruby 1-> RT 2-> RB
+*/
+int const m_Mode;
+
+Por_Info(const SwLinePortion& rPor, const SwTextPainter& rTextPainer, int 
const nMode)
+: mrPor(rPor), mrTextPainter(rTextPainer), m_Mode(nMode) {};
 };
 
 struct lt_TableColumn
@@ -160,6 +165,7 @@ class SwTaggedPDFHelper
 void BeginInlineStructureElements();
 void EndStructureElements();
 
+void EndCurrentAll();
 void EndCurrentSpan();
 void CreateCurrentSpan(SwTextPaintInfo const& rInf, OUString const& 
rStyleName);
 bool CheckContinueSpan(SwTextPaintInfo const& rInf, std::u16string_view 
rStyleName, SwTextAttr const* pInetFormatAttr);
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 999e599b4478..f9702e28b19a 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -71,6 +71,7 @@
 #include 
 #include 
 #include "porfld.hxx"
+#include "pormulti.hxx"
 #include 
 #include "itrpaint.hxx"
 #include 
@@ -935,6 +936,51 @@ void SwTaggedPDFHelper::SetAttributes( 
vcl::PDFWriter::StructElement eType )
 bLanguage = true;
 break;
 
+case vcl::PDFWriter::RT:
+{
+SwRubyPortion const*const pRuby(static_cast(pPor));
+vcl::PDFWriter::StructAttributeValue nAlign = {};
+switch (pRuby->GetAdjustment())
+{
+case text::RubyAdjust_LEFT:
+nAlign = vcl::PDFWriter::RStart;
+break;
+case text::RubyAdjust_CENTER:
+nAlign = vcl::PDFWriter::RCenter;
+break;
+case text::RubyAdjust_RIGHT:
+nAlign = vcl::PDFWriter::REnd;
+break;
+case text::RubyAdjust_BLOCK:
+nAlign = vcl::PDFWriter::RJustify;
+break;
+case text:

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

2023-10-24 Thread Noel Grandin (via logerrit)
 include/vcl/uitest/uiobject.hxx |6 +-
 sw/qa/uitest/navigator/movechapterupdown.py |   10 
 sw/qa/uitest/navigator/tdf134960.py |9 ---
 sw/qa/uitest/navigator/tdf137274.py |9 ---
 sw/qa/uitest/navigator/tdf144672.py |   10 
 sw/qa/uitest/navigator/tdf151051.py |   10 
 sw/qa/uitest/navigator/tdf154212.py |   10 
 sw/qa/uitest/writer_tests7/tdf135938.py |   19 
 vcl/source/treelist/uiobject.cxx|   66 +---
 9 files changed, 45 insertions(+), 104 deletions(-)

New commits:
commit 4edff633dd36ea47d17a993e0afb30fcfc4f9a61
Author: Noel Grandin 
AuthorDate: Tue Oct 24 15:22:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 24 18:22:58 2023 +0200

tdf#153519 make TreeListEntryUIObject safer

Do not store a raw pointer to an object that go away.
Consequently we can remove the various sleep() hacks

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

diff --git a/include/vcl/uitest/uiobject.hxx b/include/vcl/uitest/uiobject.hxx
index 293471add9b5..d27140b2c21b 100644
--- a/include/vcl/uitest/uiobject.hxx
+++ b/include/vcl/uitest/uiobject.hxx
@@ -492,7 +492,7 @@ class TreeListEntryUIObject final : public UIObject
 {
 public:
 
-TreeListEntryUIObject(const VclPtr& xTreeList, 
SvTreeListEntry* pEntry);
+TreeListEntryUIObject(const VclPtr& xTreeList, 
std::vector nTreePath);
 
 virtual StringMap get_state() override;
 
@@ -507,9 +507,11 @@ public:
 
 private:
 
+SvTreeListEntry* getEntry() const;
+
 VclPtr mxTreeList;
 
-SvTreeListEntry* const mpEntry;
+std::vector maTreePath;
 };
 
 class IconViewUIObject final : public TreeListUIObject
diff --git a/sw/qa/uitest/navigator/movechapterupdown.py 
b/sw/qa/uitest/navigator/movechapterupdown.py
index c9e41a0971cd..6bcda9b3d4bb 100644
--- a/sw/qa/uitest/navigator/movechapterupdown.py
+++ b/sw/qa/uitest/navigator/movechapterupdown.py
@@ -10,7 +10,6 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-import time
 
 class movechapterupdown(UITestCase):
 
@@ -26,15 +25,6 @@ class movechapterupdown(UITestCase):
 # wait until the navigator panel is available
 xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
 
-# HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the 
SwContentTree ctor in
-# sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is 
started by
-# SwContentTree::ShowTree triggered from the SIDEBAR action above, 
and which can
-# invalidate the TreeListEntryUIObjects used by the below code (see
-# 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of 
TreeListEntryUIObject as
-# dubious"); lets double that 1000 ms timeout value here to 
hopefully be on the safe
-# side:
-time.sleep(2)
-
 # Given the document chapter structure:
 # 1. One H1
 #   1.1. one_A (H2)
diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
index 270e9d347abb..8388b63e40f9 100644
--- a/sw/qa/uitest/navigator/tdf134960.py
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -9,7 +9,6 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
-import time
 
 class tdf134960_hyperlinks(UITestCase):
 
@@ -28,14 +27,6 @@ class tdf134960_hyperlinks(UITestCase):
 # wait until the navigator panel is available
 xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
 
-# HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the SwContentTree 
ctor in
-# sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is 
started by
-# SwContentTree::ShowTree triggered from the SIDEBAR action above, and 
which can invalidate
-# the TreeListEntryUIObjects used by the below code (see
-# 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of 
TreeListEntryUIObject as
-# dubious"); lets double that 1000 ms timeout value here to hopefully 
be on the safe side:
-time.sleep(2)
-
 xContentTree = xNavigatorPanel.getChild("contenttree")
 xHyperlinks = self.get_item(xContentTree, 'Hyperlinks')
 self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text'])
diff --git a/sw/qa/uitest/navigator/tdf137274.py 
b/sw/qa/uitest/navigator/tdf137274.py
index 9bd780a7e5c2..5273ddcb2f91 100644
--- a/sw/qa/uitest/navigator/tdf137274.py
+++ b/sw/qa/uitest/navigator/tdf137274.py
@@ -42,15 +42,6 @@ class tdf137274(UITestCase):
   

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

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

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

vcl: migrate text layout functions out of OutputDevice

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

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

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

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

2023-10-22 Thread Andrea Gelmini (via logerrit)
 include/vcl/accessibility/AccessibleTextAttributeHelper.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c0ed629732571f438a1f2e7afd37bff82ce62740
Author: Andrea Gelmini 
AuthorDate: Sun Oct 22 03:38:43 2023 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 22 13:03:32 2023 +0200

Fix typo

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

diff --git a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx 
b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
index d0d49c3209b3..00c9c383929a 100644
--- a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
+++ b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
@@ -54,7 +54,7 @@ public:
 /** Converts UNO text attribute properties to a string holding
  *  the corresponding IAccessible2 text attributes.
  * @param rUnoAttributes A sequence holding the UNO text attributes.
- * @param eAttributeType: Thy type(s) of attributes of interest.
+ * @param eAttributeType: The type(s) of attributes of interest.
  * @returns String holding the corresponding IAccessible2 text properties.
  */
 static OUString ConvertUnoToIAccessible2TextAttributes(
@@ -64,7 +64,7 @@ public:
 /**
  * Get the IAccessible2 text attributes and the span of the attributes at 
the given index.
  * @param xText The interface to query for the information.
- * @param eAttributeType: Thy type(s) of attributes of interest.
+ * @param eAttributeType: The type(s) of attributes of interest.
  * @param nOffset Character offset for which to retrieve the information.
  * @param rStartOffset Out param that is set to the start index of the 
attribute run.
  * @param rEndOffset Out param that is set to the end index of the 
attribute run.


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

2023-10-18 Thread Andrea Gelmini (via logerrit)
 include/vcl/accessibility/AccessibleTextAttributeHelper.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fdad35d096dc642c80998ae8f832ebca183f545e
Author: Andrea Gelmini 
AuthorDate: Wed Oct 18 17:59:02 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed Oct 18 21:11:17 2023 +0200

Fix typo

Change-Id: Ie54bc5f012d2de46363da9d19278736a732a1a25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158125
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx 
b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
index 8c4b43b99e11..c5e02a04e85c 100644
--- a/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
+++ b/include/vcl/accessibility/AccessibleTextAttributeHelper.hxx
@@ -38,7 +38,7 @@ public:
 
 /**
  * Get the IAccessible2 text attributes and the span of the attributes at 
the given index.
- * @param xText The interace to query for the information.
+ * @param xText The interface to query for the information.
  * @param nOffset Character offset for which to retrieve the information.
  * @param rStartOffset Out param that is set to the start index of the 
attribute run.
  * @param rEndOffset Out param that is set to the end index of the 
attribute run.


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

2023-10-17 Thread Noel Grandin (via logerrit)
 include/vcl/alpha.hxx |9 
 vcl/qa/cppunit/BitmapExTest.cxx   |   77 ++
 vcl/source/bitmap/BitmapEx.cxx|5 --
 vcl/source/bitmap/alpha.cxx   |   31 +++
 vcl/source/bitmap/bitmappaint.cxx |3 +
 5 files changed, 122 insertions(+), 3 deletions(-)

New commits:
commit dcaa66e4663111f563eab54aae7e1d73e1ae8e44
Author: Noel Grandin 
AuthorDate: Tue Oct 17 10:25:25 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Oct 17 19:06:38 2023 +0200

tdf#157792 FILEOPEN: PPT: logo not displayed

regression from
commit 3622404f09448b82c095256140afe6240b522ece
Author: Noel Grandin 
Date:   Wed Oct 11 12:54:43 2023 +0200
tdf#157636 FILEOPEN: PPT: Images have no background

But actually from
commit 81994cb2b8b32453a92bcb011830fcb884f22ffe
Convert internal vcl bitmap formats transparency->alpha (II)

where BitmapEx::CombineMaskOr was not properly updated.

To make this stuff more obvious, add a version of CombineOr
called AlphaCombineOr that only operates on AlphaMask objects.

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

diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index d10d4dcc7f31..9c6b1070ed53 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -51,6 +51,15 @@ public:
 voidErase( sal_uInt8 cTransparency );
 voidBlendWith(const AlphaMask& rOther);
 
+/** Perform boolean OR operation with another alpha-mask
+
+@param rMask
+The mask bitmap in the selected combine operation
+
+@return true, if the operation was completed successfully.
+ */
+boolAlphaCombineOr( const AlphaMask& rMask );
+
 // check if alpha is used, returns true if at least one pixel has 
transparence
 boolhasAlpha() const;
 
diff --git a/vcl/qa/cppunit/BitmapExTest.cxx b/vcl/qa/cppunit/BitmapExTest.cxx
index 9e5da1c9fab6..757cc8999538 100644
--- a/vcl/qa/cppunit/BitmapExTest.cxx
+++ b/vcl/qa/cppunit/BitmapExTest.cxx
@@ -25,12 +25,16 @@ class BitmapExTest : public CppUnit::TestFixture
 void testGetPixelColor32();
 void testTransformBitmapEx();
 void testAlphaBlendWith();
+void testCreateMask();
+void testCombineMaskOr();
 
 CPPUNIT_TEST_SUITE(BitmapExTest);
 CPPUNIT_TEST(testGetPixelColor24_8);
 CPPUNIT_TEST(testGetPixelColor32);
 CPPUNIT_TEST(testTransformBitmapEx);
 CPPUNIT_TEST(testAlphaBlendWith);
+CPPUNIT_TEST(testCreateMask);
+CPPUNIT_TEST(testCombineMaskOr);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -167,6 +171,79 @@ void BitmapExTest::testAlphaBlendWith()
  AlphaMask::ScopedReadAccess(alpha)->GetPixelIndex(0, 
0));
 }
 
+void BitmapExTest::testCreateMask()
+{
+Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
+{
+BitmapScopedWriteAccess pWriteAccess(aBitmap);
+pWriteAccess->Erase(COL_WHITE);
+for (int i = 0; i < 3; ++i)
+pWriteAccess->SetPixel(i, i, COL_RED);
+}
+aBitmap = aBitmap.CreateMask(COL_RED, 1);
+Bitmap::ScopedReadAccess pAccess(aBitmap);
+// the output is a greyscale palette bitmap
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(0, 0));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(0, 1));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(0, 2));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(1, 0));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(1, 1));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(1, 2));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(2, 0));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x00), pAccess->GetPixelIndex(2, 1));
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->GetPixelIndex(2, 2));
+}
+
+void BitmapExTest::testCombineMaskOr()
+{
+Bitmap aBitmap(Size(3, 3), vcl::PixelFormat::N24_BPP);
+{
+BitmapScopedWriteAccess pWriteAccess(aBitmap);
+pWriteAccess->Erase(COL_WHITE);
+for (int i = 0; i < 3; ++i)
+pWriteAccess->SetPixel(1, i, COL_RED);
+}
+AlphaMask aAlphaBitmap(Size(3, 3));
+{
+BitmapScopedWriteAccess pWriteAccess(aAlphaBitmap);
+pWriteAccess->Erase(Color(0xff, 0xff, 0xff));
+for (int i = 1; i < 3; ++i)
+{
+pWriteAccess->SetPixel(i, 0, Color(0x00, 0x00, 0x00));
+pWriteAccess->SetPixel(i, 1, Color(0x80, 0x80, 0x80));
+pWriteAccess->SetPixel(i, 0, Color(0xef, 0xef, 0xef));
+}
+}
+
+{
+AlphaMask aMask = aBitmap.CreateAlphaMask(COL_RED, 1);
+Bitmap::ScopedReadAccess pAccess(aMask);
+// the output is a greyscale palette bitmap
+CPPUNIT_ASSERT_EQUAL(sal_uInt8(0xff), pAccess->Get

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

2023-10-11 Thread Noel Grandin (via logerrit)
 include/vcl/metric.hxx|   50 +-
 vcl/qa/cppunit/fontmetric.cxx |   28 +++
 2 files changed, 39 insertions(+), 39 deletions(-)

New commits:
commit 6f45c0cf86b21772740bb0cafb3d462b058523f3
Author: Noel Grandin 
AuthorDate: Tue Oct 10 13:19:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Oct 11 11:19:10 2023 +0200

cool#7318 Calc rendering acceleration

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 on 64-bit machines, where tools::Long is
64-bit, which is quite unnecessary for FontMetric fields.

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

diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index 1e03232d70f7..5cf1d6e23246 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -40,23 +40,23 @@ public:
 FontMetric(vcl::font::PhysicalFontFace const& rFace);
 ~FontMetric() override;
 
-tools::LongGetAscent() const   { 
return mnAscent; }
-tools::LongGetDescent() const  { 
return mnDescent; }
-tools::LongGetInternalLeading() const  { 
return mnIntLeading; }
-tools::LongGetExternalLeading() const  { 
return mnExtLeading; }
-tools::LongGetLineHeight() const   { 
return mnLineHeight; } // TODO this is ascent + descnt
-tools::LongGetSlant() const{ 
return mnSlant; }
-tools::LongGetBulletOffset() const { 
return mnBulletOffset; }
-tools::LongGetHangingBaseline() const  { 
return mnHangingBaseline; }
-
-voidSetAscent( tools::Long nAscent )   { 
mnAscent = nAscent; }
-voidSetDescent( tools::Long nDescent ) { 
mnDescent = nDescent; }
-voidSetExternalLeading( tools::Long nExtLeading )  { 
mnExtLeading = nExtLeading; }
-voidSetInternalLeading( tools::Long nIntLeading )  { 
mnIntLeading = nIntLeading; }
-voidSetLineHeight( tools::Long nHeight )   { 
mnLineHeight = nHeight; } // TODO this is ascent + descent
-voidSetSlant( tools::Long nSlant ) { 
mnSlant = nSlant; }
-voidSetBulletOffset( tools::Long nOffset ) { 
mnBulletOffset = nOffset; }
-voidSetHangingBaseline( tools::Long nBaseline ){ 
mnHangingBaseline = nBaseline; }
+sal_Int32   GetAscent() const   { return 
mnAscent; }
+sal_Int32   GetDescent() const  { return 
mnDescent; }
+sal_Int32   GetInternalLeading() const  { return 
mnIntLeading; }
+sal_Int32   GetExternalLeading() const  { return 
mnExtLeading; }
+sal_Int32   GetLineHeight() const   { return 
mnLineHeight; } // TODO this is ascent + descnt
+sal_Int32   GetSlant() const{ return 
mnSlant; }
+sal_Int32   GetBulletOffset() const { return 
mnBulletOffset; }
+sal_Int32   GetHangingBaseline() const  { return 
mnHangingBaseline; }
+
+voidSetAscent( sal_Int32 nAscent )   { 
mnAscent = nAscent; }
+voidSetDescent( sal_Int32 nDescent ) { 
mnDescent = nDescent; }
+voidSetExternalLeading( sal_Int32 nExtLeading )  { 
mnExtLeading = nExtLeading; }
+voidSetInternalLeading( sal_Int32 nIntLeading )  { 
mnIntLeading = nIntLeading; }
+voidSetLineHeight( sal_Int32 nHeight )   { 
mnLineHeight = nHeight; } // TODO this is ascent + descent
+voidSetSlant( sal_Int32 nSlant ) { 
mnSlant = nSlant; }
+voidSetBulletOffset( sal_Int32 nOffset ) { 
mnBulletOffset = nOffset; }
+voidSetHangingBaseline( sal_Int32 nBaseline ){ 
mnHangingBaseline = nBaseline; }
 
 boolIsFullstopCentered() const  { return 
mbFullstopCentered; }
 
@@ -77,14 +77,14 @@ public:
 private:
 boolEqualNoBase( const FontMetric& ) const;
 size_t  GetHashValueNoBase() const;
-tools::LongmnAscent;  // Ascent
-tools::LongmnDescent;   

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

2023-10-04 Thread Michael Stahl (via logerrit)
 include/vcl/pdfextoutdevdata.hxx|9 ++---
 sw/source/core/text/EnhancedPDFExportHelper.cxx |3 +--
 vcl/source/gdi/pdfextoutdevdata.cxx |   19 +--
 3 files changed, 12 insertions(+), 19 deletions(-)

New commits:
commit 1ea27b7e35faf6619112bf3f1d69e4ec41c0bf23
Author: Michael Stahl 
AuthorDate: Mon Oct 2 20:42:41 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 4 11:43:40 2023 +0200

vcl: remove defensive programming from SetCurrentStructureElement()

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

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 631ba74eadfa..199f30a00c59 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -405,14 +405,9 @@ public:
 
 
 @param nElement
-the id of the new current structure element
-
-@returns
-True if the current structure element could be set successfully
-False if the current structure element could not be changed
-(e.g. if the passed element id is invalid)
+the id of the new current structure element, which must be valid
  */
-bool SetCurrentStructureElement( sal_Int32 nElement );
+void SetCurrentStructureElement( sal_Int32 nElement );
 /** get the current structure element id
 
 @returns
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 9ebc233dc687..b71b699b8e36 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -478,8 +478,7 @@ void SwTaggedPDFHelper::CheckRestoreTag() const
 {
 if ( m_nRestoreCurrentTag != -1 )
 {
-const bool bSuccess = mpPDFExtOutDevData->SetCurrentStructureElement( 
m_nRestoreCurrentTag );
-OSL_ENSURE( bSuccess, "Failed to restore reopened tag" );
+mpPDFExtOutDevData->SetCurrentStructureElement( m_nRestoreCurrentTag );
 
 #if OSL_DEBUG_LEVEL > 1
 aStructStack.pop_back();
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx 
b/vcl/source/gdi/pdfextoutdevdata.cxx
index 7719d6bb97d1..1eac67561084 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -851,25 +851,24 @@ sal_Int32 PDFExtOutDevData::WrapBeginStructureElement(
 
 void PDFExtOutDevData::EndStructureElement()
 {
+assert(mpGlobalSyncData->mCurrentStructElement != 0); // underflow?
 mpPageSyncData->PushAction( mrOutDev, 
PDFExtOutDevDataSync::EndStructureElement );
 mpGlobalSyncData->mCurrentStructElement = 
mpGlobalSyncData->mStructParents[ mpGlobalSyncData->mCurrentStructElement ];
 }
-bool PDFExtOutDevData::SetCurrentStructureElement( sal_Int32 nStructId )
+
+void PDFExtOutDevData::SetCurrentStructureElement(sal_Int32 const nStructId)
 {
-bool bSuccess = false;
-if( o3tl::make_unsigned(nStructId) < 
mpGlobalSyncData->mStructParents.size() )
-{
-mpGlobalSyncData->mCurrentStructElement = nStructId;
-mpPageSyncData->PushAction( mrOutDev, 
PDFExtOutDevDataSync::SetCurrentStructureElement );
-mpPageSyncData->mParaInts.push_back( nStructId );
-bSuccess = true;
-}
-return bSuccess;
+assert(o3tl::make_unsigned(nStructId) < 
mpGlobalSyncData->mStructParents.size());
+mpGlobalSyncData->mCurrentStructElement = nStructId;
+mpPageSyncData->PushAction( mrOutDev, 
PDFExtOutDevDataSync::SetCurrentStructureElement );
+mpPageSyncData->mParaInts.push_back( nStructId );
 }
+
 sal_Int32 PDFExtOutDevData::GetCurrentStructureElement() const
 {
 return mpGlobalSyncData->mCurrentStructElement;
 }
+
 void PDFExtOutDevData::SetStructureAttribute( PDFWriter::StructAttribute 
eAttr, PDFWriter::StructAttributeValue eVal )
 {
 mpPageSyncData->PushAction( mrOutDev, 
PDFExtOutDevDataSync::SetStructureAttribute );


[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 svx/source

2023-09-26 Thread Caolán McNamara (via logerrit)
 include/vcl/formatter.hxx  |6 ++
 svx/source/fmcomp/gridcell.cxx |   14 --
 2 files changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 9b7c732215f2dc34d1f0cfc08ea912a3925b13b0
Author: Caolán McNamara 
AuthorDate: Tue Sep 26 10:42:06 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue Sep 26 13:32:28 2023 +0200

Resolves: tdf#151919 mark blanked fields as requiring a reformat

the next time a format is requested, even if the value of the
Formatter is the same, otherwise if the value is the same it
will remain blank.

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

diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx
index 4aa81ea1be30..54d6745587e1 100644
--- a/include/vcl/formatter.hxx
+++ b/include/vcl/formatter.hxx
@@ -186,6 +186,12 @@ public:
 // If the current String is invalid, GetValue() returns this value
 double  GetDefaultValue() const { return m_dDefaultValue; }
 
+// Make the formatter recreate the output text from the value on the next
+// format attempt even if the value is the same as the current value.
+// Needed if the associated widget had its text changed by something other
+// that this Formatter (typically blanked out) since the last formatting
+voidInvalidateValueState(){ m_ValueState = valueDirty; }
+
 void SetLastSelection(const Selection& rSelection) { m_aLastSelection = 
rSelection; }
 
 // Settings for the format
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 2bf339a19135..cb8ccf91955f 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2067,15 +2067,16 @@ void DbNumericField::updateFromModel( Reference< 
XPropertySet > _rxModel )
 OSL_ENSURE( _rxModel.is() && m_pWindow, "DbNumericField::updateFromModel: 
invalid call!" );
 
 FormattedControlBase* pControl = 
static_cast(m_pWindow.get());
+Formatter& rFormatter = pControl->get_formatter();
 
 double dValue = 0;
 if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
-{
-Formatter& rFormatter = pControl->get_formatter();
 rFormatter.SetValue(dValue);
-}
 else
+{
 pControl->get_widget().set_text(OUString());
+rFormatter.InvalidateValueState();
+}
 }
 
 bool DbNumericField::commitControl()
@@ -2187,15 +2188,16 @@ void DbCurrencyField::updateFromModel( Reference< 
XPropertySet > _rxModel )
 OSL_ENSURE( _rxModel.is() && m_pWindow, "DbCurrencyField::updateFromModel: 
invalid call!" );
 
 FormattedControlBase* pControl = 
static_cast(m_pWindow.get());
+Formatter& rFormatter = pControl->get_formatter();
 
 double dValue = 0;
 if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
-{
-Formatter& rFormatter = pControl->get_formatter();
 rFormatter.SetValue(dValue);
-}
 else
+{
 pControl->get_widget().set_text(OUString());
+rFormatter.InvalidateValueState();
+}
 }
 
 bool DbCurrencyField::commitControl()


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

2023-09-05 Thread sahil (via logerrit)
 include/vcl/commandevent.hxx|2 +-
 sd/source/ui/view/viewshel.cxx  |2 +-
 vcl/source/control/imivctl1.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b4dd91f3a10610924e736445e17506b49b619a70
Author: sahil 
AuthorDate: Sun Aug 13 14:17:20 2023 +0530
Commit: Hossein 
CommitDate: Tue Sep 5 22:51:55 2023 +0200

tdf#114441 - Convert use of sal_uLong to better integer types

Updated scrolling related variables to double from sal_uLong

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

diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index fc6ba290793f..9491137acea8 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -139,7 +139,7 @@ enum class CommandWheelMode
 };
 
 // Magic value used in mnLines field in CommandWheelData
-#define COMMAND_WHEEL_PAGESCROLL(sal_uLong(0x))
+#define COMMAND_WHEEL_PAGESCROLL(double(0x))
 
 class VCL_DLLPUBLIC CommandWheelData
 {
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index d4007eb77510..91fa6a2e4b53 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -736,7 +736,7 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& 
rCEvt, ::sd::Window* pWi
 {
 if( mpContentWindow.get() == pWin )
 {
-sal_uLong nScrollLines = pData->GetScrollLines();
+double nScrollLines = pData->GetScrollLines();
 if(IsPageFlipMode())
 nScrollLines = COMMAND_WHEEL_PAGESCROLL;
 CommandWheelData aWheelData( 
pData->GetDelta(),pData->GetNotchDelta(),
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index ae297a82e107..1364dc4f44d0 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -1844,7 +1844,7 @@ bool SvxIconChoiceCtrl_Impl::HandleScrollCommand( const 
CommandEvent& rCmd )
 const CommandWheelData* pData = rCmd.GetWheelData();
 if( pData && (CommandWheelMode::SCROLL == pData->GetMode()) && 
!pData->IsHorz() )
 {
-sal_uLong nScrollLines = pData->GetScrollLines();
+double nScrollLines = pData->GetScrollLines();
 if( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
 {
 nScrollDY = GetScrollBarPageSize( aVisSize.Width() );


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

2023-09-04 Thread Khaled Hosny (via logerrit)
 include/vcl/outdev.hxx|6 ++--
 starmath/inc/visitors.hxx |7 -
 starmath/source/ElementsDockingWindow.cxx |2 -
 starmath/source/document.cxx  |   41 ++
 starmath/source/visitors.cxx  |   15 ++
 5 files changed, 56 insertions(+), 15 deletions(-)

New commits:
commit fb43c497f2cc71c988a967fa0126c27561f8c16d
Author: Khaled Hosny 
AuthorDate: Wed Aug 16 15:17:41 2023 +0300
Commit: خالد حسني 
CommitDate: Mon Sep 4 18:17:15 2023 +0200

tdf#134193: Support rendering math in RTL mode

Respect IsRightToLeft property and render accordingly.

This also fixes math rendering in RTL UI, which was incorrectly rendered 
RTL.

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

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 898939978daa..f2fdf7ab7db7 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1217,9 +1217,9 @@ public:
 
 // tells whether this output device is RTL in an LTR UI or LTR in a RTL UI
 SAL_DLLPRIVATE bool ImplIsAntiparallel() const ;
-SAL_DLLPRIVATE void ReMirror( Point &rPoint ) const;
-SAL_DLLPRIVATE void ReMirror( tools::Rectangle &rRect ) const;
-SAL_DLLPRIVATE void ReMirror( vcl::Region &rRegion ) const;
+   void ReMirror( Point &rPoint ) const;
+   void ReMirror( tools::Rectangle &rRect ) const;
+   void ReMirror( vcl::Region &rRegion ) const;
 SAL_DLLPRIVATE bool ImplIsRecordLayout() const;
 virtual boolHasMirroredGraphics() const;
 std::unique_ptr
diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx
index eaf329034c7d..c1a2a8983286 100644
--- a/starmath/inc/visitors.hxx
+++ b/starmath/inc/visitors.hxx
@@ -211,12 +211,16 @@ public:
  * @param rDevice   Device to draw on
  * @param position  Offset on device to draw the formula
  * @param pTree Formula tree to draw
+ * @param rFormat   Formula formatting settings
  * @remarks This constructor will do the drawing, no need to anything more.
  */
-SmDrawingVisitor( OutputDevice &rDevice, Point position, SmNode* pTree )
+SmDrawingVisitor( OutputDevice &rDevice, Point position, SmNode* pTree, 
const SmFormat& rFormat )
 : mrDev( rDevice )
 , maPosition( position )
+, mrFormat( rFormat )
 {
+if (mrFormat.IsRightToLeft())
+mrDev.ReMirror(maPosition);
 pTree->Accept( this );
 }
 virtual ~SmDrawingVisitor() {}
@@ -265,6 +269,7 @@ private:
 so if needed cache it locally on the stack.
  */
 Point maPosition;
+const SmFormat& mrFormat;
 };
 
 // SmSetSelectionVisitor
diff --git a/starmath/source/ElementsDockingWindow.cxx 
b/starmath/source/ElementsDockingWindow.cxx
index 7fdfb3b3ec49..d1feabd921a9 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -546,7 +546,7 @@ void SmElementsControl::addElement(const OUString& 
aElementVisual, const OUStrin
 Size aSize = pDevice->LogicToPixel(Size(pNode->GetWidth(), 
pNode->GetHeight()));
 aSize.extendBy(10, 0); // Add 5 pixels from both sides to accommodate 
extending parts of italics
 pDevice->SetOutputSizePixel(aSize);
-SmDrawingVisitor(*pDevice, pDevice->PixelToLogic(Point(5, 0)), 
pNode.get());
+SmDrawingVisitor(*pDevice, pDevice->PixelToLogic(Point(5, 0)), 
pNode.get(), maFormat);
 
 maItemDatas.push_back(std::make_unique(aElementSource, 
aHelpText));
 const OUString aId(weld::toId(maItemDatas.back().get()));
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index c0f28ac18190..9bdaad7530e6 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -261,10 +261,18 @@ void SmDocShell::ArrangeFormula()
 const SmFormat &rFormat = GetFormat();
 mpTree->Prepare(rFormat, *this, 0);
 
-// format/draw formulas always from left to right,
-// and numbers should not be converted
-pOutDev->Push(vcl::PushFlags::TEXTLAYOUTMODE | 
vcl::PushFlags::TEXTLANGUAGE);
-pOutDev->SetLayoutMode( vcl::text::ComplexTextLayoutFlags::Default );
+pOutDev->Push(vcl::PushFlags::TEXTLAYOUTMODE | 
vcl::PushFlags::TEXTLANGUAGE |
+  vcl::PushFlags::RTLENABLED);
+
+// We want the device to always be LTR, we handle RTL formulas ourselves.
+pOutDev->EnableRTL(false);
+
+// For RTL formulas, we want the brackets to be mirrored.
+bool bRTL = GetFormat().IsRightToLeft();
+pOutDev->SetLayoutMode(bRTL ? vcl::text::ComplexTextLayoutFlags::BiDiRtl
+: vcl::text::ComplexTextLayoutFlags::Default);
+
+// Numbers should not be converted, for now.
 

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

2023-08-30 Thread Michael Weghorn (via logerrit)
 include/vcl/toolkit/svtabbx.hxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit c2b621b6d9f41d269b4d1aafc5e8911dde51d607
Author: Michael Weghorn 
AuthorDate: Tue Aug 29 18:17:40 2023 +0200
Commit: Michael Weghorn 
CommitDate: Wed Aug 30 09:25:24 2023 +0200

a11y: Drop AccessibleChildren typedef

It's only used a single time anyway.

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

diff --git a/include/vcl/toolkit/svtabbx.hxx b/include/vcl/toolkit/svtabbx.hxx
index c154969678b9..1fd7b8b16e12 100644
--- a/include/vcl/toolkit/svtabbx.hxx
+++ b/include/vcl/toolkit/svtabbx.hxx
@@ -93,12 +93,10 @@ namespace vcl {
 class VCL_DLLPUBLIC SvHeaderTabListBox : public SvTabListBox, public 
vcl::IAccessibleTableProvider
 {
 private:
-typedef ::std::vector< css::uno::Reference< 
css::accessibility::XAccessible > > AccessibleChildren;
-
 boolm_bFirstPaint;
 std::unique_ptr<::vcl::SvHeaderTabListBoxImpl>  m_pImpl;
 ::vcl::IAccessibleTabListBox*   m_pAccessible;
-AccessibleChildren  m_aAccessibleChildren;
+std::vector> 
m_aAccessibleChildren;
 
 DECL_DLLPRIVATE_LINK( ScrollHdl_Impl, SvTreeListBox*, void );
 DECL_DLLPRIVATE_LINK( CreateAccessibleHdl_Impl, HeaderBar*, void );


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

2023-08-29 Thread Andrea Gelmini (via logerrit)
 include/vcl/pdfwriter.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 748d21a4675321f88bcd5fa4bec190ac32e87502
Author: Andrea Gelmini 
AuthorDate: Tue Aug 29 21:22:47 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed Aug 30 07:12:15 2023 +0200

Fix typo

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

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index d49c173bc7d8..796c1f03cd9b 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -1178,7 +1178,7 @@ The following structure describes the permissions used in 
PDF security
  */
 void SetActualText( const OUString& rText );
 
-/** set the Alt attribute of a strutural element
+/** set the Alt attribute of a structural element
 
 Alt is s replacement text describing the contents of a structural element. 
This
 is mainly used by accessibility applications; e.g. a screen reader would 
read


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

2023-08-29 Thread Andrea Gelmini (via logerrit)
 include/vcl/pdfextoutdevdata.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7ceecfbf209d99d9e1cd2fd97175a5ee7b081808
Author: Andrea Gelmini 
AuthorDate: Tue Aug 29 14:10:45 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Aug 29 14:55:07 2023 +0200

Fix typo

Change-Id: If4a80e7a3427e88f29e6ee36d05ec96ae820b60e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156249
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 6fe6eb1f391d..631ba74eadfa 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -477,7 +477,7 @@ public:
  */
 void SetActualText( const OUString& rText );
 
-/** set the Alt attribute of a strutural element
+/** set the Alt attribute of a structural element
 
 Alt is s replacement text describing the contents of a structural element. 
This
 is mainly used by accessibility applications; e.g. a screen reader would 
read


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

2023-08-29 Thread Michael Stahl (via logerrit)
 include/vcl/pdfextoutdevdata.hxx|6 +
 sw/inc/EnhancedPDFExportHelper.hxx  |   30 --
 sw/source/core/text/EnhancedPDFExportHelper.cxx |  103 +---
 3 files changed, 68 insertions(+), 71 deletions(-)

New commits:
commit 74b3a0fe9840c6076fd805db7cf8a66f056c5832
Author: Michael Stahl 
AuthorDate: Tue Aug 29 12:11:41 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Aug 29 13:52:13 2023 +0200

vcl,sw: PDF export: move SwEnhancedPDFExportHelper statics to member

New struct SwEnhancedPDFState to contain the state; it is transported
from SwEnhancedPDFExportHelper instance to SwTaggedPDFHelper instances
via vcl::PDFExtOutDevData.

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

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index fe7425d26d82..6fe6eb1f391d 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -31,6 +31,7 @@
 class Graphic;
 class GDIMetaFile;
 class SdrObject;
+struct SwEnhancedPDFState;
 
 namespace vcl
 {
@@ -96,6 +97,8 @@ class VCL_DLLPUBLIC PDFExtOutDevData final : public 
ExtOutDevData
 // map from annotation SdrObject to annotation index
 ::std::map> m_ScreenAnnotations;
 
+SwEnhancedPDFState * m_pSwPDFState = nullptr;
+
 public:
 
 PDFExtOutDevData( const OutputDevice& rOutDev );
@@ -153,6 +156,9 @@ public:
 std::vector< PDFExtOutDevBookmarkEntry >& GetBookmarks() { return 
maBookmarks;}
 const std::vector& GetChapterNames() const { return 
maChapterNames; }
 
+SwEnhancedPDFState * GetSwPDFState() { return m_pSwPDFState; }
+void SetSwPDFState(SwEnhancedPDFState *const pSwPDFState) { m_pSwPDFState 
= pSwPDFState; }
+
 const Graphic& GetCurrentGraphic() const;
 
 /** Start a new group of render output
diff --git a/sw/inc/EnhancedPDFExportHelper.hxx 
b/sw/inc/EnhancedPDFExportHelper.hxx
index a6fad2594ae8..6a505ff7 100644
--- a/sw/inc/EnhancedPDFExportHelper.hxx
+++ b/sw/inc/EnhancedPDFExportHelper.hxx
@@ -24,10 +24,8 @@
 #include "swrect.hxx"
 #include "swtypes.hxx"
 
-#include 
 #include 
 #include 
-#include 
 
 namespace vcl
 {
@@ -176,7 +174,7 @@ class SwTaggedPDFHelper
 /*
  * Analyses the document structure and export Notes, Hyperlinks, References,
  * and Outline. Link ids created during pdf export are stored in
- * aReferenceIdMap and aHyperlinkIdMap, in order to use them during
+ * SwEnhancedPDFState, in order to use them during
  * tagged pdf output. Therefore the SwEnhancedPDFExportHelper is used
  * before painting. Unfortunately links from the EditEngine into the
  * Writer document require to be exported after they have been painted.
@@ -184,14 +182,6 @@ class SwTaggedPDFHelper
  * painting process, the parameter bEditEngineOnly indicated that only
  * the bookmarks from the EditEngine have to be processed.
  */
-typedef std::set< tools::Long, lt_TableColumn > TableColumnsMapEntry;
-typedef std::pair< SwRect, sal_Int32 > IdMapEntry;
-typedef std::vector< IdMapEntry > LinkIdMap;
-typedef std::map< const SwTable*, TableColumnsMapEntry > TableColumnsMap;
-typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListIdMap;
-typedef std::map< const SwNumberTreeNode*, sal_Int32 > NumListBodyIdMap;
-typedef std::set FrameTagSet;
-
 class SwEnhancedPDFExportHelper
 {
 private:
@@ -214,15 +204,7 @@ class SwEnhancedPDFExportHelper
 
 const SwPrintData& mrPrintData;
 
-static TableColumnsMap s_aTableColumnsMap;
-static LinkIdMap s_aLinkIdMap;
-static NumListIdMap s_aNumListIdMap;
-static NumListBodyIdMap s_aNumListBodyIdMap;
-static FrameTagSet s_FrameTagSet;
-
-static LanguageType s_eLanguageDefault;
-
-void EnhancedPDFExport();
+void EnhancedPDFExport(LanguageType const eLanguageDefault);
 
 /// Exports bibliography entry links.
 void ExportAuthorityEntryLinks();
@@ -246,14 +228,6 @@ class SwEnhancedPDFExportHelper
 
 ~SwEnhancedPDFExportHelper();
 
-static TableColumnsMap& GetTableColumnsMap() {return s_aTableColumnsMap; }
-static LinkIdMap& GetLinkIdMap() { return s_aLinkIdMap; }
-static NumListIdMap& GetNumListIdMap() {return s_aNumListIdMap; }
-static NumListBodyIdMap& GetNumListBodyIdMap() {return 
s_aNumListBodyIdMap; }
-static FrameTagSet & GetFrameTagSet() { return s_FrameTagSet; }
-
-static LanguageType GetDefaultLanguage() {return s_eLanguageDefault; }
-
 //scale and position rRectangle if we're scaling due to notes in margins.
 tools::Rectangle SwRectToPDFRect(const SwPageFrame* pCurrPage,
 const tools::Rectangle& rRectangle) const;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 4473b89d25b4..40e6a8fbde13 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/E

[Libreoffice-commits] core.git: include/vcl vcl/backendtest vcl/headless vcl/inc vcl/IwyuFilter_vcl.yaml vcl/source vcl/unx

2023-08-22 Thread Gabor Kelemen (via logerrit)
 include/vcl/graphic/GraphicMetadata.hxx |6 ++
 vcl/IwyuFilter_vcl.yaml |   16 
 vcl/backendtest/outputdevice/common.cxx |2 ++
 vcl/headless/CairoCommon.cxx|1 +
 vcl/inc/DropdownBox.hxx |2 ++
 vcl/inc/ImplLayoutArgs.hxx  |6 +-
 vcl/inc/ImplOutDevData.hxx  |1 +
 vcl/inc/PriorityMergedHBox.hxx  |1 -
 vcl/inc/SalGradient.hxx |1 +
 vcl/inc/accel.hxx   |2 --
 vcl/inc/bitmap/Octree.hxx   |1 +
 vcl/inc/bitmap/impoctree.hxx|2 +-
 vcl/inc/bitmaps.hlst|2 ++
 vcl/inc/calendar.hxx|1 -
 vcl/inc/debugevent.hxx  |1 -
 vcl/inc/dndlistenercontainer.hxx|3 ---
 vcl/inc/font/DirectFontSubstitution.hxx |2 +-
 vcl/inc/font/FeatureCollector.hxx   |2 +-
 vcl/inc/font/FontMetricData.hxx |3 +--
 vcl/inc/font/LogicalFontInstance.hxx|1 -
 vcl/inc/font/PhysicalFontFace.hxx   |1 -
 vcl/inc/font/PhysicalFontFaceCollection.hxx |2 --
 vcl/inc/font/PhysicalFontFamily.hxx |2 --
 vcl/inc/font/fontsubstitution.hxx   |2 --
 vcl/inc/fontattributes.hxx  |1 -
 vcl/inc/glyphid.hxx |2 +-
 vcl/inc/graphic/DetectorTools.hxx   |4 
 vcl/inc/graphic/GraphicFormatDetector.hxx   |4 +---
 vcl/inc/graphic/GraphicID.hxx   |1 -
 vcl/inc/graphic/GraphicReader.hxx   |3 ---
 vcl/inc/graphic/Manager.hxx |1 -
 vcl/inc/graphic/UnoBinaryDataContainer.hxx  |3 ---
 vcl/inc/graphic/UnoGraphicDescriptor.hxx|1 -
 vcl/inc/graphic/VectorGraphicLoader.hxx |1 -
 vcl/inc/headless/CairoCommon.hxx|2 --
 vcl/inc/headless/svpgdi.hxx |2 --
 vcl/inc/headless/svpvd.hxx  |1 -
 vcl/inc/hyperlabel.hxx  |2 --
 vcl/inc/imagerepository.hxx |1 -
 vcl/inc/impfont.hxx |1 +
 vcl/inc/impglyphitem.hxx|2 +-
 vcl/inc/jsdialog/enabled.hxx|2 +-
 vcl/inc/jsdialog/jsdialogbuilder.hxx|4 
 vcl/inc/listbox.hxx |5 ++---
 vcl/inc/menubarvalue.hxx|1 -
 vcl/inc/opengl/win/WinDeviceInfo.hxx|4 
 vcl/inc/opengl/zone.hxx |1 -
 vcl/inc/pdf/BitmapID.hxx|1 -
 vcl/inc/pdf/Matrix3.hxx |1 -
 vcl/inc/pdf/ResourceDict.hxx|1 -
 vcl/inc/pdf/XmpMetadata.hxx |1 -
 vcl/inc/pdf/objectcopier.hxx|1 -
 vcl/inc/pdf/pdfcompat.hxx   |6 ++
 vcl/inc/pdf/pdfwriter_impl.hxx  |1 -
 vcl/inc/print.h |2 +-
 vcl/inc/printaccessoryview.hrc  |2 ++
 vcl/inc/regband.hxx |2 ++
 vcl/inc/salgdi.hxx  |1 -
 vcl/inc/sallayout.hxx   |4 
 vcl/inc/salprn.hxx  |1 +
 vcl/inc/salptype.hxx|1 +
 vcl/inc/salvtables.hxx  |2 +-
 vcl/inc/salwtype.hxx|1 -
 vcl/inc/scanlinewriter.hxx  |2 +-
 vcl/inc/schedulerimpl.hxx   |2 +-
 vcl/inc/sft.hxx |7 ---
 vcl/inc/skia/x11/salvd.hxx  |2 ++
 vcl/inc/skia/x11/textrender.hxx |1 -
 vcl/inc/slider.hxx  |2 --
 vcl/inc/strhelper.hxx   |2 --
 vcl/inc/svdata.hxx  |   10 +++---
 vcl/inc/svimpbox.hxx|1 -
 vcl/inc/textlayout.hxx  |4 
 vcl/inc/textlineinfo.hxx|3 ++-
 vcl/inc/toolbox.h   |1 +
 vcl/inc/units.hrc   |3 +++
 vcl/inc/unx/fc_fontoptions.hxx  |1 +
 vcl/inc/unx/fontmanager.hxx |4 
 vcl/inc/unx/genpspgraphics.h|1 -
 vcl/inc/unx/glyphcache.hxx  |5 +
 vcl/inc/unx/gtk/atkbridge.hxx   |2 --
 vcl/inc/unx/i18n_im.hxx |2 --
 vcl/inc/unx/i18n_xkb.hxx|2 --
 vcl/inc/unx/saldata.hxx |1 -
 vcl/inc/unx/saldisp.hxx |2 --
 vcl/inc/unx/salframe.h  |2 --
 vcl/inc/unx/salgdi.h|7 ---
 vcl/inc/unx/salinst.h   |1 -
 vcl/inc/unx/salobj.h|1 -
 vcl/inc/unx/salvd.h |2 ++
 vcl/inc/unx/ses

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

2023-08-22 Thread Michael Weghorn (via logerrit)
 include/vcl/toolkit/menubtn.hxx  |2 ++
 vcl/inc/managedmenubutton.hxx|3 ++-
 vcl/source/control/managedmenubutton.cxx |4 ++--
 vcl/source/control/menubtn.cxx   |4 +++-
 4 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit f075fa01cb4f74185f13eb0a8d7f84cf1f47af49
Author: Michael Weghorn 
AuthorDate: Tue Aug 22 10:26:32 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue Aug 22 12:48:41 2023 +0200

tdf#141101 tdf#101886 a11y: Restore previous focus on col/line popup close

Don't request focus for the color window
before the menu button popup opens.

Doing so would prevent properly restoring focus to the
menu button itself after the popup closes again.

Without this change in place, the call to
`MenuButton::Activate` in `MenuButton::ExecuteMenu (s. frame 14/15
in below backtrace) would already set focus to the "Automatic" button
in the color window:

1  PushButton::GetFocus   button.cxx 1490 0x7f4acfdc83b6
2  vcl::Window::CompatGetFocuswindow.cxx 3888 0x7f4acfd9d26d
3  vcl::Window::ImplGrabFocus mouse.cxx  384  0x7f4acfcd5215
4  vcl::Window::GrabFocus window.cxx 2979 0x7f4acfd988e9
5  SalInstanceWidget::grab_focus  salvtables.cxx 390  0x7f4ad046f505
6  ColorWindow::GrabFocus tbcontrl.cxx   2127 0x7f4ad3f21af1
7  ColorListBox::ToggleHdltbcontrl.cxx   4291 0x7f4ad3f313d6
8  ColorListBox::LinkStubToggleHdltbcontrl.cxx   4285 
0x7f4ad3f31369
9  Link::Calllink.hxx   111  
0x7f4ad04aec71
10 weld::Toggleable::signal_toggled   weld.hxx   1539 0x7f4ad04a77a3
11 SalInstanceMenuButton::ActivateHdl salvtables.cxx 3075 
0x7f4ad0483086
12 SalInstanceMenuButton::LinkStubActivateHdl salvtables.cxx 3071 
0x7f4ad0483043
13 Link::Call link.hxx   111  0x7f4acfe9e9c1
14 MenuButton::Activate   menubtn.cxx237  0x7f4acfe9e136
15 MenuButton::ExecuteMenumenubtn.cxx61   0x7f4acfe9cca1
16 MenuButton::KeyInput   menubtn.cxx226  0x7f4acfe9e092
17 ImplHandleKey  winproc.cxx1211 0x7f4acfdb0962
18 ImplWindowFrameProcwinproc.cxx2724 0x7f4acfdb6fcf
19 SalFrame::CallCallback salframe.hxx   310  0x7f4ac5aa3dfa
20 QtFrame::CallCallback  QtFrame.hxx229  0x7f4ac5aa5336
... 

As a consequence, this "Automatic" button inside of the color window
would be the UI element remembered as the the one to which focus
focus should be restored when closing the popup, see the

mxPrevFocusWin = Window::SaveFocus();

in `FloatingWindow::StartPopupMode`, which gets called like this:

1   FloatingWindow::StartPopupMode   floatwin.cxx 824  
0x7f4acfc61a61
2   ImplDockingWindowWrapper::StartPopupMode dockmgr.cxx  846  
0x7f4acfc43bd3
3   DockingManager::StartPopupMode   dockmgr.cxx  341  
0x7f4acfc412c3
4   MenuButton::ExecuteMenu  menubtn.cxx  94   
0x7f4acfe9cfa9
5   MenuButton::KeyInput menubtn.cxx  226  
0x7f4acfe9e092
6   ImplHandleKeywinproc.cxx  1211 
0x7f4acfdb0962
7   ImplWindowFrameProc  winproc.cxx  2724 
0x7f4acfdb6fcf
8   SalFrame::CallCallback   salframe.hxx 310  
0x7f4ac5aa3dfa
9   QtFrame::CallCallbackQtFrame.hxx  229  
0x7f4ac5aa5336
10  QtWidget::handleKeyEvent QtWidget.cxx 671  
0x7f4ac5af9f38
11  QtWidget::handleEventQtWidget.cxx 707  
0x7f4ac5afa094
12  QtWidget::event  QtWidget.cxx 730  
0x7f4ac5afa1f7
13  QApplicationPrivate::notify_helper   qapplication.cpp 3287 
0x7f4ac37a2414
14  QApplication::notify qapplication.cpp 2715 
0x7f4ac379fd5b
15  QCoreApplication::notifyInternal2qcoreapplication.cpp 1123 
0x7f4ac51a3c34
16  QCoreApplication::forwardEvent   qcoreapplication.cpp 1138 
0x7f4ac51a3cac
17  QWidgetWindow::handleKeyEventqwidgetwindow.cpp669  
0x7f4ac38567b1
18  QWidgetWindow::event qwidgetwindow.cpp234  
0x7f4ac3854924
19  QApplicationPrivate::notify_helper   qapplication.cpp 3287 
0x7f4ac37a2414
20  QApplication::notify qapplication.cpp 3238 
0x7f4ac37a2224
... 

and then properly restoring focus fails in
`FloatingWindow::EndPopupMode`.

Move the call to `Activate` to after showing the
popup instead. This makes sure that the actual
widget that had focus *before* the popup opened
is r

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

2023-08-10 Thread Paris Oplopoios (via logerrit)
 include/vcl/filter/PngImageWriter.hxx|4 
 vcl/qa/cppunit/png/PngFilterTest.cxx |   44 ++-
 vcl/source/filter/png/PngImageWriter.cxx |  184 +--
 3 files changed, 218 insertions(+), 14 deletions(-)

New commits:
commit b29769bfab386c9d56e72c4e9c9ec5abeb09eb46
Author: Paris Oplopoios 
AuthorDate: Mon Aug 7 01:52:52 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 11 08:51:16 2023 +0200

Initial APNG export support

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

diff --git a/include/vcl/filter/PngImageWriter.hxx 
b/include/vcl/filter/PngImageWriter.hxx
index db34e0826136..b43c304fc1d8 100644
--- a/include/vcl/filter/PngImageWriter.hxx
+++ b/include/vcl/filter/PngImageWriter.hxx
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #pragma once
@@ -39,7 +39,7 @@ public:
 PngImageWriter(SvStream& rStream);
 
 void setParameters(css::uno::Sequence const& 
rParameters);
-bool write(const BitmapEx& rBitmap);
+bool write(const Graphic& rGraphic);
 };
 
 } // namespace vcl
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx 
b/vcl/qa/cppunit/png/PngFilterTest.cxx
index 8e9c15e6dd49..51833b870d05 100644
--- a/vcl/qa/cppunit/png/PngFilterTest.cxx
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -382,12 +382,46 @@ void PngFilterTest::testApng()
 CPPUNIT_ASSERT(aGraphic.IsAnimated());
 CPPUNIT_ASSERT_EQUAL(size_t(2), 
aGraphic.GetAnimation().GetAnimationFrames().size());
 
-auto aFrame1 = aGraphic.GetAnimation().GetAnimationFrames()[0]->maBitmapEx;
-auto aFrame2 = aGraphic.GetAnimation().GetAnimationFrames()[1]->maBitmapEx;
+AnimationFrame aFrame1 = *aGraphic.GetAnimation().GetAnimationFrames()[0];
+AnimationFrame aFrame2 = *aGraphic.GetAnimation().GetAnimationFrames()[1];
 
-CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFrame1.GetPixelColor(0, 0));
-CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), aFrame1.GetPixelColor(2, 2));
-CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aFrame2.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, aFrame1.maBitmapEx.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), aFrame1.maBitmapEx.GetPixelColor(2, 
2));
+CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aFrame2.maBitmapEx.GetPixelColor(0, 0));
+
+// Roundtrip the APNG
+SvMemoryStream aOutStream;
+vcl::PngImageWriter aPngWriter(aOutStream);
+bSuccess = aPngWriter.write(aGraphic);
+CPPUNIT_ASSERT(bSuccess);
+
+aOutStream.Seek(STREAM_SEEK_TO_BEGIN);
+vcl::PngImageReader aPngReader2(aOutStream);
+Graphic aGraphic2;
+bSuccess = aPngReader2.read(aGraphic2);
+CPPUNIT_ASSERT(bSuccess);
+CPPUNIT_ASSERT(aGraphic2.IsAnimated());
+CPPUNIT_ASSERT_EQUAL(size_t(2), 
aGraphic2.GetAnimation().GetAnimationFrames().size());
+
+AnimationFrame aFrame1Roundtripped = 
*aGraphic2.GetAnimation().GetAnimationFrames()[0];
+AnimationFrame aFrame2Roundtripped = 
*aGraphic2.GetAnimation().GetAnimationFrames()[1];
+
+CPPUNIT_ASSERT_EQUAL(COL_WHITE, 
aFrame1Roundtripped.maBitmapEx.GetPixelColor(0, 0));
+CPPUNIT_ASSERT_EQUAL(Color(0x72d1c8), 
aFrame1Roundtripped.maBitmapEx.GetPixelColor(2, 2));
+CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, 
aFrame2Roundtripped.maBitmapEx.GetPixelColor(0, 0));
+
+// Make sure the two frames have the same properties
+CPPUNIT_ASSERT_EQUAL(aFrame1.maPositionPixel, 
aFrame1Roundtripped.maPositionPixel);
+CPPUNIT_ASSERT_EQUAL(aFrame1.maSizePixel, aFrame1Roundtripped.maSizePixel);
+CPPUNIT_ASSERT_EQUAL(aFrame1.mnWait, aFrame1Roundtripped.mnWait);
+CPPUNIT_ASSERT_EQUAL(aFrame1.meDisposal, aFrame1Roundtripped.meDisposal);
+CPPUNIT_ASSERT_EQUAL(aFrame1.meBlend, aFrame1Roundtripped.meBlend);
+
+CPPUNIT_ASSERT_EQUAL(aFrame2.maPositionPixel, 
aFrame2Roundtripped.maPositionPixel);
+CPPUNIT_ASSERT_EQUAL(aFrame2.maSizePixel, aFrame2Roundtripped.maSizePixel);
+CPPUNIT_ASSERT_EQUAL(aFrame2.mnWait, aFrame2Roundtripped.mnWait);
+CPPUNIT_ASSERT_EQUAL(aFrame2.meDisposal, aFrame2Roundtripped.meDisposal);
+CPPUNIT_ASSERT_EQUAL(aFrame2.meBlend, aFrame2Roundtripped.meBlend);
 }
 
 void PngFilterTest::testPngSuite()
diff --git a/vcl/source/filter/png/PngImageWriter.cxx 
b/vcl/source/filter/png/PngImageWriter.cxx
index 13e23fcb2e9b..09bddf7b2f58 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -11,7 +11,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 namespace
 {
@@ -56,13 +59,80 @@ static void lclWriteStream(png_structp pPng, png_bytep 
pData, png_size_t pDataSi
 png_error(pPng, "Write Error");
 }
 
-static bool pngWrite(SvStream& rStream, const BitmapEx& rBitmapEx, int 
nCompressionLevel,
+static void writeFctlChunk(std::vector& aFctlChunk, sal_uInt32 
nSequenceNumber, Size aSize,
+   

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

2023-08-02 Thread Noel Grandin (via logerrit)
 include/vcl/bitmap.hxx   |   12 +
 vcl/inc/bitmap/BitmapWriteAccess.hxx |7 +++
 vcl/source/bitmap/bitmappaint.cxx|   75 +++
 vcl/source/filter/egif/egif.cxx  |6 ++
 4 files changed, 99 insertions(+), 1 deletion(-)

New commits:
commit f76acf9bd97e65ba50303b6e5a25e5877996ebe1
Author: Noel Grandin 
AuthorDate: Wed Aug 2 15:26:06 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 2 18:22:28 2023 +0200

tdf#156525 Save as > HTML loses drawing object as invalid gif

regression from
commit 1c7cbd685633d44eac554629572f3401c450f855
Author: Noel Grandin 
Date:   Sun May 7 16:56:21 2023 +0200
use AlphaMask for variables when calling GetAlphaMask

where after my change, the code is now calling
Bitmap::Replace(AlphaMask,...)
instead of
Bitmap::Replace(Bitmap,...)
and those two methods do quite different things.

However, we have to
(*) restore Bitmap::Replace(Bitmap,...) which was removed in
commit 8270eb5d5600cc84dbf5f0e339f90c4519ef88bb
Author: Noel Grandin 
Date:   Fri May 19 13:35:31 2023 +0200
loplugin:unusedmethods
(*) restore BitmapWriteAccess::SetPaletteEntryCount which was removed in
commit 74cd0d0b281f8df75612bfb600df2eae62c4d21d
Author: Noel Grandin 
Date:   Thu Jun 29 13:53:30 2023 +0200
loplugin:unusedmethods
(*) Invert the mask/alpha layer, since after
commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Author: Noel Grandin 
Date:   Fri Apr 16 20:33:10 2021 +0200
Convert internal vcl bitmap formats transparency->alpha (II)
we are dealing with real alpha, and not transparency.

Also add an assert in GIFWriter::WriteAccess, since it is a logic error
to get here and have the image in the wrong format.

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

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index bc0d628179ca..1c5f7bcc7ec6 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -430,6 +430,18 @@ public:
  */
 boolReplace( const AlphaMask& rAlpha, const Color& 
rMergeColor );
 
+/** Replace all pixel where the given mask/alpha layer is on with the 
specified color
+
+@param rMask
+Mask specifying which pixel should be replaced
+
+@param rReplaceColor
+Color to be placed in all changed pixel
+
+@return true, if the operation was completed successfully.
+ */
+boolReplaceMask( const AlphaMask& rMask, const Color& 
rReplaceColor );
+
 /** Replace all pixel having the search color with the specified color
 
 @param rSearchColor
diff --git a/vcl/inc/bitmap/BitmapWriteAccess.hxx 
b/vcl/inc/bitmap/BitmapWriteAccess.hxx
index 216eb16806e4..bc903769d679 100644
--- a/vcl/inc/bitmap/BitmapWriteAccess.hxx
+++ b/vcl/inc/bitmap/BitmapWriteAccess.hxx
@@ -39,6 +39,13 @@ public:
 mpBuffer->maPalette = rPalette;
 }
 
+void SetPaletteEntryCount(sal_uInt16 nCount)
+{
+assert(mpBuffer && "Access is not valid!");
+
+mpBuffer->maPalette.SetEntryCount(nCount);
+}
+
 void SetPaletteColor(sal_uInt16 nColor, const BitmapColor& rBitmapColor)
 {
 assert(mpBuffer && "Access is not valid!");
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 487e6d1a6ad6..91a43b951748 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -884,6 +884,81 @@ vcl::Region Bitmap::CreateRegion(const Color& rColor, 
const tools::Rectangle& rR
 return aRegion;
 }
 
+bool Bitmap::ReplaceMask(const AlphaMask& rMask, const Color& rReplaceColor)
+{
+ScopedReadAccess pMaskAcc(const_cast(rMask));
+BitmapScopedWriteAccess pAcc(*this);
+
+if (!pMaskAcc || !pAcc)
+return false;
+
+const tools::Long nWidth = std::min(pMaskAcc->Width(), pAcc->Width());
+const tools::Long nHeight = std::min(pMaskAcc->Height(), pAcc->Height());
+const BitmapColor aMaskWhite(pMaskAcc->GetBestMatchingColor(COL_WHITE));
+BitmapColor aReplace;
+
+if (pAcc->HasPalette())
+{
+const sal_uInt16 nActColors = pAcc->GetPaletteEntryCount();
+const sal_uInt16 nMaxColors = 1 << pAcc->GetBitCount();
+
+// default to the nearest color
+aReplace = pAcc->GetBestMatchingColor(rReplaceColor);
+
+// for paletted images without a matching palette entry
+// look for an unused palette entry (NOTE: expensive!)
+if (pAcc->GetPaletteColor(aReplace.GetIndex()) != 
BitmapColor(rReplaceColor))
+{
+// if the palette has empty entries use the last one
+if (nActColors < nMaxColors)
+{
+pAcc->S

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

2023-08-01 Thread Paris Oplopoios (via logerrit)
 include/vcl/ITiledRenderable.hxx  |4 +++-
 sc/inc/docuno.hxx |2 +-
 sc/source/ui/unoobj/docuno.cxx|   15 +--
 sd/source/ui/inc/unomodel.hxx |2 +-
 sd/source/ui/unoidl/unomodel.cxx  |   15 +--
 sw/inc/unotxdoc.hxx   |2 +-
 sw/source/uibase/uno/unotxdoc.cxx |4 ++--
 7 files changed, 34 insertions(+), 10 deletions(-)

New commits:
commit 0004de149269ed2ab5423947b9930653f3da6038
Author: Paris Oplopoios 
AuthorDate: Wed Jul 26 17:20:59 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Tue Aug 1 13:49:06 2023 +0200

Allow getViewRenderState to get from a specific view

getViewRenderState would get its output from the current view, make it
so that it's possible to specify a specific view

Change-Id: I279b215f8311b079c220c79b8b41c76bc0210154
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154943
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit eff5643dbc5bb9dfede530e8e07261bb9bdc98f0)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155046
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx
index 9fa61258fc7a..9b76eb11200e 100644
--- a/include/vcl/ITiledRenderable.hxx
+++ b/include/vcl/ITiledRenderable.hxx
@@ -10,6 +10,7 @@
 
 #pragma once
 
+#include 
 #include 
 #include 
 #include 
@@ -380,8 +381,9 @@ public:
 /**
  * Returns an opaque string reflecting the render state of a component
  * eg. 'PD' - P for non-printing-characters, D for dark-mode.
+ * @param pViewShell the view to get the options from, if nullptr the 
current view shell is used
  */
-virtual OString getViewRenderState() { return rtl::OString(); }
+virtual OString getViewRenderState(SfxViewShell* = nullptr) { return 
rtl::OString(); }
 };
 } // namespace vcl
 
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index a75afa2834df..611b0c22d2b9 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -396,7 +396,7 @@ public:
 virtual void completeFunction(const OUString& rFunctionName) override;
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 private:
 Size getDocumentSize(SCCOL& rnTiledRenderingAreaEndCol, SCROW& 
rnTiledRenderingAreaEndRow );
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 66c2667a1a1f..fe1cf4dbe6b3 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1254,10 +1254,21 @@ void ScModelObj::completeFunction(const OUString& 
rFunctionName)
 }
 }
 
-OString ScModelObj::getViewRenderState()
+OString ScModelObj::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-ScViewData* pViewData = ScDocShell::GetViewData();
+ScViewData* pViewData = nullptr;
+
+if (pViewShell)
+{
+ScTabViewShell* pTabViewShell = dynamic_cast< 
ScTabViewShell*>(pViewShell);
+if (pTabViewShell)
+pViewData = &pTabViewShell->GetViewData();
+}
+else
+{
+pViewData = ScDocShell::GetViewData();
+}
 
 if (pViewData)
 {
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index 008c9459e1c4..e0fa051d8826 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -285,7 +285,7 @@ public:
 virtual void setPaintTextEdit(bool bPaint) override { mbPaintTextEdit = 
bPaint; }
 
 /// @see vcl::ITiledRenderable::getViewRenderState().
-OString getViewRenderState() override;
+OString getViewRenderState(SfxViewShell* pViewShell = nullptr) override;
 
 // XComponent
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 9f906dc404a0..789f419716f8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2326,10 +2326,21 @@ void SdXImpressDocument::paintTile( VirtualDevice& 
rDevice,
 comphelper::LibreOfficeKit::setTiledPainting(false);
 }
 
-OString SdXImpressDocument::getViewRenderState()
+OString SdXImpressDocument::getViewRenderState(SfxViewShell* pViewShell)
 {
 OStringBuffer aState;
-DrawViewShell* pView = GetViewShell();
+DrawViewShell* pView = nullptr;
+
+if (pViewShell)
+{
+ViewShellBase* pShellBase = dynamic_cast(pViewShell);
+pView = 
dynamic_cast(pShellBase->GetMainViewShell().get());
+}
+else
+{
+pView = GetViewShell();
+}
+
 if (pView)
 {
 const SdViewOptions& pVOpt = pView->GetViewOptions();
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 056013d75056..01619df1d382 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -463,7 +463,7 @@ public:
 void getCommandValues(tools::JsonWriter& rJsonWriter, std::string_view 
rCommand) override;
 
 

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

2023-07-26 Thread Caolán McNamara (via logerrit)
 include/vcl/weld.hxx  |1 +
 svx/uiconfig/ui/accessibilitycheckentry.ui|   22 ++
 sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx |   10 ++
 vcl/inc/salvtables.hxx|9 -
 vcl/source/app/salvtables.cxx |   20 
 vcl/unx/gtk3/gtkinst.cxx  |7 +++
 6 files changed, 48 insertions(+), 21 deletions(-)

New commits:
commit 1b6c01bdf769582508c852b24ab9d2a04fc0956f
Author: Caolán McNamara 
AuthorDate: Tue Jul 25 15:56:35 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 26 11:09:08 2023 +0200

Related: tdf#156137 allow GtkLinkButton to wrap

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

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index c03f78d6c0e1..707d93099ef4 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1673,6 +1673,7 @@ protected:
 public:
 virtual void set_label(const OUString& rText) = 0;
 virtual OUString get_label() const = 0;
+virtual void set_label_wrap(bool wrap) = 0;
 virtual void set_uri(const OUString& rUri) = 0;
 virtual OUString get_uri() const = 0;
 
diff --git a/svx/uiconfig/ui/accessibilitycheckentry.ui 
b/svx/uiconfig/ui/accessibilitycheckentry.ui
index ea4b63c5fe88..3bf122c0b70f 100644
--- a/svx/uiconfig/ui/accessibilitycheckentry.ui
+++ b/svx/uiconfig/ui/accessibilitycheckentry.ui
@@ -2,13 +2,14 @@
 
 
   
-  
+  
+  
 True
 False
 1
 1
 True
-6
+6
 
   
 True
@@ -25,9 +26,8 @@
 
   
   
-True
-True
-0
+0
+0
   
 
 
@@ -35,14 +35,13 @@
 True
 True
 True
-start
 True
 none
+0
   
   
-True
-True
-1
+1
+0
   
 
 
@@ -55,9 +54,8 @@
 center
   
   
-False
-False
-2
+2
+0
   
 
   
diff --git a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx 
b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
index 162724a1035c..338b0f1f7cac 100644
--- a/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
+++ b/sw/source/uibase/sidebar/A11yCheckIssuesPanel.cxx
@@ -43,6 +43,16 @@ AccessibilityCheckEntry::AccessibilityCheckEntry(
 if (m_pAccessibilityIssue->canGotoIssue())
 {
 m_xGotoButton->set_label(m_pAccessibilityIssue->m_aIssueText);
+
+// int nPrefWidth(m_xGotoButton->get_preferred_size().Width());
+int nMaxWidth = m_xGotoButton->get_approximate_digit_width() * 10;
+// if (nPrefWidth > nMaxWidth)
+{
+// tdf#156137 allow LinkButton label to wrap
+m_xGotoButton->set_label_wrap(true);
+m_xGotoButton->set_size_request(nMaxWidth, -1);
+}
+
 m_xGotoButton->connect_activate_link(
 LINK(this, AccessibilityCheckEntry, GotoButtonClicked));
 m_xLabel->set_visible(false);
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 4264de0cea6d..e0c61a5c15ef 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1080,9 +1080,6 @@ private:
 
 DECL_LINK(ClickHdl, ::Button*, void);
 
-protected:
-void set_label_wrap(bool bWrap);
-
 public:
 SalInstanceButton(::Button* pButton, SalInstanceBuilder* pBuilder, bool 
bTakeOwnership);
 
@@ -1242,6 +1239,8 @@ public:
 
 virtual OUString get_uri() const override { return m_xButton->GetURL(); }
 
+virtual void set_label_wrap(bool wrap) override;
+
 virtual ~SalInstanceLinkButton() override { 
m_xButton->SetClickHdl(m_aOrigClickHdl); }
 };
 
@@ -1267,7 +1266,7 @@ public:
 
 virtual OUString get_label() const override { return 
SalInstanceButton::get_label(); }
 
-virtual void set_label_wrap(bool wrap) override { 
SalInstanceButton::set_label_wrap(wrap); }
+virtual void set_label_wrap(bool wrap) override;
 
 virtual ~SalInstanceCheckButton() override;
 };
@@ -2013,7 +2012,7 @@ public:
 
 virtual OUString get_label() const override { return 
SalInstanceButton::get_label(); }
 
-virtual void set_label_wrap(bool wrap) override { 
SalInstanceButton::set_label_wrap(wrap); }
+virtual void set_label_wrap(bool wrap) override;
 
 virtual ~SalInstanceRadioButton() override;
 };
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 3ed96cd8ef58..2716a219fb81 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2890,14 +2890,14 @@ void SalInstanceButton::set_from_icon_name(const 
OUString& rIconName)
 m_xButton->SetModeImage(Image(StockImage::Yes, rIconName));
 }
 
-void SalInstanceButton::set_label_wrap(bool wrap)
+static void set_label_wrap(Control& rWidget, bool wrap)
 {
-W

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

2023-07-24 Thread Patrick Luby (via logerrit)
 include/vcl/settings.hxx|2 ++
 sc/source/ui/view/cellsh.cxx|   12 
 sc/source/ui/view/overlayobject.cxx |6 +-
 vcl/inc/osx/salframe.h  |1 +
 vcl/inc/salframe.hxx|1 +
 vcl/osx/salframe.cxx|5 +
 vcl/source/app/settings.cxx |8 
 7 files changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 9d68c794d67259a38de1465090f6f1e7fb588d62
Author: Patrick Luby 
AuthorDate: Fri Jul 21 19:55:02 2023 -0400
Commit: Patrick Luby 
CommitDate: Mon Jul 24 18:30:25 2023 +0200

tdf#155414 include system "reduce animation" preferences

Allow the system's "reduce animation" preferences to disable the
Calc animated border when copying a selection of cells.

Also, fix failure to stop the animated border when a copy action is
performed in a different document by cancelling the animated border.
This transferable has lost ownership of the system clipboard so,
in essence, the previous copy action that created this transferable
has been cancelled.

Change-Id: I4da6d557c5dbf653c38a99eb7a16d961843a41d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154752
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
Reviewed-by: Patrick Luby 

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 7f4849c7b718..addf6ebe5711 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -655,6 +655,8 @@ public:
 static bool GetUseDarkMode();
 static void SetAppColorMode(int nMode);
 static int  GetAppColorMode();
+// return true if system preferences are set to use reduced animation
+static bool GetUseReducedAnimation();
 booloperator ==( const MiscSettings& rSet ) 
const;
 booloperator !=( const MiscSettings& rSet ) 
const;
 };
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index ec5914a2224b..1a8216e6a1ba 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -557,6 +557,18 @@ IMPL_LINK( ScCellShell, ClipboardChanged, 
TransferableDataHelper*, pDataHelper,
 rBindings.Invalidate( SID_PASTE_AS_LINK );
 rBindings.Invalidate( SID_PASTE_TEXTIMPORT_DIALOG );
 rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
+
+// Fix failure to stop the animated border when a copy action is
+// performed in a different document by cancelling the animated border.
+// This transferable has lost ownership of the system clipboard so,
+// in essence, the previous copy action that created this transferable
+// has been cancelled.
+if ( !GetViewData().IsAnyFillMode() )
+{
+GetViewData().SetPasteMode( ScPasteFlags::NONE );
+// Clear CopySourceOverlay in each window of a split/frozen tabview
+GetViewData().GetView()->UpdateCopySourceOverlay();
+}
 }
 
 namespace {
diff --git a/sc/source/ui/view/overlayobject.cxx 
b/sc/source/ui/view/overlayobject.cxx
index 2be20070e4a0..a564265a95ef 100644
--- a/sc/source/ui/view/overlayobject.cxx
+++ b/sc/source/ui/view/overlayobject.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using sdr::overlay::OverlayObject;
 using sdr::overlay::OverlayManager;
@@ -34,7 +35,10 @@ ScOverlayDashedBorder::ScOverlayDashedBorder(const 
::basegfx::B2DRange& rRange,
 OverlayObject(rColor),
 mbToggle(true)
 {
-mbAllowsAnimation = 
officecfg::Office::Common::VCL::AnimationsEnabled::get();
+// tdf#155414 include system "reduce animation" preferences
+// Allow the system's "reduce animation" preferences to disable the
+// Calc animated border when copying a selection of cells.
+mbAllowsAnimation = 
(officecfg::Office::Common::VCL::AnimationsEnabled::get() && 
!MiscSettings::GetUseReducedAnimation());
 maRange = rRange;
 }
 
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index a9c2a4039d0f..87ab09868edd 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -165,6 +165,7 @@ public:
 virtual void EndSetClipRegion() override;
 virtual void UpdateDarkMode() override;
 virtual bool GetUseDarkMode() const override;
+virtual bool GetUseReducedAnimation() const override;
 
 void UpdateFrameGeometry();
 
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index 8f6e2ddfbc50..0c3b170ca239 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -301,6 +301,7 @@ public:
 
 virtual voidUpdateDarkMode() {}
 virtual boolGetUseDarkMode() const { return false; }
+virtual boolGetUseReducedAnimation() const { return false; };
 
 // Call the callback set; this sometimes necessary for implementation 
classes
 // that should not know more than necessary about the SalFrame 
implementation
diff --git a/vcl/osx/salf

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

2023-07-23 Thread Rafael Lima (via logerrit)
 include/vcl/weld.hxx |1 +
 sfx2/source/control/templatedlglocalview.cxx |   10 ++
 sfx2/source/inc/helpids.h|8 
 vcl/inc/salvtables.hxx   |1 +
 vcl/source/app/salvtables.cxx|7 +++
 vcl/unx/gtk3/gtkinst.cxx |5 +
 6 files changed, 32 insertions(+)

New commits:
commit 65c91bd5aa6f9b68390739a0e027d23c8a32da08
Author: Rafael Lima 
AuthorDate: Fri Jul 21 14:47:47 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sun Jul 23 15:07:11 2023 +0200

tdf#147911 Implement set_item_help_id for context menu items

This patch adds the method set_item_help_id for weld::Menu (similarly to 
what we already have for weld::Toolbar). This way, it is possible to define 
help IDs for each entry in context menus that are created during runtime.

This is necessary to fix various bug tickets that request F1 to redirect to 
the corresponding help page when a context menu item has focus. This currently 
works for context menus created from XML files, but fails for context menus 
created during runtime.

Besides implementing the new method, this patch fixes bug 147911 (see 
changes in file templatedlglocalview.cxx) to showcase how set_item_help_id can 
be used.

NOTE: Pressing F1 in context menus only work with "gen" and "win"... 
unfortunately it does not work in kf5 and gtk3 due to a separate bug (see bug 
156376).

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

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4c198b3ecc99..c03f78d6c0e1 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2419,6 +2419,7 @@ public:
 TriState eCheckRadioFalse)
 = 0;
 
+virtual void set_item_help_id(const OUString& rIdent, const OUString& 
rHelpId) = 0;
 virtual void remove(const OUString& rId) = 0;
 
 virtual void clear() = 0;
diff --git a/sfx2/source/control/templatedlglocalview.cxx 
b/sfx2/source/control/templatedlglocalview.cxx
index b469ea716dc8..52a12b4ef965 100644
--- a/sfx2/source/control/templatedlglocalview.cxx
+++ b/sfx2/source/control/templatedlglocalview.cxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 
TemplateDlgLocalView::TemplateDlgLocalView(std::unique_ptr
 xWindow,
@@ -113,6 +114,15 @@ void TemplateDlgLocalView::createContextMenu(const bool 
bIsDefault, const bool b
 mxContextMenu->append("move", SfxResId(STR_MOVE), BMP_MENU_MOVE);
 mxContextMenu->append("export", SfxResId(STR_EXPORT), BMP_MENU_EXPORT);
 
+// Set the help IDs of all context menu entries
+mxContextMenu->set_item_help_id("open", HID_TEMPLATEDLG_OPEN);
+mxContextMenu->set_item_help_id("edit", HID_TEMPLATEDLG_EDIT);
+mxContextMenu->set_item_help_id("default", HID_TEMPLATEDLG_DEFAULT);
+mxContextMenu->set_item_help_id("rename", HID_TEMPLATEDLG_RENAME);
+mxContextMenu->set_item_help_id("delete", HID_TEMPLATEDLG_DELETE);
+mxContextMenu->set_item_help_id("move", HID_TEMPLATEDLG_MOVE);
+mxContextMenu->set_item_help_id("export", HID_TEMPLATEDLG_EXPORT);
+
 if (!bIsSingleSel)
 {
 mxContextMenu->set_sensitive("open", false);
diff --git a/sfx2/source/inc/helpids.h b/sfx2/source/inc/helpids.h
index 7dbce5235779..051cc5ada8a5 100644
--- a/sfx2/source/inc/helpids.h
+++ b/sfx2/source/inc/helpids.h
@@ -40,6 +40,14 @@ inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_PRINT 
= u"SFX2_HID_HELP_TO
 inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = 
u"SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS";
 inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = 
u"SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG";
 
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_OPEN = 
u"SFX2_HID_TEMPLATEDLG_OPEN";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_EDIT = 
u"SFX2_HID_TEMPLATEDLG_EDIT";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_DEFAULT = 
u"SFX2_HID_TEMPLATEDLG_DEFAULT";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_RENAME = 
u"SFX2_HID_TEMPLATEDLG_RENAME";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_DELETE = 
u"SFX2_HID_TEMPLATEDLG_DELETE";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_MOVE = 
u"SFX2_HID_TEMPLATEDLG_MOVE";
+inline constexpr OUStringLiteral HID_TEMPLATEDLG_EXPORT = 
u"SFX2_HID_TEMPLATEDLG_EXPORT";
+
 inline constexpr OUStringLiteral HID_QUERY_LOAD_TEMPLATE = 
u"SFX2_HID_QUERY_LOAD_TEMPLATE";
 
 inline constexpr OUStringLiteral HID_SIDEBAR_WINDOW = 
u"SFX2_HID_SIDEBAR_WINDOW";
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 04a42c3a8929..4264de0cea6d 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -169,6 +169,7 @@ public:
 const css::uno::Reference& 
rImage,
   

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

2023-07-20 Thread Patrick Luby (via logerrit)
 include/vcl/skia/SkiaHelper.hxx |1 +
 vcl/skia/SkiaHelper.cxx |3 +++
 vcl/skia/gdiimpl.cxx|   10 ++
 vcl/source/outdev/bitmap.cxx|2 +-
 4 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 3c63cb1298fc17b71629e04d181244b5acdf8409
Author: Patrick Luby 
AuthorDate: Thu Jul 20 09:22:46 2023 -0400
Commit: Patrick Luby 
CommitDate: Thu Jul 20 19:58:35 2023 +0200

tdf#156361 use slow blending path if alpha mask blending is diabled

SkiaSalGraphicsImpl::blendBitmap() fails unexpectedly in the following
cases so return false and use the non-Skia alpha mask blending code:
- Unexpected white areas when running a slideshow or printing:
https://bugs.documentfoundation.org/attachment.cgi?id=188447
- Unexpected scaling of bitmap and/or alpha mask when exporting to PDF:
https://bugs.documentfoundation.org/attachment.cgi?id=188498

Change-Id: I13ae613f24bff4cd018110a08ed70559a1714687
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154678
Reviewed-by: Noel Grandin 
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/include/vcl/skia/SkiaHelper.hxx b/include/vcl/skia/SkiaHelper.hxx
index 37fed7ff4de9..769c4d27a9ac 100644
--- a/include/vcl/skia/SkiaHelper.hxx
+++ b/include/vcl/skia/SkiaHelper.hxx
@@ -19,6 +19,7 @@ namespace SkiaHelper
 {
 VCL_DLLPUBLIC bool isVCLSkiaEnabled();
 VCL_DLLPUBLIC OUString readLog();
+VCL_DLLPUBLIC bool isAlphaMaskBlendingEnabled();
 
 #if HAVE_FEATURE_SKIA
 
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index a8332cfe7e1d..41ce5518112e 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -18,6 +18,7 @@
 namespace SkiaHelper
 {
 bool isVCLSkiaEnabled() { return false; }
+bool isAlphaMaskBlendingEnabled() { return false; }
 
 } // namespace
 
@@ -400,6 +401,8 @@ bool isVCLSkiaEnabled()
 return bRet;
 }
 
+bool isAlphaMaskBlendingEnabled() { return false; }
+
 static RenderMethod methodToUse = RenderRaster;
 
 static bool initRenderMethodToUse()
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
index 45f3fc1c1b97..77aaa19df85c 100644
--- a/vcl/skia/gdiimpl.cxx
+++ b/vcl/skia/gdiimpl.cxx
@@ -1297,6 +1297,16 @@ bool SkiaSalGraphicsImpl::blendAlphaBitmap(const 
SalTwoRect& rPosAry,
const SalBitmap& rMaskBitmap,
const SalBitmap& rAlphaBitmap)
 {
+// tdf#156361 use slow blending path if alpha mask blending is diabled
+// SkiaSalGraphicsImpl::blendBitmap() fails unexpectedly in the following
+// cases so return false and use the non-Skia alpha mask blending code:
+// - Unexpected white areas when running a slideshow or printing:
+// https://bugs.documentfoundation.org/attachment.cgi?id=188447
+// - Unexpected scaling of bitmap and/or alpha mask when exporting to PDF:
+// https://bugs.documentfoundation.org/attachment.cgi?id=188498
+if (!SkiaHelper::isAlphaMaskBlendingEnabled())
+return false;
+
 if (checkInvalidSourceOrDestination(rPosAry))
 return false;
 
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 612ea5dc605d..d77b3ddd48c2 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -359,7 +359,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& 
rBmp, const AlphaMask& r
 
 // we need to make sure Skia never reaches this slow code path
 // (but do not fail in no-op cases)
-assert(!SkiaHelper::isVCLSkiaEnabled()
+assert(!SkiaHelper::isVCLSkiaEnabled() || 
!SkiaHelper::isAlphaMaskBlendingEnabled()
 || tools::Rectangle(Point(), rBmp.GetSizePixel())
 .Intersection(tools::Rectangle(rSrcPtPixel, 
rSrcSizePixel)).IsEmpty()
 || 
mpAlphaVDev->LogicToPixel(mpAlphaVDev->GetOutputSizePixel()).IsEmpty());


[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

2023-07-14 Thread Andrea Gelmini (via logerrit)
 include/vcl/pdfextoutdevdata.hxx |2 +-
 include/vcl/pdfwriter.hxx|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b573006f3d268d3e31c9b4f740ff4d0ad92a2371
Author: Andrea Gelmini 
AuthorDate: Fri Jul 14 16:26:35 2023 +0200
Commit: Julien Nabet 
CommitDate: Fri Jul 14 18:41:16 2023 +0200

Fix typo

Change-Id: Ic994555b5d9c87260a4a76b76deb60a5ab6c4bb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154441
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 987e2a1020b2..fe7425d26d82 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -293,7 +293,7 @@ public:
 @param rURL
 the URL the link shall point to.
 there will be no error checking or any kind of
-conversion done to this parameter execept this:
+conversion done to this parameter except this:
 it will be output as 7bit Ascii. The URL
 will appear literally in the PDF file produced
 */
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 6b9c32707839..d49c173bc7d8 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -328,7 +328,7 @@ public:
hyperlink to be executed on pushing the button.
 
There will be no error checking or any kind of
-   conversion done to the URL parameter execept this:
+   conversion done to the URL parameter except this:
it will be output as 7bit Ascii. The URL
will appear literally in the PDF file produced
 */


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

2023-07-12 Thread Szymon Kłos (via logerrit)
 include/vcl/jsdialog/executor.hxx |4 
 include/vcl/weld.hxx  |2 ++
 svtools/source/brwbox/ebbcontrols.cxx |2 +-
 svtools/source/control/ctrlbox.cxx|4 ++--
 svtools/uiconfig/ui/datewindow.ui |2 +-
 vcl/inc/jsdialog/jsdialogbuilder.hxx  |8 
 vcl/jsdialog/enabled.cxx  |1 +
 vcl/jsdialog/executor.cxx |   21 +
 vcl/jsdialog/jsdialogbuilder.cxx  |   19 +++
 9 files changed, 59 insertions(+), 4 deletions(-)

New commits:
commit 80f96e0aad80d425e3a54ad46193be3655eb29be
Author: Szymon Kłos 
AuthorDate: Thu Jul 6 15:44:24 2023 +0200
Commit: Szymon Kłos 
CommitDate: Wed Jul 12 18:36:58 2023 +0200

jsdialog: calendar widget

Change-Id: I5b2b8a1516ed2e851309dca6ef3200ed522d1b7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154136
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Pranam Lashkari 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154361
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/include/vcl/jsdialog/executor.hxx 
b/include/vcl/jsdialog/executor.hxx
index 005f9f36070d..26fd7070e86c 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -86,6 +86,10 @@ public:
 rButton.signal_selected(rIdent);
 }
 
+static void trigger_selected(weld::Calendar& rCalendar) { 
rCalendar.signal_selected(); }
+
+static void trigger_activated(weld::Calendar& rCalendar) { 
rCalendar.signal_activated(); }
+
 static void trigger_value_changed(weld::SpinButton& rSpinButton)
 {
 rSpinButton.signal_value_changed();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 8d1b5cf7722f..df1bb05c4575 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1896,6 +1896,8 @@ public:
 
 class VCL_DLLPUBLIC Calendar : virtual public Widget
 {
+friend class ::LOKTrigger;
+
 Link m_aSelectedHdl;
 Link m_aActivatedHdl;
 
diff --git a/svtools/source/brwbox/ebbcontrols.cxx 
b/svtools/source/brwbox/ebbcontrols.cxx
index dc86194576e2..45b1a3766e76 100644
--- a/svtools/source/brwbox/ebbcontrols.cxx
+++ b/svtools/source/brwbox/ebbcontrols.cxx
@@ -531,7 +531,7 @@ namespace svt
 , m_xMenuButton(m_xBuilder->weld_menu_button("button"))
 , m_xCalendarBuilder(Application::CreateBuilder(m_xMenuButton.get(), 
"svt/ui/datewindow.ui"))
 , m_xTopLevel(m_xCalendarBuilder->weld_widget("date_popup_window"))
-, m_xCalendar(m_xCalendarBuilder->weld_calendar("date"))
+, m_xCalendar(m_xCalendarBuilder->weld_calendar("date_picker"))
 , m_xExtras(m_xCalendarBuilder->weld_widget("extras"))
 , m_xTodayBtn(m_xCalendarBuilder->weld_button("today"))
 , m_xNoneBtn(m_xCalendarBuilder->weld_button("none"))
diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index ef6334a856c9..b33051f7c911 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1576,8 +1576,8 @@ 
SvtCalendarBox::SvtCalendarBox(std::unique_ptr pControl, bool
 : m_bUseLabel(bUseLabel)
 , m_xControl(std::move(pControl))
 , m_xBuilder(Application::CreateBuilder(m_xControl.get(), 
"svt/ui/datewindow.ui"))
-, m_xTopLevel(m_xBuilder->weld_widget("date_popup_window"))
-, m_xCalendar(m_xBuilder->weld_calendar("date"))
+, m_xTopLevel(m_xBuilder->weld_popover("date_popup_window"))
+, m_xCalendar(m_xBuilder->weld_calendar("date_picker"))
 {
 m_xControl->set_popover(m_xTopLevel.get());
 m_xCalendar->connect_selected(LINK(this, SvtCalendarBox, SelectHdl));
diff --git a/svtools/uiconfig/ui/datewindow.ui 
b/svtools/uiconfig/ui/datewindow.ui
index 9467cbb73213..265affe4afcb 100644
--- a/svtools/uiconfig/ui/datewindow.ui
+++ b/svtools/uiconfig/ui/datewindow.ui
@@ -14,7 +14,7 @@
 vertical
 6
 
-  
+  
 True
 True
 2019
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 4d38d66fe9f1..06e2c6135171 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -314,6 +314,7 @@ public:
 virtual std::unique_ptr weld_box(const OUString& id) override;
 virtual std::unique_ptr weld_widget(const OUString& id) 
override;
 virtual std::unique_ptr weld_image(const OUString& id) 
override;
+virtual std::unique_ptr weld_calendar(const OUString& id) 
override;
 
 static weld::MessageDialog*
 CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType,
@@ -861,4 +862,11 @@ public:
 virtual void set_image(const css::uno::Reference& 
rImage) override;
 };
 
+class JSCalendar : public JSWidget
+{
+public:
+JSCalendar(JSDialogSender* pSender, ::Calendar* pCalendar, 
SalInstanceBuilder* pBuilder,
+   bool bTakeOwnership);
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinopti

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

2023-07-07 Thread Balazs Varga (via logerrit)
 include/vcl/toolkit/dialog.hxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit efaa065eb7053954242c83760f897e7dba2e9fe8
Author: Balazs Varga 
AuthorDate: Fri Jul 7 13:01:26 2023 +0200
Commit: Balazs Varga 
CommitDate: Fri Jul 7 14:52:43 2023 +0200

Related: tdf#155708 Clean-up left over nCloseResponseToJustHide

cont int variable in dialog header.

Follow up (Clean-up) of a5c61b143d53bb10430b8a486874856c16a2d86c

Change-Id: I13ddbad581ee920a72726e18ccb9e7daf4eb7887
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154164
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx
index 640204acfe60..5e11d2f783b5 100644
--- a/include/vcl/toolkit/dialog.hxx
+++ b/include/vcl/toolkit/dialog.hxx
@@ -58,8 +58,6 @@ private:
 boolmbModalMode;
 InitFlagmnInitFlag; // used for deferred init
 
-const int nCloseResponseToJustHide = -42;
-
 VclPtr mpActionArea;
 VclPtr   mpContentArea;
 


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

2023-07-03 Thread Michael Stahl (via logerrit)
 include/vcl/gdimtf.hxx |1 
 sw/source/core/view/vprint.cxx |   65 +++--
 vcl/source/gdi/gdimtf.cxx  |7 +++-
 3 files changed, 25 insertions(+), 48 deletions(-)

New commits:
commit a225b4dbd46897903b217969da5f97f2660022c9
Author: Michael Stahl 
AuthorDate: Fri Jun 30 14:44:21 2023 +0200
Commit: Michael Stahl 
CommitDate: Mon Jul 3 11:32:14 2023 +0200

tdf#152231 vcl,sw: PDF/UA export: fix comments in the margin

If enabled, the comments mess up the structure elements, because the
PageSyncData::mActions stores indexes into the GDIMetaFile::m_aList
vector, and in PageSyncData::PlaySyncPageAct() the indexes don't match.

This is because SwViewShell::PrintOrPDFExport() replaces the GDIMetaFile
with a temporary one, then records the page content, then applies
scaling to the temporary one and replays it, recording with the original
one; somehow replaying a temporary GDIMetaFile with 270 actions to one
that already has 4 actions results in 392 actions.

It's not obvious how this can work with the temporary GDIMetaFile, so
try to get rid of it; not sure if there any drawbacks to this but the
GDIMetaFile is freshly created by the caller in any case.

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

diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index d62cd899623b..63bde564dcfd 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -115,6 +115,7 @@ public:
 voidMove( tools::Long nX, tools::Long nY );
 // additional Move method getting specifics how to handle MapMode( 
MapUnit::MapPixel )
 voidMove( tools::Long nX, tools::Long nY, tools::Long nDPIX, 
tools::Long nDPIY );
+voidScaleActions(double fScaleX, double fScaleY);
 voidScale( double fScaleX, double fScaleY );
 voidScale( const Fraction& rScaleX, const Fraction& rScaleY );
 voidRotate( Degree10 nAngle10 );
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 0ad22ccf5357..3cd0c524007e 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -446,32 +446,12 @@ bool SwViewShell::PrintOrPDFExport(
 // output device is now provided by a call from outside the Writer)
 pOutDev->Push();
 
-// fdo#36815 for comments in margins print to a metafile
-// and then scale that metafile down so that the comments
-// will fit on the real page, and replay that scaled
-// output to the real outputdevice
-GDIMetaFile *pOrigRecorder(nullptr);
-std::unique_ptr pMetaFile;
 SwPostItMode nPostItMode = rPrintData.GetPrintPostIts();
 
 // tdf#91680 Reserve space in margin for comments only if there are 
comments
 const bool bHasPostItsToPrintInMargins = ( nPostItMode == 
SwPostItMode::InMargins ) &&
 sw_GetPostIts( 
GetDoc()->getIDocumentFieldsAccess(), nullptr );
-
-if ( bHasPostItsToPrintInMargins )
-{
-//get and disable the existing recorder
-pOrigRecorder = pOutDev->GetConnectMetaFile();
-pOutDev->SetConnectMetaFile(nullptr);
-// turn off output to the device
-pOutDev->EnableOutput(false);
-// just record the rendering commands to the metafile
-// instead
-pMetaFile.reset(new GDIMetaFile);
-pMetaFile->SetPrefSize(pOutDev->GetOutputSize());
-pMetaFile->SetPrefMapMode(pOutDev->GetMapMode());
-pMetaFile->Record(pOutDev);
-}
+::std::optional oOrigHeight;
 
 // Print/PDF export for (multi-)selection has already generated a
 // temporary document with the selected text.
@@ -535,32 +515,7 @@ bool SwViewShell::PrintOrPDFExport(
 pPostItManager->CalcRects();
 pPostItManager->LayoutPostIts();
 pPostItManager->DrawNotesForPage(pOutDev, nPage-1);
-
-//Stop recording now
-pMetaFile->Stop();
-pMetaFile->WindStart();
-//Enable output to the device again
-pOutDev->EnableOutput();
-//Restore the original recorder
-pOutDev->SetConnectMetaFile(pOrigRecorder);
-
-//Now scale the recorded page down so the notes
-//will fit in the final page
-double fScale = 0.75;
-tools::Long nOrigHeight = pStPage->getFrameArea().Height();
-tools::Long nNewHeight = nOrigHeight*fScale;
-tools::Long nShiftY = (nOrigHeight-nNewHeight)/2;
-pMetaFile->Scale( fScale, fScale );
-pMetaFile->WindStart();
-//Move the scaled page down to center it
-//the other variant of Move does not map pixels
-//back to the logical units correctly
-pMetaFile->Move(0, co

[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

2023-06-27 Thread Andrea Gelmini (via logerrit)
 include/vcl/cairo.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6870e22ada9363d86ba8aa0908d49018d76037bb
Author: Andrea Gelmini 
AuthorDate: Tue Jun 27 12:38:22 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Jun 27 13:33:12 2023 +0200

Fix typo

Change-Id: I3934967d97ee3841b37882355a5006738679976a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153639
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/include/vcl/cairo.hxx b/include/vcl/cairo.hxx
index 8a6042517534..9596b24ccb24 100644
--- a/include/vcl/cairo.hxx
+++ b/include/vcl/cairo.hxx
@@ -32,7 +32,7 @@
 
 /*
  For internal cairo we have the option --enable-cairo-rgba which is potentially
- useful for Andoid or Online to switch the rgb components. For Android cairo 
then
+ useful for Android or Online to switch the rgb components. For Android cairo 
then
  matches the OpenGL GL_RGBA format so we can use it there where we don't have
  GL_BGRA support. Similarly for Online we can then use cairo's pixel data
  without needing to swizzle it for use as a canvas ImageData.


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

2023-06-19 Thread Khaled Hosny (via logerrit)
 include/vcl/embeddedfontshelper.hxx  |4 ++--
 include/xmloff/xmlimp.hxx|2 +-
 vcl/source/gdi/embeddedfontshelper.cxx   |8 
 writerfilter/source/dmapper/FontTable.cxx|   14 +++---
 writerfilter/source/dmapper/FontTable.hxx|6 +++---
 xmloff/source/core/xmlimp.cxx|2 +-
 xmloff/source/style/XMLFontStylesContext.cxx |4 ++--
 7 files changed, 20 insertions(+), 20 deletions(-)

New commits:
commit d80d89d98183ee0c1a232b975107c319001f3fbc
Author: Khaled Hosny 
AuthorDate: Mon Jun 19 17:08:45 2023 +0300
Commit: خالد حسني 
CommitDate: Mon Jun 19 21:52:25 2023 +0200

embeddedfontshelper: use u16string_view instead of char pointer

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

diff --git a/include/vcl/embeddedfontshelper.hxx 
b/include/vcl/embeddedfontshelper.hxx
index 4802c13a2d8d..cbf91ee7f09b 100644
--- a/include/vcl/embeddedfontshelper.hxx
+++ b/include/vcl/embeddedfontshelper.hxx
@@ -65,7 +65,7 @@ public:
   @param eot whether the data is compressed in Embedded OpenType format
 */
 bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& 
stream,
-const OUString& fontName, const char* extra,
+const OUString& fontName, std::u16string_view extra,
 std::vector< unsigned char > const & key, bool eot = false);
 
 /**
@@ -76,7 +76,7 @@ public:
   @param fontName name of the font (e.g. 'Times New Roman')
   @param extra additional text to use for name (e.g. to distinguish 
regular from bold, italic,...), "?" for unique
 */
-static OUString fileUrlForTemporaryFont( const OUString& fontName, const 
char* extra );
+static OUString fileUrlForTemporaryFont( const OUString& fontName, 
std::u16string_view extra );
 
 /**
   Adds the accumulated fonts to the list of known fonts. The fonts are 
used only until application
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 3287911f1112..fda180bb7837 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -582,7 +582,7 @@ public:
 
 // see EmbeddedFontsHelper::addEmbeddedFont
 bool addEmbeddedFont( const css::uno::Reference< css::io::XInputStream >& 
stream,
-const OUString& fontName, const char* extra,
+const OUString& fontName, std::u16string_view extra,
 std::vector< unsigned char > const & key, bool eot);
 
 virtual void NotifyContainsEmbeddedFont() {}
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx 
b/vcl/source/gdi/embeddedfontshelper.cxx
index b5aa00aafebe..a8a4f7e983ba 100644
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ b/vcl/source/gdi/embeddedfontshelper.cxx
@@ -66,7 +66,7 @@ void EmbeddedFontsHelper::clearTemporaryFontFiles()
 }
 
 bool EmbeddedFontsHelper::addEmbeddedFont( const uno::Reference< 
io::XInputStream >& stream, const OUString& fontName,
-const char* extra, std::vector< unsigned char > const & key, bool eot )
+std::u16string_view extra, std::vector< unsigned char > const & key, bool 
eot )
 {
 OUString fileUrl = EmbeddedFontsHelper::fileUrlForTemporaryFont( fontName, 
extra );
 osl::File file( fileUrl );
@@ -189,7 +189,7 @@ void EmbeddedFontsHelper::activateFonts()
 m_aAccumulatedFonts.clear();
 }
 
-OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( const OUString& 
fontName, const char* extra )
+OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( const OUString& 
fontName, std::u16string_view extra )
 {
 OUString path = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE( 
"bootstrap") "::UserInstallation}";
 rtl::Bootstrap::expandMacros( path );
@@ -197,10 +197,10 @@ OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( 
const OUString& fontName,
 osl::Directory::createPath( path );
 OUString filename = fontName;
 static int uniqueCounter = 0;
-if( strcmp( extra, "?" ) == 0 )
+if( extra == u"?" )
 filename += OUString::number( uniqueCounter++ );
 else
-filename += OStringToOUString( extra, RTL_TEXTENCODING_ASCII_US );
+filename += extra;
 filename += ".ttf"; // TODO is it always ttf?
 return path + filename;
 }
diff --git a/writerfilter/source/dmapper/FontTable.cxx 
b/writerfilter/source/dmapper/FontTable.cxx
index d7c6b4fe3f5b..3ddebaedf419 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -119,10 +119,10 @@ void FontTable::lcl_sprm(Sprm& rSprm)
 if( pProperties )
 {
 EmbeddedFontHandler handler(*this, 
m_pImpl->pCurrentEntry->sFontName,
-nSprmId == NS_ooxml::LN_CT_Font_embedRegular ? ""
-: nSprmId == NS_ooxml::LN_CT_Font_embedBold ? "b"
-: nSprmId == NS_ooxml::LN_CT_Font_embedItalic ? "i"
-   

[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 sw/source vcl/headless vcl/unx

2023-06-09 Thread Caolán McNamara (via logerrit)
 include/vcl/vclenum.hxx |7 ++-
 sw/source/core/text/inftxt.cxx  |4 +++-
 vcl/headless/CairoCommon.cxx|1 +
 vcl/unx/generic/gdi/cairotextrender.cxx |5 +++--
 4 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 30bc5fdb49621269b7281aace610ca85b150766c
Author: Caolán McNamara 
AuthorDate: Wed Jun 7 19:50:50 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Jun 9 12:44:38 2023 +0200

Related: CollaboraOnline#6511 cairo backend can do transparent text

and avoid the extra work required here for the generic case.

keep the transparency helper for the other backends, or any case where
we may be recording to metafile, or pdf export etc

Change-Id: Ic01b8b69f2d59e585605ce1e981298fda9185824
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152719
Reviewed-by: Michael Meeks 
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 8e38593c047c..9f9abd75d1df 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -159,7 +159,12 @@ enum class LineStyle
 
 typedef sal_uInt32 sal_UCS4;// TODO: this should be moved to rtl
 
-enum class OutDevSupportType { TransparentRect, B2DDraw };
+enum class OutDevSupportType
+{
+TransparentRect,
+B2DDraw,
+TransparentText // if alpha in TextColor can be honored
+};
 
 struct ItalicMatrix
 {
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 32676958c914..f67f4e580292 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -698,7 +698,9 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, 
const SwLinePortion &rPo
 std::unique_ptr> pTransparentText;
 if (m_pFnt->GetColor() != COL_AUTO && m_pFnt->GetColor().IsTransparent())
 {
-pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, 
aDrawInf));
+// if drawing to a backend that supports transparency for text color, 
then we don't need to use this
+if (!m_bOnWin || 
!m_pOut->SupportsOperation(OutDevSupportType::TransparentText) || 
m_pOut->GetConnectMetaFile())
+pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, 
aDrawInf));
 }
 
 if( GetTextFly().IsOn() )
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 9c67fb079566..a0a0a05b89bc 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1980,6 +1980,7 @@ bool CairoCommon::supportsOperation(OutDevSupportType 
eType)
 switch (eType)
 {
 case OutDevSupportType::TransparentRect:
+case OutDevSupportType::TransparentText:
 case OutDevSupportType::B2DDraw:
 return true;
 }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index f962c21d39ed..8390e47680be 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -343,10 +343,11 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 
 clipRegion(cr);
 
-cairo_set_source_rgb(cr,
+cairo_set_source_rgba(cr,
 mnTextColor.GetRed()/255.0,
 mnTextColor.GetGreen()/255.0,
-mnTextColor.GetBlue()/255.0);
+mnTextColor.GetBlue()/255.0,
+mnTextColor.GetAlpha()/255.0);
 
 int nRatio = nWidth * 10 / nHeight;
 


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

2023-06-08 Thread Jaume Pujantell (via logerrit)
 include/vcl/pdfwriter.hxx  |4 +
 sd/inc/Annotation.hxx  |5 ++
 sd/source/core/annotations/Annotation.cxx  |   12 +++--
 sd/source/filter/pdf/sdpdffilter.cxx   |5 ++
 sd/source/ui/annotations/annotationtag.cxx |   23 +++---
 sd/source/ui/unoidl/unomodel.cxx   |   17 ++-
 vcl/source/filter/ipdf/pdfread.cxx |1 
 vcl/source/gdi/pdfwriter_impl.cxx  |   64 +++--
 vcl/source/pdf/PDFiumLibrary.cxx   |   24 --
 9 files changed, 133 insertions(+), 22 deletions(-)

New commits:
commit 53d610786ba8085fcce331174c74294c90c41a20
Author: Jaume Pujantell 
AuthorDate: Mon Jun 5 11:49:41 2023 +0200
Commit: Andras Timar 
CommitDate: Thu Jun 8 21:53:59 2023 +0200

pdfium: better suport for annotations and some fixes

Added suport to import FreeText annotations. Added some suport to export
graphical annotations. Fixed some color issues to be more inline with
the pdfium library.

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

diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 156720fed840..1abd5bf80151 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -66,6 +66,10 @@ struct PDFNote
 OUString  Title;  // optional title for the popup 
containing the note
 OUString  Contents;   // contents of the note
 css::util::DateTime maModificationDate;
+bool isFreeText;
+std::vector maPolygons;
+Color annotColor;
+Color interiorColor;
 };
 
 class VCL_DLLPUBLIC PDFOutputStream
diff --git a/sd/inc/Annotation.hxx b/sd/inc/Annotation.hxx
index 707f2cdc8e78..00870dc703e8 100644
--- a/sd/inc/Annotation.hxx
+++ b/sd/inc/Annotation.hxx
@@ -133,6 +133,10 @@ public:
 return bool(m_pCustomAnnotationMarker);
 }
 
+void setIsFreeText(bool value) { m_bIsFreeText = value; }
+
+bool isFreeText() const { return m_bIsFreeText; }
+
 private:
 // destructor is private and will be called indirectly by the release call 
   virtual ~Annotation() {}
 
@@ -152,6 +156,7 @@ private:
 rtl::Reference m_TextRange;
 
 std::unique_ptr m_pCustomAnnotationMarker;
+bool m_bIsFreeText;
 };
 
 }
diff --git a/sd/source/core/annotations/Annotation.cxx 
b/sd/source/core/annotations/Annotation.cxx
index 850f1a973ff1..432d38f9cb32 100644
--- a/sd/source/core/annotations/Annotation.cxx
+++ b/sd/source/core/annotations/Annotation.cxx
@@ -117,11 +117,13 @@ void 
createAnnotation(uno::Reference& xAnnotation, SdPage*
 
 sal_uInt32 Annotation::m_nLastId = 1;
 
-Annotation::Annotation( const uno::Reference& context, 
SdPage* pPage )
-: ::cppu::WeakComponentImplHelper(m_aMutex)
-, ::cppu::PropertySetMixin(context, 
IMPLEMENTS_PROPERTY_SET, uno::Sequence())
-, m_nId( m_nLastId++ )
-, mpPage( pPage )
+Annotation::Annotation(const uno::Reference& context, 
SdPage* pPage)
+: ::cppu::WeakComponentImplHelper(m_aMutex)
+, ::cppu::PropertySetMixin(context, 
IMPLEMENTS_PROPERTY_SET,
+uno::Sequence())
+, m_nId(m_nLastId++)
+, mpPage(pPage)
+, m_bIsFreeText(false)
 {
 }
 
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx 
b/sd/source/filter/pdf/sdpdffilter.cxx
index 39c6ada55f4e..35b1bffbcb73 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -189,6 +189,11 @@ bool SdPdfFilter::Import()
 rCustomAnnotationMarker.maFillColor = COL_TRANSPARENT;
 }
 }
+else if (rPDFAnnotation.meSubType == 
vcl::pdf::PDFAnnotationSubType::FreeText)
+{
+auto* pAnnotation = 
static_cast(xAnnotation.get());
+pAnnotation->setIsFreeText(true);
+}
 }
 }
 mrDocument.setLock(bWasLocked);
diff --git a/sd/source/ui/annotations/annotationtag.cxx 
b/sd/source/ui/annotations/annotationtag.cxx
index 7afe26ee54b0..dbadf4cb6fe1 100644
--- a/sd/source/ui/annotations/annotationtag.cxx
+++ b/sd/source/ui/annotations/annotationtag.cxx
@@ -524,18 +524,29 @@ BitmapEx AnnotationTag::CreateAnnotationBitmap( bool 
bSelected )
 {
 ScopedVclPtrInstance< VirtualDevice > pVDev;
 
-OUString sInitials(mxAnnotation->getInitials());
-if (sInitials.isEmpty())
-sInitials = getInitials(mxAnnotation->getAuthor());
+OUString sText;
+auto* pAnnotation = dynamic_cast(mxAnnotation.get());
+if (pAnnotation && pAnnotation->isFreeText())
+{
+sText = mxAnnotation->getTextRange()->getString();
+}
+else
+{
+OUString sInitials(mxAnnotation->getInitials());
+if (sInitials.isEmpty())
+{
+sInitials = getInitials(mxAnnotation->getAuthor());
+}
 
-OUString sAuthor(sInitials + " " + OUString::number(mnIndex));

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

2023-06-05 Thread Mike Kaganski (via logerrit)
 include/vcl/weld.hxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 8149e903db501511193761eebca1640407ad52dc
Author: Mike Kaganski 
AuthorDate: Mon Jun 5 13:52:10 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Jun 5 15:31:48 2023 +0200

Introduce weld::ComboBox::insert/append taking a single ComboBoxEntry

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

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e9068f446d6d..69e95ce7ad01 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -748,10 +748,16 @@ public:
 = 0;
 virtual void insert_vector(const std::vector& rItems, 
bool bKeepExisting)
 = 0;
+void insert(int pos, const weld::ComboBoxEntry& rItem)
+{
+insert(pos, rItem.sString, rItem.sId.isEmpty() ? nullptr : &rItem.sId,
+   rItem.sImage.isEmpty() ? nullptr : &rItem.sImage, nullptr);
+}
 void insert_text(int pos, const OUString& rStr)
 {
 insert(pos, rStr, nullptr, nullptr, nullptr);
 }
+void append(const weld::ComboBoxEntry& rItem) { insert(-1, rItem); }
 void append_text(const OUString& rStr) { insert(-1, rStr, nullptr, 
nullptr, nullptr); }
 void append(const OUString& rId, const OUString& rStr)
 {
@@ -1919,10 +1925,7 @@ public:
 if (!bKeepExisting)
 m_xTreeView->clear();
 for (const auto& rItem : rItems)
-{
-m_xTreeView->insert(-1, rItem.sString, rItem.sId.isEmpty() ? 
nullptr : &rItem.sId,
-rItem.sImage.isEmpty() ? nullptr : 
&rItem.sImage, nullptr);
-}
+append(rItem);
 m_xTreeView->thaw();
 }
 


[Libreoffice-commits] core.git: include/vcl sc/source vcl/osx vcl/qt5 vcl/source vcl/unx vcl/win

2023-05-23 Thread Heiko Tietze (via logerrit)
 include/vcl/settings.hxx  |3 +++
 sc/source/ui/view/gridwin.cxx |2 +-
 sc/source/ui/view/hdrcont.cxx |2 +-
 vcl/osx/salframe.cxx  |4 
 vcl/qt5/QtFrame.cxx   |2 ++
 vcl/source/app/settings.cxx   |   17 +
 vcl/unx/gtk3/salnativewidgets-gtk.cxx |1 +
 vcl/win/window/salframe.cxx   |4 
 8 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit 258686a58f909ab04c7281c05f15882eb400748e
Author: Heiko Tietze 
AuthorDate: Wed May 17 16:48:30 2023 +0200
Commit: Heiko Tietze 
CommitDate: Tue May 23 09:44:21 2023 +0200

Resolves tdf#145080 - Use accent color for focused cell

Accent color added but effectively working only on macOS
See inline comments for gtk, qt, and win

Change-Id: I1e4a729331735683921f94b27bb2bb02555c0165
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151887
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 05c7678869d0..7f4849c7b718 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -336,6 +336,9 @@ public:
 voidSetDeactiveBorderColor( const Color& 
rColor );
 const Color&GetDeactiveBorderColor() const;
 
+voidSetAccentColor( const Color& rColor );
+const Color&GetAccentColor() const;
+
 voidSetHighlightColor( const Color& rColor );
 const Color&GetHighlightColor() const;
 
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index c2ec3311bc9d..d32313ae4308 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6454,7 +6454,7 @@ void ScGridWindow::UpdateCursorOverlay()
 
 if (xOverlayManager.is())
 {
-Color aCursorColor = 
GetSettings().GetStyleSettings().GetHighlightColor();
+Color aCursorColor = 
GetSettings().GetStyleSettings().GetAccentColor();
 if (mrViewData.GetActivePart() != eWhich)
 // non-active pane uses a different color.
 aCursorColor = 
SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor;
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 305ada306856..d6e9b5dbeb3f 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -361,7 +361,7 @@ void ScHeaderControl::Paint( vcl::RenderContext& 
/*rRenderContext*/, const tools
 {
 // background for selection
 GetOutDev()->SetLineColor();
-GetOutDev()->SetFillColor( rStyleSettings.GetHighlightColor() 
);
+GetOutDev()->SetFillColor( rStyleSettings.GetAccentColor() );
 GetOutDev()->DrawRect( aFillRect );
 }
 }
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index ea514b786ada..b4a2d07463b8 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1384,6 +1384,10 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 vcl::Font aTooltipFont(getFont([NSFont toolTipsFontOfSize: 0], nDPIY, 
aAppFont));
 aStyleSettings.SetHelpFont(aTooltipFont);
 
+Color aAccentColor( getColor( [NSColor controlAccentColor],
+   aStyleSettings.GetAccentColor(), mpNSWindow 
) );
+aStyleSettings.SetAccentColor( aAccentColor );
+
 Color aHighlightColor( getColor( [NSColor selectedTextBackgroundColor],
   aStyleSettings.GetHighlightColor(), 
mpNSWindow ) );
 aStyleSettings.SetHighlightColor( aHighlightColor );
diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx
index ed5c0538e5cb..08d206261b88 100644
--- a/vcl/qt5/QtFrame.cxx
+++ b/vcl/qt5/QtFrame.cxx
@@ -1143,6 +1143,8 @@ void QtFrame::UpdateSettings(AllSettings& rSettings)
 style.SetWorkspaceColor(aMid);
 
 // Selection
+// https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/305
+style.SetAccentColor(aHigh);
 style.SetHighlightColor(aHigh);
 style.SetHighlightTextColor(aHighText);
 style.SetListBoxWindowHighlightColor(aHigh);
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 313aacfce155..9921b0b774bc 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -112,6 +112,7 @@ struct ImplStyleData
 Color   maGroupTextColor;
 Color   maHelpColor;
 Color   maHelpTextColor;
+Color   maAccentColor;
 Color   maHighlightColor;
 Color   maHighlightTextColor;
 Color   maLabelTextColor;
@@ -536,6 +537,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
   

[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/inc vcl/source vcl/win

2023-05-11 Thread anfanite396 (via logerrit)
 include/vcl/salnativewidgets.hxx  |   18 
 vcl/inc/menubarvalue.hxx  |   49 ++
 vcl/source/outdev/nativecontrols.cxx  |1 
 vcl/source/window/menubarwindow.cxx   |1 
 vcl/win/gdi/salnativewidgets-luna.cxx |1 
 5 files changed, 52 insertions(+), 18 deletions(-)

New commits:
commit 35845a056e332c1d78d536b613aeb3183af09a91
Author: anfanite396 
AuthorDate: Fri Mar 17 21:00:19 2023 +0530
Commit: Hossein 
CommitDate: Thu May 11 10:35:53 2023 +0200

tdf#97228 Move MenubarValue class to separate include file

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

diff --git a/include/vcl/salnativewidgets.hxx b/include/vcl/salnativewidgets.hxx
index 21c852b6acbd..907c3b618f88 100644
--- a/include/vcl/salnativewidgets.hxx
+++ b/include/vcl/salnativewidgets.hxx
@@ -446,24 +446,6 @@ class SAL_DLLPUBLIC_RTTI SpinbuttonValue final : public 
ImplControlValue
 SpinbuttonValue & operator =(SpinbuttonValue &&) = delete; // due to 
ImplControlValue
 };
 
-/*  MenubarValue:
- *
- *  Value container for menubars specifying height of adjacent docking area
- */
-class MenubarValue final : public ImplControlValue
-{
-public:
-MenubarValue() : ImplControlValue( ControlType::Menubar, 0 )
-{ maTopDockingAreaHeight=0; }
-virtual ~MenubarValue() override;
-virtual MenubarValue* clone() const override;
-MenubarValue(MenubarValue const &) = default;
-MenubarValue(MenubarValue &&) = default;
-MenubarValue & operator =(MenubarValue const &) = delete; // due to 
ImplControlValue
-MenubarValue & operator =(MenubarValue &&) = delete; // due to 
ImplControlValue
-int maTopDockingAreaHeight;
-};
-
 /* MenupopupValue:
  *
  * Value container for menu items; specifies the rectangle for the whole item 
which
diff --git a/vcl/inc/menubarvalue.hxx b/vcl/inc/menubarvalue.hxx
new file mode 100644
index ..0185037ba326
--- /dev/null
+++ b/vcl/inc/menubarvalue.hxx
@@ -0,0 +1,49 @@
+/* -*- 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 .
+ */
+
+#ifndef INCLUDED_VCL_INC_MENUBARVALUE_HXX
+#define INCLUDED_VCL_INC_MENUBARVALUE_HXX
+
+#include 
+#include 
+
+/*  MenubarValue:
+ *
+ *  Value container for menubars specifying height of adjacent docking area
+ */
+class MenubarValue final : public ImplControlValue
+{
+public:
+MenubarValue()
+: ImplControlValue(ControlType::Menubar, 0)
+{
+maTopDockingAreaHeight = 0;
+}
+virtual ~MenubarValue() override;
+virtual MenubarValue* clone() const override;
+MenubarValue(MenubarValue const&) = default;
+MenubarValue(MenubarValue&&) = default;
+MenubarValue& operator=(MenubarValue const&) = delete; // due to 
ImplControlValue
+MenubarValue& operator=(MenubarValue&&) = delete; // due to 
ImplControlValue
+int maTopDockingAreaHeight;
+};
+
+#endif // INCLUDED_VCL_INC_MENUBARVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/nativecontrols.cxx 
b/vcl/source/outdev/nativecontrols.cxx
index cee9408d6cfb..1b035c72bd2d 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/vcl/source/window/menubarwindow.cxx 
b/vcl/source/window/menubarwindow.cxx
index 0109bb559503..89e6b9246148 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include "bufferdevice.hxx"
+#include 
 
 // document closing button
 #define IID_DOCUMENTCLOSE 1
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx 
b/vcl/win/gdi/salnativewidgets-luna.cxx
index c837cb7a1c82..0dd5b2dd7442 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 


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

2023-05-10 Thread Noel Grandin (via logerrit)
 include/vcl/alpha.hxx|2 +-
 vcl/qa/cppunit/skia/skia.cxx |8 
 vcl/source/bitmap/alpha.cxx  |5 ++---
 3 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit 04f02cfecfae481f256b6c98a1940fc5235a921a
Author: Noel Grandin 
AuthorDate: Wed May 10 14:06:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 10 15:54:11 2023 +0200

AlphaMask::BlendWith wants an AlphaMask parameter

so make it so

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

diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 855485d4399e..d159ef657c2a 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -49,7 +49,7 @@ public:
 Bitmap const & GetBitmap() const;
 
 voidErase( sal_uInt8 cTransparency );
-voidBlendWith(const Bitmap& rOther);
+voidBlendWith(const AlphaMask& rOther);
 
 // check if alpha is used, returns true if at least one pixel has 
transparence
 boolhasAlpha() const;
diff --git a/vcl/qa/cppunit/skia/skia.cxx b/vcl/qa/cppunit/skia/skia.cxx
index 606541a0ac48..5d81e39f587a 100644
--- a/vcl/qa/cppunit/skia/skia.cxx
+++ b/vcl/qa/cppunit/skia/skia.cxx
@@ -232,12 +232,12 @@ void SkiaTest::testAlphaBlendWith()
 if (!SkiaHelper::isVCLSkiaEnabled())
 return;
 AlphaMask alpha(Size(10, 10));
-Bitmap bitmap(Size(10, 10), vcl::PixelFormat::N24_BPP);
+AlphaMask bitmap(Size(10, 10));
 // Test with erase colors set.
 alpha.Erase(64);
 SkiaSalBitmap* skiaAlpha = 
dynamic_cast(alpha.ImplGetSalBitmap().get());
 CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
-bitmap.Erase(Color(64, 64, 64));
+bitmap.Erase(64);
 SkiaSalBitmap* skiaBitmap = 
dynamic_cast(bitmap.ImplGetSalBitmap().get());
 CPPUNIT_ASSERT(skiaBitmap->unittestHasEraseColor());
 alpha.BlendWith(bitmap);
@@ -254,7 +254,7 @@ void SkiaTest::testAlphaBlendWith()
 skiaAlpha->GetSkImage();
 CPPUNIT_ASSERT(!skiaAlpha->unittestHasEraseColor());
 CPPUNIT_ASSERT(skiaAlpha->unittestHasImage());
-bitmap.Erase(Color(64, 64, 64));
+bitmap.Erase(64);
 Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will 
create pixel data.
 skiaBitmap = dynamic_cast(bitmap.ImplGetSalBitmap().get());
 skiaBitmap->GetSkImage();
@@ -271,7 +271,7 @@ void SkiaTest::testAlphaBlendWith()
 alpha.Erase(64);
 skiaAlpha = dynamic_cast(alpha.ImplGetSalBitmap().get());
 CPPUNIT_ASSERT(skiaAlpha->unittestHasEraseColor());
-bitmap.Erase(Color(64, 64, 64));
+bitmap.Erase(64);
 Bitmap::ScopedReadAccess(bitmap)->GetColor(0, 0); // Reading a pixel will 
create pixel data.
 skiaBitmap = dynamic_cast(bitmap.ImplGetSalBitmap().get());
 skiaBitmap->GetSkImage();
diff --git a/vcl/source/bitmap/alpha.cxx b/vcl/source/bitmap/alpha.cxx
index 8618c052ab03..ab23c3e93427 100644
--- a/vcl/source/bitmap/alpha.cxx
+++ b/vcl/source/bitmap/alpha.cxx
@@ -80,7 +80,7 @@ void AlphaMask::Erase( sal_uInt8 cTransparency )
 Bitmap::Erase( Color( cTransparency, cTransparency, cTransparency ) );
 }
 
-void AlphaMask::BlendWith(const Bitmap& rOther)
+void AlphaMask::BlendWith(const AlphaMask& rOther)
 {
 std::shared_ptr 
xImpBmp(ImplGetSVData()->mpDefInst->CreateSalBitmap());
 if (xImpBmp->Create(*ImplGetSalBitmap()) && 
xImpBmp->AlphaBlendWith(*rOther.ImplGetSalBitmap()))
@@ -88,8 +88,7 @@ void AlphaMask::BlendWith(const Bitmap& rOther)
 ImplSetSalBitmap(xImpBmp);
 return;
 }
-AlphaMask aOther(rOther); // to 8 bits
-Bitmap::ScopedReadAccess pOtherAcc(aOther);
+Bitmap::ScopedReadAccess pOtherAcc(const_cast(rOther));
 AlphaScopedWriteAccess pAcc(*this);
 assert (pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && 
pAcc->GetBitCount() == 8 && "cannot BlendWith this combination");
 if (!(pOtherAcc && pAcc && pOtherAcc->GetBitCount() == 8 && 
pAcc->GetBitCount() == 8))


[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

2023-04-23 Thread Caolán McNamara (via logerrit)
 include/vcl/vclptr.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit f7307c6366196940dcdbf6d2bfc23b69b18acb85
Author: Caolán McNamara 
AuthorDate: Sat Apr 22 21:53:25 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Apr 23 14:12:49 2023 +0200

cid#1524746 silence Using a moved object

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

diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index 326881edd105..ea2fffe41790 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -201,7 +201,8 @@ public:
 {
 // hold it alive for the lifetime of this method
 ::rtl::Reference aTmp(std::move(m_rInnerRef));
-assert(!m_rInnerRef); // the move ctor above must take care of it
+// coverity[use_after_move : SUPPRESS] - the move ctor above must take 
care of it
+assert(!m_rInnerRef);
 if (aTmp.get()) {
 aTmp->disposeOnce();
 }


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

2023-04-17 Thread Mike Kaganski (via logerrit)
 include/vcl/vclptr.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60022965ce3791e578468b366baf33c64338a388
Author: Mike Kaganski 
AuthorDate: Mon Apr 17 18:40:24 2023 +0300
Commit: Mike Kaganski 
CommitDate: Mon Apr 17 20:36:09 2023 +0200

Use move ctor here

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

diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx
index 3775034ff0c6..326881edd105 100644
--- a/include/vcl/vclptr.hxx
+++ b/include/vcl/vclptr.hxx
@@ -200,8 +200,8 @@ public:
 void disposeAndClear()
 {
 // hold it alive for the lifetime of this method
-::rtl::Reference aTmp(m_rInnerRef);
-m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-)
+::rtl::Reference aTmp(std::move(m_rInnerRef));
+assert(!m_rInnerRef); // the move ctor above must take care of it
 if (aTmp.get()) {
 aTmp->disposeOnce();
 }


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

2023-04-14 Thread Caolán McNamara (via logerrit)
 include/vcl/settings.hxx |2 ++
 vcl/inc/osx/salframe.h   |1 +
 vcl/inc/salframe.hxx |1 +
 vcl/inc/unx/gtk/gtkframe.hxx |1 +
 vcl/inc/win/salframe.h   |1 +
 vcl/osx/salframe.cxx |   22 +++---
 vcl/source/app/settings.cxx  |8 
 vcl/unx/gtk3/gtkframe.cxx|   10 ++
 vcl/win/window/salframe.cxx  |5 +
 9 files changed, 44 insertions(+), 7 deletions(-)

New commits:
commit f76ec0b61e19267d9a01946dee2979f53f182a46
Author: Caolán McNamara 
AuthorDate: Fri Apr 14 10:50:59 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Apr 14 15:57:22 2023 +0200

add a way to resolve if dark mode (explicit or auto) is active

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

diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index 9292e10e45cf..05c7678869d0 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -648,6 +648,8 @@ public:
 // 0 auto, 1 light, 2, dark
 static void SetDarkMode(int nMode);
 static int  GetDarkMode();
+// return if dark mode is active, resolving 'auto' to dark (true) or light 
(false)
+static bool GetUseDarkMode();
 static void SetAppColorMode(int nMode);
 static int  GetAppColorMode();
 booloperator ==( const MiscSettings& rSet ) 
const;
diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index af8783b96147..a9c2a4039d0f 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -164,6 +164,7 @@ public:
 // done setting up the clipregion
 virtual void EndSetClipRegion() override;
 virtual void UpdateDarkMode() override;
+virtual bool GetUseDarkMode() const override;
 
 void UpdateFrameGeometry();
 
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index a78f9afe08c0..8f6e2ddfbc50 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -300,6 +300,7 @@ public:
 void NotifyModalHierarchy(bool bModal) { 
m_aModalHierarchyHdl.Call(bModal); }
 
 virtual voidUpdateDarkMode() {}
+virtual boolGetUseDarkMode() const { return false; }
 
 // Call the callback set; this sometimes necessary for implementation 
classes
 // that should not know more than necessary about the SalFrame 
implementation
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index d84abd09f7d3..00bbd26379ae 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -612,6 +612,7 @@ public:
 virtual boolHidePopover(void* nId) override;
 virtual weld::Window*   GetFrameWeld() const override;
 virtual voidUpdateDarkMode() override;
+virtual boolGetUseDarkMode() const override;
 
 static GtkSalFrame *getFromWindow( GtkWidget *pWindow );
 
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 78f61945a311..676c70c1eca0 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -140,6 +140,7 @@ public:
 virtual voidUnionClipRegion( tools::Long nX, tools::Long 
nY, tools::Long nWidth, tools::Long nHeight ) override;
 virtual voidEndSetClipRegion() override;
 virtual voidUpdateDarkMode() override;
+virtual boolGetUseDarkMode() const override;
 
 constexpr vcl::WindowState state() const { return m_eState; }
 void UpdateFrameState();
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index 4c9f891881eb..6288c44b2ab1 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1279,6 +1279,20 @@ void AquaSalFrame::UpdateDarkMode()
 }
 }
 
+bool AquaSalFrame::GetUseDarkMode() const
+{
+if (!mpNSView)
+return false;
+bool bUseDarkMode(false);
+if (@available(macOS 10.14, iOS 13, *))
+{
+NSAppearanceName match = [mpNSView.effectiveAppearance 
bestMatchFromAppearancesWithNames: @[
+  NSAppearanceNameAqua, 
NSAppearanceNameDarkAqua]];
+bUseDarkMode = [match isEqualToString: NSAppearanceNameDarkAqua];
+}
+return bUseDarkMode;
+}
+
 // on OSX-Aqua the style settings are independent of the frame, so it does
 // not really belong here. Since the connection to the Appearance_Manager
 // is currently done in salnativewidgets.cxx this would be a good place.
@@ -1309,13 +1323,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 
 StyleSettings aStyleSettings = rSettings.GetStyleSettings();
 
-bool bUseDarkMode(false);
-if (@available(macOS 10.14, iOS 13, *))
-{
-NSAppearanceName match = [mpNSView.effectiveAppearance 
bestMatchFromAppearancesWithNames: @[
-  NSAppearanceNameAqua, 
NSA

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

2023-04-13 Thread Michael Meeks (via logerrit)
 include/vcl/BinaryDataContainer.hxx|6 --
 vcl/inc/pdf/ExternalPDFStreams.hxx |4 ++--
 vcl/source/filter/graphicfilter.cxx|8 
 vcl/source/graphic/BinaryDataContainer.cxx |   23 +--
 4 files changed, 31 insertions(+), 10 deletions(-)

New commits:
commit c55d5586304f23f9d8acbaffefba68a3a11c6175
Author: Michael Meeks 
AuthorDate: Sat Apr 1 16:10:33 2023 +0100
Commit: Michael Meeks 
CommitDate: Thu Apr 13 22:24:18 2023 +0200

BinaryDataContainer: hand out shared_ptr's to SvStreams.

Hide the SvMemoryStream implementation detail better - this
could be served from a file in future. Also couple lifecycle
of the SvMemoryStream to the vector backing it.

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

diff --git a/include/vcl/BinaryDataContainer.hxx 
b/include/vcl/BinaryDataContainer.hxx
index 2e2e5d4b6264..e9e46a04e667 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -47,8 +47,10 @@ public:
 const sal_uInt8* getData() const;
 css::uno::Sequence getCopyAsByteSequence() const;
 
-// Returns the data as a stream open for reading
-SvMemoryStream getMemoryStream();
+// Returns the data as a readonly stream open for reading
+std::shared_ptr getAsStream();
+
+/// writes the contents to the given stream
 std::size_t writeToStream(SvStream& rStream) const;
 
 size_t calculateHash() const;
diff --git a/vcl/inc/pdf/ExternalPDFStreams.hxx 
b/vcl/inc/pdf/ExternalPDFStreams.hxx
index e2ddd58b91a5..b2936f01a898 100644
--- a/vcl/inc/pdf/ExternalPDFStreams.hxx
+++ b/vcl/inc/pdf/ExternalPDFStreams.hxx
@@ -38,9 +38,9 @@ struct VCL_DLLPUBLIC ExternalPDFStream
 {
 if (!mpPDFDocument)
 {
-SvMemoryStream aPDFStream = maDataContainer.getMemoryStream();
+std::shared_ptr aPDFStream = 
maDataContainer.getAsStream();
 auto pPDFDocument = std::make_shared();
-if (!pPDFDocument->ReadWithPossibleFixup(aPDFStream))
+if (!pPDFDocument->ReadWithPossibleFixup(*aPDFStream))
 {
 SAL_WARN("vcl.pdfwriter",
  "PDFWriterImpl::writeReferenceXObject: reading the 
PDF document failed");
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index 53071f6dea76..e51b027be701 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -914,8 +914,8 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& 
rIStream, sal_uInt64 size
 Size aLogicSize;
 if (eLinkType == GfxLinkType::NativeGif)
 {
-SvMemoryStream 
aMemoryStream(aGraphicContent.getMemoryStream());
-bAnimated = IsGIFAnimated(aMemoryStream, aLogicSize);
+std::shared_ptr pMemoryStream = 
aGraphicContent.getAsStream();
+bAnimated = IsGIFAnimated(*pMemoryStream, aLogicSize);
 if (!pSizeHint && aLogicSize.getWidth() && 
aLogicSize.getHeight())
 {
 pSizeHint = &aLogicSize;
@@ -954,8 +954,8 @@ ErrCode GraphicFilter::readPNG(SvStream & rStream, Graphic 
& rGraphic, GfxLinkTy
 if (auto aMSGifChunk = vcl::PngImageReader::getMicrosoftGifChunk(rStream);
 !aMSGifChunk.isEmpty())
 {
-SvMemoryStream aIStrm(aMSGifChunk.getMemoryStream());
-ImportGIF(aIStrm, rGraphic);
+std::shared_ptr pIStrm(aMSGifChunk.getAsStream());
+ImportGIF(*pIStrm, rGraphic);
 rLinkType = GfxLinkType::NativeGif;
 rpGraphicContent = aMSGifChunk;
 return aReturnCode;
diff --git a/vcl/source/graphic/BinaryDataContainer.cxx 
b/vcl/source/graphic/BinaryDataContainer.cxx
index deb676a553f9..72d9bac27940 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -42,9 +42,28 @@ css::uno::Sequence 
BinaryDataContainer::getCopyAsByteSequence() const
 return aData;
 }
 
-SvMemoryStream BinaryDataContainer::getMemoryStream()
+namespace
 {
-return SvMemoryStream(mpData ? mpData->data() : nullptr, getSize(), 
StreamMode::READ);
+/*
+ * Hold a reference on the internal state in case we swap out
+ * and free the vector while someone holds an SvStream pointer.
+ */
+class ReferencedMemoryStream : public SvMemoryStream
+{
+std::shared_ptr> mpData;
+
+public:
+ReferencedMemoryStream(const std::shared_ptr>& 
rData)
+: SvMemoryStream(rData ? rData->data() : nullptr, rData->size(), 
StreamMode::READ)
+, mpData(rData)
+{
+}
+};
+}
+
+std::shared_ptr BinaryDataContainer::getAsStream()
+{
+return std::make_shared(mpData);
 }
 
 std::size_t BinaryDataContainer::writeToStream(SvStream& rStream) const


[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/inc vcl/jsdialog vcl/source

2023-04-06 Thread Szymon Kłos (via logerrit)
 include/vcl/jsdialog/executor.hxx |   15 +++
 include/vcl/layout.hxx|   10 +-
 include/vcl/weld.hxx  |6 ++
 vcl/inc/salvtables.hxx|6 ++
 vcl/jsdialog/executor.cxx |   26 --
 vcl/source/app/salvtables.cxx |   18 ++
 6 files changed, 66 insertions(+), 15 deletions(-)

New commits:
commit c19f041f27c9a297ec20107acc89e9b1144ec070
Author: Szymon Kłos 
AuthorDate: Fri Mar 31 17:12:51 2023 +0200
Commit: Szymon Kłos 
CommitDate: Thu Apr 6 10:53:21 2023 +0200

jsdialog: implemented mouse events for drawingarea

Change-Id: Ieab3d9fdbcee90ccd125e84f74c06cd1d6711a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149953
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150057
Tested-by: Jenkins

diff --git a/include/vcl/jsdialog/executor.hxx 
b/include/vcl/jsdialog/executor.hxx
index 6138f156e0de..005f9f36070d 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -66,6 +66,21 @@ public:
 rDrawingArea.dblclick(rPos);
 }
 
+static void trigger_mouse_up(weld::DrawingArea& rDrawingArea, const Point& 
rPos)
+{
+rDrawingArea.mouse_up(rPos);
+}
+
+static void trigger_mouse_down(weld::DrawingArea& rDrawingArea, const 
Point& rPos)
+{
+rDrawingArea.mouse_down(rPos);
+}
+
+static void trigger_mouse_move(weld::DrawingArea& rDrawingArea, const 
Point& rPos)
+{
+rDrawingArea.mouse_move(rPos);
+}
+
 static void trigger_selected(weld::MenuButton& rButton, const OUString& 
rIdent)
 {
 rButton.signal_selected(rIdent);
diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx
index 995b0d952ff0..507225f4d249 100644
--- a/include/vcl/layout.hxx
+++ b/include/vcl/layout.hxx
@@ -647,11 +647,6 @@ private:
 {
 m_aResizeHdl.Call(GetOutputSizePixel());
 }
-virtual void MouseMove(const MouseEvent& rMEvt) override
-{
-if (!m_aMouseMotionHdl.Call(rMEvt))
-Control::MouseMove(rMEvt);
-}
 virtual void KeyInput(const KeyEvent& rKEvt) override
 {
 if (!m_aKeyPressHdl.Call(rKEvt))
@@ -711,6 +706,11 @@ public:
 if (!m_aMouseReleaseHdl.Call(rMEvt))
 Control::MouseButtonUp(rMEvt);
 }
+virtual void MouseMove(const MouseEvent& rMEvt) override
+{
+if (!m_aMouseMotionHdl.Call(rMEvt))
+Control::MouseMove(rMEvt);
+}
 virtual OUString GetSurroundingText() const override;
 virtual Selection GetSurroundingTextSelection() const override;
 virtual bool DeleteSurroundingText(const Selection& rSelection) override;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 5b763b4b253c..e9068f446d6d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2360,6 +2360,12 @@ private:
 virtual void click(const Point&) = 0;
 
 virtual void dblclick(const Point&){};
+
+virtual void mouse_up(const Point&){};
+
+virtual void mouse_down(const Point&){};
+
+virtual void mouse_move(const Point&){};
 };
 
 enum class Placement
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index bd462ad56ccd..cbb9fce51eee 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1341,6 +1341,12 @@ public:
 virtual void click(const Point& rPos) override;
 
 virtual void dblclick(const Point& rPos) override;
+
+virtual void mouse_up(const Point& rPos) override;
+
+virtual void mouse_down(const Point& rPos) override;
+
+virtual void mouse_move(const Point& rPos) override;
 };
 
 class SalInstanceToolbar : public SalInstanceWidget, public virtual 
weld::Toolbar
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index cb8dfa4d455c..eb11af9b2884 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -192,7 +192,8 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 auto pArea = dynamic_cast(pWidget);
 if (pArea)
 {
-if (sAction == "click" || sAction == "dblclick")
+if (sAction == "click" || sAction == "dblclick" || sAction == 
"mousemove"
+|| sAction == "mousedown" || sAction == "mouseup")
 {
 OUString sClickData = rData["data"];
 int nSeparatorPos = sClickData.indexOf(';');
@@ -205,23 +206,28 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 if (nClickPosX.empty() || nClickPosY.empty())
 return true;
 
-double posX = o3tl::toDouble(nClickPosX);
-double posY = o3tl::toDouble(nClickPosY);
+double fPosX = o3tl::toDouble(nClickPosX);
+double fPosY = o3tl::toDouble(nC

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

2023-04-05 Thread Szymon Kłos (via logerrit)
 include/vcl/jsdialog/executor.hxx |5 +
 include/vcl/toolkit/menubtn.hxx   |2 ++
 include/vcl/weld.hxx  |2 ++
 vcl/jsdialog/executor.cxx |5 +
 vcl/source/control/menubtn.cxx|   17 +
 5 files changed, 31 insertions(+)

New commits:
commit c81306b7f5f2c12c3b4391dce4697276a0a3523b
Author: Szymon Kłos 
AuthorDate: Wed Mar 15 18:46:17 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Apr 5 16:02:22 2023 +0200

jsdialog: dump menu for menubutton

Change-Id: I449ae3f8cf294e2ab81a5b47862278e325f2cb1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148937
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150041
Tested-by: Jenkins

diff --git a/include/vcl/jsdialog/executor.hxx 
b/include/vcl/jsdialog/executor.hxx
index c781f1ea1150..6138f156e0de 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -66,6 +66,11 @@ public:
 rDrawingArea.dblclick(rPos);
 }
 
+static void trigger_selected(weld::MenuButton& rButton, const OUString& 
rIdent)
+{
+rButton.signal_selected(rIdent);
+}
+
 static void trigger_value_changed(weld::SpinButton& rSpinButton)
 {
 rSpinButton.signal_value_changed();
diff --git a/include/vcl/toolkit/menubtn.hxx b/include/vcl/toolkit/menubtn.hxx
index dba8ec1a52c1..d02d077e8d8a 100644
--- a/include/vcl/toolkit/menubtn.hxx
+++ b/include/vcl/toolkit/menubtn.hxx
@@ -92,6 +92,8 @@ public:
 virtual FactoryFunction GetUITestFactory() const override;
 
 void SetCurItemId();
+
+virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 31ea29f455b6..5b763b4b253c 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1582,6 +1582,8 @@ struct VCL_DLLPUBLIC TriStateEnabled
 
 class VCL_DLLPUBLIC MenuButton : virtual public ToggleButton
 {
+friend class ::LOKTrigger;
+
 Link m_aSelectHdl;
 
 protected:
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 9c81aa767be5..cb8dfa4d455c 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -166,6 +166,11 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 
 return true;
 }
+else if (sAction == "select")
+{
+LOKTrigger::trigger_selected(*pButton, rData["data"]);
+return true;
+}
 }
 }
 else if (sControlType == "checkbox")
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index cd9b2095985e..64aec098db0f 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -265,6 +265,23 @@ void MenuButton::SetCurItemId(){
 msCurItemIdent = mpMenu->GetCurItemIdent();
 }
 
+void MenuButton::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+PushButton::DumpAsPropertyTree(rJsonWriter);
+
+if (mpMenu)
+{
+auto aMenuNode = rJsonWriter.startArray("menu");
+for (int i = 0; i < mpMenu->GetItemCount(); i++)
+{
+auto aEntryNode = rJsonWriter.startStruct();
+auto sId = mpMenu->GetItemId(i);
+rJsonWriter.put("id", mpMenu->GetItemIdent(sId));
+rJsonWriter.put("text", mpMenu->GetItemText(sId));
+}
+}
+}
+
 //class MenuToggleButton 
 
 MenuToggleButton::MenuToggleButton( vcl::Window* pParent, WinBits nWinBits )


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

2023-04-05 Thread Michael Stahl (via logerrit)
 include/vcl/pdfextoutdevdata.hxx|2 +-
 include/vcl/pdfwriter.hxx   |2 +-
 sd/source/ui/unoidl/unomodel.cxx|3 ++-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |3 ++-
 vcl/inc/pdf/pdfwriter_impl.hxx  |6 --
 vcl/qa/cppunit/pdfexport/data/vid.odt   |binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |2 ++
 vcl/source/gdi/pdfextoutdevdata.cxx |   12 +---
 vcl/source/gdi/pdfwriter.cxx|4 ++--
 vcl/source/gdi/pdfwriter_impl.cxx   |8 
 10 files changed, 27 insertions(+), 15 deletions(-)

New commits:
commit 5cc69594e4382c258f0e3e3b1ef210567fce1bd8
Author: Michael Stahl 
AuthorDate: Wed Apr 5 12:24:43 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 5 15:39:37 2023 +0200

vcl,sw,sd: PDF/UA export: produce better /CT for SdrMediaObj

  7.18.6.2 Media clip data
  In the media clip data dictionary, the optional CT and Alt keys
  (ISO 32000-1:2008, 13.2.4.2, Table 274) are required.

Presumably writing a potentially wrong hard-coded mime type here isn't
intended.

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

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 2f0360d1fdd5..58088d235eff 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -270,7 +270,7 @@ public:
 sal_Int32 CreateLink(const tools::Rectangle& rRect, OUString const& 
rAltText, sal_Int32 nPageNr = -1);
 
 /// Create a Screen annotation.
-sal_Int32 CreateScreen(const tools::Rectangle& rRect, OUString const& 
rAltText, sal_Int32 nPageNr, SdrObject const* pObj);
+sal_Int32 CreateScreen(const tools::Rectangle& rRect, OUString const& 
rAltText, OUString const& rMimeType, sal_Int32 nPageNr, SdrObject const* pObj);
 
 /// Get back the annotations created for one SdrObject.
 ::std::vector const& GetScreenAnnotIds(SdrObject const* pObj) 
const;
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 0d959f9add34..156720fed840 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -930,7 +930,7 @@ The following structure describes the permissions used in 
PDF security
 sal_Int32 CreateLink(const tools::Rectangle& rRect, sal_Int32 nPageNr, 
OUString const& rAltText);
 
 /// Creates a screen annotation.
-sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, 
OUString const& rAltText);
+sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, 
OUString const& rAltText, OUString const& rMimeType);
 
 /** creates a destination which is not intended to be referred to by a 
link, but by a public destination Id.
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index bab827c6be5f..ca741e9bb53f 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1659,7 +1659,8 @@ static void ImplPDFExportShapeInteraction( const 
uno::Reference< drawing::XShape
 if (!aMediaURL.isEmpty())
 {
 SdrObject const*const 
pSdrObj(SdrObject::getSdrObjectFromXShape(xShape));
-sal_Int32 nScreenId = 
rPDFExtOutDevData.CreateScreen(aLinkRect, altText, 
rPDFExtOutDevData.GetCurrentPageNumber(), pSdrObj);
+OUString const 
mimeType(xShapePropSet->getPropertyValue("MediaMimeType").get());
+sal_Int32 nScreenId = 
rPDFExtOutDevData.CreateScreen(aLinkRect, altText, mimeType, 
rPDFExtOutDevData.GetCurrentPageNumber(), pSdrObj);
 if (aMediaURL.startsWith("vnd.sun.star.Package:"))
 {
 OUString aTempFileURL;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 26970499ca40..633dd4d2d3c8 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2036,11 +2036,12 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 xShapePropSet->getPropertyValue("MediaURL") >>= 
aMediaURL;
 if (!aMediaURL.isEmpty())
 {
+OUString const 
mimeType(xShapePropSet->getPropertyValue("MediaMimeType").get());
 const SwPageFrame* pCurrPage = 
mrSh.GetLayout()->GetPageAtPos(aSnapRect.Center());
 tools::Rectangle 
aPDFRect(SwRectToPDFRect(pCurrPage, aSnapRect.SVRect()));
 for (sal_Int32 nScreenPageNum : aScreenPageNums)
 {
-sal_Int32 nScreenId = 
pPDFExtOutDevData->CreateScreen(aPDFRect, altText, nScree

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

2023-04-04 Thread Szymon Kłos (via logerrit)
 include/vcl/customweld.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 564d8594afc64cb5e227cedb872b7cf75c0cff07
Author: Szymon Kłos 
AuthorDate: Thu Mar 23 15:49:50 2023 +0100
Commit: Szymon Kłos 
CommitDate: Tue Apr 4 10:22:09 2023 +0200

jsdialog: update drawing area when resized

Change-Id: I429a5d750fc84b42d0d399cf3833f22e7479cfe5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149455
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149998
Tested-by: Jenkins

diff --git a/include/vcl/customweld.hxx b/include/vcl/customweld.hxx
index 32c43db643a8..c7504fb94d95 100644
--- a/include/vcl/customweld.hxx
+++ b/include/vcl/customweld.hxx
@@ -30,7 +30,7 @@ public:
 }
 // rRect is in Logical units rather than Pixels
 virtual void Paint(vcl::RenderContext& rRenderContext, const 
tools::Rectangle& rRect) = 0;
-virtual void Resize() {}
+virtual void Resize() { Invalidate(); }
 virtual bool MouseButtonDown(const MouseEvent&) { return false; }
 virtual bool MouseMove(const MouseEvent&) { return false; }
 virtual bool MouseButtonUp(const MouseEvent&) { return false; }


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

2023-04-03 Thread Michael Meeks (via logerrit)
 include/vcl/BinaryDataContainer.hxx|9 +
 svx/source/xoutdev/_xoutbmp.cxx|3 +--
 vcl/inc/pdf/ExternalPDFStreams.hxx |4 +---
 vcl/source/filter/graphicfilter.cxx|   12 +++-
 vcl/source/gdi/TypeSerializer.cxx  |4 ++--
 vcl/source/gdi/impgraph.cxx|5 +
 vcl/source/graphic/BinaryDataContainer.cxx |   11 +++
 7 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 0bd949f4412249e5ecd63716efcc55d92d120da9
Author: Michael Meeks 
AuthorDate: Sat Apr 1 12:40:58 2023 +0100
Commit: Michael Meeks 
CommitDate: Mon Apr 3 10:30:10 2023 +0200

BinaryDataContainer: pure re-factor to encapsulate stream copying.

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

diff --git a/include/vcl/BinaryDataContainer.hxx 
b/include/vcl/BinaryDataContainer.hxx
index e6e13cd340d8..0d5be69f512c 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -41,16 +41,17 @@ public:
 
 BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) 
noexcept = default;
 
-size_t getSize() const { return mpData ? mpData->size() : 0; }
-bool isEmpty() const { return !mpData || mpData->empty(); }
-const sal_uInt8* getData() const { return mpData ? mpData->data() : 
nullptr; }
+size_t getSize() const;
+bool isEmpty() const;
+const sal_uInt8* getData() 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(); }
 };
 
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 0f40946f429f..e095f8e200f1 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -207,8 +207,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, 
OUString& rFileName,
 
 if (pOStm)
 {
-auto& rDataContainer = 
rGraphic.getVectorGraphicData()->getBinaryDataContainer();
-pOStm->WriteBytes(rDataContainer.getData(), 
rDataContainer.getSize());
+
rGraphic.getVectorGraphicData()->getBinaryDataContainer().writeToStream(*pOStm);
 aMedium.Commit();
 
 if (!aMedium.GetError())
diff --git a/vcl/inc/pdf/ExternalPDFStreams.hxx 
b/vcl/inc/pdf/ExternalPDFStreams.hxx
index 45b15f7a74bc..e2ddd58b91a5 100644
--- a/vcl/inc/pdf/ExternalPDFStreams.hxx
+++ b/vcl/inc/pdf/ExternalPDFStreams.hxx
@@ -38,9 +38,7 @@ struct VCL_DLLPUBLIC ExternalPDFStream
 {
 if (!mpPDFDocument)
 {
-SvMemoryStream aPDFStream;
-aPDFStream.WriteBytes(maDataContainer.getData(), 
maDataContainer.getSize());
-aPDFStream.Seek(0);
+SvMemoryStream aPDFStream = maDataContainer.getMemoryStream();
 auto pPDFDocument = std::make_shared();
 if (!pPDFDocument->ReadWithPossibleFixup(aPDFStream))
 {
diff --git a/vcl/source/filter/graphicfilter.cxx 
b/vcl/source/filter/graphicfilter.cxx
index dc7b47598d71..53071f6dea76 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1632,9 +1632,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 && 
!rVectorGraphicDataPtr->getBinaryDataContainer().isEmpty()
 && !bIsEMF)
 {
-auto & aDataContainer = 
rVectorGraphicDataPtr->getBinaryDataContainer();
-rTempStm->WriteBytes(aDataContainer.getData(), 
aDataContainer.getSize());
-
+
rVectorGraphicDataPtr->getBinaryDataContainer().writeToStream(*rTempStm);
 if (rTempStm->GetError())
 {
 nStatus = ERRCODE_GRFILTER_IOERROR;
@@ -1673,9 +1671,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 && rVectorGraphicDataPtr->getType() == 
VectorGraphicDataType::Emf
 && 
!rVectorGraphicDataPtr->getBinaryDataContainer().isEmpty())
 {
-auto & aDataContainer = 
rVectorGraphicDataPtr->getBinaryDataContainer();
-rTempStm->WriteBytes(aDataContainer.getData(), 
aDataContainer.getSize());
-
+
rVectorGraphicDataPtr->getBinaryDataContainer().writeToStream(*rTempStm);
 if (rTempStm->GetError())
 {
 nStatus = ERRCODE_GRFILTER_IOERROR;
@@ -1743,9 +1739,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& 
rGraphic, std::u16string_vi
 && rVectorGraphicDataPtr->getType()  ==  

[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/osx vcl/qt5 vcl/source vcl/unx vcl/win

2023-03-29 Thread Michael Weghorn (via logerrit)
 include/vcl/menu.hxx|2 
 vcl/inc/osx/salmenu.h   |2 
 vcl/inc/qt5/QtFrame.hxx |3 -
 vcl/inc/qt5/QtMenu.hxx  |6 +-
 vcl/inc/qt5/QtPainter.hxx   |   18 +--
 vcl/inc/qt5/QtTools.hxx |5 --
 vcl/inc/salmenu.hxx |   17 ++-
 vcl/inc/unx/gtk/gtksalmenu.hxx  |6 +-
 vcl/inc/win/salmenu.h   |3 -
 vcl/osx/salmenu.cxx |2 
 vcl/qt5/QtFrame.cxx |   62 ++
 vcl/qt5/QtMenu.cxx  |5 +-
 vcl/qt5/QtPainter.cxx   |   20 
 vcl/qt5/QtWidget.cxx|   28 +++-
 vcl/source/app/salvtables.cxx   |2 
 vcl/source/window/menu.cxx  |   28 ++--
 vcl/source/window/menubarwindow.cxx |   83 
 vcl/source/window/menubarwindow.hxx |1 
 vcl/unx/gtk3/gtksalmenu.cxx |7 ++-
 vcl/win/window/salmenu.cxx  |2 
 20 files changed, 126 insertions(+), 176 deletions(-)

New commits:
commit f51b220b953ec71fb742f799fbe645a93cf3d944
Author: Michael Weghorn 
AuthorDate: Fri Mar 24 08:06:56 2023 +0100
Commit: Michael Weghorn 
CommitDate: Wed Mar 29 10:46:00 2023 +

tdf#149805 tdf#151677 tdf#152217 tdf#154043 tdf#153458 tdf#153800 Revert 
"VCL expect

... correct frame size for native menubars"

This reverts

commit afc828b9833b7a612369e95606ba56d41ef2c369
Date:   Sat May 28 23:47:21 2022 +0200

VCL expect correct frame size for native menubars

... and renove the wrong framesize hack in the Qt backend

because it caused several regressions and unfortunately
the commit also doesn't fix all of the bugs mentioned
in its commit message (while some previous patch sets of the
change did address more, yet had other issues, s.a. the discussion
in the commit's Gerrit change [1]).

While e.g. the drag and drop issues reported in tdf#153458
and tdf#153800 could be fixed by translating the event position
using `mapToParent()` (as is done in
`QtWidget::fillSalAbstractMouseEvent` with the above commit
in place), I currently don't see how to address the other
issues and the overall direction of the change is not fully
clear to me at this point. (There are also other pending changes
in the relation change still pending in Gerrit that would presumably
need more work/analysis.)

After all, it seems the best way forward to revert the
commit for now.

This also reverts the follow-up commit

commit 25da92004038c03c0feedf373e8038e7ee3e0c37
Date:   Thu Jul 21 11:33:02 2022 +0200

Make JunitTest_toolkit_unoapi_1 succeed again on macOS

that fixed a test failure introduced by the above commit.

Luckily, there seem to be no follow-up commits that
depend on this and the commits can be reverted cleanly
without the need to resolve any conflicts manually.

This reverts commit 25da92004038c03c0feedf373e8038e7ee3e0c37.
This reverts commit afc828b9833b7a612369e95606ba56d41ef2c369.

[1] https://gerrit.libreoffice.org/c/core/+/135082

Change-Id: I4c099ad7de8cbbad10da391ede4770d8c748fbde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149495
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Reviewed-by: Michael Weghorn 

diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index bb0ef8cee6db..abad985775e4 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -179,8 +179,6 @@ protected:
 
 SAL_DLLPRIVATE void ImplFillLayoutData() const;
 SAL_DLLPRIVATE SalMenu* ImplGetSalMenu() { return mpSalMenu.get(); }
-// convenience function; just returns the SalMenu*, if HasNativeMenuBar() 
is true
-SAL_DLLPRIVATE SalMenu* GetNativeMenuBar();
 SAL_DLLPRIVATE OUString ImplGetHelpText( sal_uInt16 nItemId ) const;
 
 // returns native check and option menu symbol height in rCheckHeight and 
rRadioHeight
diff --git a/vcl/inc/osx/salmenu.h b/vcl/inc/osx/salmenu.h
index 274d1ecd70b2..597180cc1ac3 100644
--- a/vcl/inc/osx/salmenu.h
+++ b/vcl/inc/osx/salmenu.h
@@ -55,7 +55,7 @@ public:
 AquaSalMenu( bool bMenuBar );
 virtual ~AquaSalMenu() override;
 
-virtual bool HasNativeMenuBar() override;
+virtual bool VisibleMenuBar() override;
 
 virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) 
override;
 virtual void RemoveItem( unsigned nPos ) override;
diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 40954f66d744..963572ca819b 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -131,6 +131,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 bool isMinimized() const;
 bool isMaximized() const;
 void SetWindowStateImpl(Qt::WindowStates eState);
+int menuBarOffset(

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

2023-03-22 Thread Szymon Kłos (via logerrit)
 include/vcl/jsdialog/executor.hxx |5 +
 include/vcl/weld.hxx  |4 +++-
 vcl/inc/salvtables.hxx|2 ++
 vcl/jsdialog/executor.cxx |7 +--
 vcl/source/app/salvtables.cxx |7 +++
 5 files changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 464a3549ae228bcd70bae8ea519fc781c2cc9e45
Author: Szymon Kłos 
AuthorDate: Tue Mar 14 13:11:46 2023 +0100
Commit: Szymon Kłos 
CommitDate: Wed Mar 22 08:44:34 2023 +

jsdialog: double click for drawing area

Change-Id: I280158b101f39d107090a2eebb2c06e64591cb94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148852
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149231
Tested-by: Jenkins

diff --git a/include/vcl/jsdialog/executor.hxx 
b/include/vcl/jsdialog/executor.hxx
index 50f71272bb61..0c47066da9fa 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -61,6 +61,11 @@ public:
 rDrawingArea.click(rPos);
 }
 
+static void trigger_dblclick(weld::DrawingArea& rDrawingArea, const Point& 
rPos)
+{
+rDrawingArea.dblclick(rPos);
+}
+
 static void trigger_value_changed(weld::SpinButton& rSpinButton)
 {
 rSpinButton.signal_value_changed();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index d22fa5eb616e..21d6fec1acc2 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2356,7 +2356,9 @@ public:
 private:
 friend class ::LOKTrigger;
 
-virtual void click(const Point& rPos) = 0;
+virtual void click(const Point&) = 0;
+
+virtual void dblclick(const Point&){};
 };
 
 enum class Placement
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 3c421fc89c90..c5665b28dd0c 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1339,6 +1339,8 @@ public:
 virtual OutputDevice& get_ref_device() override;
 
 virtual void click(const Point& rPos) override;
+
+virtual void dblclick(const Point& rPos) override;
 };
 
 class SalInstanceToolbar : public SalInstanceWidget, public virtual 
weld::Toolbar
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index f52bef4b9aa7..4668193cb579 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -187,7 +187,7 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 auto pArea = dynamic_cast(pWidget);
 if (pArea)
 {
-if (sAction == "click")
+if (sAction == "click" || sAction == "dblclick")
 {
 OUString sClickData = rData["data"];
 int nSeparatorPos = sClickData.indexOf(';');
@@ -209,7 +209,10 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 Size size = rRefDevice.GetOutputSize();
 posX = posX * size.Width();
 posY = posY * size.Height();
-LOKTrigger::trigger_click(*pArea, Point(posX, posY));
+if (sAction == "click")
+LOKTrigger::trigger_click(*pArea, Point(posX, 
posY));
+else
+LOKTrigger::trigger_dblclick(*pArea, Point(posX, 
posY));
 return true;
 }
 
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 4a31b3d2cd3d..e4e76768ec55 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -6350,6 +6350,13 @@ void SalInstanceDrawingArea::click(const Point& rPos)
 m_xDrawingArea->MouseButtonUp(aEvent);
 }
 
+void SalInstanceDrawingArea::dblclick(const Point& rPos)
+{
+MouseEvent aEvent(rPos, 2, MouseEventModifiers::NONE, MOUSE_LEFT, 0);
+m_xDrawingArea->MouseButtonDown(aEvent);
+m_xDrawingArea->MouseButtonUp(aEvent);
+}
+
 IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
 {
 m_aDrawHdl.Call(aPayload);


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

2023-03-20 Thread Michael Stahl (via logerrit)
 include/vcl/pdfextoutdevdata.hxx|2 +-
 include/vcl/pdfwriter.hxx   |2 +-
 sd/source/ui/unoidl/unomodel.cxx|   12 +++-
 sw/source/core/text/EnhancedPDFExportHelper.cxx |   12 +++-
 vcl/inc/pdf/pdfwriter_impl.hxx  |7 +--
 vcl/source/gdi/pdfextoutdevdata.cxx |6 --
 vcl/source/gdi/pdfwriter.cxx|4 ++--
 vcl/source/gdi/pdfwriter_impl.cxx   |   10 --
 8 files changed, 43 insertions(+), 12 deletions(-)

New commits:
commit e7d5e346677efeb7d7d14537a9151ea7a1a32809
Author: Michael Stahl 
AuthorDate: Wed Mar 15 12:39:55 2023 +0100
Commit: Michael Stahl 
CommitDate: Mon Mar 20 17:14:49 2023 +

vcl,sd,sw: PDF/UA export: add Alt text to SdrMediaObj media shapes

  7.18.6.2 Media clip data
  In the media clip data dictionary, the optional CT and Alt keys
  (ISO 32000-1:2008, 13.2.4.2, Table 274) are required.

Change-Id: I147f1677f1bd0788c2269735688d329db15c0ead
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149007
Tested-by: Michael Stahl 
Reviewed-by: Michael Stahl 

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 89696ef757b6..81ea37b86d9b 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -266,7 +266,7 @@ public:
 sal_Int32 CreateLink(const tools::Rectangle& rRect, OUString const& 
rAltText, sal_Int32 nPageNr = -1);
 
 /// Create a Screen annotation.
-sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr);
+sal_Int32 CreateScreen(const tools::Rectangle& rRect, OUString const& 
rAltText, sal_Int32 nPageNr);
 
 /** Set the destination for a link
 will change a URL type link to a dest link if necessary
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index f415fa59699f..1319909961a9 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -928,7 +928,7 @@ The following structure describes the permissions used in 
PDF security
 sal_Int32 CreateLink(const tools::Rectangle& rRect, sal_Int32 nPageNr, 
OUString const& rAltText);
 
 /// Creates a screen annotation.
-sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr);
+sal_Int32 CreateScreen(const tools::Rectangle& rRect, sal_Int32 nPageNr, 
OUString const& rAltText);
 
 /** creates a destination which is not intended to be referred to by a 
link, but by a public destination Id.
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index a955e02e3da6..61189ca9deaa 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1644,11 +1644,21 @@ static void ImplPDFExportShapeInteraction( const 
uno::Reference< drawing::XShape
 // Handle linked videos.
 if (xShape->getShapeType() == "com.sun.star.drawing.MediaShape" || 
xShape->getShapeType() == "com.sun.star.presentation.MediaShape")
 {
+OUString title;
+xShapePropSet->getPropertyValue("Title") >>= title;
+OUString description;
+xShapePropSet->getPropertyValue("Description") >>= description;
+OUString const altText(title.isEmpty()
+? description
+: description.isEmpty()
+? title
+: OUString::Concat(title) + OUString::Concat("\n") + 
OUString::Concat(description));
+
 OUString aMediaURL;
 xShapePropSet->getPropertyValue("MediaURL") >>= aMediaURL;
 if (!aMediaURL.isEmpty())
 {
-sal_Int32 nScreenId = 
rPDFExtOutDevData.CreateScreen(aLinkRect, 
rPDFExtOutDevData.GetCurrentPageNumber());
+sal_Int32 nScreenId = 
rPDFExtOutDevData.CreateScreen(aLinkRect, altText, 
rPDFExtOutDevData.GetCurrentPageNumber());
 if (aMediaURL.startsWith("vnd.sun.star.Package:"))
 {
 OUString aTempFileURL;
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 4db59dcd1be5..7c518f8b4594 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -2022,6 +2022,16 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport()
 if (xShape->getShapeType() == 
"com.sun.star.drawing.MediaShape")
 {
 uno::Reference 
xShapePropSet(xShape, uno::UNO_QUERY);
+OUString title;
+xShapePropSet->getPropertyValue("Title") >>= title;
+OUString description;
+xShapePropSet->getPropertyValue("Description") >>= 
description;
+OUString const altText(title

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

2023-03-20 Thread Stephan Bergmann (via logerrit)
 include/vcl/threadex.hxx  |1 +
 package/inc/ZipOutputEntry.hxx|1 +
 package/inc/ZipOutputStream.hxx   |1 +
 package/source/zipapi/XBufferedThreadedStream.hxx |1 +
 vcl/inc/unx/gtk/gtkdata.hxx   |1 +
 5 files changed, 5 insertions(+)

New commits:
commit 7cce1141c6d0fd3023a827021f818f1e96cf26f0
Author: Stephan Bergmann 
AuthorDate: Mon Mar 20 14:49:30 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Mar 20 15:21:08 2023 +

Missing includes (for std::exception_ptr)

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

diff --git a/include/vcl/threadex.hxx b/include/vcl/threadex.hxx
index 06d3bffa0a51..918b072ae2be 100644
--- a/include/vcl/threadex.hxx
+++ b/include/vcl/threadex.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
diff --git a/package/inc/ZipOutputEntry.hxx b/package/inc/ZipOutputEntry.hxx
index fcf25dcadf81..94eb988d8b23 100644
--- a/package/inc/ZipOutputEntry.hxx
+++ b/package/inc/ZipOutputEntry.hxx
@@ -31,6 +31,7 @@
 #include 
 #include "CRC32.hxx"
 #include 
+#include 
 
 struct ZipEntry;
 class ZipPackageBuffer;
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index b31af9d3d5c4..d92f140f70f2 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -26,6 +26,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 struct ZipEntry;
diff --git a/package/source/zipapi/XBufferedThreadedStream.hxx 
b/package/source/zipapi/XBufferedThreadedStream.hxx
index ad5d3b0ce116..beb1cd33c700 100644
--- a/package/source/zipapi/XBufferedThreadedStream.hxx
+++ b/package/source/zipapi/XBufferedThreadedStream.hxx
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 typedef css::uno::Sequence< sal_Int8 > Buffer;
 
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 3a1a9094d3ec..8aaf5baea5e5 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 


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

2023-03-16 Thread Caolán McNamara (via logerrit)
 include/vcl/weld.hxx  |9 ++--
 vcl/inc/salvtables.hxx|5 
 vcl/source/app/salvtables.cxx |   26 +
 vcl/unx/gtk3/gtkinst.cxx  |   43 +++---
 4 files changed, 62 insertions(+), 21 deletions(-)

New commits:
commit dffde8403e0bb81d7eb3b7853cece187e1d36c62
Author: Caolán McNamara 
AuthorDate: Thu Mar 16 09:50:19 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 16 14:02:44 2023 +

allow more than DrawingArea to report style updates

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

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index e352c2e357f7..4acece25f052 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -87,6 +87,7 @@ protected:
 Link m_aFocusInHdl;
 Link m_aFocusOutHdl;
 Link m_aMnemonicActivateHdl;
+Link m_aStyleUpdatedHdl;
 Link m_aSizeAllocateHdl;
 Link m_aKeyPressHdl;
 Link m_aKeyReleaseHdl;
@@ -279,6 +280,12 @@ public:
 m_aMouseReleaseHdl = rLink;
 }
 
+virtual void connect_style_updated(const Link& rLink)
+{
+assert(!m_aStyleUpdatedHdl.IsSet() || !rLink.IsSet());
+m_aStyleUpdatedHdl = rLink;
+}
+
 virtual void grab_add() = 0;
 virtual bool has_grab() const = 0;
 virtual void grab_remove() = 0;
@@ -2274,7 +2281,6 @@ public:
 
 protected:
 Link m_aDrawHdl;
-Link m_aStyleUpdatedHdl;
 Link m_aCommandHdl;
 Link m_aGetFocusRectHdl;
 Link m_aQueryTooltipHdl;
@@ -2304,7 +2310,6 @@ protected:
 
 public:
 void connect_draw(const Link& rLink) { m_aDrawHdl = 
rLink; }
-void connect_style_updated(const Link& rLink) { 
m_aStyleUpdatedHdl = rLink; }
 void connect_command(const Link& rLink) { 
m_aCommandHdl = rLink; }
 void connect_focus_rect(const Link& rLink)
 {
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 19f6b0adf91d..1bbf37b4f7fb 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -188,6 +188,7 @@ private:
 DECL_LINK(EventListener, VclWindowEvent&, void);
 DECL_LINK(KeyEventListener, VclWindowEvent&, bool);
 DECL_LINK(MouseEventListener, VclWindowEvent&, void);
+DECL_LINK(SettingsChangedHdl, VclWindowEvent&, void);
 DECL_LINK(MnemonicActivateHdl, vcl::Window&, bool);
 
 static void DoRecursivePaint(vcl::Window* pWindow, const Point& rPos, 
OutputDevice& rOutput);
@@ -333,6 +334,8 @@ public:
 
 virtual void connect_key_release(const Link& rLink) 
override;
 
+virtual void connect_style_updated(const Link& rLink) 
override;
+
 virtual bool get_extents_relative_to(const Widget& rRelative, int& x, int& 
y, int& width,
  int& height) const override;
 
@@ -1311,6 +1314,8 @@ public:
 
 virtual void connect_key_release(const Link& rLink) 
override;
 
+virtual void connect_style_updated(const Link& rLink) 
override;
+
 virtual void set_cursor(PointerStyle ePointerStyle) override;
 
 virtual Point get_pointer_position() const override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index f9a6cfc75dc2..61fa56dd3223 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -580,6 +580,25 @@ void SalInstanceWidget::connect_key_release(const 
Link& r
 weld::Widget::connect_key_release(rLink);
 }
 
+IMPL_LINK(SalInstanceWidget, SettingsChangedHdl, VclWindowEvent&, rEvent, void)
+{
+if (rEvent.GetId() != VclEventId::WindowDataChanged)
+return;
+
+DataChangedEvent* pData = static_cast(rEvent.GetData());
+if (pData->GetType() == DataChangedEventType::SETTINGS)
+m_aStyleUpdatedHdl.Call(*this);
+}
+
+void SalInstanceWidget::connect_style_updated(const Link& rLink)
+{
+if (m_aStyleUpdatedHdl.IsSet())
+m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, 
SettingsChangedHdl));
+weld::Widget::connect_style_updated(rLink);
+if (m_aStyleUpdatedHdl.IsSet())
+m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, 
SettingsChangedHdl));
+}
+
 bool SalInstanceWidget::get_extents_relative_to(const Widget& rRelative, int& 
x, int& y, int& width,
 int& height) const
 {
@@ -633,6 +652,8 @@ void SalInstanceWidget::queue_resize() { 
m_xWidget->queue_resize(); }
 
 SalInstanceWidget::~SalInstanceWidget()
 {
+if (m_aStyleUpdatedHdl.IsSet())
+m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, 
SettingsChangedHdl));
 if (m_aMnemonicActivateHdl.IsSet())
 m_xWidget->SetMnemonicActivateHdl(Link());
 if (m_bMouseEventListener)
@@ -6233,6 +6254,11 @@ void SalInstanceDrawingArea::connect_key_release(const 
Link& 
rLink)
+{
+weld::Widget::connect_style_updated(rLink);
+}
+
 void SalInstanceDrawingArea::set_cursor(PointerStyle ePo

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

2023-03-14 Thread Noel Grandin (via logerrit)
 include/vcl/filter/pdfdocument.hxx|2 
 include/vcl/filter/pdfobjectcontainer.hxx |9 
 vcl/inc/pdf/pdfwriter_impl.hxx|2 
 vcl/source/filter/ipdf/pdfdocument.cxx|2 
 vcl/source/gdi/pdfobjectcopier.cxx|8 
 vcl/source/gdi/pdfwriter_impl.cxx |  321 ++
 vcl/source/gdi/pdfwriter_impl2.cxx|6 
 7 files changed, 176 insertions(+), 174 deletions(-)

New commits:
commit 67127e9a1340076d0c8f818b41cc6c44ddd575da
Author: Noel Grandin 
AuthorDate: Tue Mar 14 10:45:54 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 14 09:45:54 2023 +

use more string_view in vcl::PDFObjectContainer

which makes the call sites much less verbose

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

diff --git a/include/vcl/filter/pdfdocument.hxx 
b/include/vcl/filter/pdfdocument.hxx
index fbe0be89cdc6..7e9d6dd8045a 100644
--- a/include/vcl/filter/pdfdocument.hxx
+++ b/include/vcl/filter/pdfdocument.hxx
@@ -596,7 +596,7 @@ public:
 /// See vcl::PDFObjectContainer::updateObject().
 bool updateObject(sal_Int32 n) override;
 /// See vcl::PDFObjectContainer::writeBuffer().
-bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) override;
+bool writeBufferBytes(const void* pBuffer, sal_uInt64 nBytes) override;
 void checkAndEnableStreamEncryption(sal_Int32 /*nObject*/) override {}
 void disableStreamEncryption() override {}
 };
diff --git a/include/vcl/filter/pdfobjectcontainer.hxx 
b/include/vcl/filter/pdfobjectcontainer.hxx
index f6614f09ea3d..308ec65cae83 100644
--- a/include/vcl/filter/pdfobjectcontainer.hxx
+++ b/include/vcl/filter/pdfobjectcontainer.hxx
@@ -10,6 +10,7 @@
 #pragma once
 
 #include 
+#include 
 
 namespace vcl
 {
@@ -26,7 +27,13 @@ public:
 virtual bool updateObject(sal_Int32 n) = 0;
 
 // Write pBuffer to the end of the output.
-virtual bool writeBuffer(const void* pBuffer, sal_uInt64 nBytes) = 0;
+virtual bool writeBufferBytes(const void* pBuffer, sal_uInt64 nBytes) = 0;
+
+// Utility method, reduces verbosity at call sites
+bool writeBuffer(std::string_view aBuffer)
+{
+return writeBufferBytes(aBuffer.data(), aBuffer.size());
+}
 
 virtual void checkAndEnableStreamEncryption(sal_Int32 nObject) = 0;
 
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index a16d57404207..4157aeda446a 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -1044,7 +1044,7 @@ i12626
 bool updateObject( sal_Int32 n ) override;
 
 /// See vcl::PDFObjectContainer::writeBuffer().
-bool writeBuffer( const void* pBuffer, sal_uInt64 nBytes ) override;
+bool writeBufferBytes( const void* pBuffer, sal_uInt64 nBytes ) override;
 void beginCompression();
 void endCompression();
 void beginRedirect( SvStream* pStream, const tools::Rectangle& );
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index 5ff50d3b55ac..568b1980ab5d 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -89,7 +89,7 @@ bool PDFDocument::updateObject(sal_Int32 nObject)
 return true;
 }
 
-bool PDFDocument::writeBuffer(const void* pBuffer, sal_uInt64 nBytes)
+bool PDFDocument::writeBufferBytes(const void* pBuffer, sal_uInt64 nBytes)
 {
 std::size_t nWritten = m_aEditBuffer.WriteBytes(pBuffer, nBytes);
 return nWritten == nBytes;
diff --git a/vcl/source/gdi/pdfobjectcopier.cxx 
b/vcl/source/gdi/pdfobjectcopier.cxx
index 2f32cdc27ce1..4c9228235cd3 100644
--- a/vcl/source/gdi/pdfobjectcopier.cxx
+++ b/vcl/source/gdi/pdfobjectcopier.cxx
@@ -147,7 +147,7 @@ sal_Int32 
PDFObjectCopier::copyExternalResource(SvMemoryStream& rDocBuffer,
 // We have the whole object, now write it to the output.
 if (!m_rContainer.updateObject(nObject))
 return -1;
-if (!m_rContainer.writeBuffer(aLine.getStr(), aLine.getLength()))
+if (!m_rContainer.writeBuffer(aLine))
 return -1;
 aLine.setLength(0);
 
@@ -156,19 +156,19 @@ sal_Int32 
PDFObjectCopier::copyExternalResource(SvMemoryStream& rDocBuffer,
 SvMemoryStream& rStream = pStream->GetMemory();
 m_rContainer.checkAndEnableStreamEncryption(nObject);
 aLine.append(static_cast(rStream.GetData()), 
rStream.GetSize());
-if (!m_rContainer.writeBuffer(aLine.getStr(), aLine.getLength()))
+if (!m_rContainer.writeBuffer(aLine))
 return -1;
 aLine.setLength(0);
 m_rContainer.disableStreamEncryption();
 
 aLine.append("\nendstream\n");
-if (!m_rContainer.writeBuffer(aLine.getStr(), aLine.getLength()))
+if (!m_rContainer.writeBuffer(aLine))
 return -1;
 aLine.setLength(0);
 }
 
 aLine.append("endobj\n\n");
-   

[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 sd/source vcl/qa vcl/source

2023-03-07 Thread Mike Kaganski (via logerrit)
 include/vcl/BinaryDataContainer.hxx|   33 +++-
 include/vcl/filter/PngImageReader.hxx  |5 -
 include/vcl/gfxlink.hxx|2 
 include/vcl/graphicfilter.hxx  |5 -
 sd/source/ui/view/sdview3.cxx  |7 -
 vcl/qa/cppunit/BinaryDataContainerTest.cxx |   33 ++--
 vcl/qa/cppunit/svm/svmtest.cxx |   10 +-
 vcl/source/filter/graphicfilter.cxx|  116 +
 vcl/source/filter/ieps/ieps.cxx|   58 ++
 vcl/source/filter/ipdf/pdfcompat.cxx   |6 -
 vcl/source/filter/png/PngImageReader.cxx   |   31 +++
 vcl/source/filter/wmf/wmf.cxx  |4 -
 vcl/source/gdi/TypeSerializer.cxx  |9 --
 vcl/source/gdi/gfxlink.cxx |   10 --
 vcl/source/gdi/impgraph.cxx|4 -
 vcl/source/gdi/vectorgraphicdata.cxx   |5 -
 vcl/source/graphic/BinaryDataContainer.cxx |   19 ++--
 17 files changed, 127 insertions(+), 230 deletions(-)

New commits:
commit d062f097cc48bd53247b7fb0c677d90fcc430ab7
Author: Mike Kaganski 
AuthorDate: Wed Mar 8 02:14:11 2023 +0300
Commit: Mike Kaganski 
CommitDate: Wed Mar 8 05:20:17 2023 +

Simplify usage of BinaryDataContainer

It is always used to store data read from streams

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

diff --git a/include/vcl/BinaryDataContainer.hxx 
b/include/vcl/BinaryDataContainer.hxx
index b7421e9874c0..e6e13cd340d8 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -10,7 +10,11 @@
 
 #pragma once
 
+#include 
+
+#include 
 #include 
+
 #include 
 #include 
 
@@ -26,35 +30,22 @@ private:
 std::shared_ptr> mpData;
 
 public:
-BinaryDataContainer();
-BinaryDataContainer(const sal_uInt8* pData, size_t nSize);
-BinaryDataContainer(std::unique_ptr> rData);
+BinaryDataContainer() = default;
+BinaryDataContainer(SvStream& stream, size_t size);
 
-BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer)
-: mpData(rBinaryDataContainer.mpData)
-{
-}
+BinaryDataContainer(const BinaryDataContainer& rBinaryDataContainer) = 
default;
 
-BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept
-: mpData(std::move(rBinaryDataContainer.mpData))
-{
-}
+BinaryDataContainer(BinaryDataContainer&& rBinaryDataContainer) noexcept = 
default;
 
-BinaryDataContainer& operator=(const BinaryDataContainer& 
rBinaryDataContainer)
-{
-mpData = rBinaryDataContainer.mpData;
-return *this;
-}
+BinaryDataContainer& operator=(const BinaryDataContainer& 
rBinaryDataContainer) = default;
 
-BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) 
noexcept
-{
-mpData = std::move(rBinaryDataContainer.mpData);
-return *this;
-}
+BinaryDataContainer& operator=(BinaryDataContainer&& rBinaryDataContainer) 
noexcept = default;
 
 size_t getSize() const { return mpData ? mpData->size() : 0; }
 bool isEmpty() const { return !mpData || mpData->empty(); }
 const sal_uInt8* getData() const { return mpData ? mpData->data() : 
nullptr; }
+// Returns the data as a stream open for reading
+SvMemoryStream getMemoryStream();
 
 size_t calculateHash() const;
 
diff --git a/include/vcl/filter/PngImageReader.hxx 
b/include/vcl/filter/PngImageReader.hxx
index bbb5b7c8d672..34b8279bc654 100644
--- a/include/vcl/filter/PngImageReader.hxx
+++ b/include/vcl/filter/PngImageReader.hxx
@@ -14,8 +14,10 @@
 #include 
 
 #include 
+#include 
 
 #include 
+#include 
 
 #include 
 
@@ -45,8 +47,7 @@ public:
 
 // Returns the contents of the msOG chunk (containing a Gif image), if it 
exists.
 // Does not change position in the stream.
-static std::unique_ptr getMicrosoftGifChunk(SvStream& rStream,
- sal_Int32* 
chunkSize = nullptr);
+static BinaryDataContainer getMicrosoftGifChunk(SvStream& rStream);
 };
 
 } // namespace vcl
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 852f418d7ef7..8c0f5fd32b05 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 
 class SvStream;
 
@@ -72,7 +71,6 @@ private:
 
 public:
 GfxLink();
-explicit GfxLink(std::unique_ptr pBuf, sal_uInt32 nBufSize, 
GfxLinkType nType);
 explicit GfxLink(BinaryDataContainer aDataConainer, GfxLinkType nType);
 
 booloperator==( const GfxLink& ) const;
diff --git a/include/vcl/graphicfilter.hxx b/include/vcl/graphicfilter.hxx
index 787439773bc4..fd183b0e0bb3 100644
--- a/include/vcl/graphicfilter.hxx
+++ b/include/vcl/graphicfilter.hxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include

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

2023-03-03 Thread Szymon Kłos (via logerrit)
 include/vcl/toolkit/dialog.hxx   |2 
 vcl/inc/wizdlg.hxx   |2 
 vcl/source/control/roadmapwizard.cxx |   72 +++
 3 files changed, 75 insertions(+), 1 deletion(-)

New commits:
commit a5e2201643392d0509cb970faf1c1e7038d14f4e
Author: Szymon Kłos 
AuthorDate: Fri Mar 3 08:13:58 2023 +0100
Commit: Szymon Kłos 
CommitDate: Sat Mar 4 07:07:50 2023 +

jsdialog: correct structure for RoadmapWizard

Signed-off-by: Szymon Kłos 
Change-Id: Id9837c208653311608bf39d6066cbf1345efc565
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148214
Tested-by: Jenkins

diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx
index 31326106cbd5..679c0232ea30 100644
--- a/include/vcl/toolkit/dialog.hxx
+++ b/include/vcl/toolkit/dialog.hxx
@@ -101,6 +101,7 @@ protected:
 friend class SalInstanceBuilder;
 void set_action_area(VclButtonBox* pBox);
 void set_content_area(VclBox* pBox);
+vcl::Window*GetFirstControlForFocus();
 
 public:
 explicitDialog( vcl::Window* pParent, WinBits nStyle = 
WB_STDDIALOG, InitFlag eFlag = InitFlag::Default );
@@ -132,7 +133,6 @@ private:
 static void ImplEndExecuteModal();
 voidImplSetModalInputMode(bool bModal);
 
-vcl::Window*GetFirstControlForFocus();
 public:
 
 /// Commence execution of a modal dialog, disposes owner on failure
diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index 04f6e88c4acd..1fd0f9bad41e 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -255,6 +255,8 @@ namespace vcl
 DECL_LINK(OnFinish, Button*, void);
 
 void implConstruct( const WizardButtonFlags _nButtonFlags );
+
+virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) 
override;
 };
 
 /// helper class to temporarily suspend any traveling in the wizard
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 49c28de9bfe9..0aef0d00527e 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -798,6 +799,77 @@ namespace vcl
 return RoadmapWizardUIObject::create;
 }
 
+namespace
+{
+bool isButton(WindowType eType)
+{
+return eType == WindowType::PUSHBUTTON || eType == 
WindowType::OKBUTTON
+|| eType == WindowType::CANCELBUTTON || eType == 
WindowType::HELPBUTTON;
+}
+}
+
+void RoadmapWizard::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+rJsonWriter.put("id", get_id());
+rJsonWriter.put("type", "dialog");
+rJsonWriter.put("title", GetText());
+
+OUString sDialogId = OStringToOUString(GetHelpId(), 
RTL_TEXTENCODING_ASCII_US);
+sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
+nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
+rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
+
+vcl::Window* pFocusControl = GetFirstControlForFocus();
+if (pFocusControl)
+rJsonWriter.put("init_focus_id", pFocusControl->get_id());
+
+{
+auto childrenNode = rJsonWriter.startArray("children");
+
+auto containerNode = rJsonWriter.startStruct();
+rJsonWriter.put("id", "container");
+rJsonWriter.put("type", "container");
+rJsonWriter.put("vertical", true);
+
+{
+auto containerChildrenNode = 
rJsonWriter.startArray("children");
+
+// tabpages
+for (int i = 0; i < GetChildCount(); i++)
+{
+vcl::Window* pChild = GetChild(i);
+
+if (!isButton(pChild->GetType()) && pChild != mpViewWindow)
+{
+auto childNode = rJsonWriter.startStruct();
+pChild->DumpAsPropertyTree(rJsonWriter);
+}
+}
+
+// buttons
+{
+auto buttonsNode = rJsonWriter.startStruct();
+rJsonWriter.put("id", "buttons");
+rJsonWriter.put("type", "buttonbox");
+rJsonWriter.put("layoutstyle", "end");
+{
+auto buttonsChildrenNode = 
rJsonWriter.startArray("children");
+for (int i = 0; i < GetChildCount(); i++)
+{
+vcl::Window* pChild = GetChild(i);
+
+if (isButton(pChild->GetType()))
+{
+auto childNode = rJsonWriter.startStruct();
+pChild->DumpAsPropertyTree(rJsonWriter);
+}
+}
+}
+}
+}
+}

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

2023-02-20 Thread Caolán McNamara (via logerrit)
 include/vcl/wizardmachine.hxx |3 +++
 svtools/source/uno/wizard/wizardshell.cxx |   10 ++
 svtools/source/uno/wizard/wizardshell.hxx |3 +++
 vcl/source/control/roadmapwizard.cxx  |   16 
 vcl/source/control/wizardmachine.cxx  |   12 +++-
 5 files changed, 35 insertions(+), 9 deletions(-)

New commits:
commit cdf7b51229f2353376fb4e9de309fb9ee5580b3a
Author: Caolán McNamara 
AuthorDate: Mon Feb 20 13:15:44 2023 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 20 21:01:26 2023 +

tdf#132110 page ids might not be state ids

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

diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx
index 04698f387011..a29b03a38062 100644
--- a/include/vcl/wizardmachine.hxx
+++ b/include/vcl/wizardmachine.hxx
@@ -302,6 +302,9 @@ namespace vcl
 */
 void
getStateHistory(std::vector& out_rHistory);
 
+virtual OString getPageIdentForState(WizardTypes::WizardState 
nState) const;
+virtual WizardTypes::WizardState getStateFromPageIdent(const OString& 
rIdent) const;
+
 public:
 class AccessGuard
 {
diff --git a/svtools/source/uno/wizard/wizardshell.cxx 
b/svtools/source/uno/wizard/wizardshell.cxx
index 93113d4fd739..4b93f09eadbe 100644
--- a/svtools/source/uno/wizard/wizardshell.cxx
+++ b/svtools/source/uno/wizard/wizardshell.cxx
@@ -83,6 +83,16 @@ namespace svt::uno
 return WizardShell_Base::run();
 }
 
+OString WizardShell::getPageIdentForState(WizardState nState) const
+{
+return OString::number(impl_stateToPageId(nState));
+}
+
+WizardState WizardShell::getStateFromPageIdent(const OString& rIdent) const
+{
+return impl_pageIdToState(rIdent.toInt32());
+}
+
 sal_Int16 WizardShell::convertCommitReasonToTravelType( const 
CommitPageReason i_eReason )
 {
 switch ( i_eReason )
diff --git a/svtools/source/uno/wizard/wizardshell.hxx 
b/svtools/source/uno/wizard/wizardshell.hxx
index a563ab9547a7..90e7269a18b2 100644
--- a/svtools/source/uno/wizard/wizardshell.hxx
+++ b/svtools/source/uno/wizard/wizardshell.hxx
@@ -106,6 +106,9 @@ namespace svt::uno
 
 PWizardPageController impl_getController(BuilderPage* i_pPage) const;
 
+virtual OString getPageIdentForState(WizardState nState) const 
override;
+virtual WizardState getStateFromPageIdent(const OString& rIdent) const 
override;
+
 // prevent outside access to some base class members
 using WizardShell_Base::skip;
 using WizardShell_Base::skipUntil;
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index fe4c53b92e02..49c28de9bfe9 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -470,7 +470,7 @@ namespace vcl
 GetOrCreatePage(nState);
 }
 
-OString sIdent(OString::number(nState));
+OString sIdent(getPageIdentForState(nState));
 m_xAssistant->set_page_index(sIdent, nItemIndex);
 m_xAssistant->set_page_title(sIdent, getStateDisplayName(nState));
 
@@ -639,9 +639,9 @@ namespace vcl
 
 IMPL_LINK(RoadmapWizardMachine, OnRoadmapItemSelected, const OString&, 
rCurItemId, bool)
 {
-int nCurItemId = rCurItemId.toInt32();
+WizardTypes::WizardState nSelectedState = 
getStateFromPageIdent(rCurItemId);
 
-if ( nCurItemId == getCurrentState() )
+if (nSelectedState == getCurrentState())
 // nothing to do
 return false;
 
@@ -651,7 +651,7 @@ namespace vcl
 WizardTravelSuspension aTravelGuard( *this );
 
 sal_Int32 nCurrentIndex = m_pImpl->getStateIndexInPath( 
getCurrentState(), m_pImpl->nActivePath );
-sal_Int32 nNewIndex = m_pImpl->getStateIndexInPath( nCurItemId, 
m_pImpl->nActivePath );
+sal_Int32 nNewIndex = m_pImpl->getStateIndexInPath( 
nSelectedState, m_pImpl->nActivePath );
 
 DBG_ASSERT( ( nCurrentIndex != -1 ) && ( nNewIndex != -1 ),
 "RoadmapWizard::OnRoadmapItemSelected: something's wrong here!" );
@@ -663,8 +663,8 @@ namespace vcl
 bool bResult = true;
 if ( nNewIndex > nCurrentIndex )
 {
-bResult = skipUntil( 
static_cast(nCurItemId) );
-WizardTypes::WizardState nTemp = 
static_cast(nCurItemId);
+bResult = skipUntil(nSelectedState);
+WizardTypes::WizardState nTemp = nSelectedState;
 while( nTemp )
 {
 if( m_pImpl->aDisabledStates.find( --nTemp ) != 
m_pImpl->aDisabledStates.end() )
@@ -672,7 +672,7 @@ namespace vcl
 }
 }
 else
-bResult = skipBackwardUntil( 
static_cast(nCurItemId) );
+ 

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

2023-01-23 Thread Noel Grandin (via logerrit)
 include/vcl/graph.hxx |2 --
 vcl/inc/graphic/UnoGraphic.hxx|7 ++-
 vcl/source/gdi/graph.cxx  |8 ++--
 vcl/source/graphic/UnoGraphic.cxx |8 
 vcl/source/graphic/UnoGraphicProvider.cxx |3 ++-
 5 files changed, 6 insertions(+), 22 deletions(-)

New commits:
commit 0da2d347a8de0e7480aba900961a1464c753c087
Author: Noel Grandin 
AuthorDate: Mon Jan 23 09:51:14 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jan 23 11:46:09 2023 +

XUnoTunnel->dynamic_cast in vcl::Graphic

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

diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index c97ee23d41c1..e662987b67e3 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -188,8 +188,6 @@ public:
 
 /// Get the page number of the multi-page source this Graphic is rendered 
from.
 sal_Int32 getPageNumber() const;
-
-static const css::uno::Sequence & getUnoTunnelId();
 };
 
 namespace std {
diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index 0e2f2af7b1b0..ce060c98f40c 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -21,7 +21,6 @@
 #define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX
 
 #include 
-#include 
 #include 
 #include 
 
@@ -33,7 +32,6 @@ namespace unographic {
 
 class Graphic final : public css::graphic::XGraphic,
 public css::awt::XBitmap,
-public css::lang::XUnoTunnel,
 public css::graphic::XGraphicTransformer,
 public ::unographic::GraphicDescriptor
 {
@@ -44,6 +42,8 @@ public:
 using ::unographic::GraphicDescriptor::init;
 void init(const ::Graphic& rGraphic);
 
+const ::Graphic& GetGraphic() const { return maGraphic; }
+
 // XInterface
 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & 
rType ) override;
 virtual void SAL_CALL acquire() noexcept override;
@@ -66,9 +66,6 @@ private:
 virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getDIB(  ) override;
 virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getMaskDIB(  ) override;
 
-// XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& rId ) override;
-
 // XGraphicTransformer
 virtual css::uno::Reference< css::graphic::XGraphic > SAL_CALL colorChange(
 const css::uno::Reference< css::graphic::XGraphic >& rGraphic,
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 2407744820f8..4c0efa56beba 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -219,7 +219,8 @@ Graphic::Graphic(const GDIMetaFile& rMtf)
 
 Graphic::Graphic( const css::uno::Reference< css::graphic::XGraphic >& 
rxGraphic )
 {
-const ::Graphic* pGraphic = 
comphelper::getFromUnoTunnel<::Graphic>(rxGraphic);
+const ::unographic::Graphic* pUnoGraphic = 
dynamic_cast<::unographic::Graphic*>(rxGraphic.get());
+const ::Graphic* pGraphic = pUnoGraphic ? &pUnoGraphic->GetGraphic() : 
nullptr;
 
 if( pGraphic )
 {
@@ -556,9 +557,4 @@ OString Graphic::getUniqueID() const
 return aUniqueString;
 }
 
-const css::uno::Sequence & Graphic::getUnoTunnelId() {
-static const comphelper::UnoIdInit gId;
-return gId.getSeq();
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/graphic/UnoGraphic.cxx 
b/vcl/source/graphic/UnoGraphic.cxx
index f26640563862..d1b7fd0238df 100644
--- a/vcl/source/graphic/UnoGraphic.cxx
+++ b/vcl/source/graphic/UnoGraphic.cxx
@@ -57,8 +57,6 @@ uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & 
rType )
 aAny <<= uno::Reference< graphic::XGraphic >( this );
 else if( rType == cppu::UnoType::get())
 aAny <<= uno::Reference< awt::XBitmap >( this );
-else if( rType == cppu::UnoType::get())
-aAny <<= uno::Reference< lang::XUnoTunnel >(this);
 else if( rType == cppu::UnoType::get())
 aAny <<= uno::Reference< graphic::XGraphicTransformer >(this);
 else
@@ -176,12 +174,6 @@ uno::Sequence SAL_CALL Graphic::getMaskDIB()
 }
 }
 
-sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId 
)
-{
-return comphelper::getSomethingImpl(rId, &maGraphic);
-}
-
-
 // XGraphicTransformer
 uno::Reference< graphic::XGraphic > SAL_CALL Graphic::colorChange(
 const uno::Reference< graphic::XGraphic >& rxGraphic, sal_Int32 
nColorFrom, sal_Int8 nTolerance, sal_Int32 nColorTo, sal_Int8 nAlphaTo )
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index f0e0d12e7895..bceb9fbabed1 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -796,7 +796,8 @@ void SAL_CALL GraphicProvider::storeGraphic( const 
uno::Reference< ::graphic::XG
 

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

2023-01-19 Thread Miklos Vajna (via logerrit)
 include/vcl/filter/PDFiumLibrary.hxx |1 +
 sw/qa/core/text/text.cxx |   24 
 sw/source/core/text/itrform2.cxx |   22 ++
 vcl/source/pdf/PDFiumLibrary.cxx |   31 +++
 4 files changed, 66 insertions(+), 12 deletions(-)

New commits:
commit 14da39fcfffe8006a79971ac0b670e12d0d7a0ea
Author: Miklos Vajna 
AuthorDate: Thu Jan 19 19:53:12 2023 +0100
Commit: Miklos Vajna 
CommitDate: Fri Jan 20 07:50:29 2023 +

tdf#153047 sw: fix PDF export of content controls in placeholder mode

Importing an inline content control from DOCX used to be just plain text
in Writer, so the PDF export of that was also just plain text.

Now that content controls are actually supported, we used to not emit
them as plain text in the PDF export, since
82d90529dc2b3cb8359dec78852cbd910a66d275 (sw content controls, rich
text: add initial PDF export, 2022-09-12). Part of this was to write the
string value of the content control as the /V (value) key of the form,
when it's not in placeholder mode. This made sure that once the form is
filled in, no overlap between the plain text and the filled in text
happens.

Try to support both use-cases at the same time by also mapping the value
of the content control to /V, even if it's in placeholder mode. This
keeps avoiding the unwanted overlap, but this way the placeholder text
is no longer lost on PDF export.

An alternative would have been to map the placeholder text to
description when the alias/title is empty, but that would show up only
as a mouse tooltip, so won't change the behavior when the PDF is
printed.

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

diff --git a/include/vcl/filter/PDFiumLibrary.hxx 
b/include/vcl/filter/PDFiumLibrary.hxx
index 347b64619045..9c278d281a1c 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -110,6 +110,7 @@ public:
 virtual OUString getFormAdditionalActionJavaScript(PDFiumDocument* pDoc,
PDFAnnotAActionType 
eEvent)
 = 0;
+virtual OUString getFormFieldValue(PDFiumDocument* pDoc) = 0;
 };
 
 class PDFiumTextPage;
diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx
index db1895b795c0..9391630acd51 100644
--- a/sw/qa/core/text/text.cxx
+++ b/sw/qa/core/text/text.cxx
@@ -675,6 +675,30 @@ CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPDF)
  
pAnnotation->getFormFieldAlternateName(pPdfDocument.get()));
 }
 
+CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testContentControlPlaceholderPDF)
+{
+// Given a file with a content control, in placeholder mode:
+createSwDoc();
+SwDoc* pDoc = getSwDoc();
+SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+pWrtShell->InsertContentControl(SwContentControlType::RICH_TEXT);
+
+// When exporting to PDF:
+save("writer_pdf_Export");
+
+// Then make sure that a fillable form widget is emitted with the expected 
value:
+std::unique_ptr pPdfDocument = parsePDFExport();
+std::unique_ptr pPage = pPdfDocument->openPage(0);
+CPPUNIT_ASSERT_EQUAL(1, pPage->getAnnotationCount());
+std::unique_ptr pAnnotation = 
pPage->getAnnotation(0);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: Click here to enter text
+// - Actual  :
+// i.e. the value of the content control was empty, the placeholder value 
was lost.
+CPPUNIT_ASSERT_EQUAL(SwResId(STR_CONTENT_CONTROL_PLACEHOLDER),
+ pAnnotation->getFormFieldValue(pPdfDocument.get()));
+}
+
 CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testCheckboxContentControlPDF)
 {
 // Given a file with a checkbox content control:
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 9f075014fd9a..91f73ed87825 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1047,18 +1047,16 @@ bool SwContentControlPortion::DescribePDFControl(const 
SwTextPaintInfo& rInf) co
 pDescriptor->Description = pContentControl->GetAlias();
 }
 
-if (!pContentControl->GetShowingPlaceHolder())
-{
-SwPosition aPoint(*pTextNode, nStart);
-SwPosition aMark(*pTextNode, nEnd);
-SwPaM aPam(aMark, aPoint);
-OUString aText = aPam.GetText();
-static sal_Unicode const aForbidden[] = {
-CH_TXTATR_BREAKWORD,
-0
-};
-pDescriptor->Text = comphelper::string::removeAny(aText, aForbidden);
-}
+// Map the text of the content control to the descriptor's text.
+SwPosition aPoint(*pTextNode, nStart);
+SwPosition aMark(*pTextNode, nEnd);
+SwPaM aPam(aMark, aPo

[Libreoffice-commits] core.git: include/vcl sc/source sd/source starmath/source sw/source vcl/source

2023-01-13 Thread Noel Grandin (via logerrit)
 include/vcl/transfer.hxx |   10 +-
 sc/source/ui/app/drwtrans.cxx|   14 +-
 sc/source/ui/app/transobj.cxx|   14 +-
 sc/source/ui/inc/drwtrans.hxx|3 ---
 sc/source/ui/inc/transobj.hxx|2 --
 sc/source/ui/view/viewfun3.cxx   |6 ++
 sd/source/ui/app/sdxfer.cxx  |5 -
 sd/source/ui/dlg/sdtreelb.cxx|   12 
 sd/source/ui/inc/sdtreelb.hxx|3 ---
 sd/source/ui/inc/sdxfer.hxx  |3 ---
 starmath/source/view.cxx |2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx |   14 +-
 sw/source/uibase/inc/swdtflvr.hxx|3 ---
 sw/source/uibase/inc/uivwimp.hxx |3 ++-
 sw/source/uibase/uiview/uivwimp.cxx  |7 +++
 vcl/source/treelist/transfer.cxx |   12 
 16 files changed, 12 insertions(+), 101 deletions(-)

New commits:
commit d60722e29a0dde6282915188e5ff7e24890a14d3
Author: Noel Grandin 
AuthorDate: Thu Jan 12 16:25:40 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 13 18:13:51 2023 +

XUnoTunnel->dynamic_cast in TransferableHelper

which leads us to find that we can skip all the dynamic_cast'ing
altogether in SwView_Impl

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

diff --git a/include/vcl/transfer.hxx b/include/vcl/transfer.hxx
index bd5999a82234..e460e9f9c155 100644
--- a/include/vcl/transfer.hxx
+++ b/include/vcl/transfer.hxx
@@ -29,7 +29,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -130,8 +129,7 @@ struct ExecuteDropEvent
 
 class VCL_DLLPUBLIC TransferableHelper : public cppu::WeakImplHelper< 
css::datatransfer::XTransferable2,

css::datatransfer::clipboard::XClipboardOwner,
-   
css::datatransfer::dnd::XDragSourceListener,
-   
css::lang::XUnoTunnel >
+   
css::datatransfer::dnd::XDragSourceListener>
 {
 private:
 
@@ -265,12 +263,6 @@ public:
 voidStartDrag( vcl::Window* pWindow, sal_Int8 
nDragSourceActions );
 
 static void ClearPrimarySelection();
-
-static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
-public:
-
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& rId ) override;
 };
 
 struct TransferableDataHelper_Impl;
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index ed83dc893ae5..2ec8c57354b6 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -231,7 +231,7 @@ ScDrawTransferObj::~ScDrawTransferObj()
 
 ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard(const 
uno::Reference& xTransferable)
 {
-return comphelper::getFromUnoTunnel(xTransferable);
+return dynamic_cast(xTransferable.get());
 }
 
 static bool lcl_HasOnlyControls( SdrModel* pModel )
@@ -719,16 +719,4 @@ void ScDrawTransferObj::InitDocShell()
 pDocSh->UpdateOle(aViewData, true);
 }
 
-const css::uno::Sequence< sal_Int8 >& ScDrawTransferObj::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theScDrawTransferObjUnoTunnelId;
-return theScDrawTransferObjUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL ScDrawTransferObj::getSomething( const css::uno::Sequence< 
sal_Int8 >& rId )
-{
-return comphelper::getSomethingImpl(
-rId, this, 
comphelper::FallbackToGetSomethingOf{});
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index a81e4149956e..3bba033d28e7 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -198,7 +198,7 @@ ScTransferObj::~ScTransferObj()
 
 ScTransferObj* ScTransferObj::GetOwnClipboard(const 
uno::Reference& xTransferable)
 {
-return comphelper::getFromUnoTunnel(xTransferable);
+return dynamic_cast(xTransferable.get());
 }
 
 void ScTransferObj::AddSupportedFormats()
@@ -903,16 +903,4 @@ void ScTransferObj::StripRefs( ScDocument& rDoc,
 }
 }
 
-const css::uno::Sequence< sal_Int8 >& ScTransferObj::getUnoTunnelId()
-{
-static const comphelper::UnoIdInit theScTransferUnoTunnelId;
-return theScTransferUnoTunnelId.getSeq();
-}
-
-sal_Int64 SAL_CALL ScTransferObj::getSomething( const css::uno::Sequence< 
sal_Int8 >& rId )
-{
-return comphelper::getSomethingImpl(
-rId, this, 
comphelper::FallbackToGetSomethingOf{});
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 34e4af7063fc..49ec9e1e34d3 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -90,9 +90,6 @@ public:
 
 static

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

2023-01-11 Thread Miklos Vajna (via logerrit)
 include/vcl/bitmapex.hxx |2 ++
 vcl/qa/cppunit/png/PngFilterTest.cxx |   16 
 vcl/source/bitmap/BitmapEx.cxx   |   12 
 3 files changed, 30 insertions(+)

New commits:
commit 53603317af854a352e75fd2c5f0f0eeaacc5293c
Author: Miklos Vajna 
AuthorDate: Wed Jan 11 20:17:58 2023 +0100
Commit: Noel Grandin 
CommitDate: Thu Jan 12 06:54:30 2023 +

vcl: introduce a BitmapEx::DumpAsPng()

This is mostly useful for ad-hoc debugging, so you don't need to
manually create an SvFileStream, a vcl::PngImageWriter & connect them,
but you can step through code in the debugger and call DumpAsPng() at
random code locations.

The filename type is intentionally a 'const char*', so you can call
DumpAsPng(0) from gdb; that would not be possible for a 'const
OUString&' parameter type.

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

diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index 45f54d016a74..5838ef8d6e40 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -449,6 +449,8 @@ public:
 
 SAL_DLLPRIVATE std::shared_ptr const & ImplGetBitmapSalBitmap() 
const { return maBitmap.ImplGetSalBitmap(); }
 
+/// Dumps the pixels as PNG in bitmap.png.
+void DumpAsPng(const char* pFileName = nullptr) const;
 
 private:
 friend class ImpGraphic;
diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx 
b/vcl/qa/cppunit/png/PngFilterTest.cxx
index fd5747d8e9c8..dae007eb7898 100644
--- a/vcl/qa/cppunit/png/PngFilterTest.cxx
+++ b/vcl/qa/cppunit/png/PngFilterTest.cxx
@@ -176,6 +176,7 @@ public:
 void testPngRoundtrip24_8();
 void testPngRoundtrip32();
 void testPngWrite8BitRGBPalette();
+void testDump();
 
 CPPUNIT_TEST_SUITE(PngFilterTest);
 CPPUNIT_TEST(testPng);
@@ -186,6 +187,7 @@ public:
 CPPUNIT_TEST(testPngRoundtrip24_8);
 CPPUNIT_TEST(testPngRoundtrip32);
 CPPUNIT_TEST(testPngWrite8BitRGBPalette);
+CPPUNIT_TEST(testDump);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -1956,6 +1958,20 @@ void PngFilterTest::testPngWrite8BitRGBPalette()
 }
 }
 
+void PngFilterTest::testDump()
+{
+utl::TempFileNamed aTempFile;
+Bitmap aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
+{
+BitmapScopedWriteAccess pWriteAccessBitmap(aBitmap);
+pWriteAccessBitmap->SetPixel(0, 0, BitmapColor());
+}
+BitmapEx aBitmapEx(aBitmap);
+aBitmapEx.DumpAsPng(aTempFile.GetURL().toUtf8().getStr());
+SvStream* pStream = aTempFile.GetStream(StreamMode::READ);
+CPPUNIT_ASSERT_GREATER(static_cast(0), 
pStream->remainingSize());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(PngFilterTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index b8f96acbcfbd..cc3988abf333 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -41,6 +41,8 @@
 #include 
 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -1482,4 +1484,14 @@ void  BitmapEx::GetColorModel(css::uno::Sequence< 
sal_Int32 >& rRGBPalette,
 rnBitCount = pReadAccess->GetBitCount();
 }
 
+void BitmapEx::DumpAsPng(const char* pFileName) const
+{
+SvFileStream aStream(pFileName ? OUString::fromUtf8(pFileName)
+   : OUString("file:///tmp/bitmap.png"),
+ StreamMode::STD_READWRITE | StreamMode::TRUNC);
+assert(aStream.good());
+vcl::PngImageWriter aWriter(aStream);
+aWriter.write(*this);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-01-11 Thread Caolán McNamara (via logerrit)
 include/vcl/sysdata.hxx  |2 --
 vcl/inc/unx/salgdi.h |2 --
 vcl/unx/generic/gdi/cairo_xlib_cairo.cxx |4 +---
 vcl/unx/generic/gdi/salgdi.cxx   |3 ---
 vcl/unx/generic/gdi/salvd.cxx|   12 +---
 5 files changed, 2 insertions(+), 21 deletions(-)

New commits:
commit 62a8b202782e38b766304b882b14ace80c0d8a8d
Author: Caolán McNamara 
AuthorDate: Tue Jan 10 16:18:44 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Jan 11 12:12:54 2023 +

remove defunct pXRenderFormat field

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

diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index f7374a06d54e..b7bdb56228d1 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -156,7 +156,6 @@ struct SystemGraphicsData
 sal_uIntPtr hDrawable;  // a drawable
 void*   pVisual;// the visual in use
 int nScreen;// the current screen of the drawable
-void*   pXRenderFormat; // render format for drawable
 #endif
 #if USE_HEADLESS_CODE
 void*   pSurface;   // the cairo surface when using svp-based 
backends, which includes gtk[3|4]
@@ -177,7 +176,6 @@ struct SystemGraphicsData
 , hDrawable( 0 )
 , pVisual( nullptr )
 , nScreen( 0 )
-, pXRenderFormat( nullptr )
 #endif
 #if USE_HEADLESS_CODE
 , pSurface( nullptr )
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index ed0a9d10ad9e..4302f849337a 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -101,7 +101,6 @@ public:
 virtual SalGraphicsImpl*GetImpl() const override;
 SalGeometryProvider*GetGeometryProvider() const;
 voidSetDrawable(Drawable d, cairo_surface_t* 
surface, SalX11Screen nXScreen);
-voidSetXRenderFormat( XRenderPictFormat* 
pXRenderFormat ) { m_pXRenderFormat = pXRenderFormat; }
 
 const SalX11Screen& GetScreenNumber() const { return 
m_nXScreen; }
 
@@ -166,7 +165,6 @@ private:
 std::unique_ptrm_pDeleteColormap;
 
 SalX11Screenm_nXScreen;
-mutable XRenderPictFormat*  m_pXRenderFormat;
 
 Region  mpClipRegion;
 Pixmap  hBrush_;// Dither
diff --git a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx 
b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
index 6ff9c8bd205c..9ec8167fbfdd 100644
--- a/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
+++ b/vcl/unx/generic/gdi/cairo_xlib_cairo.cxx
@@ -65,8 +65,7 @@ namespace cairo
 pDisplay(pSysDat.pDisplay),
 hDrawable(pSysDat.hDrawable),
 pVisual(pSysDat.pVisual),
-nScreen(pSysDat.nScreen),
-pRenderFormat(pSysDat.pXRenderFormat)
+nScreen(pSysDat.nScreen)
 {}
 
 X11SysData::X11SysData( const SystemEnvData& pSysDat, const SalFrame* 
pReference ) :
@@ -248,7 +247,6 @@ namespace cairo
 
 aSystemGraphicsData.nSize = sizeof(SystemGraphicsData);
 aSystemGraphicsData.hDrawable = mpPixmap ? mpPixmap->mhDrawable : 
maSysData.hDrawable;
-aSystemGraphicsData.pXRenderFormat = maSysData.pRenderFormat;
 aSystemGraphicsData.pSurface = pSurface;
 
 int width = cairo_xlib_surface_get_width(pSurface);
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 6a534ac4e236..b4347c0dfa59 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -83,7 +83,6 @@ X11SalGraphics::X11SalGraphics():
 m_pFrame(nullptr),
 m_pVDev(nullptr),
 m_nXScreen( 0 ),
-m_pXRenderFormat(nullptr),
 mpClipRegion(nullptr),
 hBrush_(None),
 bWindow_(false),
@@ -162,7 +161,6 @@ void X11SalGraphics::SetDrawable(Drawable aDrawable, 
cairo_surface_t* pSurface,
 }
 
 maX11Common.m_hDrawable = aDrawable;
-SetXRenderFormat( nullptr );
 }
 
 void X11SalGraphics::Init( X11SalFrame& rFrame, Drawable aTarget,
@@ -341,7 +339,6 @@ SystemGraphicsData X11SalGraphics::GetGraphicsData() const
 aRes.hDrawable = maX11Common.m_hDrawable;
 aRes.pVisual   = GetVisual().visual;
 aRes.nScreen   = m_nXScreen.getXScreen();
-aRes.pXRenderFormat = m_pXRenderFormat;
 return aRes;
 }
 
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 047437a7f78c..ee23e9112d96 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -135,17 +135,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(const 
SalGraphics& rGraphics, tools::Lo
 bExternPixmap_ = false;
 }
 
-XRenderPictFormat* pXRenderFormat = pData ? 
static_cast(pData->pXRenderFormat) : nullptr;
-if( pXRenderFormat )
-{
-pGraphics_->SetXRenderFormat( pXRenderFormat );
-if( pXRenderFormat-

[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/headless vcl/inc vcl/qt5 vcl/skia vcl/unx

2023-01-06 Thread Noel Grandin (via logerrit)
 include/vcl/salgtype.hxx|2 
 vcl/headless/CairoCommon.cxx|   45 ---
 vcl/headless/SvpGraphicsBackend.cxx |   69 +++-
 vcl/inc/headless/CairoCommon.hxx|   33 ++-
 vcl/inc/qt5/QtGraphics.hxx  |5 +
 vcl/inc/skia/gdiimpl.hxx|   35 ++--
 vcl/inc/unx/saldisp.hxx |2 
 vcl/qt5/QtGraphics_GDI.cxx  |   32 +--
 vcl/qt5/QtPainter.cxx   |8 +-
 vcl/skia/gdiimpl.cxx|   65 +++---
 vcl/skia/osx/gdiimpl.cxx|4 -
 vcl/unx/generic/app/saldisp.cxx |   10 ++-
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx |   16 ++---
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.hxx |   12 ++--
 vcl/unx/generic/gdi/gdiimpl.cxx |   56 +--
 vcl/unx/generic/gdi/gdiimpl.hxx |5 +
 16 files changed, 205 insertions(+), 194 deletions(-)

New commits:
commit 89b1d41e0d2cd16a4088e095de0f673807c4adac
Author: Noel Grandin 
AuthorDate: Thu Jan 5 12:32:32 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jan 6 11:34:20 2023 +

use std::optional for SALCOLOR_NONE

instead of re-using an actual real color value, because it will totally
not work when I convert vcl to use alpha instead of transparency

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

diff --git a/include/vcl/salgtype.hxx b/include/vcl/salgtype.hxx
index a6559d68da23..efd5cc8060d3 100644
--- a/include/vcl/salgtype.hxx
+++ b/include/vcl/salgtype.hxx
@@ -33,8 +33,6 @@ enum class DeviceFormat {
 #endif
 };
 
-constexpr ::Color SALCOLOR_NONE ( ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF );
-
 struct SalTwoRect
 {
 tools::LongmnSrcX;
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 291bc7e36380..0779cb65c564 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -609,14 +609,14 @@ void CairoCommon::clipRegion(cairo_t* cr, const 
vcl::Region& rClipRegion)
 
 void CairoCommon::clipRegion(cairo_t* cr) { CairoCommon::clipRegion(cr, 
m_aClipRegion); }
 
-void CairoCommon::drawPixel(cairo_t* cr, basegfx::B2DRange* pExtents, const 
Color& rLineColor,
-tools::Long nX, tools::Long nY)
+void CairoCommon::drawPixel(cairo_t* cr, basegfx::B2DRange* pExtents,
+const std::optional& rLineColor, 
tools::Long nX, tools::Long nY)
 {
-if (rLineColor == SALCOLOR_NONE)
+if (!rLineColor)
 return;
 
 cairo_rectangle(cr, nX, nY, 1, 1);
-CairoCommon::applyColor(cr, rLineColor, 0.0);
+CairoCommon::applyColor(cr, *rLineColor, 0.0);
 cairo_fill(cr);
 
 if (pExtents)
@@ -687,9 +687,11 @@ void CairoCommon::drawLine(cairo_t* cr, basegfx::B2DRange* 
pExtents, const Color
 cairo_stroke(cr);
 }
 
-void CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, 
const Color& rLineColor,
-  const Color& rFillColor, bool bAntiAlias, 
sal_uInt32 nPoly,
-  const sal_uInt32* pPointCounts, const 
Point** pPtAry)
+void CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents,
+  const std::optional& rLineColor,
+  const std::optional& rFillColor, bool 
bAntiAlias,
+  sal_uInt32 nPoly, const sal_uInt32* 
pPointCounts,
+  const Point** pPtAry)
 {
 basegfx::B2DPolyPolygon aPolyPoly;
 for (sal_uInt32 nPolygon = 0; nPolygon < nPoly; ++nPolygon)
@@ -711,13 +713,14 @@ void CairoCommon::drawPolyPolygon(cairo_t* cr, 
basegfx::B2DRange* pExtents, cons
 aPolyPoly, 0.0);
 }
 
-bool CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents, 
const Color& rLineColor,
-  const Color& rFillColor, bool bAntiAlias,
+bool CairoCommon::drawPolyPolygon(cairo_t* cr, basegfx::B2DRange* pExtents,
+  const std::optional& rLineColor,
+  const std::optional& rFillColor, bool 
bAntiAlias,
   const basegfx::B2DHomMatrix& rObjectToDevice,
   const basegfx::B2DPolyPolygon& rPolyPolygon, 
double fTransparency)
 {
-const bool bHasFill(rFillColor != SALCOLOR_NONE);
-const bool bHasLine(rLineColor != SALCOLOR_NONE);
+const bool bHasFill(rFillColor.has_value());
+const bool bHasLine(rLineColor.has_value());
 
 if (0 == rPolyPolygon.count() || !(bHasFill || bHasLine) || fTransparency 
< 0.0
 || fTransparency >= 1.0)

[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/inc vcl/jsdialog

2022-12-16 Thread Szymon Kłos (via logerrit)
 include/vcl/jsdialog/executor.hxx|   10 ++
 include/vcl/weld.hxx |2 ++
 vcl/inc/jsdialog/jsdialogbuilder.hxx |   17 +
 vcl/jsdialog/executor.cxx|3 +++
 vcl/jsdialog/jsdialogbuilder.cxx |   14 ++
 5 files changed, 46 insertions(+)

New commits:
commit cc067789ab7fd67bdd6f6ba8ce53a6580a56d7ff
Author: Szymon Kłos 
AuthorDate: Tue Dec 6 18:23:32 2022 +0100
Commit: Miklos Vajna 
CommitDate: Fri Dec 16 19:49:56 2022 +

jsdialog: enter/leave tab page handlers

(cherry picked from commit 1257c288a0ba03fc69e7bc29fcf05642eb91d150)

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

diff --git a/include/vcl/jsdialog/executor.hxx 
b/include/vcl/jsdialog/executor.hxx
index 6e388a6a3f79..9bccad3f1865 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -72,6 +72,16 @@ public:
 {
 rArea.m_aCommandHdl.Call(rCmd);
 }
+
+static void enter_page(weld::Notebook& rNotebook, const OString& rPage)
+{
+rNotebook.m_aEnterPageHdl.Call(rPage);
+}
+
+static void leave_page(weld::Notebook& rNotebook, const OString& rPage)
+{
+rNotebook.m_aLeavePageHdl.Call(rPage);
+}
 };
 
 namespace jsdialog
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 3bcbc0a7a08d..c9273bf4743b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -463,6 +463,8 @@ public:
 
 class VCL_DLLPUBLIC Notebook : virtual public Widget
 {
+friend class ::LOKTrigger;
+
 protected:
 Link m_aLeavePageHdl;
 Link m_aEnterPageHdl;
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 291fd24babb7..564309a72626 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -534,6 +534,12 @@ public:
 
 class JSNotebook final : public JSWidget
 {
+Link m_aLeavePageOverridenHdl;
+Link m_aEnterPageOverridenHdl;
+
+DECL_LINK(LeaveHdl, const OString&, bool);
+DECL_LINK(EnterHdl, const OString&, bool);
+
 public:
 JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, 
SalInstanceBuilder* pBuilder,
bool bTakeOwnership);
@@ -545,6 +551,17 @@ public:
 virtual void remove_page(const OString& rIdent) override;
 
 virtual void insert_page(const OString& rIdent, const OUString& rLabel, 
int nPos) override;
+
+void connect_leave_page(const Link& rLink)
+{
+m_aLeavePageHdl = LINK(this, JSNotebook, LeaveHdl);
+m_aLeavePageOverridenHdl = rLink;
+}
+void connect_enter_page(const Link& rLink)
+{
+m_aLeavePageHdl = LINK(this, JSNotebook, EnterHdl);
+m_aEnterPageOverridenHdl = rLink;
+}
 };
 
 class JSSpinButton final : public JSWidget
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 51dcca8f5d16..acd0e084ae76 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -91,7 +91,10 @@ bool ExecuteAction(const std::string& nWindowId, const 
OString& rWidget, StringM
 {
 sal_Int32 page = o3tl::toInt32(rData["data"]);
 
+OString aCurrentPage = pNotebook->get_current_page_ident();
+LOKTrigger::leave_page(*pNotebook, aCurrentPage);
 pNotebook->set_current_page(page);
+LOKTrigger::enter_page(*pNotebook, 
pNotebook->get_page_ident(page));
 
 return true;
 }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index da30834b0568..51566201638d 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1315,6 +1315,20 @@ void JSComboBox::set_active(int pos)
 
 bool JSComboBox::changed_by_direct_pick() const { return true; }
 
+IMPL_LINK(JSNotebook, LeaveHdl, const OString&, rPage, bool)
+{
+m_aLeavePageOverridenHdl.Call(rPage);
+sendFullUpdate();
+return true;
+}
+
+IMPL_LINK(JSNotebook, EnterHdl, const OString&, rPage, bool)
+{
+m_aEnterPageOverridenHdl.Call(rPage);
+sendFullUpdate();
+return true;
+}
+
 JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
 : JSWidget(pSender, pControl, pBuilder, 
bTakeOwnership)


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

2022-12-06 Thread Jim Raykowski (via logerrit)
 include/vcl/weld.hxx   |4 
 sw/source/uibase/inc/conttree.hxx  |   10 ++
 sw/source/uibase/utlui/content.cxx |  170 +
 vcl/inc/salvtables.hxx |4 
 vcl/inc/treeglue.hxx   |   25 +++--
 vcl/source/app/salvtables.cxx  |6 -
 vcl/unx/gtk3/gtkinst.cxx   |   41 
 7 files changed, 224 insertions(+), 36 deletions(-)

New commits:
commit 3cb654972ba204efb5dd35a44f95c7d509414400
Author: Jim Raykowski 
AuthorDate: Sat Dec 3 20:11:07 2022 -0900
Commit: Jim Raykowski 
CommitDate: Tue Dec 6 21:47:49 2022 +

tdf#152029 Visually draw attention to in-view bookmark

when mouse pointer is over bookmark entry in the Navigator content tree

This patch brings attention to in-view bookmarks when the mouse pointer
is positioned over bookmark content entries in the Navigator content
tree. All in-view bookmarks are brought to attention by placing the
mouse pointer over the bookmark content type (category) entry.

The patch adds a parameter to the weld::get_dest_row_at_pos function to
give the option not to auto scroll. It is needed to prevent auto
scrolling when used in the the mouse move handler. Additional use can
be made in the content tree CommandHdl to make the tree not jump when
the context popup menu is activated for entries near the top and bottom
of the the visible tree.

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

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 4b4ea74f13b3..3bcbc0a7a08d 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1352,7 +1352,9 @@ public:
  *after the row
  * b) dnd highlight the dest row
  */
-virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* 
pResult, bool bDnDMode) = 0;
+virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* 
pResult, bool bDnDMode,
+ bool bAutoScroll = true)
+= 0;
 virtual void unset_drag_dest_row() = 0;
 virtual tools::Rectangle get_row_area(const weld::TreeIter& rIter) const = 
0;
 // for dragging and dropping between TreeViews, return the active source
diff --git a/sw/source/uibase/inc/conttree.hxx 
b/sw/source/uibase/inc/conttree.hxx
index cf7c383f81e4..77358b9edb30 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -32,6 +32,8 @@
 #include 
 #include 
 
+#include 
+
 class SwWrtShell;
 class SwContentType;
 class SwNavigationPI;
@@ -91,6 +93,7 @@ class SwContentTree final : public SfxListener
 SwNavigationPI* m_pDialog;
 OUStringm_sSpace;
 AutoTimer   m_aUpdTimer;
+AutoTimer m_aOverlayObjectDelayTimer;
 
 o3tl::enumarray>  
m_aActiveContentArr;
 o3tl::enumarray>  
m_aHiddenContentArr;
@@ -129,6 +132,11 @@ class SwContentTree final : public SfxListener
 bool m_bDocHasChanged = true;
 bool m_bIgnoreDocChange = false; // used to prevent tracking update
 
+std::unique_ptr m_xOverlayCompareEntry;
+std::unique_ptr m_xOverlayObject;
+
+void BringBookmarksToAttention(const std::vector& rNames);
+
 /**
  * Before any data will be deleted, the last active entry has to be found.
  * After this the UserData will be deleted
@@ -183,6 +191,8 @@ class SwContentTree final : public SfxListener
 DECL_LINK(QueryTooltipHdl, const weld::TreeIter&, OUString);
 DECL_LINK(DragBeginHdl, bool&, bool);
 DECL_LINK(TimerUpdate, Timer *, void);
+DECL_LINK(m_aOverlayObjectDelayTimerHdl, Timer *, void);
+DECL_LINK(MouseMoveHdl, const MouseEvent&, bool);
 
 public:
 SwContentTree(std::unique_ptr xTreeView, SwNavigationPI* 
pDialog);
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 32a9e8ab63ce..cb7f96ec3b23 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -102,6 +102,12 @@
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #define CTYPE_CNT   0
 #define CTYPE_CTT   1
 
@@ -1066,6 +1072,7 @@ 
SwContentTree::SwContentTree(std::unique_ptr xTreeView, SwNaviga
 , m_pDialog(pDialog)
 , m_sSpace(OUString(""))
 , m_aUpdTimer("SwContentTree m_aUpdTimer")
+, m_aOverlayObjectDelayTimer("SwContentTree m_aOverlayObjectDelayTimer")
 , m_sInvisible(SwResId(STR_INVISIBLE))
 , m_pHiddenShell(nullptr)
 , m_pActiveShell(nullptr)
@@ -1082,6 +1089,7 @@ 
SwContentTree::SwContentTree(std::unique_ptr xTreeView, SwNaviga
 , m_bIsLastReadOnly(false)
 , m_bIsOutlineMoveable(true)
 , m_bViewHasChanged(false)
+, m_xOverlayCompareEntry(m_xTreeView->make_iterator())
 {
 m_xTreeView->set_size_request(m_xTreeView->get_approximate_digit_width() * 
30,

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

2022-12-04 Thread Khaled Hosny (via logerrit)
 include/vcl/font/Feature.hxx  |9 +++-
 vcl/inc/font/OpenTypeFeatureDefinitionList.hxx|3 -
 vcl/source/font/OpenTypeFeatureDefinitionList.cxx |   43 +++---
 3 files changed, 13 insertions(+), 42 deletions(-)

New commits:
commit fcba85d2ebb54692e0730610026b9b51feb67716
Author: Khaled Hosny 
AuthorDate: Sat Dec 3 16:29:46 2022 +0200
Commit: خالد حسني 
CommitDate: Sun Dec 4 08:21:38 2022 +

Check for trailing numeric part in isCharacterVariant/isStylisticSet

We want to mach features like “ss01” but not, say, “ssty”.

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

diff --git a/include/vcl/font/Feature.hxx b/include/vcl/font/Feature.hxx
index c5bd497532e8..0c3c159dbc11 100644
--- a/include/vcl/font/Feature.hxx
+++ b/include/vcl/font/Feature.hxx
@@ -11,6 +11,7 @@
 #define INCLUDED_VCL_FONT_FEATURE_HXX
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,12 +93,16 @@ struct Feature
 
 bool isCharacterVariant() const
 {
-return ((m_nCode >> 24) & 0xFF) == 'c' && ((m_nCode >> 16) & 0xFF) == 
'v';
+return ((m_nCode >> 24) & 0xFF) == 'c' && ((m_nCode >> 16) & 0xFF) == 
'v'
+   && rtl::isAsciiDigit((m_nCode >> 8) & 0xFF)
+   && rtl::isAsciiDigit((m_nCode >> 0) & 0xFF);
 }
 
 bool isStylisticSet() const
 {
-return ((m_nCode >> 24) & 0xFF) == 's' && ((m_nCode >> 16) & 0xFF) == 
's';
+return ((m_nCode >> 24) & 0xFF) == 's' && ((m_nCode >> 16) & 0xFF) == 
's'
+   && rtl::isAsciiDigit((m_nCode >> 8) & 0xFF)
+   && rtl::isAsciiDigit((m_nCode >> 0) & 0xFF);
 }
 
 uint32_t m_nCode;
diff --git a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx 
b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
index c8fb6f7a449d..1ae634deabe8 100644
--- a/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
+++ b/vcl/inc/font/OpenTypeFeatureDefinitionList.hxx
@@ -25,9 +25,6 @@ private:
 
 void init();
 
-static bool isSpecialFeature(vcl::font::Feature& rFeature);
-static FeatureDefinition handleSpecialFeature(vcl::font::Feature& 
rFeature);
-
 public:
 OpenTypeFeatureDefinitionListPrivate();
 FeatureDefinition getDefinition(vcl::font::Feature& rFeature);
diff --git a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx 
b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
index 4cc370cec3c7..0400833937af 100644
--- a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
+++ b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
@@ -125,49 +125,18 @@ void OpenTypeFeatureDefinitionListPrivate::init()
 });
 }
 
-namespace
-{
-OUString getNumericLowerPart(vcl::font::Feature& rFeature)
-{
-auto nFeatureCode = rFeature.m_nCode;
-char cChar1((sal_uInt32(nFeatureCode) >> 8) & 0xFF);
-char cChar2((sal_uInt32(nFeatureCode) >> 0) & 0xFF);
-
-if (rtl::isAsciiDigit(static_cast(cChar1))
-&& rtl::isAsciiDigit(static_cast(cChar2)))
-{
-return OUStringChar(cChar1) + OUStringChar(cChar2);
-}
-return OUString();
-}
-
-} // end anonymous namespace
-
-bool 
OpenTypeFeatureDefinitionListPrivate::isSpecialFeature(vcl::font::Feature& 
rFeature)
-{
-return rFeature.isCharacterVariant() || rFeature.isStylisticSet();
-}
-
-FeatureDefinition
-OpenTypeFeatureDefinitionListPrivate::handleSpecialFeature(vcl::font::Feature& 
rFeature)
+FeatureDefinition 
OpenTypeFeatureDefinitionListPrivate::getDefinition(vcl::font::Feature& 
rFeature)
 {
-FeatureDefinition aFeatureDefinition;
-OUString sNumericPart = getNumericLowerPart(rFeature);
-if (!sNumericPart.isEmpty())
+if (rFeature.isCharacterVariant() || rFeature.isStylisticSet())
 {
+FeatureDefinition aFeatureDefinition;
+OUString sNumericPart = OUStringChar(char((rFeature.m_nCode >> 8) & 
0xFF))
++ OUStringChar(char((rFeature.m_nCode >> 0) & 
0xFF));
 if (rFeature.isCharacterVariant())
 aFeatureDefinition = { rFeature.m_nCode, STR_FONT_FEATURE_ID_CVXX, 
sNumericPart };
 else if (rFeature.isStylisticSet())
 aFeatureDefinition = { rFeature.m_nCode, STR_FONT_FEATURE_ID_SSXX, 
sNumericPart };
-}
-return aFeatureDefinition;
-}
-
-FeatureDefinition 
OpenTypeFeatureDefinitionListPrivate::getDefinition(vcl::font::Feature& 
rFeature)
-{
-if (isSpecialFeature(rFeature))
-{
-return handleSpecialFeature(rFeature);
+return aFeatureDefinition;
 }
 
 auto nFeatureCode = rFeature.m_nCode;


  1   2   3   4   5   6   7   8   9   10   >