summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/postwin.h3
-rw-r--r--include/vcl/sysdata.hxx6
-rw-r--r--vcl/glyphy/demo/demo-atlas.cc8
-rw-r--r--vcl/glyphy/demo/demo-buffer.cc8
-rw-r--r--vcl/glyphy/demo/demo-font.cc20
-rw-r--r--vcl/glyphy/demo/demo-shader.cc12
-rw-r--r--vcl/inc/glyphy/demo/demo-common.h10
-rw-r--r--vcl/inc/opengl/win/WinDeviceInfo.hxx10
-rw-r--r--vcl/inc/opengl/win/blocklist_parser.hxx1
-rw-r--r--vcl/inc/salframe.hxx4
-rw-r--r--vcl/inc/win/salbmp.h4
-rw-r--r--vcl/inc/win/saldata.hxx14
-rw-r--r--vcl/inc/win/salframe.h4
-rw-r--r--vcl/inc/win/salgdi.h4
-rw-r--r--vcl/inc/win/salinst.h6
-rw-r--r--vcl/inc/win/salmenu.h4
-rw-r--r--vcl/inc/win/salobj.h2
-rw-r--r--vcl/inc/win/salprn.h4
-rw-r--r--vcl/inc/win/salsys.h2
-rw-r--r--vcl/inc/win/saltimer.h2
-rw-r--r--vcl/inc/win/salvd.h2
-rw-r--r--vcl/inc/win/wincomp.hxx46
-rw-r--r--vcl/opengl/win/WinDeviceInfo.cxx32
-rw-r--r--vcl/opengl/win/blocklist_parser.cxx8
-rw-r--r--vcl/opengl/win/gdiimpl.cxx76
-rw-r--r--vcl/qa/cppunit/complextext.cxx2
-rw-r--r--vcl/source/app/settings.cxx16
-rw-r--r--vcl/source/app/svdata.cxx4
-rw-r--r--vcl/source/app/svmain.cxx14
-rw-r--r--vcl/source/font/fontselect.cxx2
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx46
-rw-r--r--vcl/source/window/toolbox.cxx6
-rw-r--r--vcl/win/app/salinfo.cxx10
-rw-r--r--vcl/win/app/salinst.cxx172
-rw-r--r--vcl/win/app/salshl.cxx22
-rw-r--r--vcl/win/app/saltimer.cxx16
-rw-r--r--vcl/win/gdi/gdiimpl.cxx113
-rw-r--r--vcl/win/gdi/gdiimpl.hxx2
-rw-r--r--vcl/win/gdi/salbmp.cxx160
-rw-r--r--vcl/win/gdi/salfont.cxx195
-rw-r--r--vcl/win/gdi/salgdi.cxx134
-rw-r--r--vcl/win/gdi/salnativewidgets-luna.cxx85
-rw-r--r--vcl/win/gdi/salprn.cxx289
-rw-r--r--vcl/win/gdi/salvd.cxx38
-rw-r--r--vcl/win/gdi/winlayout.cxx264
-rw-r--r--vcl/win/gdi/winlayout.hxx24
-rw-r--r--vcl/win/window/keynames.cxx4
-rw-r--r--vcl/win/window/salframe.cxx615
-rw-r--r--vcl/win/window/salmenu.cxx38
-rw-r--r--vcl/win/window/salobj.cxx78
50 files changed, 1280 insertions, 1361 deletions
diff --git a/include/postwin.h b/include/postwin.h
index 95cd6f836ca3..b2df82374da8 100644
--- a/include/postwin.h
+++ b/include/postwin.h
@@ -65,7 +65,8 @@
#define STRETCH_DELETESCANS 3
#endif
-#ifdef __cplusplus
+#if !defined INCLUDED_POSTWIN_H && defined __cplusplus
+#define INCLUDED_POSTWIN_H
extern "C"
{
BOOL WINAPI WIN_Rectangle( HDC hDC, int X1, int Y1, int X2, int Y2 );
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index 458725d24033..bb2ddf8b510a 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -82,7 +82,7 @@ struct SystemEnvData
SystemEnvData()
: nSize(0)
#if defined(_WIN32)
- , hWnd(0)
+ , hWnd(nullptr)
#elif defined( MACOSX )
, mpNSView(nullptr)
, mbOpenGL(false)
@@ -157,8 +157,8 @@ struct SystemGraphicsData
SystemGraphicsData()
: nSize( sizeof( SystemGraphicsData ) )
#if defined(_WIN32)
- , hDC( 0 )
- , hWnd( 0 )
+ , hDC( nullptr )
+ , hWnd( nullptr )
#elif defined( MACOSX )
, rCGContext( nullptr )
#elif defined( ANDROID )
diff --git a/vcl/glyphy/demo/demo-atlas.cc b/vcl/glyphy/demo/demo-atlas.cc
index 4f331daf84ba..dbf8ec95fcda 100644
--- a/vcl/glyphy/demo/demo-atlas.cc
+++ b/vcl/glyphy/demo/demo-atlas.cc
@@ -45,10 +45,10 @@ demo_atlas_create (unsigned int w,
{
TRACE();
- demo_atlas_t *at = (demo_atlas_t *) calloc (1, sizeof (demo_atlas_t));
+ demo_atlas_t *at = static_cast<demo_atlas_t *>(calloc (1, sizeof (demo_atlas_t)));
at->refcount = 1;
- glGetIntegerv (GL_ACTIVE_TEXTURE, (GLint *) &at->tex_unit);
+ glGetIntegerv (GL_ACTIVE_TEXTURE, reinterpret_cast<GLint *>(&at->tex_unit));
glGenTextures (1, &at->tex_name);
at->tex_w = w;
at->tex_h = h;
@@ -62,7 +62,7 @@ demo_atlas_create (unsigned int w,
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- gl(TexImage2D) (GL_TEXTURE_2D, 0, GL_RGBA, at->tex_w, at->tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ gl(TexImage2D) (GL_TEXTURE_2D, 0, GL_RGBA, at->tex_w, at->tex_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
return at;
}
@@ -95,7 +95,7 @@ void
demo_atlas_set_uniforms (demo_atlas_t *at)
{
GLuint program;
- glGetIntegerv (GL_CURRENT_PROGRAM, (GLint *) &program);
+ glGetIntegerv (GL_CURRENT_PROGRAM, reinterpret_cast<GLint *>(&program));
glUniform4i (glGetUniformLocation (program, "u_atlas_info"),
at->tex_w, at->tex_h, at->item_w, at->item_h_q);
diff --git a/vcl/glyphy/demo/demo-buffer.cc b/vcl/glyphy/demo/demo-buffer.cc
index 8ce5b34fcd78..5101bee65552 100644
--- a/vcl/glyphy/demo/demo-buffer.cc
+++ b/vcl/glyphy/demo/demo-buffer.cc
@@ -36,7 +36,7 @@ struct demo_buffer_t {
demo_buffer_t *
demo_buffer_create (void)
{
- demo_buffer_t *buffer = (demo_buffer_t *) calloc (1, sizeof (demo_buffer_t));
+ demo_buffer_t *buffer = static_cast<demo_buffer_t *>(calloc (1, sizeof (demo_buffer_t)));
buffer->refcount = 1;
buffer->vertices = new std::vector<glyph_vertex_t>;
@@ -114,7 +114,7 @@ demo_buffer_add_text (demo_buffer_t *buffer,
glyphy_point_t top_left = buffer->cursor;
buffer->cursor.y += font_size /* * font->ascent */;
unsigned int unicode;
- for (const unsigned char *p = (const unsigned char *) utf8; *p; p++) {
+ for (const unsigned char *p = reinterpret_cast<const unsigned char *>(utf8); *p; p++) {
if (*p < 128) {
unicode = *p;
} else {
@@ -181,11 +181,11 @@ demo_buffer_draw (demo_buffer_t *buffer)
GLuint a_glyph_vertex_loc = glGetAttribLocation (program, "a_glyph_vertex");
glBindBuffer (GL_ARRAY_BUFFER, buffer->buf_name);
if (buffer->dirty) {
- glBufferData (GL_ARRAY_BUFFER, sizeof (glyph_vertex_t) * buffer->vertices->size (), (const char *) &(*buffer->vertices)[0], GL_STATIC_DRAW);
+ glBufferData (GL_ARRAY_BUFFER, sizeof (glyph_vertex_t) * buffer->vertices->size (), &(*buffer->vertices)[0], GL_STATIC_DRAW);
buffer->dirty = false;
}
glEnableVertexAttribArray (a_glyph_vertex_loc);
- glVertexAttribPointer (a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof (glyph_vertex_t), 0);
+ glVertexAttribPointer (a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof (glyph_vertex_t), nullptr);
glDrawArrays (GL_TRIANGLES, 0, buffer->vertices->size ());
glDisableVertexAttribArray (a_glyph_vertex_loc);
}
diff --git a/vcl/glyphy/demo/demo-font.cc b/vcl/glyphy/demo/demo-font.cc
index cbf0994206f5..2f03069d5447 100644
--- a/vcl/glyphy/demo/demo-font.cc
+++ b/vcl/glyphy/demo/demo-font.cc
@@ -68,7 +68,7 @@ demo_font_create (
#endif
demo_atlas_t *atlas)
{
- demo_font_t *font = (demo_font_t *) calloc (1, sizeof (demo_font_t));
+ demo_font_t *font = static_cast<demo_font_t *>(calloc (1, sizeof (demo_font_t)));
font->refcount = 1;
font->face = face;
@@ -191,7 +191,7 @@ encode_glyph (demo_font_t *font,
matrix.eM22.value = 1;
matrix.eM22.fract = 0;
- DWORD size = GetGlyphOutlineW (hdc, glyph_index, GGO_NATIVE|GGO_GLYPH_INDEX, &glyph_metrics, 0, NULL, &matrix);
+ DWORD size = GetGlyphOutlineW (hdc, glyph_index, GGO_NATIVE|GGO_GLYPH_INDEX, &glyph_metrics, 0, nullptr, &matrix);
if (size == GDI_ERROR)
die ("GetGlyphOutlineW failed");
std::vector<char> buf(size);
@@ -199,7 +199,7 @@ encode_glyph (demo_font_t *font,
if (size == GDI_ERROR)
die ("GetGlyphOutlineW failed");
- size = GetGlyphOutlineW (hdc, glyph_index, GGO_METRICS|GGO_GLYPH_INDEX, &glyph_metrics, 0, NULL, &matrix);
+ size = GetGlyphOutlineW (hdc, glyph_index, GGO_METRICS|GGO_GLYPH_INDEX, &glyph_metrics, 0, nullptr, &matrix);
if (size == GDI_ERROR)
die ("GetGlyphOutlineW failed");
@@ -215,10 +215,10 @@ encode_glyph (demo_font_t *font,
glyphy_arc_accumulator_reset (font->acc);
glyphy_arc_accumulator_set_tolerance (font->acc, tolerance);
glyphy_arc_accumulator_set_callback (font->acc,
- (glyphy_arc_endpoint_accumulator_callback_t) accumulate_endpoint,
+ reinterpret_cast<glyphy_arc_endpoint_accumulator_callback_t>(accumulate_endpoint),
&endpoints);
- if (0 != glyphy_windows(outline_decompose) ((TTPOLYGONHEADER *) buf.data(), buf.size(), font->acc))
+ if (0 != glyphy_windows(outline_decompose) (reinterpret_cast<TTPOLYGONHEADER *>(buf.data()), buf.size(), font->acc))
die ("Failed converting glyph outline to arcs");
#endif
@@ -240,14 +240,14 @@ encode_glyph (demo_font_t *font,
}
if (SCALE != 1.)
- for (unsigned int i = 0; i < endpoints.size (); i++)
+ for (std::vector<glyphy_arc_endpoint_t>::size_type i = 0; i < endpoints.size (); i++)
{
endpoints[i].p.x /= SCALE;
endpoints[i].p.y /= SCALE;
}
double avg_fetch_achieved;
- if (!glyphy_arc_list_encode_blob (endpoints.size () ? &endpoints[0] : NULL, endpoints.size (),
+ if (!glyphy_arc_list_encode_blob (endpoints.size () ? &endpoints[0] : nullptr, endpoints.size (),
buffer,
buffer_len,
faraway / SCALE,
@@ -270,7 +270,7 @@ encode_glyph (demo_font_t *font,
*advance = glyph_metrics.gmCellIncX / (double) upem; /* ??? */
#endif
- if (0)
+ if (false)
LOGI ("gid%3u: endpoints%3d; err%3g%%; tex fetch%4.1f; mem%4.1fkb\n",
glyph_index,
(unsigned int) glyphy_arc_accumulator_get_num_endpoints (font->acc),
@@ -286,7 +286,7 @@ encode_glyph (demo_font_t *font,
}
static void
-_demo_font_upload_glyph (demo_font_t *font,
+demo_font_upload_glyph (demo_font_t *font,
unsigned int glyph_index,
glyph_info_t *glyph_info)
{
@@ -315,7 +315,7 @@ demo_font_lookup_glyph (demo_font_t *font,
glyph_info_t *glyph_info)
{
if (font->glyph_cache->find (glyph_index) == font->glyph_cache->end ()) {
- _demo_font_upload_glyph (font, glyph_index, glyph_info);
+ demo_font_upload_glyph (font, glyph_index, glyph_info);
(*font->glyph_cache)[glyph_index] = *glyph_info;
} else
*glyph_info = (*font->glyph_cache)[glyph_index];
diff --git a/vcl/glyphy/demo/demo-shader.cc b/vcl/glyphy/demo/demo-shader.cc
index dc5fbaa21edd..395068d22db4 100644
--- a/vcl/glyphy/demo/demo-shader.cc
+++ b/vcl/glyphy/demo/demo-shader.cc
@@ -80,7 +80,7 @@ demo_shader_add_glyph_vertices (const glyphy_point_t &p,
double _vx = p.x + font_size * ((1-_cx) * gi->extents.min_x + _cx * gi->extents.max_x); \
double _vy = p.y - font_size * ((1-_cy) * gi->extents.min_y + _cy * gi->extents.max_y); \
glyph_vertex_encode (_vx, _vy, _cx, _cy, gi, &v[_cx * 2 + _cy]); \
- } while (0)
+ } while (false)
ENCODE_CORNER (0, 0);
ENCODE_CORNER (0, 1);
ENCODE_CORNER (1, 0);
@@ -120,7 +120,7 @@ compile_shader (GLenum type,
if (!(shader = glCreateShader (type)))
return shader;
- glShaderSource (shader, count, sources, 0);
+ glShaderSource (shader, count, sources, nullptr);
glCompileShader (shader);
glGetShaderiv (shader, GL_COMPILE_STATUS, &compiled);
@@ -131,8 +131,8 @@ compile_shader (GLenum type,
glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &info_len);
if (info_len > 0) {
- char *info_log = (char*) malloc (info_len);
- glGetShaderInfoLog (shader, info_len, NULL, info_log);
+ char *info_log = static_cast<char*>(malloc (info_len));
+ glGetShaderInfoLog (shader, info_len, nullptr, info_log);
LOGW ("%s\n", info_log);
free (info_log);
@@ -167,8 +167,8 @@ link_program (GLuint vshader,
glGetProgramiv (program, GL_INFO_LOG_LENGTH, &info_len);
if (info_len > 0) {
- char *info_log = (char*) malloc (info_len);
- glGetProgramInfoLog (program, info_len, NULL, info_log);
+ char *info_log = static_cast<char*>(malloc (info_len));
+ glGetProgramInfoLog (program, info_len, nullptr, info_log);
LOGW ("%s\n", info_log);
free (info_log);
diff --git a/vcl/inc/glyphy/demo/demo-common.h b/vcl/inc/glyphy/demo/demo-common.h
index 380942f82297..1c070f23d945 100644
--- a/vcl/inc/glyphy/demo/demo-common.h
+++ b/vcl/inc/glyphy/demo/demo-common.h
@@ -127,11 +127,11 @@
#define gl(name) \
- for (GLint __ee, __ii = 0; \
- __ii < 1; \
- (__ii++, \
- (__ee = glGetError()) && \
- (reportGLerror (__ee, #name, __LINE__, __FILE__), 0))) \
+ for (GLint ee_, ii_ = 0; \
+ ii_ < 1; \
+ (ii_++, \
+ (ee_ = glGetError()) && \
+ (reportGLerror (ee_, #name, __LINE__, __FILE__), 0))) \
gl##name
diff --git a/vcl/inc/opengl/win/WinDeviceInfo.hxx b/vcl/inc/opengl/win/WinDeviceInfo.hxx
index 8dcbd553dfe9..2e6360d4af07 100644
--- a/vcl/inc/opengl/win/WinDeviceInfo.hxx
+++ b/vcl/inc/opengl/win/WinDeviceInfo.hxx
@@ -149,7 +149,7 @@ private:
bool mbRDP;
void GetData();
- void FillBlacklist();
+ static void FillBlacklist();
bool FindBlocklistedDeviceInList();
static OUString* mpDeviceVendors[wgl::DeviceVendorMax];
@@ -159,9 +159,9 @@ public:
WinOpenGLDeviceInfo();
static OUString GetDeviceVendor(wgl::DeviceVendor eVendor);
- virtual ~WinOpenGLDeviceInfo();
+ virtual ~WinOpenGLDeviceInfo() override;
- virtual bool isDeviceBlocked();
+ virtual bool isDeviceBlocked() override;
const OUString& GetDriverVersion() const
{
@@ -208,8 +208,8 @@ public:
}
static bool FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
- OUString sDriverVersion, OUString sAdapterVendorID,
- OUString sAdapterDeviceID, uint32_t nWindowsVersion);
+ OUString const & sDriverVersion, OUString const & sAdapterVendorID,
+ OUString const & sAdapterDeviceID, uint32_t nWindowsVersion);
};
#endif
diff --git a/vcl/inc/opengl/win/blocklist_parser.hxx b/vcl/inc/opengl/win/blocklist_parser.hxx
index f30734436f22..6b716ab3d7e0 100644
--- a/vcl/inc/opengl/win/blocklist_parser.hxx
+++ b/vcl/inc/opengl/win/blocklist_parser.hxx
@@ -24,7 +24,6 @@ public:
private:
void handleEntry(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader);
- void handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader);
void handleList(xmlreader::XmlReader& rReader);
void handleContent(xmlreader::XmlReader& rReader);
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index a9654b817dd7..bac5b9be636a 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -280,6 +280,10 @@ public:
{ return m_pProc ? long(m_pProc( m_pWindow, nEvent, pEvent )) : 0; }
};
+#ifdef _WIN32
+bool HasAtHook();
+#endif
+
#endif // INCLUDED_VCL_INC_SALFRAME_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 5b24aca02f14..d1b96be52a1c 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -62,7 +62,7 @@ public:
HGLOBAL ImplGethDIB() const { return mhDIB; }
HBITMAP ImplGethDDB() const { return mhDDB; }
- std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = 0) const;
+ std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = nullptr) const;
static HGLOBAL ImplCreateDIB( const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal );
static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB );
@@ -73,7 +73,7 @@ public:
public:
WinSalBitmap();
- virtual ~WinSalBitmap();
+ virtual ~WinSalBitmap() override;
public:
diff --git a/vcl/inc/win/saldata.hxx b/vcl/inc/win/saldata.hxx
index bb630da9c2df..fc82e13b617a 100644
--- a/vcl/inc/win/saldata.hxx
+++ b/vcl/inc/win/saldata.hxx
@@ -59,8 +59,8 @@ public:
~SalData();
// native widget framework
- void initNWF();
- void deInitNWF();
+ static void initNWF();
+ static void deInitNWF();
// fill maVKMap;
void initKeyCodeMap();
@@ -151,7 +151,7 @@ struct HDCCache
};
void ImplClearHDCCache( SalData* pData );
-HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp = 0 );
+HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp = nullptr );
void ImplReleaseCachedDC( sal_uLong nID );
bool ImplAddTempFont( SalData&, const OUString& rFontFileURL );
@@ -273,22 +273,22 @@ int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 );
inline void SetWindowPtr( HWND hWnd, WinSalFrame* pThis )
{
- SetWindowLongPtr( hWnd, SAL_FRAME_THIS, (LONG_PTR)pThis );
+ SetWindowLongPtr( hWnd, SAL_FRAME_THIS, reinterpret_cast<LONG_PTR>(pThis) );
}
inline WinSalFrame* GetWindowPtr( HWND hWnd )
{
- return (WinSalFrame*)GetWindowLongPtrW( hWnd, SAL_FRAME_THIS );
+ return reinterpret_cast<WinSalFrame*>(GetWindowLongPtrW( hWnd, SAL_FRAME_THIS ));
}
inline void SetSalObjWindowPtr( HWND hWnd, WinSalObject* pThis )
{
- SetWindowLongPtr( hWnd, SAL_OBJECT_THIS, (LONG_PTR)pThis );
+ SetWindowLongPtr( hWnd, SAL_OBJECT_THIS, reinterpret_cast<LONG_PTR>(pThis) );
}
inline WinSalObject* GetSalObjWindowPtr( HWND hWnd )
{
- return (WinSalObject*)GetWindowLongPtr( hWnd, SAL_OBJECT_THIS );
+ return reinterpret_cast<WinSalObject*>(GetWindowLongPtr( hWnd, SAL_OBJECT_THIS ));
}
#endif // INCLUDED_VCL_INC_WIN_SALDATA_HXX
diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h
index 2d19ccf23dd1..3c3fa0eb0c77 100644
--- a/vcl/inc/win/salframe.h
+++ b/vcl/inc/win/salframe.h
@@ -84,7 +84,7 @@ public:
void updateScreenNumber();
public:
WinSalFrame();
- virtual ~WinSalFrame();
+ virtual ~WinSalFrame() override;
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
@@ -138,7 +138,7 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect );
// get foreign key names
namespace vcl_sal {
OUString getKeysReplacementName(
- OUString pLang,
+ OUString const & pLang,
LONG nSymbol );
}
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 5c3d85f77db4..6ecb081a9b6c 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -83,7 +83,7 @@ public:
explicit WinFontFace( const FontAttributes&,
int nFontHeight, BYTE eWinCharSet,
BYTE nPitchAndFamily );
- virtual ~WinFontFace();
+ virtual ~WinFontFace() override;
virtual PhysicalFontFace* Clone() const override;
virtual LogicalFontInstance* CreateFontInstance( FontSelectPattern& ) const override;
@@ -258,7 +258,7 @@ public:
public:
explicit WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd,
SalGeometryProvider *pProvider);
- virtual ~WinSalGraphics();
+ virtual ~WinSalGraphics() override;
SalGraphicsImpl* GetImpl() const override;
bool isPrinter() const;
diff --git a/vcl/inc/win/salinst.h b/vcl/inc/win/salinst.h
index 60e404baae82..931437e43b69 100644
--- a/vcl/inc/win/salinst.h
+++ b/vcl/inc/win/salinst.h
@@ -36,16 +36,16 @@ public:
public:
WinSalInstance();
- virtual ~WinSalInstance();
+ virtual ~WinSalInstance() override;
virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override;
virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override;
virtual void DestroyFrame( SalFrame* pFrame ) override;
- virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow = true ) override;
+ virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override;
virtual void DestroyObject( SalObject* pObject ) override;
virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics,
long &nDX, long &nDY,
- DeviceFormat eFormat, const SystemGraphicsData *pData ) override;
+ DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override;
virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo,
ImplJobSetup* pSetupData ) override;
virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override;
diff --git a/vcl/inc/win/salmenu.h b/vcl/inc/win/salmenu.h
index 858d587a40e8..7058d9c82b8a 100644
--- a/vcl/inc/win/salmenu.h
+++ b/vcl/inc/win/salmenu.h
@@ -27,7 +27,7 @@ class WinSalMenu : public SalMenu
{
public:
WinSalMenu();
- virtual ~WinSalMenu();
+ virtual ~WinSalMenu() override;
virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars
// otherwise only menu messages are processed (eg, OLE on Windows)
@@ -52,7 +52,7 @@ class WinSalMenuItem : public SalMenuItem
{
public:
WinSalMenuItem();
- virtual ~WinSalMenuItem();
+ virtual ~WinSalMenuItem() override;
MENUITEMINFOW mInfo;
void* mpMenu; // pointer to corresponding VCL menu
diff --git a/vcl/inc/win/salobj.h b/vcl/inc/win/salobj.h
index e6c9e5a4f103..c351a1895544 100644
--- a/vcl/inc/win/salobj.h
+++ b/vcl/inc/win/salobj.h
@@ -37,7 +37,7 @@ public:
WinSalObject* mpNextObject; // pointer to next object
WinSalObject();
- virtual ~WinSalObject();
+ virtual ~WinSalObject() override;
virtual void ResetClipRegion() override;
virtual void BeginSetClipRegion( sal_uIntPtr nRects ) override;
diff --git a/vcl/inc/win/salprn.h b/vcl/inc/win/salprn.h
index 87366800db9f..cfb01c3a4591 100644
--- a/vcl/inc/win/salprn.h
+++ b/vcl/inc/win/salprn.h
@@ -51,7 +51,7 @@ public:
bool mbGraphics; // is Graphics used
public:
WinSalInfoPrinter();
- virtual ~WinSalInfoPrinter();
+ virtual ~WinSalInfoPrinter() override;
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
@@ -86,7 +86,7 @@ public:
public:
WinSalPrinter();
- virtual ~WinSalPrinter();
+ virtual ~WinSalPrinter() override;
using SalPrinter::StartJob;
virtual bool StartJob( const OUString* pFileName,
diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h
index 5dd8de6450a6..7d5b26275915 100644
--- a/vcl/inc/win/salsys.h
+++ b/vcl/inc/win/salsys.h
@@ -48,7 +48,7 @@ private:
unsigned int m_nPrimary;
public:
WinSalSystem() : m_nPrimary( 0 ) {}
- virtual ~WinSalSystem();
+ virtual ~WinSalSystem() override;
virtual unsigned int GetDisplayScreenCount() override;
virtual unsigned int GetDisplayBuiltInScreen() override;
diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index 220941fc9a2e..996b2b5137da 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -26,7 +26,7 @@ class WinSalTimer : public SalTimer
{
public:
WinSalTimer() {}
- virtual ~WinSalTimer();
+ virtual ~WinSalTimer() override;
virtual void Start(sal_uIntPtr nMS) override;
virtual void Stop() override;
diff --git a/vcl/inc/win/salvd.h b/vcl/inc/win/salvd.h
index 1b57feacd2f2..d6ef1199ca45 100644
--- a/vcl/inc/win/salvd.h
+++ b/vcl/inc/win/salvd.h
@@ -46,7 +46,7 @@ public:
long mnHeight;
WinSalVirtualDevice();
- virtual ~WinSalVirtualDevice();
+ virtual ~WinSalVirtualDevice() override;
virtual SalGraphics* AcquireGraphics() override;
virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
diff --git a/vcl/inc/win/wincomp.hxx b/vcl/inc/win/wincomp.hxx
index 8d1377014d25..87aae83e9cfc 100644
--- a/vcl/inc/win/wincomp.hxx
+++ b/vcl/inc/win/wincomp.hxx
@@ -27,72 +27,72 @@
inline HPEN SelectPen( HDC hDC, HPEN hPen )
{
- return (HPEN)SelectObject( hDC, (HGDIOBJ)hPen );
+ return static_cast<HPEN>(SelectObject( hDC, static_cast<HGDIOBJ>(hPen) ));
}
inline void DeletePen( HPEN hPen )
{
- DeleteObject( (HGDIOBJ)hPen );
+ DeleteObject( static_cast<HGDIOBJ>(hPen) );
}
inline HPEN GetStockPen( int nObject )
{
- return (HPEN)GetStockObject( nObject );
+ return static_cast<HPEN>(GetStockObject( nObject ));
}
inline HBRUSH SelectBrush( HDC hDC, HBRUSH hBrush )
{
- return (HBRUSH)SelectObject( hDC, (HGDIOBJ)hBrush );
+ return static_cast<HBRUSH>(SelectObject( hDC, static_cast<HGDIOBJ>(hBrush) ));
}
inline void DeleteBrush( HBRUSH hBrush )
{
- DeleteObject( (HGDIOBJ)hBrush );
+ DeleteObject( static_cast<HGDIOBJ>(hBrush) );
}
inline HBRUSH GetStockBrush( int nObject )
{
- return (HBRUSH)GetStockObject( nObject );
+ return static_cast<HBRUSH>(GetStockObject( nObject ));
}
inline HFONT SelectFont( HDC hDC, HFONT hFont )
{
- return (HFONT)SelectObject( hDC, (HGDIOBJ)hFont );
+ return static_cast<HFONT>(SelectObject( hDC, static_cast<HGDIOBJ>(hFont) ));
}
inline void DeleteFont( HFONT hFont )
{
- DeleteObject( (HGDIOBJ)hFont );
+ DeleteObject( static_cast<HGDIOBJ>(hFont) );
}
inline HFONT GetStockFont( int nObject )
{
- return (HFONT)GetStockObject( nObject );
+ return static_cast<HFONT>(GetStockObject( nObject ));
}
inline HBITMAP SelectBitmap( HDC hDC, HBITMAP hBitmap )
{
- return (HBITMAP)SelectObject( hDC, (HGDIOBJ)hBitmap );
+ return static_cast<HBITMAP>(SelectObject( hDC, static_cast<HGDIOBJ>(hBitmap) ));
}
inline void DeleteBitmap( HBITMAP hBitmap )
{
- DeleteObject( (HGDIOBJ)hBitmap );
+ DeleteObject( static_cast<HGDIOBJ>(hBitmap) );
}
inline void DeleteRegion( HRGN hRegion )
{
- DeleteObject( (HGDIOBJ)hRegion );
+ DeleteObject( static_cast<HGDIOBJ>(hRegion) );
}
inline HPALETTE GetStockPalette( int nObject )
{
- return (HPALETTE)GetStockObject( nObject );
+ return static_cast<HPALETTE>(GetStockObject( nObject ));
}
inline void DeletePalette( HPALETTE hPalette )
{
- DeleteObject( (HGDIOBJ)hPalette );
+ DeleteObject( static_cast<HGDIOBJ>(hPalette) );
}
inline void SetWindowStyle( HWND hWnd, DWORD nStyle )
@@ -127,47 +127,47 @@ inline BOOL IsMaximized( HWND hWnd )
inline void SetWindowFont( HWND hWnd, HFONT hFont, BOOL bRedraw )
{
- SendMessage( hWnd, WM_SETFONT, (WPARAM)hFont, MAKELPARAM((UINT)bRedraw,0) );
+ SendMessage( hWnd, WM_SETFONT, reinterpret_cast<WPARAM>(hFont), MAKELPARAM((UINT)bRedraw,0) );
}
inline HFONT GetWindowFont( HWND hWnd )
{
- return (HFONT) SendMessage( hWnd, WM_GETFONT, 0, 0 );
+ return reinterpret_cast<HFONT>(SendMessage( hWnd, WM_GETFONT, 0, 0 ));
}
inline void SetClassCursor( HWND hWnd, HCURSOR hCursor )
{
- SetClassLongPtr( hWnd, GCLP_HCURSOR, (LONG_PTR)hCursor );
+ SetClassLongPtr( hWnd, GCLP_HCURSOR, reinterpret_cast<LONG_PTR>(hCursor) );
}
inline HCURSOR GetClassCursor( HWND hWnd )
{
- return (HCURSOR)GetClassLongPtr( hWnd, GCLP_HCURSOR );
+ return reinterpret_cast<HCURSOR>(GetClassLongPtr( hWnd, GCLP_HCURSOR ));
}
inline void SetClassIcon( HWND hWnd, HICON hIcon )
{
- SetClassLongPtr( hWnd, GCLP_HICON, (LONG_PTR)hIcon );
+ SetClassLongPtr( hWnd, GCLP_HICON, reinterpret_cast<LONG_PTR>(hIcon) );
}
inline HICON GetClassIcon( HWND hWnd )
{
- return (HICON)GetClassLongPtr( hWnd, GCLP_HICON );
+ return reinterpret_cast<HICON>(GetClassLongPtr( hWnd, GCLP_HICON ));
}
inline HBRUSH SetClassBrush( HWND hWnd, HBRUSH hBrush )
{
- return (HBRUSH)SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hBrush );
+ return reinterpret_cast<HBRUSH>(SetClassLongPtr( hWnd, GCLP_HBRBACKGROUND, reinterpret_cast<LONG_PTR>(hBrush) ));
}
inline HBRUSH GetClassBrush( HWND hWnd )
{
- return (HBRUSH)GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND );
+ return reinterpret_cast<HBRUSH>(GetClassLongPtr( hWnd, GCLP_HBRBACKGROUND ));
}
inline HINSTANCE GetWindowInstance( HWND hWnd )
{
- return (HINSTANCE)GetWindowLongPtr( hWnd, GWLP_HINSTANCE );
+ return reinterpret_cast<HINSTANCE>(GetWindowLongPtr( hWnd, GWLP_HINSTANCE ));
}
diff --git a/vcl/opengl/win/WinDeviceInfo.cxx b/vcl/opengl/win/WinDeviceInfo.cxx
index bdafb6ef7a14..fcf3347a1e7a 100644
--- a/vcl/opengl/win/WinDeviceInfo.cxx
+++ b/vcl/opengl/win/WinDeviceInfo.cxx
@@ -67,7 +67,7 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
// We only use this for vram size
dwcbData = sizeof(dValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
- (LPBYTE)&dValue, &dwcbData);
+ reinterpret_cast<LPBYTE>(&dValue), &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_DWORD)
{
dValue = dValue / 1024 / 1024;
@@ -86,7 +86,7 @@ bool GetKeyValue(const WCHAR* keyLocation, const WCHAR* keyName, OUString& destS
dwcbData = sizeof(wCharValue);
result = RegQueryValueExW(key, keyName, nullptr, &resultType,
- (LPBYTE)wCharValue, &dwcbData);
+ reinterpret_cast<LPBYTE>(wCharValue), &dwcbData);
if (result == ERROR_SUCCESS && resultType == REG_MULTI_SZ)
{
// This bit here could probably be cleaner.
@@ -401,8 +401,8 @@ private:
}
bool WinOpenGLDeviceInfo::FindBlocklistedDeviceInList(std::vector<wgl::DriverInfo>& aDeviceInfos,
- OUString sDriverVersion, OUString sAdapterVendorID,
- OUString sAdapterDeviceID, uint32_t nWindowsVersion)
+ OUString const & sDriverVersion, OUString const & sAdapterVendorID,
+ OUString const & sAdapterDeviceID, uint32_t nWindowsVersion)
{
uint64_t driverVersion;
wgl::ParseDriverVersion(sDriverVersion, driverVersion);
@@ -509,7 +509,7 @@ OUString getCacheFolder()
return url;
}
-void writeToLog(SvStream& rStrm, const char* pKey, const OUString rVal)
+void writeToLog(SvStream& rStrm, const char* pKey, const OUString & rVal)
{
rStrm.WriteCharPtr(pKey);
rStrm.WriteCharPtr(": ");
@@ -636,7 +636,7 @@ void WinOpenGLDeviceInfo::GetData()
&devinfoData,
SPDRP_DRIVER,
nullptr,
- (PBYTE)value,
+ reinterpret_cast<PBYTE>(value),
sizeof(value),
nullptr))
{
@@ -648,7 +648,7 @@ void WinOpenGLDeviceInfo::GetData()
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result == ERROR_SUCCESS)
{
maDriverVersion = OUString(value);
@@ -660,7 +660,7 @@ void WinOpenGLDeviceInfo::GetData()
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result == ERROR_SUCCESS)
{
maDriverDate = value;
@@ -725,7 +725,7 @@ void WinOpenGLDeviceInfo::GetData()
&devinfoData,
SPDRP_DRIVER,
nullptr,
- (PBYTE)value,
+ reinterpret_cast<PBYTE>(value),
sizeof(value),
nullptr))
{
@@ -736,7 +736,7 @@ void WinOpenGLDeviceInfo::GetData()
{
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", nullptr,
- nullptr, (LPBYTE)value, &dwcbData);
+ nullptr, reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
continue;
@@ -765,7 +765,7 @@ void WinOpenGLDeviceInfo::GetData()
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
RegCloseKey(key);
@@ -774,7 +774,7 @@ void WinOpenGLDeviceInfo::GetData()
aDriverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
RegCloseKey(key);
@@ -783,12 +783,12 @@ void WinOpenGLDeviceInfo::GetData()
aDriverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", nullptr,
- nullptr, (LPBYTE)value, &dwcbData);
+ nullptr, reinterpret_cast<LPBYTE>(value), &dwcbData);
if (result != ERROR_SUCCESS)
{
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", nullptr, nullptr,
- (LPBYTE)value, &dwcbData);
+ reinterpret_cast<LPBYTE>(value), &dwcbData);
}
RegCloseKey(key);
if (result == ERROR_SUCCESS)
@@ -816,7 +816,7 @@ void WinOpenGLDeviceInfo::GetData()
// Macro for assigning a device vendor id to a string.
#define DECLARE_VENDOR_ID(name, deviceId) \
case name: \
- *mpDeviceVendors[id] = OUString(deviceId); \
+ *mpDeviceVendors[id] = deviceId; \
break;
OUString WinOpenGLDeviceInfo::GetDeviceVendor(wgl::DeviceVendor id)
@@ -866,7 +866,7 @@ void WinOpenGLDeviceInfo::FillBlacklist()
}
catch (...)
{
- SAL_WARN("vcl.opengl.win", "error parsing blacklist");
+ SAL_WARN("vcl.opengl", "error parsing blacklist");
maDriverInfo.clear();
}
}
diff --git a/vcl/opengl/win/blocklist_parser.cxx b/vcl/opengl/win/blocklist_parser.cxx
index eb140a1c47d7..2f72472cdf70 100644
--- a/vcl/opengl/win/blocklist_parser.cxx
+++ b/vcl/opengl/win/blocklist_parser.cxx
@@ -153,9 +153,7 @@ uint64_t getVersion(const OString& rString)
return nVersion;
}
-}
-
-void WinBlocklistParser::handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
+void handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
{
int nLevel = 1;
bool bInMsg = false;
@@ -212,6 +210,8 @@ void WinBlocklistParser::handleDevices(wgl::DriverInfo& rDriver, xmlreader::XmlR
}
}
+}
+
void WinBlocklistParser::handleEntry(wgl::DriverInfo& rDriver, xmlreader::XmlReader& rReader)
{
if (meBlockType == BlockType::WHITELIST)
@@ -271,7 +271,7 @@ void WinBlocklistParser::handleEntry(wgl::DriverInfo& rDriver, xmlreader::XmlRea
else
{
OString aAttrName(name.begin, name.length);
- SAL_WARN("vcl.opengl.win", "unsupported attribute: " << aAttrName);
+ SAL_WARN("vcl.opengl", "unsupported attribute: " << aAttrName);
}
}
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index d1e83d3aab69..6470bd093cff 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -31,9 +31,9 @@ public:
};
GLWinWindow::GLWinWindow()
- : hWnd(NULL)
- , hDC(NULL)
- , hRC(NULL)
+ : hWnd(nullptr)
+ , hDC(nullptr)
+ , hRC(nullptr)
{
}
@@ -70,7 +70,7 @@ void WinOpenGLContext::resetCurrent()
OpenGLZone aZone;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
}
bool WinOpenGLContext::isCurrent()
@@ -82,7 +82,7 @@ bool WinOpenGLContext::isCurrent()
bool WinOpenGLContext::isAnyCurrent()
{
- return wglGetCurrentContext() != NULL;
+ return wglGetCurrentContext() != nullptr;
}
void WinOpenGLContext::makeCurrent()
@@ -140,11 +140,11 @@ void WinOpenGLContext::destroyCurrentContext()
if (itr != g_vShareList.end())
g_vShareList.erase(itr);
- if (wglGetCurrentContext() != NULL)
- wglMakeCurrent(NULL, NULL);
+ if (wglGetCurrentContext() != nullptr)
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext( m_aGLWin.hRC );
ReleaseDC( m_aGLWin.hWnd, m_aGLWin.hDC );
- m_aGLWin.hRC = 0;
+ m_aGLWin.hRC = nullptr;
}
}
@@ -174,14 +174,14 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT
wc.style = 0;
wc.lpfnWndProc = WndProc;
wc.cbClsExtra = wc.cbWndExtra = 0;
- wc.hInstance = NULL;
- wc.hIcon = NULL;
- wc.hCursor = NULL;
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = (LPCSTR)"GLRenderer";
+ wc.hInstance = nullptr;
+ wc.hIcon = nullptr;
+ wc.hCursor = nullptr;
+ wc.hbrBackground = nullptr;
+ wc.lpszMenuName = nullptr;
+ wc.lpszClassName = "GLRenderer";
RegisterClass(&wc);
- hwnd = CreateWindow(wc.lpszClassName, NULL, WS_DISABLED, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL);
+ hwnd = CreateWindow(wc.lpszClassName, nullptr, WS_DISABLED, 0, 0, width, height, nullptr, nullptr, wc.hInstance, nullptr);
glWin.hDC = GetDC(hwnd);
int nPixelFormat = ChoosePixelFormat(glWin.hDC, &pfd);
@@ -208,7 +208,7 @@ bool InitTempWindow(HWND& hwnd, int width, int height, const PIXELFORMATDESCRIPT
ret = wglMakeCurrent(glWin.hDC, glWin.hRC);
if(!ret)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hwnd, glWin.hDC);
DestroyWindow(hwnd);
@@ -223,18 +223,18 @@ bool WGLisExtensionSupported(const char *extension)
OpenGLZone aZone;
const size_t extlen = strlen(extension);
- const char *supported = NULL;
+ const char *supported = nullptr;
// Try to use wglGetExtensionStringARB on current DC, if possible
PROC wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB");
if (wglGetExtString)
- supported = ((char*(__stdcall*)(HDC))wglGetExtString)(wglGetCurrentDC());
+ supported = reinterpret_cast<char*(__stdcall*)(HDC)>(wglGetExtString)(wglGetCurrentDC());
// If that failed, try standard OpenGL extensions string
- if (supported == NULL)
- supported = (char*)glGetString(GL_EXTENSIONS);
+ if (supported == nullptr)
+ supported = reinterpret_cast<char const *>(glGetString(GL_EXTENSIONS));
// If that failed too, must be no extensions supported
- if (supported == NULL)
+ if (supported == nullptr)
return false;
// Begin examination at start of string, increment by 1 on false match
@@ -243,8 +243,8 @@ bool WGLisExtensionSupported(const char *extension)
// Advance p up to the next possible match
p = strstr(p, extension);
- if (p == NULL)
- return 0; // No Match
+ if (p == nullptr)
+ return false; // No Match
// Make sure that match is at the start of the string or that
// the previous char is a space, or else we could accidentally
@@ -253,7 +253,7 @@ bool WGLisExtensionSupported(const char *extension)
// Also, make sure that the following character is space or null
// or else "wglExtensionTwo" might match "wglExtension"
if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' '))
- return 1; // Match
+ return true; // Match
}
}
@@ -262,7 +262,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
OpenGLZone aZone;
- HWND hWnd = NULL;
+ HWND hWnd = nullptr;
GLWinWindow glWin;
// Create a temp window to check whether support multi-sample, if support, get the format
if (!InitTempWindow(hWnd, 32, 32, pfd, glWin))
@@ -275,17 +275,17 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
if (!WGLisExtensionSupported("WGL_ARB_multisample"))
{
SAL_WARN("vcl.opengl", "Device doesn't support multisample");
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
return false;
}
// Get our pixel format
- PFNWGLCHOOSEPIXELFORMATARBPROC fn_wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
+ PFNWGLCHOOSEPIXELFORMATARBPROC fn_wglChoosePixelFormatARB = reinterpret_cast<PFNWGLCHOOSEPIXELFORMATARBPROC>(wglGetProcAddress("wglChoosePixelFormatARB"));
if (!fn_wglChoosePixelFormatARB)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -341,7 +341,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
bArbMultisampleSupported = true;
rPixelFormat = pixelFormat;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -355,14 +355,14 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat,
{
bArbMultisampleSupported = true;
rPixelFormat = pixelFormat;
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
return bArbMultisampleSupported;
}
// Return the valid format
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(glWin.hRC);
ReleaseDC(hWnd, glWin.hDC);
DestroyWindow(hWnd);
@@ -555,7 +555,7 @@ bool WinOpenGLContext::ImplInit()
}
HGLRC hTempRC = wglCreateContext(m_aGLWin.hDC);
- if (hTempRC == NULL)
+ if (hTempRC == nullptr)
{
SAL_WARN("vcl.opengl", "wglCreateContext failed: "<< WindowsErrorString(GetLastError()));
if (bFirstCall)
@@ -581,13 +581,13 @@ bool WinOpenGLContext::ImplInit()
return false;
}
- HGLRC hSharedCtx = 0;
+ HGLRC hSharedCtx = nullptr;
if (!g_vShareList.empty())
hSharedCtx = g_vShareList.front();
if (!wglCreateContextAttribsARB)
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -605,10 +605,10 @@ bool WinOpenGLContext::ImplInit()
0
};
m_aGLWin.hRC = wglCreateContextAttribsARB(m_aGLWin.hDC, hSharedCtx, attribs);
- if (m_aGLWin.hRC == 0)
+ if (m_aGLWin.hRC == nullptr)
{
SAL_WARN("vcl.opengl", "wglCreateContextAttribsARB failed: "<< WindowsErrorString(GetLastError()));
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -618,7 +618,7 @@ bool WinOpenGLContext::ImplInit()
if (!compiledShaderBinariesWork())
{
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (bFirstCall)
disableOpenGLAndTerminateForRestart();
@@ -626,7 +626,7 @@ bool WinOpenGLContext::ImplInit()
return false;
}
- wglMakeCurrent(NULL, NULL);
+ wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(hTempRC);
if (!wglMakeCurrent(m_aGLWin.hDC, m_aGLWin.hRC))
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index b0fa4d72cb80..cb5abbdbb83c 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -99,7 +99,7 @@ void VclComplexTextTest::testTdf95650()
OutputDevice *pOutDev = static_cast< OutputDevice * >(pWin.get());
// Check that the following executes without failing assertion
- pOutDev->ImplLayout(aTxt, 9, 1, Point(), 0, 0, SalLayoutFlags::BiDiRtl, nullptr);
+ pOutDev->ImplLayout(aTxt, 9, 1, Point(), 0, nullptr, SalLayoutFlags::BiDiRtl);
}
#endif
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index c245cbdeb802..6c9f743b70e9 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2441,15 +2441,15 @@ bool MiscSettings::GetEnableATToolSupport() const
DWORD cbData = sizeof(Data);
if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
- NULL, &dwType, Data, &cbData) )
+ nullptr, &dwType, Data, &cbData) )
{
switch (dwType)
{
case REG_SZ:
- mxData->mnEnableATT = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
+ mxData->mnEnableATT = ((0 == stricmp(reinterpret_cast<const char *>(Data), "1")) || (0 == stricmp(reinterpret_cast<const char *>(Data), "true"))) ? TRISTATE_TRUE : TRISTATE_FALSE;
break;
case REG_DWORD:
- switch (((DWORD *) Data)[0]) {
+ switch (reinterpret_cast<DWORD *>(Data)[0]) {
case 0:
mxData->mnEnableATT = TRISTATE_FALSE;
break;
@@ -2513,18 +2513,18 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable )
DWORD cbData = sizeof(Data);
if( ERROR_SUCCESS == RegQueryValueEx(hkey, "SupportAssistiveTechnology",
- NULL, &dwType, Data, &cbData) )
+ nullptr, &dwType, Data, &cbData) )
{
switch (dwType)
{
case REG_SZ:
RegSetValueEx(hkey, "SupportAssistiveTechnology",
0, dwType,
- bEnable ? (sal_uInt8 *) "true" : (sal_uInt8 *) "false",
+ reinterpret_cast<sal_uInt8 const *>(bEnable ? "true" : "false"),
bEnable ? sizeof("true") : sizeof("false"));
break;
case REG_DWORD:
- ((DWORD *) Data)[0] = bEnable ? 1 : 0;
+ reinterpret_cast<DWORD *>(Data)[0] = bEnable ? 1 : 0;
RegSetValueEx(hkey, "SupportAssistiveTechnology",
0, dwType, Data, sizeof(DWORD));
break;
@@ -2538,8 +2538,8 @@ void MiscSettings::SetEnableATToolSupport( bool bEnable )
}
vcl::SettingsConfigItem::get()->
- setValue( OUString( "Accessibility" ),
- OUString( "EnableATToolSupport" ),
+ setValue( "Accessibility",
+ "EnableATToolSupport",
bEnable ? OUString("true") : OUString("false" ) );
mxData->mnEnableATT = bEnable ? TRISTATE_TRUE : TRISTATE_FALSE;
}
diff --git a/vcl/source/app/svdata.cxx b/vcl/source/app/svdata.cxx
index 74fd791ca193..81b70aada41a 100644
--- a/vcl/source/app/svdata.cxx
+++ b/vcl/source/app/svdata.cxx
@@ -256,10 +256,6 @@ BlendFrameCache* ImplGetBlendFrameCache()
}
#ifdef _WIN32
-bool HasAtHook();
-#endif
-
-#ifdef _WIN32
bool ImplInitAccessBridge()
{
ImplSVData* pSVData = ImplGetSVData();
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 0a4ef69b4850..2012764b18c2 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -609,14 +609,14 @@ struct WorkerThreadData
};
#ifdef _WIN32
-static HANDLE hThreadID = 0;
-static unsigned __stdcall _threadmain( void *pArgs )
+static HANDLE hThreadID = nullptr;
+static unsigned __stdcall threadmain( void *pArgs )
{
OleInitialize( nullptr );
static_cast<WorkerThreadData*>(pArgs)->pWorker( static_cast<WorkerThreadData*>(pArgs)->pThreadData );
delete static_cast<WorkerThreadData*>(pArgs);
OleUninitialize();
- hThreadID = 0;
+ hThreadID = nullptr;
return 0;
}
#else
@@ -638,13 +638,13 @@ void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData )
// sal thread always call CoInitializeEx, so a system dependent implementation is necessary
unsigned uThreadID;
- hThreadID = (HANDLE)_beginthreadex(
- NULL, // no security handle
+ hThreadID = reinterpret_cast<HANDLE>(_beginthreadex(
+ nullptr, // no security handle
0, // stacksize 0 means default
- _threadmain, // thread worker function
+ threadmain, // thread worker function
new WorkerThreadData( pWorker, pThreadData ), // arguments for worker function
0, // 0 means: create immediately otherwise use CREATE_SUSPENDED
- &uThreadID ); // thread id to fill
+ &uThreadID )); // thread id to fill
#else
hThreadID = osl_createThread( MainWorkerFunction, new WorkerThreadData( pWorker, pThreadData ) );
#endif
diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx
index d13b2e0b41b1..3745f041b5dd 100644
--- a/vcl/source/font/fontselect.cxx
+++ b/vcl/source/font/fontselect.cxx
@@ -91,7 +91,7 @@ FontSelectPattern::FontSelectPattern( const PhysicalFontFace& rFontData,
const Size& rSize, float fExactHeight, int nOrientation, bool bVertical )
: FontSelectPatternAttributes(rFontData, rSize, fExactHeight, nOrientation, bVertical)
, mpFontData( &rFontData )
- , mpFontInstance( NULL )
+ , mpFontInstance( nullptr )
{
}
#endif
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index f5919ee2b57b..3beb73cd3354 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7144,7 +7144,7 @@ bool PDFWriterImpl::finalizeSignature()
}
PCCERT_CONTEXT pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, reinterpret_cast<const BYTE*>(n_derArray), n_derLength);
- if (pCertContext == NULL)
+ if (pCertContext == nullptr)
{
SAL_WARN("vcl.pdfwriter", "CertCreateCertificateContext failed: " << WindowsErrorString(GetLastError()));
return false;
@@ -7167,7 +7167,7 @@ bool PDFWriterImpl::finalizeSignature()
if (!CryptAcquireCertificatePrivateKey(pCertContext,
CRYPT_ACQUIRE_CACHE_FLAG,
- NULL,
+ nullptr,
&hCryptProv,
&nKeySpec,
&bFreeNeeded))
@@ -7207,16 +7207,16 @@ bool PDFWriterImpl::finalizeSignature()
CMSG_DETACHED_FLAG,
CMSG_SIGNED,
&aSignedInfo,
- NULL,
- NULL)))
+ nullptr,
+ nullptr)))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgOpenToEncode failed: " << WindowsErrorString(GetLastError()));
CertFreeCertificateContext(pCertContext);
return false;
}
- if (!CryptMsgUpdate(hMsg, (const BYTE *)buffer1.get(), bytesRead1, FALSE) ||
- !CryptMsgUpdate(hMsg, (const BYTE *)buffer2.get(), bytesRead2, TRUE))
+ if (!CryptMsgUpdate(hMsg, reinterpret_cast<const BYTE *>(buffer1.get()), bytesRead1, FALSE) ||
+ !CryptMsgUpdate(hMsg, reinterpret_cast<const BYTE *>(buffer2.get()), bytesRead2, TRUE))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgUpdate failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hMsg);
@@ -7224,11 +7224,11 @@ bool PDFWriterImpl::finalizeSignature()
return false;
}
- PCRYPT_TIMESTAMP_CONTEXT pTsContext = NULL;
+ PCRYPT_TIMESTAMP_CONTEXT pTsContext = nullptr;
if( !m_aContext.SignTSA.isEmpty() )
{
- PointerTo_CryptRetrieveTimeStamp crts = (PointerTo_CryptRetrieveTimeStamp) GetProcAddress(LoadLibrary("crypt32.dll"), "CryptRetrieveTimeStamp");
+ PointerTo_CryptRetrieveTimeStamp crts = reinterpret_cast<PointerTo_CryptRetrieveTimeStamp>(GetProcAddress(LoadLibrary("crypt32.dll"), "CryptRetrieveTimeStamp"));
if (!crts)
{
SAL_WARN("vcl.pdfwriter", "Could not find the CryptRetrieveTimeStamp function in crypt32.dll: " << WindowsErrorString(GetLastError()));
@@ -7242,8 +7242,8 @@ bool PDFWriterImpl::finalizeSignature()
CMSG_DETACHED_FLAG,
CMSG_SIGNED,
NULL,
- NULL,
- NULL)))
+ nullptr,
+ nullptr)))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgOpenToDecode failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hMsg);
@@ -7253,7 +7253,7 @@ bool PDFWriterImpl::finalizeSignature()
DWORD nTsSigLen = 0;
- if (!CryptMsgGetParam(hMsg, CMSG_BARE_CONTENT_PARAM, 0, NULL, &nTsSigLen))
+ if (!CryptMsgGetParam(hMsg, CMSG_BARE_CONTENT_PARAM, 0, nullptr, &nTsSigLen))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgGetParam(CMSG_BARE_CONTENT_PARAM) failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hDecodedMsg);
@@ -7285,7 +7285,7 @@ bool PDFWriterImpl::finalizeSignature()
}
DWORD nDecodedSignerInfoLen = 0;
- if (!CryptMsgGetParam(hDecodedMsg, CMSG_SIGNER_INFO_PARAM, 0, NULL, &nDecodedSignerInfoLen))
+ if (!CryptMsgGetParam(hDecodedMsg, CMSG_SIGNER_INFO_PARAM, 0, nullptr, &nDecodedSignerInfoLen))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgGetParam(CMSG_SIGNER_INFO_PARAM) failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hDecodedMsg);
@@ -7305,17 +7305,17 @@ bool PDFWriterImpl::finalizeSignature()
return false;
}
- CMSG_SIGNER_INFO *pDecodedSignerInfo = (CMSG_SIGNER_INFO *) pDecodedSignerInfoBuf.get();
+ CMSG_SIGNER_INFO *pDecodedSignerInfo = reinterpret_cast<CMSG_SIGNER_INFO *>(pDecodedSignerInfoBuf.get());
CRYPT_TIMESTAMP_PARA aTsPara;
unsigned int nNonce = comphelper::rng::uniform_uint_distribution(0, SAL_MAX_UINT32);
- aTsPara.pszTSAPolicyId = NULL;
+ aTsPara.pszTSAPolicyId = nullptr;
aTsPara.fRequestCerts = TRUE;
aTsPara.Nonce.cbData = sizeof(nNonce);
- aTsPara.Nonce.pbData = (BYTE *)&nNonce;
+ aTsPara.Nonce.pbData = reinterpret_cast<BYTE *>(&nNonce);
aTsPara.cExtension = 0;
- aTsPara.rgExtension = NULL;
+ aTsPara.rgExtension = nullptr;
if (!(*crts)(m_aContext.SignTSA.getStr(),
0,
@@ -7325,8 +7325,8 @@ bool PDFWriterImpl::finalizeSignature()
pDecodedSignerInfo->EncryptedHash.pbData,
pDecodedSignerInfo->EncryptedHash.cbData,
&pTsContext,
- NULL,
- NULL))
+ nullptr,
+ nullptr))
{
SAL_WARN("vcl.pdfwriter", "CryptRetrieveTimeStamp failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hDecodedMsg);
@@ -7370,10 +7370,10 @@ bool PDFWriterImpl::finalizeSignature()
CMSG_DETACHED_FLAG,
CMSG_SIGNED,
&aSignedInfo,
- NULL,
- NULL)) ||
- !CryptMsgUpdate(hMsg, (const BYTE *)buffer1.get(), bytesRead1, FALSE) ||
- !CryptMsgUpdate(hMsg, (const BYTE *)buffer2.get(), bytesRead2, TRUE))
+ nullptr,
+ nullptr)) ||
+ !CryptMsgUpdate(hMsg, reinterpret_cast<const BYTE *>(buffer1.get()), bytesRead1, FALSE) ||
+ !CryptMsgUpdate(hMsg, reinterpret_cast<const BYTE *>(buffer2.get()), bytesRead2, TRUE))
{
SAL_WARN("vcl.pdfwriter", "Re-creating the message failed: " << WindowsErrorString(GetLastError()));
CryptMemFree(pTsContext);
@@ -7388,7 +7388,7 @@ bool PDFWriterImpl::finalizeSignature()
DWORD nSigLen = 0;
- if (!CryptMsgGetParam(hMsg, CMSG_CONTENT_PARAM, 0, NULL, &nSigLen))
+ if (!CryptMsgGetParam(hMsg, CMSG_CONTENT_PARAM, 0, nullptr, &nSigLen))
{
SAL_WARN("vcl.pdfwriter", "CryptMsgGetParam(CMSG_CONTENT_PARAM) failed: " << WindowsErrorString(GetLastError()));
if (pTsContext)
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 0ac14181e319..24cb4a77d059 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -5622,15 +5622,15 @@ void ToolBox::ImplDisableFlatButtons()
DWORD cbData = sizeof(Data);
if( ERROR_SUCCESS == RegQueryValueEx(hkey, "DisableFlatToolboxButtons",
- NULL, &dwType, Data, &cbData) )
+ nullptr, &dwType, Data, &cbData) )
{
switch (dwType)
{
case REG_SZ:
- bValue = ((0 == stricmp((const char *) Data, "1")) || (0 == stricmp((const char *) Data, "true")));
+ bValue = ((0 == stricmp(reinterpret_cast<const char *>(Data), "1")) || (0 == stricmp(reinterpret_cast<const char *>(Data), "true")));
break;
case REG_DWORD:
- bValue = (bool)(((DWORD *) Data)[0]);
+ bValue = (bool)(reinterpret_cast<DWORD *>(Data)[0]);
break;
}
}
diff --git a/vcl/win/app/salinfo.cxx b/vcl/win/app/salinfo.cxx
index 8b70632963cf..15a71e3177d9 100644
--- a/vcl/win/app/salinfo.cxx
+++ b/vcl/win/app/salinfo.cxx
@@ -104,7 +104,7 @@ bool WinSalSystem::initMonitors()
aDev.cb = sizeof( aDev );
DWORD nDevice = 0;
std::unordered_map< OUString, int, OUStringHash > aDeviceStringCount;
- while( EnumDisplayDevicesW( NULL, nDevice++, &aDev, 0 ) )
+ while( EnumDisplayDevicesW( nullptr, nDevice++, &aDev, 0 ) )
{
if( (aDev.StateFlags & DISPLAY_DEVICE_ACTIVE)
&& !(aDev.StateFlags & DISPLAY_DEVICE_MIRRORING_DRIVER) ) // sort out non/disabled monitors
@@ -122,8 +122,8 @@ bool WinSalSystem::initMonitors()
Rectangle() ) );
}
}
- HDC aDesktopRC = GetDC( NULL );
- EnumDisplayMonitors( aDesktopRC, NULL, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) );
+ HDC aDesktopRC = GetDC( nullptr );
+ EnumDisplayMonitors( aDesktopRC, nullptr, ImplEnumMonitorProc, reinterpret_cast<LPARAM>(this) );
// append monitor numbers to name strings
std::unordered_map< OUString, int, OUStringHash > aDevCount( aDeviceStringCount );
@@ -136,7 +136,7 @@ bool WinSalSystem::initMonitors()
int nInstance = aDeviceStringCount[ rDev ] - (-- aDevCount[ rDev ] );
OUStringBuffer aBuf( rDev.getLength() + 8 );
aBuf.append( rDev );
- aBuf.appendAscii( " (" );
+ aBuf.append( " (" );
aBuf.append( sal_Int32( nInstance ) );
aBuf.append( ')' );
m_aMonitors[ i ].m_aName = aBuf.makeStringAndClear();
@@ -171,7 +171,7 @@ int WinSalSystem::ShowNativeMessageBox(const OUString& rTitle, const OUString& r
ImplHideSplash();
return MessageBoxW(
- 0,
+ nullptr,
reinterpret_cast<LPCWSTR>(rMessage.getStr()),
reinterpret_cast<LPCWSTR>(rTitle.getStr()),
nFlags);
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index de58bd9c63aa..cee4e5419d92 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -95,13 +95,13 @@ void SalAbort( const OUString& rErrorText, bool )
if ( rErrorText.isEmpty() )
{
// make sure crash reporter is triggered
- RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, NULL );
+ RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
FatalAppExitW( 0, L"Application Error" );
}
else
{
// make sure crash reporter is triggered
- RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, NULL );
+ RaiseException( 0, EXCEPTION_NONCONTINUABLE, 0, nullptr );
FatalAppExitW( 0, reinterpret_cast<LPCWSTR>(rErrorText.getStr()) );
}
}
@@ -120,9 +120,9 @@ public: // for ImplSalYield() and ImplSalYieldMutexAcquireWithWait()
public:
explicit SalYieldMutex( WinSalInstance* pInstData );
- virtual void acquire();
- virtual void release();
- virtual bool tryToAcquire();
+ virtual void acquire() override;
+ virtual void release() override;
+ virtual bool tryToAcquire() override;
sal_uLong GetAcquireCount( sal_uLong nThreadId );
};
@@ -322,41 +322,41 @@ void SalData::initKeyCodeMap()
SalData::SalData()
{
- mhInst = 0; // default instance handle
+ mhInst = nullptr; // default instance handle
mnCmdShow = 0; // default frame show style
- mhDitherPal = 0; // dither palette
- mhDitherDIB = 0; // dither memory handle
- mpDitherDIB = 0; // dither memory
- mpDitherDIBData = 0; // beginning of DIB data
- mpDitherDiff = 0; // Dither mapping table
- mpDitherLow = 0; // Dither mapping table
- mpDitherHigh = 0; // Dither mapping table
+ mhDitherPal = nullptr; // dither palette
+ mhDitherDIB = nullptr; // dither memory handle
+ mpDitherDIB = nullptr; // dither memory
+ mpDitherDIBData = nullptr; // beginning of DIB data
+ mpDitherDiff = nullptr; // Dither mapping table
+ mpDitherLow = nullptr; // Dither mapping table
+ mpDitherHigh = nullptr; // Dither mapping table
mnTimerMS = 0; // Current Time (in MS) of the Timer
mnTimerOrgMS = 0; // Current Original Time (in MS)
mnNextTimerTime = 0;
mnLastEventTime = 0;
- mnTimerId = 0; // windows timer id
- mhSalObjMsgHook = 0; // hook to get interesting msg for SalObject
- mhWantLeaveMsg = 0; // window handle, that want a MOUSELEAVE message
- mpMouseLeaveTimer = 0; // Timer for MouseLeave Test
- mpFirstInstance = 0; // pointer of first instance
- mpFirstFrame = 0; // pointer of first frame
- mpFirstObject = 0; // pointer of first object window
- mpFirstVD = 0; // first VirDev
- mpFirstPrinter = 0; // first printing printer
- mpHDCCache = 0; // Cache for three DC's
- mh50Bmp = 0; // 50% Bitmap
- mh50Brush = 0; // 50% Brush
+ mnTimerId = nullptr; // windows timer id
+ mhSalObjMsgHook = nullptr; // hook to get interesting msg for SalObject
+ mhWantLeaveMsg = nullptr; // window handle, that want a MOUSELEAVE message
+ mpMouseLeaveTimer = nullptr; // Timer for MouseLeave Test
+ mpFirstInstance = nullptr; // pointer of first instance
+ mpFirstFrame = nullptr; // pointer of first frame
+ mpFirstObject = nullptr; // pointer of first object window
+ mpFirstVD = nullptr; // first VirDev
+ mpFirstPrinter = nullptr; // first printing printer
+ mpHDCCache = nullptr; // Cache for three DC's
+ mh50Bmp = nullptr; // 50% Bitmap
+ mh50Brush = nullptr; // 50% Brush
int i;
for(i=0; i<MAX_STOCKPEN; i++)
{
maStockPenColorAry[i] = 0;
- mhStockPenAry[i] = 0;
+ mhStockPenAry[i] = nullptr;
}
for(i=0; i<MAX_STOCKBRUSH; i++)
{
maStockBrushColorAry[i] = 0;
- mhStockBrushAry[i] = 0;
+ mhStockBrushAry[i] = nullptr;
}
mnStockPenCount = 0; // count of static pens
mnStockBrushCount = 0; // count of static brushes
@@ -366,8 +366,8 @@ SalData::SalData()
mbInPalChange = false; // is in WM_QUERYNEWPALETTE
mnAppThreadId = 0; // Id from Applikation-Thread
mbScrSvrEnabled = FALSE; // ScreenSaver enabled
- mpFirstIcon = 0; // icon cache, points to first icon, NULL if none
- mpTempFontItem = 0;
+ mpFirstIcon = nullptr; // icon cache, points to first icon, NULL if none
+ mpTempFontItem = nullptr;
mbThemeChanged = false; // true if visual theme was changed: throw away theme handles
mbThemeMenuSupport = false;
@@ -383,17 +383,17 @@ SalData::SalData()
SalData::~SalData()
{
deInitNWF();
- SetSalData( NULL );
+ SetSalData( nullptr );
}
void InitSalData()
{
SalData* pSalData = new SalData;
- CoInitialize(0); // put main thread in Single Threaded Apartment (STA)
+ CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA)
// init GDIPlus
static Gdiplus::GdiplusStartupInput gdiplusStartupInput;
- Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL);
+ Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, nullptr);
}
void DeInitSalData()
@@ -419,7 +419,7 @@ void InitSalMain()
STARTUPINFO aSI;
aSI.cb = sizeof( aSI );
GetStartupInfo( &aSI );
- pData->mhInst = GetModuleHandle( NULL );
+ pData->mhInst = GetModuleHandle( nullptr );
pData->mnCmdShow = aSI.wShowWindow;
}
}
@@ -467,40 +467,40 @@ SalInstance* CreateSalInstance()
aWndClassEx.cbClsExtra = 0;
aWndClassEx.cbWndExtra = SAL_FRAME_WNDEXTRA;
aWndClassEx.hInstance = pSalData->mhInst;
- aWndClassEx.hCursor = 0;
- aWndClassEx.hbrBackground = 0;
- aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.hCursor = nullptr;
+ aWndClassEx.hbrBackground = nullptr;
+ aWndClassEx.lpszMenuName = nullptr;
aWndClassEx.lpszClassName = SAL_FRAME_CLASSNAMEW;
ImplLoadSalIcon( SAL_RESID_ICON_DEFAULT, aWndClassEx.hIcon, aWndClassEx.hIconSm );
if ( !RegisterClassExW( &aWndClassEx ) )
- return NULL;
+ return nullptr;
- aWndClassEx.hIcon = 0;
- aWndClassEx.hIconSm = 0;
+ aWndClassEx.hIcon = nullptr;
+ aWndClassEx.hIconSm = nullptr;
aWndClassEx.style |= CS_SAVEBITS;
aWndClassEx.lpszClassName = SAL_SUBFRAME_CLASSNAMEW;
if ( !RegisterClassExW( &aWndClassEx ) )
- return NULL;
+ return nullptr;
// shadow effect for popups on XP
if( aSalShlData.mbWXP )
aWndClassEx.style |= CS_DROPSHADOW;
aWndClassEx.lpszClassName = SAL_TMPSUBFRAME_CLASSNAMEW;
if ( !RegisterClassExW( &aWndClassEx ) )
- return NULL;
+ return nullptr;
aWndClassEx.style = 0;
aWndClassEx.lpfnWndProc = SalComWndProcW;
aWndClassEx.cbWndExtra = 0;
aWndClassEx.lpszClassName = SAL_COM_CLASSNAMEW;
if ( !RegisterClassExW( &aWndClassEx ) )
- return NULL;
+ return nullptr;
HWND hComWnd = CreateWindowExW( WS_EX_TOOLWINDOW, SAL_COM_CLASSNAMEW,
- L"", WS_POPUP, 0, 0, 0, 0, 0, 0,
- pSalData->mhInst, NULL );
+ L"", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr,
+ pSalData->mhInst, nullptr );
if ( !hComWnd )
- return NULL;
+ return nullptr;
WinSalInstance* pInst = new WinSalInstance;
@@ -525,14 +525,14 @@ void DestroySalInstance( SalInstance* pInst )
// reset instance
if ( pSalData->mpFirstInstance == pInst )
- pSalData->mpFirstInstance = NULL;
+ pSalData->mpFirstInstance = nullptr;
delete pInst;
}
WinSalInstance::WinSalInstance()
{
- mhComWnd = 0;
+ mhComWnd = nullptr;
mpSalYieldMutex = new SalYieldMutex( this );
mpSalYieldMutex->acquire();
::comphelper::SolarMutex::setSolarMutex( mpSalYieldMutex );
@@ -540,7 +540,7 @@ WinSalInstance::WinSalInstance()
WinSalInstance::~WinSalInstance()
{
- ::comphelper::SolarMutex::setSolarMutex( 0 );
+ ::comphelper::SolarMutex::setSolarMutex( nullptr );
mpSalYieldMutex->release();
delete mpSalYieldMutex;
DestroyWindow( mhComWnd );
@@ -583,7 +583,7 @@ ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
int nMaxEvents = bHandleAllCurrentEvents ? 100 : 1;
do
{
- if ( PeekMessageW( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &aMsg );
ImplSalDispatchMessage( &aMsg );
@@ -596,7 +596,7 @@ ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
if ( bWait && ! bWasMsg )
{
- if ( GetMessageW( &aMsg, 0, 0, 0 ) )
+ if ( GetMessageW( &aMsg, nullptr, 0, 0 ) )
{
TranslateMessage( &aMsg );
ImplSalDispatchMessage( &aMsg );
@@ -675,7 +675,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
rDef = FALSE;
break;
case SAL_MSG_STARTTIMER:
- ImplSalStartTimer( (sal_uLong) lParam, FALSE );
+ ImplSalStartTimer( (sal_uLong) lParam );
rDef = FALSE;
break;
case SAL_MSG_STOPTIMER:
@@ -683,47 +683,47 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
rDef = FALSE;
break;
case SAL_MSG_CREATEFRAME:
- nRet = (LRESULT)ImplSalCreateFrame( GetSalData()->mpFirstInstance, (HWND)lParam, (SalFrameStyleFlags)wParam );
+ nRet = reinterpret_cast<LRESULT>(ImplSalCreateFrame( GetSalData()->mpFirstInstance, reinterpret_cast<HWND>(lParam), (SalFrameStyleFlags)wParam ));
rDef = FALSE;
break;
case SAL_MSG_RECREATEHWND:
- nRet = (LRESULT)ImplSalReCreateHWND( (HWND)wParam, (HWND)lParam, FALSE );
+ nRet = reinterpret_cast<LRESULT>(ImplSalReCreateHWND( reinterpret_cast<HWND>(wParam), reinterpret_cast<HWND>(lParam), false ));
rDef = FALSE;
break;
case SAL_MSG_RECREATECHILDHWND:
- nRet = (LRESULT)ImplSalReCreateHWND( (HWND)wParam, (HWND)lParam, TRUE );
+ nRet = reinterpret_cast<LRESULT>(ImplSalReCreateHWND( reinterpret_cast<HWND>(wParam), reinterpret_cast<HWND>(lParam), true ));
rDef = FALSE;
break;
case SAL_MSG_DESTROYFRAME:
- delete (SalFrame*)lParam;
+ delete reinterpret_cast<SalFrame*>(lParam);
rDef = FALSE;
break;
case SAL_MSG_DESTROYHWND:
//We only destroy the native window here. We do NOT destroy the SalFrame contained
//in the structure (GetWindowPtr()).
- if (DestroyWindow((HWND)lParam) == 0)
+ if (DestroyWindow(reinterpret_cast<HWND>(lParam)) == 0)
{
OSL_FAIL("DestroyWindow failed!");
//Failure: We remove the SalFrame from the window structure. So we avoid that
// the window structure may contain an invalid pointer, once the SalFrame is deleted.
- SetWindowPtr((HWND)lParam, 0);
+ SetWindowPtr(reinterpret_cast<HWND>(lParam), nullptr);
}
rDef = FALSE;
break;
case SAL_MSG_CREATEOBJECT:
- nRet = (LRESULT)ImplSalCreateObject( GetSalData()->mpFirstInstance, (WinSalFrame*)lParam );
+ nRet = reinterpret_cast<LRESULT>(ImplSalCreateObject( GetSalData()->mpFirstInstance, reinterpret_cast<WinSalFrame*>(lParam) ));
rDef = FALSE;
break;
case SAL_MSG_DESTROYOBJECT:
- delete (SalObject*)lParam;
+ delete reinterpret_cast<SalObject*>(lParam);
rDef = FALSE;
break;
case SAL_MSG_GETDC:
- nRet = (LRESULT)GetDCEx( (HWND)wParam, 0, DCX_CACHE );
+ nRet = reinterpret_cast<LRESULT>(GetDCEx( reinterpret_cast<HWND>(wParam), nullptr, DCX_CACHE ));
rDef = FALSE;
break;
case SAL_MSG_RELEASEDC:
- ReleaseDC( (HWND)wParam, (HDC)lParam );
+ ReleaseDC( reinterpret_cast<HWND>(wParam), reinterpret_cast<HDC>(lParam) );
rDef = FALSE;
break;
case SAL_MSG_POSTTIMER:
@@ -732,7 +732,7 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
case SAL_MSG_TIMER_CALLBACK:
EmitTimerCallback();
MSG aMsg;
- while (PeekMessageW(&aMsg, 0, SAL_MSG_TIMER_CALLBACK, SAL_MSG_TIMER_CALLBACK, PM_REMOVE))
+ while (PeekMessageW(&aMsg, nullptr, SAL_MSG_TIMER_CALLBACK, SAL_MSG_TIMER_CALLBACK, PM_REMOVE))
{
// nothing; just remove all the SAL_MSG_TIMER_CALLBACKs that
// accumulated in the queue during the EmitTimerCallback(),
@@ -788,7 +788,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
{
// revert bugfix for #108919# which never reported timeouts when called from the timer handler
// which made the application completely unresponsive during background formatting
- if ( PeekMessageW( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
return true;
}
else
@@ -796,7 +796,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
if ( nType & VclInputFlags::MOUSE )
{
// Test for mouse input
- if ( PeekMessageW( &aMsg, 0, WM_MOUSEFIRST, WM_MOUSELAST,
+ if ( PeekMessageW( &aMsg, nullptr, WM_MOUSEFIRST, WM_MOUSELAST,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
}
@@ -804,7 +804,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
if ( nType & VclInputFlags::KEYBOARD )
{
// Test for key input
- if ( PeekMessageW( &aMsg, 0, WM_KEYDOWN, WM_KEYDOWN,
+ if ( PeekMessageW( &aMsg, nullptr, WM_KEYDOWN, WM_KEYDOWN,
PM_NOREMOVE | PM_NOYIELD ) )
{
if ( (aMsg.wParam == VK_SHIFT) ||
@@ -819,23 +819,23 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
if ( nType & VclInputFlags::PAINT )
{
// Test for paint input
- if ( PeekMessageW( &aMsg, 0, WM_PAINT, WM_PAINT,
+ if ( PeekMessageW( &aMsg, nullptr, WM_PAINT, WM_PAINT,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
- if ( PeekMessageW( &aMsg, 0, WM_SIZE, WM_SIZE,
+ if ( PeekMessageW( &aMsg, nullptr, WM_SIZE, WM_SIZE,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
- if ( PeekMessageW( &aMsg, 0, SAL_MSG_POSTCALLSIZE, SAL_MSG_POSTCALLSIZE,
+ if ( PeekMessageW( &aMsg, nullptr, SAL_MSG_POSTCALLSIZE, SAL_MSG_POSTCALLSIZE,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
- if ( PeekMessageW( &aMsg, 0, WM_MOVE, WM_MOVE,
+ if ( PeekMessageW( &aMsg, nullptr, WM_MOVE, WM_MOVE,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
- if ( PeekMessageW( &aMsg, 0, SAL_MSG_POSTMOVE, SAL_MSG_POSTMOVE,
+ if ( PeekMessageW( &aMsg, nullptr, SAL_MSG_POSTMOVE, SAL_MSG_POSTMOVE,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
}
@@ -843,7 +843,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
if ( nType & VclInputFlags::TIMER )
{
// Test for timer input
- if ( PeekMessageW( &aMsg, 0, WM_TIMER, WM_TIMER,
+ if ( PeekMessageW( &aMsg, nullptr, WM_TIMER, WM_TIMER,
PM_NOREMOVE | PM_NOYIELD ) )
return true;
@@ -852,7 +852,7 @@ bool WinSalInstance::AnyInput( VclInputFlags nType )
if ( nType & VclInputFlags::OTHER )
{
// Test for any input
- if ( PeekMessageW( &aMsg, 0, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
+ if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_NOREMOVE | PM_NOYIELD ) )
return true;
}
}
@@ -875,13 +875,13 @@ void SalTimer::Start( sal_uLong nMS )
SendMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
}
else
- ImplSalStartTimer( nMS, FALSE );
+ ImplSalStartTimer( nMS );
}
SalFrame* WinSalInstance::CreateChildFrame( SystemParentData* pSystemParentData, SalFrameStyleFlags nSalFrameStyle )
{
// to switch to Main-Thread
- return (SalFrame*)(sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), (LPARAM)pSystemParentData->hWnd );
+ return reinterpret_cast<SalFrame*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(pSystemParentData->hWnd) ));
}
SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nSalFrameStyle )
@@ -891,14 +891,14 @@ SalFrame* WinSalInstance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nSa
if ( pParent )
hWndParent = static_cast<WinSalFrame*>(pParent)->mhWnd;
else
- hWndParent = 0;
- return (SalFrame*)(sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), (LPARAM)hWndParent );
+ hWndParent = nullptr;
+ return reinterpret_cast<SalFrame*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEFRAME, static_cast<WPARAM>(nSalFrameStyle), reinterpret_cast<LPARAM>(hWndParent) ));
}
void WinSalInstance::DestroyFrame( SalFrame* pFrame )
{
OpenGLContext::prepareForYield();
- SendMessageW( mhComWnd, SAL_MSG_DESTROYFRAME, 0, (LPARAM)pFrame );
+ SendMessageW( mhComWnd, SAL_MSG_DESTROYFRAME, 0, reinterpret_cast<LPARAM>(pFrame) );
}
SalObject* WinSalInstance::CreateObject( SalFrame* pParent,
@@ -906,12 +906,12 @@ SalObject* WinSalInstance::CreateObject( SalFrame* pParent,
bool /*bShow*/ )
{
// to switch to Main-Thread
- return (SalObject*)(sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEOBJECT, 0, (LPARAM)static_cast<WinSalFrame*>(pParent) );
+ return reinterpret_cast<SalObject*>((sal_IntPtr)SendMessageW( mhComWnd, SAL_MSG_CREATEOBJECT, 0, reinterpret_cast<LPARAM>(static_cast<WinSalFrame*>(pParent)) ));
}
void WinSalInstance::DestroyObject( SalObject* pObject )
{
- SendMessageW( mhComWnd, SAL_MSG_DESTROYOBJECT, 0, (LPARAM)pObject );
+ SendMessageW( mhComWnd, SAL_MSG_DESTROYOBJECT, 0, reinterpret_cast<LPARAM>(pObject) );
}
void* WinSalInstance::GetConnectionIdentifier( ConnectionIdentifierType& rReturnedType, int& rReturnedBytes )
@@ -941,14 +941,14 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
{
typedef HRESULT ( WINAPI *SHCREATEITEMFROMPARSINGNAME )( PCWSTR, IBindCtx*, REFIID, void **ppv );
SHCREATEITEMFROMPARSINGNAME pSHCreateItemFromParsingName =
- ( SHCREATEITEMFROMPARSINGNAME )GetProcAddress(
- GetModuleHandleW (L"shell32.dll"), "SHCreateItemFromParsingName" );
+ reinterpret_cast<SHCREATEITEMFROMPARSINGNAME>(GetProcAddress(
+ GetModuleHandleW (L"shell32.dll"), "SHCreateItemFromParsingName" ));
if( pSHCreateItemFromParsingName )
{
- IShellItem* pShellItem = NULL;
+ IShellItem* pShellItem = nullptr;
- HRESULT hr = pSHCreateItemFromParsingName ( (PCWSTR) system_path.getStr(), NULL, IID_PPV_ARGS(&pShellItem) );
+ HRESULT hr = pSHCreateItemFromParsingName ( system_path.getStr(), nullptr, IID_PPV_ARGS(&pShellItem) );
if ( SUCCEEDED(hr) && pShellItem )
{
@@ -993,7 +993,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
DummyShardAppIDInfo info;
info.psi = pShellItem;
- info.pszAppID = (PCWSTR) sApplicationID.getStr();
+ info.pszAppID = sApplicationID.getStr();
SHAddToRecentDocs ( SHARD_APPIDINFO, &info );
return;
@@ -1002,7 +1002,7 @@ void WinSalInstance::AddToRecentDocumentList(const OUString& rFileUrl, const OUS
}
}
// For whatever reason, we could not use the SHARD_APPIDINFO semantics
- SHAddToRecentDocs(SHARD_PATHW, (PCWSTR) system_path.getStr());
+ SHAddToRecentDocs(SHARD_PATHW, system_path.getStr());
}
}
@@ -1027,7 +1027,7 @@ const OUString& SalGetDesktopEnvironment()
SalSession* WinSalInstance::CreateSalSession()
{
- return NULL;
+ return nullptr;
}
#if !defined ( __MINGW32__ ) || defined ( _WIN64 )
diff --git a/vcl/win/app/salshl.cxx b/vcl/win/app/salshl.cxx
index d2213efd61a1..3c3c7103aa53 100644
--- a/vcl/win/app/salshl.cxx
+++ b/vcl/win/app/salshl.cxx
@@ -68,35 +68,35 @@ bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon )
{
rIcon = pSalIcon->hIcon;
rSmallIcon = pSalIcon->hSmallIcon;
- return (rSmallIcon != 0);
+ return (rSmallIcon != nullptr);
}
}
// Try at first to load the icons from the application exe file
- rIcon = (HICON)LoadImage( pSalData->mhInst, MAKEINTRESOURCE( nId ),
+ rIcon = static_cast<HICON>(LoadImage( pSalData->mhInst, MAKEINTRESOURCE( nId ),
IMAGE_ICON, GetSystemMetrics( SM_CXICON ), GetSystemMetrics( SM_CYICON ),
- LR_DEFAULTCOLOR );
+ LR_DEFAULTCOLOR ));
if ( !rIcon )
{
// If the application don't provide these icons, then we try
// to load the icon from the VCL resource
- rIcon = (HICON)LoadImage( aSalShlData.mhInst, MAKEINTRESOURCE( nId ),
+ rIcon = static_cast<HICON>(LoadImage( aSalShlData.mhInst, MAKEINTRESOURCE( nId ),
IMAGE_ICON, GetSystemMetrics( SM_CXICON ), GetSystemMetrics( SM_CYICON ),
- LR_DEFAULTCOLOR );
+ LR_DEFAULTCOLOR ));
if ( rIcon )
{
- rSmallIcon = (HICON)LoadImage( aSalShlData.mhInst, MAKEINTRESOURCE( nId ),
+ rSmallIcon = static_cast<HICON>(LoadImage( aSalShlData.mhInst, MAKEINTRESOURCE( nId ),
IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
- LR_DEFAULTCOLOR );
+ LR_DEFAULTCOLOR ));
}
else
- rSmallIcon = 0;
+ rSmallIcon = nullptr;
}
else
{
- rSmallIcon = (HICON)LoadImage( pSalData->mhInst, MAKEINTRESOURCE( nId ),
+ rSmallIcon = static_cast<HICON>(LoadImage( pSalData->mhInst, MAKEINTRESOURCE( nId ),
IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ),
- LR_DEFAULTCOLOR );
+ LR_DEFAULTCOLOR ));
}
if( rIcon )
@@ -110,7 +110,7 @@ bool ImplLoadSalIcon( int nId, HICON& rIcon, HICON& rSmallIcon )
pSalData->mpFirstIcon = pSalIcon;
}
- return (rSmallIcon != 0);
+ return (rSmallIcon != nullptr);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index ff230c2c2c61..7930ac9e0b6c 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -44,13 +44,13 @@ void ImplSalStopTimer()
HANDLE hTimer = pSalData->mnTimerId;
if (hTimer)
{
- pSalData->mnTimerId = 0; // reset so it doesn't restart
- DeleteTimerQueueTimer(NULL, hTimer, INVALID_HANDLE_VALUE);
+ pSalData->mnTimerId = nullptr; // reset so it doesn't restart
+ DeleteTimerQueueTimer(nullptr, hTimer, INVALID_HANDLE_VALUE);
pSalData->mnNextTimerTime = 0;
}
MSG aMsg;
// this needs to run on the main thread
- while (PeekMessageW(&aMsg, 0, SAL_MSG_TIMER_CALLBACK, SAL_MSG_TIMER_CALLBACK, PM_REMOVE))
+ while (PeekMessageW(&aMsg, nullptr, SAL_MSG_TIMER_CALLBACK, SAL_MSG_TIMER_CALLBACK, PM_REMOVE))
{
// just remove all the SAL_MSG_TIMER_CALLBACKs
// when the application end, this SAL_MSG_TIMER_CALLBACK start the timer again
@@ -74,10 +74,10 @@ void ImplSalStartTimer( sal_uLong nMS, bool bMutex )
// cannot change a one-shot timer, so delete it and create new one
if (pSalData->mnTimerId)
{
- DeleteTimerQueueTimer(NULL, pSalData->mnTimerId, INVALID_HANDLE_VALUE);
- pSalData->mnTimerId = 0;
+ DeleteTimerQueueTimer(nullptr, pSalData->mnTimerId, INVALID_HANDLE_VALUE);
+ pSalData->mnTimerId = nullptr;
}
- CreateTimerQueueTimer(&pSalData->mnTimerId, NULL, SalTimerProc, NULL, nMS, 0, WT_EXECUTEINTIMERTHREAD);
+ CreateTimerQueueTimer(&pSalData->mnTimerId, nullptr, SalTimerProc, nullptr, nMS, 0, WT_EXECUTEINTIMERTHREAD);
pSalData->mnNextTimerTime = pSalData->mnLastEventTime + nMS;
}
@@ -101,7 +101,7 @@ void WinSalTimer::Start( sal_uLong nMS )
SendMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS );
}
else
- ImplSalStartTimer( nMS, FALSE );
+ ImplSalStartTimer( nMS );
}
void WinSalTimer::Stop()
@@ -178,7 +178,7 @@ void EmitTimerCallback()
// with a small timeout, because we didn't get the mutex
// - but not if mnTimerId is 0, which is set by ImplSalStopTimer()
if (pSalData->mnTimerId)
- ImplSalStartTimer(pSalData->mnTimerOrgMS, false);
+ ImplSalStartTimer(pSalData->mnTimerOrgMS);
}
else
{
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 996822259d01..82c03ff2fe44 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -83,7 +83,7 @@ void ImplRenderPath( HDC hdc, sal_uLong nPoints, const SalPoint* pPtAry, const B
// a) look ahead and draw consecutive bezier or line segments by PolyBezierTo/PolyLineTo resp.
// b) convert our flag array to window's and use PolyDraw
- MoveToEx( hdc, pPtAry->mnX, pPtAry->mnY, NULL );
+ MoveToEx( hdc, pPtAry->mnX, pPtAry->mnY, nullptr );
++pPtAry; ++pFlgAry;
for( i=1; i<nPoints; ++i, ++pPtAry, ++pFlgAry )
@@ -264,11 +264,11 @@ WinSalGraphicsImpl::WinSalGraphicsImpl(WinSalGraphics& rParent):
mrParent(rParent),
mbXORMode(false),
mbPen(false),
- mhPen(0),
+ mhPen(nullptr),
mbStockPen(false),
mbBrush(false),
mbStockBrush(false),
- mhBrush(0)
+ mhBrush(nullptr)
{
}
@@ -387,9 +387,9 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY,
bool bWindowInvalidate )
{
bool bRestoreClipRgn = false;
- HRGN hOldClipRgn = 0;
+ HRGN hOldClipRgn = nullptr;
int nOldClipRgnType = ERROR;
- HRGN hInvalidateRgn = 0;
+ HRGN hInvalidateRgn = nullptr;
// do we have to invalidate also the overlapping regions?
if ( bWindowInvalidate && mrParent.isWindow() )
@@ -421,15 +421,15 @@ void WinSalGraphicsImpl::copyArea( long nDestX, long nDestY,
aSrcRect.top += aPt.y;
aSrcRect.right += aPt.x;
aSrcRect.bottom += aPt.y;
- hInvalidateRgn = 0;
+ hInvalidateRgn = nullptr;
// compute the parts that are off screen (ie invisible)
RECT theScreen;
- ImplSalGetWorkArea( NULL, &theScreen, NULL ); // find the screen area taking multiple monitors into account
+ ImplSalGetWorkArea( nullptr, &theScreen, nullptr ); // find the screen area taking multiple monitors into account
ImplCalcOutSideRgn( aSrcRect, theScreen.left, theScreen.top, theScreen.right, theScreen.bottom, hInvalidateRgn );
// calculate regions that are covered by other windows
- HRGN hTempRgn2 = 0;
+ HRGN hTempRgn2 = nullptr;
HWND hWndTopWindow = mrParent.gethWnd();
// Find the TopLevel Window, because only Windows which are in
// in the foreground of our TopLevel window must be considered
@@ -584,7 +584,7 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
{
HGLOBAL hDrawDIB;
HBITMAP hDrawDDB = rSalBitmap.ImplGethDDB();
- WinSalBitmap* pTmpSalBmp = NULL;
+ WinSalBitmap* pTmpSalBmp = nullptr;
bool bPrintDDB = ( bPrinter && hDrawDDB );
if( bPrintDDB )
@@ -598,16 +598,15 @@ void ImplDrawBitmap( HDC hDC, const SalTwoRect& rPosAry, const WinSalBitmap& rSa
if( hDrawDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDrawDIB );
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
- PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
- rSalBitmap.ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD );
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( hDrawDIB ));
+ PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize +
+ WinSalBitmap::ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD );
const int nOldStretchMode = SetStretchBltMode( hDC, STRETCH_DELETESCANS );
StretchDIBits( hDC,
(int)rPosAry.mnDestX, (int)rPosAry.mnDestY,
(int)rPosAry.mnDestWidth, (int)rPosAry.mnDestHeight,
- (int)rPosAry.mnSrcX, (int)(pBIH->biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY),
+ (int)rPosAry.mnSrcX, (int)(pBI->bmiHeader.biHeight - rPosAry.mnSrcHeight - rPosAry.mnSrcY),
(int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight,
pBits, pBI, DIB_RGB_COLORS, nDrawMode );
@@ -739,8 +738,8 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
int nDstWidth = (int)aPosAry.mnDestWidth;
int nDstHeight = (int)aPosAry.mnDestHeight;
HDC hDC = mrParent.getHDC();
- HBITMAP hMemBitmap = 0;
- HBITMAP hMaskBitmap = 0;
+ HBITMAP hMemBitmap = nullptr;
+ HBITMAP hMaskBitmap = nullptr;
if( ( nDstWidth > CACHED_HDC_DEFEXT ) || ( nDstHeight > CACHED_HDC_DEFEXT ) )
{
@@ -761,17 +760,17 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
WinSalBitmap aTmp;
if( aTmp.Create( rTransparentBitmap, &mrParent ) )
- ImplDrawBitmap( hMaskDC, aPosAry, aTmp, FALSE, SRCCOPY );
+ ImplDrawBitmap( hMaskDC, aPosAry, aTmp, false, SRCCOPY );
}
else
- ImplDrawBitmap( hMaskDC, aPosAry, rTransparentBitmap, FALSE, SRCCOPY );
+ ImplDrawBitmap( hMaskDC, aPosAry, rTransparentBitmap, false, SRCCOPY );
// now MemDC contains background, MaskDC the transparency mask
// #105055# Respect XOR mode
if( mbXORMode )
{
- ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE );
+ ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, false, SRCERASE );
// now MaskDC contains the bitmap area with black background
BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCINVERT );
// now MemDC contains background XORed bitmap area ontop
@@ -780,7 +779,7 @@ void WinSalGraphicsImpl::drawBitmap( const SalTwoRect& rPosAry,
{
BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCAND );
// now MemDC contains background with masked-out bitmap area
- ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, FALSE, SRCERASE );
+ ImplDrawBitmap( hMaskDC, aPosAry, rSalBitmap, false, SRCERASE );
// now MaskDC contains the bitmap area with black background
BitBlt( hMemDC, 0, 0, nDstWidth, nDstHeight, hMaskDC, 0, 0, SRCPAINT );
// now MemDC contains background and bitmap merged together
@@ -805,7 +804,7 @@ bool WinSalGraphicsImpl::drawAlphaRect( long nX, long nY, long nWidth,
if( mbPen || !mbBrush || mbXORMode )
return false; // can only perform solid fills without XOR.
- HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1, 0 );
+ HDC hMemDC = ImplGetCachedDC( CACHED_HDC_1 );
SetPixel( hMemDC, (int)0, (int)0, mnBrushColor );
BLENDFUNCTION aFunc = {
@@ -851,10 +850,10 @@ void WinSalGraphicsImpl::drawMask( const SalTwoRect& rPosAry,
WinSalBitmap aTmp;
if( aTmp.Create( rSalBitmap, &mrParent ) )
- ImplDrawBitmap( hDC, aPosAry, aTmp, FALSE, 0x00B8074AUL );
+ ImplDrawBitmap( hDC, aPosAry, aTmp, false, 0x00B8074AUL );
}
else
- ImplDrawBitmap( hDC, aPosAry, rSalBitmap, FALSE, 0x00B8074AUL );
+ ImplDrawBitmap( hDC, aPosAry, rSalBitmap, false, 0x00B8074AUL );
SelectBrush( hDC, hOldBrush );
DeleteBrush( hMaskBrush );
@@ -864,7 +863,7 @@ SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY )
{
SAL_WARN_IF( mrParent.isPrinter(), "vcl", "No ::GetBitmap() from printer possible!" );
- WinSalBitmap* pSalBitmap = NULL;
+ WinSalBitmap* pSalBitmap = nullptr;
nDX = labs( nDX );
nDY = labs( nDY );
@@ -884,7 +883,7 @@ SalBitmap* WinSalGraphicsImpl::getBitmap( long nX, long nY, long nDX, long nDY )
if( !pSalBitmap->Create( hBmpBitmap, FALSE, FALSE ) )
{
delete pSalBitmap;
- pSalBitmap = NULL;
+ pSalBitmap = nullptr;
}
}
else
@@ -956,7 +955,7 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal
HPEN hPen;
HPEN hOldPen;
HBRUSH hBrush;
- HBRUSH hOldBrush = 0;
+ HBRUSH hOldBrush = nullptr;
COLORREF nOldTextColor RGB(0,0,0);
int nOldROP = SetROP2( mrParent.getHDC(), R2_NOT );
@@ -986,11 +985,11 @@ void WinSalGraphicsImpl::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, Sal
}
hOldPen = SelectPen( mrParent.getHDC(), hPen );
- POINT* pWinPtAry;
+ POINT const * pWinPtAry;
// for NT, we can handover the array directly
static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
- pWinPtAry = (POINT*)pPtAry;
+ pWinPtAry = reinterpret_cast<POINT const *>(pPtAry);
// for Windows 95 and its maximum number of points
if ( nSalFlags & SalInvert::TrackFrame )
{
@@ -1047,10 +1046,10 @@ void WinSalGraphicsImpl::ResetClipRegion()
if ( mrParent.mhRegion )
{
DeleteRegion( mrParent.mhRegion );
- mrParent.mhRegion = 0;
+ mrParent.mhRegion = nullptr;
}
- SelectClipRgn( mrParent.getHDC(), 0 );
+ SelectClipRgn( mrParent.getHDC(), nullptr );
}
static bool containsOnlyHorizontalAndVerticalEdges(const basegfx::B2DPolygon& rCandidate)
@@ -1109,7 +1108,7 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
if ( mrParent.mhRegion )
{
DeleteRegion( mrParent.mhRegion );
- mrParent.mhRegion = 0;
+ mrParent.mhRegion = nullptr;
}
bool bUsePolygon(i_rClip.HasPolyPolygonOrB2DPolyPolygon());
@@ -1222,18 +1221,18 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
if ( aRectangles.size() < SAL_CLIPRECT_COUNT )
{
if ( !mrParent.mpStdClipRgnData )
- mrParent.mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ mrParent.mpStdClipRgnData = reinterpret_cast<RGNDATA*>(new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]);
mrParent.mpClipRgnData = mrParent.mpStdClipRgnData;
}
else
- mrParent.mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ mrParent.mpClipRgnData = reinterpret_cast<RGNDATA*>(new BYTE[sizeof(RGNDATA)-1+nRectBufSize]);
mrParent.mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
mrParent.mpClipRgnData->rdh.iType = RDH_RECTANGLES;
mrParent.mpClipRgnData->rdh.nCount = aRectangles.size();
mrParent.mpClipRgnData->rdh.nRgnSize = nRectBufSize;
RECT* pBoundRect = &(mrParent.mpClipRgnData->rdh.rcBound);
SetRectEmpty( pBoundRect );
- RECT* pNextClipRect = (RECT*)(&(mrParent.mpClipRgnData->Buffer));
+ RECT* pNextClipRect = reinterpret_cast<RECT*>(&(mrParent.mpClipRgnData->Buffer));
bool bFirstClipRect = true;
for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
@@ -1306,20 +1305,20 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
else if(mrParent.mpClipRgnData->rdh.nCount > 1)
{
sal_uLong nSize = mrParent.mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
- mrParent.mhRegion = ExtCreateRegion( NULL, nSize, mrParent.mpClipRgnData );
+ mrParent.mhRegion = ExtCreateRegion( nullptr, nSize, mrParent.mpClipRgnData );
// if ExtCreateRegion(...) is not supported
if( !mrParent.mhRegion )
{
- RGNDATAHEADER* pHeader = (RGNDATAHEADER*) mrParent.mpClipRgnData;
+ RGNDATAHEADER const & pHeader = mrParent.mpClipRgnData->rdh;
- if( pHeader->nCount )
+ if( pHeader.nCount )
{
- RECT* pRect = (RECT*) mrParent.mpClipRgnData->Buffer;
+ RECT* pRect = reinterpret_cast<RECT*>(mrParent.mpClipRgnData->Buffer);
mrParent.mhRegion = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
pRect++;
- for( sal_uLong n = 1; n < pHeader->nCount; n++, pRect++ )
+ for( sal_uLong n = 1; n < pHeader.nCount; n++, pRect++ )
{
HRGN hRgn = CreateRectRgn( pRect->left, pRect->top, pRect->right, pRect->bottom );
CombineRgn( mrParent.mhRegion, mrParent.mhRegion, hRgn, RGN_OR );
@@ -1329,7 +1328,7 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
}
if ( mrParent.mpClipRgnData != mrParent.mpStdClipRgnData )
- delete [] (BYTE*)mrParent.mpClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mrParent.mpClipRgnData);
}
}
@@ -1346,7 +1345,7 @@ bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
else
{
// #i123585# See above, this is a valid case, execute it
- SelectClipRgn( mrParent.getHDC(), 0 );
+ SelectClipRgn( mrParent.getHDC(), nullptr );
}
// #i123585# retval no longer dependent of mrParent.mhRegion, see TaskId comments above
@@ -1380,7 +1379,7 @@ void WinSalGraphicsImpl::SetLineColor( SalColor nSalColor )
COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ),
SALCOLOR_GREEN( nSalColor ),
SALCOLOR_BLUE( nSalColor ) );
- HPEN hNewPen = 0;
+ HPEN hNewPen = nullptr;
bool bStockPen = FALSE;
// search for stock pen (only screen, because printer have problems,
@@ -1460,7 +1459,7 @@ void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor )
BYTE nGreen = SALCOLOR_GREEN( nSalColor );
BYTE nBlue = SALCOLOR_BLUE( nSalColor );
COLORREF nBrushColor = PALETTERGB( nRed, nGreen, nBlue );
- HBRUSH hNewBrush = 0;
+ HBRUSH hNewBrush = nullptr;
bool bStockBrush = FALSE;
// search for stock brush (only screen, because printer have problems,
@@ -1485,7 +1484,7 @@ void WinSalGraphicsImpl::SetFillColor( SalColor nSalColor )
hNewBrush = CreateSolidBrush( nBrushColor );
else
{
- if ( 24 == ((BITMAPINFOHEADER*)pSalData->mpDitherDIB)->biBitCount )
+ if ( 24 == reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB)->biBitCount )
{
BYTE* pTmp = pSalData->mpDitherDIBData;
long* pDitherDiff = pSalData->mpDitherDiff;
@@ -1610,7 +1609,7 @@ void WinSalGraphicsImpl::drawPixel( long nX, long nY, SalColor nSalColor )
void WinSalGraphicsImpl::drawLine( long nX1, long nY1, long nX2, long nY2 )
{
- MoveToEx( mrParent.getHDC(), (int)nX1, (int)nY1, NULL );
+ MoveToEx( mrParent.getHDC(), (int)nX1, (int)nY1, nullptr );
// we must paint the endpoint
int bPaintEnd = TRUE;
@@ -1676,7 +1675,7 @@ void WinSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAr
// for NT, we can handover the array directly
static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
- POINT* pWinPtAry = (POINT*)pPtAry;
+ POINT* pWinPtAry = reinterpret_cast<POINT*>(const_cast<SalPoint *>(pPtAry));
// we assume there are at least 2 points (Polyline requires at least 2 point, see MSDN)
// we must paint the endpoint for last line
@@ -1722,7 +1721,7 @@ void WinSalGraphicsImpl::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry
// for NT, we can handover the array directly
static_assert( sizeof( POINT ) == sizeof( SalPoint ), "must be the same size" );
- POINT* pWinPtAry = (POINT*)pPtAry;
+ POINT const * pWinPtAry = reinterpret_cast<POINT const *>(pPtAry);
// for Windows 95 and its maximum number of points
if ( !Polygon( mrParent.getHDC(), pWinPtAry, (int)nPoints ) && (nPoints > MAX_64KSALPOINTS) )
Polygon( mrParent.getHDC(), pWinPtAry, MAX_64KSALPOINTS );
@@ -1767,7 +1766,7 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP
n += nPoints;
}
- if ( !PolyPolygon( mrParent.getHDC(), pWinPointAryAry, (int*)pWinPointAry, (UINT)nPoly ) &&
+ if ( !PolyPolygon( mrParent.getHDC(), pWinPointAryAry, reinterpret_cast<int*>(pWinPointAry), (UINT)nPoly ) &&
(nPolyPolyPoints > MAX_64KSALPOINTS) )
{
nPolyPolyPoints = 0;
@@ -1784,7 +1783,7 @@ void WinSalGraphicsImpl::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pP
if ( nPoly == 1 )
Polygon( mrParent.getHDC(), pWinPointAryAry, *pWinPointAry );
else
- PolyPolygon( mrParent.getHDC(), pWinPointAryAry, (int*)pWinPointAry, nPoly );
+ PolyPolygon( mrParent.getHDC(), pWinPointAryAry, reinterpret_cast<int*>(pWinPointAry), nPoly );
}
if ( pWinPointAry != aWinPointAry )
@@ -2151,17 +2150,15 @@ void paintToGdiPlus(
Gdiplus::REAL(rTR.mnSrcWidth),
Gdiplus::REAL(rTR.mnSrcHeight),
Gdiplus::UnitPixel,
- &aAttributes,
- 0,
- 0);
+ &aAttributes);
}
void setInterpolationMode(
Gdiplus::Graphics& rGraphics,
- const long& rSrcWidth,
- const long& rDestWidth,
- const long& rSrcHeight,
- const long& rDestHeight)
+ long rSrcWidth,
+ long rDestWidth,
+ long rSrcHeight,
+ long rDestHeight)
{
const bool bSameWidth(rSrcWidth == rDestWidth);
const bool bSameHeight(rSrcHeight == rDestHeight);
@@ -2330,9 +2327,7 @@ bool WinSalGraphicsImpl::drawTransformedBitmap(
Gdiplus::REAL(nSrcWidth),
Gdiplus::REAL(nSrcHeight),
Gdiplus::UnitPixel,
- &aAttributes,
- 0,
- 0);
+ &aAttributes);
}
}
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index aa105394060c..f8f0ae4b1991 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -51,7 +51,7 @@ public:
explicit WinSalGraphicsImpl(WinSalGraphics& rParent);
- virtual ~WinSalGraphicsImpl();
+ virtual ~WinSalGraphicsImpl() override;
virtual void Init() override;
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index 67b1a1ccbb51..73d3d78362bf 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -87,7 +87,7 @@ public:
Stop();
}
- ~GdiPlusBuffer()
+ ~GdiPlusBuffer() override
{
Stop();
}
@@ -136,7 +136,7 @@ public:
}
// from parent Timer
- virtual void Invoke()
+ virtual void Invoke() override
{
::osl::MutexGuard aGuard(m_aMutex);
EntryMap::iterator aIter(maEntries.begin());
@@ -165,7 +165,7 @@ public:
if(pSource->maGdiPlusBitmap.get())
{
pSource->maGdiPlusBitmap.reset();
- pSource->mpAssociatedAlpha = 0;
+ pSource->mpAssociatedAlpha = nullptr;
}
}
}
@@ -185,10 +185,10 @@ static GdiPlusBuffer aGdiPlusBuffer;
WinSalBitmap::WinSalBitmap()
: maSize(),
- mhDIB(0),
- mhDDB(0),
+ mhDIB(nullptr),
+ mhDDB(nullptr),
maGdiPlusBitmap(),
- mpAssociatedAlpha(0),
+ mpAssociatedAlpha(nullptr),
mnBitCount(0)
{
}
@@ -242,7 +242,7 @@ std::shared_ptr< Gdiplus::Bitmap > WinSalBitmap::ImplGetGdiPlusBitmap(const WinS
else
{
pThat->maGdiPlusBitmap.reset(pThat->ImplCreateGdiPlusBitmap());
- pThat->mpAssociatedAlpha = 0;
+ pThat->mpAssociatedAlpha = nullptr;
}
if(maGdiPlusBitmap.get())
@@ -257,9 +257,9 @@ std::shared_ptr< Gdiplus::Bitmap > WinSalBitmap::ImplGetGdiPlusBitmap(const WinS
Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
{
- Gdiplus::Bitmap* pRetval(0);
- WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this);
- WinSalBitmap* pExtraWinSalRGB = 0;
+ Gdiplus::Bitmap* pRetval(nullptr);
+ WinSalBitmap* pSalRGB = this;
+ WinSalBitmap* pExtraWinSalRGB = nullptr;
if(!pSalRGB->ImplGethDIB())
{
@@ -270,7 +270,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
}
BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraRGB = 0;
+ BitmapBuffer* pExtraRGB = nullptr;
if(pRGB && ScanlineFormat::N24BitTcBgr != (pRGB->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -279,8 +279,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
pExtraRGB = StretchAndConvert(
*pRGB,
aSalTwoRect,
- ScanlineFormat::N24BitTcBgr,
- 0);
+ ScanlineFormat::N24BitTcBgr);
pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Write);
pRGB = pExtraRGB;
@@ -309,7 +308,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
- sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
+ sal_uInt8* targetPixels = static_cast<sal_uInt8*>(aGdiPlusBitmapData.Scan0) + (nYInsert * aGdiPlusBitmapData.Stride);
memcpy(targetPixels, pSrcRGB, nW * 3);
pSrcRGB += nW * 3 + nExtraRGB;
@@ -320,7 +319,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
else
{
delete pRetval;
- pRetval = NULL;
+ pRetval = nullptr;
}
}
@@ -346,9 +345,9 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap()
Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource)
{
- Gdiplus::Bitmap* pRetval(0);
- WinSalBitmap* pSalRGB = const_cast< WinSalBitmap* >(this);
- WinSalBitmap* pExtraWinSalRGB = 0;
+ Gdiplus::Bitmap* pRetval(nullptr);
+ WinSalBitmap* pSalRGB = this;
+ WinSalBitmap* pExtraWinSalRGB = nullptr;
if(!pSalRGB->ImplGethDIB())
{
@@ -359,7 +358,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
}
BitmapBuffer* pRGB = pSalRGB->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraRGB = 0;
+ BitmapBuffer* pExtraRGB = nullptr;
if(pRGB && ScanlineFormat::N24BitTcBgr != (pRGB->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -368,15 +367,14 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
pExtraRGB = StretchAndConvert(
*pRGB,
aSalTwoRect,
- ScanlineFormat::N24BitTcBgr,
- 0);
+ ScanlineFormat::N24BitTcBgr);
pSalRGB->ReleaseBuffer(pRGB, BitmapAccessMode::Read);
pRGB = pExtraRGB;
}
WinSalBitmap* pSalA = const_cast< WinSalBitmap* >(&rAlphaSource);
- WinSalBitmap* pExtraWinSalA = 0;
+ WinSalBitmap* pExtraWinSalA = nullptr;
if(!pSalA->ImplGethDIB())
{
@@ -387,7 +385,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
}
BitmapBuffer* pA = pSalA->AcquireBuffer(BitmapAccessMode::Read);
- BitmapBuffer* pExtraA = 0;
+ BitmapBuffer* pExtraA = nullptr;
if(pA && ScanlineFormat::N8BitPal != (pA->mnFormat & ~ScanlineFormat::TopDown))
{
@@ -436,7 +434,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
- sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
+ sal_uInt8* targetPixels = static_cast<sal_uInt8*>(aGdiPlusBitmapData.Scan0) + (nYInsert * aGdiPlusBitmapData.Stride);
for(sal_uInt32 x(0); x < nW; x++)
{
@@ -455,7 +453,7 @@ Gdiplus::Bitmap* WinSalBitmap::ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlph
else
{
delete pRetval;
- pRetval = NULL;
+ pRetval = nullptr;
}
}
@@ -501,13 +499,13 @@ bool WinSalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle )
bool bRet = TRUE;
if( bDIB )
- mhDIB = (HGLOBAL) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, TRUE ) : hBitmap );
+ mhDIB = static_cast<HGLOBAL>( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, true ) : hBitmap );
else
- mhDDB = (HBITMAP) ( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, FALSE ) : hBitmap );
+ mhDDB = static_cast<HBITMAP>( bCopyHandle ? ImplCopyDIBOrDDB( hBitmap, false ) : hBitmap );
if( mhDIB )
{
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) GlobalLock( mhDIB );
+ PBITMAPINFOHEADER pBIH = static_cast<PBITMAPINFOHEADER>(GlobalLock( mhDIB ));
maSize = Size( pBIH->biWidth, pBIH->biHeight );
mnBitCount = pBIH->biBitCount;
@@ -535,7 +533,7 @@ bool WinSalBitmap::Create( HANDLE hBitmap, bool bDIB, bool bCopyHandle )
}
else
{
- mhDDB = 0;
+ mhDDB = nullptr;
bRet = FALSE;
}
}
@@ -569,14 +567,14 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBitmap )
if ( rSalBitmap.mhDIB || rSalBitmap.mhDDB )
{
HANDLE hNewHdl = ImplCopyDIBOrDDB( rSalBitmap.mhDIB ? rSalBitmap.mhDIB : rSalBitmap.mhDDB,
- rSalBitmap.mhDIB != 0 );
+ rSalBitmap.mhDIB != nullptr );
if ( hNewHdl )
{
if( rSalBitmap.mhDIB )
- mhDIB = (HGLOBAL) hNewHdl;
+ mhDIB = static_cast<HGLOBAL>(hNewHdl);
else if( rSalBitmap.mhDDB )
- mhDDB = (HBITMAP) hNewHdl;
+ mhDDB = static_cast<HBITMAP>(hNewHdl);
maSize = rSalBitmap.maSize;
mnBitCount = rSalBitmap.mnBitCount;
@@ -597,23 +595,22 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, SalGraphics* pSGraphics )
if( rSalBmp.mhDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( rSalBmp.mhDIB );
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( rSalBmp.mhDIB ));
HDC hDC = pGraphics->getHDC();
HBITMAP hNewDDB;
BITMAP aDDBInfo;
- PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize +
ImplGetDIBColorCount( rSalBmp.mhDIB ) * sizeof( RGBQUAD );
- if( pBIH->biBitCount == 1 )
+ if( pBI->bmiHeader.biBitCount == 1 )
{
- hNewDDB = CreateBitmap( pBIH->biWidth, pBIH->biHeight, 1, 1, NULL );
+ hNewDDB = CreateBitmap( pBI->bmiHeader.biWidth, pBI->bmiHeader.biHeight, 1, 1, nullptr );
if( hNewDDB )
- SetDIBits( hDC, hNewDDB, 0, pBIH->biHeight, pBits, pBI, DIB_RGB_COLORS );
+ SetDIBits( hDC, hNewDDB, 0, pBI->bmiHeader.biHeight, pBits, pBI, DIB_RGB_COLORS );
}
else
- hNewDDB = CreateDIBitmap( hDC, (PBITMAPINFOHEADER) pBI, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
+ hNewDDB = CreateDIBitmap( hDC, &pBI->bmiHeader, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
GlobalUnlock( rSalBmp.mhDIB );
@@ -644,13 +641,13 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount )
if( mhDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( mhDIB ));
const int nLines = (int) rSalBmp.maSize.Height();
- HDC hDC = GetDC( 0 );
- PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
+ HDC hDC = GetDC( nullptr );
+ PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize +
ImplGetDIBColorCount( mhDIB ) * sizeof( RGBQUAD );
SalData* pSalData = GetSalData();
- HPALETTE hOldPal = 0;
+ HPALETTE hOldPal = nullptr;
if ( pSalData->mhDitherPal )
{
@@ -669,13 +666,13 @@ bool WinSalBitmap::Create( const SalBitmap& rSSalBmp, sal_uInt16 nNewBitCount )
{
GlobalUnlock( mhDIB );
GlobalFree( mhDIB );
- mhDIB = 0;
+ mhDIB = nullptr;
}
if( hOldPal )
SelectPalette( hDC, hOldPal, TRUE );
- ReleaseDC( 0, hDC );
+ ReleaseDC( nullptr, hDC );
}
}
@@ -707,21 +704,20 @@ sal_uInt16 WinSalBitmap::ImplGetDIBColorCount( HGLOBAL hDIB )
if( hDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDIB );
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( hDIB ));
- if ( pBIH->biSize != sizeof( BITMAPCOREHEADER ) )
+ if ( pBI->bmiHeader.biSize != sizeof( BITMAPCOREHEADER ) )
{
- if( pBIH->biBitCount <= 8 )
+ if( pBI->bmiHeader.biBitCount <= 8 )
{
- if ( pBIH->biClrUsed )
- nColors = (sal_uInt16) pBIH->biClrUsed;
+ if ( pBI->bmiHeader.biClrUsed )
+ nColors = (sal_uInt16) pBI->bmiHeader.biClrUsed;
else
- nColors = 1 << pBIH->biBitCount;
+ nColors = 1 << pBI->bmiHeader.biBitCount;
}
}
- else if( ( (PBITMAPCOREHEADER) pBI )->bcBitCount <= 8 )
- nColors = 1 << ( (PBITMAPCOREHEADER) pBI )->bcBitCount;
+ else if( reinterpret_cast<PBITMAPCOREHEADER>(pBI)->bcBitCount <= 8 )
+ nColors = 1 << reinterpret_cast<PBITMAPCOREHEADER>(pBI)->bcBitCount;
GlobalUnlock( hDIB );
}
@@ -733,7 +729,7 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBits, const
{
SAL_WARN_IF( nBits != 1 && nBits != 4 && nBits != 8 && nBits != 16 && nBits != 24, "vcl", "Unsupported BitCount!" );
- HGLOBAL hDIB = 0;
+ HGLOBAL hDIB = nullptr;
if( rSize.Width() <= 0 || rSize.Height() <= 0 )
return hDIB;
@@ -786,15 +782,15 @@ HGLOBAL WinSalBitmap::ImplCreateDIB( const Size& rSize, sal_uInt16 nBits, const
HANDLE WinSalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB )
{
- HANDLE hCopy = 0;
+ HANDLE hCopy = nullptr;
if ( bDIB && hHdl )
{
const sal_uLong nSize = GlobalSize( hHdl );
- if ( (hCopy = GlobalAlloc( GHND, nSize )) != 0 )
+ if ( (hCopy = GlobalAlloc( GHND, nSize )) != nullptr )
{
- memcpy( (LPSTR) GlobalLock( hCopy ), (LPSTR) GlobalLock( hHdl ), nSize );
+ memcpy( GlobalLock( hCopy ), GlobalLock( hHdl ), nSize );
GlobalUnlock( hCopy );
GlobalUnlock( hHdl );
@@ -805,15 +801,15 @@ HANDLE WinSalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB )
BITMAP aBmp;
// find out size of source bitmap
- GetObjectA( hHdl, sizeof( BITMAP ), (LPSTR) &aBmp );
+ GetObjectA( hHdl, sizeof( BITMAP ), &aBmp );
// create destination bitmap
- if ( (hCopy = CreateBitmapIndirect( &aBmp )) != 0 )
+ if ( (hCopy = CreateBitmapIndirect( &aBmp )) != nullptr )
{
- HDC hBmpDC = CreateCompatibleDC( 0 );
- HBITMAP hBmpOld = (HBITMAP) SelectObject( hBmpDC, hHdl );
+ HDC hBmpDC = CreateCompatibleDC( nullptr );
+ HBITMAP hBmpOld = static_cast<HBITMAP>(SelectObject( hBmpDC, hHdl ));
HDC hCopyDC = CreateCompatibleDC( hBmpDC );
- HBITMAP hCopyOld = (HBITMAP) SelectObject( hCopyDC, hCopy );
+ HBITMAP hCopyOld = static_cast<HBITMAP>(SelectObject( hCopyDC, hCopy ));
BitBlt( hCopyDC, 0, 0, aBmp.bmWidth, aBmp.bmHeight, hBmpDC, 0, 0, SRCCOPY );
@@ -830,12 +826,12 @@ HANDLE WinSalBitmap::ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB )
BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
{
- BitmapBuffer* pBuffer = NULL;
+ BitmapBuffer* pBuffer = nullptr;
if( mhDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( mhDIB ));
+ PBITMAPINFOHEADER pBIH = &pBI->bmiHeader;
if( ( pBIH->biCompression == BI_RLE4 ) || ( pBIH->biCompression == BI_RLE8 ) )
{
@@ -844,12 +840,12 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
if( hNewDIB )
{
- PBITMAPINFO pNewBI = (PBITMAPINFO) GlobalLock( hNewDIB );
- PBITMAPINFOHEADER pNewBIH = (PBITMAPINFOHEADER) pNewBI;
+ PBITMAPINFO pNewBI = static_cast<PBITMAPINFO>(GlobalLock( hNewDIB ));
+ PBITMAPINFOHEADER pNewBIH = &pNewBI->bmiHeader;
const sal_uInt16 nColorCount = ImplGetDIBColorCount( hNewDIB );
- const sal_uLong nOffset = *(DWORD*) pBI + nColorCount * sizeof( RGBQUAD );
- BYTE* pOldBits = (PBYTE) pBI + nOffset;
- BYTE* pNewBits = (PBYTE) pNewBI + nOffset;
+ const sal_uLong nOffset = pBI->bmiHeader.biSize + nColorCount * sizeof( RGBQUAD );
+ BYTE* pOldBits = reinterpret_cast<PBYTE>(pBI) + nOffset;
+ BYTE* pNewBits = reinterpret_cast<PBYTE>(pNewBI) + nOffset;
memcpy( pNewBI, pBI, nOffset );
pNewBIH->biCompression = 0;
@@ -888,7 +884,7 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
pBuffer->maPalette.SetEntryCount( nPalCount );
memcpy( pBuffer->maPalette.ImplGetColorBuffer(), pBI->bmiColors, nPalCount * sizeof( RGBQUAD ) );
- pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nPalCount * sizeof( RGBQUAD );
+ pBuffer->mpBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize + nPalCount * sizeof( RGBQUAD );
}
else if( ( pBIH->biBitCount == 16 ) || ( pBIH->biBitCount == 32 ) )
{
@@ -897,11 +893,11 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
if( pBIH->biCompression == BI_BITFIELDS )
{
nOffset = 3 * sizeof( RGBQUAD );
- ColorMaskElement aRedMask(*(UINT32*) &pBI->bmiColors[ 0 ]);
+ ColorMaskElement aRedMask(*reinterpret_cast<UINT32*>(&pBI->bmiColors[ 0 ]));
aRedMask.CalcMaskShift();
- ColorMaskElement aGreenMask(*(UINT32*) &pBI->bmiColors[ 1 ]);
+ ColorMaskElement aGreenMask(*reinterpret_cast<UINT32*>(&pBI->bmiColors[ 1 ]));
aGreenMask.CalcMaskShift();
- ColorMaskElement aBlueMask(*(UINT32*) &pBI->bmiColors[ 2 ]);
+ ColorMaskElement aBlueMask(*reinterpret_cast<UINT32*>(&pBI->bmiColors[ 2 ]));
aBlueMask.CalcMaskShift();
pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
}
@@ -926,16 +922,16 @@ BitmapBuffer* WinSalBitmap::AcquireBuffer( BitmapAccessMode /*nMode*/ )
pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask);
}
- pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI + nOffset;
+ pBuffer->mpBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize + nOffset;
}
else
- pBuffer->mpBits = (PBYTE) pBI + *(DWORD*) pBI;
+ pBuffer->mpBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize;
}
else
{
GlobalUnlock( mhDIB );
delete pBuffer;
- pBuffer = NULL;
+ pBuffer = nullptr;
}
}
else
@@ -953,7 +949,7 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode
{
if( nMode == BitmapAccessMode::Write && !!pBuffer->maPalette )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( mhDIB );
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( mhDIB ));
const sal_uInt16 nCount = pBuffer->maPalette.GetEntryCount();
const sal_uInt16 nDIBColorCount = ImplGetDIBColorCount( mhDIB );
memcpy( pBI->bmiColors, pBuffer->maPalette.ImplGetColorBuffer(), (std::min)( nDIBColorCount, nCount ) * sizeof( RGBQUAD ) );
@@ -970,9 +966,9 @@ void WinSalBitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode
void WinSalBitmap::ImplDecodeRLEBuffer( const BYTE* pSrcBuf, BYTE* pDstBuf,
const Size& rSizePixel, bool bRLE4 )
{
- sal_uInt8* pRLE = (sal_uInt8*) pSrcBuf;
- sal_uInt8* pDIB = (sal_uInt8*) pDstBuf;
- sal_uInt8* pRow = (sal_uInt8*) pDstBuf;
+ sal_uInt8 const * pRLE = pSrcBuf;
+ sal_uInt8* pDIB = pDstBuf;
+ sal_uInt8* pRow = pDstBuf;
sal_uLong nWidthAl = AlignedWidth4Bytes( rSizePixel.Width() * ( bRLE4 ? 4UL : 8UL ) );
sal_uInt8* pLast = pDIB + rSizePixel.Height() * nWidthAl - 1;
sal_uLong nCountByte;
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index b76102176969..8d97f4060d3a 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -60,7 +60,7 @@ static const int MAXFONTHEIGHT = 2048;
inline FIXED FixedFromDouble( double d )
{
const long l = (long) ( d * 65536. );
- return *(FIXED*) &l;
+ return *reinterpret_cast<FIXED const *>(&l);
}
inline int IntTimes256FromFixed(FIXED f)
@@ -80,7 +80,7 @@ public:
explicit RawFontData( HDC, DWORD nTableTag=0 );
~RawFontData() { delete[] mpRawBytes; }
const unsigned char* get() const { return mpRawBytes; }
- const unsigned char* steal() { unsigned char* p = mpRawBytes; mpRawBytes = NULL; return p; }
+ const unsigned char* steal() { unsigned char* p = mpRawBytes; mpRawBytes = nullptr; return p; }
int size() const { return mnByteCount; }
private:
@@ -89,11 +89,11 @@ private:
};
RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
-: mpRawBytes( NULL )
+: mpRawBytes( nullptr )
, mnByteCount( 0 )
{
// get required size in bytes
- mnByteCount = ::GetFontData( hDC, nTableTag, 0, NULL, 0 );
+ mnByteCount = ::GetFontData( hDC, nTableTag, 0, nullptr, 0 );
if( mnByteCount == GDI_ERROR )
return;
else if( !mnByteCount )
@@ -115,7 +115,7 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
if( nFDGet > nMaxChunkSize )
nFDGet = nMaxChunkSize;
const DWORD nFDGot = ::GetFontData( hDC, nTableTag, nRawDataOfs,
- (void*)(mpRawBytes + nRawDataOfs), nFDGet );
+ mpRawBytes + nRawDataOfs, nFDGet );
if( !nFDGot )
break;
else if( nFDGot != GDI_ERROR )
@@ -133,7 +133,7 @@ RawFontData::RawFontData( HDC hDC, DWORD nTableTag )
if( nRawDataOfs != mnByteCount )
{
delete[] mpRawBytes;
- mpRawBytes = NULL;
+ mpRawBytes = nullptr;
}
}
@@ -238,14 +238,14 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar )
// use method suggested in #i97086# to determine the systems default language
// TODO: move into i18npool or sal/osl/w32/nlsupport.c
LanguageType nDefaultLang = 0;
- HKEY hKey = NULL;
+ HKEY hKey = nullptr;
LONG lResult = ::RegOpenKeyExA( HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Nls\\Language",
0, KEY_QUERY_VALUE, &hKey );
char aKeyValBuf[16];
DWORD nKeyValSize = sizeof(aKeyValBuf);
if( ERROR_SUCCESS == lResult )
- lResult = RegQueryValueExA( hKey, "Default", NULL, NULL, (LPBYTE)aKeyValBuf, &nKeyValSize );
+ lResult = RegQueryValueExA( hKey, "Default", nullptr, nullptr, reinterpret_cast<LPBYTE>(aKeyValBuf), &nKeyValSize );
aKeyValBuf[ sizeof(aKeyValBuf)-1 ] = '\0';
if( ERROR_SUCCESS == lResult )
nDefaultLang = (LanguageType)rtl_str_toInt32( aKeyValBuf, 16 );
@@ -289,7 +289,7 @@ class WinGlyphFallbackSubstititution
public:
explicit WinGlyphFallbackSubstititution( HDC );
- bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) const;
+ bool FindFontSubstitute( FontSelectPattern&, OUString& rMissingChars ) const override;
private:
HDC mhDC;
bool HasMissingChars( PhysicalFontFace*, const OUString& rMissingChars ) const;
@@ -299,9 +299,6 @@ inline WinGlyphFallbackSubstititution::WinGlyphFallbackSubstititution( HDC hDC )
: mhDC( hDC )
{}
-void ImplGetLogFontFromFontSelect( HDC, const FontSelectPattern*,
- LOGFONTW&, bool /*bTestVerticalAvail*/ );
-
// does a font face hold the given missing characters?
bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, const OUString& rMissingChars ) const
{
@@ -343,11 +340,11 @@ bool WinGlyphFallbackSubstititution::HasMissingChars( PhysicalFontFace* pFace, c
for( sal_Int32 nStrIdx = 0; nStrIdx < nStrLen; /* ++nStrIdx unreachable code, see the 'break' below */ )
{
const sal_UCS4 uChar = rMissingChars.iterateCodePoints( &nStrIdx );
- nMatchCount += xFontCharMap->HasChar( uChar );
+ nMatchCount += xFontCharMap->HasChar( uChar ) ? 1 : 0;
break; // for now
}
- xFontCharMap = 0;
+ xFontCharMap = nullptr;
const bool bHasMatches = (nMatchCount > 0);
return bHasMatches;
@@ -775,12 +772,12 @@ static FILE * grLog()
const void * getGrTable(const void* appFaceHandle, unsigned int name, size_t *len)
{
- const GrFontData * fontTables = reinterpret_cast<const GrFontData*>(appFaceHandle);
+ const GrFontData * fontTables = static_cast<const GrFontData*>(appFaceHandle);
return fontTables->getTable(name, len);
}
GrFontData::GrFontData(HDC hDC) :
- mhDC(hDC), mpFace(NULL), mnRefCount(1)
+ mhDC(hDC), mpFace(nullptr), mnRefCount(1)
{
// The face options ensure that the tables are all read at construction
// time so there is no need to keep the hDC uptodate
@@ -796,7 +793,7 @@ GrFontData::GrFontData(HDC hDC) :
fprintf(grLog(), "gr_make_face %lx for WinFontData %lx\n", (unsigned long)mpFace,
(unsigned long)this);
#endif
- mhDC = NULL;
+ mhDC = nullptr;
}
GrFontData::~GrFontData()
@@ -808,7 +805,7 @@ GrFontData::~GrFontData()
(unsigned long)this);
#endif
gr_face_destroy(mpFace);
- mpFace = NULL;
+ mpFace = nullptr;
}
std::vector<RawFontData*>::iterator i = mvData.begin();
while (i != mvData.end())
@@ -840,13 +837,13 @@ const void * GrFontData::getTable(unsigned int name, size_t *len) const
{
if (len)
*len = data->size();
- return reinterpret_cast<const void *>(data->get());
+ return static_cast<const void *>(data->get());
}
else
{
if (len)
*len = 0;
- return NULL;
+ return nullptr;
}
}
#endif
@@ -857,13 +854,13 @@ WinFontFace::WinFontFace( const FontAttributes& rDFS,
mnId( 0 ),
mbHasCJKSupport( false ),
#if ENABLE_GRAPHITE
- mpGraphiteData(NULL),
+ mpGraphiteData(nullptr),
mbHasGraphiteSupport( false ),
#endif
mbHasArabicSupport ( false ),
mbFontCapabilitiesRead( false ),
- mxUnicodeMap( NULL ),
- mpEncodingVector( NULL ),
+ mxUnicodeMap( nullptr ),
+ mpEncodingVector( nullptr ),
meWinCharSet( eWinCharSet ),
mnPitchAndFamily( nPitchAndFamily ),
mbAliasSymbolsHigh( false ),
@@ -900,7 +897,7 @@ WinFontFace::WinFontFace( const FontAttributes& rDFS,
WinFontFace::~WinFontFace()
{
if( mxUnicodeMap.Is() )
- mxUnicodeMap = 0;
+ mxUnicodeMap = nullptr;
#if ENABLE_GRAPHITE
if (mpGraphiteData)
mpGraphiteData->DeReference();
@@ -940,14 +937,14 @@ void WinFontFace::UpdateFromHDC( HDC hDC ) const
fprintf(grLog(), "WinFontFace::UpdateFromHDC %lx\n",
(unsigned long)this);
#endif
- if (mpGraphiteData == NULL)
+ if (mpGraphiteData == nullptr)
{
mpGraphiteData = new GrFontData(hDC);
if (!mpGraphiteData->getFace())
{
mbHasGraphiteSupport = false;
delete mpGraphiteData;
- mpGraphiteData = NULL;
+ mpGraphiteData = nullptr;
}
}
}
@@ -962,7 +959,7 @@ const gr_face* WinFontFace::GraphiteFace() const
fprintf(grLog(), "WinFontFace::GraphiteFace %lx has face %lx\n",
(unsigned long)this, mpGraphiteData? mpGraphiteData->getFace(): 0);
#endif
- return (mpGraphiteData)? mpGraphiteData->getFace() : NULL;
+ return (mpGraphiteData)? mpGraphiteData->getFace() : nullptr;
}
#endif
@@ -995,7 +992,7 @@ void WinFontFace::ReadGsubTable( HDC hDC ) const
// check the existence of a GSUB table
const DWORD GsubTag = CalcTag( "GSUB" );
- DWORD nRC = ::GetFontData( hDC, GsubTag, 0, NULL, 0 );
+ DWORD nRC = ::GetFontData( hDC, GsubTag, 0, nullptr, 0 );
if( (nRC == GDI_ERROR) || !nRC )
return;
@@ -1012,8 +1009,8 @@ void WinFontFace::ReadGsubTable( HDC hDC ) const
if( !*aRawFontData.get() ) // TTC candidate
nFaceNum = ~0U; // indicate "TTC font extracts only"
- TrueTypeFont* pTTFont = NULL;
- ::OpenTTFontBuffer( (void*)aRawFontData.get(), aRawFontData.size(), nFaceNum, &pTTFont );
+ TrueTypeFont* pTTFont = nullptr;
+ ::OpenTTFontBuffer( aRawFontData.get(), aRawFontData.size(), nFaceNum, &pTTFont );
if( !pTTFont )
return;
@@ -1072,7 +1069,7 @@ void WinFontFace::GetFontCapabilities( HDC hDC ) const
// GSUB table
DWORD nLength;
const DWORD GsubTag = CalcTag( "GSUB" );
- nLength = ::GetFontData( hDC, GsubTag, 0, NULL, 0 );
+ nLength = ::GetFontData( hDC, GsubTag, 0, nullptr, 0 );
if( (nLength != GDI_ERROR) && nLength )
{
std::vector<unsigned char> aTable( nLength );
@@ -1083,7 +1080,7 @@ void WinFontFace::GetFontCapabilities( HDC hDC ) const
// OS/2 table
const DWORD OS2Tag = CalcTag( "OS/2" );
- nLength = ::GetFontData( hDC, OS2Tag, 0, NULL, 0 );
+ nLength = ::GetFontData( hDC, OS2Tag, 0, nullptr, 0 );
if( (nLength != GDI_ERROR) && nLength )
{
std::vector<unsigned char> aTable( nLength );
@@ -1119,11 +1116,11 @@ void WinSalGraphics::SetTextColor( SalColor nSalColor )
::SetTextColor( getHDC(), aCol );
}
-int CALLBACK SalEnumQueryFontProcExW( const ENUMLOGFONTEXW*,
- const NEWTEXTMETRICEXW*,
+int CALLBACK SalEnumQueryFontProcExW( const LOGFONTW*,
+ const TEXTMETRICW*,
DWORD, LPARAM lParam )
{
- *((bool*)(void*)lParam) = true;
+ *reinterpret_cast<bool*>(lParam) = true;
return 0;
}
@@ -1171,7 +1168,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
rLogFont.lfWidth = (LONG)pFont->mnWidth;
rLogFont.lfUnderline = 0;
rLogFont.lfStrikeOut = 0;
- rLogFont.lfItalic = (pFont->GetItalic()) != ITALIC_NONE;
+ rLogFont.lfItalic = BYTE(pFont->GetItalic() != ITALIC_NONE);
rLogFont.lfEscapement = pFont->mnOrientation;
rLogFont.lfOrientation = rLogFont.lfEscapement;
rLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
@@ -1194,8 +1191,8 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
// check availability of vertical mode for this font
bool bAvailable = false;
- EnumFontFamiliesExW( hDC, &rLogFont, (FONTENUMPROCW)SalEnumQueryFontProcExW,
- (LPARAM)&bAvailable, 0 );
+ EnumFontFamiliesExW( hDC, &rLogFont, SalEnumQueryFontProcExW,
+ reinterpret_cast<LPARAM>(&bAvailable), 0 );
if( !bAvailable )
{
@@ -1209,12 +1206,12 @@ void ImplGetLogFontFromFontSelect( HDC hDC,
HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontScale, HFONT& o_rOldFont )
{
- HFONT hNewFont = 0;
+ HFONT hNewFont = nullptr;
- HDC hdcScreen = 0;
+ HDC hdcScreen = nullptr;
if( mbVirDev )
// only required for virtual devices, see below for details
- hdcScreen = GetDC(0);
+ hdcScreen = GetDC(nullptr);
LOGFONTW aLogFont;
ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true );
@@ -1224,7 +1221,7 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS
if( mbScreen
&& (i_pFont->mnWidth != 0
|| i_pFont->mnOrientation != 0
- || i_pFont->mpFontData == NULL
+ || i_pFont->mpFontData == nullptr
|| (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight))
&& !bImplSalCourierScalable
&& bImplSalCourierNew
@@ -1283,7 +1280,7 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS
}
if( hdcScreen )
- ::ReleaseDC( NULL, hdcScreen );
+ ::ReleaseDC( nullptr, hdcScreen );
return hNewFont;
}
@@ -1302,7 +1299,7 @@ void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
{
if( mhFonts[i] )
::DeleteFont( mhFonts[i] );
- mhFonts[ i ] = 0;
+ mhFonts[ i ] = nullptr;
if (mpWinFontEntry[i])
{
GetWinFontEntry(i)->mpFontCache->Release(GetWinFontEntry(i));
@@ -1310,7 +1307,7 @@ void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
mpWinFontEntry[i] = nullptr;
mpWinFontData[i] = nullptr;
}
- mhDefFont = 0;
+ mhDefFont = nullptr;
return;
}
@@ -1328,7 +1325,7 @@ void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
mpWinFontEntry[ nFallbackLevel ] = reinterpret_cast<WinFontInstance*>( pFont->mpFontInstance );
mpWinFontData[ nFallbackLevel ] = static_cast<const WinFontFace*>( pFont->mpFontData );
- HFONT hOldFont = 0;
+ HFONT hOldFont = nullptr;
HFONT hNewFont = ImplDoSetFont( pFont, mfFontScale[ nFallbackLevel ], hOldFont );
mfCurrentFontScale = mfFontScale[nFallbackLevel];
@@ -1345,7 +1342,7 @@ void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
if( mhFonts[i] )
{
::DeleteFont( mhFonts[i] );
- mhFonts[i] = 0;
+ mhFonts[i] = nullptr;
}
// note: removing mpWinFontEntry[i] here has obviously bad effects
}
@@ -1363,7 +1360,7 @@ void WinSalGraphics::SetFont( FontSelectPattern* pFont, int nFallbackLevel )
if ( mpFontKernPairs )
{
delete[] mpFontKernPairs;
- mpFontKernPairs = NULL;
+ mpFontKernPairs = nullptr;
}
mnFontKernPairCount = 0;
}
@@ -1402,7 +1399,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
{
// check if there are kern pairs
// TODO: does this work with GPOS kerning?
- DWORD nKernPairs = ::GetKerningPairsA( getHDC(), 0, NULL );
+ DWORD nKernPairs = ::GetKerningPairsA( getHDC(), 0, nullptr );
rxFontMetric->SetKernableFlag( (nKernPairs > 0) );
}
else
@@ -1453,12 +1450,12 @@ sal_uLong WinSalGraphics::GetKernPairs()
if( mpFontKernPairs )
{
delete[] mpFontKernPairs;
- mpFontKernPairs = NULL;
+ mpFontKernPairs = nullptr;
}
mnFontKernPairCount = 0;
- KERNINGPAIR* pPairs = NULL;
- int nCount = ::GetKerningPairsW( getHDC(), 0, NULL );
+ KERNINGPAIR* pPairs = nullptr;
+ int nCount = ::GetKerningPairsW( getHDC(), 0, nullptr );
if( nCount )
{
pPairs = new KERNINGPAIR[ nCount+1 ];
@@ -1492,11 +1489,15 @@ bool WinSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilitie
return mpWinFontData[0]->GetFontCapabilities(rFontCapabilities);
}
-int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
- const NEWTEXTMETRICEXW* pMetric,
+int CALLBACK SalEnumFontsProcExW( const LOGFONTW* lpelfe,
+ const TEXTMETRICW* lpntme,
DWORD nFontType, LPARAM lParam )
{
- ImplEnumInfo* pInfo = (ImplEnumInfo*)(void*)lParam;
+ ENUMLOGFONTEXW const * pLogFont
+ = reinterpret_cast<ENUMLOGFONTEXW const *>(lpelfe);
+ NEWTEXTMETRICEXW const * pMetric
+ = reinterpret_cast<NEWTEXTMETRICEXW const *>(lpntme);
+ ImplEnumInfo* pInfo = reinterpret_cast<ImplEnumInfo*>(lParam);
if ( !pInfo->mpName )
{
// Ignore vertical fonts
@@ -1512,11 +1513,11 @@ int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
pInfo->mpName = &aName;
memcpy( pInfo->mpLogFontW->lfFaceName, pLogFont->elfLogFont.lfFaceName, (aName.getLength()+1)*sizeof( wchar_t ) );
pInfo->mpLogFontW->lfCharSet = pLogFont->elfLogFont.lfCharSet;
- EnumFontFamiliesExW( pInfo->mhDC, pInfo->mpLogFontW, (FONTENUMPROCW)SalEnumFontsProcExW,
- (LPARAM)(void*)pInfo, 0 );
+ EnumFontFamiliesExW( pInfo->mhDC, pInfo->mpLogFontW, SalEnumFontsProcExW,
+ reinterpret_cast<LPARAM>(pInfo), 0 );
pInfo->mpLogFontW->lfFaceName[0] = '\0';
pInfo->mpLogFontW->lfCharSet = DEFAULT_CHARSET;
- pInfo->mpName = NULL;
+ pInfo->mpName = nullptr;
pInfo->mbCourier = FALSE;
}
}
@@ -1553,7 +1554,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
OUString aUSytemPath;
OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) );
- nRet = AddFontResourceExW( reinterpret_cast<LPCWSTR>(aUSytemPath.getStr()), FR_PRIVATE, NULL );
+ nRet = AddFontResourceExW( reinterpret_cast<LPCWSTR>(aUSytemPath.getStr()), FR_PRIVATE, nullptr );
if ( !nRet )
{
@@ -1572,7 +1573,7 @@ bool ImplAddTempFont( SalData& rSalData, const OUString& rFontFileURL )
rtl_TextEncoding theEncoding = osl_getThreadTextEncoding();
OString aCFileName = OUStringToOString( aUSytemPath, theEncoding );
// TODO: font should be private => need to investigate why it doesn't work then
- if( !::CreateScalableFontResourceA( 0, aResourceName, aCFileName.getStr(), NULL ) )
+ if( !::CreateScalableFontResourceA( 0, aResourceName, aCFileName.getStr(), nullptr ) )
return false;
++nCounter;
@@ -1641,7 +1642,7 @@ static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
// Create font resource file (typically with a .fot file name extension).
rtl_TextEncoding theEncoding = osl_getThreadTextEncoding();
OString aCFileName = OUStringToOString( aUSytemPath, theEncoding );
- ::CreateScalableFontResourceA( 0, aResourceName, aCFileName.getStr(), NULL );
+ ::CreateScalableFontResourceA( 0, aResourceName, aCFileName.getStr(), nullptr );
// Open and read the font resource file
OUString aFotFileName = OStringToOUString( aResourceName, osl_getThreadTextEncoding() );
@@ -1793,9 +1794,9 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
ImplEnumInfo aInfo;
aInfo.mhDC = getHDC();
aInfo.mpList = pFontCollection;
- aInfo.mpName = NULL;
- aInfo.mpLogFontA = NULL;
- aInfo.mpLogFontW = NULL;
+ aInfo.mpName = nullptr;
+ aInfo.mpLogFontA = nullptr;
+ aInfo.mpLogFontW = nullptr;
aInfo.mbCourier = false;
aInfo.mbPrinter = mbPrinter;
aInfo.mnFontCount = 0;
@@ -1813,7 +1814,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
aInfo.mnPreferredCharSet = DEFAULT_CHARSET;
DWORD nCP = GetACP();
CHARSETINFO aCharSetInfo;
- if ( TranslateCharsetInfo( (DWORD*)(sal_IntPtr)nCP, &aCharSetInfo, TCI_SRCCODEPAGE ) )
+ if ( TranslateCharsetInfo( reinterpret_cast<DWORD*>((sal_IntPtr)nCP), &aCharSetInfo, TCI_SRCCODEPAGE ) )
aInfo.mnPreferredCharSet = aCharSetInfo.ciCharset;
LOGFONTW aLogFont;
@@ -1821,7 +1822,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
aLogFont.lfCharSet = DEFAULT_CHARSET;
aInfo.mpLogFontW = &aLogFont;
EnumFontFamiliesExW( getHDC(), &aLogFont,
- (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 );
+ SalEnumFontsProcExW, reinterpret_cast<LPARAM>(&aInfo), 0 );
// check what Courier fonts are used on the screen, so to perhaps
// map Courier to CourierNew in SetFont()
@@ -1858,7 +1859,7 @@ bool WinSalGraphics::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect )
GLYPHMETRICS aGM;
aGM.gmptGlyphOrigin.x = aGM.gmptGlyphOrigin.y = 0;
aGM.gmBlackBoxX = aGM.gmBlackBoxY = 0;
- DWORD nSize = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGM, 0, NULL, &aMat );
+ DWORD nSize = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGM, 0, nullptr, &aMat );
if( nSize == GDI_ERROR )
return false;
@@ -1889,7 +1890,7 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
aGlyphId &= GF_IDXMASK;
GLYPHMETRICS aGlyphMetrics;
- const DWORD nSize1 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGlyphMetrics, 0, NULL, &aMat );
+ const DWORD nSize1 = ::GetGlyphOutlineW( hDC, aGlyphId, nGGOFlags, &aGlyphMetrics, 0, nullptr, &aMat );
if( !nSize1 ) // blank glyphs are ok
return true;
else if( nSize1 == GDI_ERROR )
@@ -1907,8 +1908,8 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
Point* pPoints = new Point[ nPtSize ];
BYTE* pFlags = new BYTE[ nPtSize ];
- TTPOLYGONHEADER* pHeader = (TTPOLYGONHEADER*)pData;
- while( (BYTE*)pHeader < pData+nSize2 )
+ TTPOLYGONHEADER* pHeader = reinterpret_cast<TTPOLYGONHEADER*>(pData);
+ while( reinterpret_cast<BYTE*>(pHeader) < pData+nSize2 )
{
// only outline data is interesting
if( pHeader->dwType != TT_POLYGON_TYPE )
@@ -1924,9 +1925,9 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
pFlags[ nPnt++ ] = POLY_NORMAL;
bool bHasOfflinePoints = false;
- TTPOLYCURVE* pCurve = (TTPOLYCURVE*)( pHeader + 1 );
- pHeader = (TTPOLYGONHEADER*)( (BYTE*)pHeader + pHeader->cb );
- while( (BYTE*)pCurve < (BYTE*)pHeader )
+ TTPOLYCURVE* pCurve = reinterpret_cast<TTPOLYCURVE*>( pHeader + 1 );
+ pHeader = reinterpret_cast<TTPOLYGONHEADER*>( reinterpret_cast<BYTE*>(pHeader) + pHeader->cb );
+ while( reinterpret_cast<BYTE*>(pCurve) < reinterpret_cast<BYTE*>(pHeader) )
{
int nNeededSize = nPnt + 16 + 3 * pCurve->cpfx;
if( nPtSize < nNeededSize )
@@ -2011,7 +2012,7 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
}
// next curve segment
- pCurve = (TTPOLYCURVE*)&pCurve->apfx[ i ];
+ pCurve = reinterpret_cast<TTPOLYCURVE*>(&pCurve->apfx[ i ]);
}
// end point is start point for closed contour
@@ -2032,7 +2033,7 @@ bool WinSalGraphics::GetGlyphOutline( sal_GlyphId aGlyphId,
pPoints[i].Y() = -pPoints[i].Y();
// insert into polypolygon
- tools::Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : NULL) );
+ tools::Polygon aPoly( nPnt, pPoints, (bHasOfflinePoints ? pFlags : nullptr) );
// convert to B2DPolyPolygon
// TODO: get rid of the intermediate PolyPolygon
rB2DPolyPoly.append( aPoly.getB2DPolygon() );
@@ -2068,7 +2069,7 @@ private:
ScopedFont::ScopedFont(WinSalGraphics & rData): m_rData(rData)
{
m_hOrigFont = m_rData.mhFonts[0];
- m_rData.mhFonts[0] = 0; // avoid deletion of current font
+ m_rData.mhFonts[0] = nullptr; // avoid deletion of current font
}
ScopedFont::~ScopedFont()
@@ -2086,11 +2087,11 @@ ScopedFont::~ScopedFont()
class ScopedTrueTypeFont
{
public:
- inline ScopedTrueTypeFont(): m_pFont(0) {}
+ inline ScopedTrueTypeFont(): m_pFont(nullptr) {}
~ScopedTrueTypeFont();
- int open(void * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum);
+ int open(void const * pBuffer, sal_uInt32 nLen, sal_uInt32 nFaceNum);
inline TrueTypeFont * get() const { return m_pFont; }
@@ -2100,14 +2101,14 @@ private:
ScopedTrueTypeFont::~ScopedTrueTypeFont()
{
- if (m_pFont != 0)
+ if (m_pFont != nullptr)
CloseTTFont(m_pFont);
}
-int ScopedTrueTypeFont::open(void * pBuffer, sal_uInt32 nLen,
+int ScopedTrueTypeFont::open(void const * pBuffer, sal_uInt32 nLen,
sal_uInt32 nFaceNum)
{
- OSL_ENSURE(m_pFont == 0, "already open");
+ OSL_ENSURE(m_pFont == nullptr, "already open");
return OpenTTFontBuffer(pBuffer, nLen, nFaceNum, &m_pFont);
}
@@ -2125,10 +2126,10 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
// TODO: much better solution: move SetFont and restoration of old font to caller
ScopedFont aOldFont(*this);
float fScale = 1.0;
- HFONT hOldFont = 0;
+ HFONT hOldFont = nullptr;
ImplDoSetFont( &aIFSD, fScale, hOldFont );
- WinFontFace* pWinFontData = (WinFontFace*)aIFSD.mpFontData;
+ WinFontFace const * pWinFontData = static_cast<WinFontFace const *>(aIFSD.mpFontData);
#if OSL_DEBUG_LEVEL > 1
// get font metrics
@@ -2168,12 +2169,12 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
aRealGlyphIds[i] = aGlyphId;
}
- xFontCharMap = 0;
+ xFontCharMap = nullptr;
// provide a font subset from the CFF-table
FILE* pOutFile = fopen( aToFile.getStr(), "wb" );
rInfo.LoadFont( FontSubsetInfo::CFF_FONT, aRawCffData.get(), aRawCffData.size() );
- bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, NULL,
+ bool bRC = rInfo.CreateFontSubset( FontSubsetInfo::TYPE1_PFB, pOutFile, nullptr,
aRealGlyphIds, pEncoding, nGlyphCount, pGlyphWidths );
fclose( pOutFile );
return bRC;
@@ -2190,7 +2191,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
nFaceNum = ~0U; // indicate "TTC font extracts only"
ScopedTrueTypeFont aSftTTF;
- int nRC = aSftTTF.open( (void*)xRawFontData.get(), xRawFontData.size(), nFaceNum );
+ int nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum );
if( nRC != SF_OK )
return FALSE;
@@ -2261,7 +2262,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
// write subset into destination file
nRC = ::CreateTTFromTTGlyphs( aSftTTF.get(), aToFile.getStr(), aShortIDs,
- aTempEncs, nGlyphCount, 0, NULL, 0 );
+ aTempEncs, nGlyphCount, 0, nullptr, 0 );
return (nRC == SF_OK);
}
@@ -2281,7 +2282,7 @@ const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont,
RawFontData aRawFontData( getHDC() );
*pDataLen = aRawFontData.size();
if( !aRawFontData.get() )
- return NULL;
+ return nullptr;
// get important font properties
TEXTMETRICA aTm;
@@ -2314,31 +2315,31 @@ const void* WinSalGraphics::GetEmbedFontData( const PhysicalFontFace* pFont,
}
if( !*pDataLen )
- return NULL;
+ return nullptr;
const unsigned char* pData = aRawFontData.steal();
- return (void*)pData;
+ return pData;
}
void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ )
{
- delete[] reinterpret_cast<char*>(const_cast<void*>(pData));
+ delete[] static_cast<char const *>(pData);
}
const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const**)
{
// TODO: even for builtin fonts we get here... why?
if( !pFont->CanEmbed() )
- return NULL;
+ return nullptr;
// fill the encoding vector
// currently no nonencoded vector
if( pNonEncoded )
- *pNonEncoded = NULL;
+ *pNonEncoded = nullptr;
const WinFontFace* pWinFontData = static_cast<const WinFontFace*>(pFont);
const Ucs2SIntMap* pEncoding = pWinFontData->GetEncodingVector();
- if( pEncoding == NULL )
+ if( pEncoding == nullptr )
{
Ucs2SIntMap* pNewEncoding = new Ucs2SIntMap;
for( sal_Unicode i = 32; i < 256; ++i )
@@ -2363,7 +2364,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
ScopedFont aOldFont(*this);
float fScale = 0.0;
- HFONT hOldFont = 0;
+ HFONT hOldFont = nullptr;
ImplDoSetFont( &aIFSD, fScale, hOldFont );
if( pFont->CanSubset() )
@@ -2379,7 +2380,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
nFaceNum = ~0U; // indicate "TTC font extracts only"
ScopedTrueTypeFont aSftTTF;
- int nRC = aSftTTF.open( (void*)xRawFontData.get(), xRawFontData.size(), nFaceNum );
+ int nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum );
if( nRC != SF_OK )
return;
@@ -2420,7 +2421,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
nChar = xFCMap->GetNextChar( nChar );
}
- xFCMap = 0;
+ xFCMap = nullptr;
}
}
else if( pFont->CanEmbed() )
diff --git a/vcl/win/gdi/salgdi.cxx b/vcl/win/gdi/salgdi.cxx
index 6b9e067d79d1..2956fed9f6a6 100644
--- a/vcl/win/gdi/salgdi.cxx
+++ b/vcl/win/gdi/salgdi.cxx
@@ -51,8 +51,8 @@ struct SysColorEntry
SysColorEntry* pNext;
};
-static SysColorEntry* pFirstSysColor = NULL;
-static SysColorEntry* pActSysColor = NULL;
+static SysColorEntry* pFirstSysColor = nullptr;
+static SysColorEntry* pActSysColor = nullptr;
// Blue7
static PALETTEENTRY aImplExtraColor1 =
@@ -117,10 +117,10 @@ void ImplInitSalGDI()
memset( pSalData->mpHDCCache, 0, CACHESIZE_HDC * sizeof( HDCCache ) );
// initialize temporary font list
- pSalData->mpTempFontItem = NULL;
+ pSalData->mpTempFontItem = nullptr;
// support palettes for 256 color displays
- HDC hDC = GetDC( 0 );
+ HDC hDC = GetDC( nullptr );
int nBitsPixel = GetDeviceCaps( hDC, BITSPIXEL );
int nPlanes = GetDeviceCaps( hDC, PLANES );
int nRasterCaps = GetDeviceCaps( hDC, RASTERCAPS );
@@ -131,9 +131,9 @@ void ImplInitSalGDI()
// test if we have to dither
HDC hMemDC = ::CreateCompatibleDC( hDC );
HBITMAP hMemBmp = ::CreateCompatibleBitmap( hDC, 8, 8 );
- HBITMAP hBmpOld = (HBITMAP) ::SelectObject( hMemDC, hMemBmp );
+ HBITMAP hBmpOld = static_cast<HBITMAP>(::SelectObject( hMemDC, hMemBmp ));
HBRUSH hMemBrush = ::CreateSolidBrush( PALETTERGB( 175, 171, 169 ) );
- HBRUSH hBrushOld = (HBRUSH) ::SelectObject( hMemDC, hMemBrush );
+ HBRUSH hBrushOld = static_cast<HBRUSH>(::SelectObject( hMemDC, hMemBrush ));
bool bDither16 = TRUE;
::PatBlt( hMemDC, 0, 0, 8, 8, PATCOPY );
@@ -144,8 +144,10 @@ void ImplInitSalGDI()
if( ::GetPixel( hMemDC, nX, nY ) != aCol )
bDither16 = FALSE;
- ::SelectObject( hMemDC, hBrushOld ), ::DeleteObject( hMemBrush );
- ::SelectObject( hMemDC, hBmpOld ), ::DeleteObject( hMemBmp );
+ ::SelectObject( hMemDC, hBrushOld );
+ ::DeleteObject( hMemBrush );
+ ::SelectObject( hMemDC, hBmpOld );
+ ::DeleteObject( hMemBmp );
::DeleteDC( hMemDC );
if( bDither16 )
@@ -154,14 +156,14 @@ void ImplInitSalGDI()
long n;
pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, sizeof( BITMAPINFOHEADER ) + 192 );
- pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( pSalData->mhDitherDIB ));
pSalData->mpDitherDiff = new long[ 256 ];
pSalData->mpDitherLow = new BYTE[ 256 ];
pSalData->mpDitherHigh = new BYTE[ 256 ];
pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER );
memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
- BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
+ BITMAPINFOHEADER* pBIH = reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB);
pBIH->biSize = sizeof( BITMAPINFOHEADER );
pBIH->biWidth = 8;
@@ -189,7 +191,7 @@ void ImplInitSalGDI()
sal_uLong nTotalCount = DITHER_MAX_SYSCOLOR + nDitherPalCount + DITHER_EXTRA_COLORS;
// create logical palette
- pLogPal = (LOGPALETTE*) new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ];
+ pLogPal = reinterpret_cast<LOGPALETTE*>(new char[ sizeof( LOGPALETTE ) + ( nTotalCount * sizeof( PALETTEENTRY ) ) ]);
pLogPal->palVersion = 0x0300;
pLogPal->palNumEntries = (sal_uInt16) nTotalCount;
pPalEntry = pLogPal->palPalEntry;
@@ -219,7 +221,7 @@ void ImplInitSalGDI()
// create palette
pSalData->mhDitherPal = CreatePalette( pLogPal );
- delete[] (char*) pLogPal;
+ delete[] reinterpret_cast<char*>(pLogPal);
if( pSalData->mhDitherPal )
{
@@ -228,15 +230,15 @@ void ImplInitSalGDI()
long n;
pSalData->mhDitherDIB = GlobalAlloc( GMEM_FIXED, nSize );
- pSalData->mpDitherDIB = (BYTE*) GlobalLock( pSalData->mhDitherDIB );
+ pSalData->mpDitherDIB = static_cast<BYTE*>(GlobalLock( pSalData->mhDitherDIB ));
pSalData->mpDitherDiff = new long[ 256 ];
pSalData->mpDitherLow = new BYTE[ 256 ];
pSalData->mpDitherHigh = new BYTE[ 256 ];
pSalData->mpDitherDIBData = pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) + ( 256 * sizeof( short ) );
memset( pSalData->mpDitherDIB, 0, sizeof( BITMAPINFOHEADER ) );
- BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*) pSalData->mpDitherDIB;
- short* pColors = (short*) ( pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) );
+ BITMAPINFOHEADER* pBIH = reinterpret_cast<BITMAPINFOHEADER*>(pSalData->mpDitherDIB);
+ short* pColors = reinterpret_cast<short*>( pSalData->mpDitherDIB + sizeof( BITMAPINFOHEADER ) );
pBIH->biSize = sizeof( BITMAPINFOHEADER );
pBIH->biWidth = 8;
@@ -261,7 +263,7 @@ void ImplInitSalGDI()
ImplUpdateSysColorEntries();
}
- ReleaseDC( 0, hDC );
+ ReleaseDC( nullptr, hDC );
}
void ImplFreeSalGDI()
@@ -282,14 +284,14 @@ void ImplFreeSalGDI()
if ( pSalData->mh50Brush )
{
DeleteBrush( pSalData->mh50Brush );
- pSalData->mh50Brush = 0;
+ pSalData->mh50Brush = nullptr;
}
// delete 50% Bitmap
if ( pSalData->mh50Bmp )
{
DeleteBitmap( pSalData->mh50Bmp );
- pSalData->mh50Bmp = 0;
+ pSalData->mh50Bmp = nullptr;
}
ImplClearHDCCache( pSalData );
@@ -299,7 +301,7 @@ void ImplFreeSalGDI()
if ( pSalData->mhDitherPal )
{
DeleteObject( pSalData->mhDitherPal );
- pSalData->mhDitherPal = 0;
+ pSalData->mhDitherPal = nullptr;
}
// delete buffers for dithering DIB patterns, if necessary
@@ -307,7 +309,7 @@ void ImplFreeSalGDI()
{
GlobalUnlock( pSalData->mhDitherDIB );
GlobalFree( pSalData->mhDitherDIB );
- pSalData->mhDitherDIB = 0;
+ pSalData->mhDitherDIB = nullptr;
delete[] pSalData->mpDitherDiff;
delete[] pSalData->mpDitherLow;
delete[] pSalData->mpDitherHigh;
@@ -321,11 +323,11 @@ void ImplFreeSalGDI()
delete pEntry;
pEntry = pTmp;
}
- pFirstSysColor = NULL;
+ pFirstSysColor = nullptr;
// delete icon cache
SalIcon* pIcon = pSalData->mpFirstIcon;
- pSalData->mpFirstIcon = NULL;
+ pSalData->mpFirstIcon = nullptr;
while( pIcon )
{
SalIcon* pTmp = pIcon->pNext;
@@ -394,13 +396,13 @@ static void ImplInsertSysColorEntry( int nSysIndex )
{
pActSysColor = pFirstSysColor = new SysColorEntry;
pFirstSysColor->nRGB = nRGB;
- pFirstSysColor->pNext = NULL;
+ pFirstSysColor->pNext = nullptr;
}
else
{
pActSysColor = pActSysColor->pNext = new SysColorEntry;
pActSysColor->nRGB = nRGB;
- pActSysColor->pNext = NULL;
+ pActSysColor->pNext = nullptr;
}
}
}
@@ -415,7 +417,7 @@ void ImplUpdateSysColorEntries()
delete pEntry;
pEntry = pTmp;
}
- pActSysColor = pFirstSysColor = NULL;
+ pActSysColor = pFirstSysColor = nullptr;
// create new sys color list
ImplInsertSysColorEntry( COLOR_ACTIVEBORDER );
@@ -464,7 +466,7 @@ void WinSalGraphics::InitGraphics()
void WinSalGraphics::DeInitGraphics()
{
// clear clip region
- SelectClipRgn( getHDC(), 0 );
+ SelectClipRgn( getHDC(), nullptr );
// select default objects
if ( mhDefPen )
SelectPen( getHDC(), mhDefPen );
@@ -483,7 +485,7 @@ HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
if( !pC->mhDC )
{
- HDC hDC = GetDC( 0 );
+ HDC hDC = GetDC( nullptr );
// create new DC with DefaultBitmap
pC->mhDC = CreateCompatibleDC( hDC );
@@ -495,15 +497,15 @@ HDC ImplGetCachedDC( sal_uLong nID, HBITMAP hBmp )
}
pC->mhSelBmp = CreateCompatibleBitmap( hDC, CACHED_HDC_DEFEXT, CACHED_HDC_DEFEXT );
- pC->mhDefBmp = (HBITMAP) SelectObject( pC->mhDC, pC->mhSelBmp );
+ pC->mhDefBmp = static_cast<HBITMAP>(SelectObject( pC->mhDC, pC->mhSelBmp ));
- ReleaseDC( 0, hDC );
+ ReleaseDC( nullptr, hDC );
}
if ( hBmp )
SelectObject( pC->mhDC, pC->mhActBmp = hBmp );
else
- pC->mhActBmp = 0;
+ pC->mhActBmp = nullptr;
return pC->mhDC;
}
@@ -537,8 +539,8 @@ void ImplClearHDCCache( SalData* pData )
}
OpenGLCompatibleDC::OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int width, int height)
- : mhBitmap(0)
- , mpData(NULL)
+ : mhBitmap(nullptr)
+ , mpData(nullptr)
, maRects(0, 0, width, height, x, y, width, height)
{
WinSalGraphics& rWinGraphics = static_cast<WinSalGraphics&>(rGraphics);
@@ -555,11 +557,11 @@ OpenGLCompatibleDC::OpenGLCompatibleDC(SalGraphics &rGraphics, int x, int y, int
// move the origin so that we always paint at 0,0 - to keep the bitmap
// small
- OffsetViewportOrgEx(mhCompatibleDC, -x, -y, NULL);
+ OffsetViewportOrgEx(mhCompatibleDC, -x, -y, nullptr);
mhBitmap = WinSalVirtualDevice::ImplCreateVirDevBitmap(mhCompatibleDC, width, height, 32, reinterpret_cast<void **>(&mpData));
- mhOrigBitmap = (HBITMAP) SelectObject(mhCompatibleDC, mhBitmap);
+ mhOrigBitmap = static_cast<HBITMAP>(SelectObject(mhCompatibleDC, mhBitmap));
}
OpenGLCompatibleDC::~OpenGLCompatibleDC()
@@ -585,10 +587,10 @@ void OpenGLCompatibleDC::fill(sal_uInt32 color)
OpenGLTexture* OpenGLCompatibleDC::getTexture()
{
if (!mpImpl)
- return NULL;
+ return nullptr;
// turn what's in the mpData into a texture
- return new OpenGLTexture(maRects.mnSrcWidth, maRects.mnSrcHeight, GL_BGRA, GL_UNSIGNED_BYTE, reinterpret_cast<sal_uInt8*>(mpData));
+ return new OpenGLTexture(maRects.mnSrcWidth, maRects.mnSrcHeight, GL_BGRA, GL_UNSIGNED_BYTE, mpData);
}
bool OpenGLCompatibleDC::copyToTexture(OpenGLTexture& aTexture)
@@ -600,21 +602,21 @@ bool OpenGLCompatibleDC::copyToTexture(OpenGLTexture& aTexture)
}
WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hWnd, SalGeometryProvider *pProvider):
- mhLocalDC(0),
+ mhLocalDC(nullptr),
mbPrinter(eType == WinSalGraphics::PRINTER),
mbVirDev(eType == WinSalGraphics::VIRTUAL_DEVICE),
mbWindow(eType == WinSalGraphics::WINDOW),
mbScreen(bScreen),
mhWnd(hWnd),
mfCurrentFontScale(1.0),
- mhRegion(0),
- mhDefPen(0),
- mhDefBrush(0),
- mhDefFont(0),
- mhDefPal(0),
- mpStdClipRgnData(NULL),
+ mhRegion(nullptr),
+ mhDefPen(nullptr),
+ mhDefBrush(nullptr),
+ mhDefFont(nullptr),
+ mhDefPal(nullptr),
+ mpStdClipRgnData(nullptr),
mbFontKernInit(false),
- mpFontKernPairs(NULL),
+ mpFontKernPairs(nullptr),
mnFontKernPairCount(0),
mnPenWidth(GSL_PEN_WIDTH)
{
@@ -625,9 +627,9 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
for( int i = 0; i < MAX_FALLBACK; ++i )
{
- mhFonts[ i ] = 0;
- mpWinFontData[ i ] = NULL;
- mpWinFontEntry[ i ] = NULL;
+ mhFonts[ i ] = nullptr;
+ mpWinFontData[ i ] = nullptr;
+ mpWinFontEntry[ i ] = nullptr;
mfFontScale[ i ] = 1.0;
}
}
@@ -640,11 +642,11 @@ WinSalGraphics::~WinSalGraphics()
if ( mhRegion )
{
DeleteRegion( mhRegion );
- mhRegion = 0;
+ mhRegion = nullptr;
}
// delete cache data
- delete [] (BYTE*)mpStdClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mpStdClipRgnData);
delete [] mpFontKernPairs;
}
@@ -818,7 +820,7 @@ bool WinSalGraphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32*
return mpImpl->drawPolyPolygonBezier( nPoly, pPoints, pPtAry, pFlgAry );
}
-static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, sal_uLong nComp, sal_uLong nSize )
+static BYTE* ImplSearchEntry( BYTE* pSource, BYTE const * pDest, sal_uLong nComp, sal_uLong nSize )
{
while ( nComp-- >= nSize )
{
@@ -832,13 +834,13 @@ static BYTE* ImplSearchEntry( BYTE* pSource, BYTE* pDest, sal_uLong nComp, sal_u
return pSource;
pSource++;
}
- return NULL;
+ return nullptr;
}
static bool ImplGetBoundingBox( double* nNumb, BYTE* pSource, sal_uLong nSize )
{
bool bRetValue = FALSE;
- BYTE* pDest = ImplSearchEntry( pSource, (BYTE*)"%%BoundingBox:", nSize, 14 );
+ BYTE* pDest = ImplSearchEntry( pSource, reinterpret_cast<BYTE const *>("%%BoundingBox:"), nSize, 14 );
if ( pDest )
{
nNumb[0] = nNumb[1] = nNumb[2] = nNumb[3] = 0;
@@ -907,11 +909,11 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
{
int nEscape = POSTSCRIPT_PASSTHROUGH;
- if ( Escape( getHDC(), QUERYESCSUPPORT, sizeof( int ), ( LPSTR )&nEscape, 0 ) )
+ if ( Escape( getHDC(), QUERYESCSUPPORT, sizeof( int ), reinterpret_cast<LPSTR>(&nEscape), nullptr ) )
{
double nBoundingBox[4];
- if ( ImplGetBoundingBox( nBoundingBox, (BYTE*)pPtr, nSize ) )
+ if ( ImplGetBoundingBox( nBoundingBox, static_cast<BYTE*>(pPtr), nSize ) )
{
OStringBuffer aBuf( POSTSCRIPT_BUFSIZE );
@@ -959,8 +961,8 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
// TODO: Handle more than one rectangle here (take
// care, the buffer can handle only POSTSCRIPT_BUFSIZE
// characters!)
- if ( mhRegion != 0 &&
- mpStdClipRgnData != NULL &&
+ if ( mhRegion != nullptr &&
+ mpStdClipRgnData != nullptr &&
mpClipRgnData == mpStdClipRgnData &&
mpClipRgnData->rdh.nCount == 1 )
{
@@ -990,8 +992,8 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
// #107797# Write out buffer
- *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
- Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+ *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 );
+ Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr );
// #107797# Write out EPS transformation code
@@ -1009,8 +1011,8 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
aBuf.append( nY - ( dM22 * nBoundingBox[3] ) );
aBuf.append( "] concat\n"
"%%BeginDocument:\n" );
- *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
- Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+ *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 );
+ Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr );
// #107797# Write out actual EPS content
@@ -1023,9 +1025,9 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
nDoNow = POSTSCRIPT_BUFSIZE - 2;
// the following is based on the string buffer allocation
// of size POSTSCRIPT_BUFSIZE at construction time of aBuf
- *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)nDoNow;
- memcpy( (void*)(aBuf.getStr() + 2), (BYTE*)pPtr + nSize - nToDo, nDoNow );
- sal_uLong nResult = Escape ( getHDC(), nEscape, nDoNow + 2, (LPTSTR)aBuf.getStr(), 0 );
+ *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)nDoNow;
+ memcpy( const_cast<char *>(aBuf.getStr() + 2), static_cast<BYTE*>(pPtr) + nSize - nToDo, nDoNow );
+ sal_uLong nResult = Escape ( getHDC(), nEscape, nDoNow + 2, aBuf.getStr(), nullptr );
if (!nResult )
break;
nToDo -= nResult;
@@ -1039,8 +1041,8 @@ bool WinSalGraphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void*
"count op_count_salWin sub {pop} repeat\n"
"countdictstack dict_count_salWin sub {end} repeat\n"
"b4_Inc_state_salWin restore\n\n" );
- *((sal_uInt16*)aBuf.getStr()) = (sal_uInt16)( aBuf.getLength() - 2 );
- Escape ( getHDC(), nEscape, aBuf.getLength(), (LPTSTR)aBuf.getStr(), 0 );
+ *reinterpret_cast<sal_uInt16*>(const_cast<char *>(aBuf.getStr())) = (sal_uInt16)( aBuf.getLength() - 2 );
+ Escape ( getHDC(), nEscape, aBuf.getLength(), aBuf.getStr(), nullptr );
bRetValue = TRUE;
}
}
@@ -1053,7 +1055,7 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const
{
SystemGraphicsData aRes;
aRes.nSize = sizeof(aRes);
- aRes.hDC = const_cast< WinSalGraphics* >(this)->getHDC();
+ aRes.hDC = getHDC();
return aRes;
}
diff --git a/vcl/win/gdi/salnativewidgets-luna.cxx b/vcl/win/gdi/salnativewidgets-luna.cxx
index 7c0864cfb151..23fa61ad9725 100644
--- a/vcl/win/gdi/salnativewidgets-luna.cxx
+++ b/vcl/win/gdi/salnativewidgets-luna.cxx
@@ -84,7 +84,6 @@ private:
public:
VisualStylesAPI();
~VisualStylesAPI();
- bool IsAvailable() { return (mhModule != NULL); }
HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassList );
HRESULT CloseThemeData( HTHEME hTheme );
@@ -98,26 +97,26 @@ public:
static VisualStylesAPI vsAPI;
VisualStylesAPI::VisualStylesAPI()
- : lpfnOpenThemeData( NULL ),
- lpfnCloseThemeData( NULL ),
- lpfnGetThemeBackgroundContentRect( NULL ),
- lpfnDrawThemeBackground( NULL ),
- lpfnDrawThemeText( NULL ),
- lpfnGetThemePartSize( NULL ),
- lpfnIsThemeActive( NULL )
+ : lpfnOpenThemeData( nullptr ),
+ lpfnCloseThemeData( nullptr ),
+ lpfnGetThemeBackgroundContentRect( nullptr ),
+ lpfnDrawThemeBackground( nullptr ),
+ lpfnDrawThemeText( nullptr ),
+ lpfnGetThemePartSize( nullptr ),
+ lpfnIsThemeActive( nullptr )
{
OUString aLibraryName( "uxtheme.dll" );
mhModule = osl_loadModule( aLibraryName.pData, SAL_LOADMODULE_DEFAULT );
if ( mhModule )
{
- lpfnOpenThemeData = (OpenThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "OpenThemeData" );
- lpfnCloseThemeData = (CloseThemeData_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "CloseThemeData" );
- lpfnGetThemeBackgroundContentRect = (GetThemeBackgroundContentRect_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemeBackgroundContentRect" );
- lpfnDrawThemeBackground = (DrawThemeBackground_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeBackground" );
- lpfnDrawThemeText = (DrawThemeText_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "DrawThemeText" );
- lpfnGetThemePartSize = (GetThemePartSize_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "GetThemePartSize" );
- lpfnIsThemeActive = (IsThemeActive_Proc_T)osl_getAsciiFunctionSymbol( mhModule, "IsThemeActive" );
+ lpfnOpenThemeData = reinterpret_cast<OpenThemeData_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "OpenThemeData" ));
+ lpfnCloseThemeData = reinterpret_cast<CloseThemeData_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "CloseThemeData" ));
+ lpfnGetThemeBackgroundContentRect = reinterpret_cast<GetThemeBackgroundContentRect_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "GetThemeBackgroundContentRect" ));
+ lpfnDrawThemeBackground = reinterpret_cast<DrawThemeBackground_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "DrawThemeBackground" ));
+ lpfnDrawThemeText = reinterpret_cast<DrawThemeText_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "DrawThemeText" ));
+ lpfnGetThemePartSize = reinterpret_cast<GetThemePartSize_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "GetThemePartSize" ));
+ lpfnIsThemeActive = reinterpret_cast<IsThemeActive_Proc_T>(osl_getAsciiFunctionSymbol( mhModule, "IsThemeActive" ));
}
}
@@ -132,7 +131,7 @@ HTHEME VisualStylesAPI::OpenThemeData( HWND hwnd, LPCWSTR pszClassList )
if(lpfnOpenThemeData)
return (*lpfnOpenThemeData) (hwnd, pszClassList);
else
- return NULL;
+ return nullptr;
}
HRESULT VisualStylesAPI::CloseThemeData( HTHEME hTheme )
@@ -213,7 +212,7 @@ static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name )
if( GetSalData()->mbThemeChanged )
{
// throw away invalid theme handles
- GetSalData()->deInitNWF();
+ SalData::deInitNWF();
GetSalData()->mbThemeChanged = false;
}
@@ -222,7 +221,7 @@ static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name )
return iter->second;
// theme not found -> add it to map
HTHEME hTheme = vsAPI.OpenThemeData( hWnd, name );
- if( hTheme != NULL )
+ if( hTheme != nullptr )
aThemeMap[name] = hTheme;
return hTheme;
}
@@ -235,7 +234,7 @@ static HTHEME getThemeHandle( HWND hWnd, LPCWSTR name )
*/
bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nPart )
{
- HTHEME hTheme = NULL;
+ HTHEME hTheme = nullptr;
switch( nType )
{
@@ -333,11 +332,11 @@ bool WinSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
hTheme = getThemeHandle( mhWnd, L"TreeView" );
break;
default:
- hTheme = NULL;
+ hTheme = nullptr;
break;
}
- return (hTheme != NULL);
+ return (hTheme != nullptr);
}
/*
@@ -358,7 +357,7 @@ bool WinSalGraphics::hitTestNativeControl( ControlType,
bool ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, const OUString& aStr)
{
- HRESULT hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ HRESULT hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
if( aStr.getLength() )
{
@@ -375,7 +374,7 @@ bool ImplDrawTheme( HTHEME hTheme, HDC hDC, int iPart, int iState, RECT rc, cons
Rectangle ImplGetThemeRect( HTHEME hTheme, HDC hDC, int iPart, int iState, const Rectangle& /* aRect */, THEMESIZE eTS = TS_TRUE )
{
SIZE aSz;
- HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, NULL, eTS, &aSz ); // TS_TRUE returns optimal size
+ HRESULT hr = vsAPI.GetThemePartSize( hTheme, hDC, iPart, iState, nullptr, eTS, &aSz ); // TS_TRUE returns optimal size
if( hr == S_OK )
return Rectangle( 0, 0, aSz.cx, aSz.cy );
else
@@ -474,9 +473,9 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
// and a darker horizontal line under that
HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
- HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
+ HPEN hOrigPen = static_cast<HPEN>(SelectObject(hDC, hpen));
- MoveToEx( hDC, rc.left, gradient_bottom, NULL );
+ MoveToEx( hDC, rc.left, gradient_bottom, nullptr );
LineTo( hDC, rc.right, gradient_bottom );
SelectObject(hDC, hOrigPen);
@@ -500,9 +499,9 @@ static void impl_drawAeroToolbar( HDC hDC, RECT rc, bool bHorizontal )
from_y = to_y = rc.top;
HPEN hpen = CreatePen( PS_SOLID, 1, RGB( 0xb0, 0xb0, 0xb0 ) );
- HPEN hOrigPen = (HPEN) SelectObject(hDC, hpen);
+ HPEN hOrigPen = static_cast<HPEN>(SelectObject(hDC, hpen));
- MoveToEx( hDC, from_x, from_y, NULL );
+ MoveToEx( hDC, from_x, from_y, nullptr );
LineTo( hDC, to_x, to_y );
SelectObject(hDC, hOrigPen);
@@ -516,7 +515,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
ControlPart nPart,
ControlState nState,
const ImplControlValue& aValue,
- OUString aCaption )
+ OUString const & aCaption )
{
// a listbox dropdown is actually a combobox dropdown
if( nType == ControlType::Listbox )
@@ -548,7 +547,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = ABS_UPHOT;
else
iState = ABS_UPNORMAL;
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
return (hr == S_OK);
}
if( nPart == ControlPart::ButtonDown )
@@ -562,7 +561,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = ABS_DOWNHOT;
else
iState = ABS_DOWNNORMAL;
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
return (hr == S_OK);
}
if( nPart == ControlPart::ButtonLeft )
@@ -576,7 +575,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = ABS_LEFTHOT;
else
iState = ABS_LEFTNORMAL;
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
return (hr == S_OK);
}
if( nPart == ControlPart::ButtonRight )
@@ -590,7 +589,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = ABS_RIGHTHOT;
else
iState = ABS_RIGHTNORMAL;
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
return (hr == S_OK);
}
if( nPart == ControlPart::ThumbHorz || nPart == ControlPart::ThumbVert )
@@ -606,18 +605,18 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = SCRBS_NORMAL;
SIZE sz;
- vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, NULL, TS_MIN, &sz);
- vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, NULL, TS_TRUE, &sz);
- vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, NULL, TS_DRAW, &sz);
+ vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, nullptr, TS_MIN, &sz);
+ vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, nullptr, TS_TRUE, &sz);
+ vsAPI.GetThemePartSize(hTheme, hDC, iPart, iState, nullptr, TS_DRAW, &sz);
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
// paint gripper on thumb if enough space
if( ( (nPart == ControlPart::ThumbVert) && (rc.bottom-rc.top > 12) ) ||
( (nPart == ControlPart::ThumbHorz) && (rc.right-rc.left > 12) ) )
{
iPart = (nPart == ControlPart::ThumbHorz) ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT;
iState = 0;
- vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
}
return (hr == S_OK);
}
@@ -640,7 +639,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
iState = SCRBS_HOT;
else
iState = SCRBS_NORMAL;
- hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, 0);
+ hr = vsAPI.DrawThemeBackground( hTheme, hDC, iPart, iState, &rc, nullptr);
return (hr == S_OK);
}
}
@@ -648,7 +647,7 @@ bool ImplDrawNativeControl( HDC hDC, HTHEME hTheme, RECT rc,
{
if( aValue.getType() == ControlType::SpinButtons )
{
- const SpinbuttonValue* pValue = (aValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue*>(&aValue) : NULL;
+ const SpinbuttonValue* pValue = (aValue.getType() == ControlType::SpinButtons) ? static_cast<const SpinbuttonValue*>(&aValue) : nullptr;
RECT rect;
ImplConvertSpinbuttonValues( pValue->mnUpperPart, pValue->mnUpperState, pValue->maUpperRect, &iPart, &iState, &rect );
@@ -1165,7 +1164,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
const OUString& aCaption )
{
bool bOk = false;
- HTHEME hTheme = NULL;
+ HTHEME hTheme = nullptr;
Rectangle buttonRect = rControlRegion;
Rectangle cacheRect = rControlRegion;
@@ -1187,7 +1186,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
}
ControlCacheKey aControlCacheKey(nType, nPart, nState, keySize);
- if (pImpl != NULL && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top()))
+ if (pImpl != nullptr && pImpl->TryRenderCachedNativeControl(aControlCacheKey, buttonRect.Left(), buttonRect.Top()))
{
return true;
}
@@ -1271,7 +1270,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
}
break;
default:
- hTheme = NULL;
+ hTheme = nullptr;
break;
}
@@ -1286,7 +1285,7 @@ bool WinSalGraphics::drawNativeControl( ControlType nType,
OUString aCaptionStr(aCaption.replace('~', '&')); // translate mnemonics
- if (pImpl == NULL)
+ if (pImpl == nullptr)
{
// set default text alignment
int ta = SetTextAlign(getHDC(), TA_LEFT|TA_TOP|TA_NOUPDATECP);
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index 6db349ed23cf..db54dd0069f0 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -91,12 +91,12 @@ using namespace com::sun::star::ui::dialogs;
static char aImplWindows[] = "windows";
static char aImplDevice[] = "device";
-static LPDEVMODEW SAL_DEVMODE_W( const ImplJobSetup* pSetupData )
+static DEVMODEW const * SAL_DEVMODE_W( const ImplJobSetup* pSetupData )
{
- LPDEVMODEW pRet = NULL;
- SalDriverData* pDrv = (SalDriverData*)pSetupData->GetDriverData();
+ DEVMODEW const * pRet = nullptr;
+ SalDriverData const * pDrv = reinterpret_cast<SalDriverData const *>(pSetupData->GetDriverData());
if( pSetupData->GetDriverDataLen() >= sizeof(DEVMODEW)+sizeof(SalDriverData)-1 )
- pRet = ((LPDEVMODEW)((pSetupData->GetDriverData()) + (pDrv->mnDriverOffset)));
+ pRet = reinterpret_cast<DEVMODEW const *>((pSetupData->GetDriverData()) + (pDrv->mnDriverOffset));
return pRet;
}
@@ -162,11 +162,11 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
DWORD i;
DWORD nBytes = 0;
DWORD nInfoPrn4 = 0;
- EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, NULL, 0, &nBytes, &nInfoPrn4 );
+ EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, nullptr, 0, &nBytes, &nInfoPrn4 );
if ( nBytes )
{
- PRINTER_INFO_4W* pWinInfo4 = (PRINTER_INFO_4W*) rtl_allocateMemory( nBytes );
- if ( EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, NULL, 4, (LPBYTE)pWinInfo4, nBytes, &nBytes, &nInfoPrn4 ) )
+ PRINTER_INFO_4W* pWinInfo4 = static_cast<PRINTER_INFO_4W*>(rtl_allocateMemory( nBytes ));
+ if ( EnumPrintersW( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS, nullptr, 4, reinterpret_cast<LPBYTE>(pWinInfo4), nBytes, &nBytes, &nInfoPrn4 ) )
{
for ( i = 0; i < nInfoPrn4; i++ )
{
@@ -174,7 +174,7 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
pInfo->maPrinterName = OUString( reinterpret_cast< const sal_Unicode* >(pWinInfo4[i].pPrinterName) );
pInfo->mnStatus = PrintQueueFlags::NONE;
pInfo->mnJobs = 0;
- pInfo->mpSysData = NULL;
+ pInfo->mpSysData = nullptr;
pList->Add( pInfo );
}
}
@@ -184,16 +184,16 @@ void WinSalInstance::GetPrinterQueueInfo( ImplPrnQueueList* pList )
void WinSalInstance::GetPrinterQueueState( SalPrinterQueueInfo* pInfo )
{
- HANDLE hPrinter = 0;
+ HANDLE hPrinter = nullptr;
LPWSTR pPrnName = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pInfo->maPrinterName.getStr()));
- if( OpenPrinterW( pPrnName, &hPrinter, NULL ) )
+ if( OpenPrinterW( pPrnName, &hPrinter, nullptr ) )
{
DWORD nBytes = 0;
- GetPrinterW( hPrinter, 2, NULL, 0, &nBytes );
+ GetPrinterW( hPrinter, 2, nullptr, 0, &nBytes );
if( nBytes )
{
- PRINTER_INFO_2W* pWinInfo2 = (PRINTER_INFO_2W*)rtl_allocateMemory(nBytes);
- if( GetPrinterW( hPrinter, 2, (LPBYTE)pWinInfo2, nBytes, &nBytes ) )
+ PRINTER_INFO_2W* pWinInfo2 = static_cast<PRINTER_INFO_2W*>(rtl_allocateMemory(nBytes));
+ if( GetPrinterW( hPrinter, 2, reinterpret_cast<LPBYTE>(pWinInfo2), nBytes, &nBytes ) )
{
if( pWinInfo2->pDriverName )
pInfo->maDriver = OUString( reinterpret_cast< const sal_Unicode* >(pWinInfo2->pDriverName) );
@@ -228,10 +228,10 @@ void WinSalInstance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo )
OUString WinSalInstance::GetDefaultPrinter()
{
DWORD nChars = 0;
- GetDefaultPrinterW( NULL, &nChars );
+ GetDefaultPrinterW( nullptr, &nChars );
if( nChars )
{
- LPWSTR pStr = (LPWSTR)rtl_allocateMemory(nChars*sizeof(WCHAR));
+ LPWSTR pStr = static_cast<LPWSTR>(rtl_allocateMemory(nChars*sizeof(WCHAR)));
OUString aDefPrt;
if( GetDefaultPrinterW( pStr, &nChars ) )
{
@@ -261,15 +261,15 @@ OUString WinSalInstance::GetDefaultPrinter()
static DWORD ImplDeviceCaps( WinSalInfoPrinter* pPrinter, WORD nCaps,
BYTE* pOutput, const ImplJobSetup* pSetupData )
{
- DEVMODEW* pDevMode;
+ DEVMODEW const * pDevMode;
if ( !pSetupData || !pSetupData->GetDriverData() )
- pDevMode = NULL;
+ pDevMode = nullptr;
else
pDevMode = SAL_DEVMODE_W( pSetupData );
return DeviceCapabilitiesW( reinterpret_cast<LPCWSTR>(pPrinter->maDeviceName.getStr()),
reinterpret_cast<LPCWSTR>(pPrinter->maPortName.getStr()),
- nCaps, (LPWSTR)pOutput, pDevMode );
+ nCaps, reinterpret_cast<LPWSTR>(pOutput), pDevMode );
}
static bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
@@ -282,12 +282,12 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
// initialize versions from jobsetup
// those will be overwritten with driver's version
- DEVMODEW* pDevModeW = NULL;
+ DEVMODEW const * pDevModeW = nullptr;
LONG dmSpecVersion = -1;
LONG dmDriverVersion = -1;
- SalDriverData* pSalDriverData = (SalDriverData*)pSetupData->GetDriverData();
- BYTE* pDriverData = ((BYTE*)pSalDriverData) + pSalDriverData->mnDriverOffset;
- pDevModeW = (DEVMODEW*)pDriverData;
+ SalDriverData const * pSalDriverData = reinterpret_cast<SalDriverData const *>(pSetupData->GetDriverData());
+ BYTE const * pDriverData = reinterpret_cast<BYTE const *>(pSalDriverData) + pSalDriverData->mnDriverOffset;
+ pDevModeW = reinterpret_cast<DEVMODEW const *>(pDriverData);
long nSysJobSize = -1;
if( pPrinter && pDevModeW )
@@ -298,26 +298,26 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
// #110800#, #111151#, #112381#, #i16580#, #i14173# and perhaps #112375#
HANDLE hPrn;
LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.getStr()));
- if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) )
+ if ( !OpenPrinterW( pPrinterNameW, &hPrn, nullptr ) )
return FALSE;
// #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded!
if( hPrn == HGDI_ERROR )
return FALSE;
- nSysJobSize = DocumentPropertiesW( 0, hPrn,
+ nSysJobSize = DocumentPropertiesW( nullptr, hPrn,
pPrinterNameW,
- NULL, NULL, 0 );
+ nullptr, nullptr, 0 );
if( nSysJobSize < 0 )
{
ClosePrinter( hPrn );
return FALSE;
}
- BYTE *pBuffer = (BYTE*)_alloca( nSysJobSize );
- LONG nRet = DocumentPropertiesW( 0, hPrn,
+ DEVMODEW *pBuffer = static_cast<DEVMODEW*>(_alloca( nSysJobSize ));
+ LONG nRet = DocumentPropertiesW( nullptr, hPrn,
pPrinterNameW,
- (LPDEVMODEW)pBuffer, NULL, DM_OUT_BUFFER );
+ pBuffer, nullptr, DM_OUT_BUFFER );
if( nRet < 0 )
{
ClosePrinter( hPrn );
@@ -327,12 +327,12 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
// the spec version differs between the windows platforms, ie 98,NT,2000/XP
// this allows us to throw away printer settings from other platforms that might crash a buggy driver
// we check the driver version as well
- dmSpecVersion = ((DEVMODEW*)pBuffer)->dmSpecVersion;
- dmDriverVersion = ((DEVMODEW*)pBuffer)->dmDriverVersion;
+ dmSpecVersion = pBuffer->dmSpecVersion;
+ dmDriverVersion = pBuffer->dmDriverVersion;
ClosePrinter( hPrn );
}
- SalDriverData* pSetupDriverData = (SalDriverData*)(pSetupData->GetDriverData());
+ SalDriverData const * pSetupDriverData = reinterpret_cast<SalDriverData const *>(pSetupData->GetDriverData());
if ( (pSetupData->GetSystem() == JOBSETUP_SYSTEM_WINDOWS) &&
(pPrinter->maDriverName == pSetupData->GetDriver()) &&
(pSetupData->GetDriverDataLen() > sizeof( SalDriverData )) &&
@@ -347,7 +347,7 @@ static bool ImplTestSalJobSetup( WinSalInfoPrinter* pPrinter,
if ( bDelete )
{
rtl_freeMemory( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) );
- pSetupData->SetDriverData( NULL );
+ pSetupData->SetDriverData( nullptr );
pSetupData->SetDriverDataLen( 0 );
}
}
@@ -360,21 +360,21 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
{
HANDLE hPrn;
LPWSTR pPrinterNameW = reinterpret_cast<LPWSTR>(const_cast<sal_Unicode*>(pPrinter->maDeviceName.getStr()));
- if ( !OpenPrinterW( pPrinterNameW, &hPrn, NULL ) )
+ if ( !OpenPrinterW( pPrinterNameW, &hPrn, nullptr ) )
return FALSE;
// #131642# hPrn==HGDI_ERROR even though OpenPrinter() succeeded!
if( hPrn == HGDI_ERROR )
return FALSE;
LONG nRet;
- HWND hWnd = 0;
+ HWND hWnd = nullptr;
DWORD nMode = DM_OUT_BUFFER;
- SalDriverData* pOutBuffer = NULL;
- BYTE* pInBuffer = NULL;
+ SalDriverData* pOutBuffer = nullptr;
+ BYTE const * pInBuffer = nullptr;
LONG nSysJobSize = DocumentPropertiesW( hWnd, hPrn,
pPrinterNameW,
- NULL, NULL, 0 );
+ nullptr, nullptr, 0 );
if ( nSysJobSize < 0 )
{
ClosePrinter( hPrn );
@@ -383,17 +383,17 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
// make Outputbuffer
const std::size_t nDriverDataLen = sizeof(SalDriverData) + nSysJobSize-1;
- pOutBuffer = (SalDriverData*)rtl_allocateZeroMemory( nDriverDataLen );
+ pOutBuffer = static_cast<SalDriverData*>(rtl_allocateZeroMemory( nDriverDataLen ));
pOutBuffer->mnSysSignature = SAL_DRIVERDATA_SYSSIGN;
// calculate driver data offset including structure padding
pOutBuffer->mnDriverOffset = sal::static_int_cast<sal_uInt16>(
- (char*)pOutBuffer->maDriverData -
- (char*)pOutBuffer );
+ reinterpret_cast<char*>(pOutBuffer->maDriverData) -
+ reinterpret_cast<char*>(pOutBuffer) );
// check if we have a suitable input buffer
- if ( bIn && ImplTestSalJobSetup( pPrinter, pSetupData, FALSE ) )
+ if ( bIn && ImplTestSalJobSetup( pPrinter, pSetupData, false ) )
{
- pInBuffer = (BYTE*)pSetupData->GetDriverData() + ((SalDriverData*)pSetupData->GetDriverData())->mnDriverOffset;
+ pInBuffer = pSetupData->GetDriverData() + reinterpret_cast<SalDriverData const *>(pSetupData->GetDriverData())->mnDriverOffset;
nMode |= DM_IN_BUFFER;
}
@@ -409,10 +409,10 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
if ( pVisibleDlgParent )
nMutexCount = ImplSalReleaseYieldMutex();
- BYTE* pOutDevMode = (((BYTE*)pOutBuffer) + pOutBuffer->mnDriverOffset);
+ BYTE* pOutDevMode = (reinterpret_cast<BYTE*>(pOutBuffer) + pOutBuffer->mnDriverOffset);
nRet = DocumentPropertiesW( hWnd, hPrn,
pPrinterNameW,
- (LPDEVMODEW)pOutDevMode, (LPDEVMODEW)pInBuffer, nMode );
+ reinterpret_cast<LPDEVMODEW>(pOutDevMode), reinterpret_cast<LPDEVMODEW>(const_cast<BYTE *>(pInBuffer)), nMode );
if ( pVisibleDlgParent )
ImplSalAcquireYieldMutex( nMutexCount );
ClosePrinter( hPrn );
@@ -424,24 +424,24 @@ static bool ImplUpdateSalJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
}
// fill up string buffers with 0 so they do not influence a JobSetup's memcmp
- if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 64 )
+ if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 64 )
{
- sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmDeviceName );
- if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( ((LPDEVMODEW)pOutDevMode)->dmDeviceName ) )
- memset( ((LPDEVMODEW)pOutDevMode)->dmDeviceName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) );
+ sal_Int32 nLen = rtl_ustr_getLength( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName );
+ if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName ) )
+ memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmDeviceName )-(nLen*sizeof(sal_Unicode)) );
}
- if( ((LPDEVMODEW)pOutDevMode)->dmSize >= 166 )
+ if( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmSize >= 166 )
{
- sal_Int32 nLen = rtl_ustr_getLength( (const sal_Unicode*)((LPDEVMODEW)pOutDevMode)->dmFormName );
- if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( ((LPDEVMODEW)pOutDevMode)->dmFormName ) )
- memset( ((LPDEVMODEW)pOutDevMode)->dmFormName+nLen, 0, sizeof( ((LPDEVMODEW)pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) );
+ sal_Int32 nLen = rtl_ustr_getLength( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName );
+ if ( sal::static_int_cast<size_t>(nLen) < SAL_N_ELEMENTS( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName ) )
+ memset( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName+nLen, 0, sizeof( reinterpret_cast<LPDEVMODEW>(pOutDevMode)->dmFormName )-(nLen*sizeof(sal_Unicode)) );
}
// update data
if ( pSetupData->GetDriverData() )
rtl_freeMemory( const_cast<sal_uInt8*>(pSetupData->GetDriverData()) );
pSetupData->SetDriverDataLen( nDriverDataLen );
- pSetupData->SetDriverData((BYTE*)pOutBuffer );
+ pSetupData->SetDriverData(reinterpret_cast<BYTE*>(pOutBuffer));
pSetupData->SetSystem( JOBSETUP_SYSTEM_WINDOWS );
return TRUE;
@@ -452,7 +452,7 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
if ( !pSetupData || !pSetupData->GetDriverData() )
return;
- DEVMODEW* pDevModeW = SAL_DEVMODE_W(pSetupData);
+ DEVMODEW const * pDevModeW = SAL_DEVMODE_W(pSetupData);
if( pDevModeW == nullptr )
return;
@@ -468,12 +468,12 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
// PaperBin
if ( nFlags & JobSetFlags::PAPERBIN )
{
- const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+ const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, nullptr, pSetupData );
if ( nCount && (nCount != GDI_ERROR) )
{
- WORD* pBins = (WORD*)rtl_allocateZeroMemory( nCount*sizeof(WORD) );
- ImplDeviceCaps( pPrinter, DC_BINS, (BYTE*)pBins, pSetupData );
+ WORD* pBins = static_cast<WORD*>(rtl_allocateZeroMemory( nCount*sizeof(WORD) ));
+ ImplDeviceCaps( pPrinter, DC_BINS, reinterpret_cast<BYTE*>(pBins), pSetupData );
pSetupData->SetPaperBin( 0 );
// search the right bin and assign index to mnPaperBin
@@ -500,19 +500,19 @@ static void ImplDevModeToJobSetup( WinSalInfoPrinter* pPrinter, ImplJobSetup* pS
}
else
{
- const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData );
- WORD* pPapers = NULL;
- const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData );
- POINT* pPaperSizes = NULL;
+ const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, nullptr, pSetupData );
+ WORD* pPapers = nullptr;
+ const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, nullptr, pSetupData );
+ POINT* pPaperSizes = nullptr;
if ( nPaperCount && (nPaperCount != GDI_ERROR) )
{
- pPapers = (WORD*)rtl_allocateZeroMemory(nPaperCount*sizeof(WORD));
- ImplDeviceCaps( pPrinter, DC_PAPERS, (BYTE*)pPapers, pSetupData );
+ pPapers = static_cast<WORD*>(rtl_allocateZeroMemory(nPaperCount*sizeof(WORD)));
+ ImplDeviceCaps( pPrinter, DC_PAPERS, reinterpret_cast<BYTE*>(pPapers), pSetupData );
}
if ( nPaperSizeCount && (nPaperSizeCount != GDI_ERROR) )
{
- pPaperSizes = (POINT*)rtl_allocateZeroMemory(nPaperSizeCount*sizeof(POINT));
- ImplDeviceCaps( pPrinter, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData );
+ pPaperSizes = static_cast<POINT*>(rtl_allocateZeroMemory(nPaperSizeCount*sizeof(POINT)));
+ ImplDeviceCaps( pPrinter, DC_PAPERSIZE, reinterpret_cast<BYTE*>(pPaperSizes), pSetupData );
}
if( nPaperSizeCount == nPaperCount && pPaperSizes && pPapers )
{
@@ -720,7 +720,7 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, const ImplJobSet
if ( !pSetupData || !pSetupData->GetDriverData() )
return;
- DEVMODEW* pDevModeW = SAL_DEVMODE_W(pSetupData);
+ DEVMODEW* pDevModeW = const_cast<DEVMODEW *>(SAL_DEVMODE_W(pSetupData));
if( pDevModeW == nullptr )
return;
@@ -737,12 +737,12 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, const ImplJobSet
// PaperBin
if ( nFlags & JobSetFlags::PAPERBIN )
{
- const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, NULL, pSetupData );
+ const DWORD nCount = ImplDeviceCaps( pPrinter, DC_BINS, nullptr, pSetupData );
if ( nCount && (nCount != GDI_ERROR) )
{
- WORD* pBins = (WORD*)rtl_allocateZeroMemory(nCount*sizeof(WORD));
- ImplDeviceCaps( pPrinter, DC_BINS, (BYTE*)pBins, pSetupData );
+ WORD* pBins = static_cast<WORD*>(rtl_allocateZeroMemory(nCount*sizeof(WORD)));
+ ImplDeviceCaps( pPrinter, DC_BINS, reinterpret_cast<BYTE*>(pBins), pSetupData );
pDevModeW->dmFields |= DM_DEFAULTSOURCE;
pDevModeW->dmDefaultSource = pBins[ pSetupData->GetPaperBin() ];
rtl_freeMemory( pBins );
@@ -915,20 +915,20 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, const ImplJobSet
default:
{
short nPaper = 0;
- const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, NULL, pSetupData );
- WORD* pPapers = NULL;
- const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, NULL, pSetupData );
- POINT* pPaperSizes = NULL;
- DWORD nLandscapeAngle = ImplDeviceCaps( pPrinter, DC_ORIENTATION, NULL, pSetupData );
+ const DWORD nPaperCount = ImplDeviceCaps( pPrinter, DC_PAPERS, nullptr, pSetupData );
+ WORD* pPapers = nullptr;
+ const DWORD nPaperSizeCount = ImplDeviceCaps( pPrinter, DC_PAPERSIZE, nullptr, pSetupData );
+ POINT* pPaperSizes = nullptr;
+ DWORD nLandscapeAngle = ImplDeviceCaps( pPrinter, DC_ORIENTATION, nullptr, pSetupData );
if ( nPaperCount && (nPaperCount != GDI_ERROR) )
{
- pPapers = (WORD*)rtl_allocateZeroMemory(nPaperCount*sizeof(WORD));
- ImplDeviceCaps( pPrinter, DC_PAPERS, (BYTE*)pPapers, pSetupData );
+ pPapers = static_cast<WORD*>(rtl_allocateZeroMemory(nPaperCount*sizeof(WORD)));
+ ImplDeviceCaps( pPrinter, DC_PAPERS, reinterpret_cast<BYTE*>(pPapers), pSetupData );
}
if ( nPaperSizeCount && (nPaperSizeCount != GDI_ERROR) )
{
- pPaperSizes = (POINT*)rtl_allocateZeroMemory(nPaperSizeCount*sizeof(POINT));
- ImplDeviceCaps( pPrinter, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData );
+ pPaperSizes = static_cast<POINT*>(rtl_allocateZeroMemory(nPaperSizeCount*sizeof(POINT)));
+ ImplDeviceCaps( pPrinter, DC_PAPERSIZE, reinterpret_cast<BYTE*>(pPaperSizes), pSetupData );
}
if ( (nPaperSizeCount == nPaperCount) && pPapers && pPaperSizes )
{
@@ -1004,27 +1004,27 @@ static void ImplJobSetupToDevMode( WinSalInfoPrinter* pPrinter, const ImplJobSet
static HDC ImplCreateICW_WithCatch( LPWSTR pDriver,
LPCWSTR pDevice,
- LPDEVMODEW pDevMode )
+ DEVMODEW const * pDevMode )
{
- HDC hDC = 0;
+ HDC hDC = nullptr;
CATCH_DRIVER_EX_BEGIN;
- hDC = CreateICW( pDriver, pDevice, 0, pDevMode );
+ hDC = CreateICW( pDriver, pDevice, nullptr, pDevMode );
CATCH_DRIVER_EX_END_2( "exception in CreateICW" );
return hDC;
}
static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, const ImplJobSetup* pSetupData )
{
- HDC hDC = 0;
- LPDEVMODEW pDevMode;
+ HDC hDC = nullptr;
+ DEVMODEW const * pDevMode;
if ( pSetupData && pSetupData->GetDriverData() )
pDevMode = SAL_DEVMODE_W( pSetupData );
else
- pDevMode = NULL;
+ pDevMode = nullptr;
// #95347 some buggy drivers (eg, OKI) write to those buffers in CreateIC, although declared const - so provide some space
// pl: does this hold true for Unicode functions ?
if( pPrinter->maDriverName.getLength() > 2048 || pPrinter->maDeviceName.getLength() > 2048 )
- return 0;
+ return nullptr;
sal_Unicode pDriverName[ 4096 ];
sal_Unicode pDeviceName[ 4096 ];
memcpy( pDriverName, pPrinter->maDriverName.getStr(), pPrinter->maDriverName.getLength()*sizeof(sal_Unicode));
@@ -1039,7 +1039,7 @@ static HDC ImplCreateSalPrnIC( WinSalInfoPrinter* pPrinter, const ImplJobSetup*
static WinSalGraphics* ImplCreateSalPrnGraphics( HDC hDC )
{
- WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, 0, /* CHECKME */ NULL);
+ WinSalGraphics* pGraphics = new WinSalGraphics(WinSalGraphics::PRINTER, false, nullptr, /* CHECKME */ nullptr);
pGraphics->SetLayout( SalLayoutFlags::NONE );
pGraphics->setHDC(hDC);
pGraphics->InitGraphics();
@@ -1079,19 +1079,19 @@ SalInfoPrinter* WinSalInstance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueIn
: OUString();
// check if the provided setup data match the actual printer
- ImplTestSalJobSetup( pPrinter, pSetupData, TRUE );
+ ImplTestSalJobSetup( pPrinter, pSetupData, true );
HDC hDC = ImplCreateSalPrnIC( pPrinter, pSetupData );
if ( !hDC )
{
delete pPrinter;
- return NULL;
+ return nullptr;
}
pPrinter->mpGraphics = ImplCreateSalPrnGraphics( hDC );
pPrinter->mhDC = hDC;
if ( !pSetupData->GetDriverData() )
- ImplUpdateSalJobSetup( pPrinter, pSetupData, FALSE, NULL );
+ ImplUpdateSalJobSetup( pPrinter, pSetupData, false, nullptr );
ImplDevModeToJobSetup( pPrinter, pSetupData, JobSetFlags::ALL );
pSetupData->SetSystem( JOBSETUP_SYSTEM_WINDOWS );
@@ -1105,8 +1105,8 @@ void WinSalInstance::DestroyInfoPrinter( SalInfoPrinter* pPrinter )
WinSalInfoPrinter::WinSalInfoPrinter() :
- mpGraphics( NULL ),
- mhDC( 0 ),
+ mpGraphics( nullptr ),
+ mhDC( nullptr ),
mbGraphics( FALSE )
{
m_bPapersInit = FALSE;
@@ -1126,17 +1126,17 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
{
m_aPaperFormats.clear();
- DWORD nCount = ImplDeviceCaps( this, DC_PAPERSIZE, NULL, pSetupData );
+ DWORD nCount = ImplDeviceCaps( this, DC_PAPERSIZE, nullptr, pSetupData );
if( nCount == GDI_ERROR )
nCount = 0;
if( nCount )
{
- POINT* pPaperSizes = (POINT*)rtl_allocateZeroMemory(nCount*sizeof(POINT));
- ImplDeviceCaps( this, DC_PAPERSIZE, (BYTE*)pPaperSizes, pSetupData );
+ POINT* pPaperSizes = static_cast<POINT*>(rtl_allocateZeroMemory(nCount*sizeof(POINT)));
+ ImplDeviceCaps( this, DC_PAPERSIZE, reinterpret_cast<BYTE*>(pPaperSizes), pSetupData );
- sal_Unicode* pNamesBuffer = (sal_Unicode*)rtl_allocateMemory(nCount*64*sizeof(sal_Unicode));
- ImplDeviceCaps( this, DC_PAPERNAMES, (BYTE*)pNamesBuffer, pSetupData );
+ sal_Unicode* pNamesBuffer = static_cast<sal_Unicode*>(rtl_allocateMemory(nCount*64*sizeof(sal_Unicode)));
+ ImplDeviceCaps( this, DC_PAPERNAMES, reinterpret_cast<BYTE*>(pNamesBuffer), pSetupData );
for( DWORD i = 0; i < nCount; ++i )
{
PaperInfo aInfo(pPaperSizes[i].x * 10, pPaperSizes[i].y * 10);
@@ -1151,7 +1151,7 @@ void WinSalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
{
- const DWORD nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
+ const DWORD nRet = ImplDeviceCaps( this, DC_ORIENTATION, nullptr, pSetupData );
if( nRet != GDI_ERROR )
return static_cast<int>(nRet) * 10;
@@ -1161,7 +1161,7 @@ int WinSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
SalGraphics* WinSalInfoPrinter::AcquireGraphics()
{
if ( mbGraphics )
- return NULL;
+ return nullptr;
if ( mpGraphics )
mbGraphics = TRUE;
@@ -1176,7 +1176,7 @@ void WinSalInfoPrinter::ReleaseGraphics( SalGraphics* )
bool WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
{
- if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, static_cast<WinSalFrame*>(pFrame) ) )
+ if ( ImplUpdateSalJobSetup( this, pSetupData, true, static_cast<WinSalFrame*>(pFrame) ) )
{
ImplDevModeToJobSetup( this, pSetupData, JobSetFlags::ALL );
return ImplUpdateSalPrnIC( this, pSetupData );
@@ -1187,7 +1187,7 @@ bool WinSalInfoPrinter::Setup( SalFrame* pFrame, ImplJobSetup* pSetupData )
bool WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
{
- if ( !ImplTestSalJobSetup( this, pSetupData, FALSE ) )
+ if ( !ImplTestSalJobSetup( this, pSetupData, false ) )
return FALSE;
return ImplUpdateSalPrnIC( this, pSetupData );
}
@@ -1195,7 +1195,7 @@ bool WinSalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
bool WinSalInfoPrinter::SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData )
{
ImplJobSetupToDevMode( this, pSetupData, nFlags );
- if ( ImplUpdateSalJobSetup( this, pSetupData, TRUE, NULL ) )
+ if ( ImplUpdateSalJobSetup( this, pSetupData, true, nullptr ) )
{
ImplDevModeToJobSetup( this, pSetupData, nFlags );
return ImplUpdateSalPrnIC( this, pSetupData );
@@ -1206,7 +1206,7 @@ bool WinSalInfoPrinter::SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData )
sal_uLong WinSalInfoPrinter::GetPaperBinCount( const ImplJobSetup* pSetupData )
{
- DWORD nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ DWORD nRet = ImplDeviceCaps( this, DC_BINS, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return nRet;
else
@@ -1217,11 +1217,11 @@ OUString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal
{
OUString aPaperBinName;
- DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, NULL, pSetupData );
+ DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, nullptr, pSetupData );
if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) )
{
sal_Unicode* pBuffer = new sal_Unicode[nBins*24];
- DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, (BYTE*)pBuffer, pSetupData );
+ DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, reinterpret_cast<BYTE*>(pBuffer), pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
aPaperBinName = OUString( pBuffer + (nPaperBin*24) );
delete [] pBuffer;
@@ -1239,35 +1239,35 @@ sal_uInt32 WinSalInfoPrinter::GetCapabilities( const ImplJobSetup* pSetupData, P
case PrinterCapType::SupportDialog:
return TRUE;
case PrinterCapType::Copies:
- nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_COPIES, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return nRet;
return 0;
case PrinterCapType::CollateCopies:
- nRet = ImplDeviceCaps( this, DC_COLLATE, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_COLLATE, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
{
- nRet = ImplDeviceCaps( this, DC_COPIES, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_COPIES, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return nRet;
}
return 0;
case PrinterCapType::SetOrientation:
- nRet = ImplDeviceCaps( this, DC_ORIENTATION, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_ORIENTATION, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
case PrinterCapType::SetPaperBin:
- nRet = ImplDeviceCaps( this, DC_BINS, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_BINS, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
case PrinterCapType::SetPaperSize:
case PrinterCapType::SetPaper:
- nRet = ImplDeviceCaps( this, DC_PAPERS, NULL, pSetupData );
+ nRet = ImplDeviceCaps( this, DC_PAPERS, nullptr, pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
return TRUE;
return FALSE;
@@ -1319,7 +1319,7 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ )
{
// process messages
MSG aMsg;
- if ( PeekMessageW( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &aMsg );
DispatchMessageW( &aMsg );
@@ -1348,35 +1348,36 @@ BOOL CALLBACK SalPrintAbortProc( HDC hPrnDC, int /* nError */ )
return TRUE;
}
-static LPDEVMODEW ImplSalSetCopies( LPDEVMODEW pDevMode, sal_uLong nCopies, bool bCollate )
+static DEVMODEW const * ImplSalSetCopies( DEVMODEW const * pDevMode, sal_uLong nCopies, bool bCollate )
{
- LPDEVMODEW pNewDevMode = pDevMode;
if ( pDevMode && (nCopies > 1) )
{
if ( nCopies > 32765 )
nCopies = 32765;
sal_uLong nDevSize = pDevMode->dmSize+pDevMode->dmDriverExtra;
- pNewDevMode = (LPDEVMODEW)rtl_allocateMemory( nDevSize );
+ LPDEVMODEW pNewDevMode = static_cast<LPDEVMODEW>(rtl_allocateMemory( nDevSize ));
memcpy( pNewDevMode, pDevMode, nDevSize );
- pDevMode = pNewDevMode;
- pDevMode->dmFields |= DM_COPIES;
- pDevMode->dmCopies = (short)(sal_uInt16)nCopies;
- pDevMode->dmFields |= DM_COLLATE;
+ pNewDevMode->dmFields |= DM_COPIES;
+ pNewDevMode->dmCopies = (short)(sal_uInt16)nCopies;
+ pNewDevMode->dmFields |= DM_COLLATE;
if ( bCollate )
- pDevMode->dmCollate = DMCOLLATE_TRUE;
+ pNewDevMode->dmCollate = DMCOLLATE_TRUE;
else
- pDevMode->dmCollate = DMCOLLATE_FALSE;
+ pNewDevMode->dmCollate = DMCOLLATE_FALSE;
+ return pNewDevMode;
+ }
+ else
+ {
+ return pDevMode;
}
-
- return pNewDevMode;
}
WinSalPrinter::WinSalPrinter() :
- mpGraphics( NULL ),
- mpInfoPrinter( NULL ),
- mpNextPrinter( NULL ),
- mhDC( 0 ),
+ mpGraphics( nullptr ),
+ mpInfoPrinter( nullptr ),
+ mpNextPrinter( nullptr ),
+ mhDC( nullptr ),
mnError( 0 ),
mnCopies( 0 ),
mbCollate( FALSE ),
@@ -1451,9 +1452,9 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
mnCopies = nCopies;
mbCollate = bCollate;
- LPDEVMODEW pOrgDevModeW = NULL;
- LPDEVMODEW pDevModeW = NULL;
- HDC hDC = 0;
+ DEVMODEW const * pOrgDevModeW = nullptr;
+ DEVMODEW const * pDevModeW = nullptr;
+ HDC hDC = nullptr;
if ( pSetupData && pSetupData->GetDriverData() )
{
pOrgDevModeW = SAL_DEVMODE_W( pSetupData );
@@ -1467,11 +1468,11 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
memcpy( aDevBuf, mpInfoPrinter->maDeviceName.getStr(), (mpInfoPrinter->maDeviceName.getLength()+1)*sizeof(sal_Unicode));
hDC = CreateDCW( reinterpret_cast<LPCWSTR>(aDrvBuf),
reinterpret_cast<LPCWSTR>(aDevBuf),
- NULL,
+ nullptr,
pDevModeW );
if ( pDevModeW != pOrgDevModeW )
- rtl_freeMemory( pDevModeW );
+ rtl_freeMemory( const_cast<DEVMODEW *>(pDevModeW) );
if ( !hDC )
{
@@ -1498,7 +1499,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
{
// process messages
MSG aMsg;
- if ( PeekMessageW( &aMsg, 0, 0, 0, PM_REMOVE ) )
+ if ( PeekMessageW( &aMsg, nullptr, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &aMsg );
DispatchMessageW( &aMsg );
@@ -1539,18 +1540,18 @@ bool WinSalPrinter::StartJob( const OUString* pFileName,
DOCINFOW aInfo;
memset( &aInfo, 0, sizeof( DOCINFOW ) );
aInfo.cbSize = sizeof( aInfo );
- aInfo.lpszDocName = (LPWSTR)rJobName.getStr();
+ aInfo.lpszDocName = rJobName.getStr();
if ( pFileName || aOutFileName.getLength() )
{
if ( (pFileName && !pFileName->isEmpty()) || aOutFileName.getLength() )
{
- aInfo.lpszOutput = (LPWSTR)( (pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr());
+ aInfo.lpszOutput = (pFileName && !pFileName->isEmpty()) ? pFileName->getStr() : aOutFileName.getStr();
}
else
aInfo.lpszOutput = L"FILE:";
}
else
- aInfo.lpszOutput = NULL;
+ aInfo.lpszOutput = nullptr;
// start Job
int nRet = lcl_StartDocW( hDC, &aInfo, this );
@@ -1577,7 +1578,7 @@ bool WinSalPrinter::EndJob()
{
mpGraphics->DeInitGraphics();
delete mpGraphics;
- mpGraphics = NULL;
+ mpGraphics = nullptr;
}
// #i54419# Windows fax printer brings up a dialog in EndDoc
@@ -1594,7 +1595,7 @@ bool WinSalPrinter::EndJob()
GetSalData()->mpFirstInstance->AcquireYieldMutex( nAcquire );
DeleteDC( hDC );
- mhDC = 0;
+ mhDC = nullptr;
}
return TRUE;
@@ -1602,19 +1603,19 @@ bool WinSalPrinter::EndJob()
SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobData )
{
- if( ! isValid() || mhDC == 0 )
- return NULL;
+ if( ! isValid() || mhDC == nullptr )
+ return nullptr;
HDC hDC = mhDC;
if ( pSetupData && pSetupData->GetDriverData() && bNewJobData )
{
- LPDEVMODEW pOrgDevModeW;
- LPDEVMODEW pDevModeW;
+ DEVMODEW const * pOrgDevModeW;
+ DEVMODEW const * pDevModeW;
pOrgDevModeW = SAL_DEVMODE_W( pSetupData );
pDevModeW = ImplSalSetCopies( pOrgDevModeW, mnCopies, mbCollate );
ResetDCW( hDC, pDevModeW );
if ( pDevModeW != pOrgDevModeW )
- rtl_freeMemory( pDevModeW );
+ rtl_freeMemory( const_cast<DEVMODEW *>(pDevModeW) );
}
volatile int nRet = 0;
CATCH_DRIVER_EX_BEGIN;
@@ -1625,7 +1626,7 @@ SalGraphics* WinSalPrinter::StartPage( ImplJobSetup* pSetupData, bool bNewJobDat
{
GetLastError();
mnError = SAL_PRINTER_ERROR_GENERALERROR;
- return NULL;
+ return nullptr;
}
// Hack to work around old PostScript printer drivers optimizing away empty pages
@@ -1647,7 +1648,7 @@ void WinSalPrinter::EndPage()
{
mpGraphics->DeInitGraphics();
delete mpGraphics;
- mpGraphics = NULL;
+ mpGraphics = nullptr;
}
if( ! isValid() )
diff --git a/vcl/win/gdi/salvd.cxx b/vcl/win/gdi/salvd.cxx
index 1253cb87657f..5735ccd66930 100644
--- a/vcl/win/gdi/salvd.cxx
+++ b/vcl/win/gdi/salvd.cxx
@@ -36,9 +36,9 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY,
if ( nBitCount == 1 )
{
- hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, NULL );
+ hBitmap = CreateBitmap( (int)nDX, (int)nDY, 1, 1, nullptr );
SAL_WARN_IF( !hBitmap, "vcl", "CreateBitmap failed: " << WindowsErrorString( GetLastError() ) );
- ppData = NULL;
+ ppData = nullptr;
}
else
{
@@ -62,7 +62,7 @@ HBITMAP WinSalVirtualDevice::ImplCreateVirDevBitmap(HDC hDC, long nDX, long nDY,
aBitmapInfo.bmiHeader.biClrImportant = 0;
hBitmap = CreateDIBSection( hDC, &aBitmapInfo,
- DIB_RGB_COLORS, ppData, NULL,
+ DIB_RGB_COLORS, ppData, nullptr,
0 );
SAL_WARN_IF( !hBitmap, "vcl", "CreateDIBSection failed: " << WindowsErrorString( GetLastError() ) );
}
@@ -88,15 +88,15 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
break;
}
- HDC hDC = NULL;
- HBITMAP hBmp = NULL;
+ HDC hDC = nullptr;
+ HBITMAP hBmp = nullptr;
bool bOk = FALSE;
if( pData )
{
hDC = (pData->hDC) ? pData->hDC : GetDC(pData->hWnd);
- hBmp = NULL;
- bOk = (hDC != NULL);
+ hBmp = nullptr;
+ bOk = (hDC != nullptr);
if (bOk)
{
nDX = GetDeviceCaps( hDC, HORZRES );
@@ -120,14 +120,14 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
// if we would return a failure in this case, the process
// would terminate which is not required
- bOk = (hDC != NULL);
+ bOk = (hDC != nullptr);
}
if ( bOk )
{
WinSalVirtualDevice* pVDev = new WinSalVirtualDevice;
SalData* pSalData = GetSalData();
- WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), 0, pVDev);
+ WinSalGraphics* pVirGraphics = new WinSalGraphics(WinSalGraphics::VIRTUAL_DEVICE, pGraphics->isScreen(), nullptr, pVDev);
pVirGraphics->SetLayout( SalLayoutFlags::NONE ); // by default no! mirroring for VirtualDevices, can be enabled with EnableRTL()
pVirGraphics->setHDC(hDC);
if ( pSalData->mhDitherPal && pVirGraphics->isScreen() )
@@ -144,11 +144,11 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
if( hBmp )
pVDev->mhDefBmp = SelectBitmap( hDC, hBmp );
else
- pVDev->mhDefBmp = NULL;
+ pVDev->mhDefBmp = nullptr;
pVDev->mpGraphics = pVirGraphics;
pVDev->mnBitCount = nBitCount;
pVDev->mbGraphics = FALSE;
- pVDev->mbForeignDC = (pData != NULL && pData->hDC != NULL );
+ pVDev->mbForeignDC = (pData != nullptr && pData->hDC != nullptr );
// insert VirDev in VirDevList
pVDev->mpNext = pSalData->mpFirstVD;
@@ -162,17 +162,17 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
DeleteDC( hDC );
if ( hBmp )
DeleteBitmap( hBmp );
- return NULL;
+ return nullptr;
}
}
WinSalVirtualDevice::WinSalVirtualDevice()
{
- setHDC((HDC)NULL); // HDC or 0 for Cache Device
- mhBmp = (HBITMAP) NULL; // Memory Bitmap
- mhDefBmp = (HBITMAP) NULL; // Default Bitmap
- mpGraphics = NULL; // current VirDev graphics
- mpNext = NULL; // next VirDev
+ setHDC(nullptr); // HDC or 0 for Cache Device
+ mhBmp = nullptr; // Memory Bitmap
+ mhDefBmp = nullptr; // Default Bitmap
+ mpGraphics = nullptr; // current VirDev graphics
+ mpNext = nullptr; // next VirDev
mnBitCount = 0; // BitCount (0 or 1)
mbGraphics = FALSE; // is Graphics used
mbForeignDC = FALSE; // uses a foreign DC instead of a bitmap
@@ -200,13 +200,13 @@ WinSalVirtualDevice::~WinSalVirtualDevice()
if( mhBmp )
DeleteBitmap( mhBmp );
delete mpGraphics;
- mpGraphics = NULL;
+ mpGraphics = nullptr;
}
SalGraphics* WinSalVirtualDevice::AcquireGraphics()
{
if ( mbGraphics )
- return NULL;
+ return nullptr;
if ( mpGraphics )
mbGraphics = TRUE;
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index d0f0b9a10b83..43cc3c47ff44 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -125,7 +125,7 @@ public:
gGlobalGlyphCache.get()->maGlyphCaches.erase(this);
}
- bool ReserveTextureSpace(OpenGLGlyphDrawElement& rElement, int nWidth, int nHeight)
+ static bool ReserveTextureSpace(OpenGLGlyphDrawElement& rElement, int nWidth, int nHeight)
{
GlobalGlyphCache* pGlobalGlyphCache = gGlobalGlyphCache.get();
rElement.maTexture = pGlobalGlyphCache->maPackedTextureAtlas.Reserve(nWidth, nHeight);
@@ -187,7 +187,7 @@ class WinFontInstance : public LogicalFontInstance
{
public:
explicit WinFontInstance( FontSelectPattern& );
- virtual ~WinFontInstance();
+ virtual ~WinFontInstance() override;
void setupGLyphy(HDC hDC);
private:
@@ -323,8 +323,6 @@ private:
bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const;
bool GetDWriteInkBox(IDWriteFontFace & rFontFace, WinLayout const &rLayout, float const lfEmHeight, Rectangle &) const;
- bool DrawGlyphs(const Point & origin, uint16_t * pGid, uint16_t * pGidEnd,
- float * pAdvances, Point * pOffsets) /*override*/;
ID2D1Factory * mpD2DFactory;
IDWriteFactory * mpDWriteFactory;
@@ -362,13 +360,13 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
aCodePointsOrGlyphIndices[0] = nGlyphIndex;
HDC hDC = CreateCompatibleDC(rLayout.mhDC);
- if (hDC == NULL)
+ if (hDC == nullptr)
{
SAL_WARN("vcl.gdi", "CreateCompatibleDC failed: " << WindowsErrorString(GetLastError()));
return false;
}
HFONT hOrigFont = static_cast<HFONT>(SelectObject(hDC, rLayout.mhFont));
- if (hOrigFont == NULL)
+ if (hOrigFont == nullptr)
{
SAL_WARN("vcl.gdi", "SelectObject failed: " << WindowsErrorString(GetLastError()));
DeleteDC(hDC);
@@ -482,7 +480,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
OpenGLCompatibleDC aDC(rGraphics, 0, 0, nBitmapWidth, nBitmapHeight);
- HFONT hNonAntialiasedFont = NULL;
+ HFONT hNonAntialiasedFont = nullptr;
SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
@@ -531,14 +529,14 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
default:
SAL_WARN("vcl.gdi", "DrawGlyphRun-EndDraw failed: " << WindowsErrorString(GetLastError()));
SelectFont(aDC.getCompatibleHDC(), hOrigFont);
- if (hNonAntialiasedFont != NULL)
+ if (hNonAntialiasedFont != nullptr)
DeleteObject(hNonAntialiasedFont);
return false;
}
pTxt->ReleaseFont();
- if (!maGlyphCache.ReserveTextureSpace(aElement, nBitmapWidth, nBitmapHeight))
+ if (!GlyphCache::ReserveTextureSpace(aElement, nBitmapWidth, nBitmapHeight))
return false;
if (!aDC.copyToTexture(aElement.maTexture))
return false;
@@ -546,7 +544,7 @@ bool WinFontInstance::CacheGlyphToAtlas(bool bRealGlyphIndices, int nGlyphIndex,
maGlyphCache.PutDrawElementInCache(aElement, nGlyphIndex);
SelectFont(aDC.getCompatibleHDC(), hOrigFont);
- if (hNonAntialiasedFont != NULL)
+ if (hNonAntialiasedFont != nullptr)
DeleteObject(hNonAntialiasedFont);
return true;
@@ -557,13 +555,13 @@ SimpleWinLayout::SimpleWinLayout(HDC hDC, const WinFontFace& rWinFontData,
: WinLayout(hDC, rWinFontData, rWinFontEntry, bUseOpenGL),
mnGlyphCount( 0 ),
mnCharCount( 0 ),
- mpOutGlyphs( NULL ),
- mpGlyphAdvances( NULL ),
- mpGlyphOrigAdvs( NULL ),
- mpCharWidths( NULL ),
- mpChars2Glyphs( NULL ),
- mpGlyphs2Chars( NULL ),
- mpGlyphRTLFlags( NULL ),
+ mpOutGlyphs( nullptr ),
+ mpGlyphAdvances( nullptr ),
+ mpGlyphOrigAdvs( nullptr ),
+ mpCharWidths( nullptr ),
+ mpChars2Glyphs( nullptr ),
+ mpGlyphs2Chars( nullptr ),
+ mpGlyphRTLFlags( nullptr ),
mnWidth( 0 ),
mnNotdefWidth( -1 )
{
@@ -625,7 +623,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
// - vertical layout
// - partial runs (e.g. with control chars or for glyph fallback)
// are involved
- sal_Unicode* pRewrittenStr = (sal_Unicode*)alloca( mnCharCount * sizeof(sal_Unicode) );
+ sal_Unicode* pRewrittenStr = static_cast<sal_Unicode*>(alloca( mnCharCount * sizeof(sal_Unicode) ));
pBidiStr = pRewrittenStr;
// note: glyph to char mapping is relative to first character
@@ -722,7 +720,7 @@ bool SimpleWinLayout::LayoutText( ImplLayoutArgs& rArgs )
continue;
// request glyph fallback at this position in the string
- bool bRTL = mpGlyphRTLFlags ? mpGlyphRTLFlags[i] : false;
+ bool bRTL = mpGlyphRTLFlags && mpGlyphRTLFlags[i];
int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[i]: i + rArgs.mnMinCharPos;
rArgs.NeedFallback( nCharPos, bRTL );
if( bSurrogate && ((nCharPos+1) < rArgs.mrStr.getLength()) )
@@ -923,14 +921,14 @@ bool SimpleWinLayout::DrawTextImpl(HDC hDC,
unsigned int i = 0;
for( unsigned int n = 0; n < numGlyphPortions; ++n, i+=maxGlyphCount )
{
- ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
+ ExtTextOutW(hDC, 0, 0, 0, nullptr, mpOutGlyphs+i, maxGlyphCount, mpGlyphAdvances+i);
}
- ExtTextOutW(hDC, 0, 0, 0, NULL, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
- MoveToEx(hDC, oldPos.x, oldPos.y, (LPPOINT) NULL);
+ ExtTextOutW(hDC, 0, 0, 0, nullptr, mpOutGlyphs+i, remainingGlyphs, mpGlyphAdvances+i);
+ MoveToEx(hDC, oldPos.x, oldPos.y, nullptr);
SetTextAlign(hDC, oldTa);
}
else
- ExtTextOutW(hDC, aPos.X(), aPos.Y(), 0, NULL, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
+ ExtTextOutW(hDC, aPos.X(), aPos.Y(), 0, nullptr, mpOutGlyphs, mnGlyphCount, mpGlyphAdvances);
if( hOrigFont )
DeleteFont(SelectFont(hDC, hOrigFont));
@@ -947,7 +945,7 @@ DeviceCoordinate SimpleWinLayout::FillDXArray( DeviceCoordinate* pDXArray ) cons
mnWidth += mpGlyphAdvances[ i ];
}
- if( pDXArray != NULL )
+ if( pDXArray != nullptr )
{
for( int i = 0; i < mnCharCount; ++i )
pDXArray[ i ] = mpCharWidths[ i ];
@@ -1260,38 +1258,38 @@ void WinFontInstance::setupGLyphy(HDC hDC)
OUTLINETEXTMETRICW aOutlineTextMetric;
if (!GetOutlineTextMetricsW (hDC, sizeof (OUTLINETEXTMETRICW), &aOutlineTextMetric))
{
- SAL_WARN("vcl.gdi.opengl", "GetOutlineTextMetricsW failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("vcl.gdi", "GetOutlineTextMetricsW failed: " << WindowsErrorString(GetLastError()));
return;
}
- HFONT hFont = (HFONT)GetCurrentObject(hDC, OBJ_FONT);
+ HFONT hFont = static_cast<HFONT>(GetCurrentObject(hDC, OBJ_FONT));
LOGFONTW aLogFont;
GetObjectW(hFont, sizeof(LOGFONTW), &aLogFont);
- HDC hNewDC = GetDC(NULL);
- if (hNewDC == NULL)
+ HDC hNewDC = GetDC(nullptr);
+ if (hNewDC == nullptr)
{
- SAL_WARN("vcl.gdi.opengl", "GetDC failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("vcl.gdi", "GetDC failed: " << WindowsErrorString(GetLastError()));
return;
}
hNewDC = CreateCompatibleDC(hNewDC);
- if (hNewDC == NULL)
+ if (hNewDC == nullptr)
{
- SAL_WARN("vcl.gdi.opengl", "CreateCompatibleDC failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("vcl.gdi", "CreateCompatibleDC failed: " << WindowsErrorString(GetLastError()));
return;
}
aLogFont.lfHeight = aOutlineTextMetric.otmEMSquare;
hFont = CreateFontIndirectW(&aLogFont);
- if (hFont == NULL)
+ if (hFont == nullptr)
{
- SAL_WARN("vcl.gdi.opengl", "CreateFontIndirectW failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("vcl.gdi", "CreateFontIndirectW failed: " << WindowsErrorString(GetLastError()));
return;
}
- if (SelectObject(hNewDC, hFont) == NULL)
+ if (SelectObject(hNewDC, hFont) == nullptr)
{
- SAL_WARN("vcl.gdi.opengl", "SelectObject failed: " << WindowsErrorString(GetLastError()));
+ SAL_WARN("vcl.gdi", "SelectObject failed: " << WindowsErrorString(GetLastError()));
return;
}
@@ -1304,7 +1302,7 @@ void WinFontInstance::setupGLyphy(HDC hDC)
WinLayout::WinLayout(HDC hDC, const WinFontFace& rWFD, WinFontInstance& rWFE, bool bUseOpenGL)
: mhDC( hDC ),
- mhFont( (HFONT)GetCurrentObject(hDC,OBJ_FONT) ),
+ mhFont( static_cast<HFONT>(GetCurrentObject(hDC,OBJ_FONT)) ),
mnBaseAdv( 0 ),
mfFontScale( 1.0 ),
mbUseOpenGL(bUseOpenGL),
@@ -1335,7 +1333,7 @@ void WinLayout::InitFont() const
HFONT WinLayout::DisableFontScaling() const
{
if( mfFontScale == 1.0 )
- return 0;
+ return nullptr;
LOGFONTW aLogFont;
GetObjectW( mhFont, sizeof(LOGFONTW), &aLogFont);
@@ -1343,7 +1341,7 @@ HFONT WinLayout::DisableFontScaling() const
aLogFont.lfWidth = (LONG)(mfFontScale * aLogFont.lfWidth);
HFONT hHugeFont = CreateFontIndirectW( &aLogFont);
if( !hHugeFont )
- return 0;
+ return nullptr;
return SelectFont( mhDC, hHugeFont );
}
@@ -1363,7 +1361,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
// no OpenGL, just classic rendering
Point aPos(0, 0);
int nGetNextGlypInfo(0);
- bool bContinue = DrawTextImpl(hDC, NULL, &aPos, &nGetNextGlypInfo);
+ bool bContinue = DrawTextImpl(hDC, nullptr, &aPos, &nGetNextGlypInfo);
assert(!bContinue);
}
else if (CacheGlyphs(rGraphics) &&
@@ -1456,7 +1454,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
bool SimpleWinLayout::CacheGlyphs(SalGraphics& rGraphics) const
{
- static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == NULL);
+ static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == nullptr);
if (!bDoGlyphCaching)
return false;
@@ -1614,27 +1612,27 @@ static void InitUSP()
UniscribeLayout::UniscribeLayout(HDC hDC, const WinFontFace& rWinFontData,
WinFontInstance& rWinFontEntry, bool bUseOpenGL)
: WinLayout(hDC, rWinFontData, rWinFontEntry, bUseOpenGL),
- mpScriptItems( NULL ),
- mpVisualItems( NULL ),
+ mpScriptItems( nullptr ),
+ mpVisualItems( nullptr ),
mnItemCount( 0 ),
mnCharCapacity( 0 ),
- mpLogClusters( NULL ),
- mpCharWidths( NULL ),
+ mpLogClusters( nullptr ),
+ mpCharWidths( nullptr ),
mnSubStringMin( 0 ),
mnGlyphCount( 0 ),
mnGlyphCapacity( 0 ),
- mpGlyphAdvances( NULL ),
- mpJustifications( NULL ),
- mpOutGlyphs( NULL ),
- mpGlyphOffsets( NULL ),
- mpVisualAttrs( NULL ),
- mpGlyphs2Chars( NULL ),
+ mpGlyphAdvances( nullptr ),
+ mpJustifications( nullptr ),
+ mpOutGlyphs( nullptr ),
+ mpGlyphOffsets( nullptr ),
+ mpVisualAttrs( nullptr ),
+ mpGlyphs2Chars( nullptr ),
mnMinKashidaWidth( 0 ),
mnMinKashidaGlyph( 0 ),
mbDisableGlyphInjection( false ),
mbUseGLyphy( false )
{
- static bool bUseGLyphy = std::getenv("SAL_USE_GLYPHY") != NULL;
+ static bool bUseGLyphy = std::getenv("SAL_USE_GLYPHY") != nullptr;
mbUseGLyphy = bUseGLyphy;
}
@@ -1761,18 +1759,18 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
// prepare itemization
// TODO: try to avoid itemization since it costs a lot of performance
- SCRIPT_STATE aScriptState = {0,false,false,false,false,false,false,false,false,0,0};
- aScriptState.uBidiLevel = bool(rArgs.mnFlags & SalLayoutFlags::BiDiRtl);
- aScriptState.fOverrideDirection = bool(rArgs.mnFlags & SalLayoutFlags::BiDiStrong);
- aScriptState.fDigitSubstitute = bool(rArgs.mnFlags & SalLayoutFlags::SubstituteDigits);
+ SCRIPT_STATE aScriptState = {0,WORD(false),WORD(false),WORD(false),WORD(false),WORD(false),WORD(false),WORD(false),WORD(false),0,0};
+ aScriptState.uBidiLevel = WORD(bool(rArgs.mnFlags & SalLayoutFlags::BiDiRtl));
+ aScriptState.fOverrideDirection = WORD(bool(rArgs.mnFlags & SalLayoutFlags::BiDiStrong));
+ aScriptState.fDigitSubstitute = WORD(bool(rArgs.mnFlags & SalLayoutFlags::SubstituteDigits));
aScriptState.fArabicNumContext = aScriptState.fDigitSubstitute & aScriptState.uBidiLevel;
DWORD nLangId = 0; // TODO: get language from font
SCRIPT_CONTROL aScriptControl;
memset(&aScriptControl, 0, sizeof(aScriptControl));
aScriptControl.uDefaultLanguage = nLangId;
aScriptControl.fNeutralOverride = aScriptState.fOverrideDirection;
- aScriptControl.fContextDigits = bool(rArgs.mnFlags & SalLayoutFlags::SubstituteDigits);
- aScriptControl.fMergeNeutralItems = true;
+ aScriptControl.fContextDigits = DWORD(bool(rArgs.mnFlags & SalLayoutFlags::SubstituteDigits));
+ aScriptControl.fMergeNeutralItems = DWORD(true);
// determine relevant substring and work only on it
// when Bidi status is unknown we need to look at the whole string though
@@ -1804,7 +1802,7 @@ bool UniscribeLayout::LayoutText( ImplLayoutArgs& rArgs )
// prepare bigger buffers for another itemization round
delete[] mpScriptItems;
- mpScriptItems = NULL;
+ mpScriptItems = nullptr;
if( nRC != E_OUTOFMEMORY )
return false;
if( nItemCapacity > (nSubStringEnd - mnSubStringMin) + 16 )
@@ -2707,12 +2705,12 @@ bool UniscribeLayout::DrawTextImpl(HDC hDC,
Point aPos = GetDrawPosition( aRelPos );
SCRIPT_CACHE& rScriptCache = GetScriptCache();
ScriptTextOut(hDC, &rScriptCache,
- aPos.X(), aPos.Y(), 0, NULL,
- &rVisualItem.mpScriptItem->a, NULL, 0,
+ aPos.X(), aPos.Y(), 0, nullptr,
+ &rVisualItem.mpScriptItem->a, nullptr, 0,
mpOutGlyphs + nMinGlyphPos,
nEndGlyphPos - nMinGlyphPos,
mpGlyphAdvances + nMinGlyphPos,
- mpJustifications ? mpJustifications + nMinGlyphPos : NULL,
+ mpJustifications ? mpJustifications + nMinGlyphPos : nullptr,
mpGlyphOffsets + nMinGlyphPos);
}
@@ -2724,7 +2722,7 @@ bool UniscribeLayout::DrawTextImpl(HDC hDC,
bool UniscribeLayout::CacheGlyphs(SalGraphics& rGraphics) const
{
- static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == NULL);
+ static bool bDoGlyphCaching = (std::getenv("SAL_DISABLE_GLYPH_CACHING") == nullptr);
if (!bDoGlyphCaching)
return false;
@@ -2777,38 +2775,38 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
rGraphics.GetOpenGLContext()->UseNoProgram();
- glUseProgram( mrWinFontEntry.mnGLyphyProgram );
+ glUseProgram( WinFontInstance::mnGLyphyProgram );
CHECK_GL_ERROR();
demo_atlas_set_uniforms( mrWinFontEntry.mpGLyphyAtlas );
GLint nLoc;
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_debug" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_debug" );
CHECK_GL_ERROR();
glUniform1f( nLoc, 0 );
CHECK_GL_ERROR();
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_contrast" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_contrast" );
CHECK_GL_ERROR();
glUniform1f( nLoc, 1 );
CHECK_GL_ERROR();
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_gamma_adjust" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_gamma_adjust" );
CHECK_GL_ERROR();
glUniform1f( nLoc, 1 );
CHECK_GL_ERROR();
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_outline" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_outline" );
CHECK_GL_ERROR();
- glUniform1f( nLoc, false );
+ glUniform1f( nLoc, GLfloat(false) );
CHECK_GL_ERROR();
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_outline_thickness" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_outline_thickness" );
CHECK_GL_ERROR();
glUniform1f( nLoc, 1 );
CHECK_GL_ERROR();
- nLoc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_boldness" );
+ nLoc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_boldness" );
CHECK_GL_ERROR();
glUniform1f( nLoc, 0 );
CHECK_GL_ERROR();
@@ -2888,7 +2886,7 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
pt.y = aPos.Y() + mpGlyphOffsets[i].dv;
glyph_info_t gi;
demo_font_lookup_glyph( mrWinFontEntry.mpGLyphyFont, mpOutGlyphs[i], &gi );
- demo_shader_add_glyph_vertices( pt, font_size, &gi, &vertices, NULL );
+ demo_shader_add_glyph_vertices( pt, font_size, &gi, &vertices, nullptr );
nAdvance += pGlyphWidths[i];
}
@@ -2938,23 +2936,23 @@ bool UniscribeLayout::DrawCachedGlyphsUsingGLyphy(SalGraphics& rGraphics) const
m4Translate( mat, -width/2, -height/2, 0 );
#endif
- GLuint u_matViewProjection_loc = glGetUniformLocation( mrWinFontEntry.mnGLyphyProgram, "u_matViewProjection" );
+ GLuint u_matViewProjection_loc = glGetUniformLocation( WinFontInstance::mnGLyphyProgram, "u_matViewProjection" );
CHECK_GL_ERROR();
glUniformMatrix4fv( u_matViewProjection_loc, 1, GL_FALSE, mat );
CHECK_GL_ERROR();
- GLuint a_glyph_vertex_loc = glGetAttribLocation( mrWinFontEntry.mnGLyphyProgram, "a_glyph_vertex" );
+ GLuint a_glyph_vertex_loc = glGetAttribLocation( WinFontInstance::mnGLyphyProgram, "a_glyph_vertex" );
GLuint buf_name;
glGenBuffers( 1, &buf_name );
CHECK_GL_ERROR();
glBindBuffer( GL_ARRAY_BUFFER, buf_name );
CHECK_GL_ERROR();
- glBufferData( GL_ARRAY_BUFFER, sizeof(glyph_vertex_t) * vertices.size(), (const char *) &vertices[0], GL_STATIC_DRAW );
+ glBufferData( GL_ARRAY_BUFFER, sizeof(glyph_vertex_t) * vertices.size(), &vertices[0], GL_STATIC_DRAW );
CHECK_GL_ERROR();
glEnableVertexAttribArray( a_glyph_vertex_loc );
CHECK_GL_ERROR();
- glVertexAttribPointer( a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof(glyph_vertex_t), 0 );
+ glVertexAttribPointer( a_glyph_vertex_loc, 4, GL_FLOAT, GL_FALSE, sizeof(glyph_vertex_t), nullptr );
CHECK_GL_ERROR();
glDrawArrays( GL_TRIANGLES, 0, vertices.size() );
CHECK_GL_ERROR();
@@ -3320,7 +3318,7 @@ void UniscribeLayout::ApplyDXArray( const ImplLayoutArgs& rArgs )
if( nRC != 0 )
{
delete[] mpJustifications;
- mpJustifications = NULL;
+ mpJustifications = nullptr;
break;
}
@@ -3684,7 +3682,7 @@ bool ExTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
break;
std::copy_n(glyphIntStr, nGlyphs, glyphWStr);
- ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, NULL, LPCWSTR(&glyphWStr), nGlyphs, NULL);
+ ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), nGlyphs, nullptr);
} while (!pRectToErase);
return (pRectToErase && nGlyphs >= 1);
@@ -3699,13 +3697,13 @@ D2DWriteTextOutRenderer::D2DWriteTextOutRenderer()
mpRT(nullptr),
mRTProps(D2D1::RenderTargetProperties(D2D1_RENDER_TARGET_TYPE_DEFAULT,
D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED),
- 0, 0, D2D1_RENDER_TARGET_USAGE_NONE, D2D1_FEATURE_LEVEL_DEFAULT)),
+ 0, 0)),
mpFontFace(nullptr),
mlfEmHeight(0.0f),
- mhDC(0)
+ mhDC(nullptr)
{
HRESULT hr = S_OK;
- hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), NULL, reinterpret_cast<void **>(&mpD2DFactory));
+ hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, __uuidof(ID2D1Factory), nullptr, reinterpret_cast<void **>(&mpD2DFactory));
hr = DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(&mpDWriteFactory));
if (SUCCEEDED(hr))
{
@@ -3745,7 +3743,7 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds);
succeeded &= BindDC(hDC, bounds); // Update the bounding rect.
- ID2D1SolidColorBrush* pBrush = NULL;
+ ID2D1SolidColorBrush* pBrush = nullptr;
COLORREF bgrTextColor = GetTextColor(mhDC);
succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), &pBrush));
@@ -3822,7 +3820,7 @@ bool D2DWriteTextOutRenderer::ReleaseFont()
{
mpFontFace->Release();
mpFontFace = nullptr;
- mhDC = 0;
+ mhDC = nullptr;
return true;
}
@@ -3840,7 +3838,7 @@ std::vector<Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
mpFontFace->GetMetrics(&aFontMetrics);
std::vector<DWRITE_GLYPH_METRICS> metrics(nGlyphs);
- if (!SUCCEEDED(mpFontFace->GetDesignGlyphMetrics(pGid, nGlyphs, metrics.data(), false)))
+ if (!SUCCEEDED(mpFontFace->GetDesignGlyphMetrics(pGid, nGlyphs, metrics.data())))
return std::vector<Rectangle>();
std::vector<Rectangle> aOut(nGlyphs);
@@ -3864,80 +3862,6 @@ std::vector<Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid
return aOut;
}
-bool D2DWriteTextOutRenderer::DrawGlyphs(const Point & origin, uint16_t * pGid, uint16_t * pGidEnd,
- float * pAdvances, Point * pOffsets)
-{
- Rectangle bounds;
- //bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds);
-
- Point aPos = origin;
- auto aInks = GetGlyphInkBoxes(pGid, pGidEnd);
- if (aInks.empty()) return false;
-
- // Calculate the bounding rectangle.
- auto adv = pAdvances;
- auto ofs = pOffsets;
- for (auto &b:aInks)
- {
- aPos += *ofs++;
- b += aPos;
- aPos.X() += *adv++;
- bounds.Union(b);
- }
- bool succeeded = BindDC(mhDC, bounds); // Update the bounding rect.
-
- ID2D1SolidColorBrush* pBrush = NULL;
- COLORREF bgrTextColor = GetTextColor(mhDC);
- succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), &pBrush));
-
- HRESULT hr = S_OK;
- if (succeeded)
- {
- const int MAX_GLYPHS = 20;
- UINT16 glyphIndices[MAX_GLYPHS];
- FLOAT glyphAdvances[MAX_GLYPHS];
- DWRITE_GLYPH_OFFSET glyphOffsets[MAX_GLYPHS] = { { 0.0f, 0.0f }, };
-
- mpRT->BeginDraw();
- for (size_t nGlyphs = std::min(static_cast<int>(pGidEnd - pGid), MAX_GLYPHS); pGid != pGidEnd;
- pGid += nGlyphs, nGlyphs = std::min(static_cast<int>(pGidEnd - pGid), MAX_GLYPHS))
- {
- std::copy(pGid, pGidEnd, glyphIndices);
- std::copy_n(pAdvances, nGlyphs, glyphAdvances);
- std::transform(pOffsets, pOffsets + nGlyphs,
- glyphOffsets,
- [](Point &o) { return DWRITE_GLYPH_OFFSET{static_cast<FLOAT>(o.X()), static_cast<FLOAT>(o.Y()) }; });
- D2D1_POINT_2F baseline = { origin.X() - bounds.Left(), origin.Y() - bounds.Top() };
- DWRITE_GLYPH_RUN glyphs = {
- mpFontFace,
- mlfEmHeight,
- nGlyphs,
- glyphIndices,
- glyphAdvances,
- glyphOffsets,
- false,
- 0
- };
-
- mpRT->DrawGlyphRun(baseline, &glyphs, pBrush);
- }
-
- hr = mpRT->EndDraw();
- }
-
- if (pBrush)
- pBrush->Release();
-
- if (hr == D2DERR_RECREATE_TARGET)
- {
- ReleaseFont();
- hr = CreateRenderTarget();
- }
-
- return (SUCCEEDED(hr) && succeeded);
-}
-
-
bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const
{
bool succeeded = false;
@@ -3947,14 +3871,14 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p
}
catch (const std::exception& e)
{
- SAL_WARN("vcl.gdi.opengl", "Error in dwrite while creating font face: " << e.what());
+ SAL_WARN("vcl.gdi", "Error in dwrite while creating font face: " << e.what());
return false;
}
if (succeeded)
{
LOGFONTW aLogFont;
- HFONT hFont = (HFONT)::GetCurrentObject(hDC, OBJ_FONT);
+ HFONT hFont = static_cast<HFONT>(::GetCurrentObject(hDC, OBJ_FONT));
GetObjectW(hFont, sizeof(LOGFONTW), &aLogFont);
float dpix, dpiy;
@@ -4004,11 +3928,11 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, WinLa
float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
{
- HDC hDC = reinterpret_cast<HDC>(const_cast<void*>(appFontHandle));
+ HDC hDC = static_cast<HDC>(const_cast<void*>(appFontHandle));
GLYPHMETRICS gm;
const MAT2 mat2 = {{0,1}, {0,0}, {0,0}, {0,1}};
if (GDI_ERROR == GetGlyphOutlineW(hDC, glyphId, GGO_GLYPH_INDEX | GGO_METRICS,
- &gm, 0, NULL, &mat2))
+ &gm, 0, nullptr, &mat2))
{
return .0f;
}
@@ -4016,7 +3940,7 @@ float gr_fontAdvance(const void* appFontHandle, gr_uint16 glyphId)
}
GraphiteWinLayout::GraphiteWinLayout(HDC hDC, const WinFontFace& rWFD, WinFontInstance& rWFE, bool bUseOpenGL) throw()
- : WinLayout(hDC, rWFD, rWFE, bUseOpenGL), mpFont(NULL),
+ : WinLayout(hDC, rWFD, rWFE, bUseOpenGL), mpFont(nullptr),
maImpl(rWFD.GraphiteFace(), rWFE)
{
// the log font size may differ from the font entry size if scaling is used for large fonts
@@ -4050,7 +3974,7 @@ GraphiteWinLayout::~GraphiteWinLayout()
bool GraphiteWinLayout::LayoutText(ImplLayoutArgs & args)
{
- HFONT hUnRotatedFont = 0;
+ HFONT hUnRotatedFont = nullptr;
if (args.mnOrientation)
{
// Graphite gets very confused if the font is rotated
@@ -4158,7 +4082,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
assert(mpWinFontData[nFallbackLevel]);
- WinLayout* pWinLayout = NULL;
+ WinLayout* pWinLayout = nullptr;
const WinFontFace& rFontFace = *mpWinFontData[ nFallbackLevel ];
WinFontInstance& rFontInstance = *mpWinFontEntry[ nFallbackLevel ];
@@ -4195,7 +4119,7 @@ SalLayout* WinSalGraphics::GetTextLayout( ImplLayoutArgs& rArgs, int nFallbackLe
else
#endif // ENABLE_GRAPHITE
{
- static bool bAvoidSimpleWinLayout = (std::getenv("VCL_NO_SIMPLEWINLAYOUT") != NULL);
+ static bool bAvoidSimpleWinLayout = (std::getenv("VCL_NO_SIMPLEWINLAYOUT") != nullptr);
if (!bAvoidSimpleWinLayout)
{
@@ -4241,7 +4165,7 @@ LogicalFontInstance * WinSalGraphics::GetWinFontEntry(int const nFallbackLevel)
WinFontInstance::WinFontInstance( FontSelectPattern& rFSD )
: LogicalFontInstance( rFSD )
-, mpKerningPairs( NULL )
+, mpKerningPairs( nullptr )
, mnKerningPairs( -1 )
, mpGLyphyAtlas( nullptr )
, mpGLyphyFont( nullptr )
@@ -4249,14 +4173,14 @@ WinFontInstance::WinFontInstance( FontSelectPattern& rFSD )
, mnMinKashidaWidth( -1 )
, mnMinKashidaGlyph( -1 )
{
- maScriptCache = NULL;
- mpGLyphyFont = NULL;
+ maScriptCache = nullptr;
+ mpGLyphyFont = nullptr;
mbGLyphySetupCalled = false;
}
WinFontInstance::~WinFontInstance()
{
- if( maScriptCache != NULL )
+ if( maScriptCache != nullptr )
ScriptFreeCache( &maScriptCache );
delete[] mpKerningPairs;
}
@@ -4270,7 +4194,7 @@ void WinFontInstance::SetKernData( int nPairCount, const KERNINGPAIR* pPairData
{
mnKerningPairs = nPairCount;
mpKerningPairs = new KERNINGPAIR[ mnKerningPairs ];
- memcpy( mpKerningPairs, (const void*)pPairData, nPairCount*sizeof(KERNINGPAIR) );
+ memcpy( mpKerningPairs, pPairData, nPairCount*sizeof(KERNINGPAIR) );
}
int WinFontInstance::GetKerning( sal_Unicode cLeft, sal_Unicode cRight ) const
diff --git a/vcl/win/gdi/winlayout.hxx b/vcl/win/gdi/winlayout.hxx
index 6709cb101cbc..e44befaf2a06 100644
--- a/vcl/win/gdi/winlayout.hxx
+++ b/vcl/win/gdi/winlayout.hxx
@@ -41,7 +41,7 @@ class WinLayout : public SalLayout
{
public:
WinLayout(HDC, const WinFontFace&, WinFontInstance&, bool bUseOpenGL);
- virtual ~WinLayout();
+ virtual ~WinLayout() override;
virtual void InitFont() const override;
void SetFontScale( float f ) { mfFontScale = f; }
HFONT DisableFontScaling() const;
@@ -72,7 +72,7 @@ class SimpleWinLayout : public WinLayout
{
public:
SimpleWinLayout(HDC, const WinFontFace&, WinFontInstance&, bool bUseOpenGL);
- virtual ~SimpleWinLayout();
+ virtual ~SimpleWinLayout() override;
virtual bool LayoutText( ImplLayoutArgs& ) override;
virtual void AdjustLayout( ImplLayoutArgs& ) override;
@@ -81,8 +81,8 @@ public:
virtual bool CacheGlyphs(SalGraphics& rGraphics) const override;
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const override;
virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
- DeviceCoordinate* pGlyphAdvances, int* pCharIndexes,
- const PhysicalFontFace** pFallbackFonts = NULL ) const override;
+ DeviceCoordinate* pGlyphAdvances = nullptr, int* pCharIndexes = nullptr,
+ const PhysicalFontFace** pFallbackFonts = nullptr ) const override;
virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override;
virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override;
@@ -123,8 +123,8 @@ public:
virtual bool CacheGlyphs(SalGraphics& rGraphics) const override;
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const override;
virtual int GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
- DeviceCoordinate* pGlyphAdvances, int* pCharPosAry,
- const PhysicalFontFace** pFallbackFonts = NULL ) const override;
+ DeviceCoordinate* pGlyphAdvances = nullptr, int* pCharPosAry = nullptr,
+ const PhysicalFontFace** pFallbackFonts = nullptr ) const override;
virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override;
virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override;
@@ -138,7 +138,7 @@ public:
virtual void DisableGlyphInjection( bool bDisable ) override { mbDisableGlyphInjection = bDisable; }
protected:
- virtual ~UniscribeLayout();
+ virtual ~UniscribeLayout() override;
void Justify( DeviceCoordinate nNewWidth );
void ApplyDXArray( const ImplLayoutArgs& );
@@ -192,7 +192,7 @@ public:
GraphiteLayoutWinImpl(const gr_face * pFace, WinFontInstance & rFont)
throw()
: GraphiteLayout(pFace), mrFont(rFont) {};
- virtual ~GraphiteLayoutWinImpl() throw() {};
+ virtual ~GraphiteLayoutWinImpl() throw() override {};
virtual sal_GlyphId getKashidaGlyph(int & rWidth) override;
private:
WinFontInstance & mrFont;
@@ -207,7 +207,7 @@ private:
mutable GraphiteLayoutWinImpl maImpl;
public:
GraphiteWinLayout(HDC hDC, const WinFontFace& rWFD, WinFontInstance& rWFE, bool bUseOpenGL) throw();
- virtual ~GraphiteWinLayout();
+ virtual ~GraphiteWinLayout() override;
// used by upper layers
virtual bool LayoutText( ImplLayoutArgs& ) override; // first step of layout
@@ -217,15 +217,15 @@ public:
virtual bool DrawCachedGlyphs(SalGraphics& rGraphics) const override;
// methods using string indexing
- virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra=0, int nFactor=1) const override;
+ virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const override;
virtual DeviceCoordinate FillDXArray( DeviceCoordinate* pDXArray ) const override;
virtual void GetCaretPositions( int nArraySize, long* pCaretXArray ) const override;
// methods using glyph indexing
virtual int GetNextGlyphs(int nLen, sal_GlyphId* pGlyphIdxAry, ::Point & rPos, int&,
- DeviceCoordinate* pGlyphAdvAry = NULL, int* pCharPosAry = NULL,
- const PhysicalFontFace** pFallbackFonts = NULL ) const override;
+ DeviceCoordinate* pGlyphAdvAry = nullptr, int* pCharPosAry = nullptr,
+ const PhysicalFontFace** pFallbackFonts = nullptr ) const override;
// used by glyph+font+script fallback
virtual void MoveGlyph( int nStart, long nNewXPos ) override;
diff --git a/vcl/win/window/keynames.cxx b/vcl/win/window/keynames.cxx
index 0038ae9dc211..89cbe02f581f 100644
--- a/vcl/win/window/keynames.cxx
+++ b/vcl/win/window/keynames.cxx
@@ -21,6 +21,8 @@
#include <rtl/ustring.hxx>
#include <sal/macros.h>
+#include <win/salframe.h>
+
#include <windows.h>
// Use unique ;) names to avoid clashes with the KEY_* (especially
@@ -192,7 +194,7 @@ namespace vcl_sal {
};
// translate keycodes, used within the displayed menu shortcuts
- OUString getKeysReplacementName( OUString pLang, LONG nSymbol )
+ OUString getKeysReplacementName( OUString const & pLang, LONG nSymbol )
{
for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ )
{
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 64d7cc04b4dc..c3d31b01d7f8 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -130,7 +130,7 @@ bool WinSalFrame::mbInReparent = FALSE;
#define Uni_SupplementaryPlanesStart 0x10000
static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
-static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = NULL );
+static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = nullptr );
static void ImplSaveFrameState( WinSalFrame* pFrame )
{
@@ -209,7 +209,7 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect )
vcl::Window *pWin = pFrame->GetWindow();
while( pWin )
{
- WorkWindow *pWorkWin = (pWin->GetType() == WINDOW_WORKWINDOW) ? (WorkWindow *) pWin : NULL;
+ WorkWindow *pWorkWin = (pWin->GetType() == WINDOW_WORKWINDOW) ? static_cast<WorkWindow *>(pWin) : nullptr;
if( pWorkWin && pWorkWin->ImplGetWindowImpl()->mbReallyVisible && pWorkWin->IsFullScreenMode() )
{
bIgnoreTaskbar = true;
@@ -235,7 +235,7 @@ void ImplSalGetWorkArea( HWND hWnd, RECT *pRect, const RECT *pParentRect )
}
else
{
- if( pParentRect != NULL )
+ if( pParentRect != nullptr )
{
// return the size of the monitor where pParentRect lives
HMONITOR hMonitor;
@@ -438,7 +438,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
}
hWnd = CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
- hWndParent, 0, pInst->mhInst, (void*)pFrame );
+ hWndParent, nullptr, pInst->mhInst, pFrame );
SAL_WARN_IF(!hWnd, "vcl", "CreateWindowExW failed: " << WindowsErrorString(GetLastError()));
#if OSL_DEBUG_LEVEL > 1
@@ -449,7 +449,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
if ( !hWnd )
{
delete pFrame;
- return NULL;
+ return nullptr;
}
// If we have an Window with an Caption Bar and without
@@ -479,7 +479,7 @@ SalFrame* ImplSalCreateFrame( WinSalInstance* pInst,
}
// reset input context
- pFrame->mhDefIMEContext = ImmAssociateContext( hWnd, 0 );
+ pFrame->mhDefIMEContext = ImmAssociateContext( hWnd, nullptr );
// determine output size and state
RECT aRect;
@@ -519,7 +519,7 @@ HWND ImplSalReCreateHWND( HWND hWndParent, HWND oldhWnd, bool bAsChild )
LPCWSTR pClassName = SAL_SUBFRAME_CLASSNAMEW;
return CreateWindowExW( nExSysStyle, pClassName, L"", nSysStyle,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
- hWndParent, 0, hInstance, (void*)GetWindowPtr( oldhWnd ) );
+ hWndParent, nullptr, hInstance, GetWindowPtr( oldhWnd ) );
}
// translation table from System keycodes into StartView keycodes
@@ -821,7 +821,7 @@ static void ImplSalFrameFullScreenPos( WinSalFrame* pFrame, bool bAlways = FALSE
int nWidth;
int nHeight;
ImplSalCalcFullScreenSize( pFrame, nX, nY, nWidth, nHeight );
- SetWindowPos( pFrame->mhWnd, 0,
+ SetWindowPos( pFrame->mhWnd, nullptr,
nX, nY, nWidth, nHeight,
SWP_NOZORDER | SWP_NOACTIVATE );
}
@@ -831,11 +831,11 @@ WinSalFrame::WinSalFrame()
{
SalData* pSalData = GetSalData();
- mhWnd = 0;
- mhCursor = LoadCursor( 0, IDC_ARROW );
- mhDefIMEContext = 0;
- mpGraphics = NULL;
- mpGraphics2 = NULL;
+ mhWnd = nullptr;
+ mhCursor = LoadCursor( nullptr, IDC_ARROW );
+ mhDefIMEContext = nullptr;
+ mpGraphics = nullptr;
+ mpGraphics2 = nullptr;
mnShowState = SW_SHOWNORMAL;
mnWidth = 0;
mnHeight = 0;
@@ -866,11 +866,11 @@ WinSalFrame::WinSalFrame()
mbCandidateMode = FALSE;
mbFloatWin = FALSE;
mbNoIcon = FALSE;
- mSelectedhMenu = 0;
- mLastActivatedhMenu = 0;
- mpClipRgnData = NULL;
+ mSelectedhMenu = nullptr;
+ mLastActivatedhMenu = nullptr;
+ mpClipRgnData = nullptr;
mbFirstClipRect = TRUE;
- mpNextClipRect = NULL;
+ mpNextClipRect = nullptr;
mnDisplay = 0;
mbPropertiesStored = FALSE;
@@ -920,14 +920,14 @@ WinSalFrame::~WinSalFrame()
SalData* pSalData = GetSalData();
if( mpClipRgnData )
- delete [] (BYTE*)mpClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mpClipRgnData);
// remove frame from framelist
WinSalFrame** ppFrame = &pSalData->mpFirstFrame;
for(; (*ppFrame != this) && *ppFrame; ppFrame = &(*ppFrame)->mpNextFrame );
if( *ppFrame )
*ppFrame = mpNextFrame;
- mpNextFrame = NULL;
+ mpNextFrame = nullptr;
// Release Cache DC
if ( mpGraphics2 &&
@@ -942,7 +942,7 @@ WinSalFrame::~WinSalFrame()
mpGraphics->DeInitGraphics();
ReleaseDC( mhWnd, mpGraphics->getHDC() );
delete mpGraphics;
- mpGraphics = NULL;
+ mpGraphics = nullptr;
}
if ( mhWnd )
@@ -950,11 +950,11 @@ WinSalFrame::~WinSalFrame()
// reset mouse leave data
if ( pSalData->mhWantLeaveMsg == mhWnd )
{
- pSalData->mhWantLeaveMsg = 0;
+ pSalData->mhWantLeaveMsg = nullptr;
if ( pSalData->mpMouseLeaveTimer )
{
delete pSalData->mpMouseLeaveTimer;
- pSalData->mpMouseLeaveTimer = NULL;
+ pSalData->mpMouseLeaveTimer = nullptr;
}
}
@@ -964,16 +964,16 @@ WinSalFrame::~WinSalFrame()
// destroy system frame
if ( !DestroyWindow( mhWnd ) )
- SetWindowPtr( mhWnd, 0 );
+ SetWindowPtr( mhWnd, nullptr );
- mhWnd = 0;
+ mhWnd = nullptr;
}
}
SalGraphics* WinSalFrame::AcquireGraphics()
{
if ( mbGraphics )
- return NULL;
+ return nullptr;
// Other threads get an own DC, because Windows modify in the
// other case our DC (changing clip region), when they send a
@@ -984,17 +984,17 @@ SalGraphics* WinSalFrame::AcquireGraphics()
// We use only three CacheDC's for all threads, because W9x is limited
// to max. 5 Cache DC's per thread
if ( pSalData->mnCacheDCInUse >= 3 )
- return NULL;
+ return nullptr;
if ( !mpGraphics2 )
{
mpGraphics2 = new WinSalGraphics(WinSalGraphics::WINDOW, true, mhWnd, this);
- mpGraphics2->setHDC(0);
+ mpGraphics2->setHDC(nullptr);
}
- HDC hDC = (HDC)(sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
+ HDC hDC = reinterpret_cast<HDC>((sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
SAL_MSG_GETDC,
- (WPARAM)mhWnd, 0 );
+ reinterpret_cast<WPARAM>(mhWnd), 0 ));
if ( hDC )
{
mpGraphics2->setHDC(hDC);
@@ -1010,7 +1010,7 @@ SalGraphics* WinSalFrame::AcquireGraphics()
return mpGraphics2;
}
else
- return NULL;
+ return nullptr;
}
else
{
@@ -1049,9 +1049,9 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
mpGraphics2->DeInitGraphics();
SendMessageW( pSalData->mpFirstInstance->mhComWnd,
SAL_MSG_RELEASEDC,
- (WPARAM)mhWnd,
- (LPARAM)mpGraphics2->getHDC() );
- mpGraphics2->setHDC(0);
+ reinterpret_cast<WPARAM>(mhWnd),
+ reinterpret_cast<LPARAM>(mpGraphics2->getHDC()) );
+ mpGraphics2->setHDC(nullptr);
pSalData->mnCacheDCInUse--;
}
}
@@ -1061,7 +1061,7 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics )
bool WinSalFrame::PostEvent(ImplSVEvent* pData)
{
- BOOL const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData);
+ BOOL const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, reinterpret_cast<LPARAM>(pData));
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
return static_cast<bool>(ret);
}
@@ -1080,7 +1080,7 @@ void WinSalFrame::SetIcon( sal_uInt16 nIcon )
return;
// 0 means default (class) icon
- HICON hIcon = NULL, hSmIcon = NULL;
+ HICON hIcon = nullptr, hSmIcon = nullptr;
if ( !nIcon )
nIcon = 1;
@@ -1089,8 +1089,8 @@ void WinSalFrame::SetIcon( sal_uInt16 nIcon )
SAL_WARN_IF( !hIcon , "vcl", "WinSalFrame::SetIcon(): Could not load large icon !" );
SAL_WARN_IF( !hSmIcon , "vcl", "WinSalFrame::SetIcon(): Could not load small icon !" );
- SendMessageW( mhWnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon );
- SendMessageW( mhWnd, WM_SETICON, ICON_SMALL, (LPARAM)hSmIcon );
+ SendMessageW( mhWnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(hIcon) );
+ SendMessageW( mhWnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(hSmIcon) );
}
void WinSalFrame::SetMenu( SalMenu* pSalMenu )
@@ -1155,7 +1155,7 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate )
HDC dc = GetDC( hWnd );
RECT aRect;
GetClientRect( hWnd, &aRect );
- FillRect( dc, &aRect, (HBRUSH) (COLOR_MENU+1) ); // choose the menucolor, because its mostly noticeable for menus
+ FillRect( dc, &aRect, reinterpret_cast<HBRUSH>(COLOR_MENU+1) ); // choose the menucolor, because its mostly noticeable for menus
ReleaseDC( hWnd, dc );
}
@@ -1165,7 +1165,7 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate )
if( (GetWindowStyle( hWnd ) & WS_POPUP) &&
!pFrame->mbCaption &&
(aRectPreMatrox.left != aRectPostMatrox.left || aRectPreMatrox.top != aRectPostMatrox.top) )
- SetWindowPos( hWnd, 0, aRectPreMatrox.left, aRectPreMatrox.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE );
+ SetWindowPos( hWnd, nullptr, aRectPreMatrox.left, aRectPreMatrox.top, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE );
if( aDogTag.isDeleted() )
return;
@@ -1210,7 +1210,7 @@ void WinSalFrame::Show( bool bVisible, bool bNoActivate )
// We post this message to avoid deadlocks
if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() )
{
- BOOL const ret = PostMessageW(mhWnd, SAL_MSG_SHOW, bVisible, bNoActivate);
+ BOOL const ret = PostMessageW(mhWnd, SAL_MSG_SHOW, WPARAM(bVisible), LPARAM(bNoActivate));
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
}
else
@@ -1334,7 +1334,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight,
int nScreenHeight;
RECT aRect;
- ImplSalGetWorkArea( mhWnd, &aRect, NULL );
+ ImplSalGetWorkArea( mhWnd, &aRect, nullptr );
nScreenX = aRect.left;
nScreenY = aRect.top;
nScreenWidth = aRect.right-aRect.left;
@@ -1437,7 +1437,7 @@ void WinSalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight,
// Notification -- really ???
if( nEvent != SalEvent::NONE )
- CallCallback( nEvent, NULL );
+ CallCallback( nEvent, nullptr );
}
static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAsChild )
@@ -1476,9 +1476,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
bool bNeedGraphics = pThis->mbGraphics;
bool bNeedCacheDC = FALSE;
- HFONT hFont = NULL;
- HPEN hPen = NULL;
- HBRUSH hBrush = NULL;
+ HFONT hFont = nullptr;
+ HPEN hPen = nullptr;
+ HBRUSH hBrush = nullptr;
int oldCount = pSalData->mnCacheDCInUse;
@@ -1487,9 +1487,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
pThis->mpGraphics2->getHDC() )
{
// save current gdi objects before hdc is gone
- hFont = (HFONT) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_FONT);
- hPen = (HPEN) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_PEN);
- hBrush = (HBRUSH) GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_BRUSH);
+ hFont = static_cast<HFONT>(GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_FONT));
+ hPen = static_cast<HPEN>(GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_PEN));
+ hBrush = static_cast<HBRUSH>(GetCurrentObject( pThis->mpGraphics2->getHDC(), OBJ_BRUSH));
pThis->ReleaseGraphics( pThis->mpGraphics2 );
// recreate cache dc only if it was destroyed
@@ -1508,9 +1508,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
// create a new hwnd with the same styles
HWND hWndParent = hNewParentWnd;
// forward to main thread
- HWND hWnd = (HWND) (sal_IntPtr) SendMessageW( pSalData->mpFirstInstance->mhComWnd,
+ HWND hWnd = reinterpret_cast<HWND>((sal_IntPtr) SendMessageW( pSalData->mpFirstInstance->mhComWnd,
bAsChild ? SAL_MSG_RECREATECHILDHWND : SAL_MSG_RECREATEHWND,
- (WPARAM) hWndParent, (LPARAM)pThis->mhWnd );
+ reinterpret_cast<WPARAM>(hWndParent), reinterpret_cast<LPARAM>(pThis->mhWnd) ));
// succeeded ?
SAL_WARN_IF( !IsWindow( hWnd ), "vcl", "WinSalFrame::SetParent not successful");
@@ -1525,9 +1525,9 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
if( bNeedCacheDC )
{
// re-create cached DC
- HDC hDC = (HDC)(sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
+ HDC hDC = reinterpret_cast<HDC>((sal_IntPtr)SendMessageW( pSalData->mpFirstInstance->mhComWnd,
SAL_MSG_GETDC,
- (WPARAM) hWnd, 0 );
+ reinterpret_cast<WPARAM>(hWnd), 0 ));
if ( hDC )
{
pThis->mpGraphics2->setHDC(hDC);
@@ -1575,32 +1575,32 @@ static void ImplSetParentFrame( WinSalFrame* pThis, HWND hNewParentWnd, bool bAs
// reparent children before old parent is destroyed
for( ::std::vector< WinSalFrame* >::iterator iChild = children.begin(); iChild != children.end(); ++iChild )
- ImplSetParentFrame( *iChild, hWnd, FALSE );
+ ImplSetParentFrame( *iChild, hWnd, false );
children.clear();
systemChildren.clear();
// Now destroy original HWND in the thread where it was created.
SendMessageW( GetSalData()->mpFirstInstance->mhComWnd,
- SAL_MSG_DESTROYHWND, (WPARAM) 0, (LPARAM)hWndOld);
+ SAL_MSG_DESTROYHWND, (WPARAM) 0, reinterpret_cast<LPARAM>(hWndOld));
}
void WinSalFrame::SetParent( SalFrame* pNewParent )
{
WinSalFrame::mbInReparent = TRUE;
- ImplSetParentFrame( this, static_cast<WinSalFrame*>(pNewParent)->mhWnd, FALSE );
+ ImplSetParentFrame( this, static_cast<WinSalFrame*>(pNewParent)->mhWnd, false );
WinSalFrame::mbInReparent = FALSE;
}
bool WinSalFrame::SetPluginParent( SystemParentData* pNewParent )
{
- if ( pNewParent->hWnd == 0 )
+ if ( pNewParent->hWnd == nullptr )
{
pNewParent->hWnd = GetDesktopWindow();
}
WinSalFrame::mbInReparent = TRUE;
- ImplSetParentFrame( this, pNewParent->hWnd, TRUE );
+ ImplSetParentFrame( this, pNewParent->hWnd, true );
WinSalFrame::mbInReparent = FALSE;
return true;
}
@@ -1608,7 +1608,7 @@ bool WinSalFrame::SetPluginParent( SystemParentData* pNewParent )
void WinSalFrame::GetWorkArea( Rectangle &rRect )
{
RECT aRect;
- ImplSalGetWorkArea( mhWnd, &aRect, NULL );
+ ImplSalGetWorkArea( mhWnd, &aRect, nullptr );
rRect.Left() = aRect.left;
rRect.Right() = aRect.right-1;
rRect.Top() = aRect.top;
@@ -1635,7 +1635,7 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState )
int nScreenHeight;
RECT aRect;
- ImplSalGetWorkArea( mhWnd, &aRect, NULL );
+ ImplSalGetWorkArea( mhWnd, &aRect, nullptr );
// #102500# allow some overlap, the window could have been made a little larger than the physical screen
nScreenX = aRect.left-10;
nScreenY = aRect.top-10;
@@ -1755,12 +1755,12 @@ void WinSalFrame::SetWindowState( const SalFrameState* pState )
// #96084 set a useful internal window size because
// the window will not be maximized (and the size updated) before show()
SetMaximizedFrameGeometry( mhWnd, this, &aStateRect );
- SetWindowPos( mhWnd, 0,
+ SetWindowPos( mhWnd, nullptr,
maGeometry.nX, maGeometry.nY, maGeometry.nWidth, maGeometry.nHeight,
SWP_NOZORDER | SWP_NOACTIVATE | nPosSize );
}
else
- SetWindowPos( mhWnd, 0,
+ SetWindowPos( mhWnd, nullptr,
nX, nY, nWidth, nHeight,
SWP_NOZORDER | SWP_NOACTIVATE | nPosSize );
}
@@ -1835,8 +1835,8 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
typedef HRESULT ( WINAPI *SHGETPROPERTYSTOREFORWINDOW )( HWND, REFIID, void ** );
SHGETPROPERTYSTOREFORWINDOW pSHGetPropertyStoreForWindow;
- pSHGetPropertyStoreForWindow = ( SHGETPROPERTYSTOREFORWINDOW )GetProcAddress(
- GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" );
+ pSHGetPropertyStoreForWindow = reinterpret_cast<SHGETPROPERTYSTOREFORWINDOW>(GetProcAddress(
+ GetModuleHandleW (L"shell32.dll"), "SHGetPropertyStoreForWindow" ));
if( pSHGetPropertyStoreForWindow )
{
@@ -1847,7 +1847,7 @@ void WinSalFrame::SetApplicationID( const OUString &rApplicationID )
PROPVARIANT pv;
if ( !rApplicationID.isEmpty() )
{
- hr = InitPropVariantFromString( ( PCWSTR )rApplicationID.getStr(), &pv );
+ hr = InitPropVariantFromString( rApplicationID.getStr(), &pv );
mbPropertiesStored = TRUE;
}
else
@@ -1892,7 +1892,7 @@ void WinSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay )
mnShowState = SW_SHOW;
// set window to screen size
- ImplSalFrameFullScreenPos( this, TRUE );
+ ImplSalFrameFullScreenPos( this, true );
}
else
{
@@ -1906,7 +1906,7 @@ void WinSalFrame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay )
SetWindowExStyle( mhWnd, GetWindowExStyle( mhWnd ) | WS_EX_TOOLWINDOW );
mbFullScreenToolWin = FALSE;
- SetWindowPos( mhWnd, 0,
+ SetWindowPos( mhWnd, nullptr,
maFullScreenRect.left,
maFullScreenRect.top,
maFullScreenRect.right-maFullScreenRect.left,
@@ -1942,13 +1942,13 @@ void WinSalFrame::StartPresentation( bool bStart )
SystemParametersInfo( SPI_GETSCREENSAVEACTIVE, 0,
&(pSalData->mbScrSvrEnabled), 0 );
if ( pSalData->mbScrSvrEnabled )
- SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0 );
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, FALSE, nullptr, 0 );
}
else
{
// turn on screen-saver
if ( pSalData->mbScrSvrEnabled )
- SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, pSalData->mbScrSvrEnabled, 0, 0 );
+ SystemParametersInfo( SPI_SETSCREENSAVEACTIVE, pSalData->mbScrSvrEnabled, nullptr, 0 );
}
}
@@ -1975,7 +1975,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
// should be the new foreground window.
HWND hCurrWnd = GetForegroundWindow();
DWORD myThreadID = GetCurrentThreadId();
- DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,NULL);
+ DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
AttachThreadInput(myThreadID, currThreadID,TRUE);
SetForegroundWindow(hWnd);
AttachThreadInput(myThreadID,currThreadID,FALSE);
@@ -2041,107 +2041,107 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle )
static o3tl::enumarray<PointerStyle, ImplPtrData> aImplPtrTab =
{
- ImplPtrData{ 0, IDC_ARROW, 0 }, // POINTER_ARROW
- { 0, 0, SAL_RESID_POINTER_NULL }, // POINTER_NULL
- { 0, IDC_WAIT, 0 }, // POINTER_WAIT
- { 0, IDC_IBEAM, 0 }, // POINTER_TEXT
- { 0, IDC_HELP, 0 }, // POINTER_HELP
- { 0, IDC_CROSS, 0 }, // POINTER_CROSS
- { 0, IDC_SIZEALL, 0 }, // POINTER_MOVE
- { 0, IDC_SIZENS, 0 }, // POINTER_NSIZE
- { 0, IDC_SIZENS, 0 }, // POINTER_SSIZE
- { 0, IDC_SIZEWE, 0 }, // POINTER_WSIZE
- { 0, IDC_SIZEWE, 0 }, // POINTER_ESIZE
- { 0, IDC_SIZENWSE, 0 }, // POINTER_NWSIZE
- { 0, IDC_SIZENESW, 0 }, // POINTER_NESIZE
- { 0, IDC_SIZENESW, 0 }, // POINTER_SWSIZE
- { 0, IDC_SIZENWSE, 0 }, // POINTER_SESIZE
- { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_NSIZE
- { 0, IDC_SIZENS, 0 }, // POINTER_WINDOW_SSIZE
- { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE
- { 0, IDC_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE
- { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE
- { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE
- { 0, IDC_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE
- { 0, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE
- { 0, IDC_SIZEWE, 0 }, // POINTER_HSPLIT
- { 0, IDC_SIZENS, 0 }, // POINTER_VSPLIT
- { 0, IDC_SIZEWE, 0 }, // POINTER_HSIZEBAR
- { 0, IDC_SIZENS, 0 }, // POINTER_VSIZEBAR
- { 0, IDC_HAND, 0 }, // POINTER_HAND
- { 0, IDC_HAND, 0 }, // POINTER_REFHAND
- { 0, IDC_PEN, 0 }, // POINTER_PEN
- { 0, 0, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY
- { 0, 0, SAL_RESID_POINTER_FILL }, // POINTER_FILL
- { 0, 0, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE
- { 0, 0, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR
- { 0, 0, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR
- { 0, 0, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR
- { 0, 0, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK
- { 0, 0, SAL_RESID_POINTER_CROP }, // POINTER_CROP
- { 0, 0, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT
- { 0, 0, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT
- { 0, 0, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA
- { 0, 0, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA
- { 0, 0, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA
- { 0, 0, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK
- { 0, 0, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK
- { 0, 0, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE
- { 0, 0, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE
- { 0, 0, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE
- { 0, 0, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK
- { 0, 0, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK
- { 0, 0, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES
- { 0, 0, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES
- { 0, IDC_NO, 0 }, // POINTER_NOTALLOWED
- { 0, 0, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE
- { 0, 0, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT
- { 0, 0, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON
- { 0, 0, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER
- { 0, 0, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC
- { 0, 0, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE
- { 0, 0, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT
- { 0, 0, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE
- { 0, 0, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND
- { 0, 0, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT
- { 0, 0, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT
- { 0, 0, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION
- { 0, 0, SAL_RESID_POINTER_CHART }, // POINTER_CHART
- { 0, 0, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE
- { 0, 0, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL
- { 0, 0, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW
- { 0, 0, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD
- { 0, 0, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN
- { 0, 0, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED
- { 0, 0, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE
- { 0, 0, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE
- { 0, 0, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE
- { 0, 0, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH
- { 0, 0, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL
- { 0, 0, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE
+ ImplPtrData{ nullptr, IDC_ARROW, 0 }, // POINTER_ARROW
+ { nullptr, nullptr, SAL_RESID_POINTER_NULL }, // POINTER_NULL
+ { nullptr, IDC_WAIT, 0 }, // POINTER_WAIT
+ { nullptr, IDC_IBEAM, 0 }, // POINTER_TEXT
+ { nullptr, IDC_HELP, 0 }, // POINTER_HELP
+ { nullptr, IDC_CROSS, 0 }, // POINTER_CROSS
+ { nullptr, IDC_SIZEALL, 0 }, // POINTER_MOVE
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_NSIZE
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_SSIZE
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_WSIZE
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_ESIZE
+ { nullptr, IDC_SIZENWSE, 0 }, // POINTER_NWSIZE
+ { nullptr, IDC_SIZENESW, 0 }, // POINTER_NESIZE
+ { nullptr, IDC_SIZENESW, 0 }, // POINTER_SWSIZE
+ { nullptr, IDC_SIZENWSE, 0 }, // POINTER_SESIZE
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_WINDOW_NSIZE
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_WINDOW_SSIZE
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_WINDOW_WSIZE
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_WINDOW_ESIZE
+ { nullptr, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_NWSIZE
+ { nullptr, IDC_SIZENESW, 0 }, // POINTER_WINDOW_NESIZE
+ { nullptr, IDC_SIZENESW, 0 }, // POINTER_WINDOW_SWSIZE
+ { nullptr, IDC_SIZENWSE, 0 }, // POINTER_WINDOW_SESIZE
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_HSPLIT
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_VSPLIT
+ { nullptr, IDC_SIZEWE, 0 }, // POINTER_HSIZEBAR
+ { nullptr, IDC_SIZENS, 0 }, // POINTER_VSIZEBAR
+ { nullptr, IDC_HAND, 0 }, // POINTER_HAND
+ { nullptr, IDC_HAND, 0 }, // POINTER_REFHAND
+ { nullptr, IDC_PEN, 0 }, // POINTER_PEN
+ { nullptr, nullptr, SAL_RESID_POINTER_MAGNIFY }, // POINTER_MAGNIFY
+ { nullptr, nullptr, SAL_RESID_POINTER_FILL }, // POINTER_FILL
+ { nullptr, nullptr, SAL_RESID_POINTER_ROTATE }, // POINTER_ROTATE
+ { nullptr, nullptr, SAL_RESID_POINTER_HSHEAR }, // POINTER_HSHEAR
+ { nullptr, nullptr, SAL_RESID_POINTER_VSHEAR }, // POINTER_VSHEAR
+ { nullptr, nullptr, SAL_RESID_POINTER_MIRROR }, // POINTER_MIRROR
+ { nullptr, nullptr, SAL_RESID_POINTER_CROOK }, // POINTER_CROOK
+ { nullptr, nullptr, SAL_RESID_POINTER_CROP }, // POINTER_CROP
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEPOINT }, // POINTER_MOVEPOINT
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEBEZIERWEIGHT }, // POINTER_MOVEBEZIERWEIGHT
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEDATA }, // POINTER_MOVEDATA
+ { nullptr, nullptr, SAL_RESID_POINTER_COPYDATA }, // POINTER_COPYDATA
+ { nullptr, nullptr, SAL_RESID_POINTER_LINKDATA }, // POINTER_LINKDATA
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEDATALINK }, // POINTER_MOVEDATALINK
+ { nullptr, nullptr, SAL_RESID_POINTER_COPYDATALINK }, // POINTER_COPYDATALINK
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEFILE }, // POINTER_MOVEFILE
+ { nullptr, nullptr, SAL_RESID_POINTER_COPYFILE }, // POINTER_COPYFILE
+ { nullptr, nullptr, SAL_RESID_POINTER_LINKFILE }, // POINTER_LINKFILE
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEFILELINK }, // POINTER_MOVEFILELINK
+ { nullptr, nullptr, SAL_RESID_POINTER_COPYFILELINK }, // POINTER_COPYFILELINK
+ { nullptr, nullptr, SAL_RESID_POINTER_MOVEFILES }, // POINTER_MOVEFILES
+ { nullptr, nullptr, SAL_RESID_POINTER_COPYFILES }, // POINTER_COPYFILES
+ { nullptr, IDC_NO, 0 }, // POINTER_NOTALLOWED
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_LINE }, // POINTER_DRAW_LINE
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_RECT }, // POINTER_DRAW_RECT
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_POLYGON }, // POINTER_DRAW_POLYGON
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_BEZIER }, // POINTER_DRAW_BEZIER
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_ARC }, // POINTER_DRAW_ARC
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_PIE }, // POINTER_DRAW_PIE
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_CIRCLECUT }, // POINTER_DRAW_CIRCLECUT
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_ELLIPSE }, // POINTER_DRAW_ELLIPSE
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_FREEHAND }, // POINTER_DRAW_FREEHAND
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_CONNECT }, // POINTER_DRAW_CONNECT
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_TEXT }, // POINTER_DRAW_TEXT
+ { nullptr, nullptr, SAL_RESID_POINTER_DRAW_CAPTION }, // POINTER_DRAW_CAPTION
+ { nullptr, nullptr, SAL_RESID_POINTER_CHART }, // POINTER_CHART
+ { nullptr, nullptr, SAL_RESID_POINTER_DETECTIVE }, // POINTER_DETECTIVE
+ { nullptr, nullptr, SAL_RESID_POINTER_PIVOT_COL }, // POINTER_PIVOT_COL
+ { nullptr, nullptr, SAL_RESID_POINTER_PIVOT_ROW }, // POINTER_PIVOT_ROW
+ { nullptr, nullptr, SAL_RESID_POINTER_PIVOT_FIELD }, // POINTER_PIVOT_FIELD
+ { nullptr, nullptr, SAL_RESID_POINTER_CHAIN }, // POINTER_CHAIN
+ { nullptr, nullptr, SAL_RESID_POINTER_CHAIN_NOTALLOWED }, // POINTER_CHAIN_NOTALLOWED
+ { nullptr, nullptr, SAL_RESID_POINTER_TIMEEVENT_MOVE }, // POINTER_TIMEEVENT_MOVE
+ { nullptr, nullptr, SAL_RESID_POINTER_TIMEEVENT_SIZE }, // POINTER_TIMEEVENT_SIZE
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_N }, // POINTER_AUTOSCROLL_N
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_S }, // POINTER_AUTOSCROLL_S
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_W }, // POINTER_AUTOSCROLL_W
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_E }, // POINTER_AUTOSCROLL_E
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_NW }, // POINTER_AUTOSCROLL_NW
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_NE }, // POINTER_AUTOSCROLL_NE
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_SW }, // POINTER_AUTOSCROLL_SW
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_SE }, // POINTER_AUTOSCROLL_SE
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_NS }, // POINTER_AUTOSCROLL_NS
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_WE }, // POINTER_AUTOSCROLL_WE
+ { nullptr, nullptr, SAL_RESID_POINTER_AUTOSCROLL_NSWE }, // POINTER_AUTOSCROLL_NSWE
+ { nullptr, nullptr, SAL_RESID_POINTER_AIRBRUSH }, // POINTER_AIRBRUSH
+ { nullptr, nullptr, SAL_RESID_POINTER_TEXT_VERTICAL }, // POINTER_TEXT_VERTICAL
+ { nullptr, nullptr, SAL_RESID_POINTER_PIVOT_DELETE }, // POINTER_PIVOT_DELETE
// #i32329#
- { 0, 0, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S
- { 0, 0, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E
- { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE
- { 0, 0, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W
- { 0, 0, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW
+ { nullptr, nullptr, SAL_RESID_POINTER_TAB_SELECT_S }, // POINTER_TAB_SELECT_S
+ { nullptr, nullptr, SAL_RESID_POINTER_TAB_SELECT_E }, // POINTER_TAB_SELECT_E
+ { nullptr, nullptr, SAL_RESID_POINTER_TAB_SELECT_SE }, // POINTER_TAB_SELECT_SE
+ { nullptr, nullptr, SAL_RESID_POINTER_TAB_SELECT_W }, // POINTER_TAB_SELECT_W
+ { nullptr, nullptr, SAL_RESID_POINTER_TAB_SELECT_SW }, // POINTER_TAB_SELECT_SW
// #i20119#
- { 0, 0, SAL_RESID_POINTER_PAINTBRUSH }, // POINTER_PAINTBRUSH
+ { nullptr, nullptr, SAL_RESID_POINTER_PAINTBRUSH }, // POINTER_PAINTBRUSH
- { 0, 0, SAL_RESID_POINTER_HIDEWHITESPACE }, // POINTER_HIDEWHITESPACE
- { 0, 0, SAL_RESID_POINTER_SHOWWHITESPACE } // POINTER_UNHIDEWHITESPACE
+ { nullptr, nullptr, SAL_RESID_POINTER_HIDEWHITESPACE }, // POINTER_HIDEWHITESPACE
+ { nullptr, nullptr, SAL_RESID_POINTER_SHOWWHITESPACE } // POINTER_UNHIDEWHITESPACE
};
// Mousepointer loaded ?
@@ -2150,7 +2150,7 @@ void WinSalFrame::SetPointer( PointerStyle ePointerStyle )
if ( aImplPtrTab[ePointerStyle].mnOwnId )
aImplPtrTab[ePointerStyle].mhCursor = ImplLoadSalCursor( aImplPtrTab[ePointerStyle].mnOwnId );
else
- aImplPtrTab[ePointerStyle].mhCursor = LoadCursor( 0, aImplPtrTab[ePointerStyle].mnSysId );
+ aImplPtrTab[ePointerStyle].mhCursor = LoadCursor( nullptr, aImplPtrTab[ePointerStyle].mnSysId );
}
// change the mouse pointer if different
@@ -2242,7 +2242,7 @@ static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pCont
{
pFrame->mbIME = FALSE;
pFrame->mbHandleIME = FALSE;
- ImmAssociateContext( pFrame->mhWnd, 0 );
+ ImmAssociateContext( pFrame->mhWnd, nullptr );
}
}
}
@@ -2250,7 +2250,7 @@ static void ImplSalFrameSetInputContext( HWND hWnd, const SalInputContext* pCont
void WinSalFrame::SetInputContext( SalInputContext* pContext )
{
// Must be called in the main thread!
- SendMessageW( mhWnd, SAL_MSG_SETINPUTCONTEXT, 0, (LPARAM)(void*)pContext );
+ SendMessageW( mhWnd, SAL_MSG_SETINPUTCONTEXT, 0, reinterpret_cast<LPARAM>(pContext) );
}
static void ImplSalFrameEndExtTextInput( HWND hWnd, EndExtTextInputFlags nFlags )
@@ -2375,7 +2375,7 @@ OUString WinSalFrame::GetKeyName( sal_uInt16 nKeyCode )
sal_uInt16 nCode = nKeyCode & 0x0FFF;
sal_uLong nSysCode2 = 0;
- const sal_Char* pReplace = NULL;
+ const sal_Char* pReplace = nullptr;
sal_Unicode cSVCode = 0;
sal_Char aFBuf[4];
nSysCode = 0;
@@ -2614,7 +2614,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
BYTE aValueBuf[10];
DWORD nValueSize = sizeof( aValueBuf );
DWORD nType;
- if ( RegQueryValueEx( hRegKey, "MenuShowDelay", 0,
+ if ( RegQueryValueEx( hRegKey, "MenuShowDelay", nullptr,
&nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
{
if ( nType == REG_SZ )
@@ -2739,7 +2739,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
vcl::Font aHelpFont = aStyleSettings.GetHelpFont();
vcl::Font aAppFont = aStyleSettings.GetAppFont();
vcl::Font aIconFont = aStyleSettings.GetIconFont();
- HDC hDC = GetDC( 0 );
+ HDC hDC = GetDC( nullptr );
NONCLIENTMETRICSW aNonClientMetrics;
aNonClientMetrics.cbSize = sizeof( aNonClientMetrics );
if ( SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, sizeof( aNonClientMetrics ), &aNonClientMetrics, 0 ) )
@@ -2755,7 +2755,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
ImplSalUpdateStyleFontW( hDC, aLogFont, aIconFont );
}
- ReleaseDC( 0, hDC );
+ ReleaseDC( nullptr, hDC );
aStyleSettings.SetToolbarIconSize(ToolbarIconSize::Large);
@@ -2806,7 +2806,7 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings )
DWORD nValue;
DWORD nValueSize = sizeof( aValueBuf );
DWORD nType;
- if ( RegQueryValueEx( hRegKey, "1", 0,
+ if ( RegQueryValueEx( hRegKey, "1", nullptr,
&nType, aValueBuf, &nValueSize ) == ERROR_SUCCESS )
{
if ( nType == REG_SZ )
@@ -2901,21 +2901,21 @@ void WinSalFrame::SimulateKeyPress( sal_uInt16 nKeyCode )
void WinSalFrame::ResetClipRegion()
{
- SetWindowRgn( mhWnd, 0, TRUE );
+ SetWindowRgn( mhWnd, nullptr, TRUE );
}
void WinSalFrame::BeginSetClipRegion( sal_uLong nRects )
{
if( mpClipRgnData )
- delete [] (BYTE*)mpClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mpClipRgnData);
sal_uLong nRectBufSize = sizeof(RECT)*nRects;
- mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ mpClipRgnData = reinterpret_cast<RGNDATA*>(new BYTE[sizeof(RGNDATA)-1+nRectBufSize]);
mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
mpClipRgnData->rdh.iType = RDH_RECTANGLES;
mpClipRgnData->rdh.nCount = nRects;
mpClipRgnData->rdh.nRgnSize = nRectBufSize;
SetRectEmpty( &(mpClipRgnData->rdh.rcBound) );
- mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer));
+ mpNextClipRect = reinterpret_cast<RECT*>(&(mpClipRgnData->Buffer));
mbFirstClipRect = TRUE;
}
@@ -2956,7 +2956,7 @@ void WinSalFrame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight )
pRect->top = (int)nY;
pRect->right = (int)nRight;
pRect->bottom = (int)nBottom;
- if( (mpNextClipRect - (RECT*)(&mpClipRgnData->Buffer)) < (int)mpClipRgnData->rdh.nCount )
+ if( (mpNextClipRect - reinterpret_cast<RECT*>(&mpClipRgnData->Buffer)) < (int)mpClipRgnData->rdh.nCount )
mpNextClipRect++;
}
@@ -2977,10 +2977,10 @@ void WinSalFrame::EndSetClipRegion()
else
{
sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
- hRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData );
+ hRegion = ExtCreateRegion( nullptr, nSize, mpClipRgnData );
}
- delete [] (BYTE*)mpClipRgnData;
- mpClipRgnData = NULL;
+ delete [] reinterpret_cast<BYTE*>(mpClipRgnData);
+ mpClipRgnData = nullptr;
SAL_WARN_IF( !hRegion, "vcl", "WinSalFrame::EndSetClipRegion() - Can't create ClipRegion" );
if( hRegion )
@@ -3088,11 +3088,11 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg,
SalData* pSalData = GetSalData();
if ( pSalData->mhWantLeaveMsg == hWnd )
{
- pSalData->mhWantLeaveMsg = 0;
+ pSalData->mhWantLeaveMsg = nullptr;
if ( pSalData->mpMouseLeaveTimer )
{
delete pSalData->mpMouseLeaveTimer;
- pSalData->mpMouseLeaveTimer = NULL;
+ pSalData->mpMouseLeaveTimer = nullptr;
}
// Mouse-Coordinates are relative to the screen
POINT aPt;
@@ -3306,7 +3306,7 @@ bool WinSalFrame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangT
bool bRet = FALSE;
sal_IntPtr nLangType = aLangType;
// just use the passed language identifier, do not try to load additional keyboard support
- HKL hkl = (HKL) nLangType;
+ HKL hkl = reinterpret_cast<HKL>(nLangType);
if( hkl )
{
@@ -3717,11 +3717,11 @@ static bool ImplHandlePaintMsg( HWND hWnd )
// clip-region must be reset, as we do not get a proper
// bounding-rectangle otherwise
if ( pFrame->mpGraphics && pFrame->mpGraphics->getRegion() )
- SelectClipRgn( pFrame->mpGraphics->getHDC(), 0 );
+ SelectClipRgn( pFrame->mpGraphics->getHDC(), nullptr );
// according to Window-Documentation one shall check first if
// there really is a paint-region
- if ( GetUpdateRect( hWnd, NULL, FALSE ) )
+ if ( GetUpdateRect( hWnd, nullptr, FALSE ) )
{
// Call BeginPaint/EndPaint to query the rect and send
// this Notofication to rect
@@ -3747,7 +3747,7 @@ static bool ImplHandlePaintMsg( HWND hWnd )
{
RECT* pRect = new RECT;
CopyRect( pRect, &aUpdateRect );
- BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0);
+ BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, reinterpret_cast<WPARAM>(pRect), 0);
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
}
EndPaint( hWnd, &aPs );
@@ -3785,7 +3785,7 @@ static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect )
}
else
{
- BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0);
+ BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, reinterpret_cast<WPARAM>(pRect), 0);
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
}
}
@@ -3879,7 +3879,7 @@ static void ImplCallMoveHdl( HWND hWnd )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- pFrame->CallCallback( SalEvent::Move, 0 );
+ pFrame->CallCallback( SalEvent::Move, nullptr );
// to avoid doing Paint twice by VCL and SAL
//if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
// UpdateWindow( hWnd );
@@ -3891,7 +3891,7 @@ static void ImplCallClosePopupsHdl( HWND hWnd )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- pFrame->CallCallback( SalEvent::ClosePopups, 0 );
+ pFrame->CallCallback( SalEvent::ClosePopups, nullptr );
}
}
@@ -3944,7 +3944,7 @@ static void ImplCallSizeHdl( HWND hWnd )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- pFrame->CallCallback( SalEvent::Resize, 0 );
+ pFrame->CallCallback( SalEvent::Resize, nullptr );
// to avoid double Paints by VCL and SAL
if ( IsWindowVisible( hWnd ) && !pFrame->mbInShow )
UpdateWindow( hWnd );
@@ -4000,11 +4000,11 @@ static void ImplHandleFocusMsg( HWND hWnd )
pFrame->mbHandleIME = !pFrame->mbSpezIME;
}
- pFrame->CallCallback( SalEvent::GetFocus, 0 );
+ pFrame->CallCallback( SalEvent::GetFocus, nullptr );
}
else
{
- pFrame->CallCallback( SalEvent::LoseFocus, 0 );
+ pFrame->CallCallback( SalEvent::LoseFocus, nullptr );
}
}
@@ -4024,7 +4024,7 @@ static void ImplHandleCloseMsg( HWND hWnd )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- pFrame->CallCallback( SalEvent::Close, 0 );
+ pFrame->CallCallback( SalEvent::Close, nullptr );
}
ImplSalYieldMutexRelease();
@@ -4043,7 +4043,7 @@ static long ImplHandleShutDownMsg( HWND hWnd )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- nRet = pFrame->CallCallback( SalEvent::Shutdown, 0 );
+ nRet = pFrame->CallCallback( SalEvent::Shutdown, nullptr );
}
ImplSalYieldMutexRelease();
return nRet;
@@ -4064,7 +4064,7 @@ static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg,
{
if ( lParam )
{
- if ( ImplSalWICompareAscii( (const wchar_t*)lParam, "devices" ) == 0 )
+ if ( ImplSalWICompareAscii( reinterpret_cast<const wchar_t*>(lParam), "devices" ) == 0 )
nSalEvent = SalEvent::PrinterChanged;
}
}
@@ -4091,7 +4091,7 @@ static void ImplHandleSettingsChangeMsg( HWND hWnd, UINT nMsg,
ImplSalFrameFullScreenPos( pFrame );
}
- pFrame->CallCallback( nSalEvent, 0 );
+ pFrame->CallCallback( nSalEvent, nullptr );
}
ImplSalYieldMutexRelease();
@@ -4103,7 +4103,7 @@ static void ImplHandleUserEvent( HWND hWnd, LPARAM lParam )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- pFrame->CallCallback( SalEvent::UserEvent, (void*)lParam );
+ pFrame->CallCallback( SalEvent::UserEvent, reinterpret_cast<void*>(lParam) );
}
ImplSalYieldMutexRelease();
}
@@ -4130,9 +4130,9 @@ static void ImplHandleForcePalette( HWND hWnd )
SelectPalette( pGraphics->getHDC(), hPal, FALSE );
if ( RealizePalette( pGraphics->getHDC() ) )
{
- InvalidateRect( hWnd, NULL, FALSE );
+ InvalidateRect( hWnd, nullptr, FALSE );
UpdateWindow( hWnd );
- pFrame->CallCallback( SalEvent::DisplayChanged, 0 );
+ pFrame->CallCallback( SalEvent::DisplayChanged, nullptr );
}
}
}
@@ -4155,7 +4155,7 @@ static LRESULT ImplHandlePalette( bool bFrame, HWND hWnd, UINT nMsg,
if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
{
- if ( (HWND)wParam == hWnd )
+ if ( reinterpret_cast<HWND>(wParam) == hWnd )
return 0;
}
@@ -4216,7 +4216,7 @@ static LRESULT ImplHandlePalette( bool bFrame, HWND hWnd, UINT nMsg,
}
// re-initialize palette
- WinSalFrame* pFrame = NULL;
+ WinSalFrame* pFrame = nullptr;
if ( bFrame )
pFrame = GetWindowPtr( hWnd );
if ( pFrame && pFrame->mpGraphics )
@@ -4276,9 +4276,9 @@ static LRESULT ImplHandlePalette( bool bFrame, HWND hWnd, UINT nMsg,
pGraphics = pTempFrame->mpGraphics;
if ( pGraphics && pGraphics->getDefPal() )
{
- InvalidateRect( pTempFrame->mhWnd, NULL, FALSE );
+ InvalidateRect( pTempFrame->mhWnd, nullptr, FALSE );
UpdateWindow( pTempFrame->mhWnd );
- pTempFrame->CallCallback( SalEvent::DisplayChanged, 0 );
+ pTempFrame->CallCallback( SalEvent::DisplayChanged, nullptr );
}
pTempFrame = pTempFrame->mpNextFrame;
}
@@ -4304,7 +4304,7 @@ static int ImplHandleMinMax( HWND hWnd, LPARAM lParam )
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
- MINMAXINFO* pMinMax = (MINMAXINFO*)lParam;
+ MINMAXINFO* pMinMax = reinterpret_cast<MINMAXINFO*>(lParam);
if ( pFrame->mbFullScreen )
{
@@ -4383,7 +4383,7 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, bool bByPosit
if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) )
SAL_WARN("vcl", "GetMenuItemInfoW failed: " << WindowsErrorString(GetLastError()));
- return (WinSalMenuItem *) mi.dwItemData;
+ return reinterpret_cast<WinSalMenuItem *>(mi.dwItemData);
}
// returns the index of the currently selected item if any or -1
@@ -4413,8 +4413,8 @@ static int ImplGetSelectedIndex( HMENU hMenu )
static int ImplMenuChar( HWND, WPARAM wParam, LPARAM lParam )
{
int nRet = MNC_IGNORE;
- HMENU hMenu = (HMENU) lParam;
- OUString aMnemonic( "&" + OUString((sal_Unicode) LOWORD(wParam)) );
+ HMENU hMenu = reinterpret_cast<HMENU>(lParam);
+ OUString aMnemonic( "&" + OUStringLiteral1((sal_Unicode) LOWORD(wParam)) );
aMnemonic = aMnemonic.toAsciiLowerCase(); // we only have ascii mnemonics
// search the mnemonic in the current menu
@@ -4454,11 +4454,11 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
{
// request was sent by a menu
nRet = 1;
- MEASUREITEMSTRUCT *pMI = (LPMEASUREITEMSTRUCT) lParam;
+ MEASUREITEMSTRUCT *pMI = reinterpret_cast<LPMEASUREITEMSTRUCT>(lParam);
if( pMI->CtlType != ODT_MENU )
return 0;
- WinSalMenuItem *pSalMenuItem = (WinSalMenuItem *) pMI->itemData;
+ WinSalMenuItem *pSalMenuItem = reinterpret_cast<WinSalMenuItem *>(pMI->itemData);
if( !pSalMenuItem )
return 0;
@@ -4468,12 +4468,12 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
NONCLIENTMETRICS ncm;
memset( &ncm, 0, sizeof(ncm) );
ncm.cbSize = sizeof( ncm );
- SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0 );
+ SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
// Assume every menu item can be default and printed bold
//ncm.lfMenuFont.lfWeight = FW_BOLD;
- HFONT hfntOld = (HFONT) SelectObject(hdc, (HFONT) CreateFontIndirect( &ncm.lfMenuFont ));
+ HFONT hfntOld = static_cast<HFONT>(SelectObject(hdc, CreateFontIndirect( &ncm.lfMenuFont )));
// menu text and accelerator
OUString aStr(pSalMenuItem->mText);
@@ -4482,7 +4482,7 @@ static int ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam )
aStr += " ";
aStr += pSalMenuItem->mAccelText;
}
- GetTextExtentPoint32W( hdc, (LPWSTR) aStr.getStr(),
+ GetTextExtentPoint32W( hdc, aStr.getStr(),
aStr.getLength(), &strSize );
// image
@@ -4511,11 +4511,11 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
{
// request was sent by a menu
nRet = 1;
- DRAWITEMSTRUCT *pDI = (LPDRAWITEMSTRUCT) lParam;
+ DRAWITEMSTRUCT *pDI = reinterpret_cast<LPDRAWITEMSTRUCT>(lParam);
if( pDI->CtlType != ODT_MENU )
return 0;
- WinSalMenuItem *pSalMenuItem = (WinSalMenuItem *) pDI->itemData;
+ WinSalMenuItem *pSalMenuItem = reinterpret_cast<WinSalMenuItem *>(pDI->itemData);
if( !pSalMenuItem )
return 0;
@@ -4539,7 +4539,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
DWORD colBackground = GetSysColor( fSelected ? COLOR_HIGHLIGHT : COLOR_MENU );
clrPrevBkgnd = SetBkColor( pDI->hDC, colBackground );
- hbrOld = (HBRUSH)SelectObject( pDI->hDC, CreateSolidBrush( GetBkColor( pDI->hDC ) ) );
+ hbrOld = static_cast<HBRUSH>(SelectObject( pDI->hDC, CreateSolidBrush( GetBkColor( pDI->hDC ) ) ));
// Fill background
if(!PatBlt( pDI->hDC, aRect.left, aRect.top, aRect.right-aRect.left, aRect.bottom-aRect.top, PATCOPY ))
@@ -4561,7 +4561,7 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
r.bottom = checkWidth;
HDC memDC = CreateCompatibleDC( pDI->hDC );
HBITMAP memBmp = CreateCompatibleBitmap( pDI->hDC, checkWidth, checkHeight );
- HBITMAP hOldBmp = (HBITMAP) SelectObject( memDC, memBmp );
+ HBITMAP hOldBmp = static_cast<HBITMAP>(SelectObject( memDC, memBmp ));
DrawFrameControl( memDC, &r, DFC_MENU, DFCS_MENUCHECK );
BitBlt( pDI->hDC, x, y+(lineHeight-checkHeight)/2, checkWidth, checkHeight, memDC, 0, 0, SRCAND );
DeleteObject( SelectObject( memDC, hOldBmp ) );
@@ -4579,23 +4579,22 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
if( fDisabled )
colBackground = RGB(255,255,255);
aBitmap.Replace( Color( COL_LIGHTMAGENTA ),
- Color( GetRValue(colBackground),GetGValue(colBackground),GetBValue(colBackground) ), 0);
+ Color( GetRValue(colBackground),GetGValue(colBackground),GetBValue(colBackground) ));
WinSalBitmap* pSalBmp = static_cast<WinSalBitmap*>(aBitmap.ImplGetImpBitmap()->ImplGetSalBitmap());
HGLOBAL hDrawDIB = pSalBmp->ImplGethDIB();
if( hDrawDIB )
{
- PBITMAPINFO pBI = (PBITMAPINFO) GlobalLock( hDrawDIB );
- PBITMAPINFOHEADER pBIH = (PBITMAPINFOHEADER) pBI;
- PBYTE pBits = (PBYTE) pBI + *(DWORD*) pBI +
- pSalBmp->ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD );
+ PBITMAPINFO pBI = static_cast<PBITMAPINFO>(GlobalLock( hDrawDIB ));
+ PBYTE pBits = reinterpret_cast<PBYTE>(pBI) + pBI->bmiHeader.biSize +
+ WinSalBitmap::ImplGetDIBColorCount( hDrawDIB ) * sizeof( RGBQUAD );
- HBITMAP hBmp = CreateDIBitmap( pDI->hDC, pBIH, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
+ HBITMAP hBmp = CreateDIBitmap( pDI->hDC, &pBI->bmiHeader, CBM_INIT, pBits, pBI, DIB_RGB_COLORS );
GlobalUnlock( hDrawDIB );
HBRUSH hbrIcon = CreateSolidBrush( GetSysColor( COLOR_GRAYTEXT ) );
- DrawStateW( pDI->hDC, (HBRUSH)hbrIcon, (DRAWSTATEPROC)NULL, (LPARAM)hBmp, (WPARAM)0,
+ DrawStateW( pDI->hDC, hbrIcon, nullptr, reinterpret_cast<LPARAM>(hBmp), (WPARAM)0,
x, y+(lineHeight-bmpSize.Height())/2, bmpSize.Width(), bmpSize.Height(),
DST_BITMAP | (fDisabled ? (fSelected ? DSS_MONO : DSS_DISABLED) : DSS_NORMAL) );
@@ -4610,21 +4609,21 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
NONCLIENTMETRICS ncm;
memset( &ncm, 0, sizeof(ncm) );
ncm.cbSize = sizeof( ncm );
- SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, (PVOID) &ncm, 0 );
+ SystemParametersInfo( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 );
// Print default menu entry with bold font
//if ( pDI->itemState & ODS_DEFAULT )
// ncm.lfMenuFont.lfWeight = FW_BOLD;
- hfntOld = (HFONT) SelectObject(pDI->hDC, (HFONT) CreateFontIndirect( &ncm.lfMenuFont ));
+ hfntOld = static_cast<HFONT>(SelectObject(pDI->hDC, CreateFontIndirect( &ncm.lfMenuFont )));
SIZE strSize;
OUString aStr( pSalMenuItem->mText );
- GetTextExtentPoint32W( pDI->hDC, (LPWSTR) aStr.getStr(),
+ GetTextExtentPoint32W( pDI->hDC, aStr.getStr(),
aStr.getLength(), &strSize );
- if(!DrawStateW( pDI->hDC, (HBRUSH)NULL, (DRAWSTATEPROC)NULL,
- (LPARAM)(LPWSTR) aStr.getStr(),
+ if(!DrawStateW( pDI->hDC, nullptr, nullptr,
+ reinterpret_cast<LPARAM>(aStr.getStr()),
(WPARAM)0, aRect.left, aRect.top + (lineHeight - strSize.cy)/2, 0, 0,
DST_PREFIXTEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) )
SAL_WARN("vcl", "DrawStateW failed: " << WindowsErrorString(GetLastError()));
@@ -4633,15 +4632,15 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
{
SIZE strSizeA;
aStr = pSalMenuItem->mAccelText;
- GetTextExtentPoint32W( pDI->hDC, (LPWSTR) aStr.getStr(),
+ GetTextExtentPoint32W( pDI->hDC, aStr.getStr(),
aStr.getLength(), &strSizeA );
TEXTMETRIC tm;
GetTextMetrics( pDI->hDC, &tm );
// position the accelerator string to the right but leave space for the
// (potential) submenu arrow (tm.tmMaxCharWidth)
- if(!DrawStateW( pDI->hDC, (HBRUSH)NULL, (DRAWSTATEPROC)NULL,
- (LPARAM)(LPWSTR) aStr.getStr(),
+ if(!DrawStateW( pDI->hDC, nullptr, nullptr,
+ reinterpret_cast<LPARAM>(aStr.getStr()),
(WPARAM)0, aRect.right-strSizeA.cx-tm.tmMaxCharWidth, aRect.top + (lineHeight - strSizeA.cy)/2, 0, 0,
DST_TEXT | (fDisabled && !fSelected ? DSS_DISABLED : DSS_NORMAL) ) )
SAL_WARN("vcl", "DrawStateW failed: " << WindowsErrorString(GetLastError()));
@@ -4656,14 +4655,14 @@ static int ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam )
return nRet;
}
-static int ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM )
+static bool ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM )
{
// Menu activation
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( !pFrame )
- return 0;
+ return false;
- HMENU hMenu = (HMENU) wParam;
+ HMENU hMenu = reinterpret_cast<HMENU>(wParam);
// WORD nPos = LOWORD (lParam);
// bool bWindowMenu = (bool) HIWORD(lParam);
@@ -4674,7 +4673,7 @@ static int ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM )
if( pSalMenuItem )
aMenuEvt.mpMenu = pSalMenuItem->mpMenu;
else
- aMenuEvt.mpMenu = NULL;
+ aMenuEvt.mpMenu = nullptr;
long nRet = pFrame->CallCallback( SalEvent::MenuActivate, &aMenuEvt );
if( nRet )
@@ -4685,20 +4684,20 @@ static int ImplHandleMenuActivate( HWND hWnd, WPARAM wParam, LPARAM )
return (nRet!=0);
}
-static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
+static bool ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
{
// Menu selection
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( !pFrame )
- return 0;
+ return false;
WORD nId = LOWORD(wParam); // menu item or submenu index
WORD nFlags = HIWORD(wParam);
- HMENU hMenu = (HMENU) lParam;
+ HMENU hMenu = reinterpret_cast<HMENU>(lParam);
// check if we have to process the message
if( !GetSalData()->IsKnownMenuHandle( hMenu ) )
- return 0;
+ return false;
bool bByPosition = FALSE;
if( nFlags & MF_POPUP )
@@ -4714,7 +4713,7 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
if( pSalMenuItem )
aMenuEvt.mpMenu = pSalMenuItem->mpMenu;
else
- aMenuEvt.mpMenu = NULL;
+ aMenuEvt.mpMenu = nullptr;
nRet = pFrame->CallCallback( SalEvent::MenuActivate, &aMenuEvt );
if( nRet )
@@ -4726,7 +4725,7 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
if( !hMenu && nFlags == 0xFFFF )
{
// all menus are closed, reset activation logic
- pFrame->mLastActivatedhMenu = NULL;
+ pFrame->mLastActivatedhMenu = nullptr;
}
if( hMenu )
@@ -4751,11 +4750,11 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
SalMenuEvent aMenuEvt;
aMenuEvt.mnId = nId;
- WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( hMenu, nId, FALSE );
+ WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( hMenu, nId, false );
if( pSalMenuItem )
aMenuEvt.mpMenu = pSalMenuItem->mpMenu;
else
- aMenuEvt.mpMenu = NULL;
+ aMenuEvt.mpMenu = nullptr;
nRet = pFrame->CallCallback( SalEvent::MenuHighlight, &aMenuEvt );
}
@@ -4763,11 +4762,11 @@ static int ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam )
return (nRet != 0);
}
-static int ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
+static bool ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
{
WinSalFrame* pFrame = GetWindowPtr( hWnd );
if ( !pFrame )
- return 0;
+ return false;
long nRet = 0;
if( !HIWORD(wParam) )
@@ -4778,11 +4777,11 @@ static int ImplHandleCommand( HWND hWnd, WPARAM wParam, LPARAM )
{
SalMenuEvent aMenuEvt;
aMenuEvt.mnId = nId;
- WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( pFrame->mSelectedhMenu, nId, FALSE );
+ WinSalMenuItem *pSalMenuItem = ImplGetSalMenuItem( pFrame->mSelectedhMenu, nId, false );
if( pSalMenuItem )
aMenuEvt.mpMenu = pSalMenuItem->mpMenu;
else
- aMenuEvt.mpMenu = NULL;
+ aMenuEvt.mpMenu = nullptr;
nRet = pFrame->CallCallback( SalEvent::MenuCommand, &aMenuEvt );
}
@@ -4845,7 +4844,7 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
aKeyEvt.mnRepeat = 0;
long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
- return (nRet != 0);
+ return int(nRet != 0);
}
else
{
@@ -4880,7 +4879,7 @@ static int ImplHandleSysCommand( HWND hWnd, WPARAM wParam, LPARAM lParam )
aKeyEvt.mnRepeat = 0;
long nRet = pFrame->CallCallback( SalEvent::KeyInput, &aKeyEvt );
pFrame->CallCallback( SalEvent::KeyUp, &aKeyEvt );
- return (nRet != 0);
+ return int(nRet != 0);
}
}
}
@@ -4901,7 +4900,7 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam )
if ( pFrame->mbIME && pFrame->mhDefIMEContext )
{
- HKL hKL = (HKL)lParam;
+ HKL hKL = reinterpret_cast<HKL>(lParam);
UINT nImeProps = ImmGetProperty( hKL, IGP_PROPERTY );
pFrame->mbSpezIME = (nImeProps & IME_PROP_SPECIAL_UI) != 0;
@@ -4915,7 +4914,7 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam )
// notify change
if( nLang != pFrame->mnInputLang )
- pFrame->CallCallback( SalEvent::InputLanguageChange, 0 );
+ pFrame->CallCallback( SalEvent::InputLanguageChange, nullptr );
// reinit spec. keys
GetSalData()->initKeyCodeMap();
@@ -4931,7 +4930,7 @@ static void ImplUpdateIMECursorPos( WinSalFrame* pFrame, HIMC hIMC )
// get cursor position and from it calculate default position
// for the composition window
SalExtTextInputPosEvent aPosEvt;
- pFrame->CallCallback( SalEvent::ExtTextInputPos, (void*)&aPosEvt );
+ pFrame->CallCallback( SalEvent::ExtTextInputPos, &aPosEvt );
if ( (aPosEvt.mnX == -1) && (aPosEvt.mnY == -1) )
aForm.dwStyle |= CFS_DEFAULT;
else
@@ -4946,7 +4945,7 @@ static void ImplUpdateIMECursorPos( WinSalFrame* pFrame, HIMC hIMC )
// a Windows caret to force the Position from the IME
if ( GetFocus() == pFrame->mhWnd )
{
- CreateCaret( pFrame->mhWnd, 0,
+ CreateCaret( pFrame->mhWnd, nullptr,
aPosEvt.mnWidth, aPosEvt.mnHeight );
SetCaretPos( aPosEvt.mnX, aPosEvt.mnY );
}
@@ -4987,7 +4986,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
// Init Event
SalExtTextInputEvent aEvt;
- aEvt.mpTextAttr = NULL;
+ aEvt.mpTextAttr = nullptr;
aEvt.mnCursorPos = 0;
aEvt.mnCursorFlags = 0;
@@ -4996,7 +4995,7 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
bDef = FALSE;
- LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, 0, 0 ) / sizeof( WCHAR );
+ LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, nullptr, 0 ) / sizeof( WCHAR );
if ( nTextLen >= 0 )
{
WCHAR* pTextBuf = new WCHAR[nTextLen];
@@ -5006,8 +5005,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
}
aEvt.mnCursorPos = aEvt.maText.getLength();
- pFrame->CallCallback( SalEvent::ExtTextInput, (void*)&aEvt );
- pFrame->CallCallback( SalEvent::EndExtTextInput, (void*)NULL );
+ pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt );
+ pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
ImplUpdateIMECursorPos( pFrame, hIMC );
}
@@ -5021,8 +5020,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
{
bDef = FALSE;
- ExtTextInputAttr* pSalAttrAry = NULL;
- LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 ) / sizeof( WCHAR );
+ ExtTextInputAttr* pSalAttrAry = nullptr;
+ LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, nullptr, 0 ) / sizeof( WCHAR );
if ( nTextLen > 0 )
{
WCHAR* pTextBuf = new WCHAR[nTextLen];
@@ -5030,8 +5029,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
aEvt.maText = OUString( reinterpret_cast<const sal_Unicode*>(pTextBuf), (sal_Int32)nTextLen );
delete [] pTextBuf;
- BYTE* pAttrBuf = NULL;
- LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, 0, 0 );
+ BYTE* pAttrBuf = nullptr;
+ LONG nAttrLen = ImmGetCompositionStringW( hIMC, GCS_COMPATTR, nullptr, 0 );
if ( nAttrLen > 0 )
{
pAttrBuf = new BYTE[nAttrLen];
@@ -5074,8 +5073,8 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
// End the mode, if the last character is deleted
if ( !nTextLen && !pFrame->mbCandidateMode )
{
- pFrame->CallCallback( SalEvent::ExtTextInput, (void*)&aEvt );
- pFrame->CallCallback( SalEvent::EndExtTextInput, (void*)NULL );
+ pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt );
+ pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
}
else
{
@@ -5088,14 +5087,14 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
aEvt.mnCursorPos--;
}
else
- aEvt.mnCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, 0, 0 ) );
+ aEvt.mnCursorPos = LOWORD( ImmGetCompositionStringW( hIMC, GCS_CURSORPOS, nullptr, 0 ) );
if ( pFrame->mbCandidateMode )
aEvt.mnCursorFlags |= EXTTEXTINPUT_CURSOR_INVISIBLE;
if ( lParam & CS_NOMOVECARET )
aEvt.mnCursorFlags |= EXTTEXTINPUT_CURSOR_OVERWRITE;
- pFrame->CallCallback( SalEvent::ExtTextInput, (void*)&aEvt );
+ pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt );
}
ImplUpdateIMECursorPos( pFrame, hIMC );
}
@@ -5127,11 +5126,11 @@ static bool ImplHandleIMEComposition( HWND hWnd, LPARAM lParam )
if ( !lParam )
{
SalExtTextInputEvent aEvt;
- aEvt.mpTextAttr = NULL;
+ aEvt.mpTextAttr = nullptr;
aEvt.mnCursorPos = 0;
aEvt.mnCursorFlags = 0;
- pFrame->CallCallback( SalEvent::ExtTextInput, (void*)&aEvt );
- pFrame->CallCallback( SalEvent::EndExtTextInput, (void*)NULL );
+ pFrame->CallCallback( SalEvent::ExtTextInput, &aEvt );
+ pFrame->CallCallback( SalEvent::EndExtTextInput, nullptr );
}
else if ( lParam & (GCS_RESULTSTR | GCS_COMPSTR | GCS_COMPATTR | GCS_CURSORPOS) )
{
@@ -5168,7 +5167,7 @@ static bool ImplHandleIMEEndComposition( HWND hWnd )
return bDef;
}
-static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam, LRESULT & nRet )
+static bool ImplHandleAppCommand( HWND hWnd, LPARAM lParam, LRESULT & nRet )
{
MediaCommand nCommand;
switch( GET_APPCOMMAND_LPARAM(lParam) )
@@ -5195,7 +5194,7 @@ static boolean ImplHandleAppCommand( HWND hWnd, LPARAM lParam, LRESULT & nRet )
}
WinSalFrame* pFrame = GetWindowPtr( hWnd );
- vcl::Window *pWindow = pFrame ? pFrame->GetWindow() : NULL;
+ vcl::Window *pWindow = pFrame ? pFrame->GetWindow() : nullptr;
if( pWindow )
{
@@ -5233,11 +5232,11 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam )
HIMC hIMC = ImmGetContext( hWnd2 );
if ( hIMC )
{
- LONG nBufLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, 0, 0 );
+ LONG nBufLen = ImmGetCompositionStringW( hIMC, GCS_COMPSTR, nullptr, 0 );
if ( nBufLen >= 1 )
{
SalExtTextInputPosEvent aPosEvt;
- pFrame->CallCallback( SalEvent::ExtTextInputPos, (void*)&aPosEvt );
+ pFrame->CallCallback( SalEvent::ExtTextInputPos, &aPosEvt );
// Vertical !!!
CANDIDATEFORM aForm;
@@ -5309,7 +5308,7 @@ ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet)
static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
{
WinSalFrame* pFrame = GetWindowPtr( hWnd );
- LPRECONVERTSTRING pReconvertString = (LPRECONVERTSTRING) lParam;
+ LPRECONVERTSTRING pReconvertString = reinterpret_cast<LPRECONVERTSTRING>(lParam);
LRESULT nRet = 0;
SalSurroundingTextRequestEvent aEvt;
aEvt.maText.clear();
@@ -5325,10 +5324,10 @@ static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
if( !pReconvertString )
{
// The first call for reconversion.
- pFrame->CallCallback( SalEvent::StartReconversion, (void*)NULL );
+ pFrame->CallCallback( SalEvent::StartReconversion, nullptr );
// Retrieve the surrounding text from the focused control.
- pFrame->CallCallback( SalEvent::SurroundingTextRequest, (void*)&aEvt );
+ pFrame->CallCallback( SalEvent::SurroundingTextRequest, &aEvt );
if( aEvt.maText.isEmpty())
{
@@ -5342,7 +5341,7 @@ static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
// The second call for reconversion.
// Retrieve the surrounding text from the focused control.
- pFrame->CallCallback( SalEvent::SurroundingTextRequest, (void*)&aEvt );
+ pFrame->CallCallback( SalEvent::SurroundingTextRequest, &aEvt );
nRet = sizeof(RECONVERTSTRING) + (aEvt.maText.getLength() + 1) * sizeof(WCHAR);
pReconvertString->dwStrOffset = sizeof(RECONVERTSTRING);
@@ -5352,7 +5351,7 @@ static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
pReconvertString->dwTargetStrOffset = pReconvertString->dwCompStrOffset;
pReconvertString->dwTargetStrLen = pReconvertString->dwCompStrLen;
- memcpy( (LPWSTR)(pReconvertString + 1), aEvt.maText.getStr(), (aEvt.maText.getLength() + 1) * sizeof(WCHAR) );
+ memcpy( pReconvertString + 1, aEvt.maText.getStr(), (aEvt.maText.getLength() + 1) * sizeof(WCHAR) );
}
// just return the required size of buffer to reconvert.
@@ -5362,12 +5361,12 @@ static LRESULT ImplHandleIMEReconvertString( HWND hWnd, LPARAM lParam )
static LRESULT ImplHandleIMEConfirmReconvertString( HWND hWnd, LPARAM lParam )
{
WinSalFrame* pFrame = GetWindowPtr( hWnd );
- LPRECONVERTSTRING pReconvertString = (LPRECONVERTSTRING) lParam;
+ LPRECONVERTSTRING pReconvertString = reinterpret_cast<LPRECONVERTSTRING>(lParam);
SalSurroundingTextRequestEvent aEvt;
aEvt.maText.clear();
aEvt.mnStart = aEvt.mnEnd = 0;
- pFrame->CallCallback( SalEvent::SurroundingTextRequest, (void*)&aEvt );
+ pFrame->CallCallback( SalEvent::SurroundingTextRequest, &aEvt );
sal_uLong nTmpStart = pReconvertString->dwCompStrOffset / sizeof(WCHAR);
sal_uLong nTmpEnd = nTmpStart + pReconvertString->dwCompStrLen;
@@ -5378,7 +5377,7 @@ static LRESULT ImplHandleIMEConfirmReconvertString( HWND hWnd, LPARAM lParam )
aSelEvt.mnStart = nTmpStart;
aSelEvt.mnEnd = nTmpEnd;
- pFrame->CallCallback( SalEvent::SurroundingTextSelectionChange, (void*)&aSelEvt );
+ pFrame->CallCallback( SalEvent::SurroundingTextSelectionChange, &aSelEvt );
}
return TRUE;
@@ -5386,7 +5385,7 @@ static LRESULT ImplHandleIMEConfirmReconvertString( HWND hWnd, LPARAM lParam )
static LRESULT ImplHandleIMEQueryCharPosition( HWND hWnd, LPARAM lParam ) {
WinSalFrame* pFrame = GetWindowPtr( hWnd );
- PIMECHARPOSITION pQueryCharPosition = (PIMECHARPOSITION) lParam;
+ PIMECHARPOSITION pQueryCharPosition = reinterpret_cast<PIMECHARPOSITION>(lParam);
if ( pQueryCharPosition->dwSize < sizeof(IMECHARPOSITION) )
return FALSE;
@@ -5394,7 +5393,7 @@ static LRESULT ImplHandleIMEQueryCharPosition( HWND hWnd, LPARAM lParam ) {
aEvt.mbValid = false;
aEvt.mnCharPos = pQueryCharPosition->dwCharPos;
- pFrame->CallCallback( SalEvent::QueryCharPosition, (void*)&aEvt );
+ pFrame->CallCallback( SalEvent::QueryCharPosition, &aEvt );
if ( !aEvt.mbValid )
return FALSE;
@@ -5478,9 +5477,9 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
// Save Window-Instance in Windowhandle
// Can also be used for the W-Version, because the struct
// to access lpCreateParams is the same structure
- CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
- WinSalFrame* pFrame = (WinSalFrame*)pStruct->lpCreateParams;
- if ( pFrame != 0 )
+ CREATESTRUCTA* pStruct = reinterpret_cast<CREATESTRUCTA*>(lParam);
+ WinSalFrame* pFrame = static_cast<WinSalFrame*>(pStruct->lpCreateParams);
+ if ( pFrame != nullptr )
{
SetWindowPtr( hWnd, pFrame );
// Set HWND already here, as data might be used already
@@ -5517,7 +5516,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_NCMOUSEMOVE:
case SAL_MSG_MOUSELEAVE:
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleMouseMsg( hWnd, nMsg, wParam, lParam );
+ rDef = int(!ImplHandleMouseMsg( hWnd, nMsg, wParam, lParam ));
ImplSalYieldMutexRelease();
break;
@@ -5552,7 +5551,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_SYSKEYUP:
case WM_SYSCHAR:
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleKeyMsg( hWnd, nMsg, wParam, lParam, nRet );
+ rDef = int(!ImplHandleKeyMsg( hWnd, nMsg, wParam, lParam, nRet ));
ImplSalYieldMutexRelease();
break;
@@ -5564,7 +5563,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
if ( !bInWheelMsg )
{
bInWheelMsg++;
- rDef = !ImplHandleWheelMsg( hWnd, nMsg, wParam, lParam );
+ rDef = int(!ImplHandleWheelMsg( hWnd, nMsg, wParam, lParam ));
// If we did not process the message, re-check if here is a
// connected (?) window that we have to notify.
if ( rDef )
@@ -5575,19 +5574,19 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_COMMAND:
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleCommand( hWnd, wParam, lParam );
+ rDef = int(!ImplHandleCommand( hWnd, wParam, lParam ));
ImplSalYieldMutexRelease();
break;
case WM_INITMENUPOPUP:
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleMenuActivate( hWnd, wParam, lParam );
+ rDef = int(!ImplHandleMenuActivate( hWnd, wParam, lParam ));
ImplSalYieldMutexRelease();
break;
case WM_MENUSELECT:
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleMenuSelect( hWnd, wParam, lParam );
+ rDef = int(!ImplHandleMenuSelect( hWnd, wParam, lParam ));
ImplSalYieldMutexRelease();
break;
@@ -5645,7 +5644,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
rDef = FALSE;
break;
case SAL_MSG_POSTPAINT:
- ImplHandlePaintMsg2( hWnd, (RECT*)wParam );
+ ImplHandlePaintMsg2( hWnd, reinterpret_cast<RECT*>(wParam) );
bCheckTimers = true;
rDef = FALSE;
break;
@@ -5657,7 +5656,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_QUERYNEWPALETTE:
case SAL_MSG_POSTQUERYNEWPAL:
- nRet = ImplHandlePalette( TRUE, hWnd, nMsg, wParam, lParam, rDef );
+ nRet = ImplHandlePalette( true, hWnd, nMsg, wParam, lParam, rDef );
break;
case WM_ACTIVATE:
@@ -5674,7 +5673,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
// #95133# a system dialog is opened/closed, using our app window as parent
{
WinSalFrame* pFrame = GetWindowPtr( hWnd );
- vcl::Window *pWin = NULL;
+ vcl::Window *pWin = nullptr;
if( pFrame )
pWin = pFrame->GetWindow();
@@ -5720,7 +5719,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
{
// handle queryendsession only once
bInQueryEnd = TRUE;
- nRet = !ImplHandleShutDownMsg( hWnd );
+ nRet = LRESULT(!ImplHandleShutDownMsg( hWnd ));
rDef = FALSE;
// Issue #16314#: ImplHandleShutDownMsg causes a PostMessage in case of allowing shutdown.
@@ -5733,7 +5732,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
{
MSG msg;
- while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
+ while( PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) )
{
DispatchMessage( &msg );
}
@@ -5790,11 +5789,11 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
rDef = FALSE;
break;
case SAL_MSG_SETINPUTCONTEXT:
- ImplSalFrameSetInputContext( hWnd, (const SalInputContext*)(void*)lParam );
+ ImplSalFrameSetInputContext( hWnd, reinterpret_cast<const SalInputContext*>(lParam) );
rDef = FALSE;
break;
case SAL_MSG_ENDEXTTEXTINPUT:
- ImplSalFrameEndExtTextInput( hWnd, (EndExtTextInputFlags)(sal_uLong)(void*)wParam );
+ ImplSalFrameEndExtTextInput( hWnd, (EndExtTextInputFlags)wParam );
rDef = FALSE;
break;
@@ -5807,20 +5806,20 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
// may send WM_IME_CHAR instead of WM_IME_COMPOSITION
// we just handle it like a WM_CHAR message - seems to work fine
ImplSalYieldMutexAcquireWithWait();
- rDef = !ImplHandleKeyMsg( hWnd, WM_CHAR, wParam, lParam, nRet );
+ rDef = int(!ImplHandleKeyMsg( hWnd, WM_CHAR, wParam, lParam, nRet ));
ImplSalYieldMutexRelease();
break;
case WM_IME_STARTCOMPOSITION:
- rDef = ImplHandleIMEStartComposition( hWnd );
+ rDef = int(ImplHandleIMEStartComposition( hWnd ));
break;
case WM_IME_COMPOSITION:
- rDef = ImplHandleIMEComposition( hWnd, lParam );
+ rDef = int(ImplHandleIMEComposition( hWnd, lParam ));
break;
case WM_IME_ENDCOMPOSITION:
- rDef = ImplHandleIMEEndComposition( hWnd );
+ rDef = int(ImplHandleIMEEndComposition( hWnd ));
break;
case WM_IME_NOTIFY:
@@ -5831,7 +5830,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
ImplSalYieldMutexAcquireWithWait();
if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) )
{
- rDef = false;
+ rDef = int(false);
}
ImplSalYieldMutexRelease();
break;
@@ -5839,7 +5838,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
case WM_APPCOMMAND:
if( ImplHandleAppCommand( hWnd, lParam, nRet ) )
{
- rDef = false;
+ rDef = int(false);
}
break;
case WM_IME_REQUEST:
@@ -5876,7 +5875,7 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
if( pSalData->mnNextTimerTime < nCurTime )
{
MSG aMsg;
- if( ! PeekMessageW( &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE | PM_NOYIELD ) )
+ if( ! PeekMessageW( &aMsg, nullptr, WM_PAINT, WM_PAINT, PM_NOREMOVE | PM_NOYIELD ) )
{
BOOL const ret = PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, nCurTime);
SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!");
@@ -5925,7 +5924,7 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR
if ( (nMsg == WM_PALETTECHANGED) || (nMsg == SAL_MSG_POSTPALCHANGED) )
{
int bDef = TRUE;
- rlResult = ImplHandlePalette( FALSE, hWnd, nMsg, wParam, lParam, bDef );
+ rlResult = ImplHandlePalette( false, hWnd, nMsg, wParam, lParam, bDef );
bResult = (bDef != 0);
}
else if( nMsg == WM_DISPLAYCHANGE )
@@ -5933,7 +5932,7 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR
WinSalSystem* pSys = static_cast<WinSalSystem*>(ImplGetSalSystem());
if( pSys )
pSys->clearMonitors();
- bResult = (pSys != NULL);
+ bResult = (pSys != nullptr);
}
return bResult;
}
diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx
index 0b623e25b1b4..b357bcfdc004 100644
--- a/vcl/win/window/salmenu.cxx
+++ b/vcl/win/window/salmenu.cxx
@@ -48,7 +48,7 @@ SalMenu* WinSalInstance::CreateMenu( bool bMenuBar, Menu* )
WinSalMenu *pSalMenu = new WinSalMenu();
pSalMenu->mbMenuBar = bMenuBar;
- pSalMenu->mhWnd = NULL;
+ pSalMenu->mhWnd = nullptr;
if( bMenuBar )
pSalMenu->mhMenu = ::CreateMenu();
else
@@ -68,7 +68,7 @@ void WinSalInstance::DestroyMenu( SalMenu* pSalMenu )
SalMenuItem* WinSalInstance::CreateMenuItem( const SalItemParams* pItemData )
{
if( !pItemData )
- return NULL;
+ return nullptr;
WinSalMenuItem *pSalMenuItem = new WinSalMenuItem();
memset( &pSalMenuItem->mInfo, 0, sizeof( MENUITEMINFOW ) );
@@ -93,11 +93,11 @@ SalMenuItem* WinSalInstance::CreateMenuItem( const SalItemParams* pItemData )
pSalMenuItem->mInfo.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID | MIIM_DATA;
pSalMenuItem->mInfo.fType = MFT_STRING;
- pSalMenuItem->mInfo.dwTypeData = (LPWSTR) pSalMenuItem->mText.getStr();
+ pSalMenuItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(pSalMenuItem->mText.getStr());
pSalMenuItem->mInfo.cch = pSalMenuItem->mText.getLength();
pSalMenuItem->mInfo.wID = pItemData->nId;
- pSalMenuItem->mInfo.dwItemData = (ULONG_PTR) pSalMenuItem; // user data
+ pSalMenuItem->mInfo.dwItemData = reinterpret_cast<ULONG_PTR>(pSalMenuItem); // user data
}
return pSalMenuItem;
@@ -127,10 +127,10 @@ static void ImplDrawMenuBar( SalMenu *pMenu )
WinSalMenu::WinSalMenu()
{
- mhMenu = NULL;
+ mhMenu = nullptr;
mbMenuBar = FALSE;
- mhWnd = NULL;
- mpParentMenu = NULL;
+ mhWnd = nullptr;
+ mpParentMenu = nullptr;
}
WinSalMenu::~WinSalMenu()
@@ -160,7 +160,7 @@ void WinSalMenu::SetFrame( const SalFrame *pFrame )
if( pFrame )
mhWnd = static_cast<const WinSalFrame*>(pFrame)->mhWnd;
else
- mhWnd = NULL;
+ mhWnd = nullptr;
}
void WinSalMenu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
@@ -190,7 +190,7 @@ void WinSalMenu::RemoveItem( unsigned nPos )
int num = ::GetMenuItemCount( mhMenu );
if( num != -1 && nPos < (unsigned)num )
{
- WinSalMenuItem *pSalMenuItem = NULL;
+ WinSalMenuItem *pSalMenuItem = nullptr;
MENUITEMINFOW mi;
memset( &mi, 0, sizeof(mi) );
@@ -199,14 +199,14 @@ void WinSalMenu::RemoveItem( unsigned nPos )
if( !GetMenuItemInfoW( mhMenu, nPos, TRUE, &mi) )
myerr = GetLastError();
else
- pSalMenuItem = (WinSalMenuItem *) mi.dwItemData;
+ pSalMenuItem = reinterpret_cast<WinSalMenuItem *>(mi.dwItemData);
if( !::RemoveMenu( mhMenu, nPos, MF_BYPOSITION ) )
myerr = GetLastError();
else
{
if( pSalMenuItem )
- pSalMenuItem->mpSalMenu = NULL;
+ pSalMenuItem->mpSalMenu = nullptr;
ImplDrawMenuBar( this );
}
}
@@ -217,7 +217,7 @@ void ImplRemoveItemById( WinSalMenu *pSalMenu, unsigned nItemId )
if( !pSalMenu )
return;
- WinSalMenuItem *pSalMenuItem = NULL;
+ WinSalMenuItem *pSalMenuItem = nullptr;
MENUITEMINFOW mi;
memset( &mi, 0, sizeof(mi) );
@@ -226,14 +226,14 @@ void ImplRemoveItemById( WinSalMenu *pSalMenu, unsigned nItemId )
if( !GetMenuItemInfoW( pSalMenu->mhMenu, nItemId, FALSE, &mi) )
myerr = GetLastError();
else
- pSalMenuItem = (WinSalMenuItem *) mi.dwItemData;
+ pSalMenuItem = reinterpret_cast<WinSalMenuItem *>(mi.dwItemData);
if( !::RemoveMenu( pSalMenu->mhMenu, nItemId, MF_BYCOMMAND ) )
myerr = GetLastError();
else
{
if( pSalMenuItem )
- pSalMenuItem->mpSalMenu = NULL;
+ pSalMenuItem->mpSalMenu = nullptr;
ImplDrawMenuBar( pSalMenu );
}
}
@@ -252,7 +252,7 @@ void WinSalMenu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsig
pWMenuItem->mInfo.fMask |= MIIM_SUBMENU;
if( !pSubMenu )
- pWMenuItem->mInfo.hSubMenu = NULL;
+ pWMenuItem->mInfo.hSubMenu = nullptr;
else
{
pWMenuItem->mInfo.hSubMenu = pWSubMenu->mhMenu;
@@ -307,7 +307,7 @@ void WinSalMenu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OU
{
aStr += "\t" + pWItem->mAccelText;
}
- pWItem->mInfo.dwTypeData = (LPWSTR) aStr.getStr();
+ pWItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(aStr.getStr());
pWItem->mInfo.cch = aStr.getLength();
if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))
@@ -332,7 +332,7 @@ void WinSalMenu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const
{
aStr += "\t" + pWItem->mAccelText;
}
- pWItem->mInfo.dwTypeData = (LPWSTR) aStr.getStr();
+ pWItem->mInfo.dwTypeData = const_cast<sal_Unicode *>(aStr.getStr());
pWItem->mInfo.cch = aStr.getLength();
if(!::SetMenuItemInfoW( mhMenu, nPos, TRUE, &pWItem->mInfo ))
@@ -355,9 +355,9 @@ void WinSalMenu::GetSystemMenuData( SystemMenuData* pData )
WinSalMenuItem::WinSalMenuItem()
{
memset( &mInfo, 0, sizeof( MENUITEMINFOW ) );
- mpMenu = NULL;
+ mpMenu = nullptr;
mnId = 0xFFFF;
- mpSalMenu = NULL;
+ mpSalMenu = nullptr;
}
WinSalMenuItem::~WinSalMenuItem()
diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx
index 9dcc29e52854..f21dfb7ade9d 100644
--- a/vcl/win/window/salobj.cxx
+++ b/vcl/win/window/salobj.cxx
@@ -61,12 +61,12 @@ WinSalObject* ImplFindSalObject( HWND hWndChild )
pObject = pObject->mpNextObject;
}
- return NULL;
+ return nullptr;
}
WinSalFrame* ImplFindSalObjectFrame( HWND hWnd )
{
- WinSalFrame* pFrame = NULL;
+ WinSalFrame* pFrame = nullptr;
WinSalObject* pObject = ImplFindSalObject( hWnd );
if ( pObject )
{
@@ -92,7 +92,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
if ( (nCode >= 0) && lParam )
{
- CWPSTRUCT* pData = (CWPSTRUCT*)lParam;
+ CWPSTRUCT* pData = reinterpret_cast<CWPSTRUCT*>(lParam);
if ( (pData->message != WM_KEYDOWN) &&
(pData->message != WM_KEYUP) )
pSalData->mnSalObjWantKeyEvt = 0;
@@ -108,7 +108,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
pObject->mhLastFocusWnd = pData->hwnd;
if ( ImplSalYieldMutexTryToAcquire() )
{
- pObject->CallCallback( SalObjEvent::GetFocus, 0 );
+ pObject->CallCallback( SalObjEvent::GetFocus, nullptr );
ImplSalYieldMutexRelease();
}
else
@@ -121,14 +121,14 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
else if ( pData->message == WM_KILLFOCUS )
{
pObject = ImplFindSalObject( pData->hwnd );
- if ( pObject && !ImplFindSalObject( (HWND)pData->wParam ) )
+ if ( pObject && !ImplFindSalObject( reinterpret_cast<HWND>(pData->wParam) ) )
{
// only call LoseFocus, if truly no child window gets the focus
- if ( !pData->wParam || !ImplFindSalObject( (HWND)pData->wParam ) )
+ if ( !pData->wParam || !ImplFindSalObject( reinterpret_cast<HWND>(pData->wParam) ) )
{
if ( ImplSalYieldMutexTryToAcquire() )
{
- pObject->CallCallback( SalObjEvent::LoseFocus, 0 );
+ pObject->CallCallback( SalObjEvent::LoseFocus, nullptr );
ImplSalYieldMutexRelease();
}
else
@@ -138,7 +138,7 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam )
}
}
else
- pObject->mhLastFocusWnd = (HWND)pData->wParam;
+ pObject->mhLastFocusWnd = reinterpret_cast<HWND>(pData->wParam);
}
}
}
@@ -286,7 +286,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
ImplSalYieldMutexAcquireWithWait();
pSysObj = GetSalObjWindowPtr( hWnd );
if ( pSysObj && !pSysObj->IsMouseTransparent() )
- pSysObj->CallCallback( SalObjEvent::ToTop, 0 );
+ pSysObj->CallCallback( SalObjEvent::ToTop, nullptr );
ImplSalYieldMutexRelease();
}
}
@@ -309,7 +309,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
if ( ImplSalYieldMutexTryToAcquire() )
{
pSysObj = GetSalObjWindowPtr( hWnd );
- pSysObj->CallCallback( SalObjEvent::ToTop, 0 );
+ pSysObj->CallCallback( SalObjEvent::ToTop, nullptr );
ImplSalYieldMutexRelease();
rDef = FALSE;
}
@@ -330,7 +330,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
nEvent = SalObjEvent::GetFocus;
else
nEvent = SalObjEvent::LoseFocus;
- pSysObj->CallCallback( nEvent, 0 );
+ pSysObj->CallCallback( nEvent, nullptr );
ImplSalYieldMutexRelease();
}
else
@@ -347,7 +347,7 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
if ( hWndChild )
{
SetWindowPos( hWndChild,
- 0, 0, 0, (int)LOWORD( lParam ), (int)HIWORD( lParam ),
+ nullptr, 0, 0, (int)LOWORD( lParam ), (int)HIWORD( lParam ),
SWP_NOZORDER | SWP_NOACTIVATE );
}
}
@@ -359,8 +359,8 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l
// Window-Instanz am Windowhandle speichern
// Can also be used for the W-Version, because the struct
// to access lpCreateParams is the same structure
- CREATESTRUCTA* pStruct = (CREATESTRUCTA*)lParam;
- pSysObj = (WinSalObject*)pStruct->lpCreateParams;
+ CREATESTRUCTA* pStruct = reinterpret_cast<CREATESTRUCTA*>(lParam);
+ pSysObj = static_cast<WinSalObject*>(pStruct->lpCreateParams);
SetSalObjWindowPtr( hWnd, pSysObj );
// set HWND already here,
// as instance data might be used during CreateWindow() events
@@ -475,17 +475,17 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent )
aWndClassEx.cbClsExtra = 0;
aWndClassEx.cbWndExtra = SAL_OBJECT_WNDEXTRA;
aWndClassEx.hInstance = pSalData->mhInst;
- aWndClassEx.hIcon = 0;
- aWndClassEx.hIconSm = 0;
- aWndClassEx.hCursor = LoadCursor( 0, IDC_ARROW );
- aWndClassEx.hbrBackground = 0;
- aWndClassEx.lpszMenuName = 0;
+ aWndClassEx.hIcon = nullptr;
+ aWndClassEx.hIconSm = nullptr;
+ aWndClassEx.hCursor = LoadCursor( nullptr, IDC_ARROW );
+ aWndClassEx.hbrBackground = nullptr;
+ aWndClassEx.lpszMenuName = nullptr;
aWndClassEx.lpszClassName = SAL_OBJECT_CLASSNAMEA;
if ( RegisterClassExA( &aWndClassEx ) )
{
// Clean background first because of plugins.
aWndClassEx.cbWndExtra = 0;
- aWndClassEx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ aWndClassEx.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW+1);
aWndClassEx.lpfnWndProc = SalSysObjChildWndProcA;
aWndClassEx.lpszClassName = SAL_OBJECT_CHILDCLASSNAMEA;
if ( RegisterClassExA( &aWndClassEx ) )
@@ -503,10 +503,10 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent )
// animations .
HWND hWnd = CreateWindowExA( 0, SAL_OBJECT_CLASSNAMEA, "",
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 0, 0,
- pParent->mhWnd, 0,
- pInst->mhInst, (void*)pObject );
+ pParent->mhWnd, nullptr,
+ pInst->mhInst, pObject );
- HWND hWndChild = 0;
+ HWND hWndChild = nullptr;
if ( hWnd )
{
// #135235# Explicitely stack SystemChildWindows in
@@ -517,8 +517,8 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent )
hWndChild = CreateWindowExA( 0, SAL_OBJECT_CHILDCLASSNAMEA, "",
WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE,
0, 0, 0, 0,
- hWnd, 0,
- pInst->mhInst, NULL );
+ hWnd, nullptr,
+ pInst->mhInst, nullptr );
}
if ( !hWndChild )
@@ -533,7 +533,7 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent )
MessageBoxA(NULL, msg, "CreateWindowExA failed", MB_OK);
#endif
delete pObject;
- return NULL;
+ return nullptr;
}
if ( hWnd )
@@ -545,18 +545,18 @@ SalObject* ImplSalCreateObject( WinSalInstance* pInst, WinSalFrame* pParent )
}
}
- return NULL;
+ return nullptr;
}
WinSalObject::WinSalObject()
{
SalData* pSalData = GetSalData();
- mhWnd = 0;
- mhWndChild = 0;
- mhLastFocusWnd = 0;
+ mhWnd = nullptr;
+ mhWndChild = nullptr;
+ mhLastFocusWnd = nullptr;
maSysData.nSize = sizeof( SystemEnvData );
- mpStdClipRgnData = NULL;
+ mpStdClipRgnData = nullptr;
// Insert object in objectlist
mpNextObject = pSalData->mpFirstObject;
@@ -586,7 +586,7 @@ WinSalObject::~WinSalObject()
}
// Cache-Daten zerstoeren
- delete [] (BYTE*)mpStdClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mpStdClipRgnData);
HWND hWndParent = ::GetParent( mhWnd );
@@ -605,7 +605,7 @@ WinSalObject::~WinSalObject()
void WinSalObject::ResetClipRegion()
{
- SetWindowRgn( mhWnd, 0, TRUE );
+ SetWindowRgn( mhWnd, nullptr, TRUE );
}
void WinSalObject::BeginSetClipRegion( sal_uLong nRectCount )
@@ -614,17 +614,17 @@ void WinSalObject::BeginSetClipRegion( sal_uLong nRectCount )
if ( nRectCount < SAL_CLIPRECT_COUNT )
{
if ( !mpStdClipRgnData )
- mpStdClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))];
+ mpStdClipRgnData = reinterpret_cast<RGNDATA*>(new BYTE[sizeof(RGNDATA)-1+(SAL_CLIPRECT_COUNT*sizeof(RECT))]);
mpClipRgnData = mpStdClipRgnData;
}
else
- mpClipRgnData = (RGNDATA*)new BYTE[sizeof(RGNDATA)-1+nRectBufSize];
+ mpClipRgnData = reinterpret_cast<RGNDATA*>(new BYTE[sizeof(RGNDATA)-1+nRectBufSize]);
mpClipRgnData->rdh.dwSize = sizeof( RGNDATAHEADER );
mpClipRgnData->rdh.iType = RDH_RECTANGLES;
mpClipRgnData->rdh.nCount = nRectCount;
mpClipRgnData->rdh.nRgnSize = nRectBufSize;
SetRectEmpty( &(mpClipRgnData->rdh.rcBound) );
- mpNextClipRect = (RECT*)(&(mpClipRgnData->Buffer));
+ mpNextClipRect = reinterpret_cast<RECT*>(&(mpClipRgnData->Buffer));
mbFirstClipRect = TRUE;
}
@@ -679,9 +679,9 @@ void WinSalObject::EndSetClipRegion()
else
{
sal_uLong nSize = mpClipRgnData->rdh.nRgnSize+sizeof(RGNDATAHEADER);
- hRegion = ExtCreateRegion( NULL, nSize, mpClipRgnData );
+ hRegion = ExtCreateRegion( nullptr, nSize, mpClipRgnData );
if ( mpClipRgnData != mpStdClipRgnData )
- delete [] (BYTE*)mpClipRgnData;
+ delete [] reinterpret_cast<BYTE*>(mpClipRgnData);
}
SAL_WARN_IF( !hRegion, "vcl", "SalObject::EndSetClipRegion() - Can't create ClipRegion" );
@@ -697,7 +697,7 @@ void WinSalObject::SetPosSize( long nX, long nY, long nWidth, long nHeight )
ShowWindow( mhWnd, SW_HIDE );
nStyle |= SWP_SHOWWINDOW;
}
- SetWindowPos( mhWnd, 0,
+ SetWindowPos( mhWnd, nullptr,
(int)nX, (int)nY, (int)nWidth, (int)nHeight,
SWP_NOZORDER | SWP_NOACTIVATE | nStyle );
}