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

2023-02-27 Thread Caolán McNamara (via logerrit)
 svtools/source/control/tabbar.cxx |   15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit ae2480960e3f37c06bfb5b61e480aba62c23c065
Author: Caolán McNamara 
AuthorDate: Mon Feb 20 15:54:22 2023 +
Commit: Michael Stahl 
CommitDate: Mon Feb 27 11:08:41 2023 +

Resolves: tdf#153763 first/last buttons in tabbar not responding

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

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index d2aabc1c20b0..de7cd8d435af 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -871,13 +871,16 @@ void TabBar::ImplShowPage( sal_uInt16 nPos )
 
 IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void )
 {
-if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | 
MOUSE_RIGHT)) == 0)
+if ( != mpImpl->mxButtonBox->m_xFirstButton.get() &&  != 
mpImpl->mxButtonBox->m_xLastButton.get())
 {
-// like tdf#149482 if we didn't see a mouse up, but find that the 
mouse is no
-// longer pressed at this point, then bail
-mpImpl->mxButtonBox->m_xPrevRepeater->Stop();
-mpImpl->mxButtonBox->m_xNextRepeater->Stop();
-return;
+if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | 
MOUSE_RIGHT)) == 0)
+{
+// like tdf#149482 if we didn't see a mouse up, but find that the 
mouse is no
+// longer pressed at this point, then bail
+mpImpl->mxButtonBox->m_xPrevRepeater->Stop();
+mpImpl->mxButtonBox->m_xNextRepeater->Stop();
+return;
+}
 }
 
 EndEditMode();


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

2023-02-14 Thread Caolán McNamara (via logerrit)
 svtools/source/control/tabbar.cxx |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit 84797ab79e3f1a37e630abffc47bfe43fbf66c22
Author: Caolán McNamara 
AuthorDate: Mon Feb 13 20:17:51 2023 +
Commit: Michael Stahl 
CommitDate: Tue Feb 14 10:09:26 2023 +

Resolves: tdf#149482 don't insert if the mouse is not still pressed

In repeat callback, if we didn't see a mouse up, but find that the mouse
is no longer pressed at this point, then bail

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

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index dd49bda0df4f..d2aabc1c20b0 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -871,6 +871,15 @@ void TabBar::ImplShowPage( sal_uInt16 nPos )
 
 IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void )
 {
+if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | 
MOUSE_RIGHT)) == 0)
+{
+// like tdf#149482 if we didn't see a mouse up, but find that the 
mouse is no
+// longer pressed at this point, then bail
+mpImpl->mxButtonBox->m_xPrevRepeater->Stop();
+mpImpl->mxButtonBox->m_xNextRepeater->Stop();
+return;
+}
+
 EndEditMode();
 
 sal_uInt16 nNewPos = mnFirstPos;
@@ -909,6 +918,14 @@ IMPL_LINK( TabBar, ImplClickHdl, weld::Button&, rBtn, void 
)
 
 IMPL_LINK_NOARG(TabBar, ImplAddClickHandler, weld::Button&, void)
 {
+if ((GetPointerState().mnState & (MOUSE_LEFT | MOUSE_MIDDLE | 
MOUSE_RIGHT)) == 0)
+{
+// tdf#149482 if we didn't see a mouse up, but find that the mouse is 
no
+// longer pressed at this point, then bail
+mpImpl->mxButtonBox->m_xAddRepeater->Stop();
+return;
+}
+
 EndEditMode();
 AddTabClick();
 }


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

2022-12-26 Thread Khaled Hosny (via logerrit)
 svtools/source/misc/sampletext.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 610880abd9f3be00451db51f05b7f4772c389b7a
Author: Khaled Hosny 
AuthorDate: Mon Dec 26 00:25:54 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Dec 26 17:44:17 2022 +

tdf#88484: Show sample text for Abyssinica SIL font

The font sets Arabic Presentation Forms-B bit, probably because it
includes U+FEFF (Zero Width Space) which happens to be in that block but
it isn’t an Arabic code point. Filter this bit out if we already decided
it isn’t an Arabic font.

