summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:32:26 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:40 +0100
commit513fc2916053db5ee7ffaf9f53c271a05cef8981 (patch)
tree7f24849841f33f3e1b2737762548c8525bca780e /vcl/source/window
parent41982607d0c9b69efd5789762bbdae6c7301ee8b (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I17c57a85bcda98ef36ddefd6562d4681d0c7d5fc
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/accessibility.cxx4
-rw-r--r--vcl/source/window/builder.cxx2
-rw-r--r--vcl/source/window/clipping.cxx4
-rw-r--r--vcl/source/window/menu.cxx2
-rw-r--r--vcl/source/window/splitwin.cxx2
-rw-r--r--vcl/source/window/stacking.cxx10
-rw-r--r--vcl/source/window/toolbox.cxx40
-rw-r--r--vcl/source/window/toolbox2.cxx6
-rw-r--r--vcl/source/window/window.cxx10
9 files changed, 40 insertions, 40 deletions
diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx
index e21197dc093c..fc3dc74d009d 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -452,7 +452,7 @@ sal_uInt16 Window::getDefaultAccessibleRole() const
nRole = accessibility::AccessibleRole::FRAME;
else if( IsScrollable() )
nRole = accessibility::AccessibleRole::SCROLL_PANE;
- else if( ((vcl::Window*)this)->ImplGetWindow()->IsMenuFloatingWindow() )
+ else if( const_cast<vcl::Window*>(this)->ImplGetWindow()->IsMenuFloatingWindow() )
nRole = accessibility::AccessibleRole::WINDOW; // #106002#, contextmenus are windows (i.e. toplevel)
else
// #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead
@@ -579,7 +579,7 @@ OUString Window::GetAccessibleDescription() const
{
// Special code for help text windows. ZT asks the border window for the
// description so we have to forward this request to our inner window.
- const vcl::Window* pWin = ((vcl::Window *)this)->ImplGetWindow();
+ const vcl::Window* pWin = const_cast<vcl::Window *>(this)->ImplGetWindow();
if ( pWin->GetType() == WINDOW_HELPTEXTWINDOW )
aAccessibleDescription = pWin->GetHelpText();
else
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 31736c43f787..f7de2d12130a 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -153,7 +153,7 @@ void VclBuilder::loadTranslations(const LanguageTag &rLanguageTag, const OUStrin
break;
}
- xmlreader::XmlReader reader(const_cast<char *>(sStr.getStr()), sStr.getLength());
+ xmlreader::XmlReader reader(sStr.getStr(), sStr.getLength());
handleTranslations(reader);
break;
}
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index b2054f8f77a4..0c24e3051832 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -120,12 +120,12 @@ vcl::Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const
if ( nFlags & WINDOW_GETCLIPREGION_NOCHILDREN )
{
if ( mpWindowImpl->mbInitWinClipRegion )
- ((vcl::Window*)this)->ImplInitWinClipRegion();
+ const_cast<vcl::Window*>(this)->ImplInitWinClipRegion();
aWinClipRegion = mpWindowImpl->maWinClipRegion;
}
else
{
- vcl::Region* pWinChildClipRegion = ((vcl::Window*)this)->ImplGetWinChildClipRegion();
+ vcl::Region* pWinChildClipRegion = const_cast<vcl::Window*>(this)->ImplGetWinChildClipRegion();
aWinClipRegion = *pWinChildClipRegion;
// --- RTL --- remirror clip region before passing it to somebody
if( ImplIsAntiparallel() )
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 5de3bb66120d..8cdcd0f7f346 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2364,7 +2364,7 @@ void Menu::ImplSetSalMenu( SalMenu *pSalMenu )
bool Menu::GetSystemMenuData( SystemMenuData* pData ) const
{
- Menu* pMenu = (Menu*)this;
+ Menu* pMenu = const_cast<Menu*>(this);
if( pData && pMenu->ImplGetSalMenu() )
{
pMenu->ImplGetSalMenu()->GetSystemMenuData( pData );
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index c777f371ea37..86db81283a4f 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -3051,7 +3051,7 @@ long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemBits nBits ) const
return pSet->mpItems[nPos].mnSize;
else
{
- ((SplitWindow*)this)->ImplCalcLayout();
+ const_cast<SplitWindow*>(this)->ImplCalcLayout();
long nRelSize = 0;
long nPerSize = 0;
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index fc676ed70f8a..ee29a8deabda 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -643,7 +643,7 @@ bool Window::IsTopWindow() const
if( mpWindowImpl->mpWinData->mnIsTopWindow == (sal_uInt16)~0) // still uninitialized
{
// #113722#, cache result of expensive queryInterface call
- vcl::Window *pThisWin = (vcl::Window*)this;
+ vcl::Window *pThisWin = const_cast<vcl::Window*>(this);
uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
}
@@ -654,7 +654,7 @@ vcl::Window* Window::FindWindow( const Point& rPos ) const
{
Point aPos = OutputToScreenPixel( rPos );
- return ((vcl::Window*)this)->ImplFindWindow( aPos );
+ return const_cast<vcl::Window*>(this)->ImplFindWindow( aPos );
}
vcl::Window* Window::ImplFindWindow( const Point& rFramePos )
@@ -1079,7 +1079,7 @@ vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
case WINDOW_OVERLAP:
if ( ImplIsOverlapWindow() )
- return (vcl::Window*)this;
+ return const_cast<vcl::Window*>(this);
else
return mpWindowImpl->mpOverlapWindow;
@@ -1090,7 +1090,7 @@ vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
return mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpOverlapWindow;
case WINDOW_CLIENT:
- return ((vcl::Window*)this)->ImplGetWindow();
+ return const_cast<vcl::Window*>(this)->ImplGetWindow();
case WINDOW_REALPARENT:
return ImplGetParent();
@@ -1101,7 +1101,7 @@ vcl::Window* Window::GetWindow( sal_uInt16 nType ) const
case WINDOW_BORDER:
if ( mpWindowImpl->mpBorderWindow )
return mpWindowImpl->mpBorderWindow->GetWindow( WINDOW_BORDER );
- return (vcl::Window*)this;
+ return const_cast<vcl::Window*>(this);
case WINDOW_FIRSTTOPWINDOWCHILD:
return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.begin();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index e6b7c1592405..1e92d1d00d1b 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -212,7 +212,7 @@ void ToolBox::ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( pThis );
// reserve dragarea only for dockable toolbars
- int dragwidth = ( pWrapper && !pWrapper->IsLocked() ) ? ImplGetDragWidth( (ToolBox*)pThis ) : 0;
+ int dragwidth = ( pWrapper && !pWrapper->IsLocked() ) ? ImplGetDragWidth( const_cast<ToolBox*>(pThis) ) : 0;
// no shadow border for dockable toolbars
int borderwidth = pWrapper ? 0: 2;
@@ -682,39 +682,39 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
{
pThis->mpData->mbAssumeDocked = true; // force non-floating mode during calculation
ImplCalcBorder( WINDOWALIGN_TOP, nLeft, nTop, nRight, nBottom, pThis );
- ((ToolBox*)pThis)->mbHorz = true;
+ const_cast<ToolBox*>(pThis)->mbHorz = true;
if ( pThis->mbHorz != bOldHorz )
- ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP;
+ const_cast<ToolBox*>(pThis)->meAlign = WINDOWALIGN_TOP;
}
else if ( nCalcMode == TB_CALCMODE_VERT )
{
pThis->mpData->mbAssumeDocked = true; // force non-floating mode during calculation
ImplCalcBorder( WINDOWALIGN_LEFT, nLeft, nTop, nRight, nBottom, pThis );
- ((ToolBox*)pThis)->mbHorz = false;
+ const_cast<ToolBox*>(pThis)->mbHorz = false;
if ( pThis->mbHorz != bOldHorz )
- ((ToolBox*)pThis)->meAlign = WINDOWALIGN_LEFT;
+ const_cast<ToolBox*>(pThis)->meAlign = WINDOWALIGN_LEFT;
}
else if ( nCalcMode == TB_CALCMODE_FLOAT )
{
pThis->mpData->mbAssumeFloating = true; // force non-floating mode during calculation
nLeft = nTop = nRight = nBottom = 0;
- ((ToolBox*)pThis)->mbHorz = true;
+ const_cast<ToolBox*>(pThis)->mbHorz = true;
if ( pThis->mbHorz != bOldHorz )
- ((ToolBox*)pThis)->meAlign = WINDOWALIGN_TOP;
+ const_cast<ToolBox*>(pThis)->meAlign = WINDOWALIGN_TOP;
}
if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) ||
(pThis->ImplIsFloatingMode() != bOldFloatingMode ) )
- ((ToolBox*)pThis)->mbCalc = true;
+ const_cast<ToolBox*>(pThis)->mbCalc = true;
}
else
ImplCalcBorder( pThis->meAlign, nLeft, nTop, nRight, nBottom, pThis );
- ((ToolBox*)pThis)->ImplCalcItem();
+ const_cast<ToolBox*>(pThis)->ImplCalcItem();
if( !nCalcMode && pThis->ImplIsFloatingMode() )
{
- aSize = ImplCalcFloatSize( ((ToolBox*)pThis), nCalcLines );
+ aSize = ImplCalcFloatSize( const_cast<ToolBox*>(pThis), nCalcLines );
}
else
{
@@ -732,7 +732,7 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
aSize.Height() += (TB_BORDER_OFFSET2*2) + nTop + nBottom;
nMax = 0;
- ((ToolBox*)pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
+ const_cast<ToolBox*>(pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
if ( nMax )
aSize.Width() += nMax;
@@ -750,7 +750,7 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
aSize.Width() += (TB_BORDER_OFFSET2*2) + nLeft + nRight;
nMax = 0;
- ((ToolBox*)pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
+ const_cast<ToolBox*>(pThis)->ImplCalcBreaks( TB_MAXNOSCROLL, &nMax, pThis->mbHorz );
if ( nMax )
aSize.Height() += nMax;
@@ -765,9 +765,9 @@ Size ToolBox::ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uIn
pThis->mpData->mbAssumeFloating = bOldAssumeFloating;
if ( (pThis->meAlign != eOldAlign) || (pThis->mbHorz != bOldHorz) )
{
- ((ToolBox*)pThis)->meAlign = eOldAlign;
- ((ToolBox*)pThis)->mbHorz = bOldHorz;
- ((ToolBox*)pThis)->mbCalc = true;
+ const_cast<ToolBox*>(pThis)->meAlign = eOldAlign;
+ const_cast<ToolBox*>(pThis)->mbHorz = bOldHorz;
+ const_cast<ToolBox*>(pThis)->mbCalc = true;
}
}
@@ -4757,8 +4757,8 @@ sal_uInt16 ToolBox::ImplCountLineBreaks( const ToolBox *pThis )
{
sal_uInt16 nLines = 0;
- std::vector< ImplToolItem >::const_iterator it = ((ToolBox*)pThis)->mpData->m_aItems.begin();
- while ( it != ((ToolBox*)pThis)->mpData->m_aItems.end() )
+ std::vector< ImplToolItem >::const_iterator it = const_cast<ToolBox*>(pThis)->mpData->m_aItems.begin();
+ while ( it != const_cast<ToolBox*>(pThis)->mpData->m_aItems.end() )
{
if( it->meType == ToolBoxItemType::BREAK )
++nLines;
@@ -4781,7 +4781,7 @@ Size ToolBox::CalcPopupWindowSizePixel() const
}
bool bPopup = mpData->mbAssumePopupMode;
- ToolBox *pThis = (ToolBox*) this;
+ ToolBox *pThis = const_cast<ToolBox*>(this);
pThis->mpData->mbAssumePopupMode = true;
Size aSize = CalcFloatingWindowSizePixel( nLines );
@@ -4803,11 +4803,11 @@ Size ToolBox::CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const
bool bDocking = mpData->mbAssumeDocked;
// simulate floating mode and force reformat before calculating
- ToolBox *pThis = (ToolBox*) this;
+ ToolBox *pThis = const_cast<ToolBox*>(this);
pThis->mpData->mbAssumeFloating = true;
pThis->mpData->mbAssumeDocked = false;
- Size aSize = ImplCalcFloatSize( (ToolBox*) this, nCalcLines );
+ Size aSize = ImplCalcFloatSize( const_cast<ToolBox*>(this), nCalcLines );
pThis->mbFormat = true;
pThis->mpData->mbAssumeFloating = bFloat;
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 5b6553fa7cf4..0bf058322410 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1005,7 +1005,7 @@ Point ToolBox::GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) con
Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) const
{
if ( mbCalc || mbFormat )
- ((ToolBox*)this)->ImplFormat();
+ const_cast<ToolBox*>(this)->ImplFormat();
sal_uInt16 nPos = GetItemPos( nItemId );
return GetItemPosRect( nPos );
@@ -1014,7 +1014,7 @@ Rectangle ToolBox::GetItemRect( sal_uInt16 nItemId ) const
Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const
{
if ( mbCalc || mbFormat )
- ((ToolBox*)this)->ImplFormat();
+ const_cast<ToolBox*>(this)->ImplFormat();
if ( nPos < mpData->m_aItems.size() )
return mpData->m_aItems[nPos].maRect;
@@ -1025,7 +1025,7 @@ Rectangle ToolBox::GetItemPosRect( sal_uInt16 nPos ) const
Size ToolBox::GetItemContentSize( sal_uInt16 nItemId ) const
{
if ( mbCalc || mbFormat )
- ((ToolBox*)this)->ImplFormat();
+ const_cast<ToolBox*>(this)->ImplFormat();
sal_uInt16 nPos = GetItemPos( nItemId );
if ( nPos < mpData->m_aItems.size() )
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index cb931cb85d0a..8d7339fcb696 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1247,7 +1247,7 @@ ImplWinData* Window::ImplGetWinData() const
{
static const char* pNoNWF = getenv( "SAL_NO_NWF" );
- ((vcl::Window*)this)->mpWindowImpl->mpWinData = new ImplWinData;
+ const_cast<vcl::Window*>(this)->mpWindowImpl->mpWinData = new ImplWinData;
mpWindowImpl->mpWinData->mpExtOldText = NULL;
mpWindowImpl->mpWinData->mpExtOldAttrAry = NULL;
mpWindowImpl->mpWinData->mpCursorRect = NULL;
@@ -2131,9 +2131,9 @@ long Window::CalcTitleWidth() const
// border of external dialogs
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
vcl::Font aFont = GetFont();
- ((vcl::Window*)this)->SetPointFont( rStyleSettings.GetTitleFont() );
+ const_cast<vcl::Window*>(this)->SetPointFont( rStyleSettings.GetTitleFont() );
long nTitleWidth = GetTextWidth( GetText() );
- ((vcl::Window*)this)->SetFont( aFont );
+ const_cast<vcl::Window*>(this)->SetFont( aFont );
nTitleWidth += rStyleSettings.GetTitleHeight() * 3;
nTitleWidth += rStyleSettings.GetBorderSize() * 2;
nTitleWidth += 10;
@@ -2973,14 +2973,14 @@ long Window::ImplGetUnmirroredOutOffX()
Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const
{
// relative to top level parent
- long offx = ((vcl::Window*) this)->ImplGetUnmirroredOutOffX();
+ long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX();
return Point( rPos.X()+offx, rPos.Y()+mnOutOffY );
}
Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const
{
// relative to top level parent
- long offx = ((vcl::Window*) this)->ImplGetUnmirroredOutOffX();
+ long offx = const_cast<vcl::Window*>(this)->ImplGetUnmirroredOutOffX();
return Point( rPos.X()-offx, rPos.Y()-mnOutOffY );
}