[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-02-09 Thread Noel Grandin (via logerrit)
 vcl/source/app/salvtables.cxx |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 7192448a9caa2b578db8e70cee73976b91e9d1e2
Author: Noel Grandin 
AuthorDate: Mon Jan 30 15:50:31 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Feb 9 13:09:17 2023 +

tdf#150380 Calc crash clicking on the title of the Border Color toolbar 
popdown

There is probably a better fix for this, but we have a popup inside a
popup here, so some weirdness is to be expected.

At least it doesn't crash now.

Change-Id: Ifaa928c47c3cbfaec8379f01f007b0c1daf4e5a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146359
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 
(cherry picked from commit f4a24366dd111c7c7434f4a887d7097ced6b5f55)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146330
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 2c998bd6d0a2..0c2f229d5d92 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1282,7 +1282,13 @@ void SalInstanceContainer::move(weld::Widget* pWidget, 
weld::Container* pNewPare
 assert(!pNewParent || pNewVclParent);
 vcl::Window* pVclWindow = pVclWidget->getWidget();
 if (pNewVclParent)
-pVclWindow->SetParent(pNewVclParent->getWidget());
+{
+vcl::Window* pNew = pNewVclParent->getWidget();
+if (!pNew->isDisposed())
+pVclWindow->SetParent(pNewVclParent->getWidget());
+else
+SAL_WARN("vcl", "ignoring move because new parent is already 
disposed");
+}
 else
 {
 pVclWindow->Hide();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-02-13 Thread Szymon Kłos (via logerrit)
 vcl/source/control/PriorityMergedHBox.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit e76c651af0e4b77bc05c53191263ec49fc012e4c
Author: Szymon Kłos 
AuthorDate: Mon Feb 6 14:39:56 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Feb 13 11:59:14 2023 +

tdf#147740 fix disappearing icons in groupbar

Change-Id: Ia67b90d05bccbd4d2c2553109ea7372574ee21d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146584
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 
(cherry picked from commit 1e23e26d48eabb829c39304a78fad26b10f76d7f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146629
Reviewed-by: Christian Lohmaier 
(cherry picked from commit db1c7c55fe0cd35ead3174b3eb7f0cdad1a475f3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146712
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/control/PriorityMergedHBox.cxx 
b/vcl/source/control/PriorityMergedHBox.cxx
index 75a26daa52c1..65d51cce378c 100644
--- a/vcl/source/control/PriorityMergedHBox.cxx
+++ b/vcl/source/control/PriorityMergedHBox.cxx
@@ -155,6 +155,15 @@ Size PriorityMergedHBox::calculateRequisition() const
 accumulateMaxes(aChildSize, aSize);
 }
 
+// find max height
+for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
+ pChild = pChild->GetWindow(GetWindowType::Next))
+{
+Size aChildSize = getLayoutRequisition(*pChild);
+setPrimaryDimension(aChildSize, getPrimaryDimension(aSize));
+accumulateMaxes(aChildSize, aSize);
+}
+
 setPrimaryDimension(aSize, 200);
 return finalizeMaxes(aSize, nVisibleChildren);
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-03-02 Thread Caolán McNamara (via logerrit)
 vcl/source/app/salvtables.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit dbe36c47aa685ccdcfd05e5116348ace7b3bd68f
Author: Caolán McNamara 
AuthorDate: Mon Feb 27 16:32:37 2023 +
Commit: Michael Stahl 
CommitDate: Thu Mar 2 10:16:24 2023 +

Related: tdf#153784 margin_bottom is a cnp nonsense, should be margin_end

Change-Id: Id14f63a8bfb64622e505903820b7f081c368389c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147924
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 3b279889daa9c37fe91663d16dd2d8c5938cc0d5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147992
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 0c2f229d5d92..2d3b6546d85a 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -380,7 +380,7 @@ void SalInstanceWidget::set_margin_bottom(int nMargin) { 
m_xWidget->set_margin_b
 
 void SalInstanceWidget::set_margin_start(int nMargin) { 
m_xWidget->set_margin_start(nMargin); }
 
-void SalInstanceWidget::set_margin_end(int nMargin) { 
m_xWidget->set_margin_bottom(nMargin); }
+void SalInstanceWidget::set_margin_end(int nMargin) { 
m_xWidget->set_margin_end(nMargin); }
 
 int SalInstanceWidget::get_margin_top() const { return 
m_xWidget->get_margin_top(); }
 
@@ -388,7 +388,7 @@ int SalInstanceWidget::get_margin_bottom() const { return 
m_xWidget->get_margin_
 
 int SalInstanceWidget::get_margin_start() const { return 
m_xWidget->get_margin_start(); }
 
-int SalInstanceWidget::get_margin_end() const { return 
m_xWidget->get_margin_bottom(); }
+int SalInstanceWidget::get_margin_end() const { return 
m_xWidget->get_margin_end(); }
 
 void SalInstanceWidget::set_accessible_name(const OUString& rName)
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-03-08 Thread Caolán McNamara (via logerrit)
 vcl/source/bitmap/BitmapFastScaleFilter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 63643ca0d3195069a65dbb37bc85ba2d49d337e5
Author: Caolán McNamara 
AuthorDate: Mon Mar 6 17:06:41 2023 +
Commit: Michael Stahl 
CommitDate: Wed Mar 8 08:51:22 2023 +

ofz#56734 Abrt

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

diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx 
b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
index 362de6de706d..14fa2464f399 100644
--- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
@@ -38,7 +38,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& 
rBitmapEx) const
 
 SAL_INFO("vcl.gdi", "New width: " << nNewWidth << "\nNew height: " << 
nNewHeight);
 
-if (nNewWidth && nNewHeight)
+if (nNewWidth > 0 && nNewHeight > 0)
 {
 Bitmap::ScopedReadAccess pReadAcc(aBitmap);
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-03-11 Thread Caolán McNamara (via logerrit)
 vcl/source/treelist/svimpbox.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b414cb574d0641d387a8c6190112746929e88d52
Author: Caolán McNamara 
AuthorDate: Fri Mar 10 15:53:06 2023 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Mar 11 22:03:18 2023 +

Resolves: tdf#132847 large scrolls that cause page up/down are still 
"scrolls"

and should emit NotifyScrolled even if the scroll is large enough that
the call to internal "scroll" optimization is omitted.

(and like cursor up/down call NotifyScrolled after ShowCursor)

Change-Id: Ie605bde8ce8312b2ff2be9fb471e2f7516b355d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148623
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 453edb8dc53b..5d3202f266c3 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -402,10 +402,10 @@ void SvImpLBox::PageDown( sal_uInt16 nDelta )
 m_pView->PaintImmediately();
 m_pView->Scroll( 0, nScroll, aArea, ScrollFlags::NoChildren );
 m_pView->PaintImmediately();
-m_pView->NotifyScrolled();
 }
 
 ShowCursor( true );
+m_pView->NotifyScrolled();
 }
 
 void SvImpLBox::PageUp( sal_uInt16 nDelta )
@@ -437,10 +437,10 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta )
 m_pView->PaintImmediately();
 m_pView->Scroll( 0, nEntryHeight*nRealDelta, aArea, 
ScrollFlags::NoChildren );
 m_pView->PaintImmediately();
-m_pView->NotifyScrolled();
 }
 
 ShowCursor( true );
+m_pView->NotifyScrolled();
 }
 
 void SvImpLBox::KeyUp( bool bPageUp )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-03-14 Thread Caolán McNamara (via logerrit)
 vcl/source/treelist/svimpbox.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 246596fb206fd05d8420834730ff87051a155ab3
Author: Caolán McNamara 
AuthorDate: Sun Mar 12 21:19:15 2023 +
Commit: Michael Stahl 
CommitDate: Tue Mar 14 10:13:11 2023 +

tdf#132847 emit NotifyScrolled on use of end/home to scroll to end/start

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

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 5d3202f266c3..e75a13945ae6 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -946,6 +946,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool 
bMoveToTop )
 FillView();
 m_aVerSBar->SetThumbPos( static_cast(m_pView->GetVisiblePos( 
m_pStartEntry )) );
 ShowCursor( true );
+m_pView->NotifyScrolled();
 m_pView->Invalidate();
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-12-14 Thread Caolán McNamara (via logerrit)
 vcl/source/window/paint.cxx |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 344d90b20bdf95e9888f916672bbe51a5d700d02
Author: Caolán McNamara 
AuthorDate: Wed Nov 23 17:29:56 2022 +
Commit: Christian Lohmaier 
CommitDate: Wed Dec 14 11:09:08 2022 +

tdf#152094 don't attempt scroll paint optimization for devices with a 
mapmode

Change-Id: I446cf9ee62faf564143d25db60643c9b6cd8e3d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143157
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 40172ade6a9e..a70f1c0e4004 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1645,6 +1645,12 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
 if ( !nHorzScroll && !nVertScroll )
 return;
 
+// There will be no CopyArea() call below, so invalidate the whole visible
+// area, not only the smaller one that was just scrolled in.
+// Do this when we have a double buffer anyway, or (tdf#152094) the device 
has a map mode enabled which
+// makes the conversion to pixel inaccurate
+const bool bCopyExistingAreaAndElideInvalidate = 
!SupportsDoubleBuffering() && !GetOutDev()->IsMapModeEnabled();
+
 if ( mpWindowImpl->mpCursor )
 mpWindowImpl->mpCursor->ImplSuspend();
 
@@ -1692,13 +1698,8 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
 tools::Rectangle aDestRect(aRectMirror);
 aDestRect.Move(bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll);
 vcl::Region aWinInvalidateRegion(aRectMirror);
-if (!SupportsDoubleBuffering())
-{
-// There will be no CopyArea() call below, so invalidate the
-// whole visible area, not only the smaller one that was just
-// scrolled in.
+if (bCopyExistingAreaAndElideInvalidate)
 aWinInvalidateRegion.Exclude(aDestRect);
-}
 
 aInvalidateRegion.Union(aWinInvalidateRegion);
 
@@ -1743,7 +1744,7 @@ void Window::ImplScroll( const tools::Rectangle& rRect,
 SalGraphics* pGraphics = ImplGetFrameGraphics();
 // The invalidation area contains the area what would be copied here,
 // so avoid copying in case of double buffering.
-if (pGraphics && !SupportsDoubleBuffering())
+if (pGraphics && bCopyExistingAreaAndElideInvalidate)
 {
 if( bReMirror )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-01-04 Thread Michael Weghorn (via logerrit)
 vcl/source/treelist/svimpbox.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 286181de69590f5e8d7f576dd99b12554760a7b0
Author: Michael Weghorn 
AuthorDate: Thu Dec 22 10:27:51 2022 +0100
Commit: Michael Stahl 
CommitDate: Wed Jan 4 15:08:23 2023 +

tdf#152532 vcl: Don't convert negative entry count to unsigned

In particular for empty output sizes (as is the case for
the observed cases from tdf#152532, where
`SvImpLBox::AdjustScrollBars` gets called before the
resize to the final size happens),

(aOSize.Height() - m_nHorSBarHeight) / nEntryHeight

can become negative, and that was silently converted
into a large positive integer when assigned to `m_nVisibleCount`
which is of type `sal_uLong`. As a result, `SvImpLBox::FillView`
later moved the view to the very top of the scroll area and did
not make sure that the selected entry would remain inside of the view.

Prevent that by using 0 as minimum value.

Also explicitly convert to unsigned using `o3tl::make_unsigned`
at another place that should be fine (but will trigger an assert
now if it isn't, rather than silently converting a negative
value to unsigned).

Change-Id: Iab1402603adb7b7c93927ecbfd10336049bfd71b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144744
Tested-by: Jenkins
Reviewed-by: Rafael Lima 
Reviewed-by: Michael Weghorn 
(cherry picked from commit 2d0ff08f8724c6fd2b7801c7eb8fa0a41a90f883)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144728
Reviewed-by: Michael Stahl 

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index cea89cdbd33c..453edb8dc53b 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -1127,7 +1127,7 @@ void SvImpLBox::AdjustScrollBars( Size& rSize )
 sal_uLong nTotalCount = m_pView->GetVisibleCount();
 
 // number of entries visible within the view
-m_nVisibleCount = aOSize.Height() / nEntryHeight;
+m_nVisibleCount = o3tl::make_unsigned(aOSize.Height() / nEntryHeight);
 
 // do we need a vertical scrollbar?
 if( bVerSBar || nTotalCount > m_nVisibleCount )
@@ -1148,7 +1148,7 @@ void SvImpLBox::AdjustScrollBars( Size& rSize )
 nResult |= 0x0002;
 // the number of entries visible within the view has to be recalculated
 // because the horizontal scrollbar is now visible.
-m_nVisibleCount =  (aOSize.Height() - m_nHorSBarHeight) / nEntryHeight;
+m_nVisibleCount = o3tl::make_unsigned(std::max(0, 
aOSize.Height() - m_nHorSBarHeight) / nEntryHeight);
 // we might actually need a vertical scrollbar now
 if( !(nResult & 0x0001) &&
 ((nTotalCount > m_nVisibleCount) || bVerSBar) )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2023-03-27 Thread Jim Raykowski (via logerrit)
 vcl/source/control/tabctrl.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 9c6bf935cd447922f8e6c974d545832d03779b12
Author: Jim Raykowski 
AuthorDate: Sat Mar 25 17:52:24 2023 -0800
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Mar 27 16:51:37 2023 +

tdf#126632 tdf#152908 Resize the notebook bar on context change

For other than gtk vcl backend the tabbed compact toolbar tabs do not
repaint correctly when the 'Table' tab is active and the cursor is move
outside of the table. This patch adds a Resize after the context is set
to make the tabs always show as expected.

Change-Id: Iedf8a6eea52c3c55e9c1266b7aa79bc0f34deb22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149593
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit e0daa98a802cc1f84ceb0f306f5d15fecabd62c1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149599
Reviewed-by: Xisco Fauli 
(cherry picked from commit b2575b26f403e97b5a1e85559d1506a0f60b3903)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149604
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 762587210f52..278fd59cd733 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -2305,6 +2305,11 @@ void NotebookbarTabControlBase::SetContext( 
vcl::EnumContext::Context eContext )
 if (!bHandled)
 bLastContextWasSupported = false;
 eLastContext = eContext;
+
+// tdf#152908 Tabbed compact toolbar does not repaint itself when tabs 
getting removed
+// For unknown reason this is needed by the tabbed compact toolbar for 
other than gtk
+// vcl backends.
+Resize();
 }
 
 void NotebookbarTabControlBase::dispose()


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-25 Thread Michael Stahl (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 5cc596a99643764f698bbc6c4bfb7ba561dee568
Author: Michael Stahl 
AuthorDate: Thu Nov 24 11:04:56 2022 +0100
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 10:07:37 2022 +0100

tdf#149140 vcl: PDF/UA export: Scope attribute exists since PDF 1.5

(regression from commit dfffe710d07f84f4152cf61ccd4a69279a26ff7c)

Change-Id: I12e077d857d25db9636f2a06f953616ae2d907bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143209
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
(cherry picked from commit 28b06bb7236f8c6e17423dc3df446306900355f1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143166
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 7a764ccfba72..41149167030d 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10604,7 +10604,9 @@ bool PDFWriterImpl::setStructureAttribute( enum 
PDFWriter::StructAttribute eAttr
 case PDFWriter::Scope:
 if (eVal == PDFWriter::Row || eVal == PDFWriter::Column || 
eVal == PDFWriter::Both)
 {
-if (eType == PDFWriter::TableHeader)
+if (eType == PDFWriter::TableHeader
+&& m_aContext.Version != PDFWriter::PDFVersion::PDF_A_1
+&& PDFWriter::PDFVersion::PDF_1_5 <= 
m_aContext.Version)
 {
 bInsert = true;
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-25 Thread Noel Grandin (via logerrit)
 vcl/source/app/scheduler.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit e63fbf524bf4bb1a247b55a31745a6ced1661532
Author: Noel Grandin 
AuthorDate: Thu Nov 24 09:33:34 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Nov 25 10:08:35 2022 +0100

tdf#148435 - avoid strange OS/X deadlock around AnyInput.

Apparently calling AnyInput on Mac and filtering for just input, gives
you window creation / re-sizing events which then trigger idle paint
events which then deadlock if called with the scheduler lock.

So just don't do this optimisation.

Change-Id: I2b518fba607815241d3bd60407cdf51a4357aef4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143200
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit 8b442d7fae17660b3665da2c1f7a084341987693)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143161
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 5da5c2465c60..927de71c4fbb 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -419,6 +419,11 @@ void Scheduler::CallbackTaskScheduling()
 break;
 }
 
+// tdf#148435 Apparently calling AnyInput on Mac and filtering for just input, 
gives
+// you window creation / re-sizing events which then trigger idle paint
+// events which then deadlock if called with the scheduler lock.
+// So since this is an optimisation, just don't do this on mac.
+#ifndef MACOSX
 // Delay invoking tasks with idle priorities as long as there are user 
input or repaint events
 // in the OS event queue. This will often effectively compress such events 
and repaint only
 // once at the end, improving performance in cases such as repeated 
zooming with a complex document.
@@ -430,6 +435,7 @@ void Scheduler::CallbackTaskScheduling()
 pMostUrgent = nullptr;
 nMinPeriod = 0;
 }
+#endif
 
 if (InfiniteTimeoutMs != nMinPeriod)
 SAL_INFO("vcl.schedule",


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-09-12 Thread Miklos Vajna (via logerrit)
 vcl/source/app/salvtables.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 8c904116d660f67341540860cc4a1fb10bc6b0d1
Author: Miklos Vajna 
AuthorDate: Thu Sep 8 13:48:01 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 12 16:10:06 2022 +0200

vcl: fix crash in SalInstanceWidget::set_busy_cursor()

Crashreport signature:

Fatal signal received: SIGSEGV code: 128 for address: 0x0

program/libmergedlo.so
vcl::Window::LeaveWait()
vcl/source/window/mouse.cxx:640
program/libsclo.so
ScSpellingEngine::ShowTableWrapDialog()
sc/source/ui/view/spelleng.cxx:315
program/libsclo.so
ScConversionEngineBase::FindNextConversionCell()
sc/source/ui/view/spelleng.cxx:168
program/libsclo.so
ScSpellDialogChildWindow::GetNextWrongSentence(bool)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173

Change-Id: I298789211d6ee038bd5a9a7bff7cf9ae4f132a91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139731
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 37d778b601966434ff6042373c1a82d4687fd034)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139665
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index b6db52c8b87d..e43481b50ea8 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -517,6 +517,11 @@ void SalInstanceWidget::thaw()
 
 void SalInstanceWidget::set_busy_cursor(bool bBusy)
 {
+if (!m_xWidget)
+{
+return;
+}
+
 if (bBusy)
 m_xWidget->EnterWait();
 else


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-09-19 Thread Julien Nabet (via logerrit)
 vcl/source/bitmap/BitmapPopArtFilter.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2c7052a76e5348981883ca95cf3c0b079ded5068
Author: Julien Nabet 
AuthorDate: Mon Sep 19 14:22:32 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Sep 19 21:16:18 2022 +0200

tdf#150992: fix crash popart filter to an SVG image

part of bt:
6  0x7f018c80186f in BitmapPalette::operator[](unsigned short) const 
(this=0x5576a198fe48, nIndex=176) at vcl/source/bitmap/bitmappalette.cxx:139
7  0x7f018c3d1fce in BitmapInfoAccess::GetPaletteColor(unsigned short) 
const (this=0x5576a2bbc520, nColor=176) at include/vcl/BitmapInfoAccess.hxx:121
8  0x7f018c85b63f in BitmapPopArtFilter::execute(BitmapEx const&) const 
(this=0x7fffb7394728, rBitmapEx=...) at 
vcl/source/bitmap/BitmapPopArtFilter.cxx:73
9  0x7f018c83e66b in BitmapFilter::Filter(BitmapEx&, BitmapFilter 
const&) (rBmpEx=..., rFilter=...) at vcl/source/bitmap/bitmapfilter.cxx:22
10 0x7f01905e5bd4 in SvxGraphicFilter::ExecuteGrfFilterSlot(SfxRequest 
const&, GraphicObject&) (rReq=..., rFilterObject=...) at 
svx/source/dialog/grfflt.cxx:202

some gdb info
(gdb) p nIndex
$1 = 176
(gdb) p mpImpl->GetBitmapData().size()
$2 = 34

full bt here:
https://bugs.documentfoundation.org/attachment.cgi?id=182499

See https://bugs.documentfoundation.org/show_bug.cgi?id=150992#c2 for some 
comments

the main thing that makes me think that the order is reversed is the 
"nLastEntry" treatment.
Indeed with the current sort, mnCount with 0 come first nLastEntry = 
nEntryCount - 1 (unless there's no color at all)

Change-Id: I3b89f2f4d6f115ea9f6752c49bad776a33f0b020
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140153
Reviewed-by: Julien Nabet 
(cherry picked from commit 8dbbc1ca6dfe75affe13dda92bdf82b6b38f1a37)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140160
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx 
b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index 5d5a6ee256ba..ce37c91fdd58 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -56,7 +56,7 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
 // sort table
 std::sort(aPopArtTable.begin(), aPopArtTable.end(),
   [](const PopArtEntry& lhs, const PopArtEntry& rhs) {
-  return lhs.mnCount < rhs.mnCount;
+  return lhs.mnCount > rhs.mnCount;
   });
 
 // get last used entry


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-09-19 Thread Mike Kaganski (via logerrit)
 vcl/source/fontsubset/cff.cxx |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 3890b65ffa04c2cb9b4956ac65409d64b5c7f11c
Author: Mike Kaganski 
AuthorDate: Sun Sep 18 17:30:22 2022 +0300
Commit: Caolán McNamara 
CommitDate: Mon Sep 19 21:18:26 2022 +0200

tdf#151039: use the same defaults also for FontSubsetInfo::m_aFontBBox

The defaults for "maFontBBox is not valid" case were already introduced
in commit 2d1f08d63942666c0094904f50ba8c512ab69b9d
  Author Release Engineers 
  Date   Thu Aug 27 12:02:29 2009 +
CWS-TOOLING: integrate CWS otf01

but it used the four elements of maFontBBox unconditionally in later
calculations. Possibly that code path is untested, because unless the
wrong size is greater than 4, it would always crash.

Unfortunately, use of { 0, 0, 0, 0 } here (as Khaled proposed in the
bug, for "garbage in, garbage out" principle) is impossible: the PDF
with such data shows an error in Acrobat Reader: "The font contains
a bad /BBox".

As Khaled mentioned, a better fix would be to use the equivalent font
extents from head table.

Change-Id: I949db23d8af7c1fd4c2362655bf602eea0e70062
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140121
Tested-by: Mike Kaganski 
Reviewed-by: Mike Kaganski 
(cherry picked from commit 1f985cb4779b581a77d419605ceb084707d408b8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139993
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index 7d418ef2694c..fdc210e040a7 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -1801,10 +1801,10 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
 else // emit default FontMatrix if needed
 pOut += sprintf( pOut, "/FontMatrix [0.001 0 0 0.001 0 0]readonly 
def\n");
 // emit FontBBox
-if( maFontBBox.size() == 4)
-rEmitter.emitValVector( "/FontBBox {", "}readonly def\n", maFontBBox);
-else // emit default FontBBox if needed
-pOut += sprintf( pOut, "/FontBBox {0 0 999 999}readonly def\n");
+auto aFontBBox = maFontBBox;
+if (aFontBBox.size() != 4)
+aFontBBox = { 0, 0, 999, 999 }; // emit default FontBBox if needed
+rEmitter.emitValVector( "/FontBBox {", "}readonly def\n", aFontBBox);
 // emit FONTINFO into TOPDICT
 pOut += sprintf( pOut,
 "/FontInfo 2 dict dup begin\n"  // TODO: check fontinfo entry count
@@ -2026,10 +2026,10 @@ void CffSubsetterContext::emitAsType1( Type1Emitter& 
rEmitter,
 fXFactor = 1000.0F * maFontMatrix[0];
 fYFactor = 1000.0F * maFontMatrix[3];
 }
-rFSInfo.m_aFontBBox = tools::Rectangle( Point( 
static_cast(maFontBBox[0] * fXFactor),
-static_cast(maFontBBox[1] * 
fYFactor) ),
-Point( 
static_cast(maFontBBox[2] * fXFactor),
-static_cast(maFontBBox[3] * 
fYFactor) ) );
+rFSInfo.m_aFontBBox = { Point(static_cast(aFontBBox[0] * 
fXFactor),
+  static_cast(aFontBBox[1] * 
fYFactor)),
+Point(static_cast(aFontBBox[2] * 
fXFactor),
+  static_cast(aFontBBox[3] * 
fYFactor)) };
 // PDF-Spec says the values below mean the ink bounds!
 // TODO: use better approximations for these ink bounds
 rFSInfo.m_nAscent  = +rFSInfo.m_aFontBBox.Bottom(); // for capital letters


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-09-21 Thread Julien Nabet (via logerrit)
 vcl/source/window/printdlg.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 35137efbb2b50b5eae8c9377f658f7bc8f23d9cc
Author: Julien Nabet 
AuthorDate: Tue Aug 23 17:27:10 2022 +0200
Commit: Christian Lohmaier 
CommitDate: Wed Sep 21 11:30:01 2022 +0200

tdf#150561: Page dimension don't match paper format in Print Preview

...like claiming 210x148 to be A4

Page size may have changed so sync mePaper with it

Change-Id: I7d7329bbacfb2f0bd56e495b7390eedebecee02c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138736
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
(cherry picked from commit 653d098a00f737e79f2e1ea81978320b2d5d27cc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138818
Reviewed-by: Christian Lohmaier 

diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 9944541fb91e..c50bd3ae351a 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -988,6 +988,8 @@ void PrintDialog::preparePreview( bool i_bMayUseCache )
 Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), 
aMapMode ) );
 aMtf.Move( aOff.X(), aOff.Y() );
 }
+// tdf#150561: page size may have changed so sync mePaper with it
+mePaper = aPrt->GetPaper();
 }
 
 mxPreview->setPreview( aMtf, aCurPageSize,


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-13 Thread Caolán McNamara (via logerrit)
 vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx |2 +-
 vcl/source/bitmap/BitmapFilterStackBlur.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 836e1dd7f82a5e8a72bbb1afcd92f6295339cc4b
Author: Caolán McNamara 
AuthorDate: Sun Jun 12 16:57:38 2022 +0100
Commit: Xisco Fauli 
CommitDate: Mon Jun 13 17:13:56 2022 +0200

crashtesting: fix crash seen on loading forum-mso-de-98993.xlsx

which may explain the backtraces seen with BitmapFilterStackBlur::filter
and BitmapBasicMorphologyFilter::filter in crashreporting

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

diff --git a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx 
b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
index 5d3f1d2772e1..8516f5861a5d 100644
--- a/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
+++ b/vcl/source/bitmap/BitmapBasicMorphologyFilter.cxx
@@ -342,7 +342,7 @@ Bitmap BitmapBasicMorphologyFilter::filter(Bitmap const& 
rBitmap) const
 ScanlineFormat nScanlineFormat;
 {
 Bitmap::ScopedReadAccess pReadAccess(bitmapCopy);
-nScanlineFormat = pReadAccess->GetScanlineFormat();
+nScanlineFormat = pReadAccess ? pReadAccess->GetScanlineFormat() : 
ScanlineFormat::NONE;
 }
 
 switch (nScanlineFormat)
diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx 
b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
index be1ab84296c7..eeb5810f5d1f 100644
--- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx
+++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
@@ -630,7 +630,7 @@ Bitmap BitmapFilterStackBlur::filter(Bitmap const& rBitmap) 
const
 ScanlineFormat nScanlineFormat;
 {
 Bitmap::ScopedReadAccess pReadAccess(bitmapCopy);
-nScanlineFormat = pReadAccess->GetScanlineFormat();
+nScanlineFormat = pReadAccess ? pReadAccess->GetScanlineFormat() : 
ScanlineFormat::NONE;
 }
 
 if (nScanlineFormat == ScanlineFormat::N24BitTcRgb


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-13 Thread Michael Weghorn (via logerrit)
 vcl/source/treelist/iconviewimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c346da70965a1896fbced456e49213d60cd50cbc
Author: Michael Weghorn 
AuthorDate: Fri Jun 10 14:06:42 2022 +0200
Commit: Michael Weghorn 
CommitDate: Mon Jun 13 20:23:22 2022 +0200

vcl: Trigger IconView action on space key as well

Handle space key the same as the return key.
This e.g. allows to insert the selected element
into the formula this way in Math again after the
switch to IconView in

commit d79c527c2a599c7821d27cf03b95cb79e2abe685
Date:   Wed Jun 1 11:20:12 2022 +0300

Use IconView in SmElementsControl

gtk3 was already behaving that way without this
change in place.

Change-Id: I061b286723fedf023551afbb2184abc946b54b9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135592
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 
(cherry picked from commit c66de992e1cb4f7f87035191832b5e28295c3477)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135702

diff --git a/vcl/source/treelist/iconviewimpl.cxx 
b/vcl/source/treelist/iconviewimpl.cxx
index 60cdf2d32b8f..6839ff1db5da 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -696,6 +696,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt )
 break;
 
 case KEY_RETURN:
+case KEY_SPACE:
 {
 bHandled = !m_pView->aDoubleClickHdl.Call(m_pView);
 break;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-15 Thread Samuel Mehrbrodt (via logerrit)
 vcl/source/treelist/treelist.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 8d2523f824e377c886621432b208ac420b6bcd14
Author: Samuel Mehrbrodt 
AuthorDate: Wed Jun 15 16:54:55 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Thu Jun 16 07:49:29 2022 +0200

Make sure pEntry is not null

Crash seen:
>   mergedlo.dll!SvTreeList::GetDepth(const SvTreeListEntry * pEntry) 
line 106
mergedlo.dll!SalInstanceTreeView::get_iter_depth(const 
weld::TreeIter & rIter) line 4230
basctllo.dll!basctl::SbTreeListBox::FindVariable(const 
weld::TreeIter * pEntry) line 271
basctllo.dll!basctl::SbTreeListBox::FindModule(const weld::TreeIter 
* pEntry) line 695
basctllo.dll!basctl::MacroChooser::BasicSelectHdl(weld::TreeView & 
__formal) line 473
basctllo.dll!basctl::MacroChooser::RestoreMacroDescription() line 
158
basctllo.dll!basctl::MacroChooser::run() line 178

Change-Id: Ic85758c0bbee952d0a23b1d52e8bbdd231e8de26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135914
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 79f820b6822f8d3578975a4757b4293728c8c717)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135937

diff --git a/vcl/source/treelist/treelist.cxx b/vcl/source/treelist/treelist.cxx
index 07db41b54266..f118e5e35637 100644
--- a/vcl/source/treelist/treelist.cxx
+++ b/vcl/source/treelist/treelist.cxx
@@ -103,7 +103,7 @@ sal_uInt16 SvTreeList::GetDepth( const SvTreeListEntry* 
pEntry ) const
 {
 DBG_ASSERT(pEntry && pEntry!=pRootItem.get(),"GetDepth:Bad Entry");
 sal_uInt16 nDepth = 0;
-while( pEntry->pParent != pRootItem.get() )
+while( pEntry && pEntry->pParent != pRootItem.get() )
 {
 nDepth++;
 pEntry = pEntry->pParent;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-20 Thread Luboš Luňák (via logerrit)
 vcl/source/window/syswin.cxx |   29 -
 1 file changed, 12 insertions(+), 17 deletions(-)

New commits:
commit 8b46093b27b065ac9b537348ed909530b5ffd588
Author: Luboš Luňák 
AuthorDate: Thu Jun 9 18:23:44 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Jun 20 10:07:32 2022 +0200

avoid uninitialized data when handling WindowState

I get valgrind reports when I start LO with kf5 backend and
a maximized window, since in that case position and size are not
set (since the maximized state makes them irrelevant). The semantics
here seem to conflict, the caller of GetWindowState() sets flags
to say what data it wants, and SalFrame::GetWindowState() sets flags
to say what data it provides, but as can be seen here those aren't
necessarily the same. So actually use only those flags that are
in both sets.

Change-Id: I4559baab90d6f465382560549d52431b28119b3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135563
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit b7b06f28d5728c2c33c073df35ac0c3bcc51e583)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135709
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index fa053499d623..113b2da02689 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -755,7 +755,10 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 return;
 
 if ( mbSysChild )
+{
+rData.setMask( vcl::WindowDataMask::NONE );
 return;
+}
 
 const vcl::Window* pWindow = this;
 while ( pWindow->mpWindowImpl->mpBorderWindow )
@@ -764,9 +767,11 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 if ( pWindow->mpWindowImpl->mbFrame )
 {
 vcl::WindowData aState;
-aState.setMask(vcl::WindowDataMask::All);
 if ( mpWindowImpl->mpFrame->GetWindowState( &aState ) )
 {
+// Limit mask only to what we've received, the rest is not set.
+nValidMask &= aState.mask();
+rData.setMask( nValidMask );
 if ( nValidMask & vcl::WindowDataMask::X )
 rData.setX( aState.x() );
 if ( nValidMask & vcl::WindowDataMask::Y )
@@ -775,26 +780,14 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 rData.setWidth( aState.width() );
 if ( nValidMask & vcl::WindowDataMask::Height )
 rData.setHeight( aState.height() );
-if ( aState.mask() & vcl::WindowDataMask::MaximizedX )
-{
+if ( nValidMask & vcl::WindowDataMask::MaximizedX )
 rData.SetMaximizedX( aState.GetMaximizedX() );
-nValidMask |= vcl::WindowDataMask::MaximizedX;
-}
-if ( aState.mask() & vcl::WindowDataMask::MaximizedY )
-{
+if ( nValidMask & vcl::WindowDataMask::MaximizedY )
 rData.SetMaximizedY( aState.GetMaximizedY() );
-nValidMask |= vcl::WindowDataMask::MaximizedY;
-}
-if ( aState.mask() & vcl::WindowDataMask::MaximizedWidth )
-{
+if ( nValidMask & vcl::WindowDataMask::MaximizedWidth )
 rData.SetMaximizedWidth( aState.GetMaximizedWidth() );
-nValidMask |= vcl::WindowDataMask::MaximizedWidth;
-}
-if ( aState.mask() & vcl::WindowDataMask::MaximizedHeight )
-{
+if ( nValidMask & vcl::WindowDataMask::MaximizedHeight )
 rData.SetMaximizedHeight( aState.GetMaximizedHeight() );
-nValidMask |= vcl::WindowDataMask::MaximizedHeight;
-}
 if ( nValidMask & vcl::WindowDataMask::State )
 {
 // #94144# allow Minimize again, should be masked out when 
read from configuration
@@ -814,6 +807,8 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 SizeaSize = GetSizePixel();
 vcl::WindowState nState = vcl::WindowState::NONE;
 
+nValidMask &= vcl::WindowDataMask::PosSizeState;
+rData.setMask( nValidMask );
 if (nValidMask & vcl::WindowDataMask::X)
 rData.setX(aPos.X());
 if (nValidMask & vcl::WindowDataMask::Y)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-20 Thread Caolán McNamara (via logerrit)
 vcl/source/gdi/pdfwriter_impl.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a46979660cb6273f2e2d50564e3a0216f6b0b9d3
Author: Caolán McNamara 
AuthorDate: Mon Jun 20 15:47:43 2022 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jun 20 18:20:59 2022 +0200

Use of uninitialised value of size 8 on export to pdf

==2899330== Use of uninitialised value of size 8
==2899330==at 0xCABB82A: (anonymous namespace)::appendHex(signed char, 
rtl::OStringBuffer&) (pdfwriter_impl.cxx:120)
==2899330==by 0xCAEB14C: vcl::PDFWriterImpl::emitTrailer() 
(pdfwriter_impl.cxx:5466)
==2899330==by 0xCAEDA09: vcl::PDFWriterImpl::emit() 
(pdfwriter_impl.cxx:5773)
==2899330==by 0xCA9F10C: vcl::PDFWriter::Emit() (pdfwriter.cxx:53)
==2899330==by 0x3D5FE329: PDFExport::Export(rtl::OUString const&, 
com::sun::star::uno::Sequence const&) 
(pdfexport.cxx:1012)

an issue since...

commit be39eba9a3d81e20c42f1073a365e91ce855c1cd
Date:   Mon Jun 6 00:17:02 2022 +0200

Use same glyph width in PDF drawing and font subset

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

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4ae1d9f5d242..ae78eda251e5 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2666,10 +2666,12 @@ bool PDFWriterImpl::emitFonts()
 sal_Int32 pCodeUnitsPerGlyph[ 256 ] = {};
 std::vector aCodeUnits;
 aCodeUnits.reserve( 256 );
-int nGlyphs = 1;
 // fill arrays and prepare encoding index map
 sal_Int32 nToUnicodeStream = 0;
 
+pWidths[0] = 0; // if it gets used then it will appear in 
s_subset.m_aMapping, otherwise 0 is fine
+int nGlyphs = 1;
+
 for (auto const& item : s_subset.m_aMapping)
 {
 sal_uInt8 nEnc = item.second.getGlyphId();


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-06-28 Thread Caolán McNamara (via logerrit)
 vcl/source/gdi/sallayout.cxx |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit d8963ecd20579a62906eae3ed14d498bf07cbb98
Author: Caolán McNamara 
AuthorDate: Tue Jun 28 15:27:57 2022 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jun 28 20:34:39 2022 +0200

tdf#149755 bottom of characters missing in dwrite rendered case

snap bounding box to full pixels

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

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index d76d72c490e9..0e582015adc8 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -238,12 +238,19 @@ bool SalLayout::GetBoundRect(tools::Rectangle& rRect) 
const
 // get bounding rectangle of individual glyph
 if (pGlyph->GetGlyphBoundRect(pGlyphFont, aRectangle))
 {
-// merge rectangle
-aRectangle += Point(aPos.getX(), aPos.getY());
-if (rRect.IsEmpty())
-rRect = aRectangle;
-else
-rRect.Union(aRectangle);
+if (!aRectangle.IsEmpty())
+{
+aRectangle.AdjustLeft(std::floor(aPos.getX()));
+aRectangle.AdjustRight(std::ceil(aPos.getX()));
+aRectangle.AdjustTop(std::floor(aPos.getY()));
+aRectangle.AdjustBottom(std::ceil(aPos.getY()));
+
+// merge rectangle
+if (rRect.IsEmpty())
+rRect = aRectangle;
+else
+rRect.Union(aRectangle);
+}
 bRet = true;
 }
 }


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-07-18 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/svm/SvmConverter.cxx |   25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 3f39e1bb8a035bc8f1afadad128a6e99b4a919d5
Author: Caolán McNamara 
AuthorDate: Sat Jul 16 11:37:22 2022 +0100
Commit: Michael Stahl 
CommitDate: Mon Jul 18 11:00:22 2022 +0200

ofz#49157 Object-size

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

diff --git a/vcl/source/filter/svm/SvmConverter.cxx 
b/vcl/source/filter/svm/SvmConverter.cxx
index c22b41b236b0..2e7ed8f35c26 100644
--- a/vcl/source/filter/svm/SvmConverter.cxx
+++ b/vcl/source/filter/svm/SvmConverter.cxx
@@ -782,17 +782,22 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, 
GDIMetaFile& rMtf )
 
 aFontVDev->GetTextArray( aStr, &aTmpAry, 
nIndex, nLen );
 
-// now, the difference between the
-// last and the second last DX array
-// is the advancement for the last
-// glyph. Thus, to complete our meta
-// action's DX array, just add that
-// difference to last elem and store
-// in very last.
-if( nStrLen > 1 )
-aDXAry[ nStrLen-1 ] = aDXAry[ 
nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ];
+if (aTmpAry.size() < 
o3tl::make_unsigned(nStrLen))
+SAL_WARN("vcl.gdi", "TextArray too 
short to recover missing element");
 else
-aDXAry[ nStrLen-1 ] = aTmpAry[ 
nStrLen-1 ]; // len=1: 0th position taken to be 0
+{
+// now, the difference between the
+// last and the second last DX array
+// is the advancement for the last
+// glyph. Thus, to complete our meta
+// action's DX array, just add that
+// difference to last elem and store
+// in very last.
+if( nStrLen > 1 )
+aDXAry[ nStrLen-1 ] = aDXAry[ 
nStrLen-2 ] + aTmpAry[ nStrLen-1 ] - aTmpAry[ nStrLen-2 ];
+else
+aDXAry[ nStrLen-1 ] = aTmpAry[ 
nStrLen-1 ]; // len=1: 0th position taken to be 0
+}
 }
 #ifdef DBG_UTIL
 else


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-07-25 Thread Heiko Tietze (via logerrit)
 vcl/source/window/dockmgr.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 7edadf64047b367f8d9cc0031008d6c6b46a55fd
Author: Heiko Tietze 
AuthorDate: Fri Jul 15 11:18:07 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Jul 25 10:37:14 2022 +0200

Resolves tdf#143688 - Allow detaching of sub-toolbars when locked

Change-Id: I36669d953eb9438df73256676e2dfbfe3c263031
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137100
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 
(cherry picked from commit db26f712e1edfef6b61a324b146310be00aeb100)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137174
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index e71c7f420580..f836ff2f1cef 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -813,8 +813,7 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox 
*pParentToolBox, FloatWin
 ImplPreparePopupMode();
 
 // don't allow tearoff, if globally disabled
-if( !StyleSettings::GetDockingFloatsSupported() ||
-( GetWindow()->GetType() == WindowType::TOOLBOX && 
ToolBox::AlwaysLocked() ) )
+if( !StyleSettings::GetDockingFloatsSupported() )
 nFlags &= ~FloatWinPopupFlags::AllowTearOff;
 
 // if the subtoolbar was opened via keyboard make sure that key events


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-09 Thread Miklos Vajna (via logerrit)
 vcl/source/window/mouse.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 7a7c76bb1e135b6de242e9fbd4b3b34adf3fc0ad
Author: Miklos Vajna 
AuthorDate: Mon Nov 7 10:48:06 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Nov 9 10:58:41 2022 +0100

vcl: fix crash in Window::LeaveWait()

Crashreport signature:

SIG   Fatal signal received: SIGSEGV code: 128 for address: 0x0
program/libmergedlo.so
vcl::Window::LeaveWait()
vcl/source/window/mouse.cxx:640
program/../program/libsclo.so
ScSpellingEngine::ShowTableWrapDialog()
sc/source/ui/view/spelleng.cxx:315
program/libsclo.so
ScConversionEngineBase::FindNextConversionCell()
sc/source/ui/view/spelleng.cxx:168
program/../program/libsclo.so
ScSpellDialogChildWindow::GetNextWrongSentence(bool)

/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/unique_ptr.h:173

Seeing that e.g. Window::GetDropTarget() also handles a disposed
vcl::Window, let's do the same here.

Change-Id: Ia4ad312ae91dfef24266c5bd45751778acbee367
Reviewed-by: Michael Meeks 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142473
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 3df3488014dc5f80756c24f584bb554845f4a2df)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142439
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index 2f85ddbd39d6..de88cae1d837 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -637,6 +637,8 @@ void Window::EnterWait()
 
 void Window::LeaveWait()
 {
+if( !mpWindowImpl )
+return;
 
 if ( mpWindowImpl->mnWaitCount )
 {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-13 Thread Caolán McNamara (via logerrit)
 vcl/source/graphic/UnoGraphicProvider.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 44463562732fb57c4009ecf54bb0c4ffa5df5034
Author: Caolán McNamara 
AuthorDate: Wed Nov 9 12:34:06 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 14 06:32:15 2022 +0100

Related: tdf#151898 set origin for implLoadRepositoryImage XGraphics

like we do when we get one from Image so we can treat these with the
same shortcuts we do for Image to have the option to pass the
underlying svg data to the final widget it ends up in

Change-Id: I13a5aecc73821e88f1958e1e1e9e7322628cce6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142484
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
(cherry picked from commit cb8a05bfccf77d5217f4f2e20b5898d6a24f990d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142594
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 1f33a14ea1bc..f0e0d12e7895 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -143,7 +143,6 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadMemory( std::u16s
 return xRet;
 }
 
-
 uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadRepositoryImage( std::u16string_view rResourceURL )
 {
 uno::Reference< ::graphic::XGraphic >   xRet;
@@ -154,13 +153,14 @@ uno::Reference< ::graphic::XGraphic > 
GraphicProvider::implLoadRepositoryImage(
 BitmapEx aBitmap;
 if ( vcl::ImageRepository::loadImage( OUString(sPathName), aBitmap ) )
 {
-xRet = Graphic(aBitmap).GetXGraphic();
+Graphic aGraphic(aBitmap);
+aGraphic.setOriginURL(OUString(rResourceURL));
+xRet = aGraphic.GetXGraphic();
 }
 }
 return xRet;
 }
 
-
 uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( 
std::u16string_view rResourceURL )
 {
 uno::Reference< ::graphic::XGraphic >   xRet;


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-13 Thread Caolán McNamara (via logerrit)
 vcl/source/outdev/bitmap.cxx |   14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3cfeeb2ea83edbf99d4e3bb6e0b67538f03f783d
Author: Caolán McNamara 
AuthorDate: Fri Nov 11 15:12:30 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Nov 14 06:34:32 2022 +0100

Related: tdf#151898 consider surface scaling if prescale with Bitmap::Scale

whose introduction dates back to:

commit c0ce7ca4884f7f6d1016bd1dbcc22066cb4a7797
Date:   Sat Jul 7 13:07:03 2012 +0200

Prescale image with Bitmap::Scale to improve quality.

don't prescale past the level of detail that the surface could retain

Change-Id: I1022688d45d2bb7b692f4ba619198fccea8eab36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142596
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 53a9f774b71d..49bdf9826398 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -154,10 +154,20 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, 
const Size& rDestSize,
 {
 if (nAction == MetaActionType::BMPSCALE && 
CanSubsampleBitmap())
 {
-const double nScaleX = aPosAry.mnDestWidth  / 
static_cast(aPosAry.mnSrcWidth);
-const double nScaleY = aPosAry.mnDestHeight / 
static_cast(aPosAry.mnSrcHeight);
+double nScaleX = aPosAry.mnDestWidth  / 
static_cast(aPosAry.mnSrcWidth);
+double nScaleY = aPosAry.mnDestHeight / 
static_cast(aPosAry.mnSrcHeight);
 
 // If subsampling, use Bitmap::Scale() for subsampling of 
better quality.
+
+// but hidpi surfaces like the cairo one have their own 
scale, so don't downscale
+// past the surface scaling which can retain the extra 
detail
+double fScale(1.0);
+if (mpGraphics->ShouldDownscaleIconsAtSurface(&fScale))
+{
+nScaleX *= fScale;
+nScaleY *= fScale;
+}
+
 if ( nScaleX < 1.0 || nScaleY < 1.0 )
 {
 aBmp.Scale(nScaleX, nScaleY);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-11-16 Thread Hossein (via logerrit)
 vcl/source/outdev/bitmap.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 19174e373aa6cb5db6975f925a8a1211f219301b
Author: Hossein 
AuthorDate: Wed Nov 16 04:30:17 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Nov 16 13:17:02 2022 +0100

tdf#152061 Fix bitmap image scaling

In the regression introduced by c2c37eadf32c80bcd8f168b9fc67f32002b3cb07
the bitmap image scale was calculated incorrectly. Upon resizing the
image a bit, this problem went away, and the image was shown with much
better quality compared to what it was before the above commit. It
turned out that the problem happened when the scale was less than 1, and
it was happening inside "if ( nScaleX < 1.0 || nScaleY < 1.0 ) {...}".

The part that was calculating aPosAry.mnSrcWidth and aPosAry.mnSrcHeight
was wrong, because it was setting the same height and width without
considering the fScale. The bitmap was scaled using Bitmap::Scale()
parameter which was newly multipled by fScale in the above commit. To
fix the problem, these two values are now multipled by fScale.

Change-Id: I8c77d2db3b05da54f1999d3915a70e3b7cc8106f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142754
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit 31d510389928c8f8a495a85cdab4c12d1bbbd3ce)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142690

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 49bdf9826398..df916c0e6b70 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -171,8 +171,8 @@ void OutputDevice::DrawBitmap( const Point& rDestPt, const 
Size& rDestSize,
 if ( nScaleX < 1.0 || nScaleY < 1.0 )
 {
 aBmp.Scale(nScaleX, nScaleY);
-aPosAry.mnSrcWidth = aPosAry.mnDestWidth;
-aPosAry.mnSrcHeight = aPosAry.mnDestHeight;
+aPosAry.mnSrcWidth = aPosAry.mnDestWidth * fScale;
+aPosAry.mnSrcHeight = aPosAry.mnDestHeight * fScale;
 }
 }
 


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-08-08 Thread Miklos Vajna (via logerrit)
 vcl/source/filter/ipdf/pdfread.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit f37998fdc3044ce8d477c2cfb0b9219d5f8ba75d
Author: Miklos Vajna 
AuthorDate: Mon Aug 1 09:31:48 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 8 18:26:55 2022 +0200

vcl: fix crash in vcl::ImportPDFUnloaded()

Crashreport signature:

SIG   Fatal signal received: SIGSEGV code: 1 for address: 0x0
program/libmergedlo.so
vcl::ImportPDFUnloaded(rtl::OUString const&, 
std::vector >&)
vcl/source/filter/ipdf/pdfread.cxx:256
program/../program/libsdlo.so
SdPdfFilter::Import()
sd/source/filter/pdf/sdpdffilter.cxx:55
program/../program/libsdlo.so
sd::DrawDocShell::ConvertFrom(SfxMedium&)
sd/source/ui/docshell/docshel4.cxx:500 (discriminator 1)
program/libmergedlo.so
SfxObjectShell::DoLoad(SfxMedium*)
sfx2/source/doc/objstor.cxx:768

Change-Id: I2fc635de696643af6a80a29aa5af4fa128f8776c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137673
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 60f9ca81e84f1bede4928c6f680325692cc8bc49)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137965
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/filter/ipdf/pdfread.cxx 
b/vcl/source/filter/ipdf/pdfread.cxx
index 8510b0a0c207..e99682e0c0e4 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -258,6 +258,11 @@ std::vector
 findAnnotations(const std::unique_ptr& pPage, 
basegfx::B2DSize aPageSize)
 {
 std::vector aPDFGraphicAnnotations;
+if (!pPage)
+{
+return aPDFGraphicAnnotations;
+}
+
 for (int nAnnotation = 0; nAnnotation < pPage->getAnnotationCount(); 
nAnnotation++)
 {
 auto pAnnotation = pPage->getAnnotation(nAnnotation);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-08-13 Thread Luboš Luňák (via logerrit)
 vcl/source/gdi/impglyphitem.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 7e428644ff93ecccda9196ebff8883f6f077c7b8
Author: Luboš Luňák 
AuthorDate: Thu Aug 11 15:02:02 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sat Aug 13 16:43:30 2022 +0200

fix checking glyph break position (tdf#150138)

Glyphs in RTL mode are in reverse, which includes the fast that
a cluster start is last, not first. So going back requires means
going back just one glyph, not a whole cluster. I'm not sure why
I originally did it this way, tdf#148954 works fine even this way,
so presumably I got confused.

Change-Id: I6ed0caf4e64e93e0643f7b88099bc7c992ea3329
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138144
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
(cherry picked from commit fd82419a27014f7b53138332b252f0ea7f17000a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138125
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 124ae16f2e20..7dd090929907 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -190,10 +190,6 @@ bool SalLayoutGlyphsImpl::isSafeToBreak(const_iterator 
pos, bool rtl) const
 if (pos == begin())
 return true;
 --pos;
-while (pos >= begin() && (pos->IsInCluster() && 
!pos->IsClusterStart()))
---pos;
-if (pos < begin())
-return true;
 }
 // Don't create a subset if it's not safe to break at the beginning or end 
of the sequence
 // (https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-08-24 Thread Xisco Fauli (via logerrit)
 vcl/source/window/syswin.cxx |   29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

New commits:
commit 105d129683b0e88bbb8e682d308786a587aa895f
Author: Xisco Fauli 
AuthorDate: Fri Aug 19 12:53:16 2022 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 23 11:30:15 2022 +0200

tdf#150236: Revert "avoid uninitialized data when handling WindowState"

This reverts commit 8b46093b27b065ac9b537348ed909530b5ffd588.

Reason for revert: Considering the number of bugs already reported
for this issue since LibreOffice 7.4 was released, I would like
to revert this commit only on libreoffice-7-4 branch.
In master, the issue got fixed by 8b6000f6075725b2e17b8fa745251ea96d7185f1
< WIN drop window state redundancies > but reading the discussion
in https://gerrit.libreoffice.org/c/core/+/135809, it might be risky
to backport it to libreoffice-7-4, thus I prefer to revert this patch

Change-Id: I5c78d165afed59a3d578f53356682425c9de2cd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138534
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Reviewed-by: Luboš Luňák 
Reviewed-by: Xisco Fauli 

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 113b2da02689..fa053499d623 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -755,10 +755,7 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 return;
 
 if ( mbSysChild )
-{
-rData.setMask( vcl::WindowDataMask::NONE );
 return;
-}
 
 const vcl::Window* pWindow = this;
 while ( pWindow->mpWindowImpl->mpBorderWindow )
@@ -767,11 +764,9 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 if ( pWindow->mpWindowImpl->mbFrame )
 {
 vcl::WindowData aState;
+aState.setMask(vcl::WindowDataMask::All);
 if ( mpWindowImpl->mpFrame->GetWindowState( &aState ) )
 {
-// Limit mask only to what we've received, the rest is not set.
-nValidMask &= aState.mask();
-rData.setMask( nValidMask );
 if ( nValidMask & vcl::WindowDataMask::X )
 rData.setX( aState.x() );
 if ( nValidMask & vcl::WindowDataMask::Y )
@@ -780,14 +775,26 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 rData.setWidth( aState.width() );
 if ( nValidMask & vcl::WindowDataMask::Height )
 rData.setHeight( aState.height() );
-if ( nValidMask & vcl::WindowDataMask::MaximizedX )
+if ( aState.mask() & vcl::WindowDataMask::MaximizedX )
+{
 rData.SetMaximizedX( aState.GetMaximizedX() );
-if ( nValidMask & vcl::WindowDataMask::MaximizedY )
+nValidMask |= vcl::WindowDataMask::MaximizedX;
+}
+if ( aState.mask() & vcl::WindowDataMask::MaximizedY )
+{
 rData.SetMaximizedY( aState.GetMaximizedY() );
-if ( nValidMask & vcl::WindowDataMask::MaximizedWidth )
+nValidMask |= vcl::WindowDataMask::MaximizedY;
+}
+if ( aState.mask() & vcl::WindowDataMask::MaximizedWidth )
+{
 rData.SetMaximizedWidth( aState.GetMaximizedWidth() );
-if ( nValidMask & vcl::WindowDataMask::MaximizedHeight )
+nValidMask |= vcl::WindowDataMask::MaximizedWidth;
+}
+if ( aState.mask() & vcl::WindowDataMask::MaximizedHeight )
+{
 rData.SetMaximizedHeight( aState.GetMaximizedHeight() );
+nValidMask |= vcl::WindowDataMask::MaximizedHeight;
+}
 if ( nValidMask & vcl::WindowDataMask::State )
 {
 // #94144# allow Minimize again, should be masked out when 
read from configuration
@@ -807,8 +814,6 @@ void SystemWindow::GetWindowState(vcl::WindowData& rData) 
const
 SizeaSize = GetSizePixel();
 vcl::WindowState nState = vcl::WindowState::NONE;
 
-nValidMask &= vcl::WindowDataMask::PosSizeState;
-rData.setMask( nValidMask );
 if (nValidMask & vcl::WindowDataMask::X)
 rData.setX(aPos.X());
 if (nValidMask & vcl::WindowDataMask::Y)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-03 Thread Khaled Hosny (via logerrit)
 vcl/source/fontsubset/sft.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit a350f1d1f19d9a3d9a400b6ae410b44c662a64b3
Author: Khaled Hosny 
AuthorDate: Mon Oct 3 00:21:47 2022 +0200
Commit: Caolán McNamara 
CommitDate: Mon Oct 3 11:33:57 2022 +0200

tdf#112152: Fix subsetting empty glyphs

When traversing the components of composite glyphs, the code was
treating a component pointing to an empty glyph (e.g. space) as an
error, but it is not. An overzealous bounds check.

Regression from:

commit 41007842ed9bb5d6165792a197769f72dae55a2c
Author: Martin Hosken 
Date:   Thu Sep 10 10:14:18 2015 +0700

Refactor graphite integration and update graphite

Change-Id: Ie352f17cb08cd5762ff2a339662248a536b4e934
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140897
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit bb67f10786fd5e232b198d09139c41078c3fc60d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140876

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index a164757a886d..93ad3e98d13f 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -1479,7 +1479,7 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, 
sal_uInt32 glyphID, std::vec
 
 const sal_uInt8* ptr = glyf + nOffset;
 const sal_uInt8* nptr = glyf + nNextOffset;
-if (nptr <= ptr)
+if (nptr < ptr)
 return 0;
 
 if (std::find(glyphlist.begin(), glyphlist.end(), glyphID) != 
glyphlist.end())
@@ -1490,6 +1490,10 @@ int GetTTGlyphComponents(AbstractTrueTypeFont *ttf, 
sal_uInt32 glyphID, std::vec
 
 glyphlist.push_back( glyphID );
 
+// Empty glyph.
+if (nptr == ptr)
+return n;
+
 sal_uInt32 nRemainingData = glyflength - nOffset;
 
 if (nRemainingData >= 10 && GetInt16(ptr, 0) == -1) {


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-13 Thread Samuel Mehrbrodt (via logerrit)
 vcl/source/window/dlgctrl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ae41ac6a621ce4ee7445d8964ae30ac99ce94f37
Author: Samuel Mehrbrodt 
AuthorDate: Thu Oct 6 16:22:41 2022 +0200
Commit: Thorsten Behrens 
CommitDate: Thu Oct 13 10:08:33 2022 +0200

tdf#151385 Only trigger mnemonics in dialogs when alt key is pressed

Change-Id: I884afad38c64bd53fe4917418ed627f9c0674554
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141022
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 9e0dcfbaf0039d07609ed4e4a9ef9f1e2e1e6b55)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141191
Reviewed-by: Thorsten Behrens 

diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index 328fcd35ff6a..5aac19d02b30 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -941,7 +941,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool 
bKeyInput )
 }
 }
 }
-else
+else if (aKeyCode.IsMod2()) // tdf#151385
 {
 sal_Unicode c = rKEvt.GetCharCode();
 if ( c )


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-13 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/itiff/itiff.cxx |   20 
 1 file changed, 20 insertions(+)

New commits:
commit 846711ad526fcc147bb39df26bf2c2ff25a053f3
Author: Caolán McNamara 
AuthorDate: Thu Oct 13 21:14:28 2022 +0100
Commit: Noel Grandin 
CommitDate: Fri Oct 14 07:39:11 2022 +0200

Resolves: tdf#151468 honour tiff resolution fields

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

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index d8895b8cff31..db30ea2cac3c 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -243,6 +244,25 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
 break;
 }
 
+MapMode aMapMode;
+uint16_t ResolutionUnit = RESUNIT_NONE;
+if (TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &ResolutionUnit) == 
1 && ResolutionUnit != RESUNIT_NONE)
+{
+float xres = 0, yres = 0;
+
+if (TIFFGetField(tif, TIFFTAG_XRESOLUTION, &xres) == 1 &&
+TIFFGetField(tif, TIFFTAG_YRESOLUTION, &yres) == 1 &&
+xres != 0 && yres != 0)
+{
+if (ResolutionUnit == RESUNIT_INCH)
+aMapMode =  MapMode(MapUnit::MapInch, Point(0,0), 
Fraction(1/xres), Fraction(1/yres));
+else if (ResolutionUnit == RESUNIT_CENTIMETER)
+aMapMode =  MapMode(MapUnit::MapCM, Point(0,0), 
Fraction(1/xres), Fraction(1/yres));
+}
+}
+aBitmapEx.SetPrefMapMode(aMapMode);
+aBitmapEx.SetPrefSize(Size(w, h));
+
 AnimationBitmap aAnimationBitmap(aBitmapEx, Point(0, 0), 
aBitmapEx.GetSizePixel(),
  ANIMATION_TIMEOUT_ON_CLICK, 
Disposal::Back);
 aAnimation.Insert(aAnimationBitmap);


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-15 Thread Khaled Hosny (via logerrit)
 vcl/source/fontsubset/cff.cxx |   31 ++-
 1 file changed, 30 insertions(+), 1 deletion(-)

New commits:
commit 81fe821cc30a6746636350d78b4fdd88839dc21c
Author: Khaled Hosny 
AuthorDate: Tue Sep 13 12:34:35 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sat Oct 15 22:39:03 2022 +0200

tdf#126242: Handle fractional values when subsetting CFF

Instead of truncating the values, write the fraction using “div” operator.

Change-Id: Ideff4ed3c9922a3ddd6c8aa0ec2733722ae722f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139854
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit a387f39de8e59d7542b74962242504b798af1362)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141397
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index fdc210e040a7..d417c7fe1a42 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -582,7 +582,30 @@ void CffSubsetterContext::writeType1Val( ValType aVal)
 {
 U8* pOut = mpWritePtr;
 
-int nInt = static_cast(aVal);
+// tdf#126242
+// Type2 has 16.16 fixed numbers, but Type1 does not. To represent values
+// with fractions we multiply it by a factor then use “div” operator to
+// divide it back and keep the fractions.
+// Code Adapted from:
+// 
https://github.com/fontforge/fontforge/blob/f152f12e567ea5bd737a2907c318ae26cfaabd08/fontforge/splinesave.c#L378
+int nDiv = 0;
+aVal = rint(aVal * 1024) / 1024;
+if (aVal != floor(aVal))
+{
+if (aVal == rint(aVal * 64) / 64)
+nDiv = 64;
+else
+nDiv = 1024;
+aVal *= nDiv;
+}
+
+int nInt = static_cast(rint(aVal));
+if (nDiv && floor(nInt) / nDiv == floor(nInt / nDiv))
+{
+nInt = rint(nInt / nDiv);
+nDiv = 0;
+}
+
 if( (nInt >= -107) && (nInt <= +107)) {
 *(pOut++) = static_cast(nInt + 139);// -107..+107
 } else if( (nInt >= -1131) && (nInt <= +1131)) {
@@ -602,6 +625,12 @@ void CffSubsetterContext::writeType1Val( ValType aVal)
 }
 
 mpWritePtr = pOut;
+
+if (nDiv)
+{
+writeType1Val(nDiv);
+writeTypeEsc(TYPE1OP::DIV);
+}
 }
 
 inline void CffSubsetterContext::writeTypeOp( int nTypeOp)


[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-15 Thread Khaled Hosny (via logerrit)
 vcl/source/fontsubset/cff.cxx |  192 +-
 1 file changed, 171 insertions(+), 21 deletions(-)

New commits:
commit 45318605384fac327a8b487e0132c4559d25a29c
Author: Khaled Hosny 
AuthorDate: Sat Oct 15 17:16:36 2022 +0200
Commit: Caolán McNamara 
CommitDate: Sat Oct 15 22:39:31 2022 +0200

tdf#123234: Fix subsetting CFF deprecated endchar

Type 2 “endchar” operator can take 4 extra arguments and act like Type 1
“seac” operator. Although this is documented as deprecated, the fonts in
the bug report use it.

Detect the presence of the extra arguments and output a “seac” operator
for them.

Change-Id: Ic24ec8fda586c82612f0cc13f2f31585d40ad9c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139908
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit 03ff7ee47c6b4e0dbf38a040825aaca53ce2ed28)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141396
Reviewed-by: Caolán McNamara 

diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx
index d417c7fe1a42..ef756e2fa57f 100644
--- a/vcl/source/fontsubset/cff.cxx
+++ b/vcl/source/fontsubset/cff.cxx
@@ -162,6 +162,55 @@ static const char* pDictEscs[] = {
 "nFDArray", "nFDSelect","sFontName"
 };
 
+static const char* pStandardEncoding[] = {
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", "space", "exclam", "quotedbl",
+"numbersign", "dollar", "percent", "ampersand",
+"quoteright", "parenleft", "parenright", "asterisk", "plus",
+"comma", "hyphen", "period", "slash", "zero", "one", "two",
+"three", "four", "five", "six", "seven", "eight", "nine",
+"colon", "semicolon", "less", "equal", "greater",
+"question", "at", "A", "B", "C", "D", "E", "F", "G", "H",
+"I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
+"U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash",
+"bracketright", "asciicircum", "underscore", "quoteleft",
+"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
+"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x",
+"y", "z", "braceleft", "bar", "braceright", "asciitilde",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", "exclamdown",
+"cent", "sterling", "fraction", "yen", "florin", "section",
+"currency", "quotesingle", "quotedblleft", "guillemotleft",
+"guilsinglleft", "guilsinglright", "fi", "fl", ".notdef",
+"endash", "dagger", "daggerdbl", "periodcentered",
+".notdef", "paragraph", "bullet", "quotesinglbase",
+"quotedblbase", "quotedblright", "guillemotright",
+"ellipsis", "perthousand", ".notdef", "questiondown",
+".notdef", "grave", "acute", "circumflex", "tilde",
+"macron", "breve", "dotaccent", "dieresis", ".notdef",
+"ring", "cedilla", ".notdef", "hungarumlaut", "ogonek",
+"caron", "emdash", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", ".notdef",
+".notdef", ".notdef", ".notdef", "AE", ".notdef",
+"ordfeminine", ".notdef", ".notdef", ".notdef", ".notdef",
+"Lslash", "Oslash", "OE", "ordmasculine", ".notdef",
+".notdef", ".notdef", ".notdef", ".notdef", "ae", ".notdef",
+".notdef", ".notdef", "dotlessi", ".notdef", ".notdef",
+"lslash", "oslash", "oe", "germandbls", ".notdef",
+".notdef", ".notdef", ".notdef"
+};
+
 namespace {
 
 namespace TYPE1OP
@@ -261,6 +310,17 @@ struct CffLocal
 boolmbForceBold;
 };
 
+const int MAX_T1OPS_SIZE = 81920; // TODO: use dynamic value
+
+struct CharString
+{
+int nLen;
+U8 aOps[MAX_T1OPS_SIZE];
+int nCffGlyphId;
+ValType aCharWidth;
+};
+
+
 class CffSubsetterContext
 :   private CffGlobal
 {
@@ -277,6 +337,8 @@ public:
 sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& );
 
 private:
+voidconvertCharStrings(const sal_GlyphId* pGlyphIds, int nGlyphCount,
+std::vector& rCharStrings);
 int convert2Type1Ops( CffLocal*, const U8* pType2Ops, int nType2Len, 
U8* pType1Ops);
 voidconvertOneTypeOp();
 voidconvertOneTypeEsc();
@@ -306,6 +368,7 @@ private:
 int getFDSelect( int nGlyphIndex) const;
 int getGl

[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source

2022-10-24 Thread Caolán McNamara (via logerrit)
 vcl/source/filter/itiff/itiff.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 0deba079dc80793d4a6ada398049d763179b4cd0
Author: Caolán McNamara 
AuthorDate: Sat Oct 22 16:37:24 2022 +0100
Commit: Michael Stahl 
CommitDate: Mon Oct 24 12:02:07 2022 +0200

ofz#52600 stop after first failed image in a multi-image tiff

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

diff --git a/vcl/source/filter/itiff/itiff.cxx 
b/vcl/source/filter/itiff/itiff.cxx
index db30ea2cac3c..e6d243b57c2d 100644
--- a/vcl/source/filter/itiff/itiff.cxx
+++ b/vcl/source/filter/itiff/itiff.cxx
@@ -267,6 +267,8 @@ bool ImportTiffGraphicImport(SvStream& rTIFF, Graphic& 
rGraphic)
  ANIMATION_TIMEOUT_ON_CLICK, 
Disposal::Back);
 aAnimation.Insert(aAnimationBitmap);
 }
+else
+break;
 } while (TIFFReadDirectory(tif));
 
 TIFFClose(tif);