core.git: vcl/inc vcl/source

2024-05-31 Thread Samuel Mehrbrodt (via logerrit)
 vcl/inc/verticaltabctrl.hxx |2 ++
 vcl/source/control/imivctl1.cxx |4 ++--
 vcl/source/control/ivctrl.cxx   |   14 ++
 3 files changed, 18 insertions(+), 2 deletions(-)

New commits:
commit 68260d7525aeaf38ac09ca9920fa1fa76dc8018a
Author: Samuel Mehrbrodt 
AuthorDate: Mon Apr 29 15:14:48 2024 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Fri May 31 13:45:24 2024 +0200

tdf#99528 Move through tabs with Ctrl-PageUp/Down keys

As required by test_tab_navigation unit test

Change-Id: Ia77aa57de420574922b4fd4a0759f18c2dc778f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166856
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx
index e00770b8d1f8..99c6cfeceeb0 100644
--- a/vcl/inc/verticaltabctrl.hxx
+++ b/vcl/inc/verticaltabctrl.hxx
@@ -53,6 +53,8 @@ public:
 virtual ~VerticalTabControl() override;
 virtual void dispose() override;
 
+virtual bool EventNotify(NotifyEvent& rNEvt) override;
+
 sal_uInt16 GetPageCount() const { return m_xChooser->GetEntryCount(); }
 
 const OUString& GetCurPageId() const { return m_sCurrentPageId; }
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index 3071083494e1..ea69fbcfb99b 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -879,7 +879,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& 
rKEvt )
 if( pCursor )
 {
 MakeEntryVisible( pCursor );
-if( nCode == KEY_UP )
+if( nCode == KEY_UP || (rKEvt.GetKeyCode().IsMod1() && nCode 
== KEY_PAGEUP))
 pNewCursor = pImpCursor->GoUpDown(pCursor,false);
 else
 pNewCursor = pImpCursor->GoPageUpDown(pCursor,false);
@@ -901,7 +901,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& 
rKEvt )
 case KEY_PAGEDOWN:
 if( pCursor )
 {
-if( nCode == KEY_DOWN )
+if( nCode == KEY_DOWN || (rKEvt.GetKeyCode().IsMod1() && nCode 
== KEY_PAGEDOWN) )
 pNewCursor=pImpCursor->GoUpDown( pCursor,true );
 else
 pNewCursor=pImpCursor->GoPageUpDown( pCursor,true );
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index c7e76a75eab0..cb0c4e33d0c3 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -481,6 +481,20 @@ IMPL_LINK_NOARG(VerticalTabControl, ChosePageHdl_Impl, 
SvtIconChoiceCtrl*, void)
 SetCurPageId(pData->sId);
 }
 
+bool VerticalTabControl::EventNotify(NotifyEvent& rNEvt)
+{
+if (rNEvt.GetType() == NotifyEventType::KEYINPUT)
+{
+sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
+if (nCode == KEY_PAGEUP || nCode == KEY_PAGEDOWN)
+{
+m_xChooser->DoKeyInput(*(rNEvt.GetKeyEvent()));
+return true;
+}
+}
+return VclHBox::EventNotify(rNEvt);
+}
+
 void VerticalTabControl::ActivatePage()
 {
 m_aActivateHdl.Call( this );


core.git: vcl/inc vcl/source

2024-05-30 Thread Thorsten Behrens (via logerrit)
 vcl/inc/verticaltabctrl.hxx   |1 +
 vcl/source/control/ivctrl.cxx |   18 ++
 2 files changed, 19 insertions(+)

New commits:
commit 7629d31f02a9fdbdf71295744c8869dee5cb4c54
Author: Thorsten Behrens 
AuthorDate: Mon May 27 01:51:02 2024 +0200
Commit: Thorsten Behrens 
CommitDate: Thu May 30 22:34:53 2024 +0200

tdf#161006 tdf#161049 tdf#161020 tdf#161047 fix VertTabCtrl size calculation

* don't rely on initial dummy pages
* so instead override GetOptimalSize() and do the math again
* this assumes that all tab pages have been inserted at the time time
  GetOptimalSize() gets called for the last time

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

diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx
index 666bef474172..e00770b8d1f8 100644
--- a/vcl/inc/verticaltabctrl.hxx
+++ b/vcl/inc/verticaltabctrl.hxx
@@ -80,6 +80,7 @@ public:
 
 vcl::Window* GetPageParent() { return m_xBox.get(); }
 
+virtual Size GetOptimalSize() const override;
 virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
 
 virtual FactoryFunction GetUITestFactory() const override;
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index 14e0ec44938b..c7e76a75eab0 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -627,6 +627,24 @@ void VerticalTabControl::SetPageText(std::u16string_view 
rPageId, const OUString
 pData->pEntry->SetText(rText);
 }
 
+Size VerticalTabControl::GetOptimalSize() const
+{
+// re-calculate size - we might have replaced dummy tab pages with
+// actual content
+Size aOptimalPageSize(m_xBox->get_preferred_size());
+
+for (auto const& item : maPageList)
+{
+Size aPagePrefSize(item->xPage->get_preferred_size());
+if (aPagePrefSize.Width() > aOptimalPageSize.Width())
+aOptimalPageSize.setWidth( aPagePrefSize.Width() );
+if (aPagePrefSize.Height() > aOptimalPageSize.Height())
+aOptimalPageSize.setHeight( aPagePrefSize.Height() );
+}
+
+return aOptimalPageSize;
+}
+
 void VerticalTabControl::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
 {
 rJsonWriter.put("id", get_id());


core.git: vcl/inc vcl/source

2024-05-29 Thread Jonathan Clark (via logerrit)
 vcl/inc/ImplLayoutRuns.hxx |   17 
 vcl/inc/sallayout.hxx  |3 
 vcl/source/gdi/CommonSalLayout.cxx |   28 ++--
 vcl/source/text/ImplLayoutArgs.cxx |   37 --
 vcl/source/text/ImplLayoutRuns.cxx |  128 +++--
 5 files changed, 93 insertions(+), 120 deletions(-)

New commits:
commit 0b6a07f07dd05d0db4ddeedb9b112e26b5fd5eb5
Author: Jonathan Clark 
AuthorDate: Tue May 28 17:27:19 2024 -0600
Commit: Jonathan Clark 
CommitDate: Wed May 29 09:37:18 2024 +0200

tdf#81272 Improved CJK fallback rendering performance

This change includes the following performance fixes:

- Removes an expensive vector sort from fallback run computation.

- Reduces unnecessary BreakIterator use while collecting grapheme
  clusters requiring fallback.

Change-Id: I760825596e0609059ef0c5ca97e210ab6647e466
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168175
Tested-by: Jenkins
Reviewed-by: Jonathan Clark 

diff --git a/vcl/inc/ImplLayoutRuns.hxx b/vcl/inc/ImplLayoutRuns.hxx
index dec9ca59dcfc..fecf1957d5f2 100644
--- a/vcl/inc/ImplLayoutRuns.hxx
+++ b/vcl/inc/ImplLayoutRuns.hxx
@@ -26,8 +26,18 @@
 class VCL_DLLPUBLIC ImplLayoutRuns
 {
 private:
+struct Run
+{
+int m_nMinRunPos;
+int m_nEndRunPos;
+bool m_bRTL;
+
+Run(int nMinRunPos, int nEndRunPos, bool bRTL);
+bool Contains(int nCharPos) const;
+};
+
 int mnRunIndex;
-boost::container::small_vector maRuns;
+boost::container::small_vector maRuns;
 
 public:
 ImplLayoutRuns() { mnRunIndex = 0; }
@@ -38,11 +48,14 @@ public:
 
 bool IsEmpty() const { return maRuns.empty(); }
 void ResetPos() { mnRunIndex = 0; }
-void NextRun() { mnRunIndex += 2; }
+void NextRun() { ++mnRunIndex; }
 bool GetRun(int* nMinRunPos, int* nEndRunPos, bool* bRTL) const;
 bool GetNextPos(int* nCharPos, bool* bRTL);
 bool PosIsInRun(int nCharPos) const;
 bool PosIsInAnyRun(int nCharPos) const;
+
+inline auto begin() const { return maRuns.begin(); }
+inline auto end() const { return maRuns.end(); }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 49eb0c4ce93a..0b10629fcb3e 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -152,7 +152,8 @@ private:
 SAL_DLLPRIVATE void GetCharWidths(std::vector& rCharWidths,
   const OUString& rStr) const;
 
-SAL_DLLPRIVATE void SetNeedFallback(vcl::text::ImplLayoutArgs&, sal_Int32, 
bool);
+SAL_DLLPRIVATE void SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, 
sal_Int32 nCharPos,
+sal_Int32 nCharEnd, bool bRightToLeft);
 
 SAL_DLLPRIVATE bool HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 
aNextChar);
 
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index a3646b69edc2..37a640645999 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -234,9 +234,10 @@ SalLayoutGlyphs GenericSalLayout::GetGlyphs() const
 return glyphs;
 }
 
-void GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, 
sal_Int32 nCharPos, bool bRightToLeft)
+void GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, 
sal_Int32 nCharPos,
+   sal_Int32 nCharEnd, bool bRightToLeft)
 {
-if (nCharPos < 0 || mbFuzzing)
+if (nCharPos < 0 || nCharPos == nCharEnd || mbFuzzing)
 return;
 
 using namespace ::com::sun::star;
@@ -250,9 +251,8 @@ void 
GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, sal_Int
 //mark all glyphs as missing so the whole thing is rendered with the same
 //font
 sal_Int32 nDone;
-int nGraphemeEndPos =
-mxBreak->nextCharacters(rArgs.mrStr, nCharPos, aLocale,
-i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
+int nGraphemeEndPos = mxBreak->nextCharacters(rArgs.mrStr, nCharEnd - 1, 
aLocale,
+  
i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
 // Safely advance nCharPos in case it is a non-BMP character.
 rArgs.mrStr.iterateCodePoints();
 int nGraphemeStartPos =
@@ -354,13 +354,22 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
 if (rArgs.mnEndCharPos - rArgs.mnMinCharPos <= 0)
 return true;
 
+ImplLayoutRuns aFallbackRuns;
+
 if (pGlyphs)
 {
 // Work with pre-computed glyph items.
 m_GlyphItems = *pGlyphs;
+
 for(const GlyphItem& item : m_GlyphItems)
 if(!item.glyphId())
-SetNeedFallback(rArgs, item.charPos(), item.IsRTLGlyph());
+aFallbackRuns.AddPos(item.charPos(), item.IsRTLGlyph());
+
+for (const auto& rRun : aFallbackRuns)
+{
+SetNeedFallback(rArgs, 

core.git: vcl/inc vcl/osx

2024-05-26 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/a11ywrapper.h|2 
 vcl/osx/a11yactionwrapper.mm |   10 ++-
 vcl/osx/a11ycomponentwrapper.mm  |5 +
 vcl/osx/a11yfactory.mm   |3 
 vcl/osx/a11yrolehelper.mm|4 -
 vcl/osx/a11yselectionwrapper.mm  |   12 +++
 vcl/osx/a11ytextattributeswrapper.mm |   12 ++-
 vcl/osx/a11ytextwrapper.mm   |   17 -
 vcl/osx/a11ywrapper.mm   |  110 ++-
 vcl/osx/a11ywrapperbutton.mm |2 
 vcl/osx/a11ywrappercheckbox.mm   |4 +
 vcl/osx/a11ywrappercombobox.mm   |6 +
 vcl/osx/a11ywrappergroup.mm  |2 
 vcl/osx/a11ywrapperlist.mm   |2 
 vcl/osx/a11ywrapperradiobutton.mm|4 +
 vcl/osx/a11ywrapperradiogroup.mm |2 
 vcl/osx/a11ywrapperrow.mm|2 
 vcl/osx/a11ywrapperscrollarea.mm |2 
 vcl/osx/a11ywrapperscrollbar.mm  |2 
 vcl/osx/a11ywrappersplitter.mm   |2 
 vcl/osx/a11ywrapperstatictext.mm |2 
 vcl/osx/a11ywrappertabgroup.mm   |2 
 vcl/osx/a11ywrappertextarea.mm   |2 
 vcl/osx/a11ywrappertoolbar.mm|2 
 vcl/osx/salmenu.cxx  |1 
 25 files changed, 157 insertions(+), 57 deletions(-)

New commits:
commit 0735a4306da86c6fa0390b85f1f391ec404b2699
Author: Patrick Luby 
AuthorDate: Fri May 24 20:26:23 2024 -0400
Commit: Noel Grandin 
CommitDate: Sun May 26 09:52:41 2024 +0200

Related tdf#158914: fix memory leaks by calling (auto)release selectors

Found the following memory leaks using Xcode's Instruments application:

1. Posting an NSAccessibilityUIElementDestroyedNotification
   notification causes [ AquaA11yWrapper isAccessibilityElement ]
   to be called on the object so mark the object as disposed
   before posting the destroyed notification and test for disposed
   in all of the standard NSAccessibility selectors to prevent
   any calls to likely disposed C++ accessibility objects.

2. In [ AquaA11yWrapper accessibilityHitTest: ],
   [ AquaA11yFactory wrapperForAccessibleContext: ] already retains
   the returned object so retaining it until the next call to this
   selector can lead to a memory leak when dragging selected cells
   in Calc to a new location. So autorelease the object so that
   transient objects stay alive but not past the next clearing of
   the autorelease pool.

3. [ AquaA11ySelectionWrapper selectedChildrenAttributeForElement: ] is
   expected to return an autoreleased object.

4. [ AquaA11yFactory wrapperForAccessible: ] is not a getter. It
   expects the caller to release the returned object.

5. CreateNSString() is not a getter. It expects the caller to
   release the returned string.

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

diff --git a/vcl/inc/osx/a11ywrapper.h b/vcl/inc/osx/a11ywrapper.h
index 1eb4039c57e9..48fdd8e2a582 100644
--- a/vcl/inc/osx/a11ywrapper.h
+++ b/vcl/inc/osx/a11ywrapper.h
@@ -67,6 +67,7 @@ struct ReferenceWrapper
 ReferenceWrapper maReferenceWrapper;
 BOOL mActsAsRadioGroup;
 BOOL mIsTableCell;
+BOOL mIsDisposed;
 }
 // NSAccessibility Protocol
 -(id)accessibilityAttributeValue:(NSString *)attribute;
@@ -101,6 +102,7 @@ struct ReferenceWrapper
 -(NSWindow*)windowForParent;
 -(id)init;
 -(id)initWithAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) anAccessibleContext;
+-(void)setDisposed;
 -(void) setDefaults: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
 +(void)setPopupMenuOpen:(BOOL)popupMenuOpen;
 -(css::accessibility::XAccessibleAction *)accessibleAction;
diff --git a/vcl/osx/a11yactionwrapper.mm b/vcl/osx/a11yactionwrapper.mm
index 9bea25c11934..77d670c958b6 100644
--- a/vcl/osx/a11yactionwrapper.mm
+++ b/vcl/osx/a11yactionwrapper.mm
@@ -55,7 +55,10 @@
 NSMutableArray * actionNames = [ [ NSMutableArray alloc ] init ];
 if ( [ wrapper accessibleAction ] ) {
 for ( int cnt = 0; cnt < [ wrapper accessibleAction ] -> 
getAccessibleActionCount(); cnt++ ) {
-[ actionNames addObject: [ AquaA11yActionWrapper 
nativeActionNameFor: CreateNSString ( [ wrapper accessibleAction ] -> 
getAccessibleActionDescription ( cnt ) ) ] ];
+// Related tdf#158914: explicitly call autorelease selector
+// CreateNSString() is not a getter. It expects the caller to
+// release the returned string.
+[ actionNames addObject: [ AquaA11yActionWrapper 
nativeActionNameFor: [ CreateNSString ( [ wrapper accessibleAction ] -> 
getAccessibleActionDescription ( cnt ) ) autorelease ] ] ];
 }
 }
 return actionNames;
@@ -64,7 +67,10 @@
 +(void)doAction:(NSString *)action 

core.git: vcl/inc vcl/jsdialog

2024-05-01 Thread Tomaž Vajngerl (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |2 ++
 vcl/jsdialog/jsdialogbuilder.cxx |8 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 79b1a61303af8dc8716c03151b28bfce13162eb0
Author: Tomaž Vajngerl 
AuthorDate: Wed May 1 18:52:03 2024 +0900
Commit: Tomaž Vajngerl 
CommitDate: Thu May 2 07:47:49 2024 +0200

jsdialog: fix updating on container "reorder_child" or "move"

The accessibility checker sidebar did not update properly when
new issues were added or were removed. The accessiblity checker
is adding and removing new widget parts (one for each new issues)
to the grids, which is using "reorder_child" and "move" methods.
If we call "reorder_child" with update, it fails in online as it
doesn't find the parent "box" ("box_document" for example) because
the id is not set properly. Doing a full update on "reorder_child"
fixes the updating problem.

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

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 2c544146dfad..7491582e1550 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -544,6 +544,8 @@ class JSContainer final : public 
JSWidget
 public:
 JSContainer(JSDialogSender* pSender, vcl::Window* pContainer, 
SalInstanceBuilder* pBuilder,
 bool bTakeOwnership);
+
+void move(weld::Widget* pWidget, weld::Container* pNewParent) override;
 };
 
 class JSScrolledWindow final : public JSWidget
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index fa574088c7c6..cb9378f471f8 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1475,6 +1475,12 @@ JSContainer::JSContainer(JSDialogSender* pSender, 
vcl::Window* pContainer,
 {
 }
 
+void JSContainer::move(weld::Widget* pWidget, weld::Container* pNewParent)
+{
+SalInstanceContainer::move(pWidget, pNewParent);
+sendFullUpdate();
+}
+
 JSScrolledWindow::JSScrolledWindow(JSDialogSender* pSender, 
::VclScrolledWindow* pContainer,
SalInstanceBuilder* pBuilder, bool 
bTakeOwnership,
bool bUserManagedScrolling)
@@ -2340,7 +2346,7 @@ JSBox::JSBox(JSDialogSender* pSender, VclBox* pBox, 
SalInstanceBuilder* pBuilder
 void JSBox::reorder_child(weld::Widget* pWidget, int nNewPosition)
 {
 SalInstanceBox::reorder_child(pWidget, nNewPosition);
-sendUpdate();
+sendFullUpdate();
 }
 
 JSImage::JSImage(JSDialogSender* pSender, FixedImage* pImage, 
SalInstanceBuilder* pBuilder,


core.git: vcl/inc vcl/osx vcl/quartz vcl/source

2024-04-29 Thread Patrick Luby (via logerrit)
 vcl/inc/quartz/salgdi.h  |4 
 vcl/osx/salframe.cxx |2 +-
 vcl/quartz/salgdi.cxx|   13 +
 vcl/source/app/IconThemeSelector.cxx |4 ++--
 vcl/source/image/ImplImage.cxx   |9 -
 5 files changed, 28 insertions(+), 4 deletions(-)

New commits:
commit f4ef5435df5560e6b6b061ce4053c71e2819bf51
Author: Patrick Luby 
AuthorDate: Mon Apr 29 09:35:30 2024 -0400
Commit: Patrick Luby 
CommitDate: Tue Apr 30 01:24:29 2024 +0200

tdf#130678 draw SVG icons at Retina resolution on macOS

Also, change the default icon theme on macOS to SVG now that SVG icons
support Retina display resolution and the existing PNG icon themes do not.

Change-Id: I8c86c316b0db005661759c132ecf7e8667cf30bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166867
Reviewed-by: Patrick Luby 
Tested-by: Jenkins

diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index c8befcc50280..b7fb674f7553 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -473,6 +473,10 @@ public:
 GetTextLayout(int nFallbackLevel) override;
 virtual voidDrawTextLayout( const GenericSalLayout& ) override;
 
+#ifdef MACOSX
+virtual boolShouldDownscaleIconsAtSurface(double* pScaleOut) 
const override;
+#endif
+
 virtual SystemGraphicsData
 GetGraphicsData() const override;
 };
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index b02dbc59585e..940337b770a1 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -1390,7 +1390,7 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 StyleSettings aStyleSettings = rSettings.GetStyleSettings();
 
 bool bUseDarkMode(GetUseDarkMode());
-OUString sThemeName(!bUseDarkMode ? u"sukapura" : u"sukapura_dark");
+OUString sThemeName(!bUseDarkMode ? u"sukapura_svg" : 
u"sukapura_dark_svg");
 aStyleSettings.SetPreferredIconTheme(sThemeName, bUseDarkMode);
 
 Color aControlBackgroundColor(getNSBoxBackgroundColor([NSColor 
controlBackgroundColor]));
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index fd81f1a04512..8c9d3a6486dd 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -299,6 +299,19 @@ void AquaSalGraphics::DrawTextLayout(const 
GenericSalLayout& rLayout)
 mpBackend->drawTextLayout(rLayout);
 }
 
+#ifdef MACOSX
+
+bool AquaSalGraphics::ShouldDownscaleIconsAtSurface(double* pScaleOut) const
+{
+if (comphelper::LibreOfficeKit::isActive())
+return SalGraphics::ShouldDownscaleIconsAtSurface(pScaleOut);
+if (pScaleOut)
+*pScaleOut = sal::aqua::getWindowScaling();
+return true;
+}
+
+#endif
+
 void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout)
 {
 #ifdef IOS
diff --git a/vcl/source/app/IconThemeSelector.cxx 
b/vcl/source/app/IconThemeSelector.cxx
index eb79752beb47..ae3af74b3da2 100644
--- a/vcl/source/app/IconThemeSelector.cxx
+++ b/vcl/source/app/IconThemeSelector.cxx
@@ -79,9 +79,9 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const 
OUString& desktopEnvi
 }
 else if ( desktopEnvironment.equalsIgnoreAsciiCase("macosx") ) {
 if (!bPreferDarkIconTheme)
-r = "sukapura";
+r = "sukapura_svg";
 else
-r = "sukapura_dark";
+r = "sukapura_dark_svg";
 }
 else if ( desktopEnvironment.equalsIgnoreAsciiCase("gnome") ||
  desktopEnvironment.equalsIgnoreAsciiCase("mate") ||
diff --git a/vcl/source/image/ImplImage.cxx b/vcl/source/image/ImplImage.cxx
index cf70052a9fd7..f4b1cbba21a4 100644
--- a/vcl/source/image/ImplImage.cxx
+++ b/vcl/source/image/ImplImage.cxx
@@ -61,13 +61,20 @@ bool ImplImage::loadStockAtScale(SalGraphics* pGraphics, 
BitmapEx )
 sal_Int32 nScalePercentage = -1;
 
 double fScale(1.0);
+OUString aIconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
+#ifdef MACOSX
+if (aIconTheme.endsWith("_svg"))
+{
+#endif
 if (pGraphics && pGraphics->ShouldDownscaleIconsAtSurface()) // 
scale at the surface
 {
 nScalePercentage = fScale * 100.0;
 eScalingFlags = ImageLoadFlags::IgnoreScalingFactor;
 }
+#ifdef MACOSX
+}
+#endif
 
-OUString aIconTheme = 
Application::GetSettings().GetStyleSettings().DetermineIconTheme();
 if (!ImageTree::get().loadImage(maStockName, aIconTheme, aBitmapEx, true,
 nScalePercentage, eScalingFlags))
 {


core.git: vcl/inc

2024-04-13 Thread HakimOttey (via logerrit)
 vcl/inc/textlineinfo.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 7d38bdbf96c42d367dfa2cc7e2916c814aa08de2
Author: HakimOttey 
AuthorDate: Fri Apr 12 20:35:25 2024 -0400
Commit: Ilmari Lauhakangas 
CommitDate: Sat Apr 13 20:40:02 2024 +0200

tdf#143148 replace includes guards in vcl textlineinfo with pragma

Change-Id: I733263074a5c4911499a6b5becfbbc87cbda968d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166044
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/vcl/inc/textlineinfo.hxx b/vcl/inc/textlineinfo.hxx
index 0d5f4428920d..e2726e0a836b 100644
--- a/vcl/inc/textlineinfo.hxx
+++ b/vcl/inc/textlineinfo.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_TEXTLINEINFO_HXX
-#define INCLUDED_VCL_INC_TEXTLINEINFO_HXX
+#pragma once
 
 #include 
 
@@ -69,6 +68,4 @@ private:
 
 };
 
-#endif // INCLUDED_VCL_INC_TEXTLINEINFO_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/inc vcl/skia vcl/win

2024-04-11 Thread Mike Kaganski (via logerrit)
 vcl/inc/win/DWriteTextRenderer.hxx |8 ++---
 vcl/inc/win/salgdi.h   |7 +---
 vcl/skia/win/gdiimpl.cxx   |3 -
 vcl/win/gdi/DWriteTextRenderer.cxx |   31 ---
 vcl/win/gdi/salfont.cxx|3 -
 vcl/win/gdi/salgdi.cxx |   58 +
 6 files changed, 48 insertions(+), 62 deletions(-)

New commits:
commit 9bbecbaea359350c2e0d78ebe4dcd10d16dccbee
Author: Mike Kaganski 
AuthorDate: Wed Apr 10 14:01:53 2024 +0500
Commit: Mike Kaganski 
CommitDate: Thu Apr 11 12:51:50 2024 +0200

Use COMReference in D2DWriteTextOutRenderer

... and simplify the related code.

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

diff --git a/vcl/inc/win/DWriteTextRenderer.hxx 
b/vcl/inc/win/DWriteTextRenderer.hxx
index b822a6bca488..1cdf67d04a39 100644
--- a/vcl/inc/win/DWriteTextRenderer.hxx
+++ b/vcl/inc/win/DWriteTextRenderer.hxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 
 enum class D2DTextAntiAliasMode
@@ -37,7 +39,6 @@ class D2DWriteTextOutRenderer : public TextOutRenderer
 {
 public:
 explicit D2DWriteTextOutRenderer(bool bRenderingModeNatural);
-virtual ~D2DWriteTextOutRenderer() override;
 
 bool operator()(GenericSalLayout const ,
 SalGraphics ,
@@ -62,9 +63,8 @@ private:
 IDWriteFontFace* GetDWriteFace(const WinFontInstance& rWinFont, float * 
lfSize) const;
 bool performRender(GenericSalLayout const , SalGraphics 
, HDC hDC, bool& bRetry, bool bRenderingModeNatural);
 
-ID2D1Factory* mpD2DFactory;
-IDWriteFactory  * mpDWriteFactory;
-ID2D1DCRenderTarget * mpRT;
+sal::systools::COMReference mpD2DFactory;
+sal::systools::COMReference mpRT;
 const D2D1_RENDER_TARGET_PROPERTIES mRTProps;
 
 bool mbRenderingModeNatural;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 80fafdeba56f..19edee0f4440 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -166,10 +166,6 @@ private:
 RGNDATA*mpStdClipRgnData;   // Cache 
Standard-ClipRegion-Data
 int mnPenWidth; // line width
 
-inline static sal::systools::COMReference mxDWriteFactory;
-inline static sal::systools::COMReference 
mxDWriteGdiInterop;
-inline static bool bDWriteDone = false;
-
 // just call both from setHDC!
 void InitGraphics();
 void DeInitGraphics();
@@ -198,7 +194,8 @@ public:
 SCREEN
 };
 
-static void getDWriteFactory(IDWriteFactory** pFactory, 
IDWriteGdiInterop** pInterop = nullptr);
+static IDWriteFactory* getDWriteFactory();
+static IDWriteGdiInterop* getDWriteGdiInterop();
 
 public:
 
diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx
index 0451307b7bdf..1d48fb9bbe71 100644
--- a/vcl/skia/win/gdiimpl.cxx
+++ b/vcl/skia/win/gdiimpl.cxx
@@ -126,8 +126,7 @@ sk_sp
 WinSkiaSalGraphicsImpl::createDirectWriteTypeface(const WinFontInstance* 
pWinFont) try
 {
 using sal::systools::ThrowIfFailed;
-IDWriteFactory* dwriteFactory;
-WinSalGraphics::getDWriteFactory();
+IDWriteFactory* dwriteFactory = WinSalGraphics::getDWriteFactory();
 if (!dwriteDone)
 {
 dwriteFontMgr = SkFontMgr_New_DirectWrite(dwriteFactory);
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index c167c44c0110..e0a50c4ed981 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -62,8 +62,10 @@ D2DTextAntiAliasMode lclGetSystemTextAntiAliasMode()
 return eMode;
 }
 
-IDWriteRenderingParams* lclSetRenderingMode(IDWriteFactory* pDWriteFactory, 
DWRITE_RENDERING_MODE eRenderingMode)
+IDWriteRenderingParams* lclSetRenderingMode(DWRITE_RENDERING_MODE 
eRenderingMode)
 {
+IDWriteFactory* pDWriteFactory = WinSalGraphics::getDWriteFactory();
+
 IDWriteRenderingParams* pDefaultParameters = nullptr;
 pDWriteFactory->CreateRenderingParams();
 
@@ -118,22 +120,12 @@ D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool 
bRenderingModeNatural)
 mbRenderingModeNatural(bRenderingModeNatural),
 meTextAntiAliasMode(D2DTextAntiAliasMode::Default)
 {
-WinSalGraphics::getDWriteFactory();
-HRESULT hr = S_OK;
-hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, 
__uuidof(ID2D1Factory), nullptr, reinterpret_cast());
+HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, 
__uuidof(ID2D1Factory), nullptr, IID_PPV_ARGS_Helper());
 if (SUCCEEDED(hr))
 hr = CreateRenderTarget(bRenderingModeNatural);
 meTextAntiAliasMode = lclGetSystemTextAntiAliasMode();
 }
 
-D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
-{
-if (mpRT)
-mpRT->Release();
-if (mpD2DFactory)
-mpD2DFactory->Release();
-}
-
 void D2DWriteTextOutRenderer::applyTextAntiAliasMode(bool 

core.git: vcl/inc vcl/win

2024-04-07 Thread Mike Kaganski (via logerrit)
 vcl/inc/win/DWriteTextRenderer.hxx |   15 ---
 vcl/inc/win/winlayout.hxx  |2 --
 vcl/win/gdi/DWriteTextRenderer.cxx |   28 ++--
 vcl/win/gdi/winlayout.cxx  |8 
 4 files changed, 18 insertions(+), 35 deletions(-)

New commits:
commit 8557ea84c9336ba8061246f1f46ddb6e02f413a1
Author: Mike Kaganski 
AuthorDate: Mon Apr 8 02:45:28 2024 +0500
Commit: Mike Kaganski 
CommitDate: Mon Apr 8 07:12:18 2024 +0200

Exclude getHScale from DirectWrite font rendering

... and drop it, since it's unused now.
Unkike with Skia, where the ratio produces a visible effect, in
DirectWrite the effect seems cancelled by transformations. Yet,
it produced computational instability, noticable in small vertical
text.

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

diff --git a/vcl/inc/win/DWriteTextRenderer.hxx 
b/vcl/inc/win/DWriteTextRenderer.hxx
index d4bb45e5895b..b822a6bca488 100644
--- a/vcl/inc/win/DWriteTextRenderer.hxx
+++ b/vcl/inc/win/DWriteTextRenderer.hxx
@@ -71,19 +71,4 @@ private:
 D2DTextAntiAliasMode meTextAntiAliasMode;
 };
 
-/**
- * Sets and unsets the needed DirectWrite transform to support the font's 
horizontal scaling and
- * rotation.
- */
-class WinFontTransformGuard
-{
-public:
-WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, float fHScale, 
const GenericSalLayout& rLayout, const D2D1_POINT_2F& rBaseline, bool 
bIsVertical);
-~WinFontTransformGuard();
-
-private:
-ID2D1RenderTarget* mpRenderTarget;
-D2D1::Matrix3x2F maTransform;
-};
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index cfb36e825b54..31066a7db28a 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -36,8 +36,6 @@ class WinFontInstance : public LogicalFontInstance
 public:
 ~WinFontInstance() override;
 
-float getHScale() const;
-
 void SetGraphics(WinSalGraphics*);
 WinSalGraphics* GetGraphics() const { return m_pGraphics; }
 
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx 
b/vcl/win/gdi/DWriteTextRenderer.cxx
index bb0f7e6b7661..633dcf82b13b 100644
--- a/vcl/win/gdi/DWriteTextRenderer.cxx
+++ b/vcl/win/gdi/DWriteTextRenderer.cxx
@@ -93,6 +93,20 @@ HRESULT checkResult(HRESULT hr, const char* location)
 #endif
 
 
+// Sets and unsets the needed DirectWrite transform to support the font's 
rotation.
+class WinFontTransformGuard
+{
+public:
+WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget,
+  const GenericSalLayout& rLayout, const 
D2D1_POINT_2F& rBaseline,
+  bool bIsVertical);
+~WinFontTransformGuard();
+
+private:
+ID2D1RenderTarget* mpRenderTarget;
+D2D1::Matrix3x2F maTransform;
+};
+
 } // end anonymous namespace
 
 D2DWriteTextOutRenderer::D2DWriteTextOutRenderer(bool bRenderingModeNatural)
@@ -214,7 +228,6 @@ bool 
D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
 }
 
 const WinFontInstance& rWinFont = static_cast(rLayout.GetFont());
-float fHScale = rWinFont.getHScale();
 
 float lfEmHeight = 0;
 IDWriteFontFace* pFontFace = GetDWriteFace(rWinFont, );
@@ -247,11 +260,11 @@ bool 
D2DWriteTextOutRenderer::performRender(GenericSalLayout const & rLayout, Sa
 while (rLayout.GetNextGlyph(, aPos, nStart))
 {
 UINT16 glyphIndices[] = { static_cast(pGlyph->glyphId()) };
-FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) / 
fHScale };
+FLOAT glyphAdvances[] = { static_cast(pGlyph->newWidth()) };
 DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
-D2D1_POINT_2F baseline = { static_cast(aPos.getX() - 
bounds.Left()) / fHScale,
+D2D1_POINT_2F baseline = { static_cast(aPos.getX() - 
bounds.Left()),
static_cast(aPos.getY() - 
bounds.Top()) };
-WinFontTransformGuard aTransformGuard(mpRT, fHScale, rLayout, 
baseline, pGlyph->IsVertical());
+WinFontTransformGuard aTransformGuard(mpRT, rLayout, baseline, 
pGlyph->IsVertical());
 DWRITE_GLYPH_RUN glyphs = {
 pFontFace,
 lfEmHeight,
@@ -302,7 +315,7 @@ IDWriteFontFace* 
D2DWriteTextOutRenderer::GetDWriteFace(const WinFontInstance& r
 return pFontFace;
 }
 
-WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget, 
float fHScale,
+WinFontTransformGuard::WinFontTransformGuard(ID2D1RenderTarget* pRenderTarget,
  const GenericSalLayout& rLayout,
  const D2D1_POINT_2F& rBaseline,
  bool bIsVertical)
@@ -310,11 +323,6 @@ 

core.git: vcl/inc

2024-04-05 Thread Heikki Ilvesmäki (via logerrit)
 vcl/inc/skia/x11/gdiimpl.hxx|5 +
 vcl/inc/skia/x11/salvd.hxx  |5 +
 vcl/inc/skia/x11/textrender.hxx |5 +
 3 files changed, 3 insertions(+), 12 deletions(-)

New commits:
commit 2c724d88fef38a390744bbe1a4add031c6c62843
Author: Heikki Ilvesmäki 
AuthorDate: Fri Apr 5 20:23:33 2024 +0300
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Sat Apr 6 02:31:36 2024 +0200

tdf#143148 use pragma once instead of include guards

Change-Id: I87f971d5c5e61127025e66947f181d6012e20ecb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165825
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx
index f7198671b4d6..849e81d9858b 100644
--- a/vcl/inc/skia/x11/gdiimpl.hxx
+++ b/vcl/inc/skia/x11/gdiimpl.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
-#define INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
+#pragma once
 
 #include 
 
@@ -40,6 +39,4 @@ private:
 friend std::unique_ptr 
createVulkanWindowContext(bool);
 };
 
-#endif // INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx
index 137a58ae6790..9dc952350f7b 100644
--- a/vcl/inc/skia/x11/salvd.hxx
+++ b/vcl/inc/skia/x11/salvd.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_SKIA_X11_SALVD_H
-#define INCLUDED_VCL_INC_SKIA_X11_SALVD_H
+#pragma once
 
 #include 
 #include 
@@ -43,6 +42,4 @@ public:
 virtual bool SetSize(tools::Long nNewDX, tools::Long nNewDY) override;
 };
 
-#endif // INCLUDED_VCL_INC_SKIA_X11_SALVD_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/x11/textrender.hxx b/vcl/inc/skia/x11/textrender.hxx
index 623e229e8e33..aacd8a6c7b70 100644
--- a/vcl/inc/skia/x11/textrender.hxx
+++ b/vcl/inc/skia/x11/textrender.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX
-#define INCLUDED_VCL_INC_SKIA_TEXTRENDER_HXX
+#pragma once
 
 #include 
 
@@ -34,6 +33,4 @@ private:
 static inline sk_sp fontManager;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/inc

2024-04-01 Thread Stephan Bergmann (via logerrit)
 vcl/inc/impgraph.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0ef2073ac560fcfab102d5363c1cc017694d6abc
Author: Stephan Bergmann 
AuthorDate: Mon Apr 1 21:16:14 2024 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Apr 2 07:28:13 2024 +0200

Fix UBSan RTTI needs

...vcl_graphic_test now failed with

> DynamicLibraryManagerException: "Failed to load dynamic library: 
workdir/LinkTarget/CppunitTest/libtest_vcl_graphic_test.so
> workdir/LinkTarget/CppunitTest/libtest_vcl_graphic_test.so: undefined 
symbol: _ZTI10ImpGraphic"

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

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 23d482aded23..fd6446e1972a 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -57,7 +57,7 @@ enum class GraphicContentType : sal_Int32
 Vector
 };
 
-class ImpGraphic final  : public vcl::graphic::MemoryManaged
+class SAL_DLLPUBLIC_RTTI ImpGraphic final  : public vcl::graphic::MemoryManaged
 {
 friend class Graphic;
 friend class GraphicID;


core.git: vcl/inc vcl/win

2024-03-28 Thread Mike Kaganski (via logerrit)
 vcl/inc/win/winlayout.hxx |1 -
 vcl/win/gdi/winlayout.cxx |   14 ++
 2 files changed, 2 insertions(+), 13 deletions(-)

New commits:
commit ff7a6711277bda28711cc92540fbd62ebaaf8db7
Author: Mike Kaganski 
AuthorDate: Thu Mar 28 19:52:00 2024 +0500
Commit: Mike Kaganski 
CommitDate: Fri Mar 29 04:17:12 2024 +0100

Simplify and drop unused method

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

diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index e1d66a0e1ab2..cfb36e825b54 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -36,7 +36,6 @@ class WinFontInstance : public LogicalFontInstance
 public:
 ~WinFontInstance() override;
 
-bool hasHScale() const;
 float getHScale() const;
 
 void SetGraphics(WinSalGraphics*);
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index eb5c740580c5..19eaae2ecee7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -146,22 +146,12 @@ WinFontInstance::~WinFontInstance()
 ::DeleteFont(m_hFont);
 }
 
-bool WinFontInstance::hasHScale() const
-{
-const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern();
-int nHeight(rPattern.mnHeight);
-int nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : 
nHeight);
-return nWidth != nHeight;
-}
-
 float WinFontInstance::getHScale() const
 {
 const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern();
-int nHeight(rPattern.mnHeight);
-if (!nHeight)
+if (!rPattern.mnHeight || !rPattern.mnWidth)
 return 1.0;
-float nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() 
: nHeight);
-return nWidth / nHeight;
+return rPattern.mnWidth * GetAverageWidthFactor() / rPattern.mnHeight;
 }
 
 void WinFontInstance::ImplInitHbFont(hb_font_t* /*pHbFont*/)


core.git: vcl/inc vcl/unx

2024-03-25 Thread Stephan Bergmann (via logerrit)
 vcl/inc/unx/i18n_cb.hxx |2 +-
 vcl/unx/generic/app/i18n_cb.cxx |4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 24aed4f9a5f6351d9153c96e3d1d1aa68028c0d0
Author: Stephan Bergmann 
AuthorDate: Mon Mar 25 18:54:05 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Mar 25 23:34:33 2024 +0100

Avoid -Werror,-Wcast-function-type-mismatch, remove unused int return

> vcl/unx/generic/app/i18n_ic.cxx:225:51: error: cast from 'int (*)(XIC, 
XPointer, XPointer)' (aka 'int (*)(_XIC *, char *, char *)') to 'XIMProc' (aka 
'void (*)(_XIM *, char *, char *)') converts to incompatible function type 
[-Werror,-Wcast-function-type-mismatch]
>   225 | maPreeditStartCallback.callback = 
reinterpret_cast(PreeditStartCallback);
>   |   
^~~

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

diff --git a/vcl/inc/unx/i18n_cb.hxx b/vcl/inc/unx/i18n_cb.hxx
index 4b498f387820..497875236c5d 100644
--- a/vcl/inc/unx/i18n_cb.hxx
+++ b/vcl/inc/unx/i18n_cb.hxx
@@ -28,7 +28,7 @@ extern "C" {
 
 // xim callbacks
 void PreeditDoneCallback ( XIC ic, XPointer client_data, XPointer call_data);
-int  PreeditStartCallback( XIC ic, XPointer client_data, XPointer call_data);
+void PreeditStartCallback( XIC ic, XPointer client_data, XPointer call_data);
 void PreeditDrawCallback ( XIC ic, XPointer client_data,
XIMPreeditDrawCallbackStruct *call_data );
 void PreeditCaretCallback( XIC ic, XPointer client_data,
diff --git a/vcl/unx/generic/app/i18n_cb.cxx b/vcl/unx/generic/app/i18n_cb.cxx
index c17c01a4d225..d4efcf34fd55 100644
--- a/vcl/unx/generic/app/i18n_cb.cxx
+++ b/vcl/unx/generic/app/i18n_cb.cxx
@@ -34,7 +34,7 @@
 
 // i. preedit start callback
 
-int
+void
 PreeditStartCallback ( XIC, XPointer client_data, XPointer )
 {
 preedit_data_t* pPreeditData = 
reinterpret_cast(client_data);
@@ -43,8 +43,6 @@ PreeditStartCallback ( XIC, XPointer client_data, XPointer )
 pPreeditData->eState = PreeditStatus::Active;
 pPreeditData->aText.nLength= 0;
 }
-
-return -1;
 }
 
 // ii. preedit done callback


core.git: vcl/inc vcl/source

2024-03-22 Thread Tomaž Vajngerl (via logerrit)
 vcl/inc/impgraph.hxx|3 +--
 vcl/source/gdi/graph.cxx|6 ++
 vcl/source/gdi/impgraph.cxx |   13 -
 3 files changed, 7 insertions(+), 15 deletions(-)

New commits:
commit e83f7b7c84d5345879c5543b78ce6ad2b32dc2bc
Author: Tomaž Vajngerl 
AuthorDate: Sun Mar 17 23:23:41 2024 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Mar 23 03:06:18 2024 +0100

vcl: set "default" type only thorugh a ImpGraphic constructor

and do some more clean-up.

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

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 9ef10d19061d..707810b9de2e 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -89,7 +89,7 @@ private:
 bool mbPrepared = false;
 
 public:
-ImpGraphic();
+ImpGraphic(bool bDefault = false);
 ImpGraphic( const ImpGraphic& rImpGraphic );
 ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept;
 ImpGraphic( GraphicExternalLink aExternalLink);
@@ -133,7 +133,6 @@ private:
 voidclear();
 
 GraphicType getType() const { return meType;}
-voidsetDefaultType();
 boolisSupportedGraphic() const;
 
 boolisTransparent() const;
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index 4c0efa56beba..252ee189b892 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -287,8 +287,7 @@ bool Graphic::IsNone() const
 
 void Graphic::Clear()
 {
-ImplTestRefCount();
-mxImpGraphic->clear();
+mxImpGraphic = std::make_shared();
 }
 
 GraphicType Graphic::GetType() const
@@ -298,8 +297,7 @@ GraphicType Graphic::GetType() const
 
 void Graphic::SetDefaultType()
 {
-ImplTestRefCount();
-mxImpGraphic->setDefaultType();
+mxImpGraphic = std::make_shared(true);
 }
 
 bool Graphic::IsSupportedGraphic() const
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 2c9f03f3a02e..ceb6c111cf7b 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -81,7 +81,8 @@ SvStream* ImpGraphic::getSwapFileStream() const
 return nullptr;
 }
 
-ImpGraphic::ImpGraphic()
+ImpGraphic::ImpGraphic(bool bDefault)
+: meType(bDefault ? GraphicType::Default : GraphicType::NONE)
 {
 }
 
@@ -149,7 +150,7 @@ ImpGraphic::ImpGraphic(GraphicExternalLink 
aGraphicExternalLink)
 
 ImpGraphic::ImpGraphic(const BitmapEx& rBitmapEx)
 : maBitmapEx(rBitmapEx)
-, meType(!rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE)
+, meType(rBitmapEx.IsEmpty() ? GraphicType::NONE : GraphicType::Bitmap)
 {
 }
 
@@ -408,15 +409,9 @@ void ImpGraphic::clear()
 maGraphicExternalLink.msURL.clear();
 }
 
-void ImpGraphic::setDefaultType()
-{
-clear();
-meType = GraphicType::Default;
-}
-
 bool ImpGraphic::isSupportedGraphic() const
 {
-return( meType != GraphicType::NONE );
+return meType != GraphicType::NONE;
 }
 
 bool ImpGraphic::isTransparent() const


core.git: vcl/inc vcl/qa

2024-03-22 Thread Tomaž Vajngerl (via logerrit)
 vcl/inc/bitmap/ScanlineTools.hxx |   56 ---
 vcl/qa/cppunit/ScanlineToolsTest.cxx |   42 --
 2 files changed, 98 deletions(-)

New commits:
commit bbfe52997225a2fb387c94462c867d670954b9b4
Author: Tomaž Vajngerl 
AuthorDate: Wed Mar 13 14:51:47 2024 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Mar 22 07:37:52 2024 +0100

vcl: remove 4-bit scanline transformer

We don't use 4-bit bitmap anymore and haven't for a long time.

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

diff --git a/vcl/inc/bitmap/ScanlineTools.hxx b/vcl/inc/bitmap/ScanlineTools.hxx
index 99ce5dc33aae..1b7db0eadffc 100644
--- a/vcl/inc/bitmap/ScanlineTools.hxx
+++ b/vcl/inc/bitmap/ScanlineTools.hxx
@@ -110,60 +110,6 @@ public:
 }
 };
 
-class ScanlineTransformer_4BitPalette final : public ScanlineTransformer
-{
-private:
-sal_uInt8* pData;
-const BitmapPalette& mrPalette;
-sal_uInt32 mnX;
-sal_uInt32 mnShift;
-
-public:
-explicit ScanlineTransformer_4BitPalette(const BitmapPalette& rPalette)
-: pData(nullptr)
-, mrPalette(rPalette)
-, mnX(0)
-, mnShift(0)
-{
-}
-
-virtual void skipPixel(sal_uInt32 nPixel) override
-{
-mnX += nPixel;
-if (nPixel & 1) // is nPixel an odd number
-mnShift ^= 4;
-}
-
-virtual void startLine(sal_uInt8* pLine) override
-{
-pData = pLine;
-mnX = 0;
-mnShift = 4;
-}
-
-virtual Color readPixel() override
-{
-const sal_uInt32 nDataIndex = mnX / 2;
-const sal_uInt8 nIndex((pData[nDataIndex] >> mnShift) & 0x0f);
-mnX++;
-mnShift ^= 4;
-
-if (nIndex < mrPalette.GetEntryCount())
-return mrPalette[nIndex];
-else
-return COL_BLACK;
-}
-
-virtual void writePixel(Color nColor) override
-{
-const sal_uInt32 nDataIndex = mnX / 2;
-const sal_uInt8 nColorIndex = mrPalette.GetBestIndex(nColor);
-pData[nDataIndex] |= (nColorIndex & 0x0f) << mnShift;
-mnX++;
-mnShift ^= 4;
-}
-};
-
 class ScanlineTransformer_1BitPalette final : public ScanlineTransformer
 {
 private:
@@ -215,8 +161,6 @@ std::unique_ptr 
getScanlineTransformer(sal_uInt16 nBits,
 {
 case 1:
 return std::make_unique(rPalette);
-case 4:
-return std::make_unique(rPalette);
 case 8:
 return std::make_unique(rPalette);
 case 24:
diff --git a/vcl/qa/cppunit/ScanlineToolsTest.cxx 
b/vcl/qa/cppunit/ScanlineToolsTest.cxx
index 97233f2692af..afb44a54f005 100644
--- a/vcl/qa/cppunit/ScanlineToolsTest.cxx
+++ b/vcl/qa/cppunit/ScanlineToolsTest.cxx
@@ -20,14 +20,12 @@ class ScanlineToolsTest : public CppUnit::TestFixture
 void ScanlineTransformer_32_ARGB();
 void ScanlineTransformer_24_BGR();
 void ScanlineTransformer_8bit_Palette();
-void ScanlineTransformer_4bit_Palette();
 void ScanlineTransformer_1bit_Palette();
 
 CPPUNIT_TEST_SUITE(ScanlineToolsTest);
 CPPUNIT_TEST(ScanlineTransformer_32_ARGB);
 CPPUNIT_TEST(ScanlineTransformer_24_BGR);
 CPPUNIT_TEST(ScanlineTransformer_8bit_Palette);
-CPPUNIT_TEST(ScanlineTransformer_4bit_Palette);
 CPPUNIT_TEST(ScanlineTransformer_1bit_Palette);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -129,46 +127,6 @@ void ScanlineToolsTest::ScanlineTransformer_8bit_Palette()
 }
 }
 
-void ScanlineToolsTest::ScanlineTransformer_4bit_Palette()
-{
-std::vector aColors{
-Color(10, 250, 120), Color(30, 230, 110), Color(50, 210, 100),
-Color(70, 190, 90),  Color(90, 170, 80),  Color(110, 150, 70),
-};
-
-BitmapPalette aPalette(16);
-for (size_t i = 0; i < aColors.size(); ++i)
-{
-aPalette[i] = aColors[i];
-}
-
-std::unique_ptr pScanlineTransformer
-= vcl::bitmap::getScanlineTransformer(4, aPalette);
-
-std::vector aScanLine(3, 0); // 6 * 0.5 BytesPerPixel
-pScanlineTransformer->startLine(aScanLine.data());
-
-for (Color const& aColor : aColors)
-{
-pScanlineTransformer->writePixel(aColor);
-}
-
-std::vector aExpectedBytes{ 0x01, 0x23, 0x45 };
-
-for (size_t i = 0; i < aScanLine.size(); ++i)
-{
-CPPUNIT_ASSERT_EQUAL(int(aExpectedBytes[i]), int(aScanLine[i]));
-}
-
-pScanlineTransformer->startLine(aScanLine.data());
-
-for (Color const& rColor : aColors)
-{
-Color aColor = pScanlineTransformer->readPixel();
-CPPUNIT_ASSERT_EQUAL(rColor, aColor);
-}
-}
-
 void ScanlineToolsTest::ScanlineTransformer_1bit_Palette()
 {
 std::vector aColors{


core.git: vcl/inc vcl/source

2024-03-21 Thread Tomaž Vajngerl (via logerrit)
 vcl/inc/impgraph.hxx|   13 +++---
 vcl/source/gdi/impgraph.cxx |   92 +---
 2 files changed, 35 insertions(+), 70 deletions(-)

New commits:
commit 4dd52211794adc7da2c19cb3defcdef16985c278
Author: Tomaž Vajngerl 
AuthorDate: Tue Mar 12 12:07:33 2024 +0900
Commit: Tomaž Vajngerl 
CommitDate: Fri Mar 22 05:50:07 2024 +0100

vcl: simplify constructors of ImpGraphic

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

diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx
index 15d68d00157c..9ef10d19061d 100644
--- a/vcl/inc/impgraph.hxx
+++ b/vcl/inc/impgraph.hxx
@@ -73,19 +73,20 @@ private:
 std::shared_ptr mpContext;
 std::shared_ptr mpSwapFile;
 std::shared_ptr mpGfxLink;
-GraphicType  meType;
-mutable sal_uLongmnSizeBytes;
-bool mbSwapOut;
-bool mbDummyContext;
 std::shared_ptr maVectorGraphicData;
+
+GraphicType  meType = GraphicType::NONE;
+mutable sal_uLongmnSizeBytes = 0;
+bool mbSwapOut = false;
+bool mbDummyContext = false;
 // cache checksum computation
 mutable BitmapChecksum   mnChecksum = 0;
 
 std::optional mxGraphicID;
 GraphicExternalLink  maGraphicExternalLink;
 
-std::chrono::high_resolution_clock::time_point maLastUsed;
-bool mbPrepared;
+mutable std::chrono::high_resolution_clock::time_point maLastUsed = 
std::chrono::high_resolution_clock::now();
+bool mbPrepared = false;
 
 public:
 ImpGraphic();
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 7150aab6b0e6..2c9f03f3a02e 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -81,13 +81,7 @@ SvStream* ImpGraphic::getSwapFileStream() const
 return nullptr;
 }
 
-ImpGraphic::ImpGraphic() :
-meType  ( GraphicType::NONE ),
-mnSizeBytes ( 0 ),
-mbSwapOut   ( false ),
-mbDummyContext  ( false ),
-maLastUsed (std::chrono::high_resolution_clock::now()),
-mbPrepared  ( false )
+ImpGraphic::ImpGraphic()
 {
 }
 
@@ -98,18 +92,18 @@ ImpGraphic::ImpGraphic(const ImpGraphic& rImpGraphic)
 , mpContext(rImpGraphic.mpContext)
 , mpSwapFile(rImpGraphic.mpSwapFile)
 , mpGfxLink(rImpGraphic.mpGfxLink)
+, maVectorGraphicData(rImpGraphic.maVectorGraphicData)
 , meType(rImpGraphic.meType)
 , mnSizeBytes(rImpGraphic.mnSizeBytes)
 , mbSwapOut(rImpGraphic.mbSwapOut)
 , mbDummyContext(rImpGraphic.mbDummyContext)
-, maVectorGraphicData(rImpGraphic.maVectorGraphicData)
 , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink)
-, maLastUsed (std::chrono::high_resolution_clock::now())
-, mbPrepared (rImpGraphic.mbPrepared)
+, mbPrepared(rImpGraphic.mbPrepared)
 {
-if( rImpGraphic.mpAnimation )
+// Special case for animations
+if (rImpGraphic.mpAnimation)
 {
-mpAnimation = std::make_unique( *rImpGraphic.mpAnimation );
+mpAnimation = std::make_unique(*rImpGraphic.mpAnimation);
 maBitmapEx = mpAnimation->GetBitmapEx();
 }
 }
@@ -122,13 +116,12 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept
 , mpContext(std::move(rImpGraphic.mpContext))
 , mpSwapFile(std::move(rImpGraphic.mpSwapFile))
 , mpGfxLink(std::move(rImpGraphic.mpGfxLink))
+, maVectorGraphicData(std::move(rImpGraphic.maVectorGraphicData))
 , meType(rImpGraphic.meType)
 , mnSizeBytes(rImpGraphic.mnSizeBytes)
 , mbSwapOut(rImpGraphic.mbSwapOut)
 , mbDummyContext(rImpGraphic.mbDummyContext)
-, maVectorGraphicData(std::move(rImpGraphic.maVectorGraphicData))
 , maGraphicExternalLink(rImpGraphic.maGraphicExternalLink)
-, maLastUsed (std::chrono::high_resolution_clock::now())
 , mbPrepared (rImpGraphic.mbPrepared)
 {
 rImpGraphic.clear();
@@ -138,11 +131,7 @@ ImpGraphic::ImpGraphic(ImpGraphic&& rImpGraphic) noexcept
 ImpGraphic::ImpGraphic(std::shared_ptr xGfxLink, sal_Int32 nPageIndex)
 : mpGfxLink(std::move(xGfxLink))
 , meType(GraphicType::Bitmap)
-, mnSizeBytes(0)
 , mbSwapOut(true)
-, mbDummyContext(false)
-, maLastUsed (std::chrono::high_resolution_clock::now())
-, mbPrepared (false)
 {
 maSwapInfo.mbIsTransparent = true;
 maSwapInfo.mbIsAlpha = true;
@@ -152,59 +141,34 @@ ImpGraphic::ImpGraphic(std::shared_ptr xGfxLink, 
sal_Int32 nPageIndex)
 maSwapInfo.mnPageIndex = nPageIndex;
 }
 
-ImpGraphic::ImpGraphic(GraphicExternalLink aGraphicExternalLink) :
-meType  ( GraphicType::Default ),
-mnSizeBytes ( 0 ),
-mbSwapOut   ( false ),
-mbDummyContext  ( false ),
-

core.git: vcl/inc vcl/jsdialog

2024-03-20 Thread Jaume Pujantell (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |1 +
 vcl/jsdialog/jsdialogbuilder.cxx |6 ++
 2 files changed, 7 insertions(+)

New commits:
commit d94288a6f26a6f0d58901732c562dfad861ec4c5
Author: Jaume Pujantell 
AuthorDate: Mon Mar 18 15:40:20 2024 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 20 15:41:08 2024 +0100

jsdialog: send update on spin button range change

On Online, on the Table Properties dialog, when changing mesures from
absolute to relative, the browser whould complain about values being
out range since it still expected absolute values.

Change-Id: I2a3ae844b4f4f874ea2140dec313794a87d9f2cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164973
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Miklos Vajna 
(cherry picked from commit c3227d33ef18f090d858e93e9dc516db25995ebe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164998
Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 315b8605582f..34fdb7a068d5 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -659,6 +659,7 @@ public:
  bool bTakeOwnership);
 
 virtual void set_value(sal_Int64 value) override;
+virtual void set_range(sal_Int64 min, sal_Int64 max) override;
 };
 
 class JSFormattedSpinButton final
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 08a3f53b6059..1f56bda71bba 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -1746,6 +1746,12 @@ void JSSpinButton::set_value(sal_Int64 value)
 sendAction(std::move(pMap));
 }
 
+void JSSpinButton::set_range(sal_Int64 min, sal_Int64 max)
+{
+SalInstanceSpinButton::set_range(min, max);
+sendUpdate();
+}
+
 JSFormattedSpinButton::JSFormattedSpinButton(JSDialogSender* pSender, 
::FormattedField* pSpin,
  SalInstanceBuilder* pBuilder, 
bool bTakeOwnership)
 : JSWidget(pSender, 
pSpin, pBuilder,


core.git: vcl/inc vcl/jsdialog

2024-03-04 Thread Noel Grandin (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |   19 ++--
 vcl/jsdialog/jsdialogbuilder.cxx |  156 ---
 2 files changed, 81 insertions(+), 94 deletions(-)

New commits:
commit 81d4f14e5968453b72ba754a7b3e6c13a30abbf4
Author: Noel Grandin 
AuthorDate: Mon Mar 4 19:15:43 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Mar 5 07:21:51 2024 +0100

reduce heap allocation in JSDialogNotifyIdle

makes the code simpler too

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

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index e24ff1589655..315b8605582f 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -125,16 +125,15 @@ public:
  std::unique_ptr pData = nullptr);
 
 private:
-void send(tools::JsonWriter& aJsonWriter);
-std::unique_ptr generateFullUpdate() const;
-std::unique_ptr 
generateWidgetUpdate(VclPtr pWindow) const;
-std::unique_ptr generateCloseMessage() const;
-std::unique_ptr
-generateActionMessage(VclPtr pWindow,
-  std::unique_ptr pData) 
const;
-std::unique_ptr
-generatePopupMessage(VclPtr pWindow, OUString sParentId, 
OUString sCloseId) const;
-std::unique_ptr generateClosePopupMessage(OUString 
sWindowId) const;
+void send(const OString& sMsg);
+OString generateFullUpdate() const;
+OString generateWidgetUpdate(VclPtr pWindow) const;
+OString generateCloseMessage() const;
+OString generateActionMessage(VclPtr pWindow,
+  std::unique_ptr 
pData) const;
+OString generatePopupMessage(VclPtr pWindow, OUString 
sParentId,
+ OUString sCloseId) const;
+OString generateClosePopupMessage(OUString sWindowId) const;
 };
 
 class JSDialogSender
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index a7199e2ed960..38b3a9e2922d 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -81,31 +81,22 @@ JSDialogNotifyIdle::JSDialogNotifyIdle(VclPtr 
aNotifierWindow,
 
 void JSDialogNotifyIdle::forceUpdate() { m_bForce = true; }
 
-void JSDialogNotifyIdle::send(tools::JsonWriter& aJsonWriter)
+void JSDialogNotifyIdle::send(const OString& sMsg)
 {
 if (!m_aNotifierWindow)
 {
-aJsonWriter.finishAndGetAsOString();
 return;
 }
 
 const vcl::ILibreOfficeKitNotifier* pNotifier = 
m_aNotifierWindow->GetLOKNotifier();
 if (pNotifier)
 {
-if (m_bForce || !aJsonWriter.isDataEquals(m_LastNotificationMessage))
+if (m_bForce || sMsg != m_LastNotificationMessage)
 {
 m_bForce = false;
-m_LastNotificationMessage = aJsonWriter.finishAndGetAsOString();
+m_LastNotificationMessage = sMsg;
 pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, 
m_LastNotificationMessage);
 }
-else
-{
-aJsonWriter.finishAndGetAsOString();
-}
-}
-else
-{
-aJsonWriter.finishAndGetAsOString();
 }
 }
 
@@ -139,91 +130,89 @@ void 
JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType,
 m_aMessageQueue.push_back(aMessage);
 }
 
-std::unique_ptr JSDialogNotifyIdle::generateFullUpdate() 
const
+OString JSDialogNotifyIdle::generateFullUpdate() const
 {
-std::unique_ptr aJsonWriter(new tools::JsonWriter());
-
 if (!m_aContentWindow || !m_aNotifierWindow)
-return aJsonWriter;
+return OString();
 
-m_aContentWindow->DumpAsPropertyTree(*aJsonWriter);
+tools::JsonWriter aJsonWriter;
+
+m_aContentWindow->DumpAsPropertyTree(aJsonWriter);
 if (m_aNotifierWindow)
-aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
-aJsonWriter->put("jsontype", m_sTypeOfJSON);
+aJsonWriter.put("id", m_aNotifierWindow->GetLOKWindowId());
+aJsonWriter.put("jsontype", m_sTypeOfJSON);
 
-return aJsonWriter;
+return aJsonWriter.finishAndGetAsOString();
 }
 
-std::unique_ptr
-JSDialogNotifyIdle::generateWidgetUpdate(VclPtr pWindow) const
+OString JSDialogNotifyIdle::generateWidgetUpdate(VclPtr pWindow) 
const
 {
-std::unique_ptr aJsonWriter(new tools::JsonWriter());
-
 if (!pWindow || !m_aNotifierWindow)
-return aJsonWriter;
+return OString();
 
-aJsonWriter->put("jsontype", m_sTypeOfJSON);
-aJsonWriter->put("action", "update");
+tools::JsonWriter aJsonWriter;
+
+aJsonWriter.put("jsontype", m_sTypeOfJSON);
+aJsonWriter.put("action", "update");
 if (m_aNotifierWindow)
-aJsonWriter->put("id", m_aNotifierWindow->GetLOKWindowId());
+aJsonWriter.put("id", m_aNotifierWindow->GetLOKWindowId());
 {
-auto aEntries = aJsonWriter->startNode("control");
-

core.git: vcl/inc vcl/qt5

2024-02-29 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtAccessibleWidget.hxx |   12 +
 vcl/qt5/QtAccessibleWidget.cxx |   77 +
 2 files changed, 89 insertions(+)

New commits:
commit 1b6963cda0a209548249dd43c5c1fa705ef32bcd
Author: Michael Weghorn 
AuthorDate: Thu Feb 29 10:20:42 2024 +0100
Commit: Michael Weghorn 
CommitDate: Thu Feb 29 12:34:37 2024 +0100

tdf#158030 qt a11y: Implement new QAccessibleAttributesInterface

Implement the new `QAccessibleAttributesInterface`
just added upstream to Qt in qtbase commit [1]

commit fb5ffe862688a87cfc136113e067bcba0c49a7ae
Author: Michael Weghorn 
AuthorDate: Fri Nov 10 18:25:02 2023 +0100
Commit: Volker Hilsheimer 
CommitDate: Thu Feb 29 04:44:22 2024 +

a11y: Add new QAccessibleAttributesInterface

, see also QTBUG-119057. [2]
This API is available with Qt >= 6.8.

That interface makes it possible to report
object attributes that are bridged to the platform a11y
layers.
Use it to bridge the attributes retrieved from
the `XAccessibleExtendedAttributes` UNO interface.

Together with the pending upstream qtbase change that
implements the AT-SPI bridge for Linux [3], the "level"
AT-SPI object attribute for headings in Writer
is correctly reported to AT-SPI, making the
Orca screen reader announce "Heading level N" as expected.

For now, map not explicitly handled attributes
as key-value pairs to Qt via the special
`QAccessible::Attribute::Custom` attribute,
which causes them to be mapped to AT-SPI unchanged, and
can e.g. be used for testing the tdf#158030 scenario.

For common attributes - like those specified in the
Core Accessibility API Mappings specification [4] -
suggesting to add new enum values to the
`QAccessible::Attribute` enum to upstream Qt
and using those instead should be considered for the future.

Related commit for gtk4:

commit 3aca2d9776a871f15009a1aa70628ba3a03ee147
Author: Michael Weghorn 
Date:   Thu Nov 9 15:31:57 2023 +0100

gtk4 a11y: Handle the "level" object attribute

[1] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=fb5ffe862688a87cfc136113e067bcba0c49a7ae
[2] https://bugreports.qt.io/browse/QTBUG-119057
[3] https://codereview.qt-project.org/c/qt/qtbase/+/517526
[4] https://www.w3.org/TR/core-aam-1.2/

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

diff --git a/vcl/inc/qt5/QtAccessibleWidget.hxx 
b/vcl/inc/qt5/QtAccessibleWidget.hxx
index 8d71ecd0ea77..46d7be26582d 100644
--- a/vcl/inc/qt5/QtAccessibleWidget.hxx
+++ b/vcl/inc/qt5/QtAccessibleWidget.hxx
@@ -38,6 +38,9 @@ class QtWidget;
 
 class QtAccessibleWidget final : public QAccessibleInterface,
  public QAccessibleActionInterface,
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+ public QAccessibleAttributesInterface,
+#endif
  public QAccessibleTextInterface,
  public QAccessibleEditableTextInterface,
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
@@ -85,6 +88,15 @@ public:
 void doAction(const QString& actionName) override;
 QStringList keyBindingsForAction(const QString& actionName) const override;
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+// helper method for QAccessibleAttributesInterface
+QHash attributes() const;
+
+// QAccessibleAttributesInterface
+QList attributeKeys() const override;
+QVariant attributeValue(QAccessible::Attribute key) const override;
+#endif
+
 // QAccessibleTextInterface
 void addSelection(int startOffset, int endOffset) override;
 QString attributes(int offset, int* startOffset, int* endOffset) const 
override;
diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx
index 7eadc3313834..790e200929b1 100644
--- a/vcl/qt5/QtAccessibleWidget.cxx
+++ b/vcl/qt5/QtAccessibleWidget.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -741,6 +742,10 @@ void* 
QtAccessibleWidget::interface_cast(QAccessible::InterfaceType t)
 #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
 if (t == QAccessible::SelectionInterface && 
accessibleProvidesInterface())
 return static_cast(this);
+#endif
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+if (t == QAccessible::AttributesInterface)
+return static_cast(this);
 #endif
 return nullptr;
 }
@@ -855,6 +860,78 @@ QStringList QtAccessibleWidget::keyBindingsForAction(const 
QString& actionName)
 return keyBindings;
 }
 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
+
+// QAccessibleAttributesInterface helpers
+namespace
+{
+void lcl_insertAttribute(QHash& 

core.git: vcl/inc xmloff/source

2024-02-25 Thread anish.deshpande (via logerrit)
 vcl/inc/skia/gdiimpl.hxx |5 +
 vcl/inc/skia/salbmp.hxx  |5 +
 vcl/inc/strhelper.hxx|5 +
 vcl/inc/strings.hxx  |5 +
 xmloff/source/chart/ColorPropertySet.hxx |6 ++
 5 files changed, 6 insertions(+), 20 deletions(-)

New commits:
commit 3d8e32a195203e4b540274b9024ced2bc364afb0
Author: anish.deshpande 
AuthorDate: Thu Feb 22 14:56:47 2024 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Mon Feb 26 06:45:07 2024 +0100

tdf#143148 Use pragma once instead of include guards in vcl and xmloff

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

diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
index b879872a8bca..71f5cce8aae6 100644
--- a/vcl/inc/skia/gdiimpl.hxx
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SKIA_GDIIMPL_HXX
-#define INCLUDED_VCL_SKIA_GDIIMPL_HXX
+#pragma once
 
 #include 
 
@@ -436,6 +435,4 @@ inline SkPaint 
SkiaSalGraphicsImpl::makePixelPaint(std::optional color) c
 return paint;
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index c42aa30f4654..639436346d61 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_SKIA_SALBMP_H
-#define INCLUDED_VCL_INC_SKIA_SALBMP_H
+#pragma once
 
 #include 
 #include 
@@ -226,6 +225,4 @@ private:
 #endif
 };
 
-#endif // INCLUDED_VCL_INC_SKIA_SALBMP_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/strhelper.hxx b/vcl/inc/strhelper.hxx
index 7793418334e1..e8f085864139 100644
--- a/vcl/inc/strhelper.hxx
+++ b/vcl/inc/strhelper.hxx
@@ -16,8 +16,7 @@
  *   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_STRHELPER_HXX
-#define INCLUDED_VCL_STRHELPER_HXX
+#pragma once
 
 #include 
 #include 
@@ -49,6 +48,4 @@ namespace psp
 
 } // namespace
 
-#endif // INCLUDED_VCL_STRHELPER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/strings.hxx b/vcl/inc/strings.hxx
index 45e9b2af4310..b4cf785ffc49 100644
--- a/vcl/inc/strings.hxx
+++ b/vcl/inc/strings.hxx
@@ -7,11 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_STRINGS_HXX
-#define INCLUDED_VCL_INC_STRINGS_HXX
+#pragma once
 
 #define SV_APP_VCLBACKEND "VCL: "
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/xmloff/source/chart/ColorPropertySet.hxx 
b/xmloff/source/chart/ColorPropertySet.hxx
index d73bf48be0d9..e623c39afde8 100644
--- a/xmloff/source/chart/ColorPropertySet.hxx
+++ b/xmloff/source/chart/ColorPropertySet.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef XMLOFF_COLORPROPERTYSET_HXX
-#define XMLOFF_COLORPROPERTYSET_HXX
+
+#pragma once
 
 #include 
 #include 
@@ -76,7 +76,5 @@ private:
 
 } //  namespace xmloff::chart
 
-// XMLOFF_COLORPROPERTYSET_HXX
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/inc

2024-02-22 Thread AhmedHamed (via logerrit)
 vcl/inc/slider.hxx |5 +
 vcl/inc/spin.hxx   |5 +
 2 files changed, 2 insertions(+), 8 deletions(-)

New commits:
commit 23056ce647654d57b63cb48a30488d35fcd26c7f
Author: AhmedHamed 
AuthorDate: Thu Feb 22 18:52:49 2024 +0200
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Fri Feb 23 03:25:52 2024 +0100

tdf#143148 Use pragma once instead of include guards

Change-Id: I5ea12f17e35e4eb3dd36781fd31664caaef17e50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163785
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/slider.hxx b/vcl/inc/slider.hxx
index 73a0dc0a2008..c1a1e808af9f 100644
--- a/vcl/inc/slider.hxx
+++ b/vcl/inc/slider.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SLIDER_HXX
-#define INCLUDED_VCL_SLIDER_HXX
+#pragma once
 
 #include 
 
@@ -96,6 +95,4 @@ public:
 voidSetSlideHdl( const Link& rLink ) { 
maSlideHdl = rLink; }
 };
 
-#endif // INCLUDED_VCL_SLIDER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/spin.hxx b/vcl/inc/spin.hxx
index 7b7fbe11bd40..7278b0293697 100644
--- a/vcl/inc/spin.hxx
+++ b/vcl/inc/spin.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_SPIN_HXX
-#define INCLUDED_VCL_INC_SPIN_HXX
+#pragma once
 
 #include 
 
@@ -38,6 +37,4 @@ void ImplDrawUpDownButtons(vcl::RenderContext& rRenderContext,
bool bHorz, bool bMirrorHorz = false);
 
 
-#endif // INCLUDED_VCL_INC_SPIN_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/inc

2024-02-21 Thread Stephan Bergmann (via logerrit)
 vcl/inc/canvasbitmap.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit cfc4a2cfd15760b1fc536c95c3570d916727c31b
Author: Stephan Bergmann 
AuthorDate: Wed Feb 21 11:23:43 2024 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Feb 21 14:41:16 2024 +0100

Fix UBSan build's RTTI needs

...after 3ba92b5f1eaf7d4447a0943ea260db515ca799dc "hide more symbols" had 
caused
CppunitTest_vcl_text to fail with

> DynamicLibraryManagerException: "Failed to load dynamic library: 
/home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/LinkTarget/CppunitTest/libtest_vcl_text.so
> 
/home/tdf/lode/jenkins/workspace/lo_ubsan/workdir/LinkTarget/CppunitTest/libtest_vcl_text.so:
 undefined symbol: _ZTIN3vcl8unotools15VclCanvasBitmapE"
> Path (length: 252) is 
'/home/tdf/lode/opt/bin:/etc/alternatives/java_sdk_11/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/home/tdf/.local/bin:/home/tdf/bin:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/etc/alternatives/java_sdk_17/bin'

()

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

diff --git a/vcl/inc/canvasbitmap.hxx b/vcl/inc/canvasbitmap.hxx
index 16f283c038a2..d6ac581e0aff 100644
--- a/vcl/inc/canvasbitmap.hxx
+++ b/vcl/inc/canvasbitmap.hxx
@@ -30,7 +30,7 @@
 
 namespace vcl::unotools
 {
-class VclCanvasBitmap final :
+class SAL_DLLPUBLIC_RTTI VclCanvasBitmap final :
 public cppu::WeakImplHelper< css::rendering::XIntegerReadOnlyBitmap,
  css::rendering::XBitmapPalette,
  css::rendering::XIntegerBitmapColorSpace >


core.git: vcl/inc vcl/osx

2024-02-19 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salnsmenu.h |8 ++--
 vcl/osx/salmenu.cxx |9 +++--
 vcl/osx/salnsmenu.mm|   26 +++---
 3 files changed, 16 insertions(+), 27 deletions(-)

New commits:
commit 64ca3756416f0355b2008f39120e68ac42269784
Author: Patrick Luby 
AuthorDate: Mon Feb 19 15:11:56 2024 -0500
Commit: Patrick Luby 
CommitDate: Mon Feb 19 22:07:49 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

While commit 4f907fbe52749265ba4eb7c40ed187b453bb1de9 fixed
tdf#126638, it caused the "disallowed action" beep.

Some modal windows, such as the native Open and Save dialogs,
return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
the main menu's -[NSMenu performKeyEquivalent:] is then called
so we can catch and redirect any modal window's key shortcut
events without triggering the modal window's "disallowed
action" beep.

Change-Id: Ib1fff68ab159361ceb847881e3a4da4736a33f51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163605
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 64b65e2c95bd..9e0f9acf68ed 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -50,14 +50,10 @@ class AquaSalMenuItem;
 - (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem;
 @end
 
-@interface SalNSMainMenuDelegate : NSObject
+@interface SalNSMainMenu : NSMenu
 {
 }
-- (id)init;
-- (BOOL)menuHasKeyEquivalent:(NSMenu*)pMenu
-forEvent:(NSEvent*)pEvent
-  target:(id*)pTarget
-  action:(SEL*)pAction;
+- (BOOL)performKeyEquivalent:(NSEvent*)pEvent;
 @end
 
 #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index 7685a1b9e1bc..6ea16a6588ae 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -113,7 +113,6 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = nullptr;
 
 // FIXME: currently this is leaked
 static MainMenuSelector* pMainMenuSelector = nil;
-static SalNSMainMenuDelegate* pMainMenuDelegate = nil;
 
 static void initAppMenu()
 {
@@ -126,7 +125,9 @@ static void initAppMenu()
 NSMenu* pAppMenu = nil;
 NSMenuItem* pNewItem = nil;
 
-NSMenu* pMainMenu = [[[NSMenu alloc] initWithTitle: @"Main Menu"] 
autorelease];
+// Related: tdf#126638 use NSMenu subclass to catch and redirect key
+// shortcuts when a modal window is displayed
+SalNSMainMenu* pMainMenu = [[[SalNSMainMenu alloc] initWithTitle: @"Main 
Menu"] autorelease];
 pNewItem = [pMainMenu addItemWithTitle: @"Application"
 action: nil
 keyEquivalent: @""];
@@ -135,10 +136,6 @@ static void initAppMenu()
 [NSApp setMainMenu: pMainMenu];
 
 pMainMenuSelector = [[MainMenuSelector alloc] init];
-pMainMenuDelegate = [[SalNSMainMenuDelegate alloc] init];
-
-// tdf#126638 set a special delegate for the main menu
-[pMainMenu setDelegate: reinterpret_cast< id 
>(pMainMenuDelegate)];
 
 // about
 NSString* pString = CreateNSString(VclResId(SV_STDTEXT_ABOUT));
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index 0659e412db1a..31627a35ea87 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -317,27 +317,23 @@ SAL_WNODEPRECATED_DECLARATIONS_POP
 }
 @end
 
-@implementation SalNSMainMenuDelegate
+@implementation SalNSMainMenu
 
--(id)init
+- (BOOL)performKeyEquivalent:(NSEvent*)pEvent
 {
-return [super init];
-}
-
--(BOOL)menuHasKeyEquivalent: (NSMenu*)pMenu forEvent: (NSEvent*)pEvent target: 
(id*)pTarget action: (SEL*)pAction
-{
-assert( pMenu == [NSApp mainMenu] );
+BOOL bRet = [super performKeyEquivalent: pEvent];
 
 // tdf#126638 dispatch key shortcut events to modal windows
 // Some modal windows, such as the native Open and Save dialogs,
-// ignore any key shortcut events so use the same existing special
-// dispatching code that -[VCL_NSApplication sendEvent:] uses to
-// dispatch key shortcuts to non-modal, non-LibreOffice windows.
-if( [NSApp modalWindow] )
-[SalNSMenu dispatchSpecialKeyEquivalents: pEvent];
+// return NO from -[NSWindow performKeyEquivalent:]. Fortunately,
+// the main menu's -[NSMenu performKeyEquivalent:] is then called
+// so we can catch and redirect any modal window's key shortcut
+// events without triggering the modal window's "disallowed
+// action" beep.
+if( !bRet && [NSApp modalWindow] )
+bRet = [SalNSMenu dispatchSpecialKeyEquivalents: pEvent];
 
-// Always return NO since the target and action are not set
-return NO;
+return bRet;
 }
 
 @end


core.git: vcl/inc vcl/osx

2024-02-18 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salnsmenu.h |   14 +++-
 vcl/osx/salmenu.cxx |   14 +++-
 vcl/osx/salnsmenu.mm|   84 
 vcl/osx/vclnsapp.mm |   49 ++--
 4 files changed, 121 insertions(+), 40 deletions(-)

New commits:
commit 4f907fbe52749265ba4eb7c40ed187b453bb1de9
Author: Patrick Luby 
AuthorDate: Sat Feb 17 10:33:08 2024 -0500
Commit: Patrick Luby 
CommitDate: Sun Feb 18 13:38:15 2024 +0100

tdf#126638 dispatch key shortcut events to modal windows

Some modal windows, such as the native Open and Save dialogs,
ignore any key shortcut events so use the same existing special
dispatching code that -[VCL_NSApplication sendEvent:] uses to
dispatch key shortcuts to non-modal, non-LibreOffice windows.

Also, disable all menu items when displaying modal windows. For
some unknown reason, key shortcuts are dispatched to the main
menu instead of the modal window so enable the "autoenabledItems"
property instances so that -[SalNSMenuItem validateMenuItem:]
will be called before handling a key shortcut and the menu item
can be temporarily disabled if a modal window is displayed.

Change-Id: I6c06024dd6ed05a4ee83f2b37e29c555b52ef555
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163527
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salnsmenu.h b/vcl/inc/osx/salnsmenu.h
index 696abca2fc0b..64b65e2c95bd 100644
--- a/vcl/inc/osx/salnsmenu.h
+++ b/vcl/inc/osx/salnsmenu.h
@@ -35,17 +35,29 @@ class AquaSalMenuItem;
 {
 AquaSalMenu* mpMenu;
 }
++ (BOOL)dispatchSpecialKeyEquivalents:(NSEvent*)pEvent;
 - (id)initWithMenu:(AquaSalMenu*)pMenu;
 - (void)menuNeedsUpdate:(NSMenu*)pMenu;
 - (void)setSalMenu:(AquaSalMenu*)pMenu;
 @end
 
-@interface SalNSMenuItem : NSMenuItem
+@interface SalNSMenuItem : NSMenuItem 
 {
 AquaSalMenuItem* mpMenuItem;
 }
 - (id)initWithMenuItem:(AquaSalMenuItem*)pMenuItem;
 - (void)menuItemTriggered:(id)aSender;
+- (BOOL)validateMenuItem:(NSMenuItem*)pMenuItem;
+@end
+
+@interface SalNSMainMenuDelegate : NSObject
+{
+}
+- (id)init;
+- (BOOL)menuHasKeyEquivalent:(NSMenu*)pMenu
+forEvent:(NSEvent*)pEvent
+  target:(id*)pTarget
+  action:(SEL*)pAction;
 @end
 
 #endif // INCLUDED_VCL_INC_OSX_SALNSMENU_H
diff --git a/vcl/osx/salmenu.cxx b/vcl/osx/salmenu.cxx
index b3d02587f46b..7685a1b9e1bc 100644
--- a/vcl/osx/salmenu.cxx
+++ b/vcl/osx/salmenu.cxx
@@ -113,6 +113,7 @@ const AquaSalMenu* AquaSalMenu::pCurrentMenuBar = nullptr;
 
 // FIXME: currently this is leaked
 static MainMenuSelector* pMainMenuSelector = nil;
+static SalNSMainMenuDelegate* pMainMenuDelegate = nil;
 
 static void initAppMenu()
 {
@@ -134,6 +135,10 @@ static void initAppMenu()
 [NSApp setMainMenu: pMainMenu];
 
 pMainMenuSelector = [[MainMenuSelector alloc] init];
+pMainMenuDelegate = [[SalNSMainMenuDelegate alloc] init];
+
+// tdf#126638 set a special delegate for the main menu
+[pMainMenu setDelegate: reinterpret_cast< id 
>(pMainMenuDelegate)];
 
 // about
 NSString* pString = CreateNSString(VclResId(SV_STDTEXT_ABOUT));
@@ -230,12 +235,19 @@ AquaSalMenu::AquaSalMenu( bool bMenuBar ) :
 {
 mpMenu = [[SalNSMenu alloc] initWithMenu: this];
 [mpMenu setDelegate: reinterpret_cast< id >(mpMenu)];
+
+// Related: tdf#126638 enable the menu's "autoenabledItems" property
+// Enable the menu's "autoenabledItems" property so that
+// -[SalNSMenuItem validateMenuItem:] will be called before handling
+// a key shortcut and the menu item can be temporarily disabled if a
+// modal window is displayed.
+[mpMenu setAutoenablesItems: YES];
 }
 else
 {
 mpMenu = [NSApp mainMenu];
+[mpMenu setAutoenablesItems: NO];
 }
-[mpMenu setAutoenablesItems: NO];
 }
 
 AquaSalMenu::~AquaSalMenu()
diff --git a/vcl/osx/salnsmenu.mm b/vcl/osx/salnsmenu.mm
index b2df2da7e5f5..0659e412db1a 100644
--- a/vcl/osx/salnsmenu.mm
+++ b/vcl/osx/salnsmenu.mm
@@ -30,6 +30,53 @@
 #include 
 
 @implementation SalNSMenu
+
++(BOOL)dispatchSpecialKeyEquivalents: (NSEvent*)pEvent
+{
+if( pEvent && [pEvent type] == NSEventTypeKeyDown )
+{
+unsigned int nModMask = ([pEvent modifierFlags] & 
(NSEventModifierFlagShift|NSEventModifierFlagControl|NSEventModifierFlagOption|NSEventModifierFlagCommand));
+if( nModMask == NSEventModifierFlagCommand )
+{
+if( [[pEvent charactersIgnoringModifiers] isEqualToString: @"v"] )
+{
+if( [NSApp sendAction: @selector(paste:) to: nil from: nil] )
+return YES;
+}
+else if( [[pEvent charactersIgnoringModifiers] isEqualToString: 
@"c"] )
+{
+if( [NSApp sendAction: @selector(copy:) to: nil from: nil] )
+return YES;
+

core.git: vcl/inc

2024-02-13 Thread Steven Casey (SMCode) (via logerrit)
 vcl/inc/BitmapSymmetryCheck.hxx  |5 +
 vcl/inc/ControlCacheKey.hxx  |5 +
 vcl/inc/DropdownBox.hxx  |5 +
 vcl/inc/FileDefinitionWidgetDraw.hxx |5 +
 vcl/inc/IPrioritable.hxx |5 +
 vcl/inc/IconThemeScanner.hxx |5 +
 vcl/inc/IconThemeSelector.hxx|5 +
 vcl/inc/ResampleKernel.hxx   |5 +
 vcl/inc/SalGradient.hxx  |5 +
 9 files changed, 9 insertions(+), 36 deletions(-)

New commits:
commit 6e0b4b9b9f5aeadf0deb4879b706fec50eb6135f
Author: Steven Casey (SMCode) 
AuthorDate: Mon Feb 12 19:08:09 2024 -0800
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Tue Feb 13 14:04:55 2024 +0100

tdf#143148 Use pragma instead of include guards

Change-Id: I0541d79dc8ddb79d433109d18aa658ff31dc7e0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163268
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/BitmapSymmetryCheck.hxx b/vcl/inc/BitmapSymmetryCheck.hxx
index 917b8b6d13a1..f23a7832d277 100644
--- a/vcl/inc/BitmapSymmetryCheck.hxx
+++ b/vcl/inc/BitmapSymmetryCheck.hxx
@@ -8,8 +8,7 @@
  *
  */
 
-#ifndef INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX
-#define INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX
+#pragma once
 
 #include 
 
@@ -26,6 +25,4 @@ private:
 static bool checkImpl(BitmapReadAccess const* pReadAccess);
 };
 
-#endif // INCLUDED_VCL_INC_BITMAPSYMMETRYCHECK_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ControlCacheKey.hxx b/vcl/inc/ControlCacheKey.hxx
index e422004ca58e..40155f80b61d 100644
--- a/vcl/inc/ControlCacheKey.hxx
+++ b/vcl/inc/ControlCacheKey.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX
-#define INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX
+#pragma once
 
 #include 
 #include 
@@ -90,5 +89,3 @@ struct ControlCacheHashFunction
 return seed;
 }
 };
-
-#endif // INCLUDED_VCL_INC_CONTROLCACHEKEY_HXX
diff --git a/vcl/inc/DropdownBox.hxx b/vcl/inc/DropdownBox.hxx
index a6530babcaa1..0e3c3e315561 100644
--- a/vcl/inc/DropdownBox.hxx
+++ b/vcl/inc/DropdownBox.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX
-#define INCLUDED_SFX2_NOTEBOOKBAR_DROPDOWNBOX_HXX
+#pragma once
 
 #include 
 #include "IPrioritable.hxx"
@@ -46,6 +45,4 @@ private:
 DECL_LINK(PBClickHdl, Button*, void);
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/FileDefinitionWidgetDraw.hxx 
b/vcl/inc/FileDefinitionWidgetDraw.hxx
index 881316c2f4a2..e7ada5fdfb86 100644
--- a/vcl/inc/FileDefinitionWidgetDraw.hxx
+++ b/vcl/inc/FileDefinitionWidgetDraw.hxx
@@ -8,8 +8,7 @@
  *
  */
 
-#ifndef INCLUDED_VCL_INC_FILEDEFINITIONWIDGETDRAW_HXX
-#define INCLUDED_VCL_INC_FILEDEFINITIONWIDGETDRAW_HXX
+#pragma once
 
 #include "widgetdraw/WidgetDefinition.hxx"
 #include "salgdi.hxx"
@@ -77,6 +76,4 @@ public:
 
 } // end vcl namespace
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/IPrioritable.hxx b/vcl/inc/IPrioritable.hxx
index 559fbc982f74..0b8dec9ec095 100644
--- a/vcl/inc/IPrioritable.hxx
+++ b/vcl/inc/IPrioritable.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_IPRIORITABLE_HXX
-#define INCLUDED_VCL_IPRIORITABLE_HXX
+#pragma once
 
 #include 
 
@@ -49,6 +48,4 @@ private:
 
 } // namespace vcl
 
-#endif // INCLUDED_VCL_IPRIORITABLE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/inc/IconThemeScanner.hxx b/vcl/inc/IconThemeScanner.hxx
index 80f24054799f..e95adf417fdd 100644
--- a/vcl/inc/IconThemeScanner.hxx
+++ b/vcl/inc/IconThemeScanner.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_ICONTHEMESCANNER_HXX
-#define INCLUDED_VCL_ICONTHEMESCANNER_HXX
+#pragma once
 
 #include 
 
@@ -81,6 +80,4 @@ private:
 
 } // end namespace vcl
 
-#endif // INCLUDED_VCL_ICONTHEMESCANNER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/IconThemeSelector.hxx b/vcl/inc/IconThemeSelector.hxx
index 65bfdf006364..dd1952a1518e 100644
--- a/vcl/inc/IconThemeSelector.hxx
+++ b/vcl/inc/IconThemeSelector.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_ICONTHEMESELECTOR_HXX
-#define INCLUDED_VCL_ICONTHEMESELECTOR_HXX
+#pragma once
 
 #include 
 
@@ -93,6 +92,4 @@ private:
 
 } /* namespace vcl */
 
-#endif // INCLUDED_VCL_ICONTHEMESELECTOR_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/ResampleKernel.hxx b/vcl/inc/ResampleKernel.hxx
index ca54213f5449..c891edbaa168 100644
--- a/vcl/inc/ResampleKernel.hxx
+++ 

core.git: vcl/inc

2024-02-12 Thread Szymon Kłos (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 199b8ef1dffd3ef46b2319d9992c83ab47ccea05
Author: Szymon Kłos 
AuthorDate: Mon Feb 12 22:11:25 2024 +0100
Commit: Szymon Kłos 
CommitDate: Tue Feb 13 08:14:52 2024 +0100

jsdialog: use action for set_sensitive

This will reduce protocol volume as we will send short
message instead of JSON for the complete widget.

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

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index e4fdd266851a..e24ff1589655 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -422,7 +422,12 @@ public:
 bool bIsSensitive = BaseInstanceClass::get_sensitive();
 BaseInstanceClass::set_sensitive(sensitive);
 if (bIsSensitive != sensitive)
-sendUpdate();
+{
+std::unique_ptr pMap
+= std::make_unique();
+(*pMap)[ACTION_TYPE ""_ostr] = (sensitive ? u"enable" : 
u"disable");
+sendAction(std::move(pMap));
+}
 }
 
 virtual css::uno::Reference 
get_drop_target() override


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

2024-02-10 Thread Mike Kaganski (via logerrit)
 vcl/inc/impdel.hxx   |6 
 vcl/source/window/window.cxx |4 ++
 vcl/win/window/salframe.cxx  |   59 ++-
 3 files changed, 46 insertions(+), 23 deletions(-)

New commits:
commit a2dd71feb75d93adf0f0daac899e7476f961ec34
Author: Mike Kaganski 
AuthorDate: Sat Feb 10 20:01:05 2024 +0600
Commit: Mike Kaganski 
CommitDate: Sat Feb 10 16:58:11 2024 +0100

tdf#54169: implement auto-accelerator feature on Windows

Change-Id: I219dfc0c8377628c10e5a19232d19260923bf614
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163215
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 

diff --git a/vcl/inc/impdel.hxx b/vcl/inc/impdel.hxx
index b387c34a0974..3b9dbb60a45e 100644
--- a/vcl/inc/impdel.hxx
+++ b/vcl/inc/impdel.hxx
@@ -57,6 +57,12 @@ class DeletionListener
if( m_pNotifier )
m_pNotifier->addDel( this );
}
+DeletionListener(const DeletionListener& rOther)
+:  m_pNotifier(rOther.m_pNotifier)
+   {
+   if (m_pNotifier)
+   m_pNotifier->addDel(this);
+   }
~DeletionListener()
{
if( m_pNotifier )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 85454316acdf..ec3adaca4674 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1808,15 +1808,17 @@ void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) 
const
 
 void Window::KeyInput( const KeyEvent& rKEvt )
 {
+#ifndef _WIN32 // On Windows, dialogs react to accelerators  without Alt 
(tdf#157649)
 KeyCode cod = rKEvt.GetKeyCode ();
-bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
 
 // do not respond to accelerators unless Alt or Ctrl is held
 if (cod.GetCode () >= 0x200 && cod.GetCode () <= 0x219)
 {
+bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
 if (autoacc && cod.GetModifier () != KEY_MOD2 && !(cod.GetModifier() & 
KEY_MOD1))
 return;
 }
+#endif
 
 NotifyEvent aNEvt( NotifyEventType::KEYINPUT, this,  );
 if ( !CompatNotify( aNEvt ) )
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index ed8f7fddee7a..313ae0ffcf2d 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -301,6 +301,15 @@ static void UpdateDarkMode(HWND hWnd)
 DwmSetWindowAttribute(hWnd, 20, , sizeof(bDarkMode));
 }
 
+static void UpdateAutoAccel()
+{
+BOOL bUnderline = FALSE;
+SystemParametersInfoW(SPI_GETKEYBOARDCUES, 0, , 0);
+
+ImplSVData* pSVData = ImplGetSVData();
+pSVData->maNWFData.mbAutoAccel = !bUnderline;
+}
+
 SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
   HWND hWndParent, SalFrameStyleFlags 
nSalFrameStyle )
 {
@@ -3578,7 +3587,7 @@ static bool HandleAltNumPadCode(HWND hWnd, UINT nMsg, 
WPARAM wParam, LPARAM lPar
 if (!(keyFlags & KF_REPEAT))
 state.clear();
 state.started = true;
-return true;
+return false; // This must be processed further - e.g., to 
show accelerators
 }
 
 if (!state.started)
@@ -3637,8 +3646,6 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 static WPARAM   nDeadChar   = 0;
 static WPARAM   nLastVKChar = 0;
 static sal_uInt16   nLastChar   = 0;
-static ModKeyFlags  nLastModKeyCode = ModKeyFlags::NONE;
-static bool bWaitForModKeyRelease = false;
 sal_uInt16  nRepeat = LOWORD( lParam );
 if (nRepeat)
 --nRepeat;
@@ -3774,14 +3781,11 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 // MCD, 2003-01-13, Support for WM_UNICHAR & Keyman 6.0; addition ends
 else
 {
+static ModKeyFlags nLastModKeyCode = ModKeyFlags::NONE;
+
 // for shift, control and menu we issue a KeyModChange event
 if ( (wParam == VK_SHIFT) || (wParam == VK_CONTROL) || (wParam == 
VK_MENU) )
 {
-SalKeyModEvent aModEvt;
-aModEvt.mbDown = false; // auto-accelerator feature not supported 
here.
-aModEvt.mnCode = nModCode;
-aModEvt.mnModKeyCode = ModKeyFlags::NONE;   // no command events 
will be sent if this member is 0
-
 ModKeyFlags tmpCode = ModKeyFlags::NONE;
 if( GetKeyState( VK_LSHIFT )  & 0x8000 )
 tmpCode |= ModKeyFlags::LeftShift;
@@ -3796,22 +3800,16 @@ static bool ImplHandleKeyMsg( HWND hWnd, UINT nMsg,
 if( GetKeyState( VK_RMENU )  & 0x8000 )
 tmpCode |= ModKeyFlags::RightMod2;
 
-if( tmpCode < nLastModKeyCode )
+if (tmpCode != nLastModKeyCode)
 {
-aModEvt.mnModKeyCode = nLastModKeyCode;
-nLastModKeyCode = ModKeyFlags::NONE;
-bWaitForModKeyRelease = true;
+SalKeyModEvent aModEvt;
+aModEvt.mbDown = nMsg == WM_KEYDOWN || nMsg 

core.git: vcl/inc

2024-02-05 Thread Tuukka Orava (via logerrit)
 vcl/inc/graphic/GraphicFormatDetector.hxx |5 +
 vcl/inc/graphic/Manager.hxx   |5 +
 vcl/inc/graphic/UnoGraphic.hxx|5 +
 vcl/inc/graphic/UnoGraphicDescriptor.hxx  |5 +
 4 files changed, 4 insertions(+), 16 deletions(-)

New commits:
commit ef6212158d8308d60d3edb6c87117958758436e2
Author: Tuukka Orava 
AuthorDate: Mon Feb 5 13:13:56 2024 +0200
Commit: Ilmari Lauhakangas 
CommitDate: Mon Feb 5 18:28:26 2024 +0100

tdf#143148 Use pragma once in vcl/inc/graphic

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

diff --git a/vcl/inc/graphic/GraphicFormatDetector.hxx 
b/vcl/inc/graphic/GraphicFormatDetector.hxx
index d6791e377fc1..24ffcab18b7a 100644
--- a/vcl/inc/graphic/GraphicFormatDetector.hxx
+++ b/vcl/inc/graphic/GraphicFormatDetector.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX
-#define INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX
+#pragma once
 
 #include 
 #include 
@@ -203,6 +202,4 @@ private:
 };
 }
 
-#endif // INCLUDED_VCL_INC_GRAPHICFORMATDETECTOR_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/graphic/Manager.hxx b/vcl/inc/graphic/Manager.hxx
index 65e92146491c..d239f6a8b01d 100644
--- a/vcl/inc/graphic/Manager.hxx
+++ b/vcl/inc/graphic/Manager.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX
-#define INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX
+#pragma once
 
 #include 
 #include 
@@ -76,6 +75,4 @@ public:
 
 } // end namespace vcl::graphic
 
-#endif // INCLUDED_VCL_INC_GRAPHIC_MANAGER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/graphic/UnoGraphic.hxx b/vcl/inc/graphic/UnoGraphic.hxx
index ce060c98f40c..94fcb361dcd1 100644
--- a/vcl/inc/graphic/UnoGraphic.hxx
+++ b/vcl/inc/graphic/UnoGraphic.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX
-#define INCLUDED_VCL_SOURCE_GRAPHIC_GRAPHIC_HXX
+#pragma once
 
 #include 
 #include 
@@ -84,6 +83,4 @@ private:
 
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/graphic/UnoGraphicDescriptor.hxx 
b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
index 2adc19dac059..3631c504fa92 100644
--- a/vcl/inc/graphic/UnoGraphicDescriptor.hxx
+++ b/vcl/inc/graphic/UnoGraphicDescriptor.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX
-#define INCLUDED_VCL_SOURCE_GRAPHIC_DESCRIPTOR_HXX
+#pragma once
 
 #include 
 #include 
@@ -114,6 +113,4 @@ private:
 
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/inc vcl/source

2024-02-05 Thread Noel Grandin (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx|4 ++
 vcl/source/gdi/pdfwriter_impl.cxx |   62 +++---
 2 files changed, 36 insertions(+), 30 deletions(-)

New commits:
commit ffb6133176d5bc1824b15893b2cf1a80aea6aa02
Author: Noel Grandin 
AuthorDate: Thu Feb 1 15:47:33 2024 +0200
Commit: Noel Grandin 
CommitDate: Mon Feb 5 15:41:27 2024 +0100

tdf#108037 speed up exporting large pdf (2)

reduce the number of allocations we need to do for OStringBuffer

Shaves 2% off the convert time.

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index 090f3e090c35..483201f624fd 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -824,6 +824,10 @@ private:
 
 ::comphelper::Hash  m_DocDigest;
 
+// reduce repeated allocations
+OStringBuffer   updateGraphicsStateLine{256};
+OStringBuffer   drawBitmapLine{80};
+
 sal_uInt64 getCurrentFilePosition()
 {
 sal_uInt64 nPosition{};
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 3a86641ae9fb..11a62a156bb0 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9795,35 +9795,36 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, 
bool bIsTrueColor, const
 
 void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& 
rDestSize, const BitmapEmit& rBitmap, const Color& rFillColor )
 {
-OStringBuffer aLine( 80 );
+OStringBuffer& rLine = drawBitmapLine;
+rLine.setLength(0);
 updateGraphicsState();
 
-aLine.append( "q " );
+rLine.append( "q " );
 if( rFillColor != COL_TRANSPARENT )
 {
-appendNonStrokingColor( rFillColor, aLine );
-aLine.append( ' ' );
+appendNonStrokingColor( rFillColor, rLine );
+rLine.append( ' ' );
 }
 sal_Int32 nCheckWidth = 0;
-m_aPages.back().appendMappedLength( 
static_cast(rDestSize.Width()), aLine, false,  );
-aLine.append( " 0 0 " );
+m_aPages.back().appendMappedLength( 
static_cast(rDestSize.Width()), rLine, false,  );
+rLine.append( " 0 0 " );
 sal_Int32 nCheckHeight = 0;
-m_aPages.back().appendMappedLength( 
static_cast(rDestSize.Height()), aLine, true,  );
-aLine.append( ' ' );
-m_aPages.back().appendPoint( rDestPoint + Point( 0, rDestSize.Height()-1 
), aLine );
-aLine.append( " cm
/Im" );
+m_aPages.back().appendMappedLength( 
static_cast(rDestSize.Height()), rLine, true,  );
+rLine.append( ' ' );
+m_aPages.back().appendPoint( rDestPoint + Point( 0, rDestSize.Height()-1 
), rLine );
+rLine.append( " cm
/Im" );
 sal_Int32 nObject = rBitmap.m_aReferenceXObject.getObject();
-aLine.append(nObject);
-aLine.append( " Do Q
" );
+rLine.append(nObject);
+rLine.append( " Do Q
" );
 if( nCheckWidth == 0 || nCheckHeight == 0 )
 {
 // #i97512# avoid invalid current matrix
-aLine.setLength( 0 );
-aLine.append( "
%bitmap image /Im" );
-aLine.append( rBitmap.m_nObject );
-aLine.append( " scaled to zero size, omitted
" );
+rLine.setLength( 0 );
+rLine.append( "
%bitmap image /Im" );
+rLine.append( rBitmap.m_nObject );
+rLine.append( " scaled to zero size, omitted
" );
 }
-writeBuffer( aLine );
+writeBuffer( rLine );
 }
 
 const BitmapEmit& PDFWriterImpl::createBitmapEmit(const BitmapEx& i_rBitmap, 
const Graphic& rGraphic, std::list& rBitmaps, ResourceDict& 
rResourceDict, std::list& rOutputStreams)
@@ -10145,9 +10146,10 @@ void PDFWriterImpl::drawWallpaper( const 
tools::Rectangle& rRect, const Wallpape
 }
 }
 
-void PDFWriterImpl::updateGraphicsState(Mode const mode)
+ void PDFWriterImpl::updateGraphicsState(Mode const mode)
 {
-OStringBuffer aLine( 256 );
+OStringBuffer& rLine = updateGraphicsStateLine;
+rLine.setLength(0);
 GraphicsState& rNewState = m_aGraphicsStack.front();
 // first set clip region since it might invalidate everything else
 
@@ -10160,7 +10162,7 @@ void PDFWriterImpl::updateGraphicsState(Mode const mode)
 {
 if( m_aCurrentPDFState.m_bClipRegion )
 {
-aLine.append( "Q " );
+rLine.append( "Q " );
 // invalidate everything but the clip region
 m_aCurrentPDFState = GraphicsState();
 rNewState.m_nUpdateFlags = 
~GraphicsStateUpdateFlags::ClipRegion;
@@ -10173,19 +10175,19 @@ void PDFWriterImpl::updateGraphicsState(Mode const 
mode)
 SetMapMode( rNewState.m_aMapMode );
 m_aCurrentPDFState.m_aMapMode = rNewState.m_aMapMode;
 
-aLine.append("q ");
+

core.git: vcl/inc vcl/qt5

2024-01-24 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtInstanceMessageDialog.hxx |1 +
 vcl/qt5/QtInstanceMessageDialog.cxx |   20 
 2 files changed, 21 insertions(+)

New commits:
commit e44a322fd00e017ea6494d836f66e5ddf6cfa9d5
Author: Michael Weghorn 
AuthorDate: Tue Jan 23 14:04:54 2024 +0100
Commit: Michael Weghorn 
CommitDate: Wed Jan 24 17:24:08 2024 +0100

tdf#154381 qt weld: Allow setting message box default button

Implement `QtInstanceMessageDialog::set_default_response`
by identifying the `QPushButton` in the `QMessageBox` that
has the `QMessageBox::ButtonRole` corresponding to the
given VCL return type and setting that as the default
button in the `QMessageBox`.

With this in place, the qt6 welded message dialog that
shows up when opening a file that's already open in another
instance of LibreOffice (s. `AlreadyOpenQueryBox::AlreadyOpenQueryBox`)
has initial focus on the "Open Read-Only" button when it opens,
just as is the case for the non-welded one
(whose use can be forced by setting env var
`SAL_VCL_QT_NO_WELDED_WIDGETS=1`).

Change-Id: I6d543b43cb6adec2dde9646e1452aa03bdcbf331
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162441
Tested-by: Jenkins
Reviewed-by: Omkar Acharekar  
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/QtInstanceMessageDialog.hxx 
b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
index 0c585a9ed916..ae353268833c 100644
--- a/vcl/inc/qt5/QtInstanceMessageDialog.hxx
+++ b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
@@ -33,6 +33,7 @@ public:
 // weld::Dialog overrides
 virtual void add_button(const OUString& rText, int nResponse,
 const OUString& rHelpId = {}) override;
+virtual void set_default_response(int nResponse) override;
 virtual int run() override;
 };
 
diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx 
b/vcl/qt5/QtInstanceMessageDialog.cxx
index 6f252c79c816..ed48c5298a6c 100644
--- a/vcl/qt5/QtInstanceMessageDialog.cxx
+++ b/vcl/qt5/QtInstanceMessageDialog.cxx
@@ -9,6 +9,8 @@
 
 #include 
 
+#include 
+
 namespace
 {
 QMessageBox::ButtonRole lcl_vclResponseTypeToQtMessageBoxButtonRole(int 
nResponseType)
@@ -109,6 +111,24 @@ void QtInstanceMessageDialog::add_button(const OUString& 
rText, int nResponse, c
 
lcl_vclResponseTypeToQtMessageBoxButtonRole(nResponse));
 }
 
+void QtInstanceMessageDialog::set_default_response(int nResponse)
+{
+assert(m_pMessageDialog);
+
+const QList aButtons = m_pMessageDialog->buttons();
+for (QAbstractButton* pAbstractButton : aButtons)
+{
+QPushButton* pButton = dynamic_cast(pAbstractButton);
+assert(pButton);
+const QMessageBox::ButtonRole eRole = 
m_pMessageDialog->buttonRole(pButton);
+if (lcl_qtMessageBoxButtonRoleToVclResponseType(eRole) == nResponse)
+{
+m_pMessageDialog->setDefaultButton(pButton);
+return;
+}
+}
+}
+
 int QtInstanceMessageDialog::run()
 {
 // cannot use the QMessageBox::exec() return value right away, because it 
returns the


core.git: vcl/inc vcl/qt5

2024-01-24 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtInstanceMessageDialog.hxx |5 +
 vcl/qt5/QtInstanceMessageDialog.cxx |   83 
 2 files changed, 88 insertions(+)

New commits:
commit bb0c0e422788b6c461387491c59911ad84c27b83
Author: Michael Weghorn 
AuthorDate: Tue Jan 23 13:47:21 2024 +0100
Commit: Michael Weghorn 
CommitDate: Wed Jan 24 17:15:07 2024 +0100

tdf#154381 qt weld: Add button handling for message box

Override the `QtInstanceDialog` methods `add_button`
and `run` in `QtInstanceMessageDialog`, and implement
handling for these buttons with the native
`QMessageBox` that is used internally:

Implement `QtInstanceMessageDialog::add_button` to
make adding buttons to the welded message dialog
work.
Map the VCL response type to a corresponding
`QMessageBox::ButtonRole`. Some mappings are
straightforward, others are a bit more arbitrary,
but the only essential thing is that the mapping
back to the VCL response code is consistent.

`QMessageBox::exec` [1] overrides `QDialog::exec` [2],
and while the int returned by the latter corresponds
to a `QDialog::DialogCode` code, the int returned by
the former corresponds to a `QMessageBox::StandardButton`
value. Since the current `QtInstanceDialog::run` implementation
relies on the `QDialog` behaviour, override it for the
message dialog case. Since the `QMessageBox::ButtonRole`
is set in `QtInstanceMessageDialog::add_button`, retrieve
the corresponding role from the clicked button instead
of using the return value of the `QMessageBox::exec`
to be able to get the correct VCL return code again.

With this in place, the qt6 welded message dialog that
shows up when opening a file that's already open in another
instance of LibreOffice (s. `AlreadyOpenQueryBox::AlreadyOpenQueryBox`)
shows buttons and clicking any of them
behaves as expected, just as is the case for the non-welded one
(whose use can be forced by setting env var
`SAL_VCL_QT_NO_WELDED_WIDGETS=1`).

[1] https://doc.qt.io/qt-6/qmessagebox.html#exec`
[2] https://doc.qt.io/qt-6/qdialog.html#exec

Change-Id: Ie37573951302f13eab758f889d478dc9351e9c07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162440
Tested-by: Jenkins
Reviewed-by: Omkar Acharekar  
Reviewed-by: Michael Weghorn 

diff --git a/vcl/inc/qt5/QtInstanceMessageDialog.hxx 
b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
index 68d2010cb1fa..0c585a9ed916 100644
--- a/vcl/inc/qt5/QtInstanceMessageDialog.hxx
+++ b/vcl/inc/qt5/QtInstanceMessageDialog.hxx
@@ -29,6 +29,11 @@ public:
 virtual OUString get_primary_text() const override;
 
 virtual OUString get_secondary_text() const override;
+
+// weld::Dialog overrides
+virtual void add_button(const OUString& rText, int nResponse,
+const OUString& rHelpId = {}) override;
+virtual int run() override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtInstanceMessageDialog.cxx 
b/vcl/qt5/QtInstanceMessageDialog.cxx
index 2ba386ded5c5..6f252c79c816 100644
--- a/vcl/qt5/QtInstanceMessageDialog.cxx
+++ b/vcl/qt5/QtInstanceMessageDialog.cxx
@@ -9,6 +9,69 @@
 
 #include 
 
+namespace
+{
+QMessageBox::ButtonRole lcl_vclResponseTypeToQtMessageBoxButtonRole(int 
nResponseType)
+{
+// RET_CANCEL, RET_HELP, RET_YES, RET_NO and RET_OK have a matching 
equivalent
+// in Qt, the others are a bit more arbitrary; what really matters about 
these
+// is only that the mapping here and the other way around
+// (in lcl_qtMessageBoxButtonRoleToVclResponseType) is consistent
+switch (nResponseType)
+{
+case RET_CANCEL:
+return QMessageBox::ButtonRole::RejectRole;
+case RET_HELP:
+return QMessageBox::ButtonRole::HelpRole;
+case RET_YES:
+return QMessageBox::ButtonRole::YesRole;
+case RET_NO:
+return QMessageBox::ButtonRole::NoRole;
+case RET_OK:
+return QMessageBox::ButtonRole::AcceptRole;
+case RET_RETRY:
+return QMessageBox::ButtonRole::ResetRole;
+case RET_IGNORE:
+return QMessageBox::ButtonRole::ActionRole;
+case RET_CLOSE:
+return QMessageBox::ButtonRole::DestructiveRole;
+default:
+assert(false && "Unhandled vcl response type");
+return QMessageBox::InvalidRole;
+}
+}
+
+VclResponseType lcl_qtMessageBoxButtonRoleToVclResponseType(int nRet)
+{
+// AcceptRole, HelpRole, NoRole, RejectRole and YesRole have a matching 
equivalent
+// in VCL, the others are a bit more arbitrary; what really matters about 
these
+// is only that the mapping here and the other way around
+// (in lcl_vclResponseTypeToQtMessageBoxButtonRole) is consistent
+switch (nRet)
+{
+case QMessageBox::ButtonRole::AcceptRole:
+return 

core.git: vcl/inc vcl/source

2024-01-16 Thread Noel Grandin (via logerrit)
 vcl/inc/textlayout.hxx |   16 ++--
 vcl/source/text/textlayout.cxx |5 -
 2 files changed, 10 insertions(+), 11 deletions(-)

New commits:
commit d62abd20dbfcc90cbea7b0b66fd4a3f3660f7ce9
Author: Noel Grandin 
AuthorDate: Tue Jan 16 09:54:26 2024 +0200
Commit: Noel Grandin 
CommitDate: Tue Jan 16 12:52:02 2024 +0100

ITextLayout is unnecessary

everything inherits through TextLayoutCommon

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

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index 7f81fcbeb10a..22349a8d2e9a 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -33,7 +33,7 @@ class Control;
 
 namespace vcl
 {
-class SAL_NO_VTABLE ITextLayout
+class VCL_DLLPUBLIC TextLayoutCommon
 {
 public:
 virtual tools::LongGetTextWidth( const OUString& _rText, 
sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
@@ -43,13 +43,6 @@ namespace vcl
 virtual sal_Int32   GetTextBreak( const OUString& _rText, tools::Long 
_nMaxTextWidth, sal_Int32 _nStartIndex, sal_Int32 _nLength ) const = 0;
 virtual boolDecomposeTextRectAction() const = 0;
 
-protected:
-~ITextLayout() COVERITY_NOEXCEPT_FALSE {}
-};
-
-class VCL_DLLPUBLIC TextLayoutCommon : public ITextLayout
-{
-public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 
 std::tuple BreakLine(const tools::Long nWidth, 
OUString const& rStr,
@@ -66,13 +59,16 @@ namespace vcl
  tools::Long nWidth, OUString const& rStr,
  DrawTextFlags nStyle);
 
+protected:
+~TextLayoutCommon() COVERITY_NOEXCEPT_FALSE;
+
 private:
 OUString GetCenterEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth);
 OUString GetEndEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth, bool bClipText);
 OUString GetNewsEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 };
 
-/** is an implementation of the ITextLayout interface which simply 
delegates its calls to the respective
+/** is an implementation of TextLayoutCommon which simply delegates its 
calls to the respective
 methods of an OutputDevice instance, without any inbetween magic.
 */
 class VCL_DLLPUBLIC DefaultTextLayout final : public TextLayoutCommon
@@ -84,7 +80,7 @@ namespace vcl
 }
 virtual ~DefaultTextLayout();
 
-// ITextLayout overridables
+// TextLayoutCommon overridables
 virtual tools::LongGetTextWidth( const OUString& _rText,
   sal_Int32 _nStartIndex,
   sal_Int32 _nLength ) const override;
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 8797689963c0..d0c76c852f63 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -62,6 +62,9 @@ void ImplMultiTextLineInfo::Clear()
 
 namespace vcl
 {
+TextLayoutCommon::~TextLayoutCommon() COVERITY_NOEXCEPT_FALSE
+{}
+
 OUString TextLayoutCommon::GetCenterEllipsisString(OUString const& 
rOrigStr, sal_Int32 nIndex, tools::Long nMaxWidth)
 {
 OUStringBuffer aTmpStr(rOrigStr);
@@ -502,7 +505,7 @@ namespace vcl
 ReferenceDeviceTextLayout( const Control& _rControl, OutputDevice& 
_rTargetDevice, OutputDevice& _rReferenceDevice );
 virtual ~ReferenceDeviceTextLayout();
 
-// ITextLayout
+// TextLayoutCommon
 virtual tools::LongGetTextWidth( const OUString& rStr, 
sal_Int32 nIndex, sal_Int32 nLen ) const override;
 virtual voidDrawText( const Point& _rStartPoint, const 
OUString& _rText, sal_Int32 _nStartIndex, sal_Int32 _nLength, std::vector< 
tools::Rectangle >* _pVector, OUString* _pDisplayText ) override;
 virtual tools::Long GetTextArray( const OUString& _rText, KernArray* 
_pDXAry, sal_Int32 _nStartIndex, sal_Int32 _nLength, bool bCaret = false ) 
const override;


core.git: vcl/inc vcl/Library_vclplug_qt5.mk vcl/Library_vclplug_qt6.mk vcl/qt5 vcl/qt6 vcl/README.vars.md

2024-01-08 Thread OmkarAcharekar (via logerrit)
 vcl/Library_vclplug_qt5.mk  |5 
 vcl/Library_vclplug_qt6.mk  |5 
 vcl/README.vars.md  |1 
 vcl/inc/qt5/QtData.hxx  |2 
 vcl/inc/qt5/QtInstance.hxx  |5 
 vcl/inc/qt5/QtInstanceContainer.hxx |   26 
 vcl/inc/qt5/QtInstanceDialog.hxx|   51 +
 vcl/inc/qt5/QtInstanceMessageDialog.hxx |   34 ++
 vcl/inc/qt5/QtInstanceWidget.hxx|  171 
 vcl/inc/qt5/QtInstanceWindow.hxx|   49 +
 vcl/inc/qt5/QtTools.hxx |7 +
 vcl/inc/qt6/QtInstanceContainer.hxx |   12 ++
 vcl/inc/qt6/QtInstanceDialog.hxx|   12 ++
 vcl/inc/qt6/QtInstanceMessageDialog.hxx |   12 ++
 vcl/inc/qt6/QtInstanceWidget.hxx|   12 ++
 vcl/inc/qt6/QtInstanceWindow.hxx|   12 ++
 vcl/qt5/QtData.cxx  |5 
 vcl/qt5/QtInstance.cxx  |   24 
 vcl/qt5/QtInstanceContainer.cxx |   23 
 vcl/qt5/QtInstanceDialog.cxx|   53 +
 vcl/qt5/QtInstanceMessageDialog.cxx |   42 +++
 vcl/qt5/QtInstanceWidget.cxx|  166 +++
 vcl/qt5/QtInstanceWindow.cxx|   70 +
 vcl/qt5/QtTools.cxx |   91 +
 vcl/qt6/QtInstanceContainer.cxx |   12 ++
 vcl/qt6/QtInstanceDialog.cxx|   12 ++
 vcl/qt6/QtInstanceMessageDialog.cxx |   12 ++
 vcl/qt6/QtInstanceWidget.cxx|   12 ++
 vcl/qt6/QtInstanceWindow.cxx|   12 ++
 29 files changed, 950 insertions(+)

New commits:
commit 1ace23443b85d4a81b94656844f1b27e2987
Author: OmkarAcharekar 
AuthorDate: Wed Dec 20 19:13:50 2023 +0530
Commit: Michael Weghorn 
CommitDate: Mon Jan 8 22:52:59 2024 +0100

tdf#130857 Use native qt widgets - simple message dialog

- Implements CreateMessageDialog method for QtInstance which would create 
message dialogs using native qt widgets.

  Example - MasterPasswordCreateDialog ( 
https://git.libreoffice.org/core/+/5e8c0575e877795aaca91346548cd0136fa22048/uui/source/masterpasscrtdlg.cxx#64
 ).
  To trigger this :
  a) Go to "Tools" -> "Options".
  b) Select "LibreOfficeDev" -> "Security", then check "Persistently save 
passwords for web connections".
  c) In the master password dialog, enter two different passwords and click 
"OK". The message dialog appears now uses native qt widgets.

- adds Env variable SAL_VCL_QT_NO_WELDED_WIDGETS which reverts to previous 
behavior using VCL widgets.

Note: most of the methods from weld::Widget hierarchy are currently just 
dummy implementations for Qt case, only what's needed for simple message 
dialogs has been implemented in this patch.

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

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 2a72693e0e85..f29090d9dd9d 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -92,6 +92,11 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
 vcl/qt5/QtGraphics_Text \
 vcl/qt5/QtInstance \
 vcl/qt5/QtInstance_Print \
+vcl/qt5/QtInstanceContainer \
+vcl/qt5/QtInstanceDialog \
+vcl/qt5/QtInstanceMessageDialog \
+vcl/qt5/QtInstanceWidget \
+vcl/qt5/QtInstanceWindow \
 vcl/qt5/QtMainWindow \
 vcl/qt5/QtMenu \
 vcl/qt5/QtObject \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index a6b14da23f5c..f8a2c38bb836 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -91,6 +91,11 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
 vcl/qt6/QtGraphics_Text \
 vcl/qt6/QtInstance \
 vcl/qt6/QtInstance_Print \
+vcl/qt6/QtInstanceContainer \
+vcl/qt6/QtInstanceDialog \
+vcl/qt6/QtInstanceMessageDialog \
+vcl/qt6/QtInstanceWidget \
+vcl/qt6/QtInstanceWindow \
 vcl/qt6/QtMainWindow \
 vcl/qt6/QtMenu \
 vcl/qt6/QtObject \
diff --git a/vcl/README.vars.md b/vcl/README.vars.md
index 44764cbb0a14..baceef575c7b 100644
--- a/vcl/README.vars.md
+++ b/vcl/README.vars.md
@@ -68,6 +68,7 @@ will be used to write the log under `instdir/uitest/`.
 * `SAL_VCL_QT_NO_FONTCONFIG` - ignore fontconfig provided font substitutions
 * `SAL_VCL_QT_NO_NATIVE` - disable `QStyle`'d controls
 * `SAL_VCL_QT_USE_QFONT` - use `QFont` for text layout and rendering (default 
is to use cairo)
+* `SAL_VCL_QT_NO_WELDED_WIDGETS` - disable the use of welded Qt widgets, 
reverts to previous VCL widget behavior
 
 ## Mac
 
diff --git a/vcl/inc/qt5/QtData.hxx b/vcl/inc/qt5/QtData.hxx
index 82cfecd57e33..14450dee220d 100644
--- a/vcl/inc/qt5/QtData.hxx
+++ b/vcl/inc/qt5/QtData.hxx
@@ -42,6 +42,8 @@ public:
 QCursor& getCursor(PointerStyle ePointerStyle);
 
 static 

core.git: vcl/inc

2024-01-01 Thread Luv Sharma (via logerrit)
 vcl/inc/unx/x11/x11sys.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 8eadc80ac0c5e194a99ba57a2bf9d29e1465bdf8
Author: Luv Sharma 
AuthorDate: Mon Jan 1 02:58:43 2024 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Mon Jan 1 12:03:50 2024 +0100

tdf#143148 Use pragma once instead of include guards in vcl

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

diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx
index b48cf26e6a75..37c5b0b7d1c5 100644
--- a/vcl/inc/unx/x11/x11sys.hxx
+++ b/vcl/inc/unx/x11/x11sys.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
-#define INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
+#pragma once
 
 #include 
 
@@ -37,6 +36,4 @@ public:
   const std::vector< OUString >& rButtons ) 
override;
 };
 
-#endif // INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

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

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

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

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

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

core.git: vcl/inc vcl/source

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

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

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

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

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


core.git: vcl/inc

2023-12-07 Thread Kira Tubo (via logerrit)
 vcl/inc/bitmap/BitmapColorizeFilter.hxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 7081b28dd6ed1ab8b8d6528d94e44e5dc3b3121d
Author: Kira Tubo 
AuthorDate: Tue Dec 5 23:56:13 2023 -0800
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Fri Dec 8 03:32:20 2023 +0100

tdf#143148 Use pragma once instead of include guards

Replace include guards with #pragma once

Change-Id: Id7378d6cf43817a8501a314dd8614467fb10e33a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160417
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/bitmap/BitmapColorizeFilter.hxx 
b/vcl/inc/bitmap/BitmapColorizeFilter.hxx
index e05edf2191fb..ae511b322d0c 100644
--- a/vcl/inc/bitmap/BitmapColorizeFilter.hxx
+++ b/vcl/inc/bitmap/BitmapColorizeFilter.hxx
@@ -8,11 +8,9 @@
  *
  */
 
-#ifndef INCLUDED_VCL_INC_BITMAP_BITMAPCOLORIZEFILTER_HXX
-#define INCLUDED_VCL_INC_BITMAP_BITMAPCOLORIZEFILTER_HXX
+#pragma once
 
 #include 
-
 #include 
 
 class BitmapColorizeFilter final : public BitmapFilter
@@ -29,6 +27,4 @@ private:
 Color maColor;
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-27 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salframeview.h |5 +---
 vcl/osx/salframeview.mm|   50 ++---
 vcl/osx/salinst.cxx|   36 ++--
 3 files changed, 44 insertions(+), 47 deletions(-)

New commits:
commit 8a5da079592377cf69735973d922fc19e8ac763d
Author: Patrick Luby 
AuthorDate: Sat Nov 25 14:53:22 2023 -0500
Commit: Patrick Luby 
CommitDate: Mon Nov 27 14:36:51 2023 +0100

tdf#155092 don't dispatch left mouse up events during live resizing

Round 2 of trying to fix macOS live resizing.

If this is a left mouse up event, dispatching this event
will trigger tdf#155092 to occur in the next mouse down
event. So do not dispatch this event and push it back onto
the front of the event queue so no more events will be
dispatched until live resizing ends. Surprisingly, live
resizing appears to end in the next mouse down event.

Also, reverted parts of commit 54da842381ccb554d3cadc876f23cf183d21bf1a
and cleaned up the setting of ImplGetSVData()->mpWinData->mbIsLiveResize.

Change-Id: Ie93ed496e1f0e2a1711284ab205c6b245f71647c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159960
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h
index 1bc2b278d630..2b1a3f9baaed 100644
--- a/vcl/inc/osx/salframeview.h
+++ b/vcl/inc/osx/salframeview.h
@@ -45,6 +45,8 @@ enum class SalEvent;
 -(void)windowDidDeminiaturize: (NSNotification*)pNotification;
 -(BOOL)windowShouldClose: (NSNotification*)pNotification;
 -(void)windowDidChangeBackingProperties:(NSNotification *)pNotification;
+-(void)windowWillStartLiveResize:(NSNotification *)pNotification;
+-(void)windowDidEndLiveResize:(NSNotification *)pNotification;
 //-(void)willEncodeRestorableState:(NSCoder*)pCoderState;
 //-(void)didDecodeRestorableState:(NSCoder*)pCoderState;
 //-(void)windowWillEnterVersionBrowser:(NSNotification*)pNotification;
@@ -261,9 +263,6 @@ enum class SalEvent;
 -(NSArray *)accessibilityChildren;
 -(NSArray > 
*)accessibilityChildrenInNavigationOrder;
 
--(void)viewWillStartLiveResize;
--(void)viewDidEndLiveResize;
-
 @end
 
 @interface SalFrameViewA11yWrapper : AquaA11yWrapper
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index c58320558013..4fd5913efc05 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -196,24 +196,19 @@ static NSArray *getMergedAccessibilityChildren(NSArray 
*pDefaultChildren, NSArra
 return pRet;
 }
 
-// Update ImplGetSVData()->mpWinData->mbIsLiveResize and return the old value
-static bool updateWinDataInLiveResize(bool bInLiveResize)
+// Update ImplGetSVData()->mpWinData->mbIsLiveResize
+static void updateWinDataInLiveResize(bool bInLiveResize)
 {
-bool bRet = false;
-
 ImplSVData* pSVData = ImplGetSVData();
 assert( pSVData );
 if ( pSVData )
 {
-bRet = pSVData->mpWinData->mbIsLiveResize;
-if ( bRet != bInLiveResize )
+if ( pSVData->mpWinData->mbIsLiveResize != bInLiveResize )
 {
 pSVData->mpWinData->mbIsLiveResize = bInLiveResize;
 Scheduler::Wakeup();
 }
 }
-
-return bRet;
 }
 
 @interface NSResponder (SalFrameWindow)
@@ -405,9 +400,8 @@ static bool updateWinDataInLiveResize(bool bInLiveResize)
 mpFrame->UpdateFrameGeometry();
 mpFrame->CallCallback( SalEvent::Resize, nullptr );
 
-bool bInLiveResize = [self inLiveResize];
-bool bOldInLiveResize = updateWinDataInLiveResize(bInLiveResize);
-if ( bInLiveResize || bOldInLiveResize )
+updateWinDataInLiveResize( [self inLiveResize] );
+if ( ImplGetSVData()->mpWinData->mbIsLiveResize )
 {
 #if HAVE_FEATURE_SKIA
 // Related: tdf#152703 Eliminate empty window with Skia/Metal 
while resizing
@@ -447,7 +441,7 @@ static bool updateWinDataInLiveResize(bool bInLiveResize)
 [self setMinSize:aMinSize];
 [self setMaxSize:aMaxSize];
 
-if ( bInLiveResize )
+if ( ImplGetSVData()->mpWinData->mbIsLiveResize )
 {
 // tdf#152703 Force repaint after live resizing ends
 // Repost this notification so that this selector will be 
called
@@ -568,6 +562,20 @@ static bool updateWinDataInLiveResize(bool bInLiveResize)
 #endif
 }
 
+-(void)windowWillStartLiveResize:(NSNotification *)pNotification
+{
+SolarMutexGuard aGuard;
+
+updateWinDataInLiveResize(true);
+}
+
+-(void)windowDidEndLiveResize:(NSNotification *)pNotification
+{
+SolarMutexGuard aGuard;
+
+updateWinDataInLiveResize(false);
+}
+
 -(void)dockMenuItemTriggered: (id)sender
 {
 (void)sender;
@@ -769,13 +777,7 @@ static bool updateWinDataInLiveResize(bool bInLiveResize)
 if (!mpFrame || !AquaSalFrame::isAlive(mpFrame))
 return;
 
-const bool bIsLiveResize = [self inLiveResize];
-const bool bWasLiveResize = 

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

2023-11-23 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salframe.h |1 
 vcl/inc/osx/salframeview.h |4 ++-
 vcl/osx/salframe.cxx   |   34 ++
 vcl/osx/salframeview.mm|   50 +
 vcl/osx/salinst.cxx|   10 ++---
 5 files changed, 63 insertions(+), 36 deletions(-)

New commits:
commit 54da842381ccb554d3cadc876f23cf183d21bf1a
Author: Patrick Luby 
AuthorDate: Wed Nov 22 18:21:53 2023 -0500
Commit: Patrick Luby 
CommitDate: Thu Nov 23 16:02:27 2023 +0100

tdf#155092 use tracking areas instead of tracking rectangles

Apparently, the older, tracking rectangles selectors cause
unexpected window resizing upon the first mouse down after the
window has been manually resized so switch to the newer,
tracking areas selectors. Also, the NSTrackingInVisibleRect
option allows us to create one single tracking area that
resizes itself automatically over the lifetime of the view.

Note: for some unknown reason, both NSTrackingMouseMoved and
NSTrackingAssumeInside are necessary options for this fix
to work.

Change-Id: I1f771628d872166ff63a52990f671df053d144ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159845
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 2d9b9084fcbb..717e5f310178 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -78,7 +78,6 @@ public:
 
 PointerStylemePointerStyle; // currently 
active pointer style
 
-NSTrackingRectTag   mnTrackingRectTag;  // used to get 
enter/leave messages
 NSRect  maTrackingRect;
 
 CGMutablePathRefmrClippingPath; // used for 
"shaping"
diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h
index f9eca27e305c..1bc2b278d630 100644
--- a/vcl/inc/osx/salframeview.h
+++ b/vcl/inc/osx/salframeview.h
@@ -28,7 +28,6 @@ enum class SalEvent;
 {
 AquaSalFrame*   mpFrame;
 id mDraggingDestinationHandler;
-BOOLmbInLiveResize;
 BOOLmbInWindowDidResize;
 NSTimer*mpLiveResizeTimer;
 }
@@ -262,6 +261,9 @@ enum class SalEvent;
 -(NSArray *)accessibilityChildren;
 -(NSArray > 
*)accessibilityChildrenInNavigationOrder;
 
+-(void)viewWillStartLiveResize;
+-(void)viewDidEndLiveResize;
+
 @end
 
 @interface SalFrameViewA11yWrapper : AquaA11yWrapper
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index a8616c4fedc4..2240de319860 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -84,7 +84,6 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, 
SalFrameStyleFlags salFrameStyle
 mpMenu( nullptr ),
 mnExtStyle( 0 ),
 mePointerStyle( PointerStyle::Arrow ),
-mnTrackingRectTag( 0 ),
 mrClippingPath( nullptr ),
 mnICOptions( InputContextFlags::NONE ),
 mnBlinkCursorDelay( nMinBlinkCursorDelay ),
@@ -237,14 +236,27 @@ void AquaSalFrame::initWindowAndView()
 if( mnStyle & SalFrameStyleFlags::TOOLTIP )
 [mpNSWindow setIgnoresMouseEvents: YES];
 else
-[mpNSWindow setAcceptsMouseMovedEvents: YES];
+// Related: tdf#155092 mouse events are now handled by tracking areas
+[mpNSWindow setAcceptsMouseMovedEvents: NO];
 [mpNSWindow setHasShadow: YES];
 
 [mpNSWindow setDelegate: static_cast >(mpNSWindow)];
 
 [mpNSWindow setRestorable:NO];
-const NSRect aRect = { NSZeroPoint, NSMakeSize(maGeometry.width(), 
maGeometry.height()) };
-mnTrackingRectTag = [mpNSView addTrackingRect: aRect owner: mpNSView 
userData: nil assumeInside: NO];
+
+// tdf#155092 use tracking areas instead of tracking rectangles
+// Apparently, the older, tracking rectangles selectors cause
+// unexpected window resizing upon the first mouse down after the
+// window has been manually resized so switch to the newer,
+// tracking areas selectors. Also, the NSTrackingInVisibleRect
+// option allows us to create one single tracking area that
+// resizes itself automatically over the lifetime of the view.
+// Note: for some unknown reason, both NSTrackingMouseMoved and
+// NSTrackingAssumeInside are necessary options for this fix
+// to work.
+NSTrackingArea *pTrackingArea = [[NSTrackingArea alloc] initWithRect: 
[mpNSView bounds] options: ( NSTrackingMouseEnteredAndExited | 
NSTrackingMouseMoved | NSTrackingActiveAlways | NSTrackingAssumeInside | 
NSTrackingInVisibleRect ) owner: mpNSView userInfo: nil];
+[mpNSView addTrackingArea: pTrackingArea];
+[pTrackingArea release];
 
 maSysData.mpNSView = mpNSView;
 
@@ -1832,7 +1844,6 @@ void AquaSalFrame::SetParent( SalFrame* pNewParent )
 
 void AquaSalFrame::UpdateFrameGeometry()
 {
-bool bFirstTime = (mnTrackingRectTag == 0);
 mbGeometryDidChange = false;
 
 if ( !mpNSWindow )
@@ -1848,7 +1859,7 @@ void 

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

2023-11-22 Thread Gülşah Köse (via logerrit)
 vcl/inc/wizdlg.hxx   |1 
 vcl/jsdialog/jsdialogbuilder.cxx |7 
 vcl/source/control/roadmapwizard.cxx |   56 +--
 vcl/source/control/wizardmachine.cxx |7 
 vcl/source/control/wizimpldata.hxx   |   47 +
 5 files changed, 71 insertions(+), 47 deletions(-)

New commits:
commit a6fffac0336fa7d5843f73139ec88a5eef8269d5
Author: Gülşah Köse 
AuthorDate: Fri Nov 10 11:32:34 2023 +0300
Commit: Gülşah Köse 
CommitDate: Wed Nov 22 13:46:39 2023 +0100

Online: Fix Wizard Help button

Wizard dialog help button's response is not initialized if we don't run
any other dialogs. It should be initialized in RoadmapWizard itself.

response_help function can not detect wizard dialog's Help button. So we
should handle this case in function too.

Signed-off-by: Gülşah Köse 
Change-Id: If80a2e54dcbf5eaa3d0e07347d12296ace5c9569
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159282
Reviewed-by: Szymon Kłos 
Tested-by: Jenkins

diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index 4416ed2e5891..56a9ed5261d7 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -128,6 +128,7 @@ namespace vcl
 
 voidAddButton( Button* pButton, tools::Long nOffset = 
0 );
 voidRemoveButton( Button* pButton );
+voidAddButtonResponse( Button* pButton, int response);
 
 voidSetPageSizePixel( const Size& rSize ) { maPageSize 
= rSize; }
 const Size& GetPageSizePixel() const { return maPageSize; }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 151928f873f6..48946baa15f9 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -54,7 +54,14 @@ void response_help(vcl::Window* pWindow)
 vcl::Window* pButtonWindow = pDialog->get_widget_for_response(RET_HELP);
 ::Button* pButton = dynamic_cast<::Button*>(pButtonWindow);
 if (!pButton)
+{
+// Is it a wizard dialog?
+vcl::RoadmapWizard* pWizard = 
dynamic_cast(pWindow);
+if (!pWizard || !pWizard->m_pHelp)
+return;
+pWizard->m_pHelp->Click();
 return;
+}
 
 pButton->Click();
 }
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 846e6f2ee2f3..1b3c9e96b477 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -28,59 +28,12 @@
 #include 
 
 #include 
-#include 
-#include 
 
 #include "wizimpldata.hxx"
 #include 
 
 namespace vcl
 {
-using namespace RoadmapWizardTypes;
-
-namespace
-{
-typedef ::std::set< WizardTypes::WizardState > StateSet;
-
-typedef ::std::map<
-PathId,
-WizardPath
-> Paths;
-
-typedef ::std::map<
-WizardTypes::WizardState,
-::std::pair<
-OUString,
-RoadmapPageFactory
->
-> StateDescriptions;
-}
-
-struct RoadmapWizardImpl
-{
-ScopedVclPtr pRoadmap;
-Paths   aPaths;
-PathId  nActivePath;
-StateDescriptions   aStateDescriptors;
-StateSetaDisabledStates;
-boolbActivePathIsDefinite;
-
-RoadmapWizardImpl()
-:pRoadmap( nullptr )
-,nActivePath( -1 )
-,bActivePathIsDefinite( false )
-{
-}
-
-/// returns the index of the current state in given path, or -1
-static sal_Int32 getStateIndexInPath( WizardTypes::WizardState 
_nState, const WizardPath& _rPath );
-/// returns the index of the current state in the path with the given 
id, or -1
-sal_Int32 getStateIndexInPath( WizardTypes::WizardState _nState, 
PathId _nPathId );
-/// returns the index of the first state in which the two given paths 
differ
-static sal_Int32 getFirstDifferentIndex( const WizardPath& _rLHS, 
const WizardPath& _rRHS );
-};
-
-
 sal_Int32 RoadmapWizardImpl::getStateIndexInPath( WizardTypes::WizardState 
_nState, const WizardPath& _rPath )
 {
 sal_Int32 nStateIndexInPath = 0;
@@ -818,6 +771,15 @@ namespace vcl
 sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
 nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
 rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
+{
+auto aResponses = rJsonWriter.startArray("responses");
+for (const auto& rResponse : m_xRoadmapImpl->maResponses)
+{
+auto aResponse = rJsonWriter.startStruct();
+rJsonWriter.put("id", rResponse.first->get_id());
+rJsonWriter.put("response", rResponse.second);
+}
+}
 
 

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

2023-11-19 Thread Taichi Haradaguchi (via logerrit)
 vcl/inc/unx/cairotextrender.hxx  |5 +
 vcl/inc/unx/cpdmgr.hxx   |6 +-
 vcl/inc/unx/cupsmgr.hxx  |5 +
 vcl/inc/unx/fc_fontoptions.hxx   |6 +-
 vcl/inc/unx/gendisp.hxx  |5 +
 vcl/inc/unx/genprn.h |5 +
 vcl/inc/unx/gensys.h |5 +
 vcl/inc/unx/gtk/gloactiongroup.h |5 +
 vcl/inc/unx/gtk/glomenu.h|5 +
 vcl/inc/unx/gtk/gtkinst.hxx  |5 +
 vcl/inc/unx/gtk/gtkobject.hxx|6 +-
 vcl/inc/unx/gtk/gtksalmenu.hxx   |5 +
 vcl/inc/unx/gtk/gtksys.hxx   |6 ++
 vcl/inc/unx/gtk/hudawareness.h   |5 +
 vcl/inc/unx/helper.hxx   |6 +-
 vcl/inc/unx/i18n_cb.hxx  |6 ++
 vcl/inc/unx/i18n_ic.hxx  |5 +
 vcl/inc/unx/i18n_im.hxx  |5 +
 vcl/inc/unx/i18n_keysym.hxx  |5 +
 vcl/inc/unx/i18n_xkb.hxx |5 +
 vcl/inc/unx/saldata.hxx  |5 +
 vcl/inc/unx/saldisp.hxx  |5 +
 vcl/inc/unx/salframe.h   |5 +
 vcl/inc/unx/salinst.h|5 +
 vcl/inc/unx/salobj.h |5 +
 vcl/inc/unx/saltimer.h   |5 +
 vcl/inc/unx/saltype.h|5 ++---
 vcl/inc/unx/salunx.h |5 +
 vcl/inc/unx/salunxtime.h |5 +
 vcl/inc/unx/salvd.h  |5 +
 vcl/inc/unx/sessioninhibitor.hxx |5 +
 vcl/inc/unx/sm.hxx   |6 ++
 vcl/inc/unx/svsys.h  |6 ++
 vcl/inc/unx/wmadaptor.hxx|5 +
 vcl/inc/unx/x11/x11gdiimpl.h |5 +
 35 files changed, 40 insertions(+), 143 deletions(-)

New commits:
commit 76898eaf8fc665802c4fcdd129ec221d9019d4b9
Author: Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Sun Nov 19 11:10:53 2023 +0900
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Mon Nov 20 04:50:03 2023 +0100

tdf#143148: Use pragma once instead of include guards in vcl/inc/unx

Change-Id: I91ba6c5e49ed7e9ae8e946859ce5ed2169ae590a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159648
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index e262a9184b31..50848ed19fa6 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
-#define INCLUDED_VCL_INC_UNX_CAIROTEXTRENDER_HXX
+#pragma once
 
 #include 
 
@@ -43,6 +42,4 @@ public:
 virtual ~CairoTextRender();
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/cpdmgr.hxx b/vcl/inc/unx/cpdmgr.hxx
index 8e71d4c13015..2806f1d09b53 100644
--- a/vcl/inc/unx/cpdmgr.hxx
+++ b/vcl/inc/unx/cpdmgr.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_CPDMGR_HXX
-#define INCLUDED_VCL_INC_UNX_CPDMGR_HXX
+#pragma once
 
 #include 
 #include 
@@ -120,7 +119,4 @@ public:
 
 } // namespace psp
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-
diff --git a/vcl/inc/unx/cupsmgr.hxx b/vcl/inc/unx/cupsmgr.hxx
index 096efdea6e77..fb172103bbd9 100644
--- a/vcl/inc/unx/cupsmgr.hxx
+++ b/vcl/inc/unx/cupsmgr.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_CUPSMGR_HXX
-#define INCLUDED_VCL_INC_UNX_CUPSMGR_HXX
+#pragma once
 
 #include 
 #include 
@@ -87,6 +86,4 @@ public:
 
 } // namespace psp
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/fc_fontoptions.hxx b/vcl/inc/unx/fc_fontoptions.hxx
index 30411d5d0c60..73bcf3421bc5 100644
--- a/vcl/inc/unx/fc_fontoptions.hxx
+++ b/vcl/inc/unx/fc_fontoptions.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX
-#define INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX
+#pragma once
 
 #include 
 #include 
@@ -38,7 +37,4 @@ private:
 FcPattern* mpPattern;
 };
 
-
-#endif // INCLUDED_VCL_INC_UNX_FC_FONTOPTIONS_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gendisp.hxx b/vcl/inc/unx/gendisp.hxx
index a6188e27a16e..5ef7d445b25a 100644
--- a/vcl/inc/unx/gendisp.hxx
+++ b/vcl/inc/unx/gendisp.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_GENERIC_GENDISP_HXX
-#define INCLUDED_VCL_INC_GENERIC_GENDISP_HXX
+#pragma once
 
 #include 
 #include 
@@ -50,6 +49,4 @@ public:
 { return m_pCapture; }
 };
 
-#endif // INCLUDED_VCL_INC_GENERIC_GENDISP_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
index 

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

2023-11-19 Thread Taichi Haradaguchi (via logerrit)
 vcl/inc/win/salbmp.h   |5 +
 vcl/inc/win/salframe.h |5 +
 vcl/inc/win/salinst.h  |5 +
 vcl/inc/win/salobj.h   |5 +
 vcl/inc/win/salprn.h   |5 +
 vcl/inc/win/salsys.h   |5 +
 vcl/inc/win/saltimer.h |5 +
 vcl/inc/win/salvd.h|6 +-
 vcl/inc/win/svsys.h|5 +
 9 files changed, 9 insertions(+), 37 deletions(-)

New commits:
commit 7618c791a39e74b0f8291ff28f65df78cfa20301
Author: Taichi Haradaguchi <20001...@ymail.ne.jp>
AuthorDate: Sun Nov 19 12:28:28 2023 +0900
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Sun Nov 19 09:14:51 2023 +0100

tdf#143148: Use pragma once instead of include guards in vcl/inc/win

Change-Id: I57db27a6cbd45ec9f1ae666a3b8da23bbf5c20de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159649
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index c83b1675331f..2edf291342cc 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALBMP_H
-#define INCLUDED_VCL_INC_WIN_SALBMP_H
+#pragma once
 
 #include 
 #include 
@@ -93,6 +92,4 @@ public:
 virtual const basegfx::SystemDependentDataHolder* 
accessSystemDependentDataHolder() const override;
 };
 
-#endif // INCLUDED_VCL_INC_WIN_SALBMP_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 66da5e3a976f..de72c089b57b 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALFRAME_H
-#define INCLUDED_VCL_INC_WIN_SALFRAME_H
+#pragma once
 
 #include 
 
@@ -160,6 +159,4 @@ namespace vcl_sal {
 LONG nSymbol );
 }
 
-#endif // INCLUDED_VCL_INC_WIN_SALFRAME_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index 7af6e007b562..9c6ca82d38bd 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALINST_H
-#define INCLUDED_VCL_INC_WIN_SALINST_H
+#pragma once
 
 #include 
 
@@ -86,6 +85,4 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst, HWND 
hWndParent, SalFrameSt
 SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent );
 HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, bool bAsChild );
 
-#endif // INCLUDED_VCL_INC_WIN_SALINST_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h
index e76c4787eb71..37bcf0317866 100644
--- a/vcl/inc/win/salobj.h
+++ b/vcl/inc/win/salobj.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALOBJ_H
-#define INCLUDED_VCL_INC_WIN_SALOBJ_H
+#pragma once
 
 #include 
 
@@ -50,6 +49,4 @@ public:
 virtual const SystemEnvData*GetSystemData() const override;
 };
 
-#endif // INCLUDED_VCL_INC_WIN_SALOBJ_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index 2d02aa5b0e54..e1bbb665e29d 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALPRN_H
-#define INCLUDED_VCL_INC_WIN_SALPRN_H
+#pragma once
 
 #include 
 
@@ -113,6 +112,4 @@ public:
 bool isValid() const { return mbValid && mhDC; }
 };
 
-#endif // INCLUDED_VCL_INC_WIN_SALPRN_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h
index cf1a6ecb4419..ae94bb9e1a5d 100644
--- a/vcl/inc/win/salsys.h
+++ b/vcl/inc/win/salsys.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALSYS_H
-#define INCLUDED_VCL_INC_WIN_SALSYS_H
+#pragma once
 
 #include 
 
@@ -65,6 +64,4 @@ public:
 sal_IntPtr /*LPRECT*/ );
 };
 
-#endif // INCLUDED_VCL_INC_WIN_SALSYS_H
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index a467de815d85..827c08ab8305 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_WIN_SALTIMER_H
-#define INCLUDED_VCL_INC_WIN_SALTIMER_H
+#pragma once
 
 #include 
 
@@ -81,6 +80,4 @@ inline bool WinSalTimer::GetForceRealTimer() const
 return m_bForceRealTimer;
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h
index 7a776056c3a2..66833f99f18a 100644
--- 

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

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

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

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

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

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


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

2023-11-18 Thread Cristina Mustatea (via logerrit)
 vcl/inc/unx/desktops.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 5682e1d4145c26fc8021879df0543d5aeacf9c83
Author: Cristina Mustatea 
AuthorDate: Thu Sep 21 17:40:52 2023 +0300
Commit: Taichi Haradaguchi <20001...@ymail.ne.jp>
CommitDate: Sun Nov 19 01:54:09 2023 +0100

tdf#143148 Use pragma once instead of include guards

Change-Id: I5da0bf7d780f5336ecfd17882e5bfd1ac7fb4a3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157156
Tested-by: Jenkins
Reviewed-by: Taichi Haradaguchi <20001...@ymail.ne.jp>

diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx
index 2056c2c37928..b40004230f91 100644
--- a/vcl/inc/unx/desktops.hxx
+++ b/vcl/inc/unx/desktops.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_DESKTOPS_HXX
-#define INCLUDED_VCL_INC_UNX_DESKTOPS_HXX
+#pragma once
 
 #include 
 
@@ -37,6 +36,4 @@ enum SAL_DLLPUBLIC_RTTI DesktopType
 DESKTOP_LXQT
 }; // keep in sync with desktop_strings[] in salplug.cxx
 
-#endif // INCLUDED_VCL_INC_UNX_DESKTOPS_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-11-07 Thread Noel Grandin (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx |2 +-
 vcl/source/animate/Animation.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c71edc1f2e8226d4ac0f06a87f4f7f7107158f82
Author: Noel Grandin 
AuthorDate: Tue Nov 7 14:40:22 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 8 06:50:46 2023 +0100

loplugin:fieldcast in AnimationData

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

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index f75b88e29541..bc86e65e3f46 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -33,7 +33,7 @@ struct AnimationData
 Point maOriginStartPt;
 Size maStartSize;
 VclPtr mpRenderContext;
-void* mpRendererData;
+AnimationRenderer* mpRendererData;
 tools::Long mnRendererId;
 bool mbIsPaused;
 
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 5f2b8ce153ee..9063b9846a24 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -310,7 +310,7 @@ void Animation::PopulateRenderers()
 }
 else
 {
-pRenderer = 
static_cast(pDataItem->mpRendererData);
+pRenderer = pDataItem->mpRendererData;
 }
 
 pRenderer->pause(pDataItem->mbIsPaused);


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

2023-11-06 Thread László Németh (via logerrit)
 vcl/inc/svdata.hxx |3 +++
 vcl/source/control/imp_listbox.cxx |2 +-
 vcl/unx/gtk3/gtkframe.cxx  |6 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 698935c220131bc761eb9cf25e01fa91087a788e
Author: László Németh 
AuthorDate: Mon Nov 6 23:56:57 2023 +0100
Commit: László Németh 
CommitDate: Tue Nov 7 07:16:01 2023 +0100

tdf#152155 vcl: fix gtk popup listbox positions on sidebar

It was fixed only on Wayland previously.

Follow-up to commit 15cdee0d846854b50dd04626b73499bef9305e00
"Resolves: tdf#152155 use gtk's knowledge of relative widget positions".

Change-Id: I7a8b17189b319146142a2193ec4b5ec41e2c2d27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159020
Tested-by: Jenkins
Reviewed-by: László Németh 

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 104b9543b74a..fd7ae855b5f2 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -118,6 +118,9 @@ class UITestLogger;
 #define SV_ICON_ID_DATABASE12
 #define SV_ICON_ID_FORMULA 13
 
+const FloatWinPopupFlags LISTBOX_FLOATWINPOPUPFLAGS = FloatWinPopupFlags::Down 
|
+FloatWinPopupFlags::NoHorzPlacement | 
FloatWinPopupFlags::AllMouseButtonClose;
+
 namespace com::sun::star::datatransfer::clipboard { class XClipboard; }
 
 namespace vcl
diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index 04919ca26f20..bb4da51859b0 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -3011,7 +3011,7 @@ void ImplListBoxFloatingWindow::StartFloat( bool 
bStartTracking )
 pGrandparentOutDev->ReMirror( aRect );
 
 // mouse-button right: close the List-Box-Float-win and don't stop the 
handling fdo#84795
-StartPopupMode( aRect, FloatWinPopupFlags::Down | 
FloatWinPopupFlags::NoHorzPlacement | FloatWinPopupFlags::AllMouseButtonClose );
+StartPopupMode( aRect, LISTBOX_FLOATWINPOPUPFLAGS );
 
 if( nPos != LISTBOX_ENTRY_NOTFOUND )
 mpImplLB->ShowProminentEntry( nPos );
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index b1bf8474b1b2..f063f80b7dea 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -3091,8 +3091,12 @@ void GtkSalFrame::EndSetClipRegion()
 
 void GtkSalFrame::PositionByToolkit(const tools::Rectangle& rRect, 
FloatWinPopupFlags nFlags)
 {
-if (ImplGetSVData()->maNWFData.mbCanDetermineWindowPosition)
+if ( ImplGetSVData()->maNWFData.mbCanDetermineWindowPosition &&
+// tdf#152155 cannot determine window positions of popup listboxes on 
sidebar
+nFlags != LISTBOX_FLOATWINPOPUPFLAGS )
+{
 return;
+}
 
 m_aFloatRect = rRect;
 m_nFloatFlags = nFlags;


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

2023-11-06 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/salframe.h  |3 +++
 vcl/osx/salframe.cxx|9 ++---
 vcl/osx/salframeview.mm |7 +++
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 0c54c09aeb7e170512195c8f619ab2ded98c1ec5
Author: Patrick Luby 
AuthorDate: Mon Nov 6 09:44:18 2023 -0500
Commit: Patrick Luby 
CommitDate: Mon Nov 6 20:27:08 2023 +0100

tdf#155266 force flush after scrolling

This is the second attempt to force a flush after scrolling.
Commit 9c0803edd1f42b2d29115674795c7c674fea1a35 worked on
Mac Silicon but not Mac Intel.

So, instead of calling [NSApp currentEvent] to determine if
scrolling has occurred, mark the AquaSalFrame whenever a
scrollwheel or mouse drag event is dispatched so the frame
will be flushed in the next AquaSalFrame::Flush() call.

Change-Id: I2d0b99d2cd1167e92c7fd89bf53b2f30ab85a165
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159003
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/osx/salframe.h b/vcl/inc/osx/salframe.h
index 21a4b963717d..2d9b9084fcbb 100644
--- a/vcl/inc/osx/salframe.h
+++ b/vcl/inc/osx/salframe.h
@@ -98,6 +98,9 @@ public:
 
 int mnBlinkCursorDelay;
 
+// tdf#155266 force flush after scrolling
+boolmbForceFlush;
+
 public:
 /** Constructor
 
diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx
index d20e6e3d8422..a8616c4fedc4 100644
--- a/vcl/osx/salframe.cxx
+++ b/vcl/osx/salframe.cxx
@@ -87,7 +87,8 @@ AquaSalFrame::AquaSalFrame( SalFrame* pParent, 
SalFrameStyleFlags salFrameStyle
 mnTrackingRectTag( 0 ),
 mrClippingPath( nullptr ),
 mnICOptions( InputContextFlags::NONE ),
-mnBlinkCursorDelay ( nMinBlinkCursorDelay )
+mnBlinkCursorDelay( nMinBlinkCursorDelay ),
+mbForceFlush( false )
 {
 mpParent = dynamic_cast(pParent);
 
@@ -1018,8 +1019,9 @@ void AquaSalFrame::Flush()
 // outside of the application's event loop (e.g. IntroWindow)
 // nothing would trigger paint event handling
 // => fall back to synchronous painting
-if( ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
+if( mbForceFlush || ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
 {
+mbForceFlush = false;
 mpGraphics->Flush();
 [mpNSView display];
 }
@@ -1039,8 +1041,9 @@ void AquaSalFrame::Flush( const tools::Rectangle& rRect )
 // outside of the application's event loop (e.g. IntroWindow)
 // nothing would trigger paint event handling
 // => fall back to synchronous painting
-if( ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
+if( mbForceFlush || ImplGetSVData()->maAppData.mnDispatchLevel <= 0 )
 {
+mbForceFlush = false;
 mpGraphics->Flush( rRect );
 [mpNSView display];
 }
diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm
index 4071155e28cc..27c9e773ec4c 100644
--- a/vcl/osx/salframeview.mm
+++ b/vcl/osx/salframeview.mm
@@ -861,6 +861,10 @@ static NSArray *getMergedAccessibilityChildren(NSArray 
*pDefaultChildren, NSArra
 aEvent.mnX = pDispatchFrame->maGeometry.width() - 1 - aEvent.mnX;
 
 pDispatchFrame->CallCallback( nEvent,  );
+
+// tdf#155266 force flush after scrolling
+if (nButton == MOUSE_LEFT && nEvent == SalEvent::MouseMove)
+mpFrame->mbForceFlush = true;
 }
 }
 
@@ -1164,6 +1168,9 @@ static NSArray *getMergedAccessibilityChildren(NSArray 
*pDefaultChildren, NSArra
 
 mpFrame->CallCallback( SalEvent::WheelMouse,  );
 }
+
+// tdf#155266 force flush after scrolling
+mpFrame->mbForceFlush = true;
 }
 }
 


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

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

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

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

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

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

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

2023-11-03 Thread Michael Stahl (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx  |   14 +---
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |   90 
 vcl/qa/cppunit/pdfexport/pdfexport2.cxx |   72 -
 vcl/source/gdi/pdfwriter_impl.cxx   |   53 +++---
 4 files changed, 108 insertions(+), 121 deletions(-)

New commits:
commit 822a0c4fcd4607d5247b828c69728a510684a442
Author: Michael Stahl 
AuthorDate: Thu Nov 2 16:34:56 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 3 13:41:08 2023 +0100

tdf#157028 vcl: PDF export: inline OBJR dictionaries

There seems to be no reason why SE child OBJR dictionaries are separate
objects, they could just be inline.

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index 23ba7c7baed5..ae8754e6cc1a 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -566,15 +567,10 @@ struct PDFStructureAttribute
 {}
 };
 
-struct PDFStructureElementKid // for Kids entries
-{
-sal_Int32 const nObject;  // an object number if nMCID is -1,
-// else the page object relevant to MCID
-sal_Int32 const nMCID;// an MCID if >= 0
-
-explicit PDFStructureElementKid( sal_Int32 nObj ) : nObject( nObj ), 
nMCID( -1 ) {}
-PDFStructureElementKid( sal_Int32 MCID, sal_Int32 nPage ) : nObject( nPage 
), nMCID( MCID ) {}
-};
+struct ObjReference { sal_Int32 const nObject; };
+struct ObjReferenceObj { sal_Int32 const nObject; };
+struct MCIDReference { sal_Int32 const nPageObj; sal_Int32 const nMCID; };
+typedef ::std::variant 
PDFStructureElementKid;
 
 struct PDFStructureElement
 {
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 9db3cf63f187..ef317e600ca5 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -2064,19 +2064,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
 for (size_t i = 0; i < pKids->GetElements().size(); ++i)
 {
 auto pNum = 
dynamic_cast(pKids->GetElement(i));
-auto pRef = 
dynamic_cast(pKids->GetElement(i));
+auto pObjR = 
dynamic_cast(pKids->GetElement(i));
 if (pNum)
 {
 ++nMCID;
 }
-if (pRef)
+if (pObjR)
 {
 ++nRef;
-auto pObjR = pRef->LookupObject();
-auto pOType = 
dynamic_cast(pObjR->Lookup("Type"));
+auto pOType
+= 
dynamic_cast(pObjR->LookupElement("Type"));
 CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue());
 auto pAnnotRef
-= 
dynamic_cast(pObjR->Lookup("Obj"));
+= 
dynamic_cast(pObjR->LookupElement("Obj"));
 auto pAnnot = pAnnotRef->LookupObject();
 auto pAType = 
dynamic_cast(pAnnot->Lookup("Type"));
 CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue());
@@ -2129,19 +2129,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
 for (size_t i = 0; i < pKids->GetElements().size(); ++i)
 {
 auto pNum = 
dynamic_cast(pKids->GetElement(i));
-auto pRef = 
dynamic_cast(pKids->GetElement(i));
+auto pObjR = 
dynamic_cast(pKids->GetElement(i));
 if (pNum)
 {
 ++nMCID;
 }
-if (pRef)
+if (pObjR)
 {
 ++nRef;
-auto pObjR = pRef->LookupObject();
-auto pOType = 
dynamic_cast(pObjR->Lookup("Type"));
+auto pOType
+= 
dynamic_cast(pObjR->LookupElement("Type"));
 CPPUNIT_ASSERT_EQUAL(OString("OBJR"), pOType->GetValue());
 auto pAnnotRef
-= 
dynamic_cast(pObjR->Lookup("Obj"));
+= 
dynamic_cast(pObjR->LookupElement("Obj"));
 auto pAnnot = pAnnotRef->LookupObject();
 auto pAType = 
dynamic_cast(pAnnot->Lookup("Type"));
 CPPUNIT_ASSERT_EQUAL(OString("Annot"), pAType->GetValue());
@@ -2193,19 +2193,19 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf157816)
 for (size_t i = 0; i < pKids->GetElements().size(); ++i)
 {
 auto pNum = 
dynamic_cast(pKids->GetElement(i));
-auto pRef = 
dynamic_cast(pKids->GetElement(i));
+auto pObjR = 
dynamic_cast(pKids->GetElement(i));
 if (pNum)
 {
 ++nMCID;
 }
-if (pRef)
+if (pObjR)
 {
 ++nRef;
-  

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

2023-11-02 Thread Tobias Kokolakis (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx|3 --
 vcl/source/gdi/pdfwriter_impl.cxx |   46 --
 2 files changed, 5 insertions(+), 44 deletions(-)

New commits:
commit fa7ae4638431bf4f4d40d16ab0017ec59e233039
Author: Tobias Kokolakis 
AuthorDate: Sat Sep 2 13:52:02 2023 +0200
Commit: Mike Kaganski 
CommitDate: Fri Nov 3 06:08:23 2023 +0100

tdf#156478 Remove unused default values for MediaBox and UserUnit

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index b20de8171473..23ba7c7baed5 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -113,9 +113,6 @@ class PDFObjectElement;
 
 namespace pdf
 {
-constexpr sal_Int32 g_nInheritedPageWidth = 595;  // default A4 in inch/72
-constexpr sal_Int32 g_nInheritedPageHeight = 842; // default A4 in inch/72
-
 struct PDFPage
 {
 VclPtr   m_pWriter;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index d11e75cf08dc..15eafe302953 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1211,7 +1211,7 @@ void PDFPage::appendMatrix3(Matrix3 const & rMatrix, 
OStringBuffer& rBuffer)
 
 double PDFPage::getHeight() const
 {
-double fRet = m_nPageHeight ? m_nPageHeight : 
vcl::pdf::g_nInheritedPageHeight;
+double fRet = m_nPageHeight ? m_nPageHeight : 842; // default A4 height in 
inch/72, OK to use hardcoded value here?
 
 if (m_nUserUnit > 1)
 {
@@ -5241,41 +5241,9 @@ bool PDFWriterImpl::emitCatalog()
 aLine.append( getResourceDictObj() );
 aLine.append( " 0 R\n" );
 
-double nMediaBoxWidth = 0;
-double nMediaBoxHeight = 0;
-sal_Int32 nUserUnit = 1;
 if( m_aPages.empty() ) // sanity check, this should not happen
-{
-nMediaBoxWidth = g_nInheritedPageWidth;
-nMediaBoxHeight = g_nInheritedPageHeight;
-}
-else
-{
-for (auto const& page : m_aPages)
-{
-if( page.m_nPageWidth > nMediaBoxWidth )
-{
-nMediaBoxWidth = page.m_nPageWidth;
-nUserUnit = page.m_nUserUnit;
-}
-if( page.m_nPageHeight > nMediaBoxHeight )
-{
-nMediaBoxHeight = page.m_nPageHeight;
-nUserUnit = page.m_nUserUnit;
-}
-}
-}
-aLine.append( "/MediaBox[ 0 0 " );
-aLine.append(nMediaBoxWidth / nUserUnit);
-aLine.append( ' ' );
-aLine.append(nMediaBoxHeight / nUserUnit);
-aLine.append(" ]\n");
-if (nUserUnit > 1)
-{
-aLine.append("/UserUnit ");
-aLine.append(nUserUnit);
-aLine.append("\n");
-}
+aLine.append( "/MediaBox[0 0 595 842]\n" ); // default A4 size in pt
+
 aLine.append("/Kids[ ");
 unsigned int i = 0;
 for (const auto & page : m_aPages)
@@ -5421,16 +5389,12 @@ bool PDFWriterImpl::emitCatalog()
 case PDFWriter::FitWidth :
 aLine.append( "/OpenAction[" );
 aLine.append( aInitPageRef );
-aLine.append( " /FitH " );
-aLine.append( g_nInheritedPageHeight );//Open fit width
-aLine.append( "]\n" );
+aLine.append( " /FitH 842]\n" ); //Open fit width, default A4 height 
in pt, OK to use hardcoded value here?
 break;
 case PDFWriter::FitVisible :
 aLine.append( "/OpenAction[" );
 aLine.append( aInitPageRef );
-aLine.append( " /FitBH " );
-aLine.append( g_nInheritedPageHeight );//Open fit visible
-aLine.append( "]\n" );
+aLine.append( " /FitBH 842]\n" ); //Open fit visible, , default A4 
height in pt, OK to use hardcoded value here?
 break;
 case PDFWriter::ActionZoom :
 aLine.append( "/OpenAction[" );


[Libreoffice-commits] core.git: vcl/inc vcl/Library_vcl.mk vcl/quartz vcl/skia

2023-10-01 Thread Patrick Luby (via logerrit)
 vcl/Library_vcl.mk   |1 +
 vcl/inc/quartz/cgutils.h |4 
 vcl/quartz/cgutils.mm|   43 +++
 vcl/skia/SkiaHelper.cxx  |   23 +++
 4 files changed, 67 insertions(+), 4 deletions(-)

New commits:
commit fe3fa1699f12eb007d26bbb19f5ff80826bc384f
Author: Patrick Luby 
AuthorDate: Sat Sep 30 18:03:45 2023 -0400
Commit: Patrick Luby 
CommitDate: Sun Oct 1 16:44:47 2023 +0200

tdf#156881 Disable Metal with AMD Radeon Pro 5XXX GPUs on macOS Catalina

When running macOS Catalina on a 2019 MacBook Pro, unexpected drawing
artifacts are drawn so disable Metal for the AMD Radeon Pro GPUs listed
for that model in https://support.apple.com/kb/SP809.

Change-Id: Iffe44da1f07af2f3bbc367051b5ea4d522216eb7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157443
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 6eb5043defed..d6a370706a86 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -714,6 +714,7 @@ $(eval $(call gb_Library_add_objcxxobjects,vcl,\
 $(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
 Cocoa \
 CoreFoundation \
+Metal \
 ))
 endif
 
diff --git a/vcl/inc/quartz/cgutils.h b/vcl/inc/quartz/cgutils.h
index 6c499448c721..786b21458d4f 100644
--- a/vcl/inc/quartz/cgutils.h
+++ b/vcl/inc/quartz/cgutils.h
@@ -31,4 +31,8 @@ CGImageRef VCL_DLLPUBLIC CreateWithSalBitmapAndMask(const 
SalBitmap& rBitmap,
 const SalBitmap& rMask, 
int nX, int nY,
 int nWidth, int nHeight);
 
+#ifdef MACOSX
+bool VCL_DLLPUBLIC DefaultMTLDeviceIsSupported();
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/quartz/cgutils.mm b/vcl/quartz/cgutils.mm
index c6a490d44885..0d611bec11d1 100644
--- a/vcl/quartz/cgutils.mm
+++ b/vcl/quartz/cgutils.mm
@@ -26,6 +26,12 @@
 #include 
 #endif
 
+#ifdef MACOSX
+#include 
+#include 
+#include 
+#endif
+
 static void CFRTLFree(void* /*info*/, const void* data, size_t /*size*/)
 {
 std::free( const_cast(data) );
@@ -85,4 +91,41 @@ CGImageRef CreateWithSalBitmapAndMask( const SalBitmap& 
rBitmap, const SalBitmap
 return xMaskedImage;
 }
 
+#ifdef MACOSX
+
+bool DefaultMTLDeviceIsSupported()
+{
+id pMetalDevice = MTLCreateSystemDefaultDevice();
+if (!pMetalDevice || !pMetalDevice.name)
+{
+SAL_WARN("vcl.skia", "MTLCreateSystemDefaultDevice() returned nil");
+return false;
+}
+
+SAL_WARN("vcl.skia", "Default MTLDevice is \"" << [pMetalDevice.name 
UTF8String] << "\"");
+
+bool bRet = true;
+
+// tdf#156881 Disable Metal with AMD Radeon Pro 5XXX GPUs on macOS Catalina
+// When running macOS Catalina on a 2019 MacBook Pro, unexpected drawing
+// artifacts are drawn so disable Metal for the AMD Radeon Pro GPUs listed
+// for that model in https://support.apple.com/kb/SP809.
+if (@available(macOS 11, *))
+{
+// No known problems with macOS Big Sur or later
+}
+else
+{
+   static NSString* pAMDRadeonPro5300Prefix = @"AMD Radeon Pro 5300M";
+   static NSString* pAMDRadeonPro5500Prefix = @"AMD Radeon Pro 5500M";
+   if ([pMetalDevice.name hasPrefix:pAMDRadeonPro5300Prefix] || 
[pMetalDevice.name hasPrefix:pAMDRadeonPro5500Prefix])
+   bRet = false;
+}
+
+[pMetalDevice release];
+return bRet;
+}
+
+#endif
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index 41ce5518112e..712ba39d75e3 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -85,6 +85,12 @@ bool isAlphaMaskBlendingEnabled() { return false; }
 
 #include 
 
+#ifdef SK_METAL
+#ifdef MACOSX
+#include 
+#endif
+#endif
+
 namespace SkiaHelper
 {
 static OUString getCacheFolder()
@@ -276,10 +282,19 @@ static void checkDeviceDenylisted(bool blockDisable = 
false)
 }
 if (grDirectContext) // Metal was initialized properly
 {
-// Try to assume Metal always works, given that Mac doesn't 
have such as wide range of HW vendors as PC.
-// If there turns out to be problems, handle it similarly to 
Vulkan.
-SAL_INFO("vcl.skia", "Using Skia Metal mode");
-writeSkiaMetalInfo();
+#ifdef MACOSX
+if (!blockDisable && !DefaultMTLDeviceIsSupported())
+{
+SAL_INFO("vcl.skia", "Metal default device not supported");
+disableRenderMethod(RenderMetal);
+useRaster = true;
+}
+else
+#endif
+{
+SAL_INFO("vcl.skia", "Using Skia Metal mode");
+writeSkiaMetalInfo();
+}
 }
 else
 {


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

2023-09-22 Thread Cosmin Humeniuc (via logerrit)
 vcl/inc/font/FeatureCollector.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 69d0a140ae133f6c9ec708034ca8a888a734f9b9
Author: Cosmin Humeniuc 
AuthorDate: Thu Sep 21 17:33:39 2023 +0300
Commit: Julien Nabet 
CommitDate: Fri Sep 22 19:17:09 2023 +0200

tdf#143148: Use pragma once instead of include guards

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

diff --git a/vcl/inc/font/FeatureCollector.hxx 
b/vcl/inc/font/FeatureCollector.hxx
index 07957a6b3e27..1b71d021599d 100644
--- a/vcl/inc/font/FeatureCollector.hxx
+++ b/vcl/inc/font/FeatureCollector.hxx
@@ -8,8 +8,7 @@
  *
  */
 
-#ifndef INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX
-#define INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX
+#pragma once
 
 #include 
 #include 
@@ -47,6 +46,4 @@ public:
 
 } // namespace vcl::font
 
-#endif // INCLUDED_VCL_INC_FONT_FEATURECOLLECTOR_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-09-22 Thread Bogdan Buzea (via logerrit)
 vcl/inc/fontsubset.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit 0f2918c25daab25cd0721d69f0506fe04456262d
Author: Bogdan Buzea 
AuthorDate: Thu Sep 21 17:35:18 2023 +0300
Commit: Julien Nabet 
CommitDate: Fri Sep 22 08:48:04 2023 +0200

tdf#143148: Use pragma once instead of include guards

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

diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx
index 1b218ed2e389..beec3f2fb55d 100644
--- a/vcl/inc/fontsubset.hxx
+++ b/vcl/inc/fontsubset.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_FONTSUBSET_HXX
-#define INCLUDED_VCL_INC_FONTSUBSET_HXX
+#pragma once
 
 #include 
 #include 
@@ -88,6 +87,4 @@ private:
 
 int VCL_DLLPUBLIC TestFontSubset(const void* data, sal_uInt32 size);
 
-#endif // INCLUDED_VCL_INC_FONTSUBSET_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-09-04 Thread Sarper Akdemir (via logerrit)
 vcl/inc/pdf/XmpMetadata.hxx   |1 +
 vcl/source/gdi/pdfwriter_impl.cxx |   32 +---
 vcl/source/pdf/XmpMetadata.cxx|8 +++-
 3 files changed, 29 insertions(+), 12 deletions(-)

New commits:
commit a45f72b8122d3bb4c0d5ac4252cf7e5a25d52291
Author: Sarper Akdemir 
AuthorDate: Thu Aug 31 02:59:51 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Mon Sep 4 20:53:40 2023 +0200

tdf#138792: PDF export: export metadata pdf:PDFVersion

Adds export of pdf:PDFVersion metadata.

Change-Id: Ic4c3eec3672839d0d125b64dfca6149912cd2458
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156329
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/vcl/inc/pdf/XmpMetadata.hxx b/vcl/inc/pdf/XmpMetadata.hxx
index d94d6e690c3c..a144266497cf 100644
--- a/vcl/inc/pdf/XmpMetadata.hxx
+++ b/vcl/inc/pdf/XmpMetadata.hxx
@@ -27,6 +27,7 @@ public:
 OString msAuthor;
 OString msSubject;
 OString msProducer;
+OString msPDFVersion;
 OString msKeywords;
 OString m_sCreatorTool;
 OString m_sCreateDate;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index def3d4ee3ba5..00b59830f048 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -623,6 +623,25 @@ void appendPdfTimeDate(OStringBuffer & rBuffer,
 }
 }
 
+const char* getPDFVersionStr(PDFWriter::PDFVersion ePDFVersion)
+{
+switch (ePDFVersion)
+{
+case PDFWriter::PDFVersion::PDF_A_1:
+case PDFWriter::PDFVersion::PDF_1_4:
+return "1.4";
+case PDFWriter::PDFVersion::PDF_1_5:
+return "1.5";
+case PDFWriter::PDFVersion::PDF_1_6:
+return "1.6";
+default:
+case PDFWriter::PDFVersion::PDF_A_2:
+case PDFWriter::PDFVersion::PDF_A_3:
+case PDFWriter::PDFVersion::PDF_1_7:
+return "1.7";
+}
+}
+
 } // end namespace
 
 PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double 
nPageHeight, PDFWriter::Orientation eOrientation )
@@ -1295,17 +1314,7 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
 // write header
 OStringBuffer aBuffer( 20 );
 aBuffer.append( "%PDF-" );
-switch( m_aContext.Version )
-{
-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;
-case PDFWriter::PDFVersion::PDF_1_6: aBuffer.append( "1.6" );break;
-default:
-case PDFWriter::PDFVersion::PDF_A_2:
-case PDFWriter::PDFVersion::PDF_A_3:
-case PDFWriter::PDFVersion::PDF_1_7: aBuffer.append( "1.7" );break;
-}
+aBuffer.append(getPDFVersionStr(m_aContext.Version));
 // append something binary as comment (suggested in PDF Reference)
 aBuffer.append( "\n%\303\244\303\274\303\266\303\237\n" );
 if( !writeBuffer( aBuffer ) )
@@ -5952,6 +5961,7 @@ sal_Int32 PDFWriterImpl::emitDocumentMetadata()
 lcl_assignMeta(m_aContext.DocumentInfo.Author, aMetadata.msAuthor);
 lcl_assignMeta(m_aContext.DocumentInfo.Subject, aMetadata.msSubject);
 lcl_assignMeta(m_aContext.DocumentInfo.Producer, aMetadata.msProducer);
+aMetadata.msPDFVersion = getPDFVersionStr(m_aContext.Version);
 lcl_assignMeta(m_aContext.DocumentInfo.Keywords, aMetadata.msKeywords);
 lcl_assignMeta(m_aContext.DocumentInfo.Creator, 
aMetadata.m_sCreatorTool);
 aMetadata.m_sCreateDate = m_aCreationMetaDateString;
diff --git a/vcl/source/pdf/XmpMetadata.cxx b/vcl/source/pdf/XmpMetadata.cxx
index 7b0df42dbb92..6dae3b86ebc1 100644
--- a/vcl/source/pdf/XmpMetadata.cxx
+++ b/vcl/source/pdf/XmpMetadata.cxx
@@ -122,7 +122,7 @@ void XmpMetadata::write()
 }
 
 // PDF properties
-if (!msProducer.isEmpty() || !msKeywords.isEmpty())
+if (!msProducer.isEmpty() || !msKeywords.isEmpty() || 
!msPDFVersion.isEmpty())
 {
 aXmlWriter.startElement("rdf:Description");
 aXmlWriter.attribute("rdf:about", OString(""));
@@ -139,6 +139,12 @@ void XmpMetadata::write()
 aXmlWriter.content(msKeywords);
 aXmlWriter.endElement();
 }
+if (!msPDFVersion.isEmpty())
+{
+aXmlWriter.startElement("pdf:PDFVersion");
+aXmlWriter.content(msPDFVersion);
+aXmlWriter.endElement();
+}
 aXmlWriter.endElement();
 }
 


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

2023-08-29 Thread Szymon Kłos (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |2 
 vcl/jsdialog/executor.cxx|7 +++
 vcl/jsdialog/jsdialogbuilder.cxx |   75 +++
 3 files changed, 59 insertions(+), 25 deletions(-)

New commits:
commit af0f610f90b315c20773c39579b70fb6e456412b
Author: Szymon Kłos 
AuthorDate: Tue Aug 8 06:56:14 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Aug 29 13:51:45 2023 +0200

jsdialog: rendering of custom entries in combobox

Change-Id: I22cca2e89c38d927a21a39886b795f42c1546afc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155854
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Caolán McNamara 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156243
Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index e4aa60558438..dc6e04c3eb4e 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -620,6 +620,8 @@ public:
 virtual void set_entry_text(const OUString& rText) override;
 virtual void set_active(int pos) override;
 virtual bool changed_by_direct_pick() const override;
+
+void render_entry(int pos);
 };
 
 class JSNotebook final : public JSWidget
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 25e1af80b324..57a1c4db22d8 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -129,6 +129,13 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 LOKTrigger::trigger_changed(*pCombobox);
 return true;
 }
+else if (sAction == "render_entry")
+{
+auto pJSCombobox = dynamic_cast(pWidget);
+if (pJSCombobox)
+
pJSCombobox->render_entry(o3tl::toInt32(rData["data"]));
+return true;
+}
 }
 }
 else if (sControlType == "pushbutton")
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 34b28184cc16..40f014d7cdc5 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -7,25 +7,35 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include 
+
+#include 
+#include 
+#include 
+
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
+
+#include 
+#include 
+
 #include 
+
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
+#include 
+
+#include 
 #include 
 
 static std::map& GetLOKPopupsMap()
@@ -95,17 +105,6 @@ void JSDialogNotifyIdle::send(tools::JsonWriter& 
aJsonWriter)
 }
 }
 
-namespace
-{
-OUString extractActionType(const jsdialog::ActionDataMap& rData)
-{
-auto it = rData.find(ACTION_TYPE);
-if (it != rData.end())
-return it->second;
-return "";
-}
-};
-
 void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType eType, 
VclPtr pWindow,
  std::unique_ptr 
pData)
 {
@@ -119,8 +118,8 @@ void JSDialogNotifyIdle::sendMessage(jsdialog::MessageType 
eType, VclPtrm_eType == eType && it->m_pWindow == pWindow)
 {
-if (it->m_pData && pData
-&& extractActionType(*it->m_pData) != 
extractActionType(*pData))
+// actions should be always sent, eg. renrering of custom entries 
in combobox
+if (eType == jsdialog::MessageType::Action)
 {
 it++;
 continue;
@@ -1662,6 +1661,32 @@ void JSComboBox::set_active(int pos)
 
 bool JSComboBox::changed_by_direct_pick() const { return true; }
 
+void JSComboBox::render_entry(int pos)
+{
+ScopedVclPtrInstance pDevice;
+Size aRenderSize = signal_custom_get_size(*pDevice);
+pDevice->SetOutputSize(aRenderSize);
+
+signal_custom_render(*pDevice, tools::Rectangle(Point(0, 0), aRenderSize), 
false, get_id(pos));
+
+BitmapEx aImage = pDevice->GetBitmapEx(Point(0, 0), aRenderSize);
+
+SvMemoryStream aOStm(65535, 65535);
+if (GraphicConverter::Export(aOStm, aImage, ConvertDataFormat::PNG) == 
ERRCODE_NONE)
+{
+css::uno::Sequence aSeq(static_cast(aOStm.GetData()),
+  aOStm.Tell());
+OUStringBuffer aBuffer("data:image/png;base64,");
+::comphelper::Base64::encode(aBuffer, aSeq);
+
+std::unique_ptr pMap = 
std::make_unique();
+(*pMap)[ACTION_TYPE] = "rendered_combobox_entry";
+(*pMap)["pos"] = OUString::number(pos);
+(*pMap)["image"] = aBuffer;
+sendAction(std::move(pMap));
+}
+}
+
 JSNotebook::JSNotebook(JSDialogSender* pSender, ::TabControl* pControl,
SalInstanceBuilder* pBuilder, bool bTakeOwnership)
 : 

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

2023-08-28 Thread Szymon Kłos (via logerrit)
 vcl/inc/verticaltabctrl.hxx   |4 +++
 vcl/source/control/ivctrl.cxx |   44 ++
 2 files changed, 48 insertions(+)

New commits:
commit 407297d9c592479d9fc90033876cad96206f9259
Author: Szymon Kłos 
AuthorDate: Thu Aug 17 10:21:57 2023 +0200
Commit: Szymon Kłos 
CommitDate: Mon Aug 28 10:19:03 2023 +0200

jsdialog: dump vertical tab control

Change-Id: I673199dfd7e95bfdb748791db094e7a1c3e74dba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155759
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Attila Szűcs 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156158
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx
index df05cfdf72b5..c5942799b381 100644
--- a/vcl/inc/verticaltabctrl.hxx
+++ b/vcl/inc/verticaltabctrl.hxx
@@ -22,6 +22,8 @@
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -78,6 +80,8 @@ public:
 
 vcl::Window* GetPageParent() { return m_xBox.get(); }
 
+virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override;
+
 virtual FactoryFunction GetUITestFactory() const override;
 };
 
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index 8a7e111f1581..a2f502ff81dc 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -627,6 +627,50 @@ void VerticalTabControl::SetPageText(std::u16string_view 
rPageId, const OUString
 pData->pEntry->SetText(rText);
 }
 
+void VerticalTabControl::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+rJsonWriter.put("id", get_id());
+rJsonWriter.put("type", "tabcontrol");
+rJsonWriter.put("vertical", true);
+rJsonWriter.put("selected", GetCurPageId());
+
+{
+auto childrenNode = rJsonWriter.startArray("children");
+for (int i = 0; i < GetPageCount(); i++)
+{
+VclPtr pChild = GetPage(GetPageId(i));
+
+if (pChild)
+{
+if (!pChild->GetChildCount())
+continue;
+
+auto aChildNode = rJsonWriter.startStruct();
+pChild->DumpAsPropertyTree(rJsonWriter);
+}
+}
+}
+{
+auto tabsNode = rJsonWriter.startArray("tabs");
+for(int i = 0; i < GetPageCount(); i++)
+{
+VclPtr pChild = GetPage(GetPageId(i));
+
+if (pChild)
+{
+if (!pChild->GetChildCount())
+continue;
+
+auto aTabNode = rJsonWriter.startStruct();
+auto sId = GetPageId(i);
+rJsonWriter.put("text", GetPageText(sId));
+rJsonWriter.put("id", sId);
+rJsonWriter.put("name", GetPageText(sId));
+}
+}
+}
+}
+
 FactoryFunction VerticalTabControl::GetUITestFactory() const
 {
 return VerticalTabControlUIObject::create;


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

2023-08-26 Thread Noel Grandin (via logerrit)
 vcl/inc/svdata.hxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 61a308be8d7e2a578054c3d6d540873eecc88145
Author: Noel Grandin 
AuthorDate: Wed Aug 23 19:15:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Aug 26 08:18:30 2023 +0200

tsan: use std::atomic for mbAppQuit

which is (IMO) the same as using volatile, but seems to make tsan
happier

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

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 44ed38f2eb9d..104b9543b74a 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -47,6 +47,7 @@
 #include "windowdev.hxx"
 #include "displayconnectiondispatch.hxx"
 
+#include 
 #include 
 #include 
 #include 
@@ -165,7 +166,7 @@ struct ImplSVAppData
 SystemWindowFlags   mnSysWinMode = SystemWindowFlags(0); // Mode, when 
SystemWindows should be created
 boolmbInAppMain = false;// is 
Application::Main() on stack
 boolmbInAppExecute = false; // is 
Application::Execute() on stack
-volatile bool   mbAppQuit = false;  // is 
Application::Quit() called, volatile because we read/write from different 
threads
+std::atomic   mbAppQuit = false;  // is 
Application::Quit() called, volatile because we read/write from different 
threads
 boolmbSettingsInit = false; // true: Settings 
are initialized
 DialogCancelMode meDialogCancel = DialogCancelMode::Off; // true: All 
Dialog::Execute() calls will be terminated immediately with return false
 bool mbRenderToBitmaps = false; // set via svp / headless plugin


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

2023-08-23 Thread Miklos Vajna (via logerrit)
 vcl/inc/unx/gtk/gtkframe.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3f92b781400c47ead0fa535d19ec33e6273be2ab
Author: Miklos Vajna 
AuthorDate: Wed Aug 23 09:50:57 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Aug 23 11:51:21 2023 +0200

vcl: fix gtk4 build

See

.

Change-Id: Ibee5c4973a1ea80515742852385e97718b10a260
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155965
Reviewed-by: Julien Nabet 
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index abbe36807bbc..5fbf4413105c 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -250,7 +250,7 @@ class GtkSalFrame final : public SalFrame
 static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer );
 static void signalStyleUpdated(GtkWidget*, gpointer);
 #else
-static void signalStyleUpdated(GtkWidget*, const gchar* pSetting, 
pointer);
+static void signalStyleUpdated(GtkWidget*, const gchar* pSetting, 
gpointer);
 #endif
 void DrawingAreaResized(GtkWidget* pWidget, int nWidth, int nHeight);
 void DrawingAreaDraw(cairo_t *cr);


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

2023-08-22 Thread Deepika Goyal (via logerrit)
 vcl/inc/unx/gtk/atkbridge.hxx  |5 +
 vcl/inc/unx/gtk/gtkbackend.hxx |5 +
 vcl/inc/unx/gtk/gtkdata.hxx|4 +---
 vcl/inc/unx/gtk/gtkframe.hxx   |4 +---
 vcl/inc/unx/gtk/gtkgdi.hxx |4 +---
 5 files changed, 5 insertions(+), 17 deletions(-)

New commits:
commit 3297c1912f40450f92b67ad592ac255e1cd21749
Author: Deepika Goyal 
AuthorDate: Thu Aug 17 18:06:43 2023 +0400
Commit: Julien Nabet 
CommitDate: Tue Aug 22 14:13:49 2023 +0200

tdf#143148 Use pragma once in vcl

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

diff --git a/vcl/inc/unx/gtk/atkbridge.hxx b/vcl/inc/unx/gtk/atkbridge.hxx
index 49c422dacfbd..19e37baab5cf 100644
--- a/vcl/inc/unx/gtk/atkbridge.hxx
+++ b/vcl/inc/unx/gtk/atkbridge.hxx
@@ -17,14 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_GTK_ATKBRIDGE_HXX
-#define INCLUDED_VCL_INC_UNX_GTK_ATKBRIDGE_HXX
+#pragma once
 
 #include 
 
 bool InitAtkBridge();
 void DeInitAtkBridge();
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkbackend.hxx b/vcl/inc/unx/gtk/gtkbackend.hxx
index 03b2e021313b..1317ad6f72b1 100644
--- a/vcl/inc/unx/gtk/gtkbackend.hxx
+++ b/vcl/inc/unx/gtk/gtkbackend.hxx
@@ -7,8 +7,7 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX
-#define INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX
+#pragma once
 
 #include 
 #if defined(GDK_WINDOWING_X11)
@@ -28,6 +27,4 @@ bool DLSYM_GDK_IS_X11_DISPLAY(GdkDisplay* pDisplay);
 bool DLSYM_GDK_IS_WAYLAND_DISPLAY(GdkDisplay* pDisplay);
 #endif
 
-#endif // INCLUDED_VCL_INC_UNX_GTK_GTKBACKEND_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx
index 04c1485963f5..704490e821d4 100644
--- a/vcl/inc/unx/gtk/gtkdata.hxx
+++ b/vcl/inc/unx/gtk/gtkdata.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
-#define INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
+#pragma once
 
 #define GLIB_DISABLE_DEPRECATION_WARNINGS
 #include 
@@ -364,6 +363,5 @@ GtkSalDisplay *GtkSalData::GetGtkDisplay() const
 return static_cast(GetDisplay());
 }
 
-#endif // INCLUDED_VCL_INC_UNX_GTK_GTKDATA_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index be9a6a2dda83..abbe36807bbc 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
-#define INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
+#pragma once
 
 #include 
 #include 
@@ -691,6 +690,5 @@ enum GdkAnchorHints
 };
 #endif
 
-#endif // INCLUDED_VCL_INC_UNX_GTK_GTKFRAME_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index 2fc66ace5ece..9d8bb26ce787 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
-#define INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
+#pragma once
 
 #include 
 
@@ -242,6 +241,5 @@ private:
 static bool style_loaded;
 };
 
-#endif // INCLUDED_VCL_INC_UNX_GTK_GTKGDI_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-08-19 Thread Patrick Luby (via logerrit)
 vcl/inc/skia/salbmp.hxx |1 +
 vcl/skia/salbmp.cxx |   39 +++
 2 files changed, 32 insertions(+), 8 deletions(-)

New commits:
commit 5baac4e53128d3c0fc73b9918dc9a9c2777ace08
Author: Patrick Luby 
AuthorDate: Fri Aug 18 15:14:18 2023 -0400
Commit: Patrick Luby 
CommitDate: Sat Aug 19 15:59:14 2023 +0200

Reimplement fix for tdf#156629 and tdf#156630

Reimplement fix in commit 926c5246b6694d469a6caed5d7ea4c3a68648468
in an attempt to reduce the fix's performance hit. Instead of
invoking EnsureBitmapData() and converting the SkImage to a
memory buffer, any pending scaling on alpha masks is handled by
creating a new, scaled SkImage.

Note that in commit 926c5246b6694d469a6caed5d7ea4c3a68648468,
EnsureBitmapData() was invoked which converted the SkImage to a
memory buffer. That in turn would make Invert() a noop which
fixed the related bug where an image has been opened and, before
it has been printed or run in a slideshow, the alpha mask would
unexpectedly be inverted. So keep this immutable behavior without
calling EnsureBitmapData() by adding a new mutability flag.

Change-Id: I99dc272b40c53664ea49333402a6a637b1548a5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155850
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 3c8b1a964806..c42aa30f4654 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -211,6 +211,7 @@ private:
 boost::shared_ptr mBuffer;
 int mScanlineSize; // size of one row in mBuffer (based on mPixelsSize)
 sk_sp mImage; // possibly GPU-backed
+bool mImageImmutable = false;
 sk_sp mAlphaImage; // cached contents as alpha image, possibly 
GPU-backed
 // Actual scaling triggered by scale() is done on-demand. This is the size 
of the pixel
 // data in mBuffer, if it differs from mSize, then there is a scaling 
operation pending.
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index eac913671384..2aa9a0a69cee 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -164,6 +164,7 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, 
vcl::PixelFormat eNewPixelF
 ResetAllData();
 const SkiaSalBitmap& src = static_cast(rSalBmp);
 mImage = src.mImage;
+mImageImmutable = src.mImageImmutable;
 mAlphaImage = src.mAlphaImage;
 mBuffer = src.mBuffer;
 mPalette = src.mPalette;
@@ -224,7 +225,7 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode 
nMode)
 assert(!mEraseColorSet);
 break;
 case BitmapAccessMode::Info:
-// Related tdf#156630 and tdf#156629 force snapshot of alpha mask
+// Related tdf#156629 and tdf#156630 force snapshot of alpha mask
 // On macOS, with Skia/Metal or Skia/Raster with a Retina display
 // (i.e. 2.0 window scale), the alpha mask gets upscaled in certain
 // cases.
@@ -236,9 +237,24 @@ BitmapBuffer* 
SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
 // fail:
 //   https://bugs.documentfoundation.org/attachment.cgi?id=188792
 static const bool bForceHiDPIScaling = 
getenv("SAL_FORCE_HIDPI_SCALING") != nullptr;
-if (mPixelsSize != mSize || (bForceHiDPIScaling && mImage))
-EnsureBitmapData();
-assert(mPixelsSize == mSize);
+if (mImage && !mImageImmutable && mBitCount == 8 && 
mPalette.IsGreyPalette8Bit()
+&& (mPixelsSize != mSize || bForceHiDPIScaling))
+{
+ResetToSkImage(GetSkImage());
+ResetPendingScaling();
+assert(mPixelsSize == mSize);
+
+// When many of the images affected by tdf#156629 and
+// tdf#156630 are exported to PDF the first time after the
+// image has been opened and before it has been printed or run
+// in a slideshow, the alpha mask will unexpectedly be
+// inverted. Fix that by marking this alpha mask as immutable
+// so that when Invert() is called on this alpha mask, it will
+// be a noop. Invert() is a noop after EnsureBitmapData() is
+// called but we don't want to call that due to performance
+// so set a flag instead.
+mImageImmutable = true;
+}
 break;
 }
 #ifdef DBG_UTIL
@@ -653,17 +669,18 @@ bool SkiaSalBitmap::Invert()
 // Normally this would need to convert contents of mBuffer for all 
possible formats,
 // so just let the VCL algorithm do it.
 // Avoid the costly SkImage->buffer->SkImage conversion.
-if (!mBuffer && mImage && !mEraseColorSet)
+if (!mBuffer && mImage && !mImageImmutable && !mEraseColorSet)
 {
 // This is 8-bit bitmap serving as alpha/transparency/mask, so the 
image 

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

2023-08-16 Thread Mike Kaganski (via logerrit)
 vcl/inc/win/wincomp.hxx |   50 
 vcl/win/window/salframe.cxx |9 ---
 2 files changed, 59 deletions(-)

New commits:
commit ee52f20ec727e5c296cc5d8f4c2a25f1414eb0fe
Author: Mike Kaganski 
AuthorDate: Thu Aug 17 00:43:12 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Aug 17 06:53:40 2023 +0200

Drop defines obsoleted by Windows 7 baseline

I.e., those that are guarded in Windows headers by stuff like

  #if(_WIN32_WINNT >= 0x0600)
  #if(WINVER >= 0x0501)

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

diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx
index 6f5b0ebc4cdd..4383bc5b77cc 100644
--- a/vcl/inc/win/wincomp.hxx
+++ b/vcl/inc/win/wincomp.hxx
@@ -178,54 +178,4 @@ inline HINSTANCE GetWindowInstance( HWND hWnd )
 
 #define MSH_SCROLL_LINES L"MSH_SCROLL_LINES_MSG"
 
-#ifndef WHEEL_DELTA
-#define WHEEL_DELTA 120
-#endif
-#ifndef WM_MOUSEWHEEL
-#define WM_MOUSEWHEEL   0x020A
-#endif
-#ifndef SPI_GETWHEELSCROLLLINES
-#define SPI_GETWHEELSCROLLLINES 104
-#endif
-#ifndef SPI_SETWHEELSCROLLLINES
-#define SPI_SETWHEELSCROLLLINES 105
-#endif
-#ifndef WHEEL_PAGESCROLL
-#define WHEEL_PAGESCROLL(UINT_MAX)
-#endif
-
-
-// - 5.0 extensions -
-
-#ifndef COLOR_GRADIENTACTIVECAPTION
-#define COLOR_GRADIENTACTIVECAPTION 27
-#endif
-#ifndef COLOR_GRADIENTINACTIVECAPTION
-#define COLOR_GRADIENTINACTIVECAPTION   28
-#endif
-
-#ifndef SPI_GETFLATMENU
-#define SPI_GETFLATMENU 0x1022
-#endif
-#ifndef COLOR_MENUBAR
-#define COLOR_MENUBAR   30
-#endif
-#ifndef COLOR_MENUHILIGHT
-#define COLOR_MENUHILIGHT   29
-#endif
-
-#ifndef CS_DROPSHADOW
-#define CS_DROPSHADOW   0x0002
-#endif
-
-// MT 12/03: From winuser.h, only needed in salframe.cxx
-// Better change salframe.cxx to include winuser.h
-
-#define WS_EX_LAYERED   0x0008
-
-#ifndef WM_UNICHAR
-#define WM_UNICHAR  0x0109
-#define UNICODE_NOCHAR  0x
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index c7c0bdd4f328..7ebe68077ec2 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -108,15 +108,6 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::container;
 using namespace ::com::sun::star::beans;
 
-#ifndef SPI_GETWHEELSCROLLCHARS
-# define SPI_GETWHEELSCROLLCHARS   0x006C
-#endif
-#ifndef SPI_SETWHEELSCROLLCHARS
-# define SPI_SETWHEELSCROLLCHARS   0x006D
-#endif
-#ifndef WM_MOUSEHWHEEL
-# define WM_MOUSEHWHEEL 0x020E
-#endif
 #ifndef IDC_PEN
 # define IDC_PEN MAKEINTRESOURCE(32631)
 #endif


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

2023-08-14 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtWidget.hxx |2 +
 vcl/qt5/QtWidget.cxx |   55 ++-
 2 files changed, 56 insertions(+), 1 deletion(-)

New commits:
commit efadd5210e56ba67f1b040dff4972fead6a56131
Author: Michael Weghorn 
AuthorDate: Mon Aug 14 08:10:21 2023 +0200
Commit: Michael Weghorn 
CommitDate: Mon Aug 14 10:07:46 2023 +0200

qt: Implement pinch/zoom gesture handling

Subscribe to receive pinch gestures by calling
`QWidget::grabGesture(Qt::PinchGesture)` and
forward that as the corresponding `SalGestureZoomEvent`.

From looking at what values the gtk implementation uses,
`1 + pPinchGesture->totalScaleFactor()` seems to be a
proper choice for the
`SalGestureZoomEvent::mfScaleDelta` value.

With this in place, zooming in and out of a Writer
document with a two-finger zoom gesture works for
me with the Qt-based VCL plugins in Writer on my laptop
that has a touch screen.
(It seems to be a bit more smooth with qt5/kf5 than
with qt6, where doing several zoom gestures after
each other sometimes requires to wait a bit before
doing another gesture in order for that one to be
processed properly.)

Qt documentation for gestures: [1]

Corresponding commit for gtk VCL plugins:

commit f2bd19f6720239db228cd4388be8e928505c51b6
Author: Povilas Kanapickas 
Date:   Thu Aug 25 00:18:30 2022 +0300

vcl: implement touchpad zoom gesture support on gtk backend

[1] https://doc.qt.io/qt-6/gestures-overview.html

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

diff --git a/vcl/inc/qt5/QtWidget.hxx b/vcl/inc/qt5/QtWidget.hxx
index e61357198027..ca0165401e15 100644
--- a/vcl/inc/qt5/QtWidget.hxx
+++ b/vcl/inc/qt5/QtWidget.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 #include 
 
@@ -45,6 +46,7 @@ class QtWidget : public QWidget
 static void commitText(QtFrame&, const QString& aText);
 static void deleteReplacementText(QtFrame& rFrame, int nReplacementStart,
   int nReplacementLength);
+static bool handleGestureEvent(QtFrame& rFrame, QGestureEvent* 
pGestureEvent);
 static bool handleKeyEvent(QtFrame&, const QWidget&, QKeyEvent*);
 static void handleMouseEnterLeaveEvents(const QtFrame&, QEvent*);
 static void fillSalAbstractMouseEvent(const QtFrame& rFrame, const 
QInputEvent* pQEvent,
diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx
index 83ada7866f2b..5e7d1d56c464 100644
--- a/vcl/qt5/QtWidget.cxx
+++ b/vcl/qt5/QtWidget.cxx
@@ -516,6 +516,52 @@ void QtWidget::deleteReplacementText(QtFrame& rFrame, int 
nReplacementStart, int
 rFrame.CallCallback(SalEvent::DeleteSurroundingTextRequest, );
 }
 
+bool QtWidget::handleGestureEvent(QtFrame& rFrame, QGestureEvent* 
pGestureEvent)
+{
+if (QGesture* pGesture = pGestureEvent->gesture(Qt::PinchGesture))
+{
+if (!pGesture->hasHotSpot())
+{
+pGestureEvent->ignore();
+return false;
+}
+
+GestureEventZoomType eType = GestureEventZoomType::Begin;
+switch (pGesture->state())
+{
+case Qt::GestureStarted:
+eType = GestureEventZoomType::Begin;
+break;
+case Qt::GestureUpdated:
+eType = GestureEventZoomType::Update;
+break;
+case Qt::GestureFinished:
+eType = GestureEventZoomType::End;
+break;
+case Qt::NoGesture:
+case Qt::GestureCanceled:
+default:
+SAL_WARN("vcl.qt", "Unhandled pinch gesture state: " << 
pGesture->state());
+pGestureEvent->ignore();
+return false;
+}
+
+QPinchGesture* pPinchGesture = static_cast(pGesture);
+const QPointF aHotspot = pGesture->hotSpot();
+SalGestureZoomEvent aEvent;
+aEvent.meEventType = eType;
+aEvent.mnX = aHotspot.x();
+aEvent.mnY = aHotspot.y();
+aEvent.mfScaleDelta = 1 + pPinchGesture->totalScaleFactor();
+rFrame.CallCallback(SalEvent::GestureZoom, );
+pGestureEvent->accept();
+return true;
+}
+
+pGestureEvent->ignore();
+return false;
+}
+
 bool QtWidget::handleKeyEvent(QtFrame& rFrame, const QWidget& rWidget, 
QKeyEvent* pEvent)
 {
 const bool bIsKeyPressed
@@ -632,7 +678,12 @@ bool QtWidget::handleKeyEvent(QtFrame& rFrame, const 
QWidget& rWidget, QKeyEvent
 
 bool QtWidget::handleEvent(QtFrame& rFrame, QWidget& rWidget, QEvent* pEvent)
 {
-if (pEvent->type() == QEvent::ShortcutOverride)
+if (pEvent->type() == QEvent::Gesture)
+{
+QGestureEvent* pGestureEvent = static_cast(pEvent);
+return handleGestureEvent(rFrame, 

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

2023-08-10 Thread Mike Kaganski (via logerrit)
 vcl/inc/pdf/pdfcompat.hxx  |2 +-
 vcl/source/filter/ipdf/pdfread.cxx |   12 
 2 files changed, 5 insertions(+), 9 deletions(-)

New commits:
commit 0d8a5f89bff51480d721395729a67e7b4260aea5
Author: Mike Kaganski 
AuthorDate: Thu Aug 10 10:32:21 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Aug 10 12:58:54 2023 +0200

Simplify conversion, and fix a comment

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

diff --git a/vcl/inc/pdf/pdfcompat.hxx b/vcl/inc/pdf/pdfcompat.hxx
index 8f629b3bc8ee..5d6d623a107e 100644
--- a/vcl/inc/pdf/pdfcompat.hxx
+++ b/vcl/inc/pdf/pdfcompat.hxx
@@ -17,7 +17,7 @@
 
 namespace vcl::pdf
 {
-/// Convert to inch, then assume 96 DPI.
+/// Convert to inch, then apply custom resolution.
 inline double pointToPixel(const double fPoint, const double fResolutionDPI)
 {
 return o3tl::convert(fPoint, o3tl::Length::pt, o3tl::Length::in) * 
fResolutionDPI;
diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index 18f8c4dee95e..8dc4c967a616 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -368,14 +368,10 @@ size_t ImportPDFUnloaded(const OUString& rURL, 
std::vector& rG
 if (aPageSize.getWidth() <= 0.0 || aPageSize.getHeight() <= 0.0)
 continue;
 
-// Returned unit is points, convert that to twip
-// 1 pt = 20 twips
-constexpr double pointToTwipconversionRatio = 20;
-
-tools::Long nPageWidth
-= convertTwipToMm100(aPageSize.getWidth() * 
pointToTwipconversionRatio);
-tools::Long nPageHeight
-= convertTwipToMm100(aPageSize.getHeight() * 
pointToTwipconversionRatio);
+// Returned unit is points
+
+tools::Long nPageWidth = 
std::round(convertPointToMm100(aPageSize.getWidth()));
+tools::Long nPageHeight = 
std::round(convertPointToMm100(aPageSize.getHeight()));
 
 // Create the Graphic with the VectorGraphicDataPtr and link the 
original PDF stream.
 // We swap out this Graphic as soon as possible, and a later swap in


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

2023-08-02 Thread Khaled Hosny (via logerrit)
 vcl/inc/unx/fontmanager.hxx |2 
 vcl/unx/generic/fontmanager/fontmanager.cxx |   68 ++--
 2 files changed, 15 insertions(+), 55 deletions(-)

New commits:
commit 790ccec0bdb65adca32e7cde6d1b42c59ca6d567
Author: Khaled Hosny 
AuthorDate: Tue Aug 1 17:45:53 2023 +
Commit: خالد حسني 
CommitDate: Wed Aug 2 11:58:10 2023 +0200

vcl: Simplify analyzeSfntFamilyName

We only need a family name not a set of name, and drop a work around for
a broken font that is probably long obsolete.

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

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index a81975f21931..1a1421aef77a 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -92,8 +92,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 OString getFontFile(const PrintFont& rFont) const;
 
 std::vector analyzeFontFile(int nDirID, const OString& 
rFileName, const char *pFormat=nullptr) const;
-static OUString convertSfntName( const vcl::NameRecord& rNameRecord ); // 
format font subsetting code
-static void analyzeSfntFamilyName( void const * pTTFont, std::vector< 
OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code
 bool analyzeSfntFile(PrintFont& rFont) const;
 // finds the font id for the nFaceIndex face in this font file
 // There may be multiple font ids for font collections
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index a3d77c6ae99e..c60495d5b905 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -287,7 +287,9 @@ std::vector PrintFontManager::findFontFileIDs( int 
nDirID, const OString
 return aIds;
 }
 
-OUString PrintFontManager::convertSfntName( const NameRecord& rNameRecord )
+namespace {
+
+OUString convertSfntName( const NameRecord& rNameRecord )
 {
 OUString aValue;
 if(
@@ -413,36 +415,10 @@ OUString PrintFontManager::convertSfntName( const 
NameRecord& rNameRecord )
 return aValue;
 }
 
-//fdo#33349.There exists an archaic Berling Antiqua font which has a "Times New
-//Roman" name field in it. We don't want the "Times New Roman" name to take
-//precedence in this case. We take Berling Antiqua as a higher priority name,
-//and erase the "Times New Roman" name
-namespace
-{
-bool isBadTNR(std::u16string_view rName, ::std::set< OUString >& rSet)
-{
-bool bRet = false;
-if ( rName == u"Berling Antiqua" )
-{
-::std::set< OUString >::iterator aEnd = rSet.end();
-::std::set< OUString >::iterator aI = rSet.find("Times New Roman");
-if (aI != aEnd)
-{
-bRet = true;
-rSet.erase(aI);
-}
-}
-return bRet;
-}
-}
-
-void PrintFontManager::analyzeSfntFamilyName( void const * pTTFont, 
::std::vector< OUString >& rNames )
+OUString analyzeSfntFamilyName(void const * pTTFont)
 {
 OUString aFamily;
 
-rNames.clear();
-::std::set< OUString > aSet;
-
 std::vector aNameRecords;
 GetTTNameRecords( static_cast(pTTFont), aNameRecords 
);
 if( !aNameRecords.empty() )
@@ -482,23 +458,17 @@ void PrintFontManager::analyzeSfntFamilyName( void const 
* pTTFont, ::std::vecto
 nMatch = 1000;
 }
 OUString aName = convertSfntName( aNameRecords[i] );
-aSet.insert( aName );
-if (aName.isEmpty())
-continue;
-if( nMatch > nLastMatch || isBadTNR(aName, aSet) )
+if (!(aName.isEmpty()) && nMatch > nLastMatch)
 {
 nLastMatch = nMatch;
 aFamily = aName;
 }
 }
 }
-if( !aFamily.isEmpty() )
-{
-rNames.push_back( aFamily );
-for (auto const& elem : aSet)
-if( elem != aFamily )
-rNames.push_back(elem);
-}
+
+return aFamily;
+}
+
 }
 
 bool PrintFontManager::analyzeSfntFile( PrintFont& rFont ) const
@@ -519,26 +489,18 @@ bool PrintFontManager::analyzeSfntFile( PrintFont& rFont 
) const
 
 if (rDFA.GetFamilyName().isEmpty())
 {
-::std::vector< OUString > aNames;
-analyzeSfntFamilyName( pTTFont, aNames );
-
-if( !aNames.empty() )
+OUString aFamily = analyzeSfntFamilyName(pTTFont);
+if (aFamily.isEmpty())
 {
-rDFA.SetFamilyName(aNames.front());
-aNames.erase(aNames.begin());
-}
-else
-{
- sal_Int32   dotIndex;
-
  // poor font does not have a family name
  // name it to file name minus the extension
- dotIndex = 

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

2023-08-02 Thread Noel Grandin (via logerrit)
 vcl/inc/unx/fontmanager.hxx |3 ++-
 vcl/unx/generic/fontmanager/fontmanager.cxx |6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 39a6740b9b8ebea2cb169392a1cce95bf0633f6e
Author: Noel Grandin 
AuthorDate: Tue Aug 1 19:10:04 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 2 08:12:44 2023 +0200

std::set->o3tl::sorted_vector for m_aFontFileToFontID

sorted_vector is perfect for small sets of small objects, and
fontId is an int.

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

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 89bf5508879b..21a8d00aa415 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -115,7 +116,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 fontID  m_nNextFontID;
 std::unordered_map< fontID, PrintFont > m_aFonts;
 // for speeding up findFontFileID
-std::unordered_map< OString, std::set< fontID > >
+std::unordered_map< OString, o3tl::sorted_vector< fontID > >
 m_aFontFileToFontID;
 
 std::unordered_map< OString, int >
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 1927071bb802..748017252987 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -247,11 +247,11 @@ fontID PrintFontManager::findFontFileID(int nDirID, const 
OString& rFontFile, in
 {
 fontID nID = 0;
 
-std::unordered_map< OString, ::std::set< fontID > >::const_iterator set_it 
= m_aFontFileToFontID.find( rFontFile );
+auto set_it = m_aFontFileToFontID.find( rFontFile );
 if( set_it == m_aFontFileToFontID.end() )
 return nID;
 
-for (auto const& elem : set_it->second)
+for (fontID elem : set_it->second)
 {
 auto it = m_aFonts.find(elem);
 if( it == m_aFonts.end() )
@@ -275,7 +275,7 @@ std::vector PrintFontManager::findFontFileIDs( int 
nDirID, const OString
 {
 std::vector aIds;
 
-std::unordered_map< OString, ::std::set< fontID > >::const_iterator set_it 
= m_aFontFileToFontID.find( rFontFile );
+auto set_it = m_aFontFileToFontID.find( rFontFile );
 if( set_it == m_aFontFileToFontID.end() )
 return aIds;
 


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

2023-08-01 Thread Andrea Gelmini (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 27701d49327f8303ec1791f1b3fa4661b0480ac9
Author: Andrea Gelmini 
AuthorDate: Tue Aug 1 15:27:12 2023 +0200
Commit: Julien Nabet 
CommitDate: Tue Aug 1 18:36:53 2023 +0200

Fix typo

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

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index bd704507f69c..ffc00d402950 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -68,7 +68,7 @@ private:
 QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& 
rToolTip, int nId);
 void ImplRemoveMenuBarButton(int nId);
 void connectHelpShortcut(QMenu* pMenu);
-// set slots that handle signals relevent for help menu
+// set slots that handle signals relevant for help menu
 void connectHelpSignalSlots(QMenu* pMenu, QtMenuItem* pSalMenuItem);
 
 public:


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

2023-08-01 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |8 
 vcl/qt5/QtMenu.cxx |   48 
 2 files changed, 56 insertions(+)

New commits:
commit 2ef9880f97de6629ddef12eb788123ab4be1ec83
Author: Michael Weghorn 
AuthorDate: Sun Jul 30 01:59:31 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue Aug 1 08:21:22 2023 +0200

tdf#156376 qt: Open help for focused native menu entry on F1

In order to allow have pressing F1 (`QKeySequence::HelpContents`)
open the corresponding help entry for the currently selected
menu entry, connect to the signal that gets emitted when
a menu entry is selected (`QAction::hovered`) and remember
its help ID. Register the F1 shortcut for the menu
and connect its `activated`/`activatedAmbiguously`
signal with a slot that opens the help for the current/
last selected menu entry.

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

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index 3e43272b6212..bd704507f69c 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -53,6 +53,9 @@ private:
 QMenu* mpQMenu;
 QButtonGroup* m_pButtonGroup;
 
+// help ID of currently/last selected item
+static OUString m_sCurrentHelpId;
+
 void DoFullMenuUpdate(Menu* pMenuBar);
 static void NativeItemText(OUString& rItemText);
 
@@ -64,6 +67,9 @@ private:
 bool validateQMenuBar() const;
 QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& 
rToolTip, int nId);
 void ImplRemoveMenuBarButton(int nId);
+void connectHelpShortcut(QMenu* pMenu);
+// set slots that handle signals relevent for help menu
+void connectHelpSignalSlots(QMenu* pMenu, QtMenuItem* pSalMenuItem);
 
 public:
 QtMenu(bool bMenuBar);
@@ -102,6 +108,8 @@ public:
 QtMenuItem* GetItemAtPos(unsigned nPos) { return maItems[nPos]; }
 
 private slots:
+static void slotShowHelp();
+static void slotMenuHovered(QtMenuItem* pItem);
 static void slotMenuTriggered(QtMenuItem* pQItem);
 static void slotMenuAboutToShow(QtMenuItem* pQItem);
 static void slotMenuAboutToHide(QtMenuItem* pQItem);
diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx
index b976fa3f5739..b1e62bc09475 100644
--- a/vcl/qt5/QtMenu.cxx
+++ b/vcl/qt5/QtMenu.cxx
@@ -24,6 +24,11 @@
 #include 
 #include 
 #include 
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#include 
+#else
+#include 
+#endif
 #include 
 
 #include 
@@ -48,6 +53,8 @@ static inline void lcl_force_menubar_layout_update(QMenuBar& 
rMenuBar)
 rMenuBar.adjustSize();
 }
 
+OUString QtMenu::m_sCurrentHelpId = u"";
+
 QtMenu::QtMenu(bool bMenuBar)
 : mpVCLMenu(nullptr)
 , mpParentSalMenu(nullptr)
@@ -77,6 +84,7 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem, 
unsigned nPos)
 if (validateQMenuBar())
 {
 QMenu* pQMenu = new QMenu(toQString(aText), nullptr);
+connectHelpSignalSlots(pQMenu, pSalMenuItem);
 pSalMenuItem->mpMenu.reset(pQMenu);
 
 if ((nPos != MENU_APPEND)
@@ -108,12 +116,14 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem, 
unsigned nPos)
 // no QMenu set, instantiate own one
 mpOwnedQMenu.reset(new QMenu);
 mpQMenu = mpOwnedQMenu.get();
+connectHelpSignalSlots(mpQMenu, pSalMenuItem);
 }
 
 if (pSalMenuItem->mpSubMenu)
 {
 // submenu
 QMenu* pQMenu = new QMenu(toQString(aText), nullptr);
+connectHelpSignalSlots(pQMenu, pSalMenuItem);
 pSalMenuItem->mpMenu.reset(pQMenu);
 
 if ((nPos != MENU_APPEND)
@@ -183,6 +193,8 @@ void QtMenu::InsertMenuItem(QtMenuItem* pSalMenuItem, 
unsigned nPos)
 
 connect(pAction, ::triggered, this,
 [pSalMenuItem] { slotMenuTriggered(pSalMenuItem); });
+connect(pAction, ::hovered, this,
+[pSalMenuItem] { slotMenuHovered(pSalMenuItem); });
 }
 }
 }
@@ -618,6 +630,22 @@ const QtFrame* QtMenu::GetFrame() const
 return pMenu ? pMenu->mpFrame : nullptr;
 }
 
+void QtMenu::slotMenuHovered(QtMenuItem* pItem)
+{
+const OUString sHelpId = 
pItem->mpParentMenu->GetMenu()->GetHelpId(pItem->mnId);
+m_sCurrentHelpId = sHelpId;
+}
+
+void QtMenu::slotShowHelp()
+{
+SolarMutexGuard aGuard;
+Help* pHelp = Application::GetHelp();
+if (pHelp && !m_sCurrentHelpId.isEmpty())
+{
+pHelp->Start(m_sCurrentHelpId);
+}
+}
+
 void QtMenu::slotMenuTriggered(QtMenuItem* pQItem)
 {
 if (!pQItem)
@@ -772,6 +800,26 @@ void QtMenu::ImplRemoveMenuBarButton(int nId)
 lcl_force_menubar_layout_update(*mpQMenuBar);
 }
 
+void QtMenu::connectHelpShortcut(QMenu* pMenu)
+{
+assert(pMenu);
+QKeySequence 

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

2023-07-31 Thread Noel Grandin (via logerrit)
 vcl/inc/ppdparser.hxx |3 ---
 vcl/unx/generic/printer/ppdparser.cxx |   16 +---
 2 files changed, 1 insertion(+), 18 deletions(-)

New commits:
commit e675d9673f138286e3c4654c522e3930ec96b4bd
Author: Noel Grandin 
AuthorDate: Mon Jul 31 08:22:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 31 17:39:39 2023 +0200

tdf#156230 one more unused piece

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

diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx
index 6d2f8c060c5d..cbc1b94b4ea8 100644
--- a/vcl/inc/ppdparser.hxx
+++ b/vcl/inc/ppdparser.hxx
@@ -76,13 +76,10 @@ class PPDKey
 boolm_bQueryValue;
 OUStringm_aGroup;
 
-public:
-enum class SetupType { ExitServer, Prolog, DocumentSetup, PageSetup, 
JCLSetup, AnySetup };
 private:
 
 boolm_bUIOption;
 int m_nOrderDependency;
-SetupType   m_eSetupType;
 
 void eraseValue( const OUString& rOption );
 public:
diff --git a/vcl/unx/generic/printer/ppdparser.cxx 
b/vcl/unx/generic/printer/ppdparser.cxx
index 6ec967c0a06a..58b2c375604f 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1273,7 +1273,6 @@ void PPDParser::parseOrderDependency(const OString& rLine)
 aLine = aLine.copy( nPos+1 );
 
 sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32();
-OString aSetup = GetCommandLineToken( 1, aLine );
 OUString aKey(OStringToOUString(GetCommandLineToken(2, aLine), 
RTL_TEXTENCODING_MS_1252));
 if( aKey[ 0 ] != '*' )
 return; // invalid order dependency
@@ -1290,18 +1289,6 @@ void PPDParser::parseOrderDependency(const OString& 
rLine)
 pKey = keyit->second.get();
 
 pKey->m_nOrderDependency = nOrder;
-if( aSetup == "ExitServer" )
-pKey->m_eSetupType = PPDKey::SetupType::ExitServer;
-else if( aSetup == "Prolog" )
-pKey->m_eSetupType = PPDKey::SetupType::Prolog;
-else if( aSetup == "DocumentSetup" )
-pKey->m_eSetupType = PPDKey::SetupType::DocumentSetup;
-else if( aSetup == "PageSetup" )
-pKey->m_eSetupType = PPDKey::SetupType::PageSetup;
-else if( aSetup == "JCLSetup" )
-pKey->m_eSetupType = PPDKey::SetupType::JCLSetup;
-else
-pKey->m_eSetupType = PPDKey::SetupType::AnySetup;
 }
 
 void PPDParser::parseConstraint( const OString& rLine )
@@ -1546,8 +1533,7 @@ PPDKey::PPDKey( OUString aKey ) :
 m_pDefaultValue( nullptr ),
 m_bQueryValue( false ),
 m_bUIOption( false ),
-m_nOrderDependency( 100 ),
-m_eSetupType( SetupType::AnySetup )
+m_nOrderDependency( 100 )
 {
 }
 


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

2023-07-31 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtMenu.hxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit b0a26a3c4ffb9994f19e4565c13a7f0ed5959cc6
Author: Michael Weghorn 
AuthorDate: Mon Jul 31 10:22:09 2023 +0200
Commit: Michael Weghorn 
CommitDate: Mon Jul 31 15:15:04 2023 +0200

qt: Drop unused QtMenu::adjustButtonSizes declaration

It was only declared and never defined ever since it
was added in

commit 9ea767cb568cef1b142190d2adb0e301baa382e2
Date:   Thu May 26 13:48:38 2022 +0200

tdf#132350 Qt implement SalMenu button interface

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

diff --git a/vcl/inc/qt5/QtMenu.hxx b/vcl/inc/qt5/QtMenu.hxx
index a1b77687ce86..3e43272b6212 100644
--- a/vcl/inc/qt5/QtMenu.hxx
+++ b/vcl/inc/qt5/QtMenu.hxx
@@ -64,7 +64,6 @@ private:
 bool validateQMenuBar() const;
 QPushButton* ImplAddMenuBarButton(const QIcon& rIcon, const QString& 
rToolTip, int nId);
 void ImplRemoveMenuBarButton(int nId);
-void adjustButtonSizes();
 
 public:
 QtMenu(bool bMenuBar);


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

2023-07-30 Thread Noel Grandin (via logerrit)
 vcl/inc/ppdparser.hxx  |8 --
 vcl/inc/printerinfomanager.hxx |5 
 vcl/inc/salinst.hxx|1 
 vcl/inc/strhelper.hxx  |   16 
 vcl/inc/unx/fontmanager.hxx|5 
 vcl/inc/unx/geninst.h  |1 
 vcl/inc/unx/genprn.h   |6 
 vcl/ios/dummies.cxx|4 ---
 vcl/null/printerinfomanager.cxx|2 -
 vcl/source/fontsubset/ttcr.hxx |6 
 vcl/unx/generic/print/genprnpsp.cxx|8 --
 vcl/unx/generic/printer/cupsmgr.cxx|   10 
 vcl/unx/generic/printer/ppdparser.cxx  |   31 -
 vcl/unx/generic/printer/printerinfomanager.cxx |3 --
 14 files changed, 106 deletions(-)

New commits:
commit 3564e11a41c8d3f06c8be387691d5997942e9738
Author: Noel Grandin 
AuthorDate: Sun Jul 30 23:20:36 2023 +0200
Commit: خالد حسني 
CommitDate: Mon Jul 31 02:18:25 2023 +0200

tdf#156230 remove now unused various bit and pieces

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

diff --git a/vcl/inc/ppdparser.hxx b/vcl/inc/ppdparser.hxx
index 7ef864bc9cfc..6d2f8c060c5d 100644
--- a/vcl/inc/ppdparser.hxx
+++ b/vcl/inc/ppdparser.hxx
@@ -101,7 +101,6 @@ public:
 
 const OUString& getKey() const { return m_aKey; }
 boolisUIKey() const { return m_bUIOption; }
-SetupType   getSetupType() const { return m_eSetupType; }
 int getOrderDependency() const { return 
m_nOrderDependency; }
 };
 
@@ -145,9 +144,6 @@ private:
 // the full path of the PPD file
 OUStringm_aFile;
 // some basic attributes
-boolm_bColorDevice;
-boolm_bType42Capable;
-sal_uLong   m_nLanguageLevel;
 rtl_TextEncodingm_aFileEncoding;
 
 
@@ -192,10 +188,6 @@ public:
 
 const ::std::vector< PPDConstraint >& getConstraints() const { return 
m_aConstraints; }
 
-boolisColorDevice() const { return m_bColorDevice; }
-boolisType42Capable() const { return m_bType42Capable; }
-sal_uLong   getLanguageLevel() const { return m_nLanguageLevel; }
-
 OUStringgetDefaultPaperDimension() const;
 voidgetDefaultPaperDimension( int& rWidth, int& rHeight ) const
 { getPaperDimension( getDefaultPaperDimension(), rWidth, rHeight ); }
diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx
index a89cff1118a5..67dd8e59b2e0 100644
--- a/vcl/inc/printerinfomanager.hxx
+++ b/vcl/inc/printerinfomanager.hxx
@@ -110,8 +110,6 @@ protected:
   m_pQueueInfo;
 
 Type  m_eType;
-bool  m_bUseIncludeFeature;
-bool  m_bUseJobPatch;
 OUString m_aSystemDefaultPaper;
 
 PrinterInfoManager( Type eType = Type::Default );
@@ -157,9 +155,6 @@ public:
 // returns true on success
 virtual bool endSpool( const OUString& rPrinterName, const OUString& 
rJobTitle, FILE* pFile, const JobData& rDocumentJobData, bool bBanner, const 
OUString  );
 
-bool getUseIncludeFeature() const { return m_bUseIncludeFeature; }
-bool getUseJobPatch() const { return m_bUseJobPatch; }
-
 // check whether a printer's feature string contains a subfeature
 bool checkFeatureToken( const OUString& rPrinterName, std::string_view 
pToken ) const;
 
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index 98e962d8c637..124118f4e609 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -195,7 +195,6 @@ public:
 
 // callbacks for printer updates
 virtual voidupdatePrinterUpdate() {}
-virtual voidjobStartedPrinterUpdate() {}
 virtual voidjobEndedPrinterUpdate() {}
 
 /// Set the app's (somewhat) magic/main-thread to this one.
diff --git a/vcl/inc/strhelper.hxx b/vcl/inc/strhelper.hxx
index c0cff31afc4f..8654400b 100644
--- a/vcl/inc/strhelper.hxx
+++ b/vcl/inc/strhelper.hxx
@@ -49,22 +49,6 @@ namespace psp
 return rtl::math::stringToDouble(rStr, u'.', u'\0');
 }
 
-inline double StringToDouble(std::string_view rStr)
-{
-return rtl::math::stringToDouble(rStr, '.', static_cast(0));
-}
-
-// fills a character buffer with the string representation of a double
-// the buffer has to be long enough (e.g. 128 bytes)
-// returns the string len
-inline int getValueOfDouble( char* pBuffer, double f, int nPrecision = 0)
-{
-OString aStr( 

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

2023-07-30 Thread Khaled Hosny (via logerrit)
 vcl/inc/unx/fontmanager.hxx |   13 -
 vcl/unx/generic/fontmanager/fontmanager.cxx |   67 
 2 files changed, 80 deletions(-)

New commits:
commit 3e563f6ed42224e5c7fbb11428604a7719e178af
Author: Khaled Hosny 
AuthorDate: Sun Jul 30 14:59:19 2023 +
Commit: خالد حسني 
CommitDate: Sun Jul 30 20:45:18 2023 +0200

Drop freshly unused PrintFontManager

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

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index a7817652d9ae..1a9ef6e3be21 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -96,7 +96,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 // font attributes
 OUString  m_aFamilyName;
 std::vector m_aAliases;
-OUString  m_aPSName;
 OUString  m_aStyleName;
 FontFamilym_eFamilyStyle;
 FontItalicm_eItalic;
@@ -104,9 +103,6 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 FontWeightm_eWeight;
 FontPitch m_ePitch;
 rtl_TextEncoding  m_aEncoding;
-int   m_nAscend;
-int   m_nDescend;
-int   m_nLeading;
 
 int   m_nDirectory;   // atom containing system 
dependent path
 OString   m_aFontFile;// relative to directory
@@ -202,9 +198,6 @@ public:
 
 // routines to get font info in small pieces
 
-// get a specific fonts PSName name
-OUString getPSName( fontID nFontID );
-
 // get a specific fonts system dependent filename
 OString getFontFileSysPath( fontID nFontID ) const
 {
@@ -217,12 +210,6 @@ public:
 // get the ttc face variation
 int getFontFaceVariation( fontID nFontID ) const;
 
-// get a specific fonts ascend
-int getFontAscend( fontID nFontID );
-
-// get a specific fonts descent
-int getFontDescend( fontID nFontID );
-
 // font administration functions
 
 /*  system dependent font matching
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index d7b6a211df13..1927071bb802 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -87,9 +87,6 @@ PrintFontManager::PrintFont::PrintFont()
 ,   m_eWeight(WEIGHT_DONTKNOW)
 ,   m_ePitch(PITCH_DONTKNOW)
 ,   m_aEncoding(RTL_TEXTENCODING_DONTKNOW)
-,   m_nAscend(0)
-,   m_nDescend(0)
-,   m_nLeading(0)
 ,   m_nDirectory(0)
 ,   m_nCollectionEntry(0)
 ,   m_nVariationEntry(0)
@@ -563,12 +560,6 @@ bool PrintFontManager::analyzeSfntFile( PrintFont& rFont ) 
const
 if( !aInfo.usubfamily.isEmpty() )
 rFont.m_aStyleName = aInfo.usubfamily;
 
-SAL_WARN_IF( aInfo.psname.isEmpty(), "vcl.fonts", "No PostScript name 
in font:" << aFile );
-
-rFont.m_aPSName = !aInfo.psname.isEmpty() ?
-OStringToOUString(aInfo.psname, aEncoding) :
-rFont.m_aFamilyName; // poor font does not have a postscript name
-
 rFont.m_eFamilyStyle = matchFamilyName(rFont.m_aFamilyName);
 
 switch( aInfo.weight )
@@ -610,33 +601,6 @@ bool PrintFontManager::analyzeSfntFile( PrintFont& rFont ) 
const
 
 rFont.m_aEncoding = aInfo.microsoftSymbolEncoded ? 
RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UCS2;
 
-if( aInfo.ascender && aInfo.descender )
-{
-rFont.m_nLeading   = aInfo.linegap;
-rFont.m_nAscend= aInfo.ascender;
-rFont.m_nDescend   = -aInfo.descender;
-}
-else if( aInfo.typoAscender && aInfo.typoDescender )
-{
-rFont.m_nLeading   = aInfo.typoLineGap;
-rFont.m_nAscend= aInfo.typoAscender;
-rFont.m_nDescend   = -aInfo.typoDescender;
-}
-else if( aInfo.winAscent && aInfo.winDescent )
-{
-rFont.m_nAscend= aInfo.winAscent;
-rFont.m_nDescend   = aInfo.winDescent;
-rFont.m_nLeading   = rFont.m_nAscend + rFont.m_nDescend - 1000;
-}
-
-// last try: font bounding box
-if( rFont.m_nAscend == 0 )
-rFont.m_nAscend = aInfo.yMax;
-if( rFont.m_nDescend == 0 )
-rFont.m_nDescend = -aInfo.yMin;
-if( rFont.m_nLeading == 0 )
-rFont.m_nLeading = 15 * (rFont.m_nAscend+rFont.m_nDescend) / 100;
-
 CloseTTFont( pTTFont );
 bSuccess = true;
 }
@@ -846,35 +810,4 @@ OString PrintFontManager::getFontFile(const PrintFont& 
rFont) const
 return aPath;
 }
 
-OUString PrintFontManager::getPSName( fontID nFontID )
-{
-PrintFont* pFont = getFont( nFontID );
-if (pFont && pFont->m_aPSName.isEmpty())
-{
-analyzeSfntFile(*pFont);
-}
-
-return pFont ? pFont->m_aPSName : OUString();

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

2023-07-30 Thread Khaled Hosny (via logerrit)
 vcl/inc/sallayout.hxx  |4 +++-
 vcl/qa/cppunit/complextext.cxx |   33 +
 vcl/source/gdi/CommonSalLayout.cxx |   15 +++
 3 files changed, 51 insertions(+), 1 deletion(-)

New commits:
commit d4653fa961b1aa1cd4bf568e7d1fe50ae97df484
Author: Khaled Hosny 
AuthorDate: Sun Jul 30 07:12:53 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 30 09:50:11 2023 +0200

tdf#107612: Include NNBSP and Mongolian characters in the same fallback run

When a Mongolian character is preceded by a Narrow No Break Space
(NNBSP), it is used to trigger special letter forms, but when we do font
fallback NNBSP is always taken from the main font (HarfBuzz synthesises
it when missing from the font, so we almost never use font fallback for
it).

We now check if the start of the fallback run is a Mongolian character
and the previous is NNBSP and extend the fallback run to include it.

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

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index dbe3000f8a83..94f0086b1517 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -57,7 +57,7 @@ namespace vcl::text {
 class TextLayoutCache;
 }
 
-class MultiSalLayout final : public SalLayout
+class VCL_DLLPUBLIC MultiSalLayout final : public SalLayout
 {
 public:
 voidDrawText(SalGraphics&) const override;
@@ -86,6 +86,8 @@ public:
   vcl::text::ImplLayoutArgs& 
rMultiArgs,
   const double* pMultiDXArray);
 
+SAL_DLLPRIVATE ImplLayoutRuns* GetFallbackRuns() { return maFallbackRuns; }
+
 virtual ~MultiSalLayout() override;
 
 private:
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index bcb0c9622361..ec6ce0ccd0e2 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -540,4 +540,37 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107718)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107612)
+{
+#if HAVE_MORE_FONTS
+vcl::Font aFont(u"DejaVu Sans", u"Book", Size(0, 72));
+
+ScopedVclPtrInstance pOutDev;
+pOutDev->SetFont(aFont);
+
+auto pLayout = pOutDev->ImplLayout(u"a\u202F\u1823", 0, -1, Point(0, 0), 
0, {}, {});
+
+// If font fallback happened, then the returned layout must be a
+// MultiSalLayout instance.
+auto pMultiLayout = dynamic_cast(pLayout.get());
+CPPUNIT_ASSERT(pMultiLayout);
+
+auto pFallbackRuns = pMultiLayout->GetFallbackRuns();
+CPPUNIT_ASSERT(!pFallbackRuns->IsEmpty());
+
+bool bRTL;
+int nCharPos = -1;
+std::vector aFallbacks;
+while (pFallbackRuns->GetNextPos(, ))
+aFallbacks.push_back(nCharPos);
+
+// Assert that U+202F is included in the fallback run.
+// Without the fix this fails with:
+// - Expected: { 2 }
+// - Actual  : { 1, 2 }
+std::vector aExpctedFallbacks = { 1, 2 };
+CPPUNIT_ASSERT_EQUAL(aFallbacks, aExpctedFallbacks);
+#endif
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 3a5fdbef0ad0..79f1a0d2c40c 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -128,6 +128,21 @@ void 
GenericSalLayout::SetNeedFallback(vcl::text::ImplLayoutArgs& rArgs, sal_Int
 mxBreak->previousCharacters(rArgs.mrStr, nCharPos, aLocale,
 i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
 
+// tdf#107612
+// If the start of the fallback run is Mongolian character and the previous
+// character is NNBSP, we want to include the NNBSP in the fallback since
+// it has special uses in Mongolian and have to be in the same text run to
+// work.
+sal_Int32 nTempPos = nGraphemeStartPos;
+if (nGraphemeStartPos > 0)
+{
+auto nCurrChar = rArgs.mrStr.iterateCodePoints(, 0);
+auto nPrevChar = rArgs.mrStr.iterateCodePoints(, -1);
+if (nPrevChar == 0x202F
+&& u_getIntPropertyValue(nCurrChar, UCHAR_SCRIPT) == 
USCRIPT_MONGOLIAN)
+nGraphemeStartPos = nTempPos;
+}
+
 //stay inside the Layout range (e.g. with tdf124116-1.odt)
 nGraphemeStartPos = std::max(rArgs.mnMinCharPos, nGraphemeStartPos);
 nGraphemeEndPos = std::min(rArgs.mnEndCharPos, nGraphemeEndPos);


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

2023-07-25 Thread Michael Weghorn (via logerrit)
 vcl/inc/win/salframe.h  |1 +
 vcl/win/window/salframe.cxx |7 +++
 2 files changed, 8 insertions(+)

New commits:
commit 609ed2944b030a692c942428afa8bf7c3ac93672
Author: Michael Weghorn 
AuthorDate: Tue Jul 25 13:08:14 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue Jul 25 14:48:38 2023 +0200

tdf#155414 win a11y: Honor system setting to disable animations

Use `SPI_GETCLIENTAREAANIMATION`, the "client area animation
parameter [that] indicates whether the user wants to disable
animations in UI elements" [1] to determine whether
animations should be disabled.

The parameter can be set in Windows, as documented in MDN docs
for the "prefers-reduced-motion" CSS media feature [2]:

> * In Windows 10: Settings > Ease of Access > Display > Show animations in 
Windows.
> * In Windows 11: Settings > Accessibility > Visual Effects > Animation 
Effects

On top of

commit 9d68c794d67259a38de1465090f6f1e7fb588d62
Author: Patrick Luby 
Date:   Fri Jul 21 19:55:02 2023 -0400

tdf#155414 include system "reduce animation" preferences

, this implements the Windows equivalent of what that change does for macOS.

[1] 
https://learn.microsoft.com/en-us/windows/win32/winauto/client-area-animation
[2] 
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion

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

diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 676c70c1eca0..564872e65d2c 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -141,6 +141,7 @@ public:
 virtual voidEndSetClipRegion() override;
 virtual voidUpdateDarkMode() override;
 virtual boolGetUseDarkMode() const override;
+virtual boolGetUseReducedAnimation() const override;
 
 constexpr vcl::WindowState state() const { return m_eState; }
 void UpdateFrameState();
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index c911fff0840f..d68178ea022f 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -3126,6 +3126,13 @@ bool WinSalFrame::GetUseDarkMode() const
 return UseDarkMode();
 }
 
+bool WinSalFrame::GetUseReducedAnimation() const
+{
+BOOL bEnableAnimation = FALSE;
+SystemParametersInfoW(SPI_GETCLIENTAREAANIMATION, 0, , 0);
+return !bEnableAnimation;
+}
+
 static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
 WPARAM wParam, LPARAM lParam )
 {


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

2023-07-22 Thread Khaled Hosny (via logerrit)
 vcl/inc/ImplLayoutArgs.hxx |6 +++---
 vcl/source/gdi/CommonSalLayout.cxx |4 ++--
 vcl/source/gdi/sallayout.cxx   |4 ++--
 vcl/source/outdev/text.cxx |   12 ++--
 vcl/source/text/ImplLayoutArgs.cxx |   10 +-
 5 files changed, 18 insertions(+), 18 deletions(-)

New commits:
commit 8e9b65c874d99e3302a9e7dfd0c7a30963526bc2
Author: Khaled Hosny 
AuthorDate: Sun Jul 16 18:20:14 2023 +0300
Commit: خالد حسني 
CommitDate: Sun Jul 23 06:00:49 2023 +0200

vcl: rename NaturalDXArray to DXArray

The unnatural DXArray is gone for a while now.

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

diff --git a/vcl/inc/ImplLayoutArgs.hxx b/vcl/inc/ImplLayoutArgs.hxx
index 381d09185563..d7100d71fd8b 100644
--- a/vcl/inc/ImplLayoutArgs.hxx
+++ b/vcl/inc/ImplLayoutArgs.hxx
@@ -35,7 +35,7 @@ public:
 vcl::text::TextLayoutCache const* m_pTextLayoutCache;
 
 // positioning related inputs
-const double* mpNaturalDXArray; // in floating point pixel units
+const double* mpDXArray; // in floating point pixel units
 const sal_Bool* mpKashidaArray;
 DeviceCoordinate mnLayoutWidth; // in pixel units
 Degree10 mnOrientation; // in 0-3600 system
@@ -48,7 +48,7 @@ public:
LanguageTag aLanguageTag, vcl::text::TextLayoutCache const* 
pLayoutCache);
 
 void SetLayoutWidth(DeviceCoordinate nWidth);
-void SetNaturalDXArray(const double* pDXArray);
+void SetDXArray(const double* pDXArray);
 void SetKashidaArray(const sal_Bool* pKashidaArray);
 void SetOrientation(Degree10 nOrientation);
 
@@ -56,7 +56,7 @@ public:
 bool GetNextPos(int* nCharPos, bool* bRTL);
 bool GetNextRun(int* nMinRunPos, int* nEndRunPos, bool* bRTL);
 void AddFallbackRun(int nMinRunPos, int nEndRunPos, bool bRTL);
-bool HasDXArray() const { return mpNaturalDXArray; }
+bool HasDXArray() const { return mpDXArray; }
 
 // methods used by BiDi and glyph fallback
 bool HasFallbackRun() const;
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index c3b8fab84595..f46f4d875210 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -139,8 +139,8 @@ void 
GenericSalLayout::AdjustLayout(vcl::text::ImplLayoutArgs& rArgs)
 {
 SalLayout::AdjustLayout(rArgs);
 
-if (rArgs.mpNaturalDXArray)
-ApplyDXArray(rArgs.mpNaturalDXArray, rArgs.mpKashidaArray);
+if (rArgs.mpDXArray)
+ApplyDXArray(rArgs.mpDXArray, rArgs.mpKashidaArray);
 else if (rArgs.mnLayoutWidth)
 Justify(rArgs.mnLayoutWidth);
 // apply asian kerning if the glyphs are not already formatted
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 3cdd71642b5b..be3506bf4e3c 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -688,11 +688,11 @@ void MultiSalLayout::AdjustLayout( 
vcl::text::ImplLayoutArgs& rArgs )
 for (DeviceCoordinate a : aJustificationArray)
 aNaturalJustificationArray.push_back(a);
 // change the DXArray temporarily (just for the justification)
-aMultiArgs.mpNaturalDXArray = aNaturalJustificationArray.data();
+aMultiArgs.mpDXArray = aNaturalJustificationArray.data();
 }
 }
 
-ImplAdjustMultiLayout(rArgs, aMultiArgs, aMultiArgs.mpNaturalDXArray);
+ImplAdjustMultiLayout(rArgs, aMultiArgs, aMultiArgs.mpDXArray);
 }
 
 void MultiSalLayout::ImplAdjustMultiLayout(vcl::text::ImplLayoutArgs& rArgs,
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 2c5f9aae06aa..61d965a28b68 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1363,10 +1363,10 @@ std::unique_ptr 
OutputDevice::ImplLayout(const OUString& rOrigStr,
 nPixelWidth, flags, pLayoutCache);
 
 DeviceCoordinate nEndGlyphCoord(0);
-std::unique_ptr xNaturalDXPixelArray;
+std::unique_ptr xDXPixelArray;
 if( !pDXArray.empty() )
 {
-xNaturalDXPixelArray.reset(new double[nLen]);
+xDXPixelArray.reset(new double[nLen]);
 
 if (mbMap)
 {
@@ -1374,16 +1374,16 @@ std::unique_ptr 
OutputDevice::ImplLayout(const OUString& rOrigStr,
 // keeping accuracy for lower levels
 int nSubPixels = pDXArray.get_factor();
 for (int i = 0; i < nLen; ++i)
-xNaturalDXPixelArray[i] = 
ImplLogicWidthToDeviceSubPixel(pDXArray.get_subunit(i)) / nSubPixels;
+xDXPixelArray[i] = 
ImplLogicWidthToDeviceSubPixel(pDXArray.get_subunit(i)) / nSubPixels;
 }
 else
 {
 for(int i = 0; i < nLen; ++i)
-xNaturalDXPixelArray[i] = pDXArray.get(i);
+xDXPixelArray[i] = pDXArray.get(i);
 }
 
-

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

2023-07-20 Thread sahil (via logerrit)
 vcl/inc/osx/keyboardfocuslistener.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit e99f7feb57e62d395d5b31f12e1c54194ffbf99d
Author: sahil 
AuthorDate: Wed Jul 19 22:11:11 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Thu Jul 20 12:47:36 2023 +0200

tdf#143148 Use pragma once in vcl

Change-Id: I4cf05114c7568d6c7b7ddba1b3c4a862d7a24dce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154656
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/vcl/inc/osx/keyboardfocuslistener.hxx 
b/vcl/inc/osx/keyboardfocuslistener.hxx
index 9589a471e733..f94afaaf4f31 100644
--- a/vcl/inc/osx/keyboardfocuslistener.hxx
+++ b/vcl/inc/osx/keyboardfocuslistener.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX
-#define INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX
+#pragma once
 
 #include 
 
@@ -33,6 +32,4 @@ public:
 = 0;
 };
 
-#endif // INCLUDED_VCL_INC_OSX_KEYBOARDFOCUSLISTENER_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


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

2023-07-18 Thread Noel Grandin (via logerrit)
 vcl/inc/dndeventdispatcher.hxx   |2 +-
 vcl/source/window/dndeventdispatcher.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 3394fe4f19def29e314798fa64235b28d9df50a6
Author: Noel Grandin 
AuthorDate: Tue Jul 18 15:04:12 2023 +0200
Commit: Noel Grandin 
CommitDate: Tue Jul 18 21:08:00 2023 +0200

fix DNDEventDispatcher::findTopLevelWindow

for the unlikely case of antiparallel desktop (whatever that is)

regression from
commit ea05f2aa4e28fd40238c4962e9dcbbf0d873cabd
Author: Norbert Thiebaud 
Date:   Thu Oct 14 22:12:16 2010 -0500
migrate OClearableGuard(SoalrMutex) to SolarMutexGuard

when the code findTopLevelWindow was extracted into its own method,
the location parameter was not made a reference, which is necessary to
propogate the update that occurs in OutputDevice::ReMirror

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

diff --git a/vcl/inc/dndeventdispatcher.hxx b/vcl/inc/dndeventdispatcher.hxx
index 9756056da3bd..0b3f58560282 100644
--- a/vcl/inc/dndeventdispatcher.hxx
+++ b/vcl/inc/dndeventdispatcher.hxx
@@ -42,7 +42,7 @@ class DNDEventDispatcher final : public 
::cppu::WeakImplHelper<
 std::recursive_mutex m_aMutex;
 css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavorList;
 
-vcl::Window* findTopLevelWindow(Point location);
+vcl::Window* findTopLevelWindow(Point& location);
 /*
  * fire the events on the dnd listener container of the specified window
  */
diff --git a/vcl/source/window/dndeventdispatcher.cxx 
b/vcl/source/window/dndeventdispatcher.cxx
index a5a89928e616..c57841c1fdfa 100644
--- a/vcl/source/window/dndeventdispatcher.cxx
+++ b/vcl/source/window/dndeventdispatcher.cxx
@@ -42,7 +42,7 @@ DNDEventDispatcher::~DNDEventDispatcher()
 designate_currentwindow(nullptr);
 }
 
-vcl::Window* DNDEventDispatcher::findTopLevelWindow(Point location)
+vcl::Window* DNDEventDispatcher::findTopLevelWindow(Point& location)
 {
 SolarMutexGuard aSolarGuard;
 


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

2023-07-13 Thread Rico Tzschichholz (via logerrit)
 vcl/inc/TextLayoutCache.hxx|2 +-
 vcl/source/gdi/CommonSalLayout.cxx |1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 55d62057c0ccd533af63b2a01edb0cddbd619721
Author: Rico Tzschichholz 
AuthorDate: Sun Apr 2 11:15:11 2023 +0200
Commit: خالد حسني 
CommitDate: Thu Jul 13 18:24:39 2023 +0200

vcl: Move include of  to the appropriate place

hb_icu_script_to_script is used in CommonSalLayout.cxx only

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

diff --git a/vcl/inc/TextLayoutCache.hxx b/vcl/inc/TextLayoutCache.hxx
index 46e5c80dc320..304c6d51ebfb 100644
--- a/vcl/inc/TextLayoutCache.hxx
+++ b/vcl/inc/TextLayoutCache.hxx
@@ -25,7 +25,7 @@
 
 #include 
 
-#include 
+#include 
 
 #include 
 
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 324b6fb48b07..c3b8fab84595 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 


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

2023-07-11 Thread Szymon Kłos (via logerrit)
 vcl/inc/salvtables.hxx|   29 +
 vcl/source/app/salvtables.cxx |   29 -
 2 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 16d600edcc33b72a9d09b7f2f496313612ffebd4
Author: Szymon Kłos 
AuthorDate: Thu Jul 6 15:36:39 2023 +0200
Commit: Szymon Kłos 
CommitDate: Tue Jul 11 15:51:11 2023 +0200

jsdialog: Move SalInstanceCalendar decl to header file

Change-Id: Ide9e685d724d646f0ab8825b1fce2b6fd130d3ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154135
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
(cherry picked from commit d792875d79a63364dba02426ef75d696ae0f02ef)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154266
Tested-by: Jenkins

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 7ac28808ce3d..d3949cd68590 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include "calendar.hxx"
 #include "iconview.hxx"
 #include "listbox.hxx"
 #include "messagedialog.hxx"
@@ -2178,4 +2179,32 @@ public:
 virtual ~SalInstanceScrolledWindow() override;
 };
 
+class SalInstanceCalendar : public SalInstanceWidget, public virtual 
weld::Calendar
+{
+private:
+VclPtr<::Calendar> m_xCalendar;
+
+DECL_LINK(SelectHdl, ::Calendar*, void);
+DECL_LINK(ActivateHdl, ::Calendar*, void);
+
+public:
+SalInstanceCalendar(::Calendar* pCalendar, SalInstanceBuilder* pBuilder, 
bool bTakeOwnership)
+: SalInstanceWidget(pCalendar, pBuilder, bTakeOwnership)
+, m_xCalendar(pCalendar)
+{
+m_xCalendar->SetSelectHdl(LINK(this, SalInstanceCalendar, SelectHdl));
+m_xCalendar->SetActivateHdl(LINK(this, SalInstanceCalendar, 
ActivateHdl));
+}
+
+virtual void set_date(const Date& rDate) override { 
m_xCalendar->SetCurDate(rDate); }
+
+virtual Date get_date() const override { return 
m_xCalendar->GetFirstSelectedDate(); }
+
+virtual ~SalInstanceCalendar() override
+{
+m_xCalendar->SetSelectHdl(Link<::Calendar*, void>());
+m_xCalendar->SetActivateHdl(Link<::Calendar*, void>());
+}
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 71308484ed63..4de845997375 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -76,7 +76,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -3294,34 +3293,6 @@ public:
 
 virtual void set_text(const OUString& rText) override { 
m_xProgressBar->SetText(rText); }
 };
-
-class SalInstanceCalendar : public SalInstanceWidget, public virtual 
weld::Calendar
-{
-private:
-VclPtr<::Calendar> m_xCalendar;
-
-DECL_LINK(SelectHdl, ::Calendar*, void);
-DECL_LINK(ActivateHdl, ::Calendar*, void);
-
-public:
-SalInstanceCalendar(::Calendar* pCalendar, SalInstanceBuilder* pBuilder, 
bool bTakeOwnership)
-: SalInstanceWidget(pCalendar, pBuilder, bTakeOwnership)
-, m_xCalendar(pCalendar)
-{
-m_xCalendar->SetSelectHdl(LINK(this, SalInstanceCalendar, SelectHdl));
-m_xCalendar->SetActivateHdl(LINK(this, SalInstanceCalendar, 
ActivateHdl));
-}
-
-virtual void set_date(const Date& rDate) override { 
m_xCalendar->SetCurDate(rDate); }
-
-virtual Date get_date() const override { return 
m_xCalendar->GetFirstSelectedDate(); }
-
-virtual ~SalInstanceCalendar() override
-{
-m_xCalendar->SetSelectHdl(Link<::Calendar*, void>());
-m_xCalendar->SetActivateHdl(Link<::Calendar*, void>());
-}
-};
 }
 
 IMPL_LINK_NOARG(SalInstanceCalendar, SelectHdl, ::Calendar*, void)


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

2023-07-10 Thread Khaled Hosny (via logerrit)
 vcl/inc/win/winlayout.hxx |2 --
 vcl/win/gdi/salfont.cxx   |   11 ---
 vcl/win/gdi/winlayout.cxx |1 -
 3 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 88d72b44a1a9345e7eacdd707cecfb300517df9c
Author: Khaled Hosny 
AuthorDate: Mon Jul 10 09:49:38 2023 +
Commit: خالد حسني 
CommitDate: Mon Jul 10 15:45:31 2023 +0200

Drop unused WinFontInstance scale

Unsed since:

commit 7cb3e475f2fb0162c7290414509de4fb8fe57e30
Author: Jan-Marek Glogowski 
Date:   Thu Sep 6 14:04:25 2018 +0200

WIN add SalGraphics* to WinFontInstance

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

diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index fb8e5a1c6e43..07c80e8e8b39 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -43,7 +43,6 @@ public:
 WinSalGraphics* GetGraphics() const { return m_pGraphics; }
 
 HFONT GetHFONT() const { return m_hFont; }
-float GetScale() const { return m_fScale; }
 // Return true if the font is for vertical writing.
 // I.e. the font name of the LOGFONT is prefixed with '@'.
 bool  IsCJKVerticalFont() const { return m_bIsCJKVerticalFont; }
@@ -64,7 +63,6 @@ private:
 
 WinSalGraphics *m_pGraphics;
 HFONT m_hFont;
-float m_fScale;
 bool  m_bIsCJKVerticalFont;
 sal_Int32 m_nTmDescent;
 mutable sal::systools::COMReference mxDWFontFace;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index f4a3029a454f..3b31028c88bb 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -867,7 +867,7 @@ void WinSalGraphics::GetFontMetric( FontMetricDataRef& 
rxFontMetric, int nFallba
 rxFontMetric->SetSlant( 0 );
 
 // transformation dependent font metrics
-rxFontMetric->SetWidth(static_cast(pFontInstance->GetScale() * 
aWinMetric.tmAveCharWidth));
+rxFontMetric->SetWidth(aWinMetric.tmAveCharWidth);
 }
 
 FontCharMapRef WinSalGraphics::GetFontCharMap() const
@@ -1167,7 +1167,6 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId 
nId, tools::Rectangle& r
 
 const ::comphelper::ScopeGuard aFontRestoreScopeGuard([hFont, hOrigFont, 
hDC]()
 { if (hFont != hOrigFont) SelectObject(hDC, hOrigFont); });
-const float fFontScale = GetScale();
 
 // use unity matrix
 MAT2 aMat;
@@ -1202,10 +1201,8 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId 
nId, tools::Rectangle& r
 
 rRect = tools::Rectangle( Point( +aGM.gmptGlyphOrigin.x, 
-aGM.gmptGlyphOrigin.y ),
 Size( aGM.gmBlackBoxX, aGM.gmBlackBoxY ) );
-rRect.SetLeft(static_cast( fFontScale * rRect.Left() ));
-rRect.SetRight(static_cast( fFontScale * rRect.Right() ) + 1);
-rRect.SetTop(static_cast( fFontScale * rRect.Top() ));
-rRect.SetBottom(static_cast( fFontScale * rRect.Bottom() ) + 1);
+rRect.SetRight(rRect.Right() + 1);
+rRect.SetBottom(rRect.Bottom() + 1);
 return true;
 }
 
@@ -1389,7 +1386,7 @@ bool WinFontInstance::GetGlyphOutline(sal_GlyphId nId, 
basegfx::B2DPolyPolygon&
 // rescaling needed for the tools::PolyPolygon conversion
 if( rB2DPolyPoly.count() )
 {
-const double fFactor(GetScale()/256);
+const double fFactor(1.0f/256);
 
rB2DPolyPoly.transform(basegfx::utils::createScaleB2DHomMatrix(fFactor, 
fFactor));
 }
 
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 371bdeb9642e..5081456aaaef 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -135,7 +135,6 @@ WinFontInstance::WinFontInstance(const WinFontFace& rPFF, 
const vcl::font::FontS
 : LogicalFontInstance(rPFF, rFSP)
 , m_pGraphics(nullptr)
 , m_hFont(nullptr)
-, m_fScale(1.0f)
 , m_bIsCJKVerticalFont(false)
 , m_nTmDescent(0)
 {


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

2023-07-05 Thread Noel Grandin (via logerrit)
 vcl/inc/svimpbox.hxx |2 -
 vcl/source/bitmap/dibtools.cxx   |   45 ---
 vcl/source/treelist/iconviewimpl.cxx |7 +
 vcl/source/treelist/iconviewimpl.hxx |2 -
 vcl/source/treelist/svimpbox.cxx |   11 +++-
 5 files changed, 24 insertions(+), 43 deletions(-)

New commits:
commit 23583706b51f4c1cde8ceb20557fe376691fad88
Author: Noel Grandin 
AuthorDate: Tue Jul 4 20:27:38 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Jul 5 09:33:41 2023 +0200

loplugin:constantparam

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

diff --git a/vcl/inc/svimpbox.hxx b/vcl/inc/svimpbox.hxx
index 949a488ed816..61e103e12b1f 100644
--- a/vcl/inc/svimpbox.hxx
+++ b/vcl/inc/svimpbox.hxx
@@ -250,7 +250,7 @@ public:
 voidResize();
 voidGetFocus();
 voidLoseFocus();
-virtual voidUpdateAll( bool bInvalidateCompleteView );
+virtual voidUpdateAll();
 voidSetEntryHeight();
 voidInvalidateEntry( SvTreeListEntry* );
 voidRecalcFocusRect();
diff --git a/vcl/source/bitmap/dibtools.cxx b/vcl/source/bitmap/dibtools.cxx
index c95c21704dd9..d8fa61362635 100644
--- a/vcl/source/bitmap/dibtools.cxx
+++ b/vcl/source/bitmap/dibtools.cxx
@@ -330,7 +330,7 @@ bool ImplReadDIBPalette(SvStream& rIStm, BitmapPalette& 
rPal, bool bQuad)
 return rIStm.GetError() == ERRCODE_NONE;
 }
 
-BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette, 
bool bForceToMonoWhileReading)
+BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, BitmapPalette& rPalette)
 {
 const sal_uInt16 nPaletteEntryCount = rPalette.GetEntryCount();
 if (nPaletteEntryCount && nIndex >= nPaletteEntryCount)
@@ -341,22 +341,9 @@ BitmapColor SanitizePaletteIndex(sal_uInt8 nIndex, 
BitmapPalette& rPalette, bool
 << nPaletteEntryCount);
 nIndex = nSanitizedIndex;
 }
-
-if (nPaletteEntryCount && bForceToMonoWhileReading)
-{
-return 
BitmapColor(static_cast(rPalette[nIndex].GetLuminance() >= 255));
-}
-
 return BitmapColor(nIndex);
 }
 
-BitmapColor SanitizeColor(const BitmapColor , bool 
bForceToMonoWhileReading)
-{
-if (!bForceToMonoWhileReading)
-return rColor;
-return BitmapColor(static_cast(rColor.GetLuminance() >= 255));
-}
-
 bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & rHeader, 
BitmapWriteAccess& rAcc, BitmapPalette& rPalette, bool bRLE4)
 {
 Scanline pRLE = pBuffer;
@@ -394,10 +381,10 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const 
& rHeader, BitmapWriteA
 cTmp = *pRLE++;
 
 if( nX < nWidth )
-rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp >> 4, rPalette, /*bForceToMonoWhileReading*/false));
+rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp >> 4, rPalette));
 
 if( nX < nWidth )
-rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp & 0x0f, rPalette, /*bForceToMonoWhileReading*/false));
+rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp & 0x0f, rPalette));
 }
 
 if( nRunByte & 1 )
@@ -406,7 +393,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & 
rHeader, BitmapWriteA
 return false;
 
 if( nX < nWidth )
-rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(*pRLE >> 4, rPalette, /*bForceToMonoWhileReading*/false));
+rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(*pRLE >> 4, rPalette));
 
 pRLE++;
 }
@@ -427,7 +414,7 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const & 
rHeader, BitmapWriteA
 return false;
 
 if( nX < nWidth )
-rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(*pRLE, rPalette, /*bForceToMonoWhileReading*/false));
+rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(*pRLE, rPalette));
 
 pRLE++;
 }
@@ -474,18 +461,18 @@ bool ImplDecodeRLE(sal_uInt8* pBuffer, DIBV5Header const 
& rHeader, BitmapWriteA
 
 for (sal_uLong i = 0; i < nRunByte && nX < nWidth; ++i)
 {
-rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp >> 4, rPalette, /*bForceToMonoWhileReading*/false));
+rAcc.SetPixelOnData(pScanline, nX++, 
SanitizePaletteIndex(cTmp >> 4, rPalette));
 if( nX < 

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

2023-07-02 Thread Noel Grandin (via logerrit)
 vcl/inc/salbmp.hxx|5 +
 vcl/inc/skia/salbmp.hxx   |1 +
 vcl/skia/salbmp.cxx   |   25 +
 vcl/source/bitmap/bitmappaint.cxx |2 +-
 4 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit 72f2de04a23680fcb75cf5bc89b3422f9e89cdef
Author: Noel Grandin 
AuthorDate: Fri Jun 30 15:02:16 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Jul 2 16:57:46 2023 +0200

optimised Skia Invert() operation

which is not that important right now, but my upcoming
transparency->alpha patch will make more heavy use of Invert(),
and this change will reduce the cost of that

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

diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 2b93fb4d..3f9dafab15dc 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -104,6 +104,11 @@ public:
 return false;
 }
 
+virtual boolInvert()
+{
+return false;
+}
+
 #if defined MACOSX || defined IOS
 // Related: tdf#146842 Eliminate temporary copies of SkiaSalBitmap when
 // printing
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index 8a974f08566c..3c8b1a964806 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -64,6 +64,7 @@ public:
 virtual bool ConvertToGreyscale() override;
 virtual bool Erase(const Color& color) override;
 virtual bool AlphaBlendWith(const SalBitmap& rSalBmp) override;
+virtual bool Invert() override;
 #if defined MACOSX || defined IOS
 virtual CGImageRef CreateWithMask(const SalBitmap& rMask, int nX, int nY, 
int nWidth,
   int nHeight) const override;
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 57cea14316c5..1ce85dd0e837 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -623,6 +623,31 @@ bool SkiaSalBitmap::AlphaBlendWith(const SalBitmap& 
rSalBmp)
 return true;
 }
 
+bool SkiaSalBitmap::Invert()
+{
+#ifdef DBG_UTIL
+assert(mWriteAccessCount == 0);
+#endif
+// Normally this would need to convert contents of mBuffer for all 
possible formats,
+// so just let the VCL algorithm do it.
+// Avoid the costly SkImage->buffer->SkImage conversion.
+if (!mBuffer && mImage && !mEraseColorSet)
+{
+// This is 8-bit bitmap serving as alpha/transparency/mask, so the 
image itself needs no alpha.
+sk_sp surface = createSkSurface(mSize, kOpaque_SkAlphaType);
+surface->getCanvas()->clear(SK_ColorWHITE);
+SkPaint paint;
+paint.setBlendMode(SkBlendMode::kDifference);
+surface->getCanvas()->drawImage(
+mImage, 0, 0, SkSamplingOptions(SkFilterMode::kLinear, 
SkMipmapMode::kLinear), );
+ResetToSkImage(makeCheckedImageSnapshot(surface));
+DataChanged();
+SAL_INFO("vcl.skia.trace", "invert(" << this << ")");
+return true;
+}
+return false;
+}
+
 SkBitmap SkiaSalBitmap::GetAsSkBitmap() const
 {
 #ifdef DBG_UTIL
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index f454aa97affa..7701af429ef6 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -77,7 +77,7 @@ bool Bitmap::Invert()
 
 pAcc->SetPalette(aBmpPal);
 }
-else
+else if (!mxSalBmp->Invert()) // try optimised call first
 {
 const tools::Long nWidth = pAcc->Width();
 const tools::Long nHeight = pAcc->Height();


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

2023-06-22 Thread Michael Weghorn (via logerrit)
 vcl/inc/unx/desktops.hxx  |1 +
 vcl/source/app/IconThemeSelector.cxx  |1 +
 vcl/source/app/salplug.cxx|4 ++--
 vcl/unx/generic/desktopdetect/desktopdetector.cxx |   11 +++
 vcl/unx/kf5/KFSalInstance.cxx |8 +---
 5 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit 8b0e1f2a914d672182d585d8cb2d4a815e88977e
Author: Michael Weghorn 
AuthorDate: Thu Jun 22 08:40:56 2023 +0200
Commit: Michael Weghorn 
CommitDate: Thu Jun 22 22:15:50 2023 +0200

Detect Plasma 6 desktop

Add detection for Plasma 6, which is currently in development stage.
With the following plasma-workspace commit [1] in place,
KDE_SESSION_VERSION is set to 6, so use that to detect it:

commit 4c2242d7dfafac161baec3ec316af24d7b48ef8b
Author: Michael Weghorn 
Date:   Thu Jun 22 07:47:31 2023 +0200

Set KDE_SESSION_VERSION to 6

Since the master branch is based on Qt6/KF6 and will
become Plasma 6, set KDE_SESSION_VERSION to "6".

This will allow other applications to detect they're
running in a (preview of a) Plasma 6 session and react
accordingly.
(E.g. LibreOffice can use this to choose to
use its upcoming kf6 integration by default instead of the
kf5 one.)

[1] 
https://invent.kde.org/plasma/plasma-workspace/-/commit/4c2242d7dfafac161baec3ec316af24d7b48ef8b

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

diff --git a/vcl/inc/unx/desktops.hxx b/vcl/inc/unx/desktops.hxx
index 0abb6aa71339..2056c2c37928 100644
--- a/vcl/inc/unx/desktops.hxx
+++ b/vcl/inc/unx/desktops.hxx
@@ -33,6 +33,7 @@ enum SAL_DLLPUBLIC_RTTI DesktopType
 DESKTOP_XFCE,
 DESKTOP_MATE,
 DESKTOP_PLASMA5,
+DESKTOP_PLASMA6,
 DESKTOP_LXQT
 }; // keep in sync with desktop_strings[] in salplug.cxx
 
diff --git a/vcl/source/app/IconThemeSelector.cxx 
b/vcl/source/app/IconThemeSelector.cxx
index 6b8dfc0f42c7..15eb4b7768fc 100644
--- a/vcl/source/app/IconThemeSelector.cxx
+++ b/vcl/source/app/IconThemeSelector.cxx
@@ -70,6 +70,7 @@ IconThemeSelector::GetIconThemeForDesktopEnvironment(const 
OUString& desktopEnvi
 #else
 OUString r;
 if ( desktopEnvironment.equalsIgnoreAsciiCase("plasma5") ||
+ desktopEnvironment.equalsIgnoreAsciiCase("plasma6") ||
  desktopEnvironment.equalsIgnoreAsciiCase("lxqt") ) {
 if (!bPreferDarkIconTheme)
 r = "breeze";
diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx
index e51375b94ae5..fee5b7e33e6d 100644
--- a/vcl/source/app/salplug.cxx
+++ b/vcl/source/app/salplug.cxx
@@ -249,7 +249,7 @@ const char* const* autodetect_plugin_list()
   desktop == DESKTOP_XFCE  ||
   desktop == DESKTOP_MATE )
 pList = pStandardFallbackList;
-else if (desktop == DESKTOP_PLASMA5 || desktop == DESKTOP_LXQT)
+else if (desktop == DESKTOP_PLASMA5 || desktop == DESKTOP_PLASMA6 || 
desktop == DESKTOP_LXQT)
 pList = pKDEFallbackList;
 
 return pList;
@@ -426,7 +426,7 @@ const OUString& SalGetDesktopEnvironment()
 // Order to match desktops.hxx' DesktopType
 static const char * const desktop_strings[] = {
 "none", "unknown", "GNOME", "UNITY",
-"XFCE", "MATE", "PLASMA5", "LXQT" };
+"XFCE", "MATE", "PLASMA5", "PLASMA6", "LXQT" };
 static OUString aDesktopEnvironment;
 if( aDesktopEnvironment.isEmpty())
 {
diff --git a/vcl/unx/generic/desktopdetect/desktopdetector.cxx 
b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
index bad134fbdafd..8baeb303feed 100644
--- a/vcl/unx/generic/desktopdetect/desktopdetector.cxx
+++ b/vcl/unx/generic/desktopdetect/desktopdetector.cxx
@@ -117,6 +117,13 @@ static bool is_plasma5_desktop()
 return pFullVersion && pSessionVersion && (0 == strcmp(pSessionVersion, 
"5"));
 }
 
+static bool is_plasma6_desktop()
+{
+static const char* pFullVersion = getenv("KDE_FULL_SESSION");
+static const char* pSessionVersion = getenv("KDE_SESSION_VERSION");
+return pFullVersion && pSessionVersion && (0 == strcmp(pSessionVersion, 
"6"));
+}
+
 extern "C"
 {
 
@@ -132,6 +139,8 @@ DESKTOP_DETECTOR_PUBLIC DesktopType 
get_desktop_environment()
 return DESKTOP_LXQT;
 if (aOver.equalsIgnoreAsciiCase("plasma5") || 
aOver.equalsIgnoreAsciiCase("plasma"))
 return DESKTOP_PLASMA5;
+if (aOver.equalsIgnoreAsciiCase("plasma6"))
+return DESKTOP_PLASMA6;
 if ( aOver.equalsIgnoreAsciiCase( "gnome" ) )
 return DESKTOP_GNOME;
 if ( aOver.equalsIgnoreAsciiCase( "gnome-wayland" ) )
@@ -190,6 +199,8 @@ DESKTOP_DETECTOR_PUBLIC DesktopType 
get_desktop_environment()
 
 if 

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

2023-06-13 Thread Khaled Hosny (via logerrit)
 vcl/inc/unx/fontmanager.hxx |3 +++
 vcl/unx/generic/fontmanager/fontconfig.cxx  |   20 ++--
 vcl/unx/generic/fontmanager/fontmanager.cxx |2 ++
 3 files changed, 23 insertions(+), 2 deletions(-)

New commits:
commit b416006052649ed69ef1dcd711187c860353a0db
Author: Khaled Hosny 
AuthorDate: Tue Jun 13 12:36:24 2023 +0300
Commit: Caolán McNamara 
CommitDate: Tue Jun 13 17:29:22 2023 +0200

When adding application fonts, add them also to FontConfig

This way FontConfig can use them for missing chars font fallback.

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

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index a76474f856fc..a7817652d9ae 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -175,6 +175,9 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 */
 static void addFontconfigDir(const OString& rDirectory);
 
+/* register an application specific font file for libfontconfig */
+static void addFontconfigFile(const OString& rFile);
+
 std::set m_aPreviousLangSupportRequests;
 std::vector m_aCurrentRequests;
 Timer m_aFontInstallerTimer;
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx 
b/vcl/unx/generic/fontmanager/fontconfig.cxx
index eb66017d98fa..a34d0e08b050 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -153,8 +153,6 @@ class FontCfgWrapper
 {
 FcFontSet* m_pFontSet;
 
-void addFontSet( FcSetName );
-
 FontCfgWrapper();
 ~FontCfgWrapper();
 
@@ -162,6 +160,8 @@ public:
 static FontCfgWrapper& get();
 static void release();
 
+void addFontSet( FcSetName );
+
 FcFontSet* getFontSet();
 
 void clear();
@@ -766,6 +766,22 @@ void PrintFontManager::addFontconfigDir( const OString& 
rDirName )
 }
 }
 
+void PrintFontManager::addFontconfigFile( const OString& rFileName )
+{
+const char* pFileName = rFileName.getStr();
+bool bFileOk = (FcConfigAppFontAddFile(FcConfigGetCurrent(), 
reinterpret_cast(pFileName) ) == FcTrue);
+
+SAL_INFO("vcl.fonts", "FcConfigAppFontAddFile(\"" << pFileName << "\") => 
" << std::boolalpha << bFileOk);
+
+if( !bFileOk )
+return;
+
+// FIXME: we want to add only the newly added font not re-add the whole
+// application font set.
+FontCfgWrapper& rWrapper = FontCfgWrapper::get();
+rWrapper.addFontSet( FcSetApplication );
+}
+
 static void addtopattern(FcPattern *pPattern,
 FontItalic eItalic, FontWeight eWeight, FontWidth eWidth, FontPitch ePitch)
 {
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx 
b/vcl/unx/generic/fontmanager/fontmanager.cxx
index b8f99d122e1f..d7b6a211df13 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -159,6 +159,8 @@ std::vector PrintFontManager::addFontFile( 
std::u16string_view rFileUrl
 std::vector aFontIds = findFontFileIDs( nDirID, aName );
 if( aFontIds.empty() )
 {
+addFontconfigFile(OUStringToOString(aPath.GetFull(), 
osl_getThreadTextEncoding()));
+
 std::vector aNewFonts = analyzeFontFile(nDirID, aName);
 for (auto & font : aNewFonts)
 {


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

2023-06-08 Thread Patrick Luby (via logerrit)
 vcl/inc/quartz/salgdi.h |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 312adca5c50666d924dce936012fba5b8f626939
Author: Patrick Luby 
AuthorDate: Thu Jun 8 15:56:28 2023 -0400
Commit: Patrick Luby 
CommitDate: Thu Jun 8 22:50:35 2023 +0200

Fix iOS build breakage

Two new functions that are used only on macOS were added in commit
75dc3a54fca8b2dc775ba007190d8c2e188f1c0a.

Change-Id: I18d0f7aaa9d1ca6634b13eafc76b4fd39dfa52ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152771
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index df9eabad936f..009bf59e872e 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -133,8 +133,10 @@ private:
 
 namespace sal::aqua
 {
+#ifdef MACOSX
 NSRect getTotalScreenBounds();
 void resetTotalScreenBounds();
+#endif
 float getWindowScaling();
 void resetWindowScaling();
 }


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

2023-06-07 Thread Patrick Luby (via logerrit)
 vcl/inc/osx/a11yfactory.h|6 
 vcl/inc/osx/a11ywrapper.h|   16 +
 vcl/inc/osx/salframeview.h   |   44 
 vcl/inc/quartz/salgdi.h  |2 
 vcl/osx/a11yactionwrapper.h  |1 
 vcl/osx/a11yactionwrapper.mm |   19 +
 vcl/osx/a11yfactory.mm   |   57 -
 vcl/osx/a11ywrapper.mm   |  435 +--
 vcl/osx/salframe.cxx |7 
 vcl/osx/salframeview.mm  |  374 
 vcl/osx/salgdiutils.cxx  |   36 +++
 11 files changed, 918 insertions(+), 79 deletions(-)

New commits:
commit 75dc3a54fca8b2dc775ba007190d8c2e188f1c0a
Author: Patrick Luby 
AuthorDate: Wed Jun 7 13:53:39 2023 -0400
Commit: Patrick Luby 
CommitDate: Wed Jun 7 21:48:54 2023 +0200

Partial fix tdf#155376 use NSAccessibilityElement instead of NSView

On macOS, accessibility is implemented by creating a native NSView
for each C++ accessible element. The problem with using an NSView
for each element is that NSViews are very slow to add to or remove from
an NSWindow once the number of NSViews is more than a thousand or so.

Fortunately, Apple added a protocol that allows adding a native
accessible element using the lightweight NSAccessiblityElement class.
The topmost NSAccessiblityElement elements are connected to the single
SalFrameView in each NSWindow but since NSAccessiblityElements are not
NSViews, they are not connected to any of NSWindow's event or draw
dispatching. This makes NSAccessiblityElements significantly faster to
add to or remove from an NSWindow with no apparent loss in functionality.

Note: this change is a subset of the LibreOffice 4.4 code changes that I
wrote for NeoOffice.

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

diff --git a/vcl/inc/osx/a11yfactory.h b/vcl/inc/osx/a11yfactory.h
index cec49bf93b6d..9ef837dfaa9d 100644
--- a/vcl/inc/osx/a11yfactory.h
+++ b/vcl/inc/osx/a11yfactory.h
@@ -26,14 +26,14 @@
 @interface AquaA11yFactory : NSObject
 {
 }
-+(void)insertIntoWrapperRepository: (NSView *) viewElement 
forAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
++(void)insertIntoWrapperRepository: (AquaA11yWrapper *) element 
forAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
 +(AquaA11yWrapper *)wrapperForAccessible: (css::uno::Reference < 
css::accessibility::XAccessible >) rxAccessible;
 +(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
 +(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext 
createIfNotExists:(BOOL) bCreate;
 +(AquaA11yWrapper *)wrapperForAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext 
createIfNotExists:(BOOL) bCreate asRadioGroup:(BOOL) asRadioGroup;
 +(void)removeFromWrapperRepositoryFor: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
-+(void)registerView: (NSView *) theView;
-+(void)revokeView: (NSView *) theViewt;
++(void)registerWrapper: (AquaA11yWrapper *) theWrapper;
++(void)revokeWrapper: (AquaA11yWrapper *) theWrapper;
 @end
 
 
diff --git a/vcl/inc/osx/a11ywrapper.h b/vcl/inc/osx/a11ywrapper.h
index 469e50820e19..1eb4039c57e9 100644
--- a/vcl/inc/osx/a11ywrapper.h
+++ b/vcl/inc/osx/a11ywrapper.h
@@ -50,7 +50,19 @@ struct ReferenceWrapper
 css::uno::Reference < css::accessibility::XAccessibleTextMarkup > 
rAccessibleTextMarkup;
 };
 
-@interface AquaA11yWrapper : NSView
+@interface AquaA11yWrapper : NSAccessibilityElement
+
 {
 ReferenceWrapper maReferenceWrapper;
 BOOL mActsAsRadioGroup;
@@ -68,6 +80,7 @@ struct ReferenceWrapper
 -(id)accessibilityFocusedUIElement;
 -(NSString *)accessibilityActionDescription:(NSString *)action;
 -(void)accessibilityPerformAction:(NSString *)action;
+-(BOOL)performAction:(NSString *)action;
 -(NSArray *)accessibilityActionNames;
 -(id)accessibilityHitTest:(NSPoint)point;
 // Attribute values
@@ -86,6 +99,7 @@ struct ReferenceWrapper
 -(void)setActsAsRadioGroup:(BOOL)actsAsRadioGroup;
 -(BOOL)actsAsRadioGroup;
 -(NSWindow*)windowForParent;
+-(id)init;
 -(id)initWithAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) anAccessibleContext;
 -(void) setDefaults: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
 +(void)setPopupMenuOpen:(BOOL)popupMenuOpen;
diff --git a/vcl/inc/osx/salframeview.h b/vcl/inc/osx/salframeview.h
index 1282eb10cbee..f9eca27e305c 100644
--- a/vcl/inc/osx/salframeview.h
+++ b/vcl/inc/osx/salframeview.h
@@ -70,11 +70,22 @@ enum class SalEvent;
 

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

2023-06-02 Thread Noel Grandin (via logerrit)
 vcl/inc/osx/a11ywrapper.h |3 --
 vcl/osx/a11ywrapper.mm|   60 +++---
 vcl/osx/salframeview.mm   |8 ++
 3 files changed, 30 insertions(+), 41 deletions(-)

New commits:
commit 7acc7660a752497a546263d28e82a2e8f61fd702
Author: Noel Grandin 
AuthorDate: Thu Jun 1 14:24:41 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 2 08:03:00 2023 +0200

reduce memory overhead of AquaA11yWrapper

we can allocate this internally, which reduces the number of
heap allocations we need to do

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

diff --git a/vcl/inc/osx/a11ywrapper.h b/vcl/inc/osx/a11ywrapper.h
index f9b30eb98fcd..469e50820e19 100644
--- a/vcl/inc/osx/a11ywrapper.h
+++ b/vcl/inc/osx/a11ywrapper.h
@@ -52,7 +52,7 @@ struct ReferenceWrapper
 
 @interface AquaA11yWrapper : NSView
 {
-ReferenceWrapper * mpReferenceWrapper;
+ReferenceWrapper maReferenceWrapper;
 BOOL mActsAsRadioGroup;
 BOOL mIsTableCell;
 }
@@ -88,7 +88,6 @@ struct ReferenceWrapper
 -(NSWindow*)windowForParent;
 -(id)initWithAccessibleContext: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) anAccessibleContext;
 -(void) setDefaults: (css::uno::Reference < 
css::accessibility::XAccessibleContext >) rxAccessibleContext;
--(void) dealloc;
 +(void)setPopupMenuOpen:(BOOL)popupMenuOpen;
 -(css::accessibility::XAccessibleAction *)accessibleAction;
 -(css::accessibility::XAccessibleContext *)accessibleContext;
diff --git a/vcl/osx/a11ywrapper.mm b/vcl/osx/a11ywrapper.mm
index 96de29e07f77..75763a65a131 100644
--- a/vcl/osx/a11ywrapper.mm
+++ b/vcl/osx/a11ywrapper.mm
@@ -79,34 +79,33 @@ static std::ostream <<(std::ostream , NSObject 
*obj) {
 }
 
 -(void) setDefaults: (Reference < XAccessibleContext >) rxAccessibleContext {
-mpReferenceWrapper = new ReferenceWrapper;
 mActsAsRadioGroup = NO;
-mpReferenceWrapper -> rAccessibleContext = rxAccessibleContext;
+maReferenceWrapper.rAccessibleContext = rxAccessibleContext;
 mIsTableCell = NO;
 // Querying all supported interfaces
 try {
 // XAccessibleComponent
-mpReferenceWrapper->rAccessibleComponent.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleComponent.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleExtendedComponent
-mpReferenceWrapper->rAccessibleExtendedComponent.set( 
rxAccessibleContext, UNO_QUERY );
+maReferenceWrapper.rAccessibleExtendedComponent.set( 
rxAccessibleContext, UNO_QUERY );
 // XAccessibleSelection
-mpReferenceWrapper->rAccessibleSelection.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleSelection.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleTable
-mpReferenceWrapper->rAccessibleTable.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleTable.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleText
-mpReferenceWrapper->rAccessibleText.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleText.set( rxAccessibleContext, UNO_QUERY 
);
 // XAccessibleEditableText
-mpReferenceWrapper->rAccessibleEditableText.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleEditableText.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleValue
-mpReferenceWrapper->rAccessibleValue.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleValue.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleAction
-mpReferenceWrapper->rAccessibleAction.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleAction.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleTextAttributes
-mpReferenceWrapper->rAccessibleTextAttributes.set( 
rxAccessibleContext, UNO_QUERY );
+maReferenceWrapper.rAccessibleTextAttributes.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleMultiLineText
-mpReferenceWrapper->rAccessibleMultiLineText.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleMultiLineText.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleTextMarkup
-mpReferenceWrapper->rAccessibleTextMarkup.set( rxAccessibleContext, 
UNO_QUERY );
+maReferenceWrapper.rAccessibleTextMarkup.set( rxAccessibleContext, 
UNO_QUERY );
 // XAccessibleEventBroadcaster
 #if 0
 /* #i102033# NSAccessibility does not seemt to know an equivalent for 
transient children.
@@ -137,13 +136,6 @@ static std::ostream <<(std::ostream , NSObject 
*obj) {
 }
 }
 
--(void)dealloc {
-if ( mpReferenceWrapper ) {
-delete mpReferenceWrapper;
-}
-[ super dealloc ];
-}
-
 #pragma mark -
 

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

2023-05-24 Thread Noel Grandin (via logerrit)
 vcl/inc/unx/gtk/gtkgdi.hxx|1 +
 vcl/unx/gtk3/salnativewidgets-gtk.cxx |   16 +++-
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 55cca83ca3544d3ae82d978b017899ced9833cc5
Author: Noel Grandin 
AuthorDate: Tue May 23 15:06:07 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed May 24 10:17:03 2023 +0200

speedup drawing toolbars, cache min-width

doing the style lookup for the minWidth is really very slow in gtk

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

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index c0a032863ea4..2fc66ace5ece 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -201,6 +201,7 @@ private:
 static GtkStyleContext *mpRadioMenuItemRadioStyle;
 static GtkStyleContext *mpSeparatorMenuItemStyle;
 static GtkStyleContext *mpSeparatorMenuItemSeparatorStyle;
+static gint mnVerticalSeparatorMinWidth;
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
 static tools::Rectangle NWGetScrollButtonRect( ControlPart nPart, 
tools::Rectangle aAreaRect );
diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
index 425c642d45fd..a531a59527db 100644
--- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx
@@ -91,6 +91,7 @@ GtkStyleContext* GtkSalGraphics::mpRadioMenuItemStyle = 
nullptr;
 GtkStyleContext* GtkSalGraphics::mpRadioMenuItemRadioStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpSeparatorMenuItemStyle = nullptr;
 GtkStyleContext* GtkSalGraphics::mpSeparatorMenuItemSeparatorStyle = nullptr;
+gint GtkSalGraphics::mnVerticalSeparatorMinWidth = 0;
 
 #if !GTK_CHECK_VERSION(4, 0, 0)
 static void style_context_get_margin(GtkStyleContext *pContext, GtkBorder 
*pMargin)
@@ -1531,17 +1532,11 @@ static gfloat getArrowSize(GtkStyleContext* context)
 
 namespace
 {
-void draw_vertical_separator(GtkStyleContext *context, cairo_t *cr, const 
tools::Rectangle& rControlRegion)
+void draw_vertical_separator(GtkStyleContext *context, cairo_t *cr, const 
tools::Rectangle& rControlRegion, gint nSeparatorWidth)
 {
 tools::Long nX = 0;
 tools::Long nY = 0;
 
-gint nSeparatorWidth = 1;
-
-gtk_style_context_get(context,
-gtk_style_context_get_state(context),
-"min-width", , nullptr);
-
 gint nHalfSeparatorWidth = nSeparatorWidth / 2;
 gint nHalfRegionWidth = rControlRegion.GetWidth() / 2;
 
@@ -1854,14 +1849,14 @@ bool GtkSalGraphics::drawNativeControl( ControlType 
nType, ControlPart nPart, co
 break;
 case RenderType::ToolbarSeparator:
 {
-draw_vertical_separator(context, cr, rControlRegion);
+draw_vertical_separator(context, cr, rControlRegion, 
mnVerticalSeparatorMinWidth);
 break;
 }
 case RenderType::Separator:
 if (nPart == ControlPart::SeparatorHorz)
 draw_horizontal_separator(context, cr, rControlRegion);
 else
-draw_vertical_separator(context, cr, rControlRegion);
+draw_vertical_separator(context, cr, rControlRegion, 
mnVerticalSeparatorMinWidth);
 break;
 case RenderType::Arrow:
 gtk_render_arrow(context, cr,
@@ -2920,6 +2915,9 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, 
GtkWidget *pWindow )
 GtkToolItem *item = gtk_separator_tool_item_new();
 gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), item, -1);
 mpToolbarSeparatorStyle = gtk_widget_get_style_context(GTK_WIDGET(item));
+gtk_style_context_get(mpToolbarSeparatorStyle,
+gtk_style_context_get_state(mpToolbarSeparatorStyle),
+"min-width", , nullptr);
 
 GtkWidget *pButton = gtk_button_new();
 item = gtk_tool_button_new(pButton, nullptr);


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

2023-05-23 Thread Michael Meeks (via logerrit)
 vcl/inc/unx/cairotextrender.hxx |4 -
 vcl/unx/generic/gdi/cairotextrender.cxx |   68 +---
 2 files changed, 45 insertions(+), 27 deletions(-)

New commits:
commit 2a1e7671795ee6c6350b7d799b9c4742ffb67e78
Author: Michael Meeks 
AuthorDate: Tue May 23 20:13:14 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 23 22:13:34 2023 +0200

perf: surprising to see PDF being vsprintf'd during JSDialog rendering.

Avoid some hundreds of these:

_cairo_pdf_surface_show_page
...
cairo_surface_destroy
CairoTextRender::CairoTextRender

via.

SvpCairoTextRender: :SvpCairoTextRender(SvpSalGraphics&)
SvpSalGraphics: :SvpSalGraphics()
Change-Id: Ieefb65138f7e685f09dbf4c36a2fccd39b4b05cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152173
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 05f15d14ee27..ff0a2117811a 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -32,10 +32,6 @@ class VCL_DLLPUBLIC CairoTextRender : public 
FreeTypeTextRenderImpl
 {
 private:
 CairoCommon& mrCairoCommon;
-// https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/235
-// I don't want to have CAIRO_ROUND_GLYPH_POS_ON set in the cairo
-// surfaces font_options, but that's private, so tricky to achieve
-cairo_font_options_t* mpRoundGlyphPosOffOptions;
 protected:
 cairo_t*getCairoContext();
 voidreleaseCairoContext(cairo_t* cr);
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index e7689c1028e1..f962c21d39ed 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -131,35 +131,57 @@ extern "C"
 }
 #endif
 
-CairoTextRender::CairoTextRender(CairoCommon& rCairoCommon)
-: mrCairoCommon(rCairoCommon)
-{
-// https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/235
-// I don't want to have CAIRO_ROUND_GLYPH_POS_ON set in the cairo surfaces
-// font_options when trying subpixel rendering, but that's a private
-// feature of cairo_font_options_t, so tricky to achieve. Hack this by
-// getting the font options of a backend known to set this private feature
-// to CAIRO_ROUND_GLYPH_POS_OFF and then set to defaults the public
-// features and the result can be merged with new font options to set
-// CAIRO_ROUND_GLYPH_POS_OFF in those
-mpRoundGlyphPosOffOptions = cairo_font_options_create();
+namespace {
+struct CairoFontOptions
+{
+// https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/235
+// I don't want to have CAIRO_ROUND_GLYPH_POS_ON set in the cairo
+// surfaces font_options, but that's private, so tricky to achieve
+cairo_font_options_t* mpRoundGlyphPosOffOptions;
+
+CairoFontOptions()
+{
+// https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/235
+// I don't want to have CAIRO_ROUND_GLYPH_POS_ON set in the cairo 
surfaces
+// font_options when trying subpixel rendering, but that's a 
private
+// feature of cairo_font_options_t, so tricky to achieve. Hack 
this by
+// getting the font options of a backend known to set this private 
feature
+// to CAIRO_ROUND_GLYPH_POS_OFF and then set to defaults the public
+// features and the result can be merged with new font options to 
set
+// CAIRO_ROUND_GLYPH_POS_OFF in those
+mpRoundGlyphPosOffOptions = cairo_font_options_create();
 #if defined(CAIRO_HAS_SVG_SURFACE)
-// svg, pdf and ps backends have CAIRO_ROUND_GLYPH_POS_OFF by default
-cairo_surface_t* hack = cairo_svg_surface_create(nullptr, 1, 1);
+// svg, pdf and ps backends have CAIRO_ROUND_GLYPH_POS_OFF by 
default
+cairo_surface_t* hack = cairo_svg_surface_create(nullptr, 1, 1);
 #elif defined(CAIRO_HAS_PDF_SURFACE)
-cairo_surface_t* hack = cairo_pdf_surface_create(nullptr, 1, 1);
+cairo_surface_t* hack = cairo_pdf_surface_create(nullptr, 1, 1);
 #endif
-cairo_surface_get_font_options(hack, mpRoundGlyphPosOffOptions);
-cairo_surface_destroy(hack);
-cairo_font_options_set_antialias(mpRoundGlyphPosOffOptions, 
CAIRO_ANTIALIAS_DEFAULT);
-cairo_font_options_set_subpixel_order(mpRoundGlyphPosOffOptions, 
CAIRO_SUBPIXEL_ORDER_DEFAULT);
-cairo_font_options_set_hint_style(mpRoundGlyphPosOffOptions, 
CAIRO_HINT_STYLE_DEFAULT);
-cairo_font_options_set_hint_metrics(mpRoundGlyphPosOffOptions, 
CAIRO_HINT_METRICS_DEFAULT);
+cairo_surface_get_font_options(hack, mpRoundGlyphPosOffOptions);
+cairo_surface_destroy(hack);
+cairo_font_options_set_antialias(mpRoundGlyphPosOffOptions, 
CAIRO_ANTIALIAS_DEFAULT);
+

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

2023-05-17 Thread Caolán McNamara (via logerrit)
 vcl/inc/unx/salgdi.h|1 +
 vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx |3 +++
 2 files changed, 4 insertions(+)

New commits:
commit 24b1631dfd1c0701f13a10378580836c8862cdc4
Author: Caolán McNamara 
AuthorDate: Wed May 17 11:10:47 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 17 15:58:14 2023 +0200

menus all black with SAL_RTL_ENABLED=1 and SAL_USE_VCLPLUGIN=gen

export SAL_USE_VCLPLUGIN=gen
export SAL_RTL_ENABLED=1
run writer and the menus are all black

a problem since:

commit 622e8cd9e5c96d0fe0bb02e07d95efa93c156c44
Date:   Wed Jan 11 11:00:43 2023 +

reuse CairoCommon GetGraphicsWidth from X11CairoSalGraphicsImpl

so restore the use of mrParent.m_pFrame as done in original
implementation

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

diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 35b4d98d076d..1684530b30ff 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -81,6 +81,7 @@ public:
 
 class X11SalGraphics final : public SalGraphicsAutoDelegateToImpl
 {
+friend class X11CairoSalGraphicsImpl;
 friend class X11CairoTextRender;
 
 public:
diff --git a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx 
b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
index 53bf309375bc..d5a88631c192 100644
--- a/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
+++ b/vcl/unx/generic/gdi/X11CairoSalGraphicsImpl.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 
 X11CairoSalGraphicsImpl::X11CairoSalGraphicsImpl(X11SalGraphics& rParent, 
CairoCommon& rCairoCommon)
 : mrParent(rParent)
@@ -30,6 +31,8 @@ 
X11CairoSalGraphicsImpl::X11CairoSalGraphicsImpl(X11SalGraphics& rParent, CairoC
 
 tools::Long X11CairoSalGraphicsImpl::GetGraphicsWidth() const
 {
+if (mrParent.m_pFrame)
+return mrParent.m_pFrame->maGeometry.width();
 return mrCairoCommon.m_pSurface ? mrCairoCommon.m_aFrameSize.getX() : 0;
 }
 


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

2023-05-12 Thread Attila Szűcs (via logerrit)
 vcl/inc/jsdialog/jsdialogbuilder.hxx |4 
 vcl/jsdialog/executor.cxx|   10 --
 vcl/jsdialog/jsdialogbuilder.cxx |   35 +--
 3 files changed, 45 insertions(+), 4 deletions(-)

New commits:
commit 6be76f54a4e94b952975dfded25afff60257c6dd
Author: Attila Szűcs 
AuthorDate: Wed May 3 04:30:55 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri May 12 17:25:36 2023 +0200

LOK: Navi-4 tree dblclick

Removed sendUpdate that was called 1/sec, so selection dont revert 1/sec.
Put sendUpdate into set_cursor(), that seems to be a better spot.

Fixed set_cursor usage in executor, that caused slection to not work
in dblclick at all.
Because set_cursor(int) use not absolute position, but relative to parent
And root was used as parent, so it picked SwContent from the 1. lvl,
but the 1. lvl items are not real items, just SwContentTypes ..
e.g.:Headings.. that cannot be activated.. so never happened anything.

Change-Id: Iea373af3a0832a4f97202122bd36022eddf26efe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151308
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151703
Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx 
b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 27ac31784228..4d38d66fe9f1 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -749,6 +749,10 @@ public:
 virtual void expand_row(const weld::TreeIter& rIter) override;
 virtual void collapse_row(const weld::TreeIter& rIter) override;
 
+virtual void set_cursor(const weld::TreeIter& rIter) override;
+void set_cursor_without_notify(const weld::TreeIter& rIter);
+virtual void set_cursor(int pos) override;
+
 using SalInstanceTreeView::remove;
 virtual void remove(int pos) override;
 virtual void remove(const weld::TreeIter& rIter) override;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 2784acf0cae8..af514bc70dde 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -441,7 +441,8 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 std::unique_ptr 
itEntry(pTreeView->make_iterator());
 pTreeView->get_iter_abs_pos(*itEntry, nAbsPos);
 pTreeView->select(*itEntry);
-pTreeView->set_cursor(*itEntry);
+pTreeView->set_cursor_without_notify(*itEntry);
+pTreeView->grab_focus();
 LOKTrigger::trigger_changed(*pTreeView);
 return true;
 }
@@ -450,8 +451,11 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 sal_Int32 nRow = o3tl::toInt32(rData["data"]);
 
 pTreeView->unselect_all();
+std::unique_ptr 
itEntry(pTreeView->make_iterator());
+pTreeView->get_iter_abs_pos(*itEntry, nRow);
 pTreeView->select(nRow);
-pTreeView->set_cursor(nRow);
+pTreeView->set_cursor_without_notify(*itEntry);
+pTreeView->grab_focus();
 LOKTrigger::trigger_changed(*pTreeView);
 LOKTrigger::trigger_row_activated(*pTreeView);
 return true;
@@ -461,6 +465,8 @@ bool ExecuteAction(const OUString& nWindowId, const 
OUString& rWidget, StringMap
 sal_Int32 nAbsPos = o3tl::toInt32(rData["data"]);
 std::unique_ptr 
itEntry(pTreeView->make_iterator());
 pTreeView->get_iter_abs_pos(*itEntry, nAbsPos);
+pTreeView->set_cursor_without_notify(*itEntry);
+pTreeView->grab_focus();
 pTreeView->expand_row(*itEntry);
 return true;
 }
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index ed3a0893dbcb..a3c55e28ddfb 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -2016,16 +2016,47 @@ void JSTreeView::clear()
 sendUpdate();
 }
 
+void JSTreeView::set_cursor_without_notify(const weld::TreeIter& rIter)
+{
+SalInstanceTreeView::set_cursor(rIter);
+}
+
+void JSTreeView::set_cursor(const weld::TreeIter& rIter)
+{
+SalInstanceTreeView::set_cursor(rIter);
+sendUpdate();
+}
+
+void JSTreeView::set_cursor(int pos)
+{
+SalInstanceTreeView::set_cursor(pos);
+sendUpdate();
+}
+
 void JSTreeView::expand_row(const weld::TreeIter& rIter)
 {
+bool bNotify = false;
+const SalInstanceTreeIter& rVclIter = static_cast(rIter);
+if (!m_xTreeView->IsExpanded(rVclIter.iter))
+bNotify = true;
+
 SalInstanceTreeView::expand_row(rIter);
-sendUpdate();
+
+if (bNotify)
+  

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

2023-05-09 Thread Caolán McNamara (via logerrit)
 vcl/inc/qt5/QtFrame.hxx |2 
 vcl/inc/unx/gtk/gtkframe.hxx|2 
 vcl/inc/unx/salframe.h  |2 
 vcl/inc/unx/screensaverinhibitor.hxx|   28 ++--
 vcl/qt5/QtFrame.cxx |8 +-
 vcl/unx/generic/window/salframe.cxx |4 -
 vcl/unx/generic/window/screensaverinhibitor.cxx |   75 ++--
 vcl/unx/gtk3/gtkframe.cxx   |   15 +---
 8 files changed, 66 insertions(+), 70 deletions(-)

New commits:
commit 796fb57d7b2e2ea05795dc49c4438c25adc26fd4
Author: Caolán McNamara 
AuthorDate: Mon May 8 11:17:00 2023 +0100
Commit: Caolán McNamara 
CommitDate: Tue May 9 11:20:29 2023 +0200

Related: tdf#142176 rearrange screensaver inhibiter to be more generic

and for not-x11 I see gtk just uses 0 for xid (which is called
window_system_id there now)

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

diff --git a/vcl/inc/qt5/QtFrame.hxx b/vcl/inc/qt5/QtFrame.hxx
index 963572ca819b..b927d366765d 100644
--- a/vcl/inc/qt5/QtFrame.hxx
+++ b/vcl/inc/qt5/QtFrame.hxx
@@ -102,7 +102,7 @@ class VCLPLUG_QT_PUBLIC QtFrame : public QObject, public 
SalFrame
 QRect m_aRestoreGeometry;
 
 #if CHECK_ANY_QT_USING_X11
-ScreenSaverInhibitor m_ScreenSaverInhibitor;
+SessionManagerInhibitor m_SessionManagerInhibitor;
 ModKeyFlags m_nKeyModifiers;
 #endif
 
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 00bbd26379ae..1a83a7fc39d3 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -202,7 +202,7 @@ class GtkSalFrame final : public SalFrame
 boolm_bGraphics;
 ModKeyFlags m_nKeyModifiers;
 PointerStylem_ePointerStyle;
-ScreenSaverInhibitorm_ScreenSaverInhibitor;
+SessionManagerInhibitor m_SessionManagerInhibitor;
 gulong  m_nSetFocusSignalId;
 boolm_bFullscreen;
 boolm_bDefaultPos;
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
index 3bbf9729c971..d8a177d9a867 100644
--- a/vcl/inc/unx/salframe.h
+++ b/vcl/inc/unx/salframe.h
@@ -105,7 +105,7 @@ class X11SalFrame final : public SalFrame
 int m_nWorkArea;
 boolm_bSetFocusOnMap;
 
-ScreenSaverInhibitor maScreenSaverInhibitor;
+SessionManagerInhibitor maSessionManagerInhibitor;
 tools::Rectangle   maPaintRegion;
 
 Timer   maAlwaysOnTopRaiseTimer;
diff --git a/vcl/inc/unx/screensaverinhibitor.hxx 
b/vcl/inc/unx/screensaverinhibitor.hxx
index 4ddbb53f9c12..6cfa3e2fd700 100644
--- a/vcl/inc/unx/screensaverinhibitor.hxx
+++ b/vcl/inc/unx/screensaverinhibitor.hxx
@@ -19,17 +19,25 @@
 #include 
 #include 
 
-class VCL_PLUGIN_PUBLIC ScreenSaverInhibitor
+enum ApplicationInhibitFlags
+{
+APPLICATION_INHIBIT_LOGOUT = (1 << 0),
+APPLICATION_INHIBIT_SWITCH = (1 << 1),
+APPLICATION_INHIBIT_SUSPEND = (1 << 2),
+APPLICATION_INHIBIT_IDLE = (1 << 3) // Inhibit the session being marked as 
idle
+};
+
+class VCL_PLUGIN_PUBLIC SessionManagerInhibitor
 {
 public:
-void inhibit(bool bInhibit, std::u16string_view sReason, bool bIsX11,
- const std::optional& xid, 
std::optional pDisplay);
+void inhibit(bool bInhibit, std::u16string_view sReason, 
ApplicationInhibitFlags eType,
+ unsigned int window_system_id, std::optional 
pDisplay);
 
 private:
 // These are all used as guint, however this header may be included
 // in kde/tde/etc backends, where we would ideally avoid having
 // any glib dependencies, hence the direct use of unsigned int.
-std::optional mnFDOCookie; // FDO ScreenSaver Inhibit
+std::optional mnFDOSSCookie; // FDO ScreenSaver Inhibit
 std::optional mnFDOPMCookie; // FDO PowerManagement Inhibit
 std::optional mnGSMCookie;
 std::optional mnMSMCookie;
@@ -49,18 +57,20 @@ private:
 // all encompassing standard, hence we should just try all of them.
 //
 // The current APIs we have: (note: the list of supported environments is 
incomplete)
-// FDO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported 
only by KDE?
+// FDSSO: org.freedesktop.ScreenSaver::Inhibit - appears to be supported 
only by KDE?
 // FDOPM: org.freedesktop.PowerManagement.Inhibit::Inhibit - XFCE, (KDE) ?
 //(KDE: doesn't inhibit screensaver, but does inhibit 
PowerManagement)
 // GSM: org.gnome.SessionManager::Inhibit - gnome 3
 // MSM: org.mate.Sessionmanager::Inhibit - Mate <= 1.10, is identical to 
GSM
 //   (This is replaced by the GSM interface from Mate 1.12 onwards)
 //
-// Note: the Uninhibit call has 

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

2023-05-03 Thread Caolán McNamara (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx|2 +-
 vcl/source/gdi/pdfwriter_impl.cxx |   14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8b865782d798a33f95ddedad2bde78cb8450708a
Author: Caolán McNamara 
AuthorDate: Wed May 3 09:50:22 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 3 21:46:30 2023 +0200

pass the std::vector instead of its data()

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index fc9e68afc18b..bad2d387511c 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -937,7 +937,7 @@ i12626
 /* writes a font descriptor and returns its object id (or 0) */
 sal_Int32 emitFontDescriptor(const vcl::font::PhysicalFontFace*, 
FontSubsetInfo const &, sal_Int32 nSubsetID, sal_Int32 nStream);
 /* writes a ToUnicode cmap, returns the corresponding stream object */
-sal_Int32 createToUnicodeCMap( sal_uInt8 const * pEncoding, const sal_Ucs* 
pCodeUnits, const sal_Int32* pCodeUnitsPerGlyph,
+sal_Int32 createToUnicodeCMap( sal_uInt8 const * pEncoding, const 
std::vector& CodeUnits, const sal_Int32* pCodeUnitsPerGlyph,
const sal_Int32* pEncToUnicodeIndex, 
uint32_t nGlyphs );
 
 /* get resource dict object number */
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 7d51e3d916d1..d146e3ae85dc 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2556,7 +2556,7 @@ bool PDFWriterImpl::emitType3Font(const 
vcl::font::PhysicalFontFace* pFace,
 nFontDescriptor = emitFontDescriptor(pFace, aSubsetInfo, 
rSubset.m_nFontID, 0);
 
 if (nToUnicodeStream)
-nToUnicodeStream = createToUnicodeCMap(pEncoding, 
aCodeUnits.data(), pCodeUnitsPerGlyph,
+nToUnicodeStream = createToUnicodeCMap(pEncoding, aCodeUnits, 
pCodeUnitsPerGlyph,
pEncToUnicodeIndex, 
nGlyphs);
 
 // write font object
@@ -2865,14 +2865,14 @@ static void appendSubsetName( int nSubsetID, 
std::u16string_view rPSName, OStrin
 }
 
 sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 const * pEncoding,
-  const sal_Ucs* pCodeUnits,
+  const std::vector& 
rCodeUnits,
   const sal_Int32* 
pCodeUnitsPerGlyph,
   const sal_Int32* 
pEncToUnicodeIndex,
   uint32_t nGlyphs )
 {
 int nMapped = 0;
 for (auto n = 0u; n < nGlyphs; ++n)
-if (pCodeUnitsPerGlyph[n] && pCodeUnits[pEncToUnicodeIndex[n]])
+if (pCodeUnitsPerGlyph[n] && rCodeUnits[pEncToUnicodeIndex[n]])
 nMapped++;
 
 if( nMapped == 0 )
@@ -2900,7 +2900,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 
const * pEncoding,
 int nCount = 0;
 for (auto n = 0u; n < nGlyphs; ++n)
 {
-if (pCodeUnitsPerGlyph[n] && pCodeUnits[pEncToUnicodeIndex[n]])
+if (pCodeUnitsPerGlyph[n] && rCodeUnits[pEncToUnicodeIndex[n]])
 {
 if( (nCount % 100) == 0 )
 {
@@ -2916,8 +2916,8 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 
const * pEncoding,
 sal_Int32 nIndex = pEncToUnicodeIndex[n];
 for( sal_Int32 j = 0; j < pCodeUnitsPerGlyph[n]; j++ )
 {
-appendHex( static_cast(pCodeUnits[nIndex + j] / 
256), aContents );
-appendHex( static_cast(pCodeUnits[nIndex + j] & 
255), aContents );
+appendHex( static_cast(rCodeUnits[nIndex + j] / 
256), aContents );
+appendHex( static_cast(rCodeUnits[nIndex + j] & 
255), aContents );
 }
 aContents.append( ">\n" );
 nCount++;
@@ -3184,7 +3184,7 @@ bool PDFWriterImpl::emitFonts()
 sal_Int32 nFontDescriptor = emitFontDescriptor( subset.first, 
aSubsetInfo, s_subset.m_nFontID, nFontStream );
 
 if( nToUnicodeStream )
-nToUnicodeStream = createToUnicodeCMap( pEncoding, 
aCodeUnits.data(), pCodeUnitsPerGlyph, pEncToUnicodeIndex, nGlyphs );
+nToUnicodeStream = createToUnicodeCMap( pEncoding, 
aCodeUnits, pCodeUnitsPerGlyph, pEncToUnicodeIndex, nGlyphs );
 
 sal_Int32 nFontObject = createObject();
 if ( !updateObject( nFontObject ) ) return false;


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

2023-04-22 Thread Michael Weghorn (via logerrit)
 vcl/inc/qt5/QtAccessibleWidget.hxx |   19 +++
 vcl/qt5/QtAccessibleWidget.cxx |  212 -
 2 files changed, 183 insertions(+), 48 deletions(-)

New commits:
commit 84183c84d86456e3c311b35150b1fc9b63a85561
Author: Michael Weghorn 
AuthorDate: Sat Apr 22 09:22:38 2023 +0300
Commit: Michael Weghorn 
CommitDate: Sat Apr 22 11:33:32 2023 +0200

qt a11y: Implement QAccessibleSelectionInterface added in Qt 6.5

This adds an implementation of the
`QAccessibleSelectionInterface` that was added
in Qt 6.5 in commit [1]

commit 9d16d5e2245c26e5746fd7609300b84a2a983457
Author: Michael Weghorn 
Date:   Tue Oct 11 15:23:54 2022 +0200

a11y: Add new QAccessibleSelectionInterface

, s.a. QTBUG-105909 [2].

The `QAccessibleSelectionInterface` is currently still marked as
preliminary in Qt, so changes to the API *might* still happen
and require an update of the implementation here as well).

Quoting from the commit message of the above commit:

> This interface is marked \preliminary until:
>
> 1. There is a working a11y bridge for macOS/VoiceOver
> 2. There is a working a11y bridge for Windows/UI Automation
> 3. There is a working a11y bridge for linux/AT-SPI
> 4. There is at least one implementation (e.g. QAccessibleTable)
>that implements it successfully (second candidate:
>Qt Quick TableView [...])

The AT-SPI bridge (point 3 from above) has been implemented in [3]

commit ece2feee0317b582a56a0bfc783f11fe67d3edee
Author: Michael Weghorn 
Date:   Tue Oct 11 15:24:04 2022 +0200

a11y atspi: Bridge newly introduced QAccessibleSelectionInterface

, an implementation for `QAccessibleTable` (point 4 from above) was
added in [4]

commit 092bbc9ad30c6cd7389053dc4b332cc762693676
Author: Michael Weghorn 
Date:   Wed Oct 12 07:07:48 2022 +0200

a11y: Implement QAccessibleSelectionInterface for item views

. The Qt Gerrit changes for the macOS implementation (point 1 from
above) and the Windows/UIA implementation (point 2 from above)
are currently still awaiting review: [5] [6]

To avoid duplication, just call the newly added methods
`QtAccessibleWidget::selectedItemCount` and
`QtAccessibleWidget::selectedItem` from the
`QAccessibleTableInterface` methods
`QtAccessibleWidget::selectedCellCount` and
and `QtAccessibleWidget::selectedCells`, and
therefore implement the former also for Qt < 6.5.

Sample use of the interface from Accerciser's IPython
console (with 18 cells selected in Calc and the spreadsheet
object selected in Accerciser's a11y object tree; screencast
attached to QTBUG-105909 [2]):

In [10]: acc.get_interfaces()
Out[10]: ['Accessible', 'Component', 'Selection', 'Table']
In [11]: sel = acc.querySelection()
In [12]: sel.nSelectedChildren
Out[12]: 18
In [13]: sel.getSelectedChild(0).name
Out[13]: 'B1'
In [14]: sel.deselectSelectedChild(1)
Out[14]: True
In [15]: sel.deselectChild(1)
Out[15]: True
In [16]: sel.selectChild(0)
Out[16]: True
In [17]: sel.clearSelection()
Out[17]: True
In [18]: sel.selectAll()
Out[18]: True

[1] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9d16d5e2245c26e5746fd7609300b84a2a983457
[2] https://bugreports.qt.io/browse/QTBUG-105909
[3] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ece2feee0317b582a56a0bfc783f11fe67d3edee
[4] 
https://code.qt.io/cgit/qt/qtbase.git/commit/?id=092bbc9ad30c6cd7389053dc4b332cc762693676
[5] https://codereview.qt-project.org/c/qt/qtbase/+/451353
[6] https://codereview.qt-project.org/c/qt/qtbase/+/451646

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

diff --git a/vcl/inc/qt5/QtAccessibleWidget.hxx 
b/vcl/inc/qt5/QtAccessibleWidget.hxx
index 7e7625041c4f..d6d27c9cfcbd 100644
--- a/vcl/inc/qt5/QtAccessibleWidget.hxx
+++ b/vcl/inc/qt5/QtAccessibleWidget.hxx
@@ -40,6 +40,9 @@ class QtAccessibleWidget final : public QAccessibleInterface,
  public QAccessibleActionInterface,
  public QAccessibleTextInterface,
  public QAccessibleEditableTextInterface,
+#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
+ public QAccessibleSelectionInterface,
+#endif
  public QAccessibleTableCellInterface,
  public QAccessibleTableInterface,
  public QAccessibleValueInterface
@@ -147,6 +150,22 @@ public:
 virtual int 

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

2023-04-19 Thread Caolán McNamara (via logerrit)
 vcl/inc/salvtables.hxx|2 ++
 vcl/source/app/salvtables.cxx |9 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 3ec73488e447a693a14a773a7fb96938036c0324
Author: Caolán McNamara 
AuthorDate: Wed Apr 19 16:55:34 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Apr 19 21:55:13 2023 +0200

Resolves: tdf#154912 make double-click to expand rows the same as arrow 
expand

the arrow case does the necessary removal of the "dummy" entry which is
necessary to get the treeview to indicate it has children, while the
double click case skipped that step, so rearrange so both behave the
same.

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

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index cbb9fce51eee..096675cf9a49 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1548,6 +1548,8 @@ protected:
 DECL_LINK(CustomRenderHdl, svtree_render_args, void);
 DECL_LINK(CustomMeasureHdl, svtree_measure_args, Size);
 
+bool ExpandRow(const SalInstanceTreeIter& rIter);
+
 // Each row has a cell for the expander image, (and an optional cell for a
 // checkbutton if enable_toggle_buttons has been called) which precede
 // index 0
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 0b818bf2f5f4..faad9efb1e3a 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4815,7 +4815,7 @@ void SalInstanceTreeView::expand_row(const 
weld::TreeIter& rIter)
 {
 assert(m_xTreeView->IsUpdateMode() && "don't expand when frozen");
 const SalInstanceTreeIter& rVclIter = static_cast(rIter);
-if (!m_xTreeView->IsExpanded(rVclIter.iter) && signal_expanding(rIter))
+if (!m_xTreeView->IsExpanded(rVclIter.iter) && ExpandRow(rVclIter))
 m_xTreeView->Expand(rVclIter.iter);
 }
 
@@ -5329,7 +5329,12 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, 
SvTreeListBox*, bool)
 }
 
 // expanding
+return ExpandRow(aIter);
+}
 
+bool SalInstanceTreeView::ExpandRow(const SalInstanceTreeIter& rIter)
+{
+SvTreeListEntry* pEntry = rIter.iter;
 // if there's a preexisting placeholder child, required to make this
 // potentially expandable in the first place, now we remove it
 SvTreeListEntry* pPlaceHolder = GetPlaceHolderChild(pEntry);
@@ -5339,7 +5344,7 @@ IMPL_LINK_NOARG(SalInstanceTreeView, ExpandingHdl, 
SvTreeListBox*, bool)
 m_xTreeView->RemoveEntry(pPlaceHolder);
 }
 
-bool bRet = signal_expanding(aIter);
+bool bRet = signal_expanding(rIter);
 
 if (pPlaceHolder)
 {


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

2023-04-17 Thread Stephan Bergmann (via logerrit)
 vcl/inc/win/saldata.hxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 955b4aa7619206e2ae38127e3cfaecbf1d1d7e11
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:21:42 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 17:15:36 2023 +0200

loplugin:nullptr

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

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index b5740d5670a4..80acfaabec31 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -62,11 +62,11 @@ class SkiaControlsCache;
 
 struct HDCCache
 {
-HDC mhDC = 0;
-HPALETTEmhDefPal = 0;
-HBITMAP mhDefBmp = 0;
-HBITMAP mhSelBmp = 0;
-HBITMAP mhActBmp = 0;
+HDC mhDC = nullptr;
+HPALETTEmhDefPal = nullptr;
+HBITMAP mhDefBmp = nullptr;
+HBITMAP mhSelBmp = nullptr;
+HBITMAP mhActBmp = nullptr;
 };
 
 struct SalIcon


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

2023-04-13 Thread Noel Grandin (via logerrit)
 vcl/inc/printerinfomanager.hxx |2 +-
 vcl/null/printerinfomanager.cxx|2 +-
 vcl/unx/generic/printer/printerinfomanager.cxx |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5652ecbf8bf9bf8b3c15764c38d26fe4b449cb64
Author: Noel Grandin 
AuthorDate: Thu Apr 13 11:01:23 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 13 18:47:15 2023 +0200

use more string_view in PrinterInfoManager

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

diff --git a/vcl/inc/printerinfomanager.hxx b/vcl/inc/printerinfomanager.hxx
index 3b5394ace0e9..a89cff1118a5 100644
--- a/vcl/inc/printerinfomanager.hxx
+++ b/vcl/inc/printerinfomanager.hxx
@@ -161,7 +161,7 @@ public:
 bool getUseJobPatch() const { return m_bUseJobPatch; }
 
 // check whether a printer's feature string contains a subfeature
-bool checkFeatureToken( const OUString& rPrinterName, const char* pToken ) 
const;
+bool checkFeatureToken( const OUString& rPrinterName, std::string_view 
pToken ) const;
 
 virtual ~PrinterInfoManager();
 };
diff --git a/vcl/null/printerinfomanager.cxx b/vcl/null/printerinfomanager.cxx
index 24515dbc149e..7b95d3b28e11 100644
--- a/vcl/null/printerinfomanager.cxx
+++ b/vcl/null/printerinfomanager.cxx
@@ -81,7 +81,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( const 
OUString& /* rPrint
 return aEmptyInfo;
 }
 
-bool PrinterInfoManager::checkFeatureToken( const OUString& /* rPrinterName 
*/, const char* /* pToken */ ) const
+bool PrinterInfoManager::checkFeatureToken( const OUString& /* rPrinterName 
*/, std::string_view /* pToken */ ) const
 {
 (void) this;
 
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx 
b/vcl/unx/generic/printer/printerinfomanager.cxx
index a2d99ccf0e59..c81e4ce256ee 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -548,7 +548,7 @@ const PrinterInfo& PrinterInfoManager::getPrinterInfo( 
const OUString& rPrinter
 return it != m_aPrinters.end() ? it->second.m_aInfo : aEmptyInfo;
 }
 
-bool PrinterInfoManager::checkFeatureToken( const OUString& rPrinterName, 
const char* pToken ) const
+bool PrinterInfoManager::checkFeatureToken( const OUString& rPrinterName, 
std::string_view pToken ) const
 {
 const PrinterInfo& rPrinterInfo( getPrinterInfo( rPrinterName ) );
 sal_Int32 nIndex = 0;


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

2023-04-13 Thread Noel Grandin (via logerrit)
 vcl/inc/win/saldata.hxx |   33 +
 vcl/win/app/salinst.cxx |1 -
 vcl/win/gdi/salgdi.cxx  |   11 +++
 3 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit 209e859c3e78d5818df3e3f84669aaa2a3810c01
Author: Noel Grandin 
AuthorDate: Wed Apr 12 13:46:00 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Apr 13 10:04:42 2023 +0200

no need to allocate these separately

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

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index c391086b30a1..b5740d5670a4 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -21,6 +21,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -53,6 +54,21 @@ class SkiaControlsCache;
 #define MAX_STOCKBRUSH  4
 #define SAL_CLIPRECT_COUNT  16
 
+#define CACHESIZE_HDC   3
+#define CACHED_HDC_10
+#define CACHED_HDC_21
+#define CACHED_HDC_DRAW 2
+#define CACHED_HDC_DEFEXT   64
+
+struct HDCCache
+{
+HDC mhDC = 0;
+HPALETTEmhDefPal = 0;
+HBITMAP mhDefBmp = 0;
+HBITMAP mhSelBmp = 0;
+HBITMAP mhActBmp = 0;
+};
+
 struct SalIcon
 {
 int nId;
@@ -96,7 +112,7 @@ public:
 WinSalObject*   mpFirstObject;  // pointer of first object 
window
 WinSalVirtualDevice*mpFirstVD;  // first VirDev
 WinSalPrinter*  mpFirstPrinter; // first printing printer
-HDCCache*   mpHDCCache; // Cache for three DC's
+std::array maHDCCache; // Cache for three DC's
 HBITMAP mh50Bmp;// 50% Bitmap
 HBRUSH  mh50Brush;  // 50% Brush
 COLORREFmaStockPenColorAry[MAX_STOCKPEN];
@@ -139,21 +155,6 @@ struct SalShlData
 
 extern SalShlData aSalShlData;
 
-#define CACHESIZE_HDC   3
-#define CACHED_HDC_10
-#define CACHED_HDC_21
-#define CACHED_HDC_DRAW 2
-#define CACHED_HDC_DEFEXT   64
-
-struct HDCCache
-{
-HDC mhDC;
-HPALETTEmhDefPal;
-HBITMAP mhDefBmp;
-HBITMAP mhSelBmp;
-HBITMAP mhActBmp;
-};
-
 void ImplClearHDCCache( SalData* pData );
 HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp = nullptr );
 void ImplReleaseCachedDC( sal_uLong nID );
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3e2cc7a04754..a2aabbab2870 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -261,7 +261,6 @@ SalData::SalData()
 mpFirstObject = nullptr;// pointer of first object window
 mpFirstVD = nullptr;// first VirDev
 mpFirstPrinter = nullptr;   // first printing printer
-mpHDCCache = nullptr;   // Cache for three DC's
 mh50Bmp = nullptr;  // 50% Bitmap
 mh50Brush = nullptr;// 50% Brush
 int i;
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 8a38a684ca35..cb3cad6508ed 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -134,10 +134,6 @@ void ImplInitSalGDI()
 pSalData->mhStockBrushAry[3]= CreateSolidBrush( 
pSalData->maStockBrushColorAry[3] );
 pSalData->mnStockBrushCount = 4;
 
-// initialize cache of device contexts
-pSalData->mpHDCCache = new HDCCache[ CACHESIZE_HDC ];
-memset( pSalData->mpHDCCache, 0, CACHESIZE_HDC * sizeof( HDCCache ) );
-
 // initialize temporary font lists
 pSalData->mpSharedTempFontItem = nullptr;
 pSalData->mpOtherTempFontItem = nullptr;
@@ -318,7 +314,6 @@ void ImplFreeSalGDI()
 }
 
 ImplClearHDCCache( pSalData );
-delete[] pSalData->mpHDCCache;
 
 // delete Ditherpalette, if existing
 if ( pSalData->mhDitherPal )
@@ -511,7 +506,7 @@ void WinSalGraphics::setHDC(HDC aNew)
 HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
 {
 SalData*pSalData = GetSalData();
-HDCCache*   pC = >mpHDCCache[ nID ];
+HDCCache*   pC = >maHDCCache[ nID ];
 
 if( !pC->mhDC )
 {
@@ -543,7 +538,7 @@ HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
 void ImplReleaseCachedDC( sal_uLong nID )
 {
 SalData*pSalData = GetSalData();
-HDCCache*   pC = >mpHDCCache[ nID ];
+HDCCache*   pC = >maHDCCache[ nID ];
 
 if ( pC->mhActBmp )
 SelectObject( pC->mhDC, pC->mhSelBmp );
@@ -553,7 +548,7 @@ void ImplClearHDCCache( SalData* pData )
 {
 for( sal_uLong i = 0; i < CACHESIZE_HDC; i++ )
 {
-HDCCache* pC = >mpHDCCache[ i ];
+HDCCache* pC = >maHDCCache[ i ];
 
 if( pC->mhDC )
 {


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

2023-04-12 Thread Noel Grandin (via logerrit)
 vcl/inc/win/saldata.hxx  |3 ---
 vcl/source/app/scheduler.cxx |1 -
 vcl/win/app/salinst.cxx  |1 -
 vcl/win/window/salframe.cxx  |   19 ---
 4 files changed, 24 deletions(-)

New commits:
commit 5944f8dc9a20c5c1cd450cd457bcc973f649b7ca
Author: Noel Grandin 
AuthorDate: Wed Apr 12 12:42:50 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 12 16:01:26 2023 +0200

mpMouseLeaveTimer has been dead

ever since it was added in
commit 8229967979d96bd01e63e2954b7af35a57d9e08c
Date:   Thu Sep 20 15:23:39 2007 +
INTEGRATION: CWS os2port01 (1.2.2); FILE ADDED
2006/11/29 14:34:20 ydario 1.2.2.1: Initial OS/2 import.

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

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index 2d20903d6157..c391086b30a1 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -91,7 +91,6 @@ public:
 std::unique_ptr mpDitherHigh;   // Dither mapping table
 HHOOK   mhSalObjMsgHook;// hook to get interesting 
msg for SalObject
 HWNDmhWantLeaveMsg; // window handle, that 
want a MOUSELEAVE message
-AutoTimer*  mpMouseLeaveTimer;  // Timer for MouseLeave 
Test
 WinSalInstance* mpInstance;
 WinSalFrame*mpFirstFrame;   // pointer of first frame
 WinSalObject*   mpFirstObject;  // pointer of first object 
window
@@ -201,8 +200,6 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const 
char* pStr2 );
 #define SAL_OBJECT_CHILDCLASSNAMEW  L"SALOBJECTCHILD"
 #define SAL_COM_CLASSNAMEW  L"SALCOMWND"
 
-#define SAL_MOUSELEAVE_TIMEOUT  300
-
 // wParam == bWait; lParam == 0
 #define SAL_MSG_THREADYIELD (WM_USER+111)
 // wParam == 0; lParam == nMS
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 7afdfd0846e6..098242fe6c70 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -160,7 +160,6 @@ next_priority:
 || !strcmp( pTask->GetDebugName(), "desktop::Desktop 
m_firstRunTimer" )
 || !strcmp( pTask->GetDebugName(), 
"DrawWorkStartupTimer" )
 || !strcmp( pTask->GetDebugName(), 
"editeng::ImpEditEngine aOnlineSpellTimer" )
-|| !strcmp( pTask->GetDebugName(), "ImplHandleMouseMsg 
SalData::mpMouseLeaveTimer" )
 || !strcmp( pTask->GetDebugName(), "sc ScModule 
IdleTimer" )
 || !strcmp( pTask->GetDebugName(), 
"sd::CacheConfiguration maReleaseTimer" )
 || !strcmp( pTask->GetDebugName(), 
"svtools::GraphicCache maReleaseTimer" )
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 3afb38c04648..3e2cc7a04754 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -256,7 +256,6 @@ SalData::SalData()
 mpDitherHigh = nullptr; // Dither mapping table
 mhSalObjMsgHook = nullptr;  // hook to get interesting msg for SalObject
 mhWantLeaveMsg = nullptr;   // window handle, that want a MOUSELEAVE 
message
-mpMouseLeaveTimer = nullptr; // Timer for MouseLeave Test
 mpInstance = nullptr;  // pointer of first instance
 mpFirstFrame = nullptr; // pointer of first frame
 mpFirstObject = nullptr;// pointer of first object window
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 7b88c3ab8a67..48a251c38e86 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -984,11 +984,6 @@ WinSalFrame::~WinSalFrame()
 if ( pSalData->mhWantLeaveMsg == mhWnd )
 {
 pSalData->mhWantLeaveMsg = nullptr;
-if ( pSalData->mpMouseLeaveTimer )
-{
-delete pSalData->mpMouseLeaveTimer;
-pSalData->mpMouseLeaveTimer = nullptr;
-}
 }
 
 // remove windows properties
@@ -3185,15 +3180,6 @@ static bool ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
 SendMessageW( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, 
GetMessagePos() );
 
 pSalData->mhWantLeaveMsg = hWnd;
-// Start MouseLeave-Timer
-if ( !pSalData->mpMouseLeaveTimer )
-{
-pSalData->mpMouseLeaveTimer = new AutoTimer( 
"ImplHandleMouseMsg SalData::mpMouseLeaveTimer" );
-pSalData->mpMouseLeaveTimer->SetTimeout( 
SAL_MOUSELEAVE_TIMEOUT );
-pSalData->mpMouseLeaveTimer->Start();
-// We don't need to set a timeout handler, because we test
-// for mouseleave in the timeout callback
-}
 aMouseEvt.mnButton = 0;
 nEvent = SalEvent::MouseMove;
 }
@@ -3226,11 +3212,6 @@ 

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

2023-04-12 Thread Noel Grandin (via logerrit)
 vcl/inc/win/saldata.hxx |6 +++---
 vcl/win/gdi/salgdi.cxx  |   18 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 9cfa99594cc21ad42f3428c4e2c521dd87511fc2
Author: Noel Grandin 
AuthorDate: Wed Apr 12 13:40:08 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 12 15:47:03 2023 +0200

use more unique_ptr in SalData

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

diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index 3145688e24be..2d20903d6157 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -86,9 +86,9 @@ public:
 HGLOBAL mhDitherDIB;// dither memory handle
 BYTE*   mpDitherDIB;// dither memory
 BYTE*   mpDitherDIBData;// beginning of DIB data
-tools::Long*mpDitherDiff;   // Dither mapping table
-BYTE*   mpDitherLow;// Dither mapping table
-BYTE*   mpDitherHigh;   // Dither mapping table
+std::unique_ptr mpDitherDiff;// Dither mapping table
+std::unique_ptr mpDitherLow;// Dither mapping table
+std::unique_ptr mpDitherHigh;   // Dither mapping table
 HHOOK   mhSalObjMsgHook;// hook to get interesting 
msg for SalObject
 HWNDmhWantLeaveMsg; // window handle, that 
want a MOUSELEAVE message
 AutoTimer*  mpMouseLeaveTimer;  // Timer for MouseLeave 
Test
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 630933192687..8a38a684ca35 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -180,9 +180,9 @@ void ImplInitSalGDI()
 
 pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( 
BITMAPINFOHEADER ) + 192 );
 pSalData->mpDitherDIB = static_cast(GlobalLock( 
pSalData->mhDitherDIB ));
-pSalData->mpDitherDiff = new tools::Long[ 256 ];
-pSalData->mpDitherLow = new BYTE[ 256 ];
-pSalData->mpDitherHigh = new BYTE[ 256 ];
+pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
+pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
+pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
 pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( 
BITMAPINFOHEADER );
 memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
 
@@ -254,9 +254,9 @@ void ImplInitSalGDI()
 
 pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
 pSalData->mpDitherDIB = static_cast(GlobalLock( 
pSalData->mhDitherDIB ));
-pSalData->mpDitherDiff = new tools::Long[ 256 ];
-pSalData->mpDitherLow = new BYTE[ 256 ];
-pSalData->mpDitherHigh = new BYTE[ 256 ];
+pSalData->mpDitherDiff.reset(new tools::Long[ 256 ]);
+pSalData->mpDitherLow.reset(new BYTE[ 256 ]);
+pSalData->mpDitherHigh.reset(new BYTE[ 256 ]);
 pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( 
BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
 memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
 
@@ -333,9 +333,9 @@ void ImplFreeSalGDI()
 GlobalUnlock( pSalData->mhDitherDIB );
 GlobalFree( pSalData->mhDitherDIB );
 pSalData->mhDitherDIB = nullptr;
-delete[] pSalData->mpDitherDiff;
-delete[] pSalData->mpDitherLow;
-delete[] pSalData->mpDitherHigh;
+pSalData->mpDitherDiff.reset();
+pSalData->mpDitherLow.reset();
+pSalData->mpDitherHigh.reset();
 }
 
 DeleteSysColorList();


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

2023-04-12 Thread Noel Grandin (via logerrit)
 vcl/inc/svdata.hxx|2 +-
 vcl/source/window/window2.cxx |7 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 6629bdff20602935f042838ede5e8986a120b5f0
Author: Noel Grandin 
AuthorDate: Wed Apr 12 12:48:30 2023 +0200
Commit: Noel Grandin 
CommitDate: Wed Apr 12 13:57:13 2023 +0200

use more unique_ptr in ImplSVWinData

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

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 0a34fb2f4234..6d1d8adac015 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -258,7 +258,7 @@ struct ImplSVWinData
 std::vector> mpExecuteDialogs;   ///< Stack of 
dialogs that are Execute()'d - the last one is the top most one.
 VclPtr mpExtTextInputWin;  // Window, which 
is in ExtTextInput
 VclPtr mpTrackWin; // window, that is 
in tracking mode
-AutoTimer*  mpTrackTimer = nullptr; // tracking timer
+std::unique_ptr mpTrackTimer;// tracking timer
 std::vector  maMsgBoxImgList;// ImageList for 
MessageBox
 VclPtr mpAutoScrollWin;// window, that is 
in AutoScrollMode mode
 VclPtr mpLastWheelWindow;  // window, that 
last received a mouse wheel event
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 6a6f20dab5a7..46d8bd7f8881 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -268,7 +268,7 @@ void Window::StartTracking( StartTrackingFlags nFlags )
 if ( !mpWindowImpl->mbUseFrameData &&
  (nFlags & (StartTrackingFlags::ScrollRepeat | 
StartTrackingFlags::ButtonRepeat)) )
 {
-pSVData->mpWinData->mpTrackTimer = new AutoTimer("vcl::Window 
pSVData->mpWinData->mpTrackTimer");
+pSVData->mpWinData->mpTrackTimer.reset(new AutoTimer("vcl::Window 
pSVData->mpWinData->mpTrackTimer"));
 
 if ( nFlags & StartTrackingFlags::ScrollRepeat )
 pSVData->mpWinData->mpTrackTimer->SetTimeout( 
MouseSettings::GetScrollRepeat() );
@@ -304,10 +304,7 @@ void Window::EndTracking( TrackingEventFlags nFlags )
 return;
 
 if ( !mpWindowImpl->mbUseFrameData && pSVData->mpWinData->mpTrackTimer )
-{
-delete pSVData->mpWinData->mpTrackTimer;
-pSVData->mpWinData->mpTrackTimer = nullptr;
-}
+pSVData->mpWinData->mpTrackTimer.reset();
 
 mpWindowImpl->mpFrameData->mpTrackWin = pSVData->mpWinData->mpTrackWin = 
nullptr;
 pSVData->mpWinData->mnTrackFlags  = StartTrackingFlags::NONE;


  1   2   3   4   5   6   7   8   9   10   >