Change-Id: I9935c793b8a7592eb92db59bc75de65b81ab99fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144819
Tested-by: Jenkins
Reviewed-by: خالد حسني 
(cherry picked from commit 18b39c8c9b35528c8fb172339126b613827d09aa)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144797
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svtools/source/misc/sampletext.cxx 
b/svtools/source/misc/sampletext.cxx
index c59f5a7a43ec..52351e51dd3a 100644
--- a/svtools/source/misc/sampletext.cxx
+++ b/svtools/source/misc/sampletext.cxx
@@ -1122,6 +1122,12 @@ namespace
 
 aMasked.set(vcl::UnicodeCoverage::GREEK_EXTENDED, false);
 aMasked.set(vcl::UnicodeCoverage::GREEK_AND_COPTIC, false);
+// tdf#88484
+// Some fonts set the Arabic Presentation Forms-B bit because they
+// support U+FEFF (Zero Width Space) which happens to be in that block
+// but it isn’t an Arabic code point. By the time we reach here we
+// decided this isn’t an Arabic font, so it should be safe.
+aMasked.set(vcl::UnicodeCoverage::ARABIC_PRESENTATION_FORMS_B, false);
 if (aMasked.count() == 1)
 return 
otCoverageToScript(static_cast(find_first(aMasked)));
 


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

2022-11-09 Thread Rafael Lima (via logerrit)
 svtools/source/control/ruler.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 2e9122f79b2573647a77bdfb2216934a5abda778
Author: Rafael Lima 
AuthorDate: Tue Oct 18 18:43:59 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 9 21:08:47 2022 +0100

tdf#151519 Make ticks in ruler visible again

As reported by the user, the ticks in the ruler are no longer visible. This 
patch draws them using the shadow color.

Tested with: gen, gtk3 and kf5

Change-Id: Ie80255544b88adfc331fac1365ce381dd90187cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141407
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 
(cherry picked from commit aa8a8b36b73304431bacd7ed0f8803de8dfffe3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142448
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 07e030aac109..89164e6ed8f2 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -417,6 +417,7 @@ void Ruler::ImplInvertLines(vcl::RenderContext& 
rRenderContext)
 
 void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long 
nMin, tools::Long nMax, tools::Long nStart, tools::Long nTop, tools::Long 
nBottom)
 {
+const StyleSettings& rStyleSettings = 
rRenderContext.GetSettings().GetStyleSettings();
 double nCenter = nTop + ((nBottom - nTop) / 2);
 
 tools::Long nTickLength3 = (nBottom - nTop) * 0.5;
@@ -523,7 +524,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
 }
 else
 {
-
rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
+rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
 }
 
 if (bNoTicks)
@@ -576,6 +577,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& 
rRenderContext, tools::Long nMin,
 double aStep = nTick / nTick4;
 double aRest = std::abs(aStep - std::floor(aStep));
 double nAcceptanceDelta = 0.0001;
+rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
 
 if (aRest < nAcceptanceDelta)
 {


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

2022-11-09 Thread Caolán McNamara (via logerrit)
 svtools/source/control/ctrlbox.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9447d7dd2470693c57211be9231b4792dae9fb1b
Author: Caolán McNamara 
AuthorDate: Mon Nov 7 21:04:30 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Nov 9 20:18:22 2022 +0100

Resolves: tdf#150273 use same bg as valueset

Change-Id: Idbe4bf6eaad64fdd0865a2734b4c9d0221801df9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142401
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit c4fc1dda75fe7aefce50d77ad05319cd143e6e25)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142311
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 37952f5336e2..af86920a5726 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -1617,6 +1617,8 @@ void SvtLineListBox::UpdatePreview()
 const auto nPos = (aVirDev->GetOutputSizePixel().Height() - 
aImage.GetSizePixel().Height()) / 2;
 aVirDev->Push(vcl::PushFlags::MAPMODE);
 aVirDev->SetMapMode(MapMode(MapUnit::MapPixel));
+const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+aVirDev->SetBackground(rSettings.GetFieldColor());
 aVirDev->Erase();
 aVirDev->DrawImage(Point(0, nPos), aImage);
 m_xControl->set_image(aVirDev.get());


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

2022-10-17 Thread Miklos Vajna (via logerrit)
 svtools/source/misc/embedhlp.cxx |   35 ++-
 1 file changed, 34 insertions(+), 1 deletion(-)

New commits:
commit 165a0ea595b86c448396bb3826513d54f84640aa
Author: Miklos Vajna 
AuthorDate: Tue Oct 11 16:56:24 2022 +0200
Commit: Michael Stahl 
CommitDate: Mon Oct 17 12:27:44 2022 +0200

