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

2023-04-20 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 c2014929cf27e4b00e0ed18b9284a593bf8cf684
Author: Caolán McNamara 
AuthorDate: Wed Apr 19 16:55:34 2023 +0100
Commit: Xisco Fauli 
CommitDate: Thu Apr 20 15:26:09 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/+/150622
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 
(cherry picked from commit 310a23fd4dde657038efb1e3fbb9db9e0cdbca3b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150630
Reviewed-by: Xisco Fauli 

diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index d5605bf942bf..99fee1c0d48b 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1396,6 +1396,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 2d3b6546d85a..343f37743033 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -4750,7 +4750,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);
 }
 
@@ -5278,7 +5278,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);
@@ -5288,7 +5293,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: Branch 'libreoffice-7-4' - vcl/inc vcl/source

2022-12-07 Thread Caolán McNamara (via logerrit)
 vcl/inc/sallayout.hxx|2 +-
 vcl/source/gdi/sallayout.cxx |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 1da94619de444da37b560a675278c3d4c1cc2f3c
Author: Caolán McNamara 
AuthorDate: Sat Dec 3 20:28:21 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Dec 7 08:47:14 2022 +

Resolves: tdf#152196 visible gaps with glyph fallback in Arabic/Persian text

includes:

Related: tdf#152196 these should be at least DeviceCoordinate
Related: tdf#152196 adjustLinearPosX takes a double
Related: tdf#152196 adjustLinearPosX takes a double

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

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 75f7cb3c6ea0..a1b30ed36130 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -135,7 +135,7 @@ public:
 
 private:
 // for glyph+font+script fallback
-voidMoveGlyph(int nStart, tools::Long nNewXPos);
+voidMoveGlyph(int nStart, double nNewXPos);
 voidDropGlyph(int nStart);
 voidSimplify(bool bIsBase);
 
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 51e1d9ad5e20..48f808235280 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -550,7 +550,7 @@ bool GenericSalLayout::GetNextGlyph(const GlyphItem** 
pGlyph,
 return true;
 }
 
-void GenericSalLayout::MoveGlyph( int nStart, tools::Long nNewXPos )
+void GenericSalLayout::MoveGlyph(int nStart, double nNewXPos)
 {
 if( nStart >= static_cast(m_GlyphItems.size()) )
 return;
@@ -564,7 +564,7 @@ void GenericSalLayout::MoveGlyph( int nStart, tools::Long 
nNewXPos )
 if( pGlyphIter->IsRTLGlyph() )
 nNewXPos += pGlyphIter->newWidth() - pGlyphIter->origWidth();
 // calculate the x-offset to the old position
-tools::Long nXDelta = nNewXPos - pGlyphIter->linearPos().getX() + 
pGlyphIter->xOffset();
+double nXDelta = nNewXPos - pGlyphIter->linearPos().getX() + 
pGlyphIter->xOffset();
 // adjust all following glyph positions if needed
 if( nXDelta != 0 )
 {
@@ -782,7 +782,7 @@ void 
MultiSalLayout::ImplAdjustMultiLayout(vcl::text::ImplLayoutArgs& rArgs,
 mnLevel = nLevel;
 
 // prepare merge the fallback levels
-tools::Long nXPos = 0;
+DC nXPos = 0;
 for( n = 0; n < nLevel; ++n )
 maFallbackRuns[n].ResetPos();
 


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

2022-11-25 Thread Jonas Eyov (via logerrit)
 vcl/inc/window.h  |2 ++
 vcl/source/window/window.cxx  |2 ++
 vcl/source/window/window2.cxx |   37 ++---
 3 files changed, 26 insertions(+), 15 deletions(-)

New commits:
commit 3dcea050438ace1ace5e013c0c7326aec3c82c6b
Author: Jonas Eyov 
AuthorDate: Fri Nov 18 03:40:57 2022 +
Commit: Adolfo Jayme Barrientos 
CommitDate: Sat Nov 26 05:35:41 2022 +0100

tdf#143209 vcl: track partial scroll deltas

this makes scrolling in calc smoother and makes left/up scrolling
the same speed as right/down scrolling, which was previously not the
case.

prior to this change, Window::HandleScrollCommand only checked each
event for being a large enough scroll to advance one unit. this
happened in lcl_HandleScrollHelper by way of o3tl::saturating_cast,
which meant that nonzero upward/leftward scrolls were always worth at
least one unit, while downward/rightward scrolls needed to be larger
than 1 to count.

now, we accumulate partial scroll offsets in WindowImpl and perform a
saturating cast on the absolute value, so behavior is symmetric and
sensitive to accumulated small scroll values. this feels smoother
and is more correct.

Change-Id: Id3692d14edd45ed26f2952e3418e4d82806e1fc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142948
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 
(cherry picked from commit fe21365c5a9083ae1f086ea48614263b3a75ab3e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143122
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index b0395330e19e..87afc6cda56c 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -256,6 +256,8 @@ public:
 vcl::Cursor*mpCursor;
 PointerStylemaPointer;
 FractionmaZoom;
+double  mfPartialScrollX;
+double  mfPartialScrollY;
 OUStringmaText;
 std::optional
 mpControlFont;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index fe6f788e8ecc..aabd1778c11a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -590,6 +590,8 @@ WindowImpl::WindowImpl( vcl::Window& rWindow, WindowType 
nType )
 {
 mxOutDev = VclPtr::Create(rWindow);
 maZoom  = Fraction( 1, 1 );
+mfPartialScrollX= 0.0;
+mfPartialScrollY= 0.0;
 maWinRegion = vcl::Region(true);
 maWinClipRegion = vcl::Region(true);
 mpWinData   = nullptr;  // 
Extra Window Data, that we don't need for all windows
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index c20dc471120b..ad7677195dab 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -597,12 +597,14 @@ tools::Long Window::GetDrawPixel( OutputDevice const * 
pDev, tools::Long nPixels
 return nP;
 }
 
-static void lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool 
isMultiplyByLineSize )
+// returns how much was actually scrolled (so that abs(retval) <= abs(nN))
+static double lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool 
isMultiplyByLineSize )
 {
 if ( !pScrl || !nN || !pScrl->IsEnabled() || !pScrl->IsInputEnabled() || 
pScrl->IsInModalMode() )
-return;
+return 0.0;
 
 tools::Long nNewPos = pScrl->GetThumbPos();
+double scrolled = nN;
 
 if ( nN == double(-LONG_MAX) )
 nNewPos += pScrl->GetPageSize();
@@ -615,13 +617,22 @@ static void lcl_HandleScrollHelper( ScrollBar* pScrl, 
double nN, bool isMultiply
 nN*=pScrl->GetLineSize();
 }
 
-const double fVal = nNewPos - nN;
+// compute how many quantized units to scroll
+tools::Long magnitude = o3tl::saturating_cast(abs(nN));
+tools::Long change = copysign(magnitude, nN);
+
+nNewPos = nNewPos - change;
 
-nNewPos = o3tl::saturating_cast(fVal);
+scrolled = double(change);
+// convert back to chunked/continuous
+if(isMultiplyByLineSize){
+scrolled /= pScrl->GetLineSize();
+}
 }
 
 pScrl->DoScroll( nNewPos );
 
+return scrolled;
 }
 
 bool Window::HandleScrollCommand( const CommandEvent& rCmd,
@@ -667,6 +678,9 @@ bool Window::HandleScrollCommand( const CommandEvent& rCmd,
 {
 double nScrollLines = pData->GetScrollLines();
 double nLines;
+double* partialScroll = pData->IsHorz()
+? >mfPartialScrollX
+: >mfPartialScrollY;
 if ( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
 {
 if ( 

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

2022-10-03 Thread Caolán McNamara (via logerrit)
 vcl/inc/pdf/pdfwriter_impl.hxx|3 ++-
 vcl/source/gdi/pdfwriter_impl.cxx |   14 +-
 2 files changed, 11 insertions(+), 6 deletions(-)

New commits:
commit da42c917c49940b3507b72fcd8f603331d922244
Author: Caolán McNamara 
AuthorDate: Mon Oct 3 09:01:56 2022 +0100
Commit: Adolfo Jayme Barrientos 
CommitDate: Mon Oct 3 15:49:22 2022 +0200

tdf#150786 use the same colors for pdf widgets regardless of theme

use StyleSettings::SetStandardStyles()

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

diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index d718529476b9..0919414c4dc5 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -55,11 +55,11 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
 
-class StyleSettings;
 class FontSubsetInfo;
 class ZCodec;
 class EncHashTransporter;
@@ -664,6 +664,7 @@ private:
 void DrawHatchLine_DrawLine(const Point& rStartPoint, const Point& 
rEndPoint) override;
 
 MapMode m_aMapMode; // PDFWriterImpl scaled 
units
+StyleSettings   m_aWidgetStyleSettings;
 std::vector< PDFPage >  m_aPages;
 /* maps object numbers to file offsets (needed for xref) */
 std::vector< sal_uInt64 >   m_aObjects;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 4577eff96b86..e28f1fa75997 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1196,6 +1196,7 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
PDFWriter& i_rOuterFace)
 : VirtualDevice(Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
 m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) 
), Fraction( 1, pointToPixel(1) ) ),
+m_aWidgetStyleSettings(Application::GetSettings().GetStyleSettings()),
 m_nCurrentStructElement( 0 ),
 m_bEmitStructure( true ),
 m_nNextFID( 1 ),
@@ -1231,6 +1232,9 @@ PDFWriterImpl::PDFWriterImpl( const 
PDFWriter::PDFWriterContext& rContext,
 aFont.SetFamilyName( "Times" );
 aFont.SetFontSize( Size( 0, 12 ) );
 
+// tdf#150786 use the same settings for widgets regardless of theme
+m_aWidgetStyleSettings.SetStandardStyles();
+
 GraphicsState aState;
 aState.m_aMapMode   = m_aMapMode;
 aState.m_aFont  = aFont;
@@ -3633,7 +3637,7 @@ static const Color& replaceColor( const Color& rCol1, 
const Color& rCol2 )
 
 void PDFWriterImpl::createDefaultPushButtonAppearance( PDFWidget& rButton, 
const PDFWriter::PushButtonWidget& rWidget )
 {
-const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
 // save graphics state
 push( PushFlags::ALL );
@@ -3740,7 +3744,7 @@ Font PDFWriterImpl::drawFieldBorder( PDFWidget& rIntern,
 
 void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const 
PDFWriter::EditWidget& rWidget )
 {
-const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+const StyleSettings& rSettings = m_aWidgetStyleSettings;
 SvMemoryStream* pEditStream = new SvMemoryStream( 1024, 1024 );
 
 push( PushFlags::ALL );
@@ -3786,7 +3790,7 @@ void PDFWriterImpl::createDefaultEditAppearance( 
PDFWidget& rEdit, const PDFWrit
 
 void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const 
PDFWriter::ListBoxWidget& rWidget )
 {
-const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+const StyleSettings& rSettings = m_aWidgetStyleSettings;
 SvMemoryStream* pListBoxStream = new SvMemoryStream( 1024, 1024 );
 
 push( PushFlags::ALL );
@@ -3831,7 +3835,7 @@ void PDFWriterImpl::createDefaultListBoxAppearance( 
PDFWidget& rBox, const PDFWr
 
 void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const 
PDFWriter::CheckBoxWidget& rWidget )
 {
-const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
 // save graphics state
 push( PushFlags::ALL );
@@ -3971,7 +3975,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( 
PDFWidget& rBox, const PDFW
 
 void PDFWriterImpl::createDefaultRadioButtonAppearance( PDFWidget& rBox, const 
PDFWriter::RadioButtonWidget& rWidget )
 {
-const StyleSettings& rSettings = 
Application::GetSettings().GetStyleSettings();
+const StyleSettings& rSettings = m_aWidgetStyleSettings;
 
 // save graphics state
 push( PushFlags::ALL );


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

2022-07-29 Thread Julien Nabet (via logerrit)
 vcl/inc/font/OpenTypeFeatureStrings.hrc   |3 ---
 vcl/source/font/OpenTypeFeatureDefinitionList.cxx |5 +
 2 files changed, 1 insertion(+), 7 deletions(-)

New commits:
commit de159e1ea264dae35cae90af24700bf971f065be
Author: Julien Nabet 
AuthorDate: Thu Jul 28 18:06:36 2022 +0200
Commit: Caolán McNamara 
CommitDate: Fri Jul 29 17:07:23 2022 +0200

tdf#126754: Wrong OpenType tag for fractions in "font features" dialog

Opentype defines only "frac" and not parameters values like 1 or 2 for 
"frac"

See:
https://en.wikipedia.org/wiki/List_of_typographic_features
https://docs.microsoft.com/en-us/typography/opentype/spec/features_fj

So remove STR_FONT_FEATURE_ID_FRAC_PARAM_0/1/2
+ remove the extra ":" for STR_FONT_FEATURE_ID_FRAC

I gave a try with "Alegraya" font, it worked.
I also give a try with "Linux Biolinum G", there are still "None" (value 
"0"), "Diagonal fractions" (value "1") and "Nut fractions" (value "2").
It seems they're on the font itself like entry "'frac' Diagonal and nut 
Fractions".

So it shouldn't bring regression.

Change-Id: I2f46a3f4a53dc498b764dbeb1c1266589cc8d8c7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137574
Reviewed-by: Caolán McNamara 
Tested-by: Jenkins
Reviewed-by: Julien Nabet 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137590

diff --git a/vcl/inc/font/OpenTypeFeatureStrings.hrc 
b/vcl/inc/font/OpenTypeFeatureStrings.hrc
index 5e1960b95613..15876c9562c0 100644
--- a/vcl/inc/font/OpenTypeFeatureStrings.hrc
+++ b/vcl/inc/font/OpenTypeFeatureStrings.hrc
@@ -41,9 +41,6 @@
 #define STR_FONT_FEATURE_ID_EXPT  NC_("STR_FONT_FEATURE_ID_EXPT", 
"Expert Forms")
 #define STR_FONT_FEATURE_ID_FALT  NC_("STR_FONT_FEATURE_ID_FALT", 
"Final Glyph on Line Alternates")
 #define STR_FONT_FEATURE_ID_FRAC  NC_("STR_FONT_FEATURE_ID_FRAC", 
"Fraction style:")
-#define STR_FONT_FEATURE_ID_FRAC_PARAM_0  
NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_0", "None")
-#define STR_FONT_FEATURE_ID_FRAC_PARAM_1  
NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_1", "Diagonal Fractions")
-#define STR_FONT_FEATURE_ID_FRAC_PARAM_2  
NC_("STR_FONT_FEATURE_ID_FRAC_PARAM_2", "Nut Fractions")
 #define STR_FONT_FEATURE_ID_FWID  NC_("STR_FONT_FEATURE_ID_FWID", 
"Full Widths")
 #define STR_FONT_FEATURE_ID_HALT  NC_("STR_FONT_FEATURE_ID_HALT", 
"Alternate Half Widths")
 #define STR_FONT_FEATURE_ID_HIST  NC_("STR_FONT_FEATURE_ID_HIST", 
"Historical Forms")
diff --git a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx 
b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
index bd60c0e3bd32..f49837ccec43 100644
--- a/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
+++ b/vcl/source/font/OpenTypeFeatureDefinitionList.cxx
@@ -45,10 +45,7 @@ void OpenTypeFeatureDefinitionListPrivate::init()
 { featureCode("dpng"), STR_FONT_FEATURE_ID_DPNG },
 { featureCode("expt"), STR_FONT_FEATURE_ID_EXPT },
 { featureCode("falt"), STR_FONT_FEATURE_ID_FALT },
-{ featureCode("frac"), STR_FONT_FEATURE_ID_FRAC,
-  std::vector{ { 0, STR_FONT_FEATURE_ID_FRAC_PARAM_0 
},
- { 1, STR_FONT_FEATURE_ID_FRAC_PARAM_1 
},
- { 2, STR_FONT_FEATURE_ID_FRAC_PARAM_2 
} } },
+{ featureCode("frac"), STR_FONT_FEATURE_ID_FRAC },
 { featureCode("fwid"), STR_FONT_FEATURE_ID_FWID },
 { featureCode("halt"), STR_FONT_FEATURE_ID_HALT },
 { featureCode("hist"), STR_FONT_FEATURE_ID_HIST },