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

2022-10-07 Thread Caolán McNamara (via logerrit)
 include/vcl/toolkit/edit.hxx |1 +
 sw/source/ui/table/autoformatpreview.cxx |9 -
 vcl/source/control/edit.cxx  |   22 ++
 vcl/source/control/spinfld.cxx   |8 ++--
 vcl/source/window/brdwin.cxx |   17 ++---
 5 files changed, 39 insertions(+), 18 deletions(-)

New commits:
commit e73f779f46cb709c2c7de7f0b6d217195ccb5a4f
Author: Caolán McNamara 
AuthorDate: Fri Oct 7 17:31:40 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 7 20:25:41 2022 +0200

set the background before setting the DrawMode

so we get the document color set even in HighContrast mode

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

diff --git a/sw/source/ui/table/autoformatpreview.cxx 
b/sw/source/ui/table/autoformatpreview.cxx
index 2a2318252c9f..e04fffefcae4 100644
--- a/sw/source/ui/table/autoformatpreview.cxx
+++ b/sw/source/ui/table/autoformatpreview.cxx
@@ -432,6 +432,10 @@ void AutoFormatPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 {
 rRenderContext.Push(vcl::PushFlags::ALL);
 
+const Color& rWinColor = 
SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
+rRenderContext.SetBackground(Wallpaper(rWinColor));
+rRenderContext.Erase();
+
 DrawModeFlags nOldDrawMode = rRenderContext.GetDrawMode();
 if (rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
 rRenderContext.SetDrawMode(DrawModeFlags::SettingsLine | 
DrawModeFlags::SettingsFill
@@ -441,12 +445,7 @@ void AutoFormatPreview::Paint(vcl::RenderContext& 
rRenderContext, const tools::R
 
 vcl::Font aFont(rRenderContext.GetFont());
 aFont.SetTransparent(true);
-
 rRenderContext.SetFont(aFont);
-rRenderContext.SetLineColor();
-const Color& rWinColor = 
SW_MOD()->GetColorConfig().GetColorValue(::svtools::DOCCOLOR).nColor;
-rRenderContext.SetBackground(Wallpaper(rWinColor));
-rRenderContext.SetFillColor(rWinColor);
 
 // Draw the Frame
 Color oldColor = rRenderContext.GetLineColor();
commit 4cb11d8a6682fecd661b926a417ae7f26f76e7db
Author: Caolán McNamara 
AuthorDate: Fri Oct 7 16:40:23 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Oct 7 20:25:21 2022 +0200

Related: tdf#98067 do RollOver for Edit as well as SpinButton

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

diff --git a/include/vcl/toolkit/edit.hxx b/include/vcl/toolkit/edit.hxx
index 6cba936040eb..2291ce2d7558 100644
--- a/include/vcl/toolkit/edit.hxx
+++ b/include/vcl/toolkit/edit.hxx
@@ -161,6 +161,7 @@ public:
 virtual voidCommand( const CommandEvent& rCEvt ) override;
 virtual voidStateChanged( StateChangedType nType ) override;
 virtual voidDataChanged( const DataChangedEvent& rDCEvt ) override;
+virtual boolPreNotify(NotifyEvent& rNEvt) override;
 
 virtual voidModify();
 
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 70c29cff95b1..1554f846ba95 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1913,6 +1913,28 @@ void Edit::LoseFocus()
 Control::LoseFocus();
 }
 
+bool Edit::PreNotify(NotifyEvent& rNEvt)
+{
+if (rNEvt.GetType() == NotifyEventType::MOUSEMOVE)
+{
+const MouseEvent* pMouseEvt = rNEvt.GetMouseEvent();
+if (pMouseEvt && !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() 
&& !pMouseEvt->IsModifierChanged())
+{
+// trigger redraw if mouse over state has changed
+if (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow())
+{
+if (IsNativeWidgetEnabled() &&
+IsNativeControlSupported(ControlType::Editbox, 
ControlPart::Entire))
+{
+ImplInvalidateOutermostBorder(this);
+}
+}
+}
+}
+
+return Control::PreNotify(rNEvt);
+}
+
 void Edit::Command( const CommandEvent& rCEvt )
 {
 if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 56d26d81c8f8..973825a3a977 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -870,12 +870,8 @@ bool SpinField::PreNotify(NotifyEvent& rNEvt)
 tools::Rectangle* pLastRect = ImplFindPartRect( 
GetLastPointerPosPixel() );
 if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || 
pMouseEvt->IsEnterWindow()) )
 {
-if (IsNativeWidgetEnabled() &&
-IsNativeControlSupported(ControlType::Editbox, 
ControlPart::Entire))
-{
- 

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

2018-04-05 Thread Caolán McNamara
 include/vcl/bitmap.hxx|8 +++-
 sw/source/filter/ww8/ww8atr.cxx   |2 ++
 vcl/source/bitmap/bitmap.cxx  |   24 +---
 vcl/source/bitmap/bitmappaint.cxx |2 +-
 vcl/source/gdi/bitmap3.cxx|4 ++--
 vcl/source/gdi/bitmap4.cxx|8 
 6 files changed, 29 insertions(+), 19 deletions(-)

New commits:
commit f8869a6bb23312d4498b8862248ef3612a6c9393
Author: Caolán McNamara 
Date:   Thu Apr 5 08:19:31 2018 +0100

coverity#1433793 silence Explicit null dereferenced

and

coverity#1433785 Explicit null dereferenced

Change-Id: I261dc865d58daa2488c2c3c64975a2ff9bb46b53
Reviewed-on: https://gerrit.libreoffice.org/52430
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 8bcc97c768ed..0e285081d079 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -5054,11 +5054,13 @@ static void ParaTabStopDelAdd( WW8Export& rWrt,
 
 if( nOP < nNP ) // next tab is old
 {
+assert(pTO);
 aTab.Del(*pTO, nLStypeMgn); // must be deleted
 nO++;
 }
 else if( nNP < nOP )// next tab is new
 {
+assert(pTN);
 aTab.Add(*pTN, nLParaMgn);  // must be inserted
 nN++;
 }
commit 4eaa447630756f64bceba81e1a787c289c120152
Author: Chris Sherlock 
Date:   Thu Apr 5 16:02:17 2018 +1000

vcl: ImplAssignWithSize() -> ReassignWithSize()

Change-Id: I278a976028762f5c101dfd46ee62c4aa06bd719d
Reviewed-on: https://gerrit.libreoffice.org/52422
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 69108febbe4e..5740fc38eb63 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -662,11 +662,17 @@ public:
 const BmpFilterParam* pFilterParam = nullptr );
 
 public:
+/** ReassignWithSize and recalculate bitmap.
+
+  ReassignWithSizes the bitmap, and recalculates the bitmap size based on 
the new bitmap.
+
+  @param rBitmap Bitmap to reassign and use for size calculation
+ */
+SAL_DLLPRIVATE void ReassignWithSize(const Bitmap& rBitmap);
 
 SAL_DLLPRIVATE void ImplMakeUnique();
 const std::shared_ptr& ImplGetImpBitmap() const { return 
mxImpBmp; }
 SAL_DLLPRIVATE void ImplSetImpBitmap( const 
std::shared_ptr& xImpBmp );
-SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap );
 
 SAL_DLLPRIVATE bool ImplScaleFast( const double& rScaleX, const 
double& rScaleY );
 SAL_DLLPRIVATE bool ImplScaleInterpolate( const double& rScaleX, const 
double& rScaleY );
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index bf13e87fe68c..86868f70826a 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -302,20 +302,22 @@ void Bitmap::ImplMakeUnique()
 }
 }
 
-void Bitmap::ImplAssignWithSize( const Bitmap& rBitmap )
+void Bitmap::ReassignWithSize(const Bitmap& rBitmap)
 {
-const Size  aOldSizePix( GetSizePixel() );
-const Size  aNewSizePix( rBitmap.GetSizePixel() );
-const MapMode   aOldMapMode( maPrefMapMode );
-SizeaNewPrefSize;
+const Size aOldSizePix(GetSizePixel());
+const Size aNewSizePix(rBitmap.GetSizePixel());
+const MapMode aOldMapMode(maPrefMapMode);
+Size aNewPrefSize;
 
-if( ( aOldSizePix != aNewSizePix ) && aOldSizePix.Width() && 
aOldSizePix.Height() )
+if ((aOldSizePix != aNewSizePix) && aOldSizePix.Width() && 
aOldSizePix.Height())
 {
-aNewPrefSize.setWidth( FRound( maPrefSize.Width() * 
aNewSizePix.Width() / aOldSizePix.Width() ) );
-aNewPrefSize.setHeight( FRound( maPrefSize.Height() * 
aNewSizePix.Height() / aOldSizePix.Height() ) );
+aNewPrefSize.setWidth(FRound(maPrefSize.Width() * aNewSizePix.Width() 
/ aOldSizePix.Width()));
+aNewPrefSize.setHeight(FRound(maPrefSize.Height() * 
aNewSizePix.Height() / aOldSizePix.Height()));
 }
 else
+{
 aNewPrefSize = maPrefSize;
+}
 
 *this = rBitmap;
 
@@ -413,7 +415,7 @@ bool Bitmap::Crop( const tools::Rectangle& rRectPixel )
 pReadAcc.reset();
 
 if( bRet )
-ImplAssignWithSize( aNewBmp );
+ReassignWithSize( aNewBmp );
 }
 }
 