tdf#151470 svtools: prevent storing broken graphic of embedded objects

Updating the preview of the embedded PDF object in the bugdoc leads to
Acrobat generating a new preview, we throw away the old one, write the
new one to the document, and next time the document is opened, we can't
parse it, so the preview is lost for the user.

The reason for this seems to be that sometimes Acrobat generates a
broken WMF: the first 4 bytes is 0x0002 (DISKMETAFILE from the
MetafileType enum), but the next 4 bytes is 0x6f43, which means that the
header size is 56966 bytes long, but the whole preview is 29291, so this
WMF looks broken.

Fix the problem by adding error handling before we insert the WMF we get
from Acrobat as a graphic stream to the document storage: don't update
the graphic stream if the data is something that can't be handled by
VCL's graphic filters. svt::EmbeddedObjectRef::GetReplacement() has a
similar error handling, which is why the preview only gets broken on
document reload.

No testcase, this only happens on Windows and only in case a problematic
handler for PDF is installed, which is hard to test from 'make check'.

Change-Id: I9e1ce979e58a155fa5e72e31cd9ea38258bb8b6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141229
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins
(cherry picked from commit 0bd83ba4c40bd7c3ebd3f098421c23bc9ced7b9e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141320
Reviewed-by: Michael Stahl 

diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 809a2b155790..d50238d8eab0 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -679,7 +679,40 @@ std::unique_ptr 
EmbeddedObjectRef::GetGraphicStream( bool bUpdate ) co
 if(xStream.is())
 {
 if (mpImpl->pContainer)
-
mpImpl->pContainer->InsertGraphicStream(xStream,mpImpl->aPersistName,mpImpl->aMediaType);
+{
+bool bInsertGraphicStream = true;
+uno::Reference xSeekable(xStream, 
uno::UNO_QUERY);
+std::optional oPosition;
+if (xSeekable.is())
+{
+oPosition = xSeekable->getPosition();
+}
+if (bUpdate)
+{
+std::unique_ptr pResult = 
utl::UcbStreamHelper::CreateStream(xStream);
+if (pResult)
+{
+GraphicFilter& rGF = 
GraphicFilter::GetGraphicFilter();
+Graphic aGraphic;
+rGF.ImportGraphic(aGraphic, u"", *pResult);
+if (aGraphic.IsNone())
+{
+// The graphic is not something we can 
understand, don't overwrite a
+// potentially working previous graphic.
+SAL_WARN("svtools.misc", 
"EmbeddedObjectRef::GetGraphicStream: failed to parse xStream");
+bInsertGraphicStream = false;
+}
+}
+}
+if (xSeekable.is() && oPosition.has_value())
+{
+xSeekable->seek(*oPosition);
+}
+if (bInsertGraphicStream)
+{
+
mpImpl->pContainer->InsertGraphicStream(xStream,mpImpl->aPersistName,mpImpl->aMediaType);
+}
+}
 
 std::unique_ptr pResult = 
::utl::UcbStreamHelper::CreateStream( xStream );
 if (pResult && bUpdate)


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

2022-08-15 Thread Luboš Luňák (via logerrit)
 svtools/source/svrtf/parrtf.cxx |   35 +--
 1 file changed, 21 insertions(+), 14 deletions(-)

New commits:
commit 7ca35790effb9a5a1ee17bd9a669fc2c38fcb99f
Author: Luboš Luňák 
AuthorDate: Fri Aug 12 13:01:24 2022 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 15 13:38:38 2022 +0200

revert direct append to aToken in SvRTFParser::ScanText() (tdf#150151)

This reverts most of commit 09558e2f45e27d572fd261562c884c2d2cc896a7,
the problem is that GetNextToken_() resets aToken, overwriting the value
created by this function.

Change-Id: I1daca07a6e01cfecfeff9fbf7c311b0d392d84d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138190
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138273

diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index c6dcef7a0b69..69fdb9508408 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -302,9 +302,9 @@ sal_Unicode SvRTFParser::GetHexValue()
 void SvRTFParser::ScanText()
 {
 const sal_Unicode cBreak = 0;
-const sal_uInt32 nStartLength = aToken.getLength();
+OUStringBuffer aStrBuffer;
 bool bContinue = true;
-while( bContinue && IsParserWorking() && aToken.getLength() - nStartLength 
< MAX_STRING_LEN)
+while( bContinue && IsParserWorking() && aStrBuffer.getLength() < 
MAX_STRING_LEN)
 {
 bool bNextCh = true;
 switch( nNextCh )
@@ -342,8 +342,8 @@ void SvRTFParser::ScanText()
 if (next>0xFF) // fix for #i43933# and #i35653#
 {
 if (!aByteString.isEmpty())
-aToken.append( 
OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
-
aToken.append(static_cast(next));
+aStrBuffer.append( 
OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
+
aStrBuffer.append(static_cast(next));
 
 continue;
 }
@@ -383,23 +383,23 @@ void SvRTFParser::ScanText()
 bNextCh = false;
 
 if (!aByteString.isEmpty())
-aToken.append( 
OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
+aStrBuffer.append( 
OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
 }
 break;
 case '\\':
 case '}':
 case '{':
 case '+':   // I found in a RTF file
-aToken.append(sal_Unicode(nNextCh));
+aStrBuffer.append(sal_Unicode(nNextCh));
 break;
 case '~':   // nonbreaking space
-aToken.append(u'\x00A0');
+aStrBuffer.append(u'\x00A0');
 break;
 case '-':   // optional hyphen
-aToken.append(u'\x00AD');
+aStrBuffer.append(u'\x00AD');
 break;
 case '_':   // nonbreaking hyphen
-aToken.append(u'\x2011');
+aStrBuffer.append(u'\x2011');
 break;
 
 case 'u':
@@ -412,12 +412,12 @@ void SvRTFParser::ScanText()
 {
 bRTF_InTextRead = true;
 
-OUString sSave( aToken );
+OUString sSave( aToken ); // GetNextToken_() 
overwrites this
 nNextCh = '\\';
 int nToken = GetNextToken_();
 DBG_ASSERT( RTF_U == nToken, "still not a UNI-Code 
character" );
 // don't convert symbol chars
-aToken.append(static_cast< sal_Unicode 
>(nTokenValue));
+aStrBuffer.append(static_cast< sal_Unicode 
>(nTokenValue));
 
 // overread the next n "RTF" characters. This
 // can be also \{, \}, \'88
@@ -488,20 +488,24 @@ void SvRTFParser::ScanText()
 break;
 
 default:
-if( nNextCh == cBreak || aToken.getLength() - nStartLength >= 
MAX_STRING_LEN)
+if( nNextCh == cBreak || aStrBuffer.getLength() >= MAX_STRING_LEN)
 bContinue = false;
 else
 {
 do {
 // all other characters end up in the text
-aToken.appendUtf32(nNextCh);
+aStrBuffer.appendUtf32(nNextCh);
 
 if (sal_Unicode(EOF) == (nNextCh 

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

2022-06-24 Thread Xisco Fauli (via logerrit)
 svtools/source/control/ctrlbox.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit aef5eb654ce5cd6b0026d50782137e79664dc30a
Author: Xisco Fauli 
AuthorDate: Tue Jun 21 16:58:24 2022 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jun 24 23:21:36 2022 +0200

svtools: avoid divide by zero in calcCustomItemSize

See 
https://crashreport.libreoffice.org/stats/signature/%60anonymous%20namespace'::calcCustomItemSize

Change-Id: I5f1b19b7679c73cf29952629469e5151395b2b12
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136254
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
(cherry picked from commit ec03eef9b431048ea21a733c39c79b792b0f653c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136393

diff --git a/svtools/source/control/ctrlbox.cxx 
b/svtools/source/control/ctrlbox.cxx
index 411a2dd4961d..37952f5336e2 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -343,7 +343,8 @@ namespace
 gUserItemSz.setHeight(gUserItemSz.Height() / 10);
 
 size_t nMaxDeviceHeight = SAL_MAX_INT16 / 16; // see 
limitXCreatePixmap and be generous wrt up to x16 hidpi
-gPreviewsPerDevice = nMaxDeviceHeight / gUserItemSz.Height();
+assert(gUserItemSz.Height() != 0);
+gPreviewsPerDevice = gUserItemSz.Height() == 0 ? 16 : nMaxDeviceHeight 
/ gUserItemSz.Height();
 }
 }