@@ -810,8 +812,8 @@ bool Bitmap::Expand( sal_uLong nDX, sal_uLong nDY, const 
Color* pInitColor )
 
 pReadAcc.reset();
 
-if( bRet )
-ImplAssignWithSize( aNewBmp );
+if (bRet)
+

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

2016-06-03 Thread Noel Grandin
 include/vcl/embeddedfontshelper.hxx  |2 +-
 include/vcl/helper.hxx   |9 ++---
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 vcl/source/gdi/embeddedfontshelper.cxx   |6 +++---
 vcl/unx/generic/fontmanager/fontcache.cxx|2 +-
 vcl/unx/generic/fontmanager/helper.cxx   |   18 +-
 xmloff/source/style/XMLFontAutoStylePool.cxx |2 +-
 7 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit dfad705d5f0c05cbebb4155d69212b35c58a22c0
Author: Noel Grandin 
Date:   Wed Jun 1 11:58:20 2016 +0200

Convert whichOfficePath to scoped enum

Change-Id: If31c00ac8820e6dfce5047e997c35f5e1878db6f
Reviewed-on: https://gerrit.libreoffice.org/25763
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/helper.hxx b/include/vcl/helper.hxx
index 34271ca..dcdcd92 100644
--- a/include/vcl/helper.hxx
+++ b/include/vcl/helper.hxx
@@ -31,7 +31,9 @@
 // forwards
 namespace osl { class File; }
 
-namespace psp {
+namespace psp
+{
+
 typedef int fontID;
 
 void VCL_DLLPUBLIC getPrinterPathList( std::list< OUString >& rPathList, const 
char* pSubDir );
@@ -49,10 +51,11 @@ void VCL_DLLPUBLIC normPath( OString& rPath );
 // rOrgPath will be subject to normPath
 void VCL_DLLPUBLIC splitPath( OString& rOrgPath, OString& rDir, OString& rBase 
);
 
-enum whichOfficePath { InstallationRootPath, UserPath, ConfigPath };
+enum class whichOfficePath { InstallationRootPath, UserPath, ConfigPath };
 // note: gcc 3.4.1 warns about visibility if we retunr a const OUString& here
 // seems to be a bug in gcc, now we return an object instead of a reference
-OUString VCL_DLLPUBLIC getOfficePath( enum whichOfficePath ePath );
+OUString VCL_DLLPUBLIC getOfficePath( whichOfficePath ePath );
+
 } // namespace
 
 
diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx 
b/vcl/unx/generic/fontmanager/fontcache.cxx
index 25526d8..a4a1550 100644
--- a/vcl/unx/generic/fontmanager/fontcache.cxx
+++ b/vcl/unx/generic/fontmanager/fontcache.cxx
@@ -50,7 +50,7 @@ using namespace utl;
 FontCache::FontCache()
 {
 m_bDoFlush = false;
-m_aCacheFile = getOfficePath( UserPath );
+m_aCacheFile = getOfficePath( whichOfficePath::UserPath );
 if( !m_aCacheFile.isEmpty() )
 {
 m_aCacheFile += "/user/psprint/pspfontcache";
diff --git a/vcl/unx/generic/fontmanager/helper.cxx 
b/vcl/unx/generic/fontmanager/helper.cxx
index a8c35b8..8b7c2ed 100644
--- a/vcl/unx/generic/fontmanager/helper.cxx
+++ b/vcl/unx/generic/fontmanager/helper.cxx
@@ -37,7 +37,7 @@ using ::rtl::Bootstrap;
 
 namespace psp {
 
-OUString getOfficePath( enum whichOfficePath ePath )
+OUString getOfficePath( whichOfficePath ePath )
 {
 static OUString aInstallationRootPath;
 static OUString aUserPath;
@@ -87,9 +87,9 @@ OUString getOfficePath( enum whichOfficePath ePath )
 
 switch( ePath )
 {
-case ConfigPath: return aConfigPath;
-case InstallationRootPath: return aInstallationRootPath;
-case UserPath: return aUserPath;
+case whichOfficePath::ConfigPath: return aConfigPath;
+case whichOfficePath::InstallationRootPath: return 
aInstallationRootPath;
+case whichOfficePath::UserPath: return aUserPath;
 }
 return aEmpty;
 }
@@ -116,7 +116,7 @@ void psp::getPrinterPathList( std::list< OUString >& 
rPathList, const char* pSub
 OUStringBuffer aPathBuffer( 256 );
 
 // append net path
-aPathBuffer.append( getOfficePath( psp::InstallationRootPath ) );
+aPathBuffer.append( getOfficePath( whichOfficePath::InstallationRootPath ) 
);
 if( !aPathBuffer.isEmpty() )
 {
 aPathBuffer.append( "/" LIBO_SHARE_FOLDER "/psprint" );
@@ -128,7 +128,7 @@ void psp::getPrinterPathList( std::list< OUString >& 
rPathList, const char* pSub
 rPathList.push_back( aPathBuffer.makeStringAndClear() );
 }
 // append user path
-aPathBuffer.append( getOfficePath( psp::UserPath ) );
+aPathBuffer.append( getOfficePath( whichOfficePath::UserPath ) );
 if( !aPathBuffer.isEmpty() )
 {
 aPathBuffer.append( "/user/psprint" );
@@ -193,9 +193,9 @@ OUString psp::getFontPath()
 {
 OUStringBuffer aPathBuffer( 512 );
 
-OUString aConfigPath( getOfficePath( psp::ConfigPath ) );
-OUString aInstallationRootPath( getOfficePath( 
psp::InstallationRootPath ) );
-OUString aUserPath( getOfficePath( psp::UserPath ) );
+OUString aConfigPath( getOfficePath( whichOfficePath::ConfigPath ) );
+OUString aInstallationRootPath( getOfficePath( 
whichOfficePath::InstallationRootPath ) );
+OUString aUserPath( getOfficePath( whichOfficePath::UserPath ) );
 if( !aConfigPath.isEmpty() )
 {
 // #i53530# Path from CustomDataUrl will completely
commit db4e8806aace921ca1348c1bc0949a7e554f34ac
Author: Noel Grandin 
Date: