summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 00:04:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-04 01:41:02 +0200
commitce47b1a9c68a27fc37594148f6be2661f27120ea (patch)
tree4c9b5c3da29b76c7c8eb23cdbf85c496b0efd87e /vcl/source/window
parent6fc2a300ad8b1c6936b513eff94fd527ea74b469 (diff)
loplugin:flatten in vcl/window
Change-Id: I94e69e988f038e85b1fb78985211d478bb5ed9b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100033 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/NotebookBarAddonsMerger.cxx55
-rw-r--r--vcl/source/window/brdwin.cxx50
-rw-r--r--vcl/source/window/builder.cxx18
-rw-r--r--vcl/source/window/clipping.cxx54
-rw-r--r--vcl/source/window/cursor.cxx149
-rw-r--r--vcl/source/window/dockingarea.cxx142
-rw-r--r--vcl/source/window/dockmgr.cxx332
-rw-r--r--vcl/source/window/dockwin.cxx388
-rw-r--r--vcl/source/window/event.cxx20
-rw-r--r--vcl/source/window/floatwin.cxx32
-rw-r--r--vcl/source/window/layout.cxx240
-rw-r--r--vcl/source/window/menu.cxx218
-rw-r--r--vcl/source/window/menubarwindow.cxx196
-rw-r--r--vcl/source/window/menufloatingwindow.cxx226
-rw-r--r--vcl/source/window/mouse.cxx71
-rw-r--r--vcl/source/window/paint.cxx114
-rw-r--r--vcl/source/window/printdlg.cxx152
-rw-r--r--vcl/source/window/scrwnd.cxx28
-rw-r--r--vcl/source/window/seleng.cxx30
-rw-r--r--vcl/source/window/split.cxx28
-rw-r--r--vcl/source/window/splitwin.cxx136
-rw-r--r--vcl/source/window/stacking.cxx252
-rw-r--r--vcl/source/window/status.cxx232
-rw-r--r--vcl/source/window/syswin.cxx102
-rw-r--r--vcl/source/window/tabpage.cxx30
-rw-r--r--vcl/source/window/taskpanelist.cxx54
-rw-r--r--vcl/source/window/toolbox.cxx218
-rw-r--r--vcl/source/window/toolbox2.cxx545
-rw-r--r--vcl/source/window/window.cxx422
-rw-r--r--vcl/source/window/window2.cxx100
-rw-r--r--vcl/source/window/winproc.cxx84
-rw-r--r--vcl/source/window/wrkwin.cxx26
32 files changed, 2372 insertions, 2372 deletions
diff --git a/vcl/source/window/NotebookBarAddonsMerger.cxx b/vcl/source/window/NotebookBarAddonsMerger.cxx
index 1c042017a3fc..c8c3c4bd2288 100644
--- a/vcl/source/window/NotebookBarAddonsMerger.cxx
+++ b/vcl/source/window/NotebookBarAddonsMerger.cxx
@@ -72,39 +72,38 @@ static void CreateNotebookBarToolBox(vcl::Window* pNotebookbarToolBox,
{
sal_uInt16 nItemId = 0;
ToolBox* pToolbox = dynamic_cast<ToolBox*>(pNotebookbarToolBox);
- if (pToolbox)
+ if (!pToolbox)
+ return;
+
+ pToolbox->InsertSeparator();
+ pToolbox->Show();
+ Size aSize(0, 0);
+ Image sImage;
+ pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame, ToolBoxItemBits::NONE, aSize);
+ nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL);
+ pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL);
+ pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel);
+
+ if (nIter < aImageVec.size())
{
- pToolbox->InsertSeparator();
- pToolbox->Show();
- Size aSize(0, 0);
- Image sImage;
- pToolbox->InsertItem(aAddonNotebookBarItem.sCommandURL, m_xFrame, ToolBoxItemBits::NONE,
- aSize);
- nItemId = pToolbox->GetItemId(aAddonNotebookBarItem.sCommandURL);
- pToolbox->SetItemCommand(nItemId, aAddonNotebookBarItem.sCommandURL);
- pToolbox->SetQuickHelpText(nItemId, aAddonNotebookBarItem.sLabel);
-
- if (nIter < aImageVec.size())
+ sImage = aImageVec[nIter];
+ if (!sImage)
{
- sImage = aImageVec[nIter];
- if (!sImage)
- {
- sImage = vcl::CommandInfoProvider::GetImageForCommand(
- aAddonNotebookBarItem.sImageIdentifier, m_xFrame);
- }
+ sImage = vcl::CommandInfoProvider::GetImageForCommand(
+ aAddonNotebookBarItem.sImageIdentifier, m_xFrame);
}
+ }
- if (aAddonNotebookBarItem.sStyle == STYLE_TEXT)
- pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
- else if (aAddonNotebookBarItem.sStyle == STYLE_ICON)
- pToolbox->SetItemImage(nItemId, sImage);
- else
- {
- pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
- pToolbox->SetItemImage(nItemId, sImage);
- }
- pToolbox->Show();
+ if (aAddonNotebookBarItem.sStyle == STYLE_TEXT)
+ pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
+ else if (aAddonNotebookBarItem.sStyle == STYLE_ICON)
+ pToolbox->SetItemImage(nItemId, sImage);
+ else
+ {
+ pToolbox->SetItemText(nItemId, aAddonNotebookBarItem.sLabel);
+ pToolbox->SetItemImage(nItemId, sImage);
}
+ pToolbox->Show();
}
NotebookBarAddonsMerger::NotebookBarAddonsMerger() {}
diff --git a/vcl/source/window/brdwin.cxx b/vcl/source/window/brdwin.cxx
index 07c3511bc5c8..1d9d6cbec2f8 100644
--- a/vcl/source/window/brdwin.cxx
+++ b/vcl/source/window/brdwin.cxx
@@ -1899,32 +1899,32 @@ void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize )
void ImplBorderWindow::InvalidateBorder()
{
- if ( IsReallyVisible() )
+ if ( !IsReallyVisible() )
+ return;
+
+ // invalidate only if we have a border
+ sal_Int32 nLeftBorder;
+ sal_Int32 nTopBorder;
+ sal_Int32 nRightBorder;
+ sal_Int32 nBottomBorder;
+ mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
+ if ( !(nLeftBorder || nTopBorder || nRightBorder || nBottomBorder) )
+ return;
+
+ tools::Rectangle aWinRect( Point( 0, 0 ), GetOutputSizePixel() );
+ vcl::Region aRegion( aWinRect );
+ aWinRect.AdjustLeft(nLeftBorder );
+ aWinRect.AdjustTop(nTopBorder );
+ aWinRect.AdjustRight( -nRightBorder );
+ aWinRect.AdjustBottom( -nBottomBorder );
+ // no output area anymore, now invalidate all
+ if ( (aWinRect.Right() < aWinRect.Left()) ||
+ (aWinRect.Bottom() < aWinRect.Top()) )
+ Invalidate( InvalidateFlags::NoChildren );
+ else
{
- // invalidate only if we have a border
- sal_Int32 nLeftBorder;
- sal_Int32 nTopBorder;
- sal_Int32 nRightBorder;
- sal_Int32 nBottomBorder;
- mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
- if ( nLeftBorder || nTopBorder || nRightBorder || nBottomBorder )
- {
- tools::Rectangle aWinRect( Point( 0, 0 ), GetOutputSizePixel() );
- vcl::Region aRegion( aWinRect );
- aWinRect.AdjustLeft(nLeftBorder );
- aWinRect.AdjustTop(nTopBorder );
- aWinRect.AdjustRight( -nRightBorder );
- aWinRect.AdjustBottom( -nBottomBorder );
- // no output area anymore, now invalidate all
- if ( (aWinRect.Right() < aWinRect.Left()) ||
- (aWinRect.Bottom() < aWinRect.Top()) )
- Invalidate( InvalidateFlags::NoChildren );
- else
- {
- aRegion.Exclude( aWinRect );
- Invalidate( aRegion, InvalidateFlags::NoChildren );
- }
- }
+ aRegion.Exclude( aWinRect );
+ Invalidate( aRegion, InvalidateFlags::NoChildren );
}
}
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 6bbfef0d9574..2cdc33966ff6 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1465,19 +1465,19 @@ void VclBuilder::extractBuffer(const OString &id, stringmap &rMap)
void VclBuilder::extractStock(const OString &id, stringmap &rMap)
{
VclBuilder::stringmap::iterator aFind = rMap.find(OString("stock"));
+ if (aFind == rMap.end())
+ return;
+
+ stockinfo aInfo;
+ aInfo.m_sStock = aFind->second;
+ rMap.erase(aFind);
+ aFind = rMap.find(OString("icon-size"));
if (aFind != rMap.end())
{
- stockinfo aInfo;
- aInfo.m_sStock = aFind->second;
+ aInfo.m_nSize = aFind->second.toInt32();
rMap.erase(aFind);
- aFind = rMap.find(OString("icon-size"));
- if (aFind != rMap.end())
- {
- aInfo.m_nSize = aFind->second.toInt32();
- rMap.erase(aFind);
- }
- m_pParserState->m_aStockMap[id] = aInfo;
}
+ m_pParserState->m_aStockMap[id] = aInfo;
}
void VclBuilder::extractButtonImage(const OString &id, stringmap &rMap, bool bRadio)
diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx
index e2c3a37c8ccf..1fb8e0d77e78 100644
--- a/vcl/source/window/clipping.cxx
+++ b/vcl/source/window/clipping.cxx
@@ -90,25 +90,25 @@ ParentClipMode Window::GetParentClipMode() const
void Window::ExpandPaintClipRegion( const vcl::Region& rRegion )
{
- if( mpWindowImpl->mpPaintRegion )
- {
- vcl::Region aPixRegion = LogicToPixel( rRegion );
- vcl::Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion );
+ if( !mpWindowImpl->mpPaintRegion )
+ return;
- vcl::Region aWinChildRegion = *ImplGetWinChildClipRegion();
- // only this region is in frame coordinates, so re-mirror it
- if( ImplIsAntiparallel() )
- {
- const OutputDevice *pOutDev = GetOutDev();
- pOutDev->ReMirror( aWinChildRegion );
- }
+ vcl::Region aPixRegion = LogicToPixel( rRegion );
+ vcl::Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion );
- aDevPixRegion.Intersect( aWinChildRegion );
- if( ! aDevPixRegion.IsEmpty() )
- {
- mpWindowImpl->mpPaintRegion->Union( aDevPixRegion );
- mbInitClipRegion = true;
- }
+ vcl::Region aWinChildRegion = *ImplGetWinChildClipRegion();
+ // only this region is in frame coordinates, so re-mirror it
+ if( ImplIsAntiparallel() )
+ {
+ const OutputDevice *pOutDev = GetOutDev();
+ pOutDev->ReMirror( aWinChildRegion );
+ }
+
+ aDevPixRegion.Intersect( aWinChildRegion );
+ if( ! aDevPixRegion.IsEmpty() )
+ {
+ mpWindowImpl->mpPaintRegion->Union( aDevPixRegion );
+ mbInitClipRegion = true;
}
}
@@ -659,19 +659,19 @@ void Window::ImplCalcOverlapRegion( const tools::Rectangle& rSourceRect, vcl::Re
while ( pWindow );
}
- if ( bChildren )
+ if ( !bChildren )
+ return;
+
+ pWindow = mpWindowImpl->mpFirstChild;
+ while ( pWindow )
{
- pWindow = mpWindowImpl->mpFirstChild;
- while ( pWindow )
+ if ( pWindow->mpWindowImpl->mbReallyVisible )
{
- if ( pWindow->mpWindowImpl->mbReallyVisible )
- {
- aTempRegion = aRegion;
- pWindow->ImplIntersectWindowRegion( aTempRegion );
- rRegion.Union( aTempRegion );
- }
- pWindow = pWindow->mpWindowImpl->mpNext;
+ aTempRegion = aRegion;
+ pWindow->ImplIntersectWindowRegion( aTempRegion );
+ rRegion.Union( aTempRegion );
}
+ pWindow = pWindow->mpWindowImpl->mpNext;
}
}
diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx
index 9eba6b2f603f..c8a573b9fbd4 100644
--- a/vcl/source/window/cursor.cxx
+++ b/vcl/source/window/cursor.cxx
@@ -187,80 +187,81 @@ void vcl::Cursor::ImplRestore()
void vcl::Cursor::ImplDoShow( bool bDrawDirect, bool bRestore )
{
- if ( mbVisible )
+ if ( !mbVisible )
+ return;
+
+ vcl::Window* pWindow;
+ if ( mpWindow )
+ pWindow = mpWindow;
+ else
{
- vcl::Window* pWindow;
- if ( mpWindow )
- pWindow = mpWindow;
- else
- {
- // show the cursor, if there is an active window and the cursor
- // has been selected in this window
- pWindow = Application::GetFocusWindow();
- if (!pWindow || !pWindow->mpWindowImpl || (pWindow->mpWindowImpl->mpCursor != this)
- || pWindow->mpWindowImpl->mbInPaint
- || !pWindow->mpWindowImpl->mpFrameData->mbHasFocus)
- pWindow = nullptr;
- }
+ // show the cursor, if there is an active window and the cursor
+ // has been selected in this window
+ pWindow = Application::GetFocusWindow();
+ if (!pWindow || !pWindow->mpWindowImpl || (pWindow->mpWindowImpl->mpCursor != this)
+ || pWindow->mpWindowImpl->mbInPaint
+ || !pWindow->mpWindowImpl->mpFrameData->mbHasFocus)
+ pWindow = nullptr;
+ }
- if ( pWindow )
- {
- if ( !mpData )
- {
- mpData.reset( new ImplCursorData );
- mpData->mbCurVisible = false;
- mpData->maTimer.SetInvokeHandler( LINK( this, Cursor, ImplTimerHdl ) );
- mpData->maTimer.SetDebugName( "vcl ImplCursorData maTimer" );
- }
+ if ( !pWindow )
+ return;
- mpData->mpWindow = pWindow;
- mpData->mnStyle = mnStyle;
- if ( bDrawDirect || bRestore )
- ImplDraw();
+ if ( !mpData )
+ {
+ mpData.reset( new ImplCursorData );
+ mpData->mbCurVisible = false;
+ mpData->maTimer.SetInvokeHandler( LINK( this, Cursor, ImplTimerHdl ) );
+ mpData->maTimer.SetDebugName( "vcl ImplCursorData maTimer" );
+ }
- if ( !mpWindow && ! ( ! bDrawDirect && mpData->maTimer.IsActive()) )
- {
- mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
- if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
- mpData->maTimer.Start();
- else if ( !mpData->mbCurVisible )
- ImplDraw();
- LOKNotify( pWindow, "cursor_invalidate" );
- LOKNotify( pWindow, "cursor_visible" );
- }
- }
+ mpData->mpWindow = pWindow;
+ mpData->mnStyle = mnStyle;
+ if ( bDrawDirect || bRestore )
+ ImplDraw();
+
+ if ( !mpWindow && ! ( ! bDrawDirect && mpData->maTimer.IsActive()) )
+ {
+ mpData->maTimer.SetTimeout( pWindow->GetSettings().GetStyleSettings().GetCursorBlinkTime() );
+ if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
+ mpData->maTimer.Start();
+ else if ( !mpData->mbCurVisible )
+ ImplDraw();
+ LOKNotify( pWindow, "cursor_invalidate" );
+ LOKNotify( pWindow, "cursor_visible" );
}
}
void vcl::Cursor::LOKNotify( vcl::Window* pWindow, const OUString& rAction )
{
- if (VclPtr<vcl::Window> pParent = pWindow->GetParentWithLOKNotifier())
- {
- assert(pWindow && "Cannot notify without a window");
- assert(mpData && "Require ImplCursorData");
- assert(comphelper::LibreOfficeKit::isActive());
-
- if (comphelper::LibreOfficeKit::isDialogPainting())
- return;
-
- const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
- std::vector<vcl::LOKPayloadItem> aItems;
- if (rAction == "cursor_visible")
- aItems.emplace_back("visible", mpData->mbCurVisible ? "true" : "false");
- else if (rAction == "cursor_invalidate")
- {
- const long nX = pWindow->GetOutOffXPixel() + pWindow->LogicToPixel(GetPos()).X() - pParent->GetOutOffXPixel();
- const long nY = pWindow->GetOutOffYPixel() + pWindow->LogicToPixel(GetPos()).Y() - pParent->GetOutOffYPixel();
- Size aSize = pWindow->LogicToPixel(GetSize());
- if (!aSize.Width())
- aSize.setWidth( pWindow->GetSettings().GetStyleSettings().GetCursorSize() );
-
- const tools::Rectangle aRect(Point(nX, nY), aSize);
- aItems.emplace_back("rectangle", aRect.toString());
- }
+ VclPtr<vcl::Window> pParent = pWindow->GetParentWithLOKNotifier();
+ if (!pParent)
+ return;
+
+ assert(pWindow && "Cannot notify without a window");
+ assert(mpData && "Require ImplCursorData");
+ assert(comphelper::LibreOfficeKit::isActive());
- pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
+ if (comphelper::LibreOfficeKit::isDialogPainting())
+ return;
+
+ const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
+ std::vector<vcl::LOKPayloadItem> aItems;
+ if (rAction == "cursor_visible")
+ aItems.emplace_back("visible", mpData->mbCurVisible ? "true" : "false");
+ else if (rAction == "cursor_invalidate")
+ {
+ const long nX = pWindow->GetOutOffXPixel() + pWindow->LogicToPixel(GetPos()).X() - pParent->GetOutOffXPixel();
+ const long nY = pWindow->GetOutOffYPixel() + pWindow->LogicToPixel(GetPos()).Y() - pParent->GetOutOffYPixel();
+ Size aSize = pWindow->LogicToPixel(GetSize());
+ if (!aSize.Width())
+ aSize.setWidth( pWindow->GetSettings().GetStyleSettings().GetCursorSize() );
+
+ const tools::Rectangle aRect(Point(nX, nY), aSize);
+ aItems.emplace_back("rectangle", aRect.toString());
}
+
+ pNotifier->notifyWindow(pParent->GetLOKWindowId(), rAction, aItems);
}
bool vcl::Cursor::ImplDoHide( bool bSuspend )
@@ -304,18 +305,18 @@ bool vcl::Cursor::ImplSuspend()
void vcl::Cursor::ImplNew()
{
- if ( mbVisible && mpData && mpData->mpWindow )
- {
- if ( mpData->mbCurVisible )
- ImplRestore();
+ if ( !(mbVisible && mpData && mpData->mpWindow) )
+ return;
- ImplDraw();
- if ( !mpWindow )
- {
- LOKNotify( mpData->mpWindow, "cursor_invalidate" );
- if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
- mpData->maTimer.Start();
- }
+ if ( mpData->mbCurVisible )
+ ImplRestore();
+
+ ImplDraw();
+ if ( !mpWindow )
+ {
+ LOKNotify( mpData->mpWindow, "cursor_invalidate" );
+ if ( mpData->maTimer.GetTimeout() != STYLE_CURSOR_NOBLINKTIME )
+ mpData->maTimer.Start();
}
}
diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx
index fed3fa5c4737..dc16eb702bf8 100644
--- a/vcl/source/window/dockingarea.cxx
+++ b/vcl/source/window/dockingarea.cxx
@@ -156,92 +156,92 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
EnableNativeWidget(); // only required because the toolkit currently switches this flag off
- if (rRenderContext.IsNativeControlSupported(ControlType::Toolbar, ControlPart::Entire))
- {
- ToolbarValue aControlValue;
+ if (!rRenderContext.IsNativeControlSupported(ControlType::Toolbar, ControlPart::Entire))
+ return;
- if (GetAlign() == WindowAlign::Top && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG)
- {
- // give NWF a hint that this dockingarea is adjacent to the menubar
- // useful for special gradient effects that should cover both windows
- aControlValue.mbIsTopDockingArea = true;
- }
+ ToolbarValue aControlValue;
- ControlState nState = ControlState::ENABLED;
- const bool isFooter = GetAlign() == WindowAlign::Bottom && !rSetting.GetPersonaFooter().IsEmpty();
+ if (GetAlign() == WindowAlign::Top && ImplGetSVData()->maNWFData.mbMenuBarDockingAreaCommonBG)
+ {
+ // give NWF a hint that this dockingarea is adjacent to the menubar
+ // useful for special gradient effects that should cover both windows
+ aControlValue.mbIsTopDockingArea = true;
+ }
- if ((GetAlign() == WindowAlign::Top && !rSetting.GetPersonaHeader().IsEmpty() ) || isFooter)
- Erase(rRenderContext);
- else if (!ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB)
- {
- // draw a single toolbar background covering the whole docking area
- tools::Rectangle aCtrlRegion(Point(), GetOutputSizePixel());
+ ControlState nState = ControlState::ENABLED;
+ const bool isFooter = GetAlign() == WindowAlign::Bottom && !rSetting.GetPersonaFooter().IsEmpty();
- rRenderContext.DrawNativeControl(ControlType::Toolbar, IsHorizontal() ? ControlPart::DrawBackgroundHorz : ControlPart::DrawBackgroundVert,
- aCtrlRegion, nState, aControlValue, OUString() );
+ if ((GetAlign() == WindowAlign::Top && !rSetting.GetPersonaHeader().IsEmpty() ) || isFooter)
+ Erase(rRenderContext);
+ else if (!ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB)
+ {
+ // draw a single toolbar background covering the whole docking area
+ tools::Rectangle aCtrlRegion(Point(), GetOutputSizePixel());
- if (!ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames)
+ rRenderContext.DrawNativeControl(ControlType::Toolbar, IsHorizontal() ? ControlPart::DrawBackgroundHorz : ControlPart::DrawBackgroundVert,
+ aCtrlRegion, nState, aControlValue, OUString() );
+
+ if (!ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames)
+ {
+ // each toolbar gets a thin border to better recognize its borders on the homogeneous docking area
+ sal_uInt16 nChildren = GetChildCount();
+ for (sal_uInt16 n = 0; n < nChildren; n++)
{
- // each toolbar gets a thin border to better recognize its borders on the homogeneous docking area
- sal_uInt16 nChildren = GetChildCount();
- for (sal_uInt16 n = 0; n < nChildren; n++)
+ vcl::Window* pChild = GetChild(n);
+ if (pChild->IsVisible())
{
- vcl::Window* pChild = GetChild(n);
- if (pChild->IsVisible())
- {
- Point aPos = pChild->GetPosPixel();
- Size aSize = pChild->GetSizePixel();
- tools::Rectangle aRect(aPos, aSize);
-
- rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetLightColor());
- rRenderContext.DrawLine(aRect.TopLeft(), aRect.TopRight());
- rRenderContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft());
-
- rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
- rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
- rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
- }
+ Point aPos = pChild->GetPosPixel();
+ Size aSize = pChild->GetSizePixel();
+ tools::Rectangle aRect(aPos, aSize);
+
+ rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetLightColor());
+ rRenderContext.DrawLine(aRect.TopLeft(), aRect.TopRight());
+ rRenderContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft());
+
+ rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
+ rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
+ rRenderContext.DrawLine(aRect.TopRight(), aRect.BottomRight());
}
}
}
- else
+ }
+ else
+ {
+ // create map to find toolbar lines
+ Size aOutSz(GetOutputSizePixel());
+ std::map<int, int> ranges;
+ sal_uInt16 nChildren = GetChildCount();
+ for (sal_uInt16 n = 0; n < nChildren; n++)
{
- // create map to find toolbar lines
- Size aOutSz(GetOutputSizePixel());
- std::map<int, int> ranges;
- sal_uInt16 nChildren = GetChildCount();
- for (sal_uInt16 n = 0; n < nChildren; n++)
+ vcl::Window* pChild = GetChild(n);
+ Point aPos = pChild->GetPosPixel();
+ Size aSize = pChild->GetSizePixel();
+ if (IsHorizontal())
+ ranges[aPos.Y()] = aSize.Height();
+ else
+ ranges[aPos.X()] = aSize.Width();
+ }
+
+ // draw multiple toolbar backgrounds, i.e., one for each toolbar line
+ for (auto const& range : ranges)
+ {
+ tools::Rectangle aTBRect;
+ if (IsHorizontal())
{
- vcl::Window* pChild = GetChild(n);
- Point aPos = pChild->GetPosPixel();
- Size aSize = pChild->GetSizePixel();
- if (IsHorizontal())
- ranges[aPos.Y()] = aSize.Height();
- else
- ranges[aPos.X()] = aSize.Width();
+ aTBRect.SetLeft( 0 );
+ aTBRect.SetRight( aOutSz.Width() - 1 );
+ aTBRect.SetTop( range.first );
+ aTBRect.SetBottom( range.first + range.second - 1 );
}
-
- // draw multiple toolbar backgrounds, i.e., one for each toolbar line
- for (auto const& range : ranges)
+ else
{
- tools::Rectangle aTBRect;
- if (IsHorizontal())
- {
- aTBRect.SetLeft( 0 );
- aTBRect.SetRight( aOutSz.Width() - 1 );
- aTBRect.SetTop( range.first );
- aTBRect.SetBottom( range.first + range.second - 1 );
- }
- else
- {
- aTBRect.SetLeft( range.first );
- aTBRect.SetRight( range.first + range.second - 1 );
- aTBRect.SetTop( 0 );
- aTBRect.SetBottom( aOutSz.Height() - 1 );
- }
- rRenderContext.DrawNativeControl(ControlType::Toolbar, IsHorizontal() ? ControlPart::DrawBackgroundHorz : ControlPart::DrawBackgroundVert,
- aTBRect, nState, aControlValue, OUString());
+ aTBRect.SetLeft( range.first );
+ aTBRect.SetRight( range.first + range.second - 1 );
+ aTBRect.SetTop( 0 );
+ aTBRect.SetBottom( aOutSz.Height() - 1 );
}
+ rRenderContext.DrawNativeControl(ControlType::Toolbar, IsHorizontal() ? ControlPart::DrawBackgroundHorz : ControlPart::DrawBackgroundVert,
+ aTBRect, nState, aControlValue, OUString());
}
}
}
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index 42a9a8b16fbd..f3bb625d2bd5 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -549,87 +549,87 @@ void ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos )
void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt )
{
// used during docking of a currently docked window
- if ( mbDocking )
+ if ( !mbDocking )
+ return;
+
+ if ( rTEvt.IsTrackingEnded() )
{
- if ( rTEvt.IsTrackingEnded() )
+ mbDocking = false;
+ GetWindow()->HideTracking();
+ if ( rTEvt.IsTrackingCanceled() )
{
- mbDocking = false;
- GetWindow()->HideTracking();
- if ( rTEvt.IsTrackingCanceled() )
+ mbDockCanceled = true;
+ EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ mbDockCanceled = false;
+ }
+ else
+ EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ }
+ // Docking only upon non-synthetic MouseEvents
+ else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
+ {
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+ Point aFrameMousePos = GetWindow()->ImplOutputToFrame( aMousePos );
+ Size aFrameSize = GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
+ if ( aFrameMousePos.X() < 0 )
+ aFrameMousePos.setX( 0 );
+ if ( aFrameMousePos.Y() < 0 )
+ aFrameMousePos.setY( 0 );
+ if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
+ aFrameMousePos.setX( aFrameSize.Width()-1 );
+ if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
+ aFrameMousePos.setY( aFrameSize.Height()-1 );
+ aMousePos = GetWindow()->ImplFrameToOutput( aFrameMousePos );
+ aMousePos.AdjustX( -(maMouseOff.X()) );
+ aMousePos.AdjustY( -(maMouseOff.Y()) );
+ Point aPos = GetWindow()->ImplOutputToFrame( aMousePos );
+ tools::Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) );
+ tools::Rectangle aCompRect = aTrackRect;
+ aPos.AdjustX(maMouseOff.X() );
+ aPos.AdjustY(maMouseOff.Y() );
+
+ bool bFloatMode = Docking( aPos, aTrackRect );
+
+ if ( mbLastFloatMode != bFloatMode )
+ {
+ if ( bFloatMode )
{
- mbDockCanceled = true;
- EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
- mbDockCanceled = false;
+ aTrackRect.AdjustLeft( -mnDockLeft );
+ aTrackRect.AdjustTop( -mnDockTop );
+ aTrackRect.AdjustRight(mnDockRight );
+ aTrackRect.AdjustBottom(mnDockBottom );
}
else
- EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
- }
- // Docking only upon non-synthetic MouseEvents
- else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
- {
- Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
- Point aFrameMousePos = GetWindow()->ImplOutputToFrame( aMousePos );
- Size aFrameSize = GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
- if ( aFrameMousePos.X() < 0 )
- aFrameMousePos.setX( 0 );
- if ( aFrameMousePos.Y() < 0 )
- aFrameMousePos.setY( 0 );
- if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
- aFrameMousePos.setX( aFrameSize.Width()-1 );
- if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
- aFrameMousePos.setY( aFrameSize.Height()-1 );
- aMousePos = GetWindow()->ImplFrameToOutput( aFrameMousePos );
- aMousePos.AdjustX( -(maMouseOff.X()) );
- aMousePos.AdjustY( -(maMouseOff.Y()) );
- Point aPos = GetWindow()->ImplOutputToFrame( aMousePos );
- tools::Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) );
- tools::Rectangle aCompRect = aTrackRect;
- aPos.AdjustX(maMouseOff.X() );
- aPos.AdjustY(maMouseOff.Y() );
-
- bool bFloatMode = Docking( aPos, aTrackRect );
-
- if ( mbLastFloatMode != bFloatMode )
{
- if ( bFloatMode )
- {
- aTrackRect.AdjustLeft( -mnDockLeft );
- aTrackRect.AdjustTop( -mnDockTop );
- aTrackRect.AdjustRight(mnDockRight );
- aTrackRect.AdjustBottom(mnDockBottom );
- }
- else
+ if ( aCompRect == aTrackRect )
{
- if ( aCompRect == aTrackRect )
- {
- aTrackRect.AdjustLeft(mnDockLeft );
- aTrackRect.AdjustTop(mnDockTop );
- aTrackRect.AdjustRight( -mnDockRight );
- aTrackRect.AdjustBottom( -mnDockBottom );
- }
+ aTrackRect.AdjustLeft(mnDockLeft );
+ aTrackRect.AdjustTop(mnDockTop );
+ aTrackRect.AdjustRight( -mnDockRight );
+ aTrackRect.AdjustBottom( -mnDockBottom );
}
- mbLastFloatMode = bFloatMode;
}
+ mbLastFloatMode = bFloatMode;
+ }
- ShowTrackFlags nTrackStyle;
- if ( bFloatMode )
- nTrackStyle = ShowTrackFlags::Object;
- else
- nTrackStyle = ShowTrackFlags::Big;
- tools::Rectangle aShowTrackRect = aTrackRect;
- aShowTrackRect.SetPos( GetWindow()->ImplFrameToOutput( aShowTrackRect.TopLeft() ) );
+ ShowTrackFlags nTrackStyle;
+ if ( bFloatMode )
+ nTrackStyle = ShowTrackFlags::Object;
+ else
+ nTrackStyle = ShowTrackFlags::Big;
+ tools::Rectangle aShowTrackRect = aTrackRect;
+ aShowTrackRect.SetPos( GetWindow()->ImplFrameToOutput( aShowTrackRect.TopLeft() ) );
- GetWindow()->ShowTracking( aShowTrackRect, nTrackStyle );
+ GetWindow()->ShowTracking( aShowTrackRect, nTrackStyle );
- // calculate mouse offset again, as the rectangle was changed
- maMouseOff.setX( aPos.X() - aTrackRect.Left() );
- maMouseOff.setY( aPos.Y() - aTrackRect.Top() );
+ // calculate mouse offset again, as the rectangle was changed
+ maMouseOff.setX( aPos.X() - aTrackRect.Left() );
+ maMouseOff.setY( aPos.Y() - aTrackRect.Top() );
- mnTrackX = aTrackRect.Left();
- mnTrackY = aTrackRect.Top();
- mnTrackWidth = aTrackRect.GetWidth();
- mnTrackHeight = aTrackRect.GetHeight();
- }
+ mnTrackX = aTrackRect.Left();
+ mnTrackY = aTrackRect.Top();
+ mnTrackWidth = aTrackRect.GetWidth();
+ mnTrackHeight = aTrackRect.GetHeight();
}
}
@@ -880,111 +880,111 @@ void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
if( !IsFloatingMode() && IsLocked() )
return;
- if ( IsFloatingMode() != bFloatMode )
+ if ( IsFloatingMode() == bFloatMode )
+ return;
+
+ if ( !PrepareToggleFloatingMode() )
+ return;
+
+ bool bVisible = GetWindow()->IsVisible();
+
+ if ( bFloatMode )
{
- if ( PrepareToggleFloatingMode() )
- {
- bool bVisible = GetWindow()->IsVisible();
+ GetWindow()->Show( false, ShowFlags::NoFocusChange );
- if ( bFloatMode )
- {
- GetWindow()->Show( false, ShowFlags::NoFocusChange );
-
- maDockPos = GetWindow()->GetPosPixel();
-
- vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent );
- mpOldBorderWin = GetWindow()->GetWindow( GetWindowType::Border );
- if( mpOldBorderWin == mpDockingWindow )
- mpOldBorderWin = nullptr; // no border window found
-
- VclPtrInstance<ImplDockFloatWin2> pWin(
- mpParent,
- mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?
- mnFloatBits | WB_SYSTEMWINDOW
- | WB_OWNERDRAWDECORATION
- : mnFloatBits,
- this );
-
- // At least for DockingWindow, GetText() has a side effect of setting deferred
- // properties. This must be done before setting the border window (see below),
- // so that the border width will end up in mpWindowImpl->mnBorderWidth, not in
- // the border window (See DockingWindow::setPosSizeOnContainee() and
- // DockingWindow::GetOptimalSize()).
- pWin->SetText( GetWindow()->GetText() );
-
- GetWindow()->mpWindowImpl->mpBorderWindow = nullptr;
- GetWindow()->mpWindowImpl->mnLeftBorder = 0;
- GetWindow()->mpWindowImpl->mnTopBorder = 0;
- GetWindow()->mpWindowImpl->mnRightBorder = 0;
- GetWindow()->mpWindowImpl->mnBottomBorder = 0;
-
- // if the parent gets destroyed, we also have to reset the parent of the BorderWindow
- if ( mpOldBorderWin )
- mpOldBorderWin->SetParent( pWin );
- GetWindow()->SetParent( pWin );
- pWin->SetPosPixel( Point() );
-
- GetWindow()->mpWindowImpl->mpBorderWindow = pWin;
- pWin->mpWindowImpl->mpClientWindow = mpDockingWindow;
- GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
-
- pWin->SetOutputSizePixel( GetWindow()->GetSizePixel() );
- pWin->SetPosPixel( maFloatPos );
- // pass on DockingData to FloatingWindow
- pWin->ShowTitleButton( TitleButton::Docking, mbDockBtn );
- pWin->ShowTitleButton( TitleButton::Hide, mbHideBtn );
- if ( mbRollUp )
- pWin->RollUp();
- else
- pWin->RollDown();
- pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
- pWin->SetMinOutputSizePixel( maMinOutSize );
- pWin->SetMaxOutputSizePixel( maMaxOutSize );
-
- mpFloatWin = pWin;
-
- if ( bVisible )
- GetWindow()->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
-
- ToggleFloatingMode();
- }
- else
- {
- GetWindow()->Show( false, ShowFlags::NoFocusChange );
-
- // store FloatingData in FloatingWindow
- maFloatPos = mpFloatWin->GetPosPixel();
- mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
- mbHideBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Hide );
- mbRollUp = mpFloatWin->IsRollUp();
- maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
- maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
- maMaxOutSize = mpFloatWin->GetMaxOutputSizePixel();
-
- vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent ); //mpWindowImpl->mpRealParent;
- GetWindow()->mpWindowImpl->mpBorderWindow = nullptr;
- if ( mpOldBorderWin )
- {
- GetWindow()->SetParent( mpOldBorderWin );
- static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
- GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder,
- GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder );
- mpOldBorderWin->Resize();
- }
- GetWindow()->mpWindowImpl->mpBorderWindow = mpOldBorderWin;
- GetWindow()->SetParent( pRealParent );
- GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
+ maDockPos = GetWindow()->GetPosPixel();
+
+ vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent );
+ mpOldBorderWin = GetWindow()->GetWindow( GetWindowType::Border );
+ if( mpOldBorderWin == mpDockingWindow )
+ mpOldBorderWin = nullptr; // no border window found
+
+ VclPtrInstance<ImplDockFloatWin2> pWin(
+ mpParent,
+ mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?
+ mnFloatBits | WB_SYSTEMWINDOW
+ | WB_OWNERDRAWDECORATION
+ : mnFloatBits,
+ this );
+
+ // At least for DockingWindow, GetText() has a side effect of setting deferred
+ // properties. This must be done before setting the border window (see below),
+ // so that the border width will end up in mpWindowImpl->mnBorderWidth, not in
+ // the border window (See DockingWindow::setPosSizeOnContainee() and
+ // DockingWindow::GetOptimalSize()).
+ pWin->SetText( GetWindow()->GetText() );
+
+ GetWindow()->mpWindowImpl->mpBorderWindow = nullptr;
+ GetWindow()->mpWindowImpl->mnLeftBorder = 0;
+ GetWindow()->mpWindowImpl->mnTopBorder = 0;
+ GetWindow()->mpWindowImpl->mnRightBorder = 0;
+ GetWindow()->mpWindowImpl->mnBottomBorder = 0;
+
+ // if the parent gets destroyed, we also have to reset the parent of the BorderWindow
+ if ( mpOldBorderWin )
+ mpOldBorderWin->SetParent( pWin );
+ GetWindow()->SetParent( pWin );
+ pWin->SetPosPixel( Point() );
+
+ GetWindow()->mpWindowImpl->mpBorderWindow = pWin;
+ pWin->mpWindowImpl->mpClientWindow = mpDockingWindow;
+ GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
+
+ pWin->SetOutputSizePixel( GetWindow()->GetSizePixel() );
+ pWin->SetPosPixel( maFloatPos );
+ // pass on DockingData to FloatingWindow
+ pWin->ShowTitleButton( TitleButton::Docking, mbDockBtn );
+ pWin->ShowTitleButton( TitleButton::Hide, mbHideBtn );
+ if ( mbRollUp )
+ pWin->RollUp();
+ else
+ pWin->RollDown();
+ pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
+ pWin->SetMinOutputSizePixel( maMinOutSize );
+ pWin->SetMaxOutputSizePixel( maMaxOutSize );
- mpFloatWin.disposeAndClear();
- GetWindow()->SetPosPixel( maDockPos );
+ mpFloatWin = pWin;
- if ( bVisible )
- GetWindow()->Show();
+ if ( bVisible )
+ GetWindow()->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
- ToggleFloatingMode();
+ ToggleFloatingMode();
+ }
+ else
+ {
+ GetWindow()->Show( false, ShowFlags::NoFocusChange );
- }
+ // store FloatingData in FloatingWindow
+ maFloatPos = mpFloatWin->GetPosPixel();
+ mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
+ mbHideBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Hide );
+ mbRollUp = mpFloatWin->IsRollUp();
+ maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
+ maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
+ maMaxOutSize = mpFloatWin->GetMaxOutputSizePixel();
+
+ vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent ); //mpWindowImpl->mpRealParent;
+ GetWindow()->mpWindowImpl->mpBorderWindow = nullptr;
+ if ( mpOldBorderWin )
+ {
+ GetWindow()->SetParent( mpOldBorderWin );
+ static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
+ GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder,
+ GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder );
+ mpOldBorderWin->Resize();
}
+ GetWindow()->mpWindowImpl->mpBorderWindow = mpOldBorderWin;
+ GetWindow()->SetParent( pRealParent );
+ GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
+
+ mpFloatWin.disposeAndClear();
+ GetWindow()->SetPosPixel( maDockPos );
+
+ if ( bVisible )
+ GetWindow()->Show();
+
+ ToggleFloatingMode();
+
}
}
diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx
index 7c0daa54bc18..bae44f7bdaac 100644
--- a/vcl/source/window/dockwin.cxx
+++ b/vcl/source/window/dockwin.cxx
@@ -328,19 +328,19 @@ void DockingWindow::ImplInitSettings()
{
// Hack: to be able to build DockingWindows w/o background before switching
// TODO: Hack
- if ( IsBackground() )
- {
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+ if ( !IsBackground() )
+ return;
- Color aColor;
- if ( IsControlBackground() )
- aColor = GetControlBackground();
- else if ( Window::GetStyle() & WB_3DLOOK )
- aColor = rStyleSettings.GetFaceColor();
- else
- aColor = rStyleSettings.GetWindowColor();
- SetBackground( aColor );
- }
+ const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
+
+ Color aColor;
+ if ( IsControlBackground() )
+ aColor = GetControlBackground();
+ else if ( Window::GetStyle() & WB_3DLOOK )
+ aColor = rStyleSettings.GetFaceColor();
+ else
+ aColor = rStyleSettings.GetWindowColor();
+ SetBackground( aColor );
}
DockingWindow::DockingWindow( WindowType nType ) :
@@ -407,113 +407,113 @@ void DockingWindow::Tracking( const TrackingEvent& rTEvt )
if( GetDockingManager()->IsDockable( this ) ) // new docking interface
return Window::Tracking( rTEvt );
- if ( mbDocking )
+ if ( !mbDocking )
+ return;
+
+ if ( rTEvt.IsTrackingEnded() )
{
- if ( rTEvt.IsTrackingEnded() )
+ mbDocking = false;
+ if ( mbDragFull )
{
- mbDocking = false;
- if ( mbDragFull )
+ // reset old state on Cancel
+ if ( rTEvt.IsTrackingCanceled() )
{
- // reset old state on Cancel
- if ( rTEvt.IsTrackingCanceled() )
- {
- StartDocking();
- tools::Rectangle aRect( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) );
- EndDocking( aRect, mbStartFloat );
- }
+ StartDocking();
+ tools::Rectangle aRect( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) );
+ EndDocking( aRect, mbStartFloat );
}
- else
+ }
+ else
+ {
+ HideTracking();
+ if ( rTEvt.IsTrackingCanceled() )
{
- HideTracking();
- if ( rTEvt.IsTrackingCanceled() )
- {
- mbDockCanceled = true;
- EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
- mbDockCanceled = false;
- }
- else
- EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ mbDockCanceled = true;
+ EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
+ mbDockCanceled = false;
}
+ else
+ EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
}
- // dock only for non-synthetic MouseEvents
- else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
+ }
+ // dock only for non-synthetic MouseEvents
+ else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
+ {
+ Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
+ Point aFrameMousePos = ImplOutputToFrame( aMousePos );
+ Size aFrameSize = mpWindowImpl->mpFrameWindow->GetOutputSizePixel();
+ if ( aFrameMousePos.X() < 0 )
+ aFrameMousePos.setX( 0 );
+ if ( aFrameMousePos.Y() < 0 )
+ aFrameMousePos.setY( 0 );
+ if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
+ aFrameMousePos.setX( aFrameSize.Width()-1 );
+ if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
+ aFrameMousePos.setY( aFrameSize.Height()-1 );
+ aMousePos = ImplFrameToOutput( aFrameMousePos );
+ aMousePos.AdjustX( -(maMouseOff.X()) );
+ aMousePos.AdjustY( -(maMouseOff.Y()) );
+ Point aFramePos = ImplOutputToFrame( aMousePos );
+ tools::Rectangle aTrackRect( aFramePos, Size( mnTrackWidth, mnTrackHeight ) );
+ tools::Rectangle aCompRect = aTrackRect;
+ aFramePos.AdjustX(maMouseOff.X() );
+ aFramePos.AdjustY(maMouseOff.Y() );
+ if ( mbDragFull )
+ StartDocking();
+ bool bFloatMode = Docking( aFramePos, aTrackRect );
+ if ( mbLastFloatMode != bFloatMode )
{
- Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
- Point aFrameMousePos = ImplOutputToFrame( aMousePos );
- Size aFrameSize = mpWindowImpl->mpFrameWindow->GetOutputSizePixel();
- if ( aFrameMousePos.X() < 0 )
- aFrameMousePos.setX( 0 );
- if ( aFrameMousePos.Y() < 0 )
- aFrameMousePos.setY( 0 );
- if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
- aFrameMousePos.setX( aFrameSize.Width()-1 );
- if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
- aFrameMousePos.setY( aFrameSize.Height()-1 );
- aMousePos = ImplFrameToOutput( aFrameMousePos );
- aMousePos.AdjustX( -(maMouseOff.X()) );
- aMousePos.AdjustY( -(maMouseOff.Y()) );
- Point aFramePos = ImplOutputToFrame( aMousePos );
- tools::Rectangle aTrackRect( aFramePos, Size( mnTrackWidth, mnTrackHeight ) );
- tools::Rectangle aCompRect = aTrackRect;
- aFramePos.AdjustX(maMouseOff.X() );
- aFramePos.AdjustY(maMouseOff.Y() );
- if ( mbDragFull )
- StartDocking();
- bool bFloatMode = Docking( aFramePos, aTrackRect );
- if ( mbLastFloatMode != bFloatMode )
+ if ( bFloatMode )
{
- if ( bFloatMode )
- {
- aTrackRect.AdjustLeft( -mnDockLeft );
- aTrackRect.AdjustTop( -mnDockTop );
- aTrackRect.AdjustRight(mnDockRight );
- aTrackRect.AdjustBottom(mnDockBottom );
- }
- else
- {
- if ( aCompRect == aTrackRect )
- {
- aTrackRect.AdjustLeft(mnDockLeft );
- aTrackRect.AdjustTop(mnDockTop );
- aTrackRect.AdjustRight( -mnDockRight );
- aTrackRect.AdjustBottom( -mnDockBottom );
- }
- }
- mbLastFloatMode = bFloatMode;
+ aTrackRect.AdjustLeft( -mnDockLeft );
+ aTrackRect.AdjustTop( -mnDockTop );
+ aTrackRect.AdjustRight(mnDockRight );
+ aTrackRect.AdjustBottom(mnDockBottom );
}
- if ( mbDragFull )
+ else
{
- Point aOldPos = OutputToScreenPixel( Point() );
- EndDocking( aTrackRect, mbLastFloatMode );
- // repaint if state or position has changed
- if ( aOldPos != OutputToScreenPixel( Point() ) )
+ if ( aCompRect == aTrackRect )
{
- ImplUpdateAll();
- ImplGetFrameWindow()->ImplUpdateAll();
+ aTrackRect.AdjustLeft(mnDockLeft );
+ aTrackRect.AdjustTop(mnDockTop );
+ aTrackRect.AdjustRight( -mnDockRight );
+ aTrackRect.AdjustBottom( -mnDockBottom );
}
-// EndDocking( aTrackRect, mbLastFloatMode );
}
- else
+ mbLastFloatMode = bFloatMode;
+ }
+ if ( mbDragFull )
+ {
+ Point aOldPos = OutputToScreenPixel( Point() );
+ EndDocking( aTrackRect, mbLastFloatMode );
+ // repaint if state or position has changed
+ if ( aOldPos != OutputToScreenPixel( Point() ) )
{
- ShowTrackFlags nTrackStyle;
- if ( bFloatMode )
- nTrackStyle = ShowTrackFlags::Big;
- else
- nTrackStyle = ShowTrackFlags::Object;
- tools::Rectangle aShowTrackRect = aTrackRect;
- aShowTrackRect.SetPos( ImplFrameToOutput( aShowTrackRect.TopLeft() ) );
- ShowTracking( aShowTrackRect, nTrackStyle );
-
- // recalculate mouse offset, as the rectangle was changed
- maMouseOff.setX( aFramePos.X() - aTrackRect.Left() );
- maMouseOff.setY( aFramePos.Y() - aTrackRect.Top() );
+ ImplUpdateAll();
+ ImplGetFrameWindow()->ImplUpdateAll();
}
-
- mnTrackX = aTrackRect.Left();
- mnTrackY = aTrackRect.Top();
- mnTrackWidth = aTrackRect.GetWidth();
- mnTrackHeight = aTrackRect.GetHeight();
+// EndDocking( aTrackRect, mbLastFloatMode );
}
+ else
+ {
+ ShowTrackFlags nTrackStyle;
+ if ( bFloatMode )
+ nTrackStyle = ShowTrackFlags::Big;
+ else
+ nTrackStyle = ShowTrackFlags::Object;
+ tools::Rectangle aShowTrackRect = aTrackRect;
+ aShowTrackRect.SetPos( ImplFrameToOutput( aShowTrackRect.TopLeft() ) );
+ ShowTracking( aShowTrackRect, nTrackStyle );
+
+ // recalculate mouse offset, as the rectangle was changed
+ maMouseOff.setX( aFramePos.X() - aTrackRect.Left() );
+ maMouseOff.setY( aFramePos.Y() - aTrackRect.Top() );
+ }
+
+ mnTrackX = aTrackRect.Left();
+ mnTrackY = aTrackRect.Top();
+ mnTrackWidth = aTrackRect.GetWidth();
+ mnTrackHeight = aTrackRect.GetHeight();
}
}
@@ -698,103 +698,103 @@ void DockingWindow::SetFloatingMode( bool bFloatMode )
pWrapper->SetFloatingMode( bFloatMode );
return;
}
- if ( IsFloatingMode() != bFloatMode )
+ if ( IsFloatingMode() == bFloatMode )
+ return;
+
+ if ( !PrepareToggleFloatingMode() ) // changes to floating mode can be vetoed
+ return;
+
+ bool bVisible = IsVisible();
+
+ if ( bFloatMode )
{
- if ( PrepareToggleFloatingMode() ) // changes to floating mode can be vetoed
- {
- bool bVisible = IsVisible();
+ // set deferred properties early, so border width will end up
+ // in our mpWindowImpl->mnBorderWidth, not in mpBorderWindow.
+ // (see its usage in setPosSizeOnContainee and GetOptimalSize.)
+ setDeferredProperties();
- if ( bFloatMode )
- {
- // set deferred properties early, so border width will end up
- // in our mpWindowImpl->mnBorderWidth, not in mpBorderWindow.
- // (see its usage in setPosSizeOnContainee and GetOptimalSize.)
- setDeferredProperties();
-
- Show( false, ShowFlags::NoFocusChange );
-
- maDockPos = Window::GetPosPixel();
-
- vcl::Window* pRealParent = mpWindowImpl->mpRealParent;
- mpOldBorderWin = mpWindowImpl->mpBorderWindow;
-
- VclPtrInstance<ImplDockFloatWin> pWin(
- mpImplData->mpParent,
- mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
- this );
- mpFloatWin = pWin;
- mpWindowImpl->mpBorderWindow = nullptr;
- mpWindowImpl->mnLeftBorder = 0;
- mpWindowImpl->mnTopBorder = 0;
- mpWindowImpl->mnRightBorder = 0;
- mpWindowImpl->mnBottomBorder = 0;
- // if the parent gets destroyed, we also have to reset the parent of the BorderWindow
- if ( mpOldBorderWin )
- mpOldBorderWin->SetParent( pWin );
-
- // #i123765# reset the buffered DropTargets when undocking, else it may not
- // be correctly initialized
- mpWindowImpl->mxDNDListenerContainer.clear();
-
- SetParent( pWin );
- SetPosPixel( Point() );
- mpWindowImpl->mpBorderWindow = pWin;
- pWin->mpWindowImpl->mpClientWindow = this;
- mpWindowImpl->mpRealParent = pRealParent;
- pWin->SetText( Window::GetText() );
- Size aSize(Window::GetSizePixel());
- pWin->SetOutputSizePixel(aSize);
- pWin->SetPosPixel( maFloatPos );
- // pass on DockingData to FloatingWindow
- pWin->ShowTitleButton( TitleButton::Docking, mbDockBtn );
- pWin->ShowTitleButton( TitleButton::Hide, mbHideBtn );
- if ( mbRollUp )
- pWin->RollUp();
- else
- pWin->RollDown();
- pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
- pWin->SetMinOutputSizePixel( maMinOutSize );
-
- pWin->SetMaxOutputSizePixel( mpImplData->maMaxOutSize );
-
- ToggleFloatingMode();
-
- if ( bVisible )
- Show();
- }
- else
- {
- Show( false, ShowFlags::NoFocusChange );
-
- // store FloatingData in FloatingWindow
- maFloatPos = mpFloatWin->GetPosPixel();
- mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
- mbHideBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Hide );
- mbRollUp = mpFloatWin->IsRollUp();
- maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
- maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
- mpImplData->maMaxOutSize = mpFloatWin->GetMaxOutputSizePixel();
-
- vcl::Window* pRealParent = mpWindowImpl->mpRealParent;
- mpWindowImpl->mpBorderWindow = nullptr;
- if ( mpOldBorderWin )
- {
- SetParent( mpOldBorderWin );
- static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
- mpOldBorderWin->Resize();
- }
- mpWindowImpl->mpBorderWindow = mpOldBorderWin;
- SetParent( pRealParent );
- mpWindowImpl->mpRealParent = pRealParent;
- mpFloatWin.disposeAndClear();
- SetPosPixel( maDockPos );
+ Show( false, ShowFlags::NoFocusChange );
- ToggleFloatingMode();
+ maDockPos = Window::GetPosPixel();
+
+ vcl::Window* pRealParent = mpWindowImpl->mpRealParent;
+ mpOldBorderWin = mpWindowImpl->mpBorderWindow;
+
+ VclPtrInstance<ImplDockFloatWin> pWin(
+ mpImplData->mpParent,
+ mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ? mnFloatBits | WB_SYSTEMWINDOW : mnFloatBits,
+ this );
+ mpFloatWin = pWin;
+ mpWindowImpl->mpBorderWindow = nullptr;
+ mpWindowImpl->mnLeftBorder = 0;
+ mpWindowImpl->mnTopBorder = 0;
+ mpWindowImpl->mnRightBorder = 0;
+ mpWindowImpl->mnBottomBorder = 0;
+ // if the parent gets destroyed, we also have to reset the parent of the BorderWindow
+ if ( mpOldBorderWin )
+ mpOldBorderWin->SetParent( pWin );
+
+ // #i123765# reset the buffered DropTargets when undocking, else it may not
+ // be correctly initialized
+ mpWindowImpl->mxDNDListenerContainer.clear();
+
+ SetParent( pWin );
+ SetPosPixel( Point() );
+ mpWindowImpl->mpBorderWindow = pWin;
+ pWin->mpWindowImpl->mpClientWindow = this;
+ mpWindowImpl->mpRealParent = pRealParent;
+ pWin->SetText( Window::GetText() );
+ Size aSize(Window::GetSizePixel());
+ pWin->SetOutputSizePixel(aSize);
+ pWin->SetPosPixel( maFloatPos );
+ // pass on DockingData to FloatingWindow
+ pWin->ShowTitleButton( TitleButton::Docking, mbDockBtn );
+ pWin->ShowTitleButton( TitleButton::Hide, mbHideBtn );
+ if ( mbRollUp )
+ pWin->RollUp();
+ else
+ pWin->RollDown();
+ pWin->SetRollUpOutputSizePixel( maRollUpOutSize );
+ pWin->SetMinOutputSizePixel( maMinOutSize );
- if ( bVisible )
- Show();
- }
+ pWin->SetMaxOutputSizePixel( mpImplData->maMaxOutSize );
+
+ ToggleFloatingMode();
+
+ if ( bVisible )
+ Show();
+ }
+ else
+ {
+ Show( false, ShowFlags::NoFocusChange );
+
+ // store FloatingData in FloatingWindow
+ maFloatPos = mpFloatWin->GetPosPixel();
+ mbDockBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
+ mbHideBtn = mpFloatWin->IsTitleButtonVisible( TitleButton::Hide );
+ mbRollUp = mpFloatWin->IsRollUp();
+ maRollUpOutSize = mpFloatWin->GetRollUpOutputSizePixel();
+ maMinOutSize = mpFloatWin->GetMinOutputSizePixel();
+ mpImplData->maMaxOutSize = mpFloatWin->GetMaxOutputSizePixel();
+
+ vcl::Window* pRealParent = mpWindowImpl->mpRealParent;
+ mpWindowImpl->mpBorderWindow = nullptr;
+ if ( mpOldBorderWin )
+ {
+ SetParent( mpOldBorderWin );
+ static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
+ mpOldBorderWin->Resize();
}
+ mpWindowImpl->mpBorderWindow = mpOldBorderWin;
+ SetParent( pRealParent );
+ mpWindowImpl->mpRealParent = pRealParent;
+ mpFloatWin.disposeAndClear();
+ SetPosPixel( maDockPos );
+
+ ToggleFloatingMode();
+
+ if ( bVisible )
+ Show();
}
}
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 4f31a2ebf768..4d7f3cf35284 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -647,18 +647,18 @@ void Window::ImplCallFocusChangeActivate( vcl::Window* pNewOverlapWindow,
}
}
}
- if ( bCallActivate && ! pNewOverlapWindow->mpWindowImpl->mbActive )
- {
- pNewOverlapWindow->mpWindowImpl->mbActive = true;
- pNewOverlapWindow->Activate();
+ if ( !bCallActivate || pNewOverlapWindow->mpWindowImpl->mbActive )
+ return;
+
+ pNewOverlapWindow->mpWindowImpl->mbActive = true;
+ pNewOverlapWindow->Activate();
- if ( pNewRealWindow != pNewOverlapWindow )
+ if ( pNewRealWindow != pNewOverlapWindow )
+ {
+ if( ! pNewRealWindow->mpWindowImpl->mbActive )
{
- if( ! pNewRealWindow->mpWindowImpl->mbActive )
- {
- pNewRealWindow->mpWindowImpl->mbActive = true;
- pNewRealWindow->Activate();
- }
+ pNewRealWindow->mpWindowImpl->mbActive = true;
+ pNewRealWindow->Activate();
}
}
}
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 95f39fba5955..53f9349e565f 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -732,22 +732,22 @@ void FloatingWindow::PopupModeEnd()
void FloatingWindow::SetTitleType( FloatWinTitleType nTitle )
{
- if ( (mnTitle != nTitle) && mpWindowImpl->mpBorderWindow )
- {
- mnTitle = nTitle;
- Size aOutSize = GetOutputSizePixel();
- BorderWindowTitleType nTitleStyle;
- if ( nTitle == FloatWinTitleType::Normal )
- nTitleStyle = BorderWindowTitleType::Small;
- else if ( nTitle == FloatWinTitleType::TearOff )
- nTitleStyle = BorderWindowTitleType::Tearoff;
- else if ( nTitle == FloatWinTitleType::Popup )
- nTitleStyle = BorderWindowTitleType::Popup;
- else // nTitle == FloatWinTitleType::NONE
- nTitleStyle = BorderWindowTitleType::NONE;
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetTitleType( nTitleStyle, aOutSize );
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
- }
+ if ( (mnTitle == nTitle) || !mpWindowImpl->mpBorderWindow )
+ return;
+
+ mnTitle = nTitle;
+ Size aOutSize = GetOutputSizePixel();
+ BorderWindowTitleType nTitleStyle;
+ if ( nTitle == FloatWinTitleType::Normal )
+ nTitleStyle = BorderWindowTitleType::Small;
+ else if ( nTitle == FloatWinTitleType::TearOff )
+ nTitleStyle = BorderWindowTitleType::Tearoff;
+ else if ( nTitle == FloatWinTitleType::Popup )
+ nTitleStyle = BorderWindowTitleType::Popup;
+ else // nTitle == FloatWinTitleType::NONE
+ nTitleStyle = BorderWindowTitleType::NONE;
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetTitleType( nTitleStyle, aOutSize );
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
}
void FloatingWindow::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nFlags )
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index f7e4a8b45324..30168a47a3f3 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2049,19 +2049,19 @@ void VclScrolledWindow::Paint(vcl::RenderContext& rRenderContext, const tools::R
void VclViewport::setAllocation(const Size &rAllocation)
{
vcl::Window *pChild = get_child();
- if (pChild && pChild->IsVisible())
+ if (!(pChild && pChild->IsVisible()))
+ return;
+
+ Size aReq(getLayoutRequisition(*pChild));
+ aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
+ aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
+ Point aKeepPos(pChild->GetPosPixel());
+ if (m_bInitialAllocation)
{
- Size aReq(getLayoutRequisition(*pChild));
- aReq.setWidth( std::max(aReq.Width(), rAllocation.Width()) );
- aReq.setHeight( std::max(aReq.Height(), rAllocation.Height()) );
- Point aKeepPos(pChild->GetPosPixel());
- if (m_bInitialAllocation)
- {
- aKeepPos = Point(0, 0);
- m_bInitialAllocation = false;
- }
- setLayoutAllocation(*pChild, aKeepPos, aReq);
+ aKeepPos = Point(0, 0);
+ m_bInitialAllocation = false;
}
+ setLayoutAllocation(*pChild, aKeepPos, aReq);
}
const vcl::Window *VclEventBox::get_child() const
@@ -2181,126 +2181,126 @@ void MessageDialog::create_message_area()
{
setDeferredProperties();
- if (!m_pGrid)
- {
- VclContainer *pContainer = get_content_area();
- assert(pContainer);
+ if (m_pGrid)
+ return;
- m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
- m_pGrid->reorderWithinParent(0);
- m_pGrid->set_column_spacing(12);
- m_pMessageBox.set(VclPtr<VclVBox>::Create(m_pGrid));
- m_pMessageBox->set_grid_left_attach(1);
- m_pMessageBox->set_grid_top_attach(0);
- m_pMessageBox->set_spacing(GetTextHeight());
+ VclContainer *pContainer = get_content_area();
+ assert(pContainer);
- m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
- switch (m_eMessageType)
- {
- case VclMessageType::Info:
- m_pImage->SetImage(GetStandardInfoBoxImage());
- break;
- case VclMessageType::Warning:
- m_pImage->SetImage(GetStandardWarningBoxImage());
- break;
- case VclMessageType::Question:
- m_pImage->SetImage(GetStandardQueryBoxImage());
- break;
- case VclMessageType::Error:
- m_pImage->SetImage(GetStandardErrorBoxImage());
- break;
- }
- m_pImage->set_grid_left_attach(0);
- m_pImage->set_grid_top_attach(0);
- m_pImage->set_valign(VclAlign::Start);
- m_pImage->Show();
+ m_pGrid.set( VclPtr<VclGrid>::Create(pContainer) );
+ m_pGrid->reorderWithinParent(0);
+ m_pGrid->set_column_spacing(12);
+ m_pMessageBox.set(VclPtr<VclVBox>::Create(m_pGrid));
+ m_pMessageBox->set_grid_left_attach(1);
+ m_pMessageBox->set_grid_top_attach(0);
+ m_pMessageBox->set_spacing(GetTextHeight());
+
+ m_pImage = VclPtr<FixedImage>::Create(m_pGrid, WB_CENTER | WB_VCENTER | WB_3DLOOK);
+ switch (m_eMessageType)
+ {
+ case VclMessageType::Info:
+ m_pImage->SetImage(GetStandardInfoBoxImage());
+ break;
+ case VclMessageType::Warning:
+ m_pImage->SetImage(GetStandardWarningBoxImage());
+ break;
+ case VclMessageType::Question:
+ m_pImage->SetImage(GetStandardQueryBoxImage());
+ break;
+ case VclMessageType::Error:
+ m_pImage->SetImage(GetStandardErrorBoxImage());
+ break;
+ }
+ m_pImage->set_grid_left_attach(0);
+ m_pImage->set_grid_top_attach(0);
+ m_pImage->set_valign(VclAlign::Start);
+ m_pImage->Show();
- WinBits nWinStyle = WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_NOLABEL | WB_NOTABSTOP;
+ WinBits nWinStyle = WB_CLIPCHILDREN | WB_LEFT | WB_VCENTER | WB_NOLABEL | WB_NOTABSTOP;
- bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
+ bool bHasSecondaryText = !m_sSecondaryString.isEmpty();
- m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
- m_pPrimaryMessage->SetPaintTransparent(true);
- m_pPrimaryMessage->EnableCursor(false);
+ m_pPrimaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
+ m_pPrimaryMessage->SetPaintTransparent(true);
+ m_pPrimaryMessage->EnableCursor(false);
- m_pPrimaryMessage->set_hexpand(true);
- m_pPrimaryMessage->SetText(m_sPrimaryString);
- m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
+ m_pPrimaryMessage->set_hexpand(true);
+ m_pPrimaryMessage->SetText(m_sPrimaryString);
+ m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty());
- m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
- m_pSecondaryMessage->SetPaintTransparent(true);
- m_pSecondaryMessage->EnableCursor(false);
- m_pSecondaryMessage->set_hexpand(true);
- m_pSecondaryMessage->SetText(m_sSecondaryString);
- m_pSecondaryMessage->Show(bHasSecondaryText);
+ m_pSecondaryMessage = VclPtr<VclMultiLineEdit>::Create(m_pMessageBox, nWinStyle);
+ m_pSecondaryMessage->SetPaintTransparent(true);
+ m_pSecondaryMessage->EnableCursor(false);
+ m_pSecondaryMessage->set_hexpand(true);
+ m_pSecondaryMessage->SetText(m_sSecondaryString);
+ m_pSecondaryMessage->Show(bHasSecondaryText);
- MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
+ MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, bHasSecondaryText ? m_pSecondaryMessage.get() : nullptr);
- VclButtonBox *pButtonBox = get_action_area();
- assert(pButtonBox);
+ VclButtonBox *pButtonBox = get_action_area();
+ assert(pButtonBox);
- VclPtr<PushButton> pBtn;
- short nDefaultResponse = get_default_response();
- switch (m_eButtonsType)
- {
- case VclButtonsType::NONE:
- break;
- case VclButtonsType::Ok:
- pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("ok");
- add_button(pBtn, RET_OK, true);
- nDefaultResponse = RET_OK;
- break;
- case VclButtonsType::Close:
- pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("close");
- add_button(pBtn, RET_CLOSE, true);
- nDefaultResponse = RET_CLOSE;
- break;
- case VclButtonsType::Cancel:
- pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
- pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
- pBtn->Show();
- pBtn->set_id("cancel");
- add_button(pBtn, RET_CANCEL, true);
- nDefaultResponse = RET_CANCEL;
- break;
- case VclButtonsType::YesNo:
- pBtn = VclPtr<PushButton>::Create(pButtonBox);
- pBtn->SetText(GetStandardText(StandardButtonType::Yes));
- pBtn->Show();
- pBtn->set_id("yes");
- add_button(pBtn, RET_YES, true);
-
- pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
- pBtn->SetText(GetStandardText(StandardButtonType::No));
- pBtn->Show();
- pBtn->set_id("no");
- add_button(pBtn, RET_NO, true);
- nDefaultResponse = RET_NO;
- break;
- case VclButtonsType::OkCancel:
- pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
- pBtn->Show();
- pBtn->set_id("ok");
- add_button(pBtn, RET_OK, true);
-
- pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
- pBtn->Show();
- pBtn->set_id("cancel");
- add_button(pBtn, RET_CANCEL, true);
- nDefaultResponse = RET_CANCEL;
- break;
- }
- set_default_response(nDefaultResponse);
- sort_native_button_order(*pButtonBox);
- m_pMessageBox->Show();
- m_pGrid->Show();
+ VclPtr<PushButton> pBtn;
+ short nDefaultResponse = get_default_response();
+ switch (m_eButtonsType)
+ {
+ case VclButtonsType::NONE:
+ break;
+ case VclButtonsType::Ok:
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("ok");
+ add_button(pBtn, RET_OK, true);
+ nDefaultResponse = RET_OK;
+ break;
+ case VclButtonsType::Close:
+ pBtn.set( VclPtr<CloseButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("close");
+ add_button(pBtn, RET_CLOSE, true);
+ nDefaultResponse = RET_CLOSE;
+ break;
+ case VclButtonsType::Cancel:
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+ pBtn->SetStyle(pBtn->GetStyle() & WB_DEFBUTTON);
+ pBtn->Show();
+ pBtn->set_id("cancel");
+ add_button(pBtn, RET_CANCEL, true);
+ nDefaultResponse = RET_CANCEL;
+ break;
+ case VclButtonsType::YesNo:
+ pBtn = VclPtr<PushButton>::Create(pButtonBox);
+ pBtn->SetText(GetStandardText(StandardButtonType::Yes));
+ pBtn->Show();
+ pBtn->set_id("yes");
+ add_button(pBtn, RET_YES, true);
+
+ pBtn.set( VclPtr<PushButton>::Create(pButtonBox) );
+ pBtn->SetText(GetStandardText(StandardButtonType::No));
+ pBtn->Show();
+ pBtn->set_id("no");
+ add_button(pBtn, RET_NO, true);
+ nDefaultResponse = RET_NO;
+ break;
+ case VclButtonsType::OkCancel:
+ pBtn.set( VclPtr<OKButton>::Create(pButtonBox) );
+ pBtn->Show();
+ pBtn->set_id("ok");
+ add_button(pBtn, RET_OK, true);
+
+ pBtn.set( VclPtr<CancelButton>::Create(pButtonBox) );
+ pBtn->Show();
+ pBtn->set_id("cancel");
+ add_button(pBtn, RET_CANCEL, true);
+ nDefaultResponse = RET_CANCEL;
+ break;
}
+ set_default_response(nDefaultResponse);
+ sort_native_button_order(*pButtonBox);
+ m_pMessageBox->Show();
+ m_pGrid->Show();
}
void MessageDialog::create_owned_areas()
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 3d5d88fa11f2..6ffbdd2fd0e5 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -907,33 +907,33 @@ void Menu::EnableItem( sal_uInt16 nItemId, bool bEnable )
size_t nPos;
MenuItemData* pItemData = pItemList->GetData( nItemId, nPos );
- if ( pItemData && ( pItemData->bEnabled != bEnable ) )
- {
- pItemData->bEnabled = bEnable;
+ if ( !(pItemData && ( pItemData->bEnabled != bEnable )) )
+ return;
- vcl::Window* pWin = ImplGetWindow();
- if ( pWin && pWin->IsVisible() )
+ pItemData->bEnabled = bEnable;
+
+ vcl::Window* pWin = ImplGetWindow();
+ if ( pWin && pWin->IsVisible() )
+ {
+ SAL_WARN_IF(!IsMenuBar(), "vcl", "Menu::EnableItem - Popup visible!" );
+ long nX = 0;
+ size_t nCount = pItemList->size();
+ for ( size_t n = 0; n < nCount; n++ )
{
- SAL_WARN_IF(!IsMenuBar(), "vcl", "Menu::EnableItem - Popup visible!" );
- long nX = 0;
- size_t nCount = pItemList->size();
- for ( size_t n = 0; n < nCount; n++ )
+ MenuItemData* pData = pItemList->GetDataFromPos( n );
+ if ( n == nPos )
{
- MenuItemData* pData = pItemList->GetDataFromPos( n );
- if ( n == nPos )
- {
- pWin->Invalidate( tools::Rectangle( Point( nX, 0 ), Size( pData->aSz.Width(), pData->aSz.Height() ) ) );
- break;
- }
- nX += pData->aSz.Width();
+ pWin->Invalidate( tools::Rectangle( Point( nX, 0 ), Size( pData->aSz.Width(), pData->aSz.Height() ) ) );
+ break;
}
+ nX += pData->aSz.Width();
}
- // update native menu
- if( ImplGetSalMenu() )
- ImplGetSalMenu()->EnableItem( nPos, bEnable );
-
- ImplCallEventListeners( bEnable ? VclEventId::MenuEnable : VclEventId::MenuDisable, nPos );
}
+ // update native menu
+ if( ImplGetSalMenu() )
+ ImplGetSalMenu()->EnableItem( nPos, bEnable );
+
+ ImplCallEventListeners( bEnable ? VclEventId::MenuEnable : VclEventId::MenuDisable, nPos );
}
bool Menu::IsItemEnabled( sal_uInt16 nItemId ) const
@@ -953,20 +953,20 @@ void Menu::ShowItem( sal_uInt16 nItemId, bool bVisible )
MenuItemData* pData = pItemList->GetData( nItemId, nPos );
SAL_WARN_IF(IsMenuBar() && !bVisible , "vcl", "Menu::ShowItem - ignored for menu bar entries!");
- if (!IsMenuBar()&& pData && (pData->bVisible != bVisible))
- {
- vcl::Window* pWin = ImplGetWindow();
- if ( pWin && pWin->IsVisible() )
- {
- SAL_WARN( "vcl", "Menu::ShowItem - ignored for visible popups!" );
- return;
- }
- pData->bVisible = bVisible;
+ if (IsMenuBar() || !pData || (pData->bVisible == bVisible))
+ return;
- // update native menu
- if( ImplGetSalMenu() )
- ImplGetSalMenu()->ShowItem( nPos, bVisible );
+ vcl::Window* pWin = ImplGetWindow();
+ if ( pWin && pWin->IsVisible() )
+ {
+ SAL_WARN( "vcl", "Menu::ShowItem - ignored for visible popups!" );
+ return;
}
+ pData->bVisible = bVisible;
+
+ // update native menu
+ if( ImplGetSalMenu() )
+ ImplGetSalMenu()->ShowItem( nPos, bVisible );
}
void Menu::SetItemText( sal_uInt16 nItemId, const OUString& rStr )
@@ -977,27 +977,27 @@ void Menu::SetItemText( sal_uInt16 nItemId, const OUString& rStr )
if ( !pData )
return;
- if ( rStr != pData->aText )
- {
- pData->aText = rStr;
- // Clear layout for aText.
- pData->aTextGlyphs.Invalidate();
- ImplSetMenuItemData( pData );
- // update native menu
- if( ImplGetSalMenu() && pData->pSalMenuItem )
- ImplGetSalMenu()->SetItemText( nPos, pData->pSalMenuItem.get(), rStr );
+ if ( rStr == pData->aText )
+ return;
- vcl::Window* pWin = ImplGetWindow();
- mpLayoutData.reset();
- if (pWin && IsMenuBar())
- {
- ImplCalcSize( pWin );
- if ( pWin->IsVisible() )
- pWin->Invalidate();
- }
+ pData->aText = rStr;
+ // Clear layout for aText.
+ pData->aTextGlyphs.Invalidate();
+ ImplSetMenuItemData( pData );
+ // update native menu
+ if( ImplGetSalMenu() && pData->pSalMenuItem )
+ ImplGetSalMenu()->SetItemText( nPos, pData->pSalMenuItem.get(), rStr );
- ImplCallEventListeners( VclEventId::MenuItemTextChanged, nPos );
+ vcl::Window* pWin = ImplGetWindow();
+ mpLayoutData.reset();
+ if (pWin && IsMenuBar())
+ {
+ ImplCalcSize( pWin );
+ if ( pWin->IsVisible() )
+ pWin->Invalidate();
}
+
+ ImplCallEventListeners( VclEventId::MenuItemTextChanged, nPos );
}
OUString Menu::GetItemText( sal_uInt16 nItemId ) const
@@ -2215,19 +2215,19 @@ void Menu::ImplKillLayoutData() const
void Menu::ImplFillLayoutData() const
{
- if (pWindow && pWindow->IsReallyVisible())
+ if (!(pWindow && pWindow->IsReallyVisible()))
+ return;
+
+ mpLayoutData.reset(new MenuLayoutData);
+ if (IsMenuBar())
{
- mpLayoutData.reset(new MenuLayoutData);
- if (IsMenuBar())
- {
- ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME
- }
- else
- {
- MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get());
- ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(),
- nullptr, false, true); //FIXME
- }
+ ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), 0, 0, nullptr, false, true); // FIXME
+ }
+ else
+ {
+ MenuFloatingWindow* pFloat = static_cast<MenuFloatingWindow*>(pWindow.get());
+ ImplPaint(*pWindow, pWindow->GetOutputSizePixel(), pFloat->nScrollerHeight, pFloat->ImplGetStartY(),
+ nullptr, false, true); //FIXME
}
}
@@ -2325,18 +2325,18 @@ bool Menu::IsHighlighted( sal_uInt16 nItemPos ) const
void Menu::HighlightItem( sal_uInt16 nItemPos )
{
- if ( pWindow )
+ if ( !pWindow )
+ return;
+
+ if (IsMenuBar())
{
- if (IsMenuBar())
- {
- MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow.get() );
- pMenuWin->SetAutoPopup( false );
- pMenuWin->ChangeHighlightItem( nItemPos, false );
- }
- else
- {
- static_cast< MenuFloatingWindow* >( pWindow.get() )->ChangeHighlightItem( nItemPos, false );
- }
+ MenuBarWindow* pMenuWin = static_cast< MenuBarWindow* >( pWindow.get() );
+ pMenuWin->SetAutoPopup( false );
+ pMenuWin->ChangeHighlightItem( nItemPos, false );
+ }
+ else
+ {
+ static_cast< MenuFloatingWindow* >( pWindow.get() )->ChangeHighlightItem( nItemPos, false );
}
}
@@ -2531,24 +2531,24 @@ bool MenuBar::ImplHandleCmdEvent( const CommandEvent& rCEvent )
void MenuBar::SelectItem(sal_uInt16 nId)
{
- if (pWindow)
- {
- pWindow->GrabFocus();
- nId = GetItemPos( nId );
+ if (!pWindow)
+ return;
- MenuBarWindow* pMenuWin = getMenuBarWindow();
- if (pMenuWin)
+ pWindow->GrabFocus();
+ nId = GetItemPos( nId );
+
+ MenuBarWindow* pMenuWin = getMenuBarWindow();
+ if (pMenuWin)
+ {
+ // #99705# popup the selected menu
+ pMenuWin->SetAutoPopup( true );
+ if (ITEMPOS_INVALID != pMenuWin->GetHighlightedItem())
{
- // #99705# popup the selected menu
- pMenuWin->SetAutoPopup( true );
- if (ITEMPOS_INVALID != pMenuWin->GetHighlightedItem())
- {
- pMenuWin->KillActivePopup();
- pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, false );
- }
- if (nId != ITEMPOS_INVALID)
- pMenuWin->ChangeHighlightItem( nId, false );
+ pMenuWin->KillActivePopup();
+ pMenuWin->ChangeHighlightItem( ITEMPOS_INVALID, false );
}
+ if (nId != ITEMPOS_INVALID)
+ pMenuWin->ChangeHighlightItem( nId, false );
}
}
@@ -2726,32 +2726,32 @@ void PopupMenu::EndExecute()
void PopupMenu::SelectItem(sal_uInt16 nId)
{
- if ( ImplGetWindow() )
+ if ( !ImplGetWindow() )
+ return;
+
+ if( nId != ITEMPOS_INVALID )
{
- if( nId != ITEMPOS_INVALID )
- {
- size_t nPos = 0;
- MenuItemData* pData = GetItemList()->GetData( nId, nPos );
- if (pData && pData->pSubMenu)
- ImplGetFloatingWindow()->ChangeHighlightItem( nPos, true );
- else
- ImplGetFloatingWindow()->EndExecute( nId );
- }
+ size_t nPos = 0;
+ MenuItemData* pData = GetItemList()->GetData( nId, nPos );
+ if (pData && pData->pSubMenu)
+ ImplGetFloatingWindow()->ChangeHighlightItem( nPos, true );
else
- {
- MenuFloatingWindow* pFloat = ImplGetFloatingWindow();
- pFloat->GrabFocus();
+ ImplGetFloatingWindow()->EndExecute( nId );
+ }
+ else
+ {
+ MenuFloatingWindow* pFloat = ImplGetFloatingWindow();
+ pFloat->GrabFocus();
- for( size_t nPos = 0; nPos < GetItemList()->size(); nPos++ )
+ for( size_t nPos = 0; nPos < GetItemList()->size(); nPos++ )
+ {
+ MenuItemData* pData = GetItemList()->GetDataFromPos( nPos );
+ if( pData->pSubMenu )
{
- MenuItemData* pData = GetItemList()->GetDataFromPos( nPos );
- if( pData->pSubMenu )
- {
- pFloat->KillActivePopup();
- }
+ pFloat->KillActivePopup();
}
- pFloat->ChangeHighlightItem( ITEMPOS_INVALID, false );
}
+ pFloat->ChangeHighlightItem( ITEMPOS_INVALID, false );
}
}
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 41a51b79ce5b..52913815f2c4 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -277,108 +277,108 @@ IMPL_LINK( MenuBarWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst )
{
MenuItemData* pItemData = m_pMenu ? m_pMenu->GetItemList()->GetDataFromPos( m_nHighlightedItem ) : nullptr;
- if ( pItemData )
+ if ( !pItemData )
+ return;
+
+ m_bIgnoreFirstMove = true;
+ if ( m_pActivePopup && ( m_pActivePopup != pItemData->pSubMenu ) )
{
- m_bIgnoreFirstMove = true;
- if ( m_pActivePopup && ( m_pActivePopup != pItemData->pSubMenu ) )
- {
- KillActivePopup();
- }
- if ( pItemData->bEnabled && pItemData->pSubMenu && ( m_nHighlightedItem != ITEMPOS_INVALID ) &&
- ( pItemData->pSubMenu != m_pActivePopup ) )
- {
- m_pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
- long nX = 0;
- MenuItemData* pData = nullptr;
- for ( sal_uLong n = 0; n < m_nHighlightedItem; n++ )
- {
- pData = m_pMenu->GetItemList()->GetDataFromPos( n );
- nX += pData->aSz.Width();
- }
- pData = m_pMenu->pItemList->GetDataFromPos( m_nHighlightedItem );
- Point aItemTopLeft( nX, 0 );
- Point aItemBottomRight( aItemTopLeft );
- aItemBottomRight.AdjustX(pData->aSz.Width() );
+ KillActivePopup();
+ }
+ if ( !(pItemData->bEnabled && pItemData->pSubMenu && ( m_nHighlightedItem != ITEMPOS_INVALID ) &&
+ ( pItemData->pSubMenu != m_pActivePopup )) )
+ return;
- if (pData->bHiddenOnGUI)
- {
- mpParentPopup.disposeAndClear();
- mpParentPopup = VclPtr<PopupMenu>::Create();
- m_pActivePopup = mpParentPopup.get();
+ m_pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
+ long nX = 0;
+ MenuItemData* pData = nullptr;
+ for ( sal_uLong n = 0; n < m_nHighlightedItem; n++ )
+ {
+ pData = m_pMenu->GetItemList()->GetDataFromPos( n );
+ nX += pData->aSz.Width();
+ }
+ pData = m_pMenu->pItemList->GetDataFromPos( m_nHighlightedItem );
+ Point aItemTopLeft( nX, 0 );
+ Point aItemBottomRight( aItemTopLeft );
+ aItemBottomRight.AdjustX(pData->aSz.Width() );
- for (sal_uInt16 i = m_nHighlightedItem; i < m_pMenu->GetItemCount(); ++i)
- {
- sal_uInt16 nId = m_pMenu->GetItemId(i);
-
- MenuItemData* pParentItemData = m_pMenu->GetItemList()->GetData(nId);
- assert(pParentItemData);
- mpParentPopup->InsertItem(nId, pParentItemData->aText, pParentItemData->nBits, pParentItemData->sIdent);
- mpParentPopup->SetHelpId(nId, pParentItemData->aHelpId);
- mpParentPopup->SetHelpText(nId, pParentItemData->aHelpText);
- mpParentPopup->SetAccelKey(nId, pParentItemData->aAccelKey);
- mpParentPopup->SetItemCommand(nId, pParentItemData->aCommandStr);
- mpParentPopup->SetHelpCommand(nId, pParentItemData->aHelpCommandStr);
-
- PopupMenu* pPopup = m_pMenu->GetPopupMenu(nId);
- mpParentPopup->SetPopupMenu(nId, pPopup);
- }
- }
- // the menu bar could have height 0 in fullscreen mode:
- // so do not use always WindowHeight, as ItemHeight < WindowHeight.
- if ( GetSizePixel().Height() )
- {
- // #107747# give menuitems the height of the menubar
- aItemBottomRight.AdjustY(GetOutputSizePixel().Height()-1 );
- }
+ if (pData->bHiddenOnGUI)
+ {
+ mpParentPopup.disposeAndClear();
+ mpParentPopup = VclPtr<PopupMenu>::Create();
+ m_pActivePopup = mpParentPopup.get();
- // ImplExecute is not modal...
- // #99071# do not grab the focus, otherwise it will be restored to the menubar
- // when the frame is reactivated later
- //GrabFocus();
- m_pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Down | FloatWinPopupFlags::NoHorzPlacement, m_pMenu, bPreSelectFirst );
- // does not have a window, if aborted before or if there are no entries
- if ( m_pActivePopup->ImplGetFloatingWindow() )
- m_pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
- else
- m_pActivePopup = nullptr;
+ for (sal_uInt16 i = m_nHighlightedItem; i < m_pMenu->GetItemCount(); ++i)
+ {
+ sal_uInt16 nId = m_pMenu->GetItemId(i);
+
+ MenuItemData* pParentItemData = m_pMenu->GetItemList()->GetData(nId);
+ assert(pParentItemData);
+ mpParentPopup->InsertItem(nId, pParentItemData->aText, pParentItemData->nBits, pParentItemData->sIdent);
+ mpParentPopup->SetHelpId(nId, pParentItemData->aHelpId);
+ mpParentPopup->SetHelpText(nId, pParentItemData->aHelpText);
+ mpParentPopup->SetAccelKey(nId, pParentItemData->aAccelKey);
+ mpParentPopup->SetItemCommand(nId, pParentItemData->aCommandStr);
+ mpParentPopup->SetHelpCommand(nId, pParentItemData->aHelpCommandStr);
+
+ PopupMenu* pPopup = m_pMenu->GetPopupMenu(nId);
+ mpParentPopup->SetPopupMenu(nId, pPopup);
}
}
+ // the menu bar could have height 0 in fullscreen mode:
+ // so do not use always WindowHeight, as ItemHeight < WindowHeight.
+ if ( GetSizePixel().Height() )
+ {
+ // #107747# give menuitems the height of the menubar
+ aItemBottomRight.AdjustY(GetOutputSizePixel().Height()-1 );
+ }
+
+ // ImplExecute is not modal...
+ // #99071# do not grab the focus, otherwise it will be restored to the menubar
+ // when the frame is reactivated later
+ //GrabFocus();
+ m_pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Down | FloatWinPopupFlags::NoHorzPlacement, m_pMenu, bPreSelectFirst );
+ // does not have a window, if aborted before or if there are no entries
+ if ( m_pActivePopup->ImplGetFloatingWindow() )
+ m_pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
+ else
+ m_pActivePopup = nullptr;
}
void MenuBarWindow::KillActivePopup()
{
- if ( m_pActivePopup )
+ if ( !m_pActivePopup )
+ return;
+
+ if( m_pActivePopup->pWindow )
+ if( static_cast<FloatingWindow *>(m_pActivePopup->pWindow.get())->IsInCleanUp() )
+ return; // kill it later
+
+ if ( m_pActivePopup->bInCallback )
+ m_pActivePopup->bCanceled = true;
+
+ m_pActivePopup->bInCallback = true;
+ m_pActivePopup->Deactivate();
+ m_pActivePopup->bInCallback = false;
+ // check for pActivePopup, if stopped by deactivate...
+ if ( m_pActivePopup->ImplGetWindow() )
{
- if( m_pActivePopup->pWindow )
- if( static_cast<FloatingWindow *>(m_pActivePopup->pWindow.get())->IsInCleanUp() )
- return; // kill it later
-
- if ( m_pActivePopup->bInCallback )
- m_pActivePopup->bCanceled = true;
-
- m_pActivePopup->bInCallback = true;
- m_pActivePopup->Deactivate();
- m_pActivePopup->bInCallback = false;
- // check for pActivePopup, if stopped by deactivate...
- if ( m_pActivePopup->ImplGetWindow() )
+ if (mpParentPopup)
{
- if (mpParentPopup)
+ for (sal_uInt16 i = 0; i < mpParentPopup->GetItemCount(); ++i)
{
- for (sal_uInt16 i = 0; i < mpParentPopup->GetItemCount(); ++i)
- {
- sal_uInt16 nId = mpParentPopup->GetItemId(i);
- MenuItemData* pParentItemData = mpParentPopup->GetItemList()->GetData(nId);
- assert(pParentItemData);
- pParentItemData->pSubMenu = nullptr;
- }
+ sal_uInt16 nId = mpParentPopup->GetItemId(i);
+ MenuItemData* pParentItemData = mpParentPopup->GetItemList()->GetData(nId);
+ assert(pParentItemData);
+ pParentItemData->pSubMenu = nullptr;
}
- m_pActivePopup->ImplGetFloatingWindow()->StopExecute();
- m_pActivePopup->ImplGetFloatingWindow()->doShutdown();
- m_pActivePopup->pWindow->SetParentToDefaultWindow();
- m_pActivePopup->pWindow.disposeAndClear();
}
- m_pActivePopup = nullptr;
+ m_pActivePopup->ImplGetFloatingWindow()->StopExecute();
+ m_pActivePopup->ImplGetFloatingWindow()->doShutdown();
+ m_pActivePopup->pWindow->SetParentToDefaultWindow();
+ m_pActivePopup->pWindow.disposeAndClear();
}
+ m_pActivePopup = nullptr;
}
void MenuBarWindow::PopupClosed( Menu const * pPopup )
@@ -1096,20 +1096,20 @@ void MenuBarWindow::ApplySettings(vcl::RenderContext& rRenderContext)
void MenuBarWindow::ImplInitStyleSettings()
{
- if (IsNativeControlSupported(ControlType::Menubar, ControlPart::MenuItem) &&
- IsNativeControlSupported(ControlType::Menubar, ControlPart::Entire))
+ if (!(IsNativeControlSupported(ControlType::Menubar, ControlPart::MenuItem) &&
+ IsNativeControlSupported(ControlType::Menubar, ControlPart::Entire)))
+ return;
+
+ AllSettings aSettings(GetSettings());
+ ImplGetFrame()->UpdateSettings(aSettings); // to update persona
+ StyleSettings aStyle(aSettings.GetStyleSettings());
+ Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
+ if (aHighlightTextColor != COL_TRANSPARENT)
{
- AllSettings aSettings(GetSettings());
- ImplGetFrame()->UpdateSettings(aSettings); // to update persona
- StyleSettings aStyle(aSettings.GetStyleSettings());
- Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
- if (aHighlightTextColor != COL_TRANSPARENT)
- {
- aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
- }
- aSettings.SetStyleSettings(aStyle);
- OutputDevice::SetSettings(aSettings);
+ aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
}
+ aSettings.SetStyleSettings(aStyle);
+ OutputDevice::SetSettings(aSettings);
}
void MenuBarWindow::DataChanged( const DataChangedEvent& rDCEvt )
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 84e19a63e0b5..28ffca8d1526 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -324,59 +324,59 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void )
return;
MenuItemData* pItemData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
- if ( pItemData )
+ if ( !pItemData )
+ return;
+
+ if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) )
{
- if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) )
- {
- FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
- SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
- KillActivePopup();
- SetPopupModeFlags( nOldFlags );
- }
- if ( pItemData->bEnabled && pItemData->pSubMenu && pItemData->pSubMenu->GetItemCount() && ( pItemData->pSubMenu != pActivePopup ) )
- {
- pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
- long nY = nScrollerHeight+ImplGetStartY();
- MenuItemData* pData = nullptr;
- for ( sal_uLong n = 0; n < nHighlightedItem; n++ )
- {
- pData = pMenu->pItemList->GetDataFromPos( n );
- nY += pData->aSz.Height();
- }
- pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
- Size MySize = GetOutputSizePixel();
- Point aItemTopLeft( 0, nY );
- Point aItemBottomRight( aItemTopLeft );
- aItemBottomRight.AdjustX(MySize.Width() );
- aItemBottomRight.AdjustY(pData->aSz.Height() );
-
- // shift the popups a little
- aItemTopLeft.AdjustX(2 );
- aItemBottomRight.AdjustX( -2 );
- if ( nHighlightedItem )
- aItemTopLeft.AdjustY( -2 );
- else
- {
- sal_Int32 nL, nT, nR, nB;
- GetBorder( nL, nT, nR, nB );
- aItemTopLeft.AdjustY( -nT );
- }
+ FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
+ SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
+ KillActivePopup();
+ SetPopupModeFlags( nOldFlags );
+ }
+ if ( !(pItemData->bEnabled && pItemData->pSubMenu && pItemData->pSubMenu->GetItemCount() && ( pItemData->pSubMenu != pActivePopup )) )
+ return;
- // pTest: crash due to Reschedule() in call of Activate()
- // Also it is prevented that submenus are displayed which
- // were for long in Activate Rescheduled and which should not be
- // displayed now.
- Menu* pTest = pActivePopup;
- FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
- SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
- sal_uInt16 nRet = pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Right, pMenu, pTimer == nullptr );
- SetPopupModeFlags( nOldFlags );
-
- // nRet != 0, if it was stopped during Activate()...
- if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() )
- pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
- }
+ pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
+ long nY = nScrollerHeight+ImplGetStartY();
+ MenuItemData* pData = nullptr;
+ for ( sal_uLong n = 0; n < nHighlightedItem; n++ )
+ {
+ pData = pMenu->pItemList->GetDataFromPos( n );
+ nY += pData->aSz.Height();
}
+ pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
+ Size MySize = GetOutputSizePixel();
+ Point aItemTopLeft( 0, nY );
+ Point aItemBottomRight( aItemTopLeft );
+ aItemBottomRight.AdjustX(MySize.Width() );
+ aItemBottomRight.AdjustY(pData->aSz.Height() );
+
+ // shift the popups a little
+ aItemTopLeft.AdjustX(2 );
+ aItemBottomRight.AdjustX( -2 );
+ if ( nHighlightedItem )
+ aItemTopLeft.AdjustY( -2 );
+ else
+ {
+ sal_Int32 nL, nT, nR, nB;
+ GetBorder( nL, nT, nR, nB );
+ aItemTopLeft.AdjustY( -nT );
+ }
+
+ // pTest: crash due to Reschedule() in call of Activate()
+ // Also it is prevented that submenus are displayed which
+ // were for long in Activate Rescheduled and which should not be
+ // displayed now.
+ Menu* pTest = pActivePopup;
+ FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
+ SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
+ sal_uInt16 nRet = pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Right, pMenu, pTimer == nullptr );
+ SetPopupModeFlags( nOldFlags );
+
+ // nRet != 0, if it was stopped during Activate()...
+ if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() )
+ pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
}
IMPL_LINK_NOARG(MenuFloatingWindow, SubmenuClose, Timer *, void)
@@ -479,30 +479,30 @@ void MenuFloatingWindow::StopExecute()
void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
{
- if ( pActivePopup && ( !pThisOnly || ( pThisOnly == pActivePopup ) ) )
+ if ( !pActivePopup || ( pThisOnly && ( pThisOnly != pActivePopup ) ) )
+ return;
+
+ if( pActivePopup->pWindow )
+ if( static_cast<FloatingWindow *>(pActivePopup->pWindow.get())->IsInCleanUp() )
+ return; // kill it later
+ if ( pActivePopup->bInCallback )
+ pActivePopup->bCanceled = true;
+
+ // For all actions pActivePopup = 0, if e.g.
+ // PopupModeEndHdl the popups to destroy were called synchronous
+ PopupMenu* pPopup = pActivePopup;
+ pActivePopup = nullptr;
+ pPopup->bInCallback = true;
+ pPopup->Deactivate();
+ pPopup->bInCallback = false;
+ if ( pPopup->ImplGetWindow() )
{
- if( pActivePopup->pWindow )
- if( static_cast<FloatingWindow *>(pActivePopup->pWindow.get())->IsInCleanUp() )
- return; // kill it later
- if ( pActivePopup->bInCallback )
- pActivePopup->bCanceled = true;
-
- // For all actions pActivePopup = 0, if e.g.
- // PopupModeEndHdl the popups to destroy were called synchronous
- PopupMenu* pPopup = pActivePopup;
- pActivePopup = nullptr;
- pPopup->bInCallback = true;
- pPopup->Deactivate();
- pPopup->bInCallback = false;
- if ( pPopup->ImplGetWindow() )
- {
- pPopup->ImplGetFloatingWindow()->StopExecute();
- pPopup->ImplGetFloatingWindow()->doShutdown();
- pPopup->pWindow->SetParentToDefaultWindow();
- pPopup->pWindow.disposeAndClear();
+ pPopup->ImplGetFloatingWindow()->StopExecute();
+ pPopup->ImplGetFloatingWindow()->doShutdown();
+ pPopup->pWindow->SetParentToDefaultWindow();
+ pPopup->pWindow.disposeAndClear();
- PaintImmediately();
- }
+ PaintImmediately();
}
}
@@ -527,21 +527,21 @@ void MenuFloatingWindow::EndExecute()
pCleanUpFrom->StopExecute();
- if ( nItem != ITEMPOS_INVALID && pM )
+ if ( !(nItem != ITEMPOS_INVALID && pM) )
+ return;
+
+ MenuItemData* pItemData = pM->GetItemList()->GetDataFromPos( nItem );
+ if ( pItemData && !pItemData->bIsTemporary )
{
- MenuItemData* pItemData = pM->GetItemList()->GetDataFromPos( nItem );
- if ( pItemData && !pItemData->bIsTemporary )
+ pM->nSelectedId = pItemData->nId;
+ pM->sSelectedIdent = pItemData->sIdent;
+ if (pStart)
{
- pM->nSelectedId = pItemData->nId;
- pM->sSelectedIdent = pItemData->sIdent;
- if (pStart)
- {
- pStart->nSelectedId = pItemData->nId;
- pStart->sSelectedIdent = pItemData->sIdent;
- }
-
- pM->ImplSelect();
+ pStart->nSelectedId = pItemData->nId;
+ pStart->sSelectedIdent = pItemData->sIdent;
}
+
+ pM->ImplSelect();
}
}
@@ -576,20 +576,20 @@ void MenuFloatingWindow::MouseButtonUp( const MouseEvent& rMEvt )
// as it will be too late after EndExecute
sal_uInt16 _nMBDownPos = nMBDownPos;
nMBDownPos = ITEMPOS_INVALID;
- if ( pData && pData->bEnabled && ( pData->eType != MenuItemType::SEPARATOR ) )
+ if ( !(pData && pData->bEnabled && ( pData->eType != MenuItemType::SEPARATOR )) )
+ return;
+
+ if ( !pData->pSubMenu )
{
- if ( !pData->pSubMenu )
- {
+ EndExecute();
+ }
+ else if ( ( pData->nBits & MenuItemBits::POPUPSELECT ) && ( nHighlightedItem == _nMBDownPos ) && ( rMEvt.GetClicks() == 2 ) )
+ {
+ // not when clicked over the arrow...
+ Size aSz = GetOutputSizePixel();
+ long nFontHeight = GetTextHeight();
+ if ( rMEvt.GetPosPixel().X() < ( aSz.Width() - nFontHeight - nFontHeight/4 ) )
EndExecute();
- }
- else if ( ( pData->nBits & MenuItemBits::POPUPSELECT ) && ( nHighlightedItem == _nMBDownPos ) && ( rMEvt.GetClicks() == 2 ) )
- {
- // not when clicked over the arrow...
- Size aSz = GetOutputSizePixel();
- long nFontHeight = GetTextHeight();
- if ( rMEvt.GetPosPixel().X() < ( aSz.Width() - nFontHeight - nFontHeight/4 ) )
- EndExecute();
- }
}
}
@@ -713,23 +713,23 @@ void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
nDelta = nMouseY - ( aOutSz.Height() - nY );
}
- if ( nDelta )
- {
- aScrollTimer.Stop(); // if scrolled through MouseMove.
- long nTimeout;
- if ( nDelta < 3 )
- nTimeout = 200;
- else if ( nDelta < 5 )
- nTimeout = 100;
- else if ( nDelta < 8 )
- nTimeout = 70;
- else if ( nDelta < 12 )
- nTimeout = 40;
- else
- nTimeout = 20;
- aScrollTimer.SetTimeout( nTimeout );
- aScrollTimer.Start();
- }
+ if ( !nDelta )
+ return;
+
+ aScrollTimer.Stop(); // if scrolled through MouseMove.
+ long nTimeout;
+ if ( nDelta < 3 )
+ nTimeout = 200;
+ else if ( nDelta < 5 )
+ nTimeout = 100;
+ else if ( nDelta < 8 )
+ nTimeout = 70;
+ else if ( nDelta < 12 )
+ nTimeout = 40;
+ else
+ nTimeout = 20;
+ aScrollTimer.SetTimeout( nTimeout );
+ aScrollTimer.Start();
}
void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTimer )
{
diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx
index a4219c62df28..0fc8bb6d02f8 100644
--- a/vcl/source/window/mouse.cxx
+++ b/vcl/source/window/mouse.cxx
@@ -134,24 +134,24 @@ PointerStyle Window::ImplGetMousePointer() const
void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, bool bModChanged )
{
- if ( mpWindowImpl->mpFrameData->mbMouseIn && mpWindowImpl->mpFrameWindow->mpWindowImpl->mbReallyVisible )
- {
- sal_uInt64 nTime = tools::Time::GetSystemTicks();
- long nX = mpWindowImpl->mpFrameData->mnLastMouseX;
- long nY = mpWindowImpl->mpFrameData->mnLastMouseY;
- sal_uInt16 nCode = nMouseCode;
- MouseEventModifiers nMode = mpWindowImpl->mpFrameData->mnMouseMode;
- bool bLeave;
- // check for MouseLeave
- bLeave = ((nX < 0) || (nY < 0) ||
- (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) ||
- (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) &&
- !ImplGetSVData()->mpWinData->mpCaptureWin;
- nMode |= MouseEventModifiers::SYNTHETIC;
- if ( bModChanged )
- nMode |= MouseEventModifiers::MODIFIERCHANGED;
- ImplHandleMouseEvent( mpWindowImpl->mpFrameWindow, MouseNotifyEvent::MOUSEMOVE, bLeave, nX, nY, nTime, nCode, nMode );
- }
+ if ( !(mpWindowImpl->mpFrameData->mbMouseIn && mpWindowImpl->mpFrameWindow->mpWindowImpl->mbReallyVisible) )
+ return;
+
+ sal_uInt64 nTime = tools::Time::GetSystemTicks();
+ long nX = mpWindowImpl->mpFrameData->mnLastMouseX;
+ long nY = mpWindowImpl->mpFrameData->mnLastMouseY;
+ sal_uInt16 nCode = nMouseCode;
+ MouseEventModifiers nMode = mpWindowImpl->mpFrameData->mnMouseMode;
+ bool bLeave;
+ // check for MouseLeave
+ bLeave = ((nX < 0) || (nY < 0) ||
+ (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) ||
+ (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) &&
+ !ImplGetSVData()->mpWinData->mpCaptureWin;
+ nMode |= MouseEventModifiers::SYNTHETIC;
+ if ( bModChanged )
+ nMode |= MouseEventModifiers::MODIFIERCHANGED;
+ ImplHandleMouseEvent( mpWindowImpl->mpFrameWindow, MouseNotifyEvent::MOUSEMOVE, bLeave, nX, nY, nTime, nCode, nMode );
}
void Window::ImplGenerateMouseMove()
@@ -482,25 +482,26 @@ void Window::SetPointer( PointerStyle nPointer )
if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
- if (VclPtr<vcl::Window> pWin = GetParentWithLOKNotifier())
+ VclPtr<vcl::Window> pWin = GetParentWithLOKNotifier();
+ if (!pWin)
+ return;
+
+ PointerStyle aPointer = GetPointer();
+ // We don't map all possible pointers hence we need a default
+ OString aPointerString = "default";
+ auto aIt = vcl::gaLOKPointerMap.find(aPointer);
+ if (aIt != vcl::gaLOKPointerMap.end())
{
- PointerStyle aPointer = GetPointer();
- // We don't map all possible pointers hence we need a default
- OString aPointerString = "default";
- auto aIt = vcl::gaLOKPointerMap.find(aPointer);
- if (aIt != vcl::gaLOKPointerMap.end())
- {
- aPointerString = aIt->second;
- }
+ aPointerString = aIt->second;
+ }
- // issue mouse pointer events only for document windows
- // Doc windows' immediate parent SfxFrameViewWindow_Impl is the one with
- // parent notifier set during initialization
- if (GetParent()->ImplGetWindowImpl()->mbLOKParentNotifier &&
- GetParent()->ImplGetWindowImpl()->mnLOKWindowId == 0)
- {
- pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
- }
+ // issue mouse pointer events only for document windows
+ // Doc windows' immediate parent SfxFrameViewWindow_Impl is the one with
+ // parent notifier set during initialization
+ if (GetParent()->ImplGetWindowImpl()->mbLOKParentNotifier &&
+ GetParent()->ImplGetWindowImpl()->mnLOKWindowId == 0)
+ {
+ pWin->GetLOKNotifier()->libreOfficeKitViewCallback(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
}
}
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index e1d281e71948..670909e3bccb 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -271,50 +271,50 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
pWindowImpl->maInvalidateRegion.Intersect(*pWinChildClipRegion);
}
pWindowImpl->mnPaintFlags = ImplPaintFlags::NONE;
- if (!pWindowImpl->maInvalidateRegion.IsEmpty())
- {
+ if (pWindowImpl->maInvalidateRegion.IsEmpty())
+ return;
+
#if HAVE_FEATURE_OPENGL
- VCL_GL_INFO("PaintHelper::DoPaint on " <<
- typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "' begin");
+ VCL_GL_INFO("PaintHelper::DoPaint on " <<
+ typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "' begin");
#endif
- // double-buffering: setup the buffer if it does not exist
- if (!pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering())
- StartBufferedPaint();
+ // double-buffering: setup the buffer if it does not exist
+ if (!pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering())
+ StartBufferedPaint();
- // double-buffering: if this window does not support double-buffering,
- // but we are in the middle of double-buffered paint, we might be
- // losing information
- if (pFrameData->mbInBufferedPaint && !m_pWindow->SupportsDoubleBuffering())
- SAL_WARN("vcl.window", "non-double buffered window in the double-buffered hierarchy, painting directly: " << typeid(*m_pWindow.get()).name());
+ // double-buffering: if this window does not support double-buffering,
+ // but we are in the middle of double-buffered paint, we might be
+ // losing information
+ if (pFrameData->mbInBufferedPaint && !m_pWindow->SupportsDoubleBuffering())
+ SAL_WARN("vcl.window", "non-double buffered window in the double-buffered hierarchy, painting directly: " << typeid(*m_pWindow.get()).name());
- if (pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering())
- {
- // double-buffering
- vcl::PaintBufferGuard g(pFrameData, m_pWindow);
- m_pWindow->ApplySettings(*pFrameData->mpBuffer);
+ if (pFrameData->mbInBufferedPaint && m_pWindow->SupportsDoubleBuffering())
+ {
+ // double-buffering
+ vcl::PaintBufferGuard g(pFrameData, m_pWindow);
+ m_pWindow->ApplySettings(*pFrameData->mpBuffer);
- m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer);
- m_pWindow->Paint(*pFrameData->mpBuffer, m_aPaintRect);
- pFrameData->maBufferedRect.Union(m_aPaintRect);
- }
- else
+ m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer);
+ m_pWindow->Paint(*pFrameData->mpBuffer, m_aPaintRect);
+ pFrameData->maBufferedRect.Union(m_aPaintRect);
+ }
+ else
+ {
+ // direct painting
+ Wallpaper aBackground = m_pWindow->GetBackground();
+ m_pWindow->ApplySettings(*m_pWindow);
+ // Restore bitmap background if it was lost.
+ if (aBackground.IsBitmap() && !m_pWindow->GetBackground().IsBitmap())
{
- // direct painting
- Wallpaper aBackground = m_pWindow->GetBackground();
- m_pWindow->ApplySettings(*m_pWindow);
- // Restore bitmap background if it was lost.
- if (aBackground.IsBitmap() && !m_pWindow->GetBackground().IsBitmap())
- {
- m_pWindow->SetBackground(aBackground);
- }
- m_pWindow->PushPaintHelper(this, *m_pWindow);
- m_pWindow->Paint(*m_pWindow, m_aPaintRect);
+ m_pWindow->SetBackground(aBackground);
}
+ m_pWindow->PushPaintHelper(this, *m_pWindow);
+ m_pWindow->Paint(*m_pWindow, m_aPaintRect);
+ }
#if HAVE_FEATURE_OPENGL
- VCL_GL_INFO("PaintHelper::DoPaint end on " <<
- typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "'");
+ VCL_GL_INFO("PaintHelper::DoPaint end on " <<
+ typeid( *m_pWindow ).name() << " '" << m_pWindow->GetText() << "'");
#endif
- }
}
namespace vcl
@@ -883,33 +883,33 @@ void Window::ImplMoveAllInvalidateRegions( const tools::Rectangle& rRect,
// also shift Paint-Region when paints need processing
ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChildren );
// Paint-Region should be shifted, as drawn by the parents
- if ( !ImplIsOverlapWindow() )
+ if ( ImplIsOverlapWindow() )
+ return;
+
+ vcl::Region aPaintAllRegion;
+ vcl::Window* pPaintAllWindow = this;
+ do
{
- vcl::Region aPaintAllRegion;
- vcl::Window* pPaintAllWindow = this;
- do
+ pPaintAllWindow = pPaintAllWindow->ImplGetParent();
+ if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
{
- pPaintAllWindow = pPaintAllWindow->ImplGetParent();
- if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAllChildren )
+ if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
{
- if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & ImplPaintFlags::PaintAll )
- {
- aPaintAllRegion.SetEmpty();
- break;
- }
- else
- aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion );
+ aPaintAllRegion.SetEmpty();
+ break;
}
+ else
+ aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion );
}
- while ( !pPaintAllWindow->ImplIsOverlapWindow() );
- if ( !aPaintAllRegion.IsEmpty() )
- {
- aPaintAllRegion.Move( nHorzScroll, nVertScroll );
- InvalidateFlags nPaintFlags = InvalidateFlags::NONE;
- if ( bChildren )
- nPaintFlags |= InvalidateFlags::Children;
- ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
- }
+ }
+ while ( !pPaintAllWindow->ImplIsOverlapWindow() );
+ if ( !aPaintAllRegion.IsEmpty() )
+ {
+ aPaintAllRegion.Move( nHorzScroll, nVertScroll );
+ InvalidateFlags nPaintFlags = InvalidateFlags::NONE;
+ if ( bChildren )
+ nPaintFlags |= InvalidateFlags::Children;
+ ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
}
}
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 28e4b689d276..d964390ef062 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -1692,50 +1692,50 @@ void PrintDialog::updateWindowFromProperty( const OUString& i_rProperty )
{
beans::PropertyValue* pValue = maPController->getValue( i_rProperty );
auto it = maPropertyToWindowMap.find( i_rProperty );
- if( pValue && it != maPropertyToWindowMap.end() )
+ if( !(pValue && it != maPropertyToWindowMap.end()) )
+ return;
+
+ const auto& rWindows( it->second );
+ if( rWindows.empty() )
+ return;
+
+ bool bVal = false;
+ sal_Int32 nVal = -1;
+ if( pValue->Value >>= bVal )
{
- const auto& rWindows( it->second );
- if( ! rWindows.empty() )
+ // we should have a CheckBox for this one
+ weld::CheckButton* pBox = dynamic_cast<weld::CheckButton*>(rWindows.front());
+ if( pBox )
{
- bool bVal = false;
- sal_Int32 nVal = -1;
- if( pValue->Value >>= bVal )
- {
- // we should have a CheckBox for this one
- weld::CheckButton* pBox = dynamic_cast<weld::CheckButton*>(rWindows.front());
- if( pBox )
- {
- pBox->set_active( bVal );
- }
- else if ( i_rProperty == "PrintProspect" )
- {
- // EVIL special case
- if( bVal )
- mxBrochureBtn->set_active(true);
- else
- mxPagesBtn->set_active(true);
- }
- else
- {
- SAL_WARN( "vcl", "missing a checkbox" );
- }
- }
- else if( pValue->Value >>= nVal )
- {
- // this could be a ListBox or a RadioButtonGroup
- weld::ComboBox* pList = dynamic_cast<weld::ComboBox*>(rWindows.front());
- if( pList )
- {
- pList->set_active( static_cast< sal_uInt16 >(nVal) );
- }
- else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
- {
- weld::RadioButton* pBtn = dynamic_cast<weld::RadioButton*>(rWindows[nVal]);
- SAL_WARN_IF( !pBtn, "vcl", "unexpected control for property" );
- if( pBtn )
- pBtn->set_active(true);
- }
- }
+ pBox->set_active( bVal );
+ }
+ else if ( i_rProperty == "PrintProspect" )
+ {
+ // EVIL special case
+ if( bVal )
+ mxBrochureBtn->set_active(true);
+ else
+ mxPagesBtn->set_active(true);
+ }
+ else
+ {
+ SAL_WARN( "vcl", "missing a checkbox" );
+ }
+ }
+ else if( pValue->Value >>= nVal )
+ {
+ // this could be a ListBox or a RadioButtonGroup
+ weld::ComboBox* pList = dynamic_cast<weld::ComboBox*>(rWindows.front());
+ if( pList )
+ {
+ pList->set_active( static_cast< sal_uInt16 >(nVal) );
+ }
+ else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
+ {
+ weld::RadioButton* pBtn = dynamic_cast<weld::RadioButton*>(rWindows[nVal]);
+ SAL_WARN_IF( !pBtn, "vcl", "unexpected control for property" );
+ if( pBtn )
+ pBtn->set_active(true);
}
}
}
@@ -2048,54 +2048,54 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, weld::ToggleButton&, i_rBtn, void )
// this handler gets called for all radiobuttons that get unchecked, too
// however we only want one notification for the new value (that is for
// the button that gets checked)
- if( i_rBtn.get_active() )
- {
- PropertyValue* pVal = getValueForWindow( &i_rBtn );
- auto it = maControlToNumValMap.find( &i_rBtn );
- if( pVal && it != maControlToNumValMap.end() )
- {
- makeEnabled( &i_rBtn );
+ if( !i_rBtn.get_active() )
+ return;
- sal_Int32 nVal = it->second;
- pVal->Value <<= nVal;
+ PropertyValue* pVal = getValueForWindow( &i_rBtn );
+ auto it = maControlToNumValMap.find( &i_rBtn );
+ if( !(pVal && it != maControlToNumValMap.end()) )
+ return;
- updateOrientationBox();
+ makeEnabled( &i_rBtn );
- checkOptionalControlDependencies();
+ sal_Int32 nVal = it->second;
+ pVal->Value <<= nVal;
- // tdf#41205 give focus to the page range edit if the corresponding radio button was selected
- if (pVal->Name == "PrintContent" && mxPageRangesRadioButton->get_active())
- mxPageRangeEdit->grab_focus();
+ updateOrientationBox();
- // update preview and page settings
- preparePreview(false);
- }
- }
+ checkOptionalControlDependencies();
+
+ // tdf#41205 give focus to the page range edit if the corresponding radio button was selected
+ if (pVal->Name == "PrintContent" && mxPageRangesRadioButton->get_active())
+ mxPageRangeEdit->grab_focus();
+
+ // update preview and page settings
+ preparePreview(false);
}
IMPL_LINK( PrintDialog, UIOption_SelectHdl, weld::ComboBox&, i_rBox, void )
{
PropertyValue* pVal = getValueForWindow( &i_rBox );
- if( pVal )
- {
- makeEnabled( &i_rBox );
+ if( !pVal )
+ return;
- sal_Int32 nVal( i_rBox.get_active() );
- pVal->Value <<= nVal;
+ makeEnabled( &i_rBox );
- //If we are in impress we start in print slides mode and get a
- //maFirstPageSize for slides which are usually landscape mode, if we
- //change to notes which are usually in portrait mode, and then visit
- //n-up print, we will assume notes are in landscape unless we throw
- //away maFirstPageSize when we change page content type
- if (pVal->Name == "PageContentType")
- maFirstPageSize = Size();
+ sal_Int32 nVal( i_rBox.get_active() );
+ pVal->Value <<= nVal;
- checkOptionalControlDependencies();
+ //If we are in impress we start in print slides mode and get a
+ //maFirstPageSize for slides which are usually landscape mode, if we
+ //change to notes which are usually in portrait mode, and then visit
+ //n-up print, we will assume notes are in landscape unless we throw
+ //away maFirstPageSize when we change page content type
+ if (pVal->Name == "PageContentType")
+ maFirstPageSize = Size();
- // update preview and page settings
- preparePreview(false);
- }
+ checkOptionalControlDependencies();
+
+ // update preview and page settings
+ preparePreview(false);
}
IMPL_LINK( PrintDialog, UIOption_SpinModifyHdl, weld::SpinButton&, i_rBox, void )
diff --git a/vcl/source/window/scrwnd.cxx b/vcl/source/window/scrwnd.cxx
index 58345ef62037..51838b82da7a 100644
--- a/vcl/source/window/scrwnd.cxx
+++ b/vcl/source/window/scrwnd.cxx
@@ -128,22 +128,22 @@ void ImplWheelWindow::ImplCreateImageList()
void ImplWheelWindow::ImplSetWheelMode( WheelMode nWheelMode )
{
- if( nWheelMode != mnWheelMode )
- {
- mnWheelMode = nWheelMode;
+ if( nWheelMode == mnWheelMode )
+ return;
- if( WheelMode::NONE == mnWheelMode )
- {
- if( IsVisible() )
- Hide();
- }
- else
- {
- if( !IsVisible() )
- Show();
+ mnWheelMode = nWheelMode;
- Invalidate();
- }
+ if( WheelMode::NONE == mnWheelMode )
+ {
+ if( IsVisible() )
+ Hide();
+ }
+ else
+ {
+ if( !IsVisible() )
+ Show();
+
+ Invalidate();
}
}
diff --git a/vcl/source/window/seleng.cxx b/vcl/source/window/seleng.cxx
index 41d0d5f89ec9..f4eaeef726cc 100644
--- a/vcl/source/window/seleng.cxx
+++ b/vcl/source/window/seleng.cxx
@@ -361,27 +361,27 @@ void SelectionEngine::Command( const CommandEvent& rCEvt )
if ( !pFunctionSet || aWTimer.IsActive() )
return;
aWTimer.Stop();
- if ( rCEvt.GetCommand() == CommandEventId::StartDrag )
+ if ( rCEvt.GetCommand() != CommandEventId::StartDrag )
+ return;
+
+ nFlags |= SelectionEngineFlags::CMDEVT;
+ if ( nFlags & SelectionEngineFlags::DRG_ENAB )
{
- nFlags |= SelectionEngineFlags::CMDEVT;
- if ( nFlags & SelectionEngineFlags::DRG_ENAB )
+ SAL_WARN_IF( !rCEvt.IsMouseEvent(), "vcl", "STARTDRAG: Not a MouseEvent" );
+ if ( pFunctionSet->IsSelectionAtPoint( rCEvt.GetMousePosPixel() ) )
{
- SAL_WARN_IF( !rCEvt.IsMouseEvent(), "vcl", "STARTDRAG: Not a MouseEvent" );
- if ( pFunctionSet->IsSelectionAtPoint( rCEvt.GetMousePosPixel() ) )
- {
- aLastMove = MouseEvent( rCEvt.GetMousePosPixel(),
- aLastMove.GetClicks(), aLastMove.GetMode(),
- aLastMove.GetButtons(), aLastMove.GetModifier() );
- pFunctionSet->BeginDrag();
- const SelectionEngineFlags nMask = SelectionEngineFlags::CMDEVT|SelectionEngineFlags::WAIT_UPEVT|SelectionEngineFlags::IN_SEL;
- nFlags &= ~nMask;
- }
- else
- nFlags &= ~SelectionEngineFlags::CMDEVT;
+ aLastMove = MouseEvent( rCEvt.GetMousePosPixel(),
+ aLastMove.GetClicks(), aLastMove.GetMode(),
+ aLastMove.GetButtons(), aLastMove.GetModifier() );
+ pFunctionSet->BeginDrag();
+ const SelectionEngineFlags nMask = SelectionEngineFlags::CMDEVT|SelectionEngineFlags::WAIT_UPEVT|SelectionEngineFlags::IN_SEL;
+ nFlags &= ~nMask;
}
else
nFlags &= ~SelectionEngineFlags::CMDEVT;
}
+ else
+ nFlags &= ~SelectionEngineFlags::CMDEVT;
}
void SelectionEngine::SetUpdateInterval( sal_uLong nInterval )
diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx
index 44b44d33e73d..ffa6f7bbe173 100644
--- a/vcl/source/window/split.cxx
+++ b/vcl/source/window/split.cxx
@@ -650,21 +650,21 @@ void Splitter::KeyInput( const KeyEvent& rKEvt )
void Splitter::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
- if( rDCEvt.GetType() == DataChangedEventType::SETTINGS )
- {
- const AllSettings* pOldSettings = rDCEvt.GetOldSettings();
- if(!pOldSettings)
- return;
+ if( rDCEvt.GetType() != DataChangedEventType::SETTINGS )
+ return;
- Color oldFaceColor = pOldSettings->GetStyleSettings().GetFaceColor();
- Color newFaceColor = Application::GetSettings().GetStyleSettings().GetFaceColor();
- if( oldFaceColor.IsDark() != newFaceColor.IsDark() )
- {
- if( newFaceColor.IsDark() )
- SetBackground( ImplWhiteWall::get() );
- else
- SetBackground( ImplBlackWall::get() );
- }
+ const AllSettings* pOldSettings = rDCEvt.GetOldSettings();
+ if(!pOldSettings)
+ return;
+
+ Color oldFaceColor = pOldSettings->GetStyleSettings().GetFaceColor();
+ Color newFaceColor = Application::GetSettings().GetStyleSettings().GetFaceColor();
+ if( oldFaceColor.IsDark() != newFaceColor.IsDark() )
+ {
+ if( newFaceColor.IsDark() )
+ SetBackground( ImplWhiteWall::get() );
+ else
+ SetBackground( ImplBlackWall::get() );
}
}
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 9acc609c963d..66d64e7fd343 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -224,43 +224,43 @@ void SplitWindow::ImplDrawBorder(vcl::RenderContext& rRenderContext)
void SplitWindow::ImplDrawBorderLine(vcl::RenderContext& rRenderContext)
{
- if (mbFadeOut)
- {
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- long nDX = mnDX;
- long nDY = mnDY;
+ if (!mbFadeOut)
+ return;
- switch (meAlign)
- {
- case WindowAlign::Left:
- rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
- rRenderContext.DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, nDY-2 ) );
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ long nDX = mnDX;
+ long nDY = mnDY;
- rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
- rRenderContext.DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN, nDY-3 ) );
- break;
- case WindowAlign::Right:
- rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
- rRenderContext.DrawLine( Point( SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( SPLITWIN_SPLITSIZEEXLN-1, nDY-2 ) );
+ switch (meAlign)
+ {
+ case WindowAlign::Left:
+ rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
+ rRenderContext.DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN-1, nDY-2 ) );
+
+ rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
+ rRenderContext.DrawLine( Point( nDX-SPLITWIN_SPLITSIZEEXLN, 1 ), Point( nDX-SPLITWIN_SPLITSIZEEXLN, nDY-3 ) );
+ break;
+ case WindowAlign::Right:
+ rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
+ rRenderContext.DrawLine( Point( SPLITWIN_SPLITSIZEEXLN-1, 0 ), Point( SPLITWIN_SPLITSIZEEXLN-1, nDY-2 ) );
- rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
- rRenderContext.DrawLine( Point( SPLITWIN_SPLITSIZEEXLN, 1 ), Point( SPLITWIN_SPLITSIZEEXLN, nDY-3 ) );
- break;
- case WindowAlign::Top:
- rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
- rRenderContext.DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-1, nDY-SPLITWIN_SPLITSIZEEXLN-1 ) );
+ rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
+ rRenderContext.DrawLine( Point( SPLITWIN_SPLITSIZEEXLN, 1 ), Point( SPLITWIN_SPLITSIZEEXLN, nDY-3 ) );
+ break;
+ case WindowAlign::Top:
+ rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
+ rRenderContext.DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN-1 ), Point( nDX-1, nDY-SPLITWIN_SPLITSIZEEXLN-1 ) );
- rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
- rRenderContext.DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN ), Point( nDX-1, nDY-SPLITWIN_SPLITSIZEEXLN ) );
- break;
- case WindowAlign::Bottom:
- rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
- rRenderContext.DrawLine( Point( 0, 5 ), Point( nDX-1, 5 ) );
+ rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
+ rRenderContext.DrawLine( Point( 0, nDY-SPLITWIN_SPLITSIZEEXLN ), Point( nDX-1, nDY-SPLITWIN_SPLITSIZEEXLN ) );
+ break;
+ case WindowAlign::Bottom:
+ rRenderContext.SetLineColor( rStyleSettings.GetShadowColor() );
+ rRenderContext.DrawLine( Point( 0, 5 ), Point( nDX-1, 5 ) );
- rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
- rRenderContext.DrawLine( Point( 0, SPLITWIN_SPLITSIZEEXLN ), Point( nDX-1, SPLITWIN_SPLITSIZEEXLN ) );
- break;
- }
+ rRenderContext.SetLineColor( rStyleSettings.GetLightColor() );
+ rRenderContext.DrawLine( Point( 0, SPLITWIN_SPLITSIZEEXLN ), Point( nDX-1, SPLITWIN_SPLITSIZEEXLN ) );
+ break;
}
}
@@ -1581,52 +1581,52 @@ void SplitWindow::ImplDrawGrip(vcl::RenderContext& rRenderContext, const tools::
void SplitWindow::ImplDrawFadeIn(vcl::RenderContext& rRenderContext)
{
- if (mbFadeIn)
- {
- tools::Rectangle aTempRect;
- ImplGetFadeInRect(aTempRect);
+ if (!mbFadeIn)
+ return;
- bool bLeft = true;
- switch (meAlign)
- {
- case WindowAlign::Top:
- case WindowAlign::Left:
- bLeft = false;
- break;
- case WindowAlign::Bottom:
- case WindowAlign::Right:
- default:
- bLeft = true;
- break;
- }
+ tools::Rectangle aTempRect;
+ ImplGetFadeInRect(aTempRect);
- ImplDrawGrip(rRenderContext, aTempRect, (meAlign == WindowAlign::Top) || (meAlign == WindowAlign::Bottom), bLeft);
+ bool bLeft = true;
+ switch (meAlign)
+ {
+ case WindowAlign::Top:
+ case WindowAlign::Left:
+ bLeft = false;
+ break;
+ case WindowAlign::Bottom:
+ case WindowAlign::Right:
+ default:
+ bLeft = true;
+ break;
}
+
+ ImplDrawGrip(rRenderContext, aTempRect, (meAlign == WindowAlign::Top) || (meAlign == WindowAlign::Bottom), bLeft);
}
void SplitWindow::ImplDrawFadeOut(vcl::RenderContext& rRenderContext)
{
- if (mbFadeOut)
- {
- tools::Rectangle aTempRect;
- ImplGetFadeOutRect(aTempRect);
+ if (!mbFadeOut)
+ return;
- bool bLeft = true;
- switch (meAlign)
- {
- case WindowAlign::Bottom:
- case WindowAlign::Right:
- bLeft = false;
- break;
- case WindowAlign::Top:
- case WindowAlign::Left:
- default:
- bLeft = true;
- break;
- }
+ tools::Rectangle aTempRect;
+ ImplGetFadeOutRect(aTempRect);
- ImplDrawGrip(rRenderContext, aTempRect, (meAlign == WindowAlign::Top) || (meAlign == WindowAlign::Bottom), bLeft);
+ bool bLeft = true;
+ switch (meAlign)
+ {
+ case WindowAlign::Bottom:
+ case WindowAlign::Right:
+ bLeft = false;
+ break;
+ case WindowAlign::Top:
+ case WindowAlign::Left:
+ default:
+ bLeft = true;
+ break;
}
+
+ ImplDrawGrip(rRenderContext, aTempRect, (meAlign == WindowAlign::Top) || (meAlign == WindowAlign::Bottom), bLeft);
}
void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx
index 82a17e63e228..a23e3ff97f2a 100644
--- a/vcl/source/window/stacking.cxx
+++ b/vcl/source/window/stacking.cxx
@@ -60,52 +60,52 @@ void Window::ImplInsertWindow( vcl::Window* pParent )
mpWindowImpl->mpParent = pParent;
mpWindowImpl->mpRealParent = pParent;
- if ( pParent && !mpWindowImpl->mbFrame )
+ if ( !pParent || mpWindowImpl->mbFrame )
+ return;
+
+ // search frame window and set window frame data
+ vcl::Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
+ mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData;
+ if (mpWindowImpl->mpFrame != pFrameParent->mpWindowImpl->mpFrame)
{
- // search frame window and set window frame data
- vcl::Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
- mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData;
- if (mpWindowImpl->mpFrame != pFrameParent->mpWindowImpl->mpFrame)
- {
- mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame;
- if (mpWindowImpl->mpSysObj)
- mpWindowImpl->mpSysObj->Reparent(mpWindowImpl->mpFrame);
- }
- mpWindowImpl->mpFrameWindow = pFrameParent;
- mpWindowImpl->mbFrame = false;
+ mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame;
+ if (mpWindowImpl->mpSysObj)
+ mpWindowImpl->mpSysObj->Reparent(mpWindowImpl->mpFrame);
+ }
+ mpWindowImpl->mpFrameWindow = pFrameParent;
+ mpWindowImpl->mbFrame = false;
- // search overlap window and insert window in list
- if ( ImplIsOverlapWindow() )
- {
- vcl::Window* pFirstOverlapParent = pParent;
- while ( !pFirstOverlapParent->ImplIsOverlapWindow() )
- pFirstOverlapParent = pFirstOverlapParent->ImplGetParent();
- mpWindowImpl->mpOverlapWindow = pFirstOverlapParent;
-
- mpWindowImpl->mpNextOverlap = mpWindowImpl->mpFrameData->mpFirstOverlap;
- mpWindowImpl->mpFrameData->mpFirstOverlap = this;
-
- // Overlap-Windows are by default the uppermost
- mpWindowImpl->mpNext = pFirstOverlapParent->mpWindowImpl->mpFirstOverlap;
- pFirstOverlapParent->mpWindowImpl->mpFirstOverlap = this;
- if ( !pFirstOverlapParent->mpWindowImpl->mpLastOverlap )
- pFirstOverlapParent->mpWindowImpl->mpLastOverlap = this;
- else
- mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this;
- }
+ // search overlap window and insert window in list
+ if ( ImplIsOverlapWindow() )
+ {
+ vcl::Window* pFirstOverlapParent = pParent;
+ while ( !pFirstOverlapParent->ImplIsOverlapWindow() )
+ pFirstOverlapParent = pFirstOverlapParent->ImplGetParent();
+ mpWindowImpl->mpOverlapWindow = pFirstOverlapParent;
+
+ mpWindowImpl->mpNextOverlap = mpWindowImpl->mpFrameData->mpFirstOverlap;
+ mpWindowImpl->mpFrameData->mpFirstOverlap = this;
+
+ // Overlap-Windows are by default the uppermost
+ mpWindowImpl->mpNext = pFirstOverlapParent->mpWindowImpl->mpFirstOverlap;
+ pFirstOverlapParent->mpWindowImpl->mpFirstOverlap = this;
+ if ( !pFirstOverlapParent->mpWindowImpl->mpLastOverlap )
+ pFirstOverlapParent->mpWindowImpl->mpLastOverlap = this;
else
- {
- if ( pParent->ImplIsOverlapWindow() )
- mpWindowImpl->mpOverlapWindow = pParent;
- else
- mpWindowImpl->mpOverlapWindow = pParent->mpWindowImpl->mpOverlapWindow;
- mpWindowImpl->mpPrev = pParent->mpWindowImpl->mpLastChild;
- pParent->mpWindowImpl->mpLastChild = this;
- if ( !pParent->mpWindowImpl->mpFirstChild )
- pParent->mpWindowImpl->mpFirstChild = this;
- else
- mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
- }
+ mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this;
+ }
+ else
+ {
+ if ( pParent->ImplIsOverlapWindow() )
+ mpWindowImpl->mpOverlapWindow = pParent;
+ else
+ mpWindowImpl->mpOverlapWindow = pParent->mpWindowImpl->mpOverlapWindow;
+ mpWindowImpl->mpPrev = pParent->mpWindowImpl->mpLastChild;
+ pParent->mpWindowImpl->mpLastChild = this;
+ if ( !pParent->mpWindowImpl->mpFirstChild )
+ pParent->mpWindowImpl->mpFirstChild = this;
+ else
+ mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
}
}
@@ -193,44 +193,44 @@ void Window::reorderWithinParent(sal_uInt16 nNewPosition)
void Window::ImplToBottomChild()
{
- if ( !ImplIsOverlapWindow() && !mpWindowImpl->mbReallyVisible && (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild.get() != this) )
- {
- // put the window to the end of the list
- if ( mpWindowImpl->mpPrev )
- mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
- else
- mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
- mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
- mpWindowImpl->mpPrev = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild;
- mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this;
- mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
- mpWindowImpl->mpNext = nullptr;
- }
+ if ( ImplIsOverlapWindow() || mpWindowImpl->mbReallyVisible || (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild.get() == this) )
+ return;
+
+ // put the window to the end of the list
+ if ( mpWindowImpl->mpPrev )
+ mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
+ else
+ mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
+ mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
+ mpWindowImpl->mpPrev = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild;
+ mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this;
+ mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
+ mpWindowImpl->mpNext = nullptr;
}
void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData )
{
SAL_WARN_IF( !ImplIsOverlapWindow(), "vcl", "Window::ImplCalcToTop(): Is not an OverlapWindow" );
- if ( !mpWindowImpl->mbFrame )
+ if ( mpWindowImpl->mbFrame )
+ return;
+
+ if ( !IsReallyVisible() )
+ return;
+
+ // calculate region, where the window overlaps with other windows
+ Point aPoint( mnOutOffX, mnOutOffY );
+ vcl::Region aRegion( tools::Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ vcl::Region aInvalidateRegion;
+ ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion );
+
+ if ( !aInvalidateRegion.IsEmpty() )
{
- if ( IsReallyVisible() )
- {
- // calculate region, where the window overlaps with other windows
- Point aPoint( mnOutOffX, mnOutOffY );
- vcl::Region aRegion( tools::Rectangle( aPoint,
- Size( mnOutWidth, mnOutHeight ) ) );
- vcl::Region aInvalidateRegion;
- ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion );
-
- if ( !aInvalidateRegion.IsEmpty() )
- {
- ImplCalcToTopData* pData = new ImplCalcToTopData;
- pPrevData->mpNext.reset(pData);
- pData->mpWindow = this;
- pData->mpInvalidateRegion.reset(new vcl::Region( aInvalidateRegion ));
- }
- }
+ ImplCalcToTopData* pData = new ImplCalcToTopData;
+ pPrevData->mpNext.reset(pData);
+ pData->mpWindow = this;
+ pData->mpInvalidateRegion.reset(new vcl::Region( aInvalidateRegion ));
}
}
@@ -535,63 +535,63 @@ void Window::SetZOrder( vcl::Window* pRefWindow, ZOrderFlags nFlags )
mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
}
- if ( IsReallyVisible() )
+ if ( !IsReallyVisible() )
+ return;
+
+ if ( !mpWindowImpl->mbInitWinClipRegion && mpWindowImpl->maWinClipRegion.IsEmpty() )
+ return;
+
+ bool bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion;
+ ImplSetClipFlag();
+
+ // When ClipRegion was not initialised, assume
+ // the window has not been sent, therefore do not
+ // trigger any Invalidates. This is an optimization
+ // for HTML documents with many controls. If this
+ // check gives problems, a flag should be introduced
+ // which tracks whether the window has already been
+ // emitted after Show
+ if ( bInitWinClipRegion )
+ return;
+
+ // Invalidate all windows which are next to each other
+ // Is INCOMPLETE !!!
+ tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
+ vcl::Window* pWindow = nullptr;
+ if ( ImplIsOverlapWindow() )
{
- if ( mpWindowImpl->mbInitWinClipRegion || !mpWindowImpl->maWinClipRegion.IsEmpty() )
+ if ( mpWindowImpl->mpOverlapWindow )
+ pWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
+ }
+ else
+ pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild;
+ // Invalidate all windows in front of us and which are covered by us
+ while ( pWindow )
+ {
+ if ( pWindow == this )
+ break;
+ tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ if ( aWinRect.IsOver( aCompRect ) )
+ pWindow->Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent );
+ pWindow = pWindow->mpWindowImpl->mpNext;
+ }
+
+ // If we are covered by a window in the background
+ // we should redraw it
+ while ( pWindow )
+ {
+ if ( pWindow != this )
{
- bool bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion;
- ImplSetClipFlag();
-
- // When ClipRegion was not initialised, assume
- // the window has not been sent, therefore do not
- // trigger any Invalidates. This is an optimization
- // for HTML documents with many controls. If this
- // check gives problems, a flag should be introduced
- // which tracks whether the window has already been
- // emitted after Show
- if ( !bInitWinClipRegion )
+ tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
+ Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
+ if ( aWinRect.IsOver( aCompRect ) )
{
- // Invalidate all windows which are next to each other
- // Is INCOMPLETE !!!
- tools::Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
- vcl::Window* pWindow = nullptr;
- if ( ImplIsOverlapWindow() )
- {
- if ( mpWindowImpl->mpOverlapWindow )
- pWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
- }
- else
- pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild;
- // Invalidate all windows in front of us and which are covered by us
- while ( pWindow )
- {
- if ( pWindow == this )
- break;
- tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
- Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
- if ( aWinRect.IsOver( aCompRect ) )
- pWindow->Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent );
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
-
- // If we are covered by a window in the background
- // we should redraw it
- while ( pWindow )
- {
- if ( pWindow != this )
- {
- tools::Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
- Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
- if ( aWinRect.IsOver( aCompRect ) )
- {
- Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent );
- break;
- }
- }
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
+ Invalidate( InvalidateFlags::Children | InvalidateFlags::NoTransparent );
+ break;
}
}
+ pWindow = pWindow->mpWindowImpl->mpNext;
}
}
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 2eeb5ae0fedc..283bc033c244 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -657,35 +657,35 @@ void StatusBar::ImplCalcProgressRect()
void StatusBar::MouseButtonDown( const MouseEvent& rMEvt )
{
// trigger toolbox only for left mouse button
- if ( rMEvt.IsLeft() )
- {
- Point aMousePos = rMEvt.GetPosPixel();
+ if ( !rMEvt.IsLeft() )
+ return;
- // search for clicked item
- for ( size_t i = 0; i < mvItemList.size(); ++i )
+ Point aMousePos = rMEvt.GetPosPixel();
+
+ // search for clicked item
+ for ( size_t i = 0; i < mvItemList.size(); ++i )
+ {
+ ImplStatusItem* pItem = mvItemList[ i ].get();
+ // check item for being clicked
+ if ( ImplGetItemRectPos( sal_uInt16(i) ).IsInside( aMousePos ) )
{
- ImplStatusItem* pItem = mvItemList[ i ].get();
- // check item for being clicked
- if ( ImplGetItemRectPos( sal_uInt16(i) ).IsInside( aMousePos ) )
- {
- mnCurItemId = pItem->mnId;
- if ( rMEvt.GetClicks() == 2 )
- DoubleClick();
- else
- Click();
- mnCurItemId = 0;
-
- // Item found
- return;
- }
- }
+ mnCurItemId = pItem->mnId;
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+ else
+ Click();
+ mnCurItemId = 0;
- // if there's no item, trigger Click or DoubleClick
- if ( rMEvt.GetClicks() == 2 )
- DoubleClick();
- else
- Click();
+ // Item found
+ return;
+ }
}
+
+ // if there's no item, trigger Click or DoubleClick
+ if ( rMEvt.GetClicks() == 2 )
+ DoubleClick();
+ else
+ Click();
}
void StatusBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
@@ -845,32 +845,32 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
{
Window::DataChanged( rDCEvt );
- if ( (rDCEvt.GetType() == DataChangedEventType::DISPLAY )
+ if ( !((rDCEvt.GetType() == DataChangedEventType::DISPLAY )
|| (rDCEvt.GetType() == DataChangedEventType::FONTS )
|| (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION)
|| ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS)
&& (rDCEvt.GetFlags() & AllSettingsFlags::STYLE )
- )
+ ))
)
+ return;
+
+ mbFormat = true;
+ ImplInitSettings();
+ long nFudge = GetTextHeight() / 4;
+ for (auto & pItem : mvItemList)
{
- mbFormat = true;
- ImplInitSettings();
- long nFudge = GetTextHeight() / 4;
- for (auto & pItem : mvItemList)
- {
- long nWidth = GetTextWidth( pItem->maText ) + nFudge;
- if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
- pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
+ long nWidth = GetTextWidth( pItem->maText ) + nFudge;
+ if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
+ pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
- pItem->mxLayoutCache.reset();
- }
- Size aSize = GetSizePixel();
- // do not disturb current width, since
- // CalcWindowSizePixel calculates a minimum width
- aSize.setHeight( CalcWindowSizePixel().Height() );
- SetSizePixel( aSize );
- Invalidate();
+ pItem->mxLayoutCache.reset();
}
+ Size aSize = GetSizePixel();
+ // do not disturb current width, since
+ // CalcWindowSizePixel calculates a minimum width
+ aSize.setHeight( CalcWindowSizePixel().Height() );
+ SetSizePixel( aSize );
+ Invalidate();
}
void StatusBar::Click()
@@ -948,19 +948,19 @@ void StatusBar::ShowItem( sal_uInt16 nItemId )
{
sal_uInt16 nPos = GetItemPos( nItemId );
- if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ if ( nPos == STATUSBAR_ITEM_NOTFOUND )
+ return;
+
+ ImplStatusItem* pItem = mvItemList[ nPos ].get();
+ if ( !pItem->mbVisible )
{
- ImplStatusItem* pItem = mvItemList[ nPos ].get();
- if ( !pItem->mbVisible )
- {
- pItem->mbVisible = true;
+ pItem->mbVisible = true;
- mbFormat = true;
- if ( ImplIsItemUpdate() )
- Invalidate();
+ mbFormat = true;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
- CallEventListeners( VclEventId::StatusbarShowItem, reinterpret_cast<void*>(nItemId) );
- }
+ CallEventListeners( VclEventId::StatusbarShowItem, reinterpret_cast<void*>(nItemId) );
}
}
@@ -968,19 +968,19 @@ void StatusBar::HideItem( sal_uInt16 nItemId )
{
sal_uInt16 nPos = GetItemPos( nItemId );
- if ( nPos != STATUSBAR_ITEM_NOTFOUND )
+ if ( nPos == STATUSBAR_ITEM_NOTFOUND )
+ return;
+
+ ImplStatusItem* pItem = mvItemList[ nPos ].get();
+ if ( pItem->mbVisible )
{
- ImplStatusItem* pItem = mvItemList[ nPos ].get();
- if ( pItem->mbVisible )
- {
- pItem->mbVisible = false;
+ pItem->mbVisible = false;
- mbFormat = true;
- if ( ImplIsItemUpdate() )
- Invalidate();
+ mbFormat = true;
+ if ( ImplIsItemUpdate() )
+ Invalidate();
- CallEventListeners( VclEventId::StatusbarHideItem, reinterpret_cast<void*>(nItemId) );
- }
+ CallEventListeners( VclEventId::StatusbarHideItem, reinterpret_cast<void*>(nItemId) );
}
}
@@ -1132,50 +1132,50 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCha
{
sal_uInt16 nPos = GetItemPos( nItemId );
- if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- {
- ImplStatusItem* pItem = mvItemList[ nPos ].get();
+ if ( nPos == STATUSBAR_ITEM_NOTFOUND )
+ return;
- if ( pItem->maText != rText )
- {
- pItem->maText = rText;
+ ImplStatusItem* pItem = mvItemList[ nPos ].get();
- // adjust item width - see also DataChanged()
- long nFudge = GetTextHeight()/4;
+ if ( pItem->maText == rText )
+ return;
- long nWidth;
- if (nCharsWidth != -1)
- {
- std::unique_ptr<SalLayout> pSalLayout = ImplLayout("0",0,-1);
- const SalLayoutGlyphs* pGlyphs = pSalLayout ? pSalLayout->GetGlyphs() : nullptr;
- nWidth = GetTextWidth("0",0,-1,nullptr,pGlyphs );
- nWidth = nWidth * nCharsWidth + nFudge;
- }
- else
- {
- std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1);
- const SalLayoutGlyphs* pGlyphs = pSalLayout ? pSalLayout->GetGlyphs() : nullptr;
- nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pGlyphs ) + nFudge;
- // Store the calculated layout.
- pItem->mxLayoutCache = std::move(pSalLayout);
- }
+ pItem->maText = rText;
- if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
- ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth ))
- {
- pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
- ImplFormat();
- Invalidate();
- }
+ // adjust item width - see also DataChanged()
+ long nFudge = GetTextHeight()/4;
- // re-draw item if StatusBar is visible and UpdateMode active
- if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
- {
- tools::Rectangle aRect = ImplGetItemRectPos(nPos);
- Invalidate(aRect);
- PaintImmediately();
- }
- }
+ long nWidth;
+ if (nCharsWidth != -1)
+ {
+ std::unique_ptr<SalLayout> pSalLayout = ImplLayout("0",0,-1);
+ const SalLayoutGlyphs* pGlyphs = pSalLayout ? pSalLayout->GetGlyphs() : nullptr;
+ nWidth = GetTextWidth("0",0,-1,nullptr,pGlyphs );
+ nWidth = nWidth * nCharsWidth + nFudge;
+ }
+ else
+ {
+ std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1);
+ const SalLayoutGlyphs* pGlyphs = pSalLayout ? pSalLayout->GetGlyphs() : nullptr;
+ nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pGlyphs ) + nFudge;
+ // Store the calculated layout.
+ pItem->mxLayoutCache = std::move(pSalLayout);
+ }
+
+ if( (nWidth > pItem->mnWidth + STATUSBAR_OFFSET) ||
+ ((nWidth < pItem->mnWidth) && (mnDX - STATUSBAR_OFFSET) < mnItemsWidth ))
+ {
+ pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
+ ImplFormat();
+ Invalidate();
+ }
+
+ // re-draw item if StatusBar is visible and UpdateMode active
+ if ( pItem->mbVisible && !mbFormat && ImplIsItemUpdate() )
+ {
+ tools::Rectangle aRect = ImplGetItemRectPos(nPos);
+ Invalidate(aRect);
+ PaintImmediately();
}
}
@@ -1215,21 +1215,21 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData )
{
sal_uInt16 nPos = GetItemPos( nItemId );
- if ( nPos != STATUSBAR_ITEM_NOTFOUND )
- {
- ImplStatusItem* pItem = mvItemList[ nPos ].get();
- // invalidate cache
- pItem->mxLayoutCache.reset();
- pItem->mpUserData = pNewData;
+ if ( nPos == STATUSBAR_ITEM_NOTFOUND )
+ return;
- // call Draw-Item if it's a User-Item
- if ( (pItem->mnBits & StatusBarItemBits::UserDraw) && pItem->mbVisible &&
- !mbFormat && ImplIsItemUpdate() )
- {
- tools::Rectangle aRect = ImplGetItemRectPos(nPos);
- Invalidate(aRect, InvalidateFlags::NoErase);
- PaintImmediately();
- }
+ ImplStatusItem* pItem = mvItemList[ nPos ].get();
+ // invalidate cache
+ pItem->mxLayoutCache.reset();
+ pItem->mpUserData = pNewData;
+
+ // call Draw-Item if it's a User-Item
+ if ( (pItem->mnBits & StatusBarItemBits::UserDraw) && pItem->mbVisible &&
+ !mbFormat && ImplIsItemUpdate() )
+ {
+ tools::Rectangle aRect = ImplGetItemRectPos(nPos);
+ Invalidate(aRect, InvalidateFlags::NoErase);
+ PaintImmediately();
}
}
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index 2df41ae7dae7..9399455150a3 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -902,66 +902,66 @@ OString SystemWindow::GetWindowState( WindowStateMask nMask ) const
void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
{
- if ( mpMenuBar != pMenuBar )
- {
- MenuBar* pOldMenuBar = mpMenuBar;
- vcl::Window* pOldWindow = nullptr;
- VclPtr<vcl::Window> pNewWindow;
- mpMenuBar = pMenuBar;
+ if ( mpMenuBar == pMenuBar )
+ return;
- if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) )
- {
- if ( pOldMenuBar )
- pOldWindow = pOldMenuBar->ImplGetWindow();
- else
- pOldWindow = nullptr;
- if ( pOldWindow )
- {
- CallEventListeners( VclEventId::WindowMenubarRemoved, static_cast<void*>(pOldMenuBar) );
- pOldWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
- }
- if ( pMenuBar )
- {
- SAL_WARN_IF( pMenuBar->pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" );
+ MenuBar* pOldMenuBar = mpMenuBar;
+ vcl::Window* pOldWindow = nullptr;
+ VclPtr<vcl::Window> pNewWindow;
+ mpMenuBar = pMenuBar;
- pNewWindow = MenuBar::ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar);
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow(pNewWindow);
+ if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) )
+ {
+ if ( pOldMenuBar )
+ pOldWindow = pOldMenuBar->ImplGetWindow();
+ else
+ pOldWindow = nullptr;
+ if ( pOldWindow )
+ {
+ CallEventListeners( VclEventId::WindowMenubarRemoved, static_cast<void*>(pOldMenuBar) );
+ pOldWindow->SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
+ }
+ if ( pMenuBar )
+ {
+ SAL_WARN_IF( pMenuBar->pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" );
- CallEventListeners( VclEventId::WindowMenubarAdded, static_cast<void*>(pMenuBar) );
- }
- else
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow( nullptr );
- ImplToBottomChild();
- if ( pOldMenuBar )
- {
- bool bDelete = (pMenuBar == nullptr);
- if( bDelete && pOldWindow )
- {
- if( mpImplData->mpTaskPaneList )
- mpImplData->mpTaskPaneList->RemoveWindow( pOldWindow );
- }
- MenuBar::ImplDestroy( pOldMenuBar, bDelete );
- if( bDelete )
- pOldWindow = nullptr; // will be deleted in MenuBar::ImplDestroy,
- }
+ pNewWindow = MenuBar::ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar);
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow(pNewWindow);
+ CallEventListeners( VclEventId::WindowMenubarAdded, static_cast<void*>(pMenuBar) );
}
else
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow( nullptr );
+ ImplToBottomChild();
+ if ( pOldMenuBar )
{
- if( pMenuBar )
- pNewWindow = pMenuBar->ImplGetWindow();
- if( pOldMenuBar )
- pOldWindow = pOldMenuBar->ImplGetWindow();
+ bool bDelete = (pMenuBar == nullptr);
+ if( bDelete && pOldWindow )
+ {
+ if( mpImplData->mpTaskPaneList )
+ mpImplData->mpTaskPaneList->RemoveWindow( pOldWindow );
+ }
+ MenuBar::ImplDestroy( pOldMenuBar, bDelete );
+ if( bDelete )
+ pOldWindow = nullptr; // will be deleted in MenuBar::ImplDestroy,
}
- // update taskpane list to make menubar accessible
- if( mpImplData->mpTaskPaneList )
- {
- if( pOldWindow )
- mpImplData->mpTaskPaneList->RemoveWindow( pOldWindow );
- if( pNewWindow )
- mpImplData->mpTaskPaneList->AddWindow( pNewWindow );
- }
+ }
+ else
+ {
+ if( pMenuBar )
+ pNewWindow = pMenuBar->ImplGetWindow();
+ if( pOldMenuBar )
+ pOldWindow = pOldMenuBar->ImplGetWindow();
+ }
+
+ // update taskpane list to make menubar accessible
+ if( mpImplData->mpTaskPaneList )
+ {
+ if( pOldWindow )
+ mpImplData->mpTaskPaneList->RemoveWindow( pOldWindow );
+ if( pNewWindow )
+ mpImplData->mpTaskPaneList->AddWindow( pNewWindow );
}
}
diff --git a/vcl/source/window/tabpage.cxx b/vcl/source/window/tabpage.cxx
index bfb7b67a8497..5b2408b1b1c1 100644
--- a/vcl/source/window/tabpage.cxx
+++ b/vcl/source/window/tabpage.cxx
@@ -124,21 +124,21 @@ void TabPage::DataChanged( const DataChangedEvent& rDCEvt )
void TabPage::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& )
{
// draw native tabpage only inside tabcontrols, standalone tabpages look ugly (due to bad dialog design)
- if( IsNativeControlSupported(ControlType::TabBody, ControlPart::Entire) && GetParent() && (GetParent()->GetType() == WindowType::TABCONTROL) )
- {
- const ImplControlValue aControlValue;
-
- ControlState nState = ControlState::ENABLED;
- if ( !IsEnabled() )
- nState &= ~ControlState::ENABLED;
- if ( HasFocus() )
- nState |= ControlState::FOCUSED;
- // pass the whole window region to NWF as the tab body might be a gradient or bitmap
- // that has to be scaled properly, clipping makes sure that we do not paint too much
- tools::Rectangle aCtrlRegion( Point(), GetOutputSizePixel() );
- rRenderContext.DrawNativeControl( ControlType::TabBody, ControlPart::Entire, aCtrlRegion, nState,
- aControlValue, OUString() );
- }
+ if( !(IsNativeControlSupported(ControlType::TabBody, ControlPart::Entire) && GetParent() && (GetParent()->GetType() == WindowType::TABCONTROL)) )
+ return;
+
+ const ImplControlValue aControlValue;
+
+ ControlState nState = ControlState::ENABLED;
+ if ( !IsEnabled() )
+ nState &= ~ControlState::ENABLED;
+ if ( HasFocus() )
+ nState |= ControlState::FOCUSED;
+ // pass the whole window region to NWF as the tab body might be a gradient or bitmap
+ // that has to be scaled properly, clipping makes sure that we do not paint too much
+ tools::Rectangle aCtrlRegion( Point(), GetOutputSizePixel() );
+ rRenderContext.DrawNativeControl( ControlType::TabBody, ControlPart::Entire, aCtrlRegion, nState,
+ aControlValue, OUString() );
}
void TabPage::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags )
diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx
index 6e321f498c3c..1cfb8ba92757 100644
--- a/vcl/source/window/taskpanelist.cxx
+++ b/vcl/source/window/taskpanelist.cxx
@@ -81,37 +81,37 @@ TaskPaneList::~TaskPaneList()
void TaskPaneList::AddWindow( vcl::Window *pWindow )
{
- if( pWindow )
+ if( !pWindow )
+ return;
+
+ auto insertionPos = dynamic_cast<MenuBarWindow*>(pWindow) ? mTaskPanes.begin() : mTaskPanes.end();
+ for ( auto p = mTaskPanes.begin(); p != mTaskPanes.end(); ++p )
{
- auto insertionPos = dynamic_cast<MenuBarWindow*>(pWindow) ? mTaskPanes.begin() : mTaskPanes.end();
- for ( auto p = mTaskPanes.begin(); p != mTaskPanes.end(); ++p )
+ if ( *p == pWindow )
+ // avoid duplicates
+ return;
+
+ // If the new window is the child of an existing pane window, or vice versa,
+ // ensure that in our pane list, *first* the child window appears, *then*
+ // the ancestor window.
+ // This is necessary for HandleKeyEvent: There, the list is traveled from the
+ // beginning, until the first window is found which has the ChildPathFocus. Now
+ // if this would be the ancestor window of another pane window, this would fudge
+ // the result
+ if ( pWindow->IsWindowOrChild( *p ) )
{
- if ( *p == pWindow )
- // avoid duplicates
- return;
-
- // If the new window is the child of an existing pane window, or vice versa,
- // ensure that in our pane list, *first* the child window appears, *then*
- // the ancestor window.
- // This is necessary for HandleKeyEvent: There, the list is traveled from the
- // beginning, until the first window is found which has the ChildPathFocus. Now
- // if this would be the ancestor window of another pane window, this would fudge
- // the result
- if ( pWindow->IsWindowOrChild( *p ) )
- {
- insertionPos = p + 1;
- break;
- }
- if ( (*p)->IsWindowOrChild( pWindow ) )
- {
- insertionPos = p;
- break;
- }
+ insertionPos = p + 1;
+ break;
+ }
+ if ( (*p)->IsWindowOrChild( pWindow ) )
+ {
+ insertionPos = p;
+ break;
}
-
- mTaskPanes.insert( insertionPos, pWindow );
- pWindow->ImplIsInTaskPaneList( true );
}
+
+ mTaskPanes.insert( insertionPos, pWindow );
+ pWindow->ImplIsInTaskPaneList( true );
}
void TaskPaneList::RemoveWindow( vcl::Window *pWindow )
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 935a7e3ae9ec..4728d594038e 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -2334,26 +2334,26 @@ void ToolBox::ImplFormat( bool bResize )
IMPL_LINK_NOARG(ToolBox, ImplDropdownLongClickHdl, Timer *, void)
{
- if (mnCurPos != ITEM_NOTFOUND &&
- (mpData->m_aItems[ mnCurPos ].mnBits & ToolBoxItemBits::DROPDOWN))
- {
- mpData->mbDropDownByKeyboard = false;
- mpData->maDropdownClickHdl.Call( this );
+ if (mnCurPos == ITEM_NOTFOUND ||
+ !(mpData->m_aItems[ mnCurPos ].mnBits & ToolBoxItemBits::DROPDOWN))
+ return;
- // do not reset data if the dropdown handler opened a floating window
- // see ImplFloatControl()
- if( !mpFloatWin )
- {
- // no floater was opened
- Deactivate();
- InvalidateItem(mnCurPos);
+ mpData->mbDropDownByKeyboard = false;
+ mpData->maDropdownClickHdl.Call( this );
- mnCurPos = ITEM_NOTFOUND;
- mnCurItemId = 0;
- mnDownItemId = 0;
- mnMouseModifier = 0;
- mnHighItemId = 0;
- }
+ // do not reset data if the dropdown handler opened a floating window
+ // see ImplFloatControl()
+ if( !mpFloatWin )
+ {
+ // no floater was opened
+ Deactivate();
+ InvalidateItem(mnCurPos);
+
+ mnCurPos = ITEM_NOTFOUND;
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnMouseModifier = 0;
+ mnHighItemId = 0;
}
}
@@ -2430,32 +2430,32 @@ static void ImplDrawDropdownArrow(vcl::RenderContext& rRenderContext, const tool
void ToolBox::ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight)
{
- if (!mpData->maMenubuttonItem.maRect.IsEmpty())
- {
- // #i53937# paint menu button only if necessary
- if (!ImplHasClippedItems())
- return;
+ if (mpData->maMenubuttonItem.maRect.IsEmpty())
+ return;
- // execute pending paint requests
- ImplCheckUpdate();
+ // #i53937# paint menu button only if necessary
+ if (!ImplHasClippedItems())
+ return;
- rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
+ // execute pending paint requests
+ ImplCheckUpdate();
- // draw the 'more' indicator / button (>>)
- ImplErase(rRenderContext, mpData->maMenubuttonItem.maRect, bHighlight);
+ rRenderContext.Push(PushFlags::FILLCOLOR | PushFlags::LINECOLOR);
- if (bHighlight)
- ImplDrawButton(rRenderContext, mpData->maMenubuttonItem.maRect, 2, false, true, false );
+ // draw the 'more' indicator / button (>>)
+ ImplErase(rRenderContext, mpData->maMenubuttonItem.maRect, bHighlight);
- if (ImplHasClippedItems())
- ImplDrawMoreIndicator(rRenderContext, mpData->maMenubuttonItem.maRect);
+ if (bHighlight)
+ ImplDrawButton(rRenderContext, mpData->maMenubuttonItem.maRect, 2, false, true, false );
- // store highlight state
- mpData->mbMenubuttonSelected = bHighlight;
+ if (ImplHasClippedItems())
+ ImplDrawMoreIndicator(rRenderContext, mpData->maMenubuttonItem.maRect);
- // restore colors
- rRenderContext.Pop();
- }
+ // store highlight state
+ mpData->mbMenubuttonSelected = bHighlight;
+
+ // restore colors
+ rRenderContext.Pop();
}
void ToolBox::ImplDrawSpin(vcl::RenderContext& rRenderContext)
@@ -2503,25 +2503,25 @@ void ToolBox::ImplDrawSeparator(vcl::RenderContext& rRenderContext, ImplToolItem
}
/* Draw the widget only if it can't be drawn natively. */
- if (!bNativeOk)
+ if (bNativeOk)
+ return;
+
+ long nCenterPos, nSlim;
+ const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
+ rRenderContext.SetLineColor(rStyleSettings.GetSeparatorColor());
+ if (IsHorizontal())
{
- long nCenterPos, nSlim;
- const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
- rRenderContext.SetLineColor(rStyleSettings.GetSeparatorColor());
- if (IsHorizontal())
- {
- nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
- nCenterPos = pItem->maRect.Center().X();
- rRenderContext.DrawLine(Point(nCenterPos, pItem->maRect.Top() + nSlim),
- Point(nCenterPos, pItem->maRect.Bottom() - nSlim));
- }
- else
- {
- nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
- nCenterPos = pItem->maRect.Center().Y();
- rRenderContext.DrawLine(Point(pItem->maRect.Left() + nSlim, nCenterPos),
- Point(pItem->maRect.Right() - nSlim, nCenterPos));
- }
+ nSlim = (pItem->maRect.Bottom() - pItem->maRect.Top ()) / 4;
+ nCenterPos = pItem->maRect.Center().X();
+ rRenderContext.DrawLine(Point(nCenterPos, pItem->maRect.Top() + nSlim),
+ Point(nCenterPos, pItem->maRect.Bottom() - nSlim));
+ }
+ else
+ {
+ nSlim = (pItem->maRect.Right() - pItem->maRect.Left ()) / 4;
+ nCenterPos = pItem->maRect.Center().Y();
+ rRenderContext.DrawLine(Point(pItem->maRect.Left() + nSlim, nCenterPos),
+ Point(pItem->maRect.Right() - nSlim, nCenterPos));
}
}
@@ -2768,31 +2768,31 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::si
}
// paint optional drop down arrow
- if (bDropDown)
+ if (!bDropDown)
+ return;
+
+ bool bSetColor = true;
+ if ( !pItem->mbEnabled || !IsEnabled() )
{
- bool bSetColor = true;
- if ( !pItem->mbEnabled || !IsEnabled() )
- {
- bSetColor = false;
- rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
- }
+ bSetColor = false;
+ rRenderContext.SetFillColor(rStyleSettings.GetShadowColor());
+ }
- // dropdown only will be painted without inner border
- if( (pItem->mnBits & ToolBoxItemBits::DROPDOWNONLY) != ToolBoxItemBits::DROPDOWNONLY )
- {
- ImplErase(rRenderContext, aDropDownRect, nHighlight != 0, bHasOpenPopup);
+ // dropdown only will be painted without inner border
+ if( (pItem->mnBits & ToolBoxItemBits::DROPDOWNONLY) != ToolBoxItemBits::DROPDOWNONLY )
+ {
+ ImplErase(rRenderContext, aDropDownRect, nHighlight != 0, bHasOpenPopup);
- if( nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) )
- {
- if( bHasOpenPopup )
- ImplDrawFloatwinBorder(rRenderContext, pItem);
- else
- ImplDrawButton(rRenderContext, aDropDownRect, nHighlight, pItem->meState == TRISTATE_TRUE,
- pItem->mbEnabled && IsEnabled(), false);
- }
+ if( nHighlight != 0 || (pItem->meState == TRISTATE_TRUE) )
+ {
+ if( bHasOpenPopup )
+ ImplDrawFloatwinBorder(rRenderContext, pItem);
+ else
+ ImplDrawButton(rRenderContext, aDropDownRect, nHighlight, pItem->meState == TRISTATE_TRUE,
+ pItem->mbEnabled && IsEnabled(), false);
}
- ImplDrawDropdownArrow(rRenderContext, aDropDownRect, bSetColor, bRotate);
}
+ ImplDrawDropdownArrow(rRenderContext, aDropDownRect, bSetColor, bRotate);
}
void ToolBox::ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem)
@@ -3579,28 +3579,28 @@ void ToolBox::Resize()
}
// redraw border
- if ( mnWinStyle & WB_BORDER )
+ if ( !(mnWinStyle & WB_BORDER) )
+ return;
+
+ // as otherwise, when painting we might think we have to re-draw everything
+ if ( mbFormat && IsReallyVisible() )
+ Invalidate();
+ else
{
- // as otherwise, when painting we might think we have to re-draw everything
- if ( mbFormat && IsReallyVisible() )
- Invalidate();
- else
+ if ( mnRightBorder )
{
- if ( mnRightBorder )
- {
- if ( nOldDX > mnDX )
- Invalidate( tools::Rectangle( mnDX-mnRightBorder-1, 0, mnDX, mnDY ) );
- else
- Invalidate( tools::Rectangle( nOldDX-mnRightBorder-1, 0, nOldDX, nOldDY ) );
- }
+ if ( nOldDX > mnDX )
+ Invalidate( tools::Rectangle( mnDX-mnRightBorder-1, 0, mnDX, mnDY ) );
+ else
+ Invalidate( tools::Rectangle( nOldDX-mnRightBorder-1, 0, nOldDX, nOldDY ) );
+ }
- if ( mnBottomBorder )
- {
- if ( nOldDY > mnDY )
- Invalidate( tools::Rectangle( 0, mnDY-mnBottomBorder-1, mnDX, mnDY ) );
- else
- Invalidate( tools::Rectangle( 0, nOldDY-mnBottomBorder-1, nOldDX, nOldDY ) );
- }
+ if ( mnBottomBorder )
+ {
+ if ( nOldDY > mnDY )
+ Invalidate( tools::Rectangle( 0, mnDY-mnBottomBorder-1, mnDX, mnDY ) );
+ else
+ Invalidate( tools::Rectangle( 0, nOldDY-mnBottomBorder-1, nOldDX, nOldDY ) );
}
}
}
@@ -3867,23 +3867,23 @@ void ToolBox::DataChanged( const DataChangedEvent& rDCEvt )
void ToolBox::statusChanged( const css::frame::FeatureStateEvent& Event )
{
// Update image mirroring/rotation
- if ( Event.FeatureURL.Complete == ".uno:ImageOrientation" )
- {
- SfxImageItem aItem( 1 );
- aItem.PutValue( Event.State, 0 );
+ if ( Event.FeatureURL.Complete != ".uno:ImageOrientation" )
+ return;
- mbImagesMirrored = aItem.IsMirrored();
- mnImagesRotationAngle = aItem.GetRotation();
+ SfxImageItem aItem( 1 );
+ aItem.PutValue( Event.State, 0 );
- // update image orientation
- OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(mpStatusListener->getFrame()));
- for (auto const& item : mpData->m_aItems)
- {
- if (vcl::CommandInfoProvider::IsMirrored(item.maCommandStr, aModuleName))
- SetItemImageMirrorMode(item.mnId, mbImagesMirrored);
- if (vcl::CommandInfoProvider::IsRotated(item.maCommandStr, aModuleName))
- SetItemImageAngle(item.mnId, mnImagesRotationAngle);
- }
+ mbImagesMirrored = aItem.IsMirrored();
+ mnImagesRotationAngle = aItem.GetRotation();
+
+ // update image orientation
+ OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(mpStatusListener->getFrame()));
+ for (auto const& item : mpData->m_aItems)
+ {
+ if (vcl::CommandInfoProvider::IsMirrored(item.maCommandStr, aModuleName))
+ SetItemImageMirrorMode(item.mnId, mbImagesMirrored);
+ if (vcl::CommandInfoProvider::IsRotated(item.maCommandStr, aModuleName))
+ SetItemImageAngle(item.mnId, mnImagesRotationAngle);
}
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index b7e7f8ea209f..9538410d5b6d 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -300,23 +300,23 @@ void ToolBox::ImplInvalidate( bool bNewCalc, bool bFullPaint )
void ToolBox::ImplUpdateItem( ImplToolItems::size_type nIndex )
{
// do we need to redraw?
- if ( IsReallyVisible() && IsUpdateMode() )
+ if ( !(IsReallyVisible() && IsUpdateMode()) )
+ return;
+
+ if ( nIndex == ITEM_NOTFOUND )
+ {
+ // #i52217# no immediate draw as this might lead to paint problems
+ Invalidate( tools::Rectangle( mnLeftBorder, mnTopBorder, mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) );
+ }
+ else
{
- if ( nIndex == ITEM_NOTFOUND )
+ if ( !mbFormat )
{
// #i52217# no immediate draw as this might lead to paint problems
- Invalidate( tools::Rectangle( mnLeftBorder, mnTopBorder, mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) );
+ Invalidate( mpData->m_aItems[nIndex].maRect );
}
else
- {
- if ( !mbFormat )
- {
- // #i52217# no immediate draw as this might lead to paint problems
- Invalidate( mpData->m_aItems[nIndex].maRect );
- }
- else
- maPaintRect.Union( mpData->m_aItems[nIndex].maRect );
- }
+ maPaintRect.Union( mpData->m_aItems[nIndex].maRect );
}
}
@@ -526,31 +526,31 @@ void ToolBox::InsertBreak( ImplToolItems::size_type nPos )
void ToolBox::RemoveItem( ImplToolItems::size_type nPos )
{
- if( nPos < mpData->m_aItems.size() )
- {
- bool bMustCalc;
- bMustCalc = mpData->m_aItems[nPos].meType == ToolBoxItemType::BUTTON;
+ if( nPos >= mpData->m_aItems.size() )
+ return;
- if ( mpData->m_aItems[nPos].mpWindow )
- mpData->m_aItems[nPos].mpWindow->Hide();
+ bool bMustCalc;
+ bMustCalc = mpData->m_aItems[nPos].meType == ToolBoxItemType::BUTTON;
- // add the removed item to PaintRect
- maPaintRect.Union( mpData->m_aItems[nPos].maRect );
+ if ( mpData->m_aItems[nPos].mpWindow )
+ mpData->m_aItems[nPos].mpWindow->Hide();
- // ensure not to delete in the Select-Handler
- if ( mpData->m_aItems[nPos].mnId == mnCurItemId )
- mnCurItemId = 0;
- if ( mpData->m_aItems[nPos].mnId == mnHighItemId )
- mnHighItemId = 0;
+ // add the removed item to PaintRect
+ maPaintRect.Union( mpData->m_aItems[nPos].maRect );
- ImplInvalidate( bMustCalc );
+ // ensure not to delete in the Select-Handler
+ if ( mpData->m_aItems[nPos].mnId == mnCurItemId )
+ mnCurItemId = 0;
+ if ( mpData->m_aItems[nPos].mnId == mnHighItemId )
+ mnHighItemId = 0;
- mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos );
- mpData->ImplClearLayoutData();
+ ImplInvalidate( bMustCalc );
- // Notify
- CallEventListeners( VclEventId::ToolboxItemRemoved, reinterpret_cast< void* >( nPos ) );
- }
+ mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos );
+ mpData->ImplClearLayoutData();
+
+ // Notify
+ CallEventListeners( VclEventId::ToolboxItemRemoved, reinterpret_cast< void* >( nPos ) );
}
void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId )
@@ -561,23 +561,23 @@ void ToolBox::CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId )
ImplToolItems::size_type nPos = rToolBox.GetItemPos( nItemId );
// found item
- if ( nPos != ITEM_NOTFOUND )
- {
- // push ToolBox item onto the list
- ImplToolItem aNewItem = rToolBox.mpData->m_aItems[nPos];
- // reset state
- aNewItem.mpWindow = nullptr;
- aNewItem.mbShowWindow = false;
+ if ( nPos == ITEM_NOTFOUND )
+ return;
- mpData->m_aItems.push_back( aNewItem );
- mpData->ImplClearLayoutData();
- // redraw ToolBox
- ImplInvalidate();
+ // push ToolBox item onto the list
+ ImplToolItem aNewItem = rToolBox.mpData->m_aItems[nPos];
+ // reset state
+ aNewItem.mpWindow = nullptr;
+ aNewItem.mbShowWindow = false;
- // Notify
- ImplToolItems::size_type nNewPos2 = mpData->m_aItems.size() - 1;
- CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos2 ) );
- }
+ mpData->m_aItems.push_back( aNewItem );
+ mpData->ImplClearLayoutData();
+ // redraw ToolBox
+ ImplInvalidate();
+
+ // Notify
+ ImplToolItems::size_type nNewPos2 = mpData->m_aItems.size() - 1;
+ CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos2 ) );
}
void ToolBox::Clear()
@@ -660,28 +660,28 @@ Size ToolBox::GetDefaultImageSize() const
void ToolBox::SetAlign( WindowAlign eNewAlign )
{
- if ( meAlign != eNewAlign )
- {
- meAlign = eNewAlign;
+ if ( meAlign == eNewAlign )
+ return;
- if ( !ImplIsFloatingMode() )
- {
- // set horizontal/vertical alignment
- if ( (eNewAlign == WindowAlign::Left) || (eNewAlign == WindowAlign::Right) )
- mbHorz = false;
- else
- mbHorz = true;
+ meAlign = eNewAlign;
- // Update the background according to Persona if necessary
- ImplInitSettings( false, false, true );
+ if ( ImplIsFloatingMode() )
+ return;
- // redraw everything, as the border has changed
- mbCalc = true;
- mbFormat = true;
- if ( IsReallyVisible() && IsUpdateMode() )
- Invalidate();
- }
- }
+ // set horizontal/vertical alignment
+ if ( (eNewAlign == WindowAlign::Left) || (eNewAlign == WindowAlign::Right) )
+ mbHorz = false;
+ else
+ mbHorz = true;
+
+ // Update the background according to Persona if necessary
+ ImplInitSettings( false, false, true );
+
+ // redraw everything, as the border has changed
+ mbCalc = true;
+ mbFormat = true;
+ if ( IsReallyVisible() && IsUpdateMode() )
+ Invalidate();
}
void ToolBox::SetLineCount( ImplToolItems::size_type nNewLines )
@@ -939,21 +939,21 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
- {
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
- Size aOldSize = pItem->maImage.GetSizePixel();
+ if ( nPos == ITEM_NOTFOUND )
+ return;
- pItem->maImage = rImage;
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ Size aOldSize = pItem->maImage.GetSizePixel();
- // only once all is calculated, do extra work
- if (!mbCalc)
- {
- if (aOldSize != pItem->maImage.GetSizePixel())
- ImplInvalidate( true );
- else
- ImplUpdateItem( nPos );
- }
+ pItem->maImage = rImage;
+
+ // only once all is calculated, do extra work
+ if (!mbCalc)
+ {
+ if (aOldSize != pItem->maImage.GetSizePixel())
+ ImplInvalidate( true );
+ else
+ ImplUpdateItem( nPos );
}
}
@@ -970,28 +970,28 @@ void ToolBox::SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
- {
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
- Size aOldSize = pItem->maImage.GetSizePixel();
+ if ( nPos == ITEM_NOTFOUND )
+ return;
- long nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % 3600;
- while( nDeltaAngle < 0 )
- nDeltaAngle += 3600;
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ Size aOldSize = pItem->maImage.GetSizePixel();
- pItem->mnImageAngle = nAngle10;
- if( nDeltaAngle && !!pItem->maImage )
- {
- pItem->maImage = ImplRotImage( pItem->maImage, nDeltaAngle );
- }
+ long nDeltaAngle = (nAngle10 - pItem->mnImageAngle) % 3600;
+ while( nDeltaAngle < 0 )
+ nDeltaAngle += 3600;
- if (!mbCalc)
- {
- if (aOldSize != pItem->maImage.GetSizePixel())
- ImplInvalidate(true);
- else
- ImplUpdateItem(nPos);
- }
+ pItem->mnImageAngle = nAngle10;
+ if( nDeltaAngle && !!pItem->maImage )
+ {
+ pItem->maImage = ImplRotImage( pItem->maImage, nDeltaAngle );
+ }
+
+ if (!mbCalc)
+ {
+ if (aOldSize != pItem->maImage.GetSizePixel())
+ ImplInvalidate(true);
+ else
+ ImplUpdateItem(nPos);
}
}
@@ -1008,21 +1008,21 @@ void ToolBox::SetItemImageMirrorMode( sal_uInt16 nItemId, bool bMirror )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
- {
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ if ( nPos == ITEM_NOTFOUND )
+ return;
- if (pItem->mbMirrorMode != bMirror)
- {
- pItem->mbMirrorMode = bMirror;
- if (!!pItem->maImage)
- {
- pItem->maImage = ImplMirrorImage(pItem->maImage);
- }
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
- if (!mbCalc)
- ImplUpdateItem(nPos);
+ if (pItem->mbMirrorMode != bMirror)
+ {
+ pItem->mbMirrorMode = bMirror;
+ if (!!pItem->maImage)
+ {
+ pItem->maImage = ImplMirrorImage(pItem->maImage);
}
+
+ if (!mbCalc)
+ ImplUpdateItem(nPos);
}
}
@@ -1036,30 +1036,30 @@ void ToolBox::SetItemText( sal_uInt16 nItemId, const OUString& rText )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
+ if ( nPos == ITEM_NOTFOUND )
+ return;
+
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ // only once all is calculated, do extra work
+ if ( !mbCalc &&
+ ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) )
{
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
- // only once all is calculated, do extra work
- if ( !mbCalc &&
- ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) )
- {
- long nOldWidth = GetCtrlTextWidth( pItem->maText );
- pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
- mpData->ImplClearLayoutData();
- if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) )
- ImplInvalidate( true );
- else
- ImplUpdateItem( nPos );
- }
+ long nOldWidth = GetCtrlTextWidth( pItem->maText );
+ pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
+ mpData->ImplClearLayoutData();
+ if ( nOldWidth != GetCtrlTextWidth( pItem->maText ) )
+ ImplInvalidate( true );
else
- pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
+ ImplUpdateItem( nPos );
+ }
+ else
+ pItem->maText = MnemonicGenerator::EraseAllMnemonicChars(rText);
- // Notify button changed event to prepare accessibility bridge
- CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
+ // Notify button changed event to prepare accessibility bridge
+ CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
- // Notify
- CallEventListeners( VclEventId::ToolboxItemTextChanged, reinterpret_cast< void* >( nPos ) );
- }
+ // Notify
+ CallEventListeners( VclEventId::ToolboxItemTextChanged, reinterpret_cast< void* >( nPos ) );
}
const OUString& ToolBox::GetItemText( sal_uInt16 nItemId ) const
@@ -1121,100 +1121,100 @@ void ToolBox::SetItemDown( sal_uInt16 nItemId, bool bDown )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
+ if ( nPos == ITEM_NOTFOUND )
+ return;
+
+ if ( bDown )
{
- if ( bDown )
- {
- if ( nPos != mnCurPos )
- {
- mnCurPos = nPos;
- InvalidateItem(mnCurPos);
- Flush();
- }
- }
- else
+ if ( nPos != mnCurPos )
{
- if ( nPos == mnCurPos )
- {
- InvalidateItem(mnCurPos);
- Flush();
- mnCurPos = ITEM_NOTFOUND;
- }
+ mnCurPos = nPos;
+ InvalidateItem(mnCurPos);
+ Flush();
}
-
- if ( mbDrag )
+ }
+ else
+ {
+ if ( nPos == mnCurPos )
{
- mbDrag = false;
- EndTracking();
- if (IsMouseCaptured())
- ReleaseMouse();
- Deactivate();
+ InvalidateItem(mnCurPos);
+ Flush();
+ mnCurPos = ITEM_NOTFOUND;
}
+ }
- mnCurItemId = 0;
- mnDownItemId = 0;
- mnMouseModifier = 0;
+ if ( mbDrag )
+ {
+ mbDrag = false;
+ EndTracking();
+ if (IsMouseCaptured())
+ ReleaseMouse();
+ Deactivate();
}
+
+ mnCurItemId = 0;
+ mnDownItemId = 0;
+ mnMouseModifier = 0;
}
void ToolBox::SetItemState( sal_uInt16 nItemId, TriState eState )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
+ if ( nPos == ITEM_NOTFOUND )
+ return;
+
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+
+ // the state has changed
+ if ( pItem->meState == eState )
+ return;
+
+ // if RadioCheck, un-check the previous
+ if ( (eState == TRISTATE_TRUE) && (pItem->mnBits & ToolBoxItemBits::AUTOCHECK) &&
+ (pItem->mnBits & ToolBoxItemBits::RADIOCHECK) )
{
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ ImplToolItem* pGroupItem;
+ ImplToolItems::size_type nGroupPos;
+ ImplToolItems::size_type nItemCount = GetItemCount();
- // the state has changed
- if ( pItem->meState != eState )
+ nGroupPos = nPos;
+ while ( nGroupPos )
{
- // if RadioCheck, un-check the previous
- if ( (eState == TRISTATE_TRUE) && (pItem->mnBits & ToolBoxItemBits::AUTOCHECK) &&
- (pItem->mnBits & ToolBoxItemBits::RADIOCHECK) )
+ pGroupItem = &mpData->m_aItems[nGroupPos-1];
+ if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
{
- ImplToolItem* pGroupItem;
- ImplToolItems::size_type nGroupPos;
- ImplToolItems::size_type nItemCount = GetItemCount();
-
- nGroupPos = nPos;
- while ( nGroupPos )
- {
- pGroupItem = &mpData->m_aItems[nGroupPos-1];
- if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
- {
- if ( pGroupItem->meState != TRISTATE_FALSE )
- SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
- }
- else
- break;
- nGroupPos--;
- }
+ if ( pGroupItem->meState != TRISTATE_FALSE )
+ SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
+ }
+ else
+ break;
+ nGroupPos--;
+ }
- nGroupPos = nPos+1;
- while ( nGroupPos < nItemCount )
- {
- pGroupItem = &mpData->m_aItems[nGroupPos];
- if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
- {
- if ( pGroupItem->meState != TRISTATE_FALSE )
- SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
- }
- else
- break;
- nGroupPos++;
- }
+ nGroupPos = nPos+1;
+ while ( nGroupPos < nItemCount )
+ {
+ pGroupItem = &mpData->m_aItems[nGroupPos];
+ if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
+ {
+ if ( pGroupItem->meState != TRISTATE_FALSE )
+ SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
}
+ else
+ break;
+ nGroupPos++;
+ }
+ }
- pItem->meState = eState;
- ImplUpdateItem( nPos );
+ pItem->meState = eState;
+ ImplUpdateItem( nPos );
- // Notify button changed event to prepare accessibility bridge
- CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
+ // Notify button changed event to prepare accessibility bridge
+ CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
- // Call accessible listener to notify state_changed event
- CallEventListeners( VclEventId::ToolboxItemUpdated, reinterpret_cast< void* >(nPos) );
- }
- }
+ // Call accessible listener to notify state_changed event
+ CallEventListeners( VclEventId::ToolboxItemUpdated, reinterpret_cast< void* >(nPos) );
}
TriState ToolBox::GetItemState( sal_uInt16 nItemId ) const
@@ -1231,28 +1231,28 @@ void ToolBox::EnableItem( sal_uInt16 nItemId, bool bEnable )
{
ImplToolItems::size_type nPos = GetItemPos( nItemId );
- if ( nPos != ITEM_NOTFOUND )
- {
- ImplToolItem* pItem = &mpData->m_aItems[nPos];
- if ( pItem->mbEnabled != bEnable )
- {
- pItem->mbEnabled = bEnable;
+ if ( nPos == ITEM_NOTFOUND )
+ return;
- // if existing, also redraw the window
- if ( pItem->mpWindow )
- pItem->mpWindow->Enable( pItem->mbEnabled );
+ ImplToolItem* pItem = &mpData->m_aItems[nPos];
+ if ( pItem->mbEnabled == bEnable )
+ return;
- // update item
- ImplUpdateItem( nPos );
+ pItem->mbEnabled = bEnable;
- ImplUpdateInputEnable();
+ // if existing, also redraw the window
+ if ( pItem->mpWindow )
+ pItem->mpWindow->Enable( pItem->mbEnabled );
- // Notify button changed event to prepare accessibility bridge
- CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
+ // update item
+ ImplUpdateItem( nPos );
- CallEventListeners( bEnable ? VclEventId::ToolboxItemEnabled : VclEventId::ToolboxItemDisabled, reinterpret_cast< void* >( nPos ) );
- }
- }
+ ImplUpdateInputEnable();
+
+ // Notify button changed event to prepare accessibility bridge
+ CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
+
+ CallEventListeners( bEnable ? VclEventId::ToolboxItemEnabled : VclEventId::ToolboxItemDisabled, reinterpret_cast< void* >( nPos ) );
}
bool ToolBox::IsItemEnabled( sal_uInt16 nItemId ) const
@@ -1379,20 +1379,20 @@ void ToolBox::SetOutStyle( sal_uInt16 nNewStyle )
// always force flat looking toolbars since NWF
nNewStyle |= TOOLBOX_STYLE_FLAT;
- if ( mnOutStyle != nNewStyle )
- {
- mnOutStyle = nNewStyle;
- ImplDisableFlatButtons();
+ if ( mnOutStyle == nNewStyle )
+ return;
- // so as to redo the ButtonDevice
- if ( !(mnOutStyle & TOOLBOX_STYLE_FLAT) )
- {
- mnMaxItemWidth = 1;
- mnMaxItemHeight = 1;
- }
+ mnOutStyle = nNewStyle;
+ ImplDisableFlatButtons();
- ImplInvalidate( true, true );
+ // so as to redo the ButtonDevice
+ if ( !(mnOutStyle & TOOLBOX_STYLE_FLAT) )
+ {
+ mnMaxItemWidth = 1;
+ mnMaxItemHeight = 1;
}
+
+ ImplInvalidate( true, true );
}
// disable key input if all items are disabled
@@ -1477,26 +1477,26 @@ void ToolBox::SetDropdownClickHdl( const Link<ToolBox *, void>& rLink )
void ToolBox::SetMenuType( ToolBoxMenuType aType )
{
- if( aType != mpData->maMenuType )
+ if( aType == mpData->maMenuType )
+ return;
+
+ mpData->maMenuType = aType;
+ if( IsFloatingMode() )
{
- mpData->maMenuType = aType;
- if( IsFloatingMode() )
- {
- // the menu button may have to be moved into the decoration which changes the layout
- ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
- if( pWrapper )
- pWrapper->ShowTitleButton( TitleButton::Menu, bool( aType & ToolBoxMenuType::Customize) );
+ // the menu button may have to be moved into the decoration which changes the layout
+ ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
+ if( pWrapper )
+ pWrapper->ShowTitleButton( TitleButton::Menu, bool( aType & ToolBoxMenuType::Customize) );
- mbFormat = true;
- ImplFormat();
- ImplSetMinMaxFloatSize();
- }
- else
- {
- // trigger redraw of menu button
- if( !mpData->maMenubuttonItem.maRect.IsEmpty() )
- Invalidate(mpData->maMenubuttonItem.maRect);
- }
+ mbFormat = true;
+ ImplFormat();
+ ImplSetMinMaxFloatSize();
+ }
+ else
+ {
+ // trigger redraw of menu button
+ if( !mpData->maMenubuttonItem.maRect.IsEmpty() )
+ Invalidate(mpData->maMenubuttonItem.maRect);
}
}
@@ -1553,39 +1553,38 @@ void ToolBox::UpdateCustomMenu()
// in the toolbar are ignored as they would introduce too much clutter,
// instead we have a single separator to help distinguish between overflow
// and hidden items.
- if ( !mpData->m_aItems.empty() )
+ if ( mpData->m_aItems.empty() )
+ return;
+
+ // nStartPos will hold the number of clipped items appended from first loop
+ for ( const auto& rItem : mpData->m_aItems )
{
- // nStartPos will hold the number of clipped items appended from first loop
- for ( const auto& rItem : mpData->m_aItems )
+ if( rItem.IsClipped() )
{
- if( rItem.IsClipped() )
- {
- sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START;
- MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
- pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits);
- pMenu->SetItemCommand( id, rItem.maCommandStr );
- pMenu->EnableItem( id, rItem.mbEnabled );
- pMenu->CheckItem ( id, rItem.meState == TRISTATE_TRUE );
- }
+ sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START;
+ MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
+ pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits);
+ pMenu->SetItemCommand( id, rItem.maCommandStr );
+ pMenu->EnableItem( id, rItem.mbEnabled );
+ pMenu->CheckItem ( id, rItem.meState == TRISTATE_TRUE );
}
+ }
- // add a separator below the inserted clipped-items
- pMenu->InsertSeparator();
+ // add a separator below the inserted clipped-items
+ pMenu->InsertSeparator();
- // now append the items that are explicitly disabled
- for ( const auto& rItem : mpData->m_aItems )
+ // now append the items that are explicitly disabled
+ for ( const auto& rItem : mpData->m_aItems )
+ {
+ if( rItem.IsItemHidden() )
{
- if( rItem.IsItemHidden() )
- {
- sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START;
- MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
- pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits );
- pMenu->SetItemCommand( id, rItem.maCommandStr );
- pMenu->EnableItem( id, rItem.mbEnabled );
- pMenu->CheckItem( id, rItem.meState == TRISTATE_TRUE );
- }
+ sal_uInt16 id = rItem.mnId + TOOLBOX_MENUITEM_START;
+ MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
+ pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits );
+ pMenu->SetItemCommand( id, rItem.maCommandStr );
+ pMenu->EnableItem( id, rItem.mbEnabled );
+ pMenu->CheckItem( id, rItem.meState == TRISTATE_TRUE );
}
-
}
}
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 6b3d44e6d716..95c0ccb203ff 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1565,166 +1565,166 @@ void Window::ImplPosSizeWindow( long nX, long nY,
}
}
- if ( bNewPos || bNewSize )
- {
- bool bUpdateSysObjPos = false;
- if ( bNewPos )
- bUpdateSysObjPos = ImplUpdatePos();
+ if ( !(bNewPos || bNewSize) )
+ return;
- // the borderwindow always specifies the position for its client window
- if ( mpWindowImpl->mpBorderWindow )
- mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos;
-
- if ( mpWindowImpl->mpClientWindow )
- {
- mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder,
- mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder,
- mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder,
- mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder,
- PosSizeFlags::X | PosSizeFlags::Y |
- PosSizeFlags::Width | PosSizeFlags::Height );
- // If we have a client window, then this is the position
- // of the Application's floating windows
- mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos;
- if ( bNewPos )
- {
- if ( mpWindowImpl->mpClientWindow->IsVisible() )
- {
- mpWindowImpl->mpClientWindow->ImplCallMove();
- }
- else
- {
- mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = true;
- }
- }
- }
+ bool bUpdateSysObjPos = false;
+ if ( bNewPos )
+ bUpdateSysObjPos = ImplUpdatePos();
- // Move()/Resize() will be called only for Show(), such that
- // at least one is called before Show()
- if ( IsVisible() )
+ // the borderwindow always specifies the position for its client window
+ if ( mpWindowImpl->mpBorderWindow )
+ mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos;
+
+ if ( mpWindowImpl->mpClientWindow )
+ {
+ mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder,
+ mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder,
+ mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder,
+ mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder,
+ PosSizeFlags::X | PosSizeFlags::Y |
+ PosSizeFlags::Width | PosSizeFlags::Height );
+ // If we have a client window, then this is the position
+ // of the Application's floating windows
+ mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos;
+ if ( bNewPos )
{
- if ( bNewPos )
+ if ( mpWindowImpl->mpClientWindow->IsVisible() )
{
- ImplCallMove();
+ mpWindowImpl->mpClientWindow->ImplCallMove();
}
- if ( bNewSize )
+ else
{
- ImplCallResize();
+ mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = true;
}
}
- else
+ }
+
+ // Move()/Resize() will be called only for Show(), such that
+ // at least one is called before Show()
+ if ( IsVisible() )
+ {
+ if ( bNewPos )
{
- if ( bNewPos )
- mpWindowImpl->mbCallMove = true;
- if ( bNewSize )
- mpWindowImpl->mbCallResize = true;
+ ImplCallMove();
+ }
+ if ( bNewSize )
+ {
+ ImplCallResize();
}
+ }
+ else
+ {
+ if ( bNewPos )
+ mpWindowImpl->mbCallMove = true;
+ if ( bNewSize )
+ mpWindowImpl->mbCallResize = true;
+ }
- bool bUpdateSysObjClip = false;
- if ( IsReallyVisible() )
+ bool bUpdateSysObjClip = false;
+ if ( IsReallyVisible() )
+ {
+ if ( bNewPos || bNewSize )
{
- if ( bNewPos || bNewSize )
- {
- // set Clip-Flag
- bUpdateSysObjClip = !ImplSetClipFlag( true );
- }
+ // set Clip-Flag
+ bUpdateSysObjClip = !ImplSetClipFlag( true );
+ }
- // invalidate window content ?
- if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) )
+ // invalidate window content ?
+ if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) )
+ {
+ if ( bNewPos )
{
- if ( bNewPos )
+ bool bInvalidate = false;
+ bool bParentPaint = true;
+ if ( !ImplIsOverlapWindow() )
+ bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled();
+ if ( bCopyBits && bParentPaint && !HasPaintEvent() )
{
- bool bInvalidate = false;
- bool bParentPaint = true;
- if ( !ImplIsOverlapWindow() )
- bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled();
- if ( bCopyBits && bParentPaint && !HasPaintEvent() )
+ Point aPoint( mnOutOffX, mnOutOffY );
+ vcl::Region aRegion( tools::Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ if ( mpWindowImpl->mbWinRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
+ ImplClipBoundaries( aRegion, false, true );
+ if ( !pOverlapRegion->IsEmpty() )
{
- Point aPoint( mnOutOffX, mnOutOffY );
- vcl::Region aRegion( tools::Rectangle( aPoint,
- Size( mnOutWidth, mnOutHeight ) ) );
- if ( mpWindowImpl->mbWinRegion )
- aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
- ImplClipBoundaries( aRegion, false, true );
- if ( !pOverlapRegion->IsEmpty() )
- {
- pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY );
- aRegion.Exclude( *pOverlapRegion );
- }
- if ( !aRegion.IsEmpty() )
+ pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY );
+ aRegion.Exclude( *pOverlapRegion );
+ }
+ if ( !aRegion.IsEmpty() )
+ {
+ // adapt Paint areas
+ ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ),
+ Size( nOldOutWidth, nOldOutHeight ) ),
+ mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY,
+ true );
+ SalGraphics* pGraphics = ImplGetFrameGraphics();
+ if ( pGraphics )
{
- // adapt Paint areas
- ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ),
- Size( nOldOutWidth, nOldOutHeight ) ),
- mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY,
- true );
- SalGraphics* pGraphics = ImplGetFrameGraphics();
- if ( pGraphics )
- {
- OutputDevice *pOutDev = GetOutDev();
- const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics );
- if ( bSelectClipRegion )
- {
- pGraphics->CopyArea( mnOutOffX, mnOutOffY,
- nOldOutOffX, nOldOutOffY,
- nOldOutWidth, nOldOutHeight,
- this );
- }
- else
- bInvalidate = true;
+ OutputDevice *pOutDev = GetOutDev();
+ const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics );
+ if ( bSelectClipRegion )
+ {
+ pGraphics->CopyArea( mnOutOffX, mnOutOffY,
+ nOldOutOffX, nOldOutOffY,
+ nOldOutWidth, nOldOutHeight,
+ this );
}
else
bInvalidate = true;
- if ( !bInvalidate )
- {
- if ( !pOverlapRegion->IsEmpty() )
- ImplInvalidateFrameRegion( pOverlapRegion.get(), InvalidateFlags::Children );
- }
}
else
bInvalidate = true;
+ if ( !bInvalidate )
+ {
+ if ( !pOverlapRegion->IsEmpty() )
+ ImplInvalidateFrameRegion( pOverlapRegion.get(), InvalidateFlags::Children );
+ }
}
else
bInvalidate = true;
- if ( bInvalidate )
- ImplInvalidateFrameRegion( nullptr, InvalidateFlags::Children );
}
else
- {
- Point aPoint( mnOutOffX, mnOutOffY );
- vcl::Region aRegion( tools::Rectangle( aPoint,
- Size( mnOutWidth, mnOutHeight ) ) );
- aRegion.Exclude( *pOldRegion );
- if ( mpWindowImpl->mbWinRegion )
- aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
- ImplClipBoundaries( aRegion, false, true );
- if ( !aRegion.IsEmpty() )
- ImplInvalidateFrameRegion( &aRegion, InvalidateFlags::Children );
- }
+ bInvalidate = true;
+ if ( bInvalidate )
+ ImplInvalidateFrameRegion( nullptr, InvalidateFlags::Children );
}
-
- // invalidate Parent or Overlaps
- if ( bNewPos ||
- (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) )
+ else
{
- vcl::Region aRegion( *pOldRegion );
- if ( !mpWindowImpl->mbPaintTransparent )
- ImplExcludeWindowRegion( aRegion );
+ Point aPoint( mnOutOffX, mnOutOffY );
+ vcl::Region aRegion( tools::Rectangle( aPoint,
+ Size( mnOutWidth, mnOutHeight ) ) );
+ aRegion.Exclude( *pOldRegion );
+ if ( mpWindowImpl->mbWinRegion )
+ aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
ImplClipBoundaries( aRegion, false, true );
- if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow )
- ImplInvalidateParentFrameRegion( aRegion );
+ if ( !aRegion.IsEmpty() )
+ ImplInvalidateFrameRegion( &aRegion, InvalidateFlags::Children );
}
}
- // adapt system objects
- if ( bUpdateSysObjClip )
- ImplUpdateSysObjClip();
- if ( bUpdateSysObjPos )
- ImplUpdateSysObjPos();
- if ( bNewSize && mpWindowImpl->mpSysObj )
- mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
+ // invalidate Parent or Overlaps
+ if ( bNewPos ||
+ (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) )
+ {
+ vcl::Region aRegion( *pOldRegion );
+ if ( !mpWindowImpl->mbPaintTransparent )
+ ImplExcludeWindowRegion( aRegion );
+ ImplClipBoundaries( aRegion, false, true );
+ if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow )
+ ImplInvalidateParentFrameRegion( aRegion );
+ }
}
+
+ // adapt system objects
+ if ( bUpdateSysObjClip )
+ ImplUpdateSysObjClip();
+ if ( bUpdateSysObjPos )
+ ImplUpdateSysObjPos();
+ if ( bNewSize && mpWindowImpl->mpSysObj )
+ mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
}
void Window::ImplNewInputContext()
@@ -1967,62 +1967,62 @@ void Window::SetStyle( WinBits nStyle )
void Window::SetExtendedStyle( WindowExtendedStyle nExtendedStyle )
{
- if ( mpWindowImpl->mnExtendedStyle != nExtendedStyle )
+ if ( mpWindowImpl->mnExtendedStyle == nExtendedStyle )
+ return;
+
+ vcl::Window* pWindow = ImplGetBorderWindow();
+ if( ! pWindow )
+ pWindow = this;
+ if( pWindow->mpWindowImpl->mbFrame )
{
- vcl::Window* pWindow = ImplGetBorderWindow();
- if( ! pWindow )
- pWindow = this;
- if( pWindow->mpWindowImpl->mbFrame )
- {
- SalExtStyle nExt = 0;
- if( nExtendedStyle & WindowExtendedStyle::Document )
- nExt |= SAL_FRAME_EXT_STYLE_DOCUMENT;
- if( nExtendedStyle & WindowExtendedStyle::DocModified )
- nExt |= SAL_FRAME_EXT_STYLE_DOCMODIFIED;
+ SalExtStyle nExt = 0;
+ if( nExtendedStyle & WindowExtendedStyle::Document )
+ nExt |= SAL_FRAME_EXT_STYLE_DOCUMENT;
+ if( nExtendedStyle & WindowExtendedStyle::DocModified )
+ nExt |= SAL_FRAME_EXT_STYLE_DOCMODIFIED;
- pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt );
- }
- mpWindowImpl->mnExtendedStyle = nExtendedStyle;
+ pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt );
}
+ mpWindowImpl->mnExtendedStyle = nExtendedStyle;
}
void Window::SetBorderStyle( WindowBorderStyle nBorderStyle )
{
- if ( mpWindowImpl->mpBorderWindow )
+ if ( !mpWindowImpl->mpBorderWindow )
+ return;
+
+ if( nBorderStyle == WindowBorderStyle::REMOVEBORDER &&
+ ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame &&
+ mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent
+ )
+ {
+ // this is a little awkward: some controls (e.g. svtools ProgressBar)
+ // cannot avoid getting constructed with WB_BORDER but want to disable
+ // borders in case of NWF drawing. So they need a method to remove their border window
+ VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
+ // remove us as border window's client
+ pBorderWin->mpWindowImpl->mpClientWindow = nullptr;
+ mpWindowImpl->mpBorderWindow = nullptr;
+ mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent;
+ // reparent us above the border window
+ SetParent( pBorderWin->mpWindowImpl->mpParent );
+ // set us to the position and size of our previous border
+ Point aBorderPos( pBorderWin->GetPosPixel() );
+ Size aBorderSize( pBorderWin->GetSizePixel() );
+ setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
+ // release border window
+ pBorderWin.disposeAndClear();
+
+ // set new style bits
+ SetStyle( GetStyle() & (~WB_BORDER) );
+ }
+ else
{
- if( nBorderStyle == WindowBorderStyle::REMOVEBORDER &&
- ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame &&
- mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent
- )
- {
- // this is a little awkward: some controls (e.g. svtools ProgressBar)
- // cannot avoid getting constructed with WB_BORDER but want to disable
- // borders in case of NWF drawing. So they need a method to remove their border window
- VclPtr<vcl::Window> pBorderWin = mpWindowImpl->mpBorderWindow;
- // remove us as border window's client
- pBorderWin->mpWindowImpl->mpClientWindow = nullptr;
- mpWindowImpl->mpBorderWindow = nullptr;
- mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent;
- // reparent us above the border window
- SetParent( pBorderWin->mpWindowImpl->mpParent );
- // set us to the position and size of our previous border
- Point aBorderPos( pBorderWin->GetPosPixel() );
- Size aBorderSize( pBorderWin->GetSizePixel() );
- setPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
- // release border window
- pBorderWin.disposeAndClear();
-
- // set new style bits
- SetStyle( GetStyle() & (~WB_BORDER) );
- }
+ if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
+ static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetBorderStyle( nBorderStyle );
else
- {
- if ( mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW )
- static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetBorderStyle( nBorderStyle );
- else
- mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
- }
+ mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
}
}
@@ -2608,19 +2608,19 @@ void Window::EnableInput( bool bEnable, const vcl::Window* pExcludeWindow )
}
// the same for ownerdraw floating windows
- if( mpWindowImpl->mbFrame )
+ if( !mpWindowImpl->mbFrame )
+ return;
+
+ ::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
+ for (auto const& elem : rList)
{
- ::std::vector< VclPtr<vcl::Window> >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
- for (auto const& elem : rList)
+ // Is Window in the path from this window
+ if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( elem, true ) )
{
- // Is Window in the path from this window
- if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( elem, true ) )
- {
- // Is Window not in the exclude window path or not the
- // exclude window, then change the status
- if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( elem, true ) )
- elem->EnableInput( bEnable );
- }
+ // Is Window not in the exclude window path or not the
+ // exclude window, then change the status
+ if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( elem, true ) )
+ elem->EnableInput( bEnable );
}
}
}
@@ -2685,27 +2685,27 @@ void Window::SetActivateMode( ActivateModeFlags nMode )
if ( mpWindowImpl->mpBorderWindow )
mpWindowImpl->mpBorderWindow->SetActivateMode( nMode );
- if ( mpWindowImpl->mnActivateMode != nMode )
- {
- mpWindowImpl->mnActivateMode = nMode;
+ if ( mpWindowImpl->mnActivateMode == nMode )
+ return;
- // possibly trigger Deactivate/Activate
- if ( mpWindowImpl->mnActivateMode != ActivateModeFlags::NONE )
+ mpWindowImpl->mnActivateMode = nMode;
+
+ // possibly trigger Deactivate/Activate
+ if ( mpWindowImpl->mnActivateMode != ActivateModeFlags::NONE )
+ {
+ if ( (mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW)) &&
+ !HasChildPathFocus( true ) )
{
- if ( (mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW)) &&
- !HasChildPathFocus( true ) )
- {
- mpWindowImpl->mbActive = false;
- Deactivate();
- }
+ mpWindowImpl->mbActive = false;
+ Deactivate();
}
- else
+ }
+ else
+ {
+ if ( !mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW) )
{
- if ( !mpWindowImpl->mbActive || (GetType() == WindowType::BORDERWINDOW) )
- {
- mpWindowImpl->mbActive = true;
- Activate();
- }
+ mpWindowImpl->mbActive = true;
+ Activate();
}
}
}
@@ -3427,20 +3427,20 @@ void Window::ImplCallDeactivateListeners( vcl::Window *pNew )
void Window::ImplCallActivateListeners( vcl::Window *pOld )
{
// no activation if the old active window is my child
- if ( !pOld || !ImplIsChild( pOld ) )
- {
- VclPtr<vcl::Window> xWindow(this);
- CallEventListeners( VclEventId::WindowActivate, pOld );
- if( xWindow->IsDisposed() )
- return;
+ if ( pOld && ImplIsChild( pOld ))
+ return;
- if ( ImplGetParent() )
- ImplGetParent()->ImplCallActivateListeners( pOld );
- else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
- {
- // top level frame reached: store hint for DefModalDialogParent
- ImplGetSVData()->maFrameData.mpActiveApplicationFrame = mpWindowImpl->mpFrameWindow;
- }
+ VclPtr<vcl::Window> xWindow(this);
+ CallEventListeners( VclEventId::WindowActivate, pOld );
+ if( xWindow->IsDisposed() )
+ return;
+
+ if ( ImplGetParent() )
+ ImplGetParent()->ImplCallActivateListeners( pOld );
+ else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
+ {
+ // top level frame reached: store hint for DefModalDialogParent
+ ImplGetSVData()->maFrameData.mpActiveApplicationFrame = mpWindowImpl->mpFrameWindow;
}
}
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 8a6809771c3a..cab79f4fcef3 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -273,39 +273,39 @@ void Window::EndTracking( TrackingEventFlags nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->mpWinData->mpTrackWin.get() == this )
+ if ( pSVData->mpWinData->mpTrackWin.get() != this )
+ return;
+
+ if ( pSVData->mpWinData->mpTrackTimer )
{
- if ( pSVData->mpWinData->mpTrackTimer )
- {
- delete pSVData->mpWinData->mpTrackTimer;
- pSVData->mpWinData->mpTrackTimer = nullptr;
- }
+ delete pSVData->mpWinData->mpTrackTimer;
+ pSVData->mpWinData->mpTrackTimer = nullptr;
+ }
- pSVData->mpWinData->mpTrackWin = nullptr;
- pSVData->mpWinData->mnTrackFlags = StartTrackingFlags::NONE;
- ReleaseMouse();
+ pSVData->mpWinData->mpTrackWin = nullptr;
+ pSVData->mpWinData->mnTrackFlags = StartTrackingFlags::NONE;
+ ReleaseMouse();
- // call EndTracking if required
+ // call EndTracking if required
+ {
+ Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
+ if( ImplIsAntiparallel() )
{
- Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
- if( ImplIsAntiparallel() )
- {
- // re-mirror frame pos at pChild
- const OutputDevice *pOutDev = GetOutDev();
- pOutDev->ReMirror( aMousePos );
- }
-
- MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
- mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
- mpWindowImpl->mpFrameData->mnMouseCode,
- mpWindowImpl->mpFrameData->mnMouseCode );
- TrackingEvent aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
- // CompatTracking effectively
- if (!mpWindowImpl || mpWindowImpl->mbInDispose)
- return Window::Tracking( aTEvt );
- else
- return Tracking( aTEvt );
+ // re-mirror frame pos at pChild
+ const OutputDevice *pOutDev = GetOutDev();
+ pOutDev->ReMirror( aMousePos );
}
+
+ MouseEvent aMEvt( ImplFrameToOutput( aMousePos ),
+ mpWindowImpl->mpFrameData->mnClickCount, MouseEventModifiers::NONE,
+ mpWindowImpl->mpFrameData->mnMouseCode,
+ mpWindowImpl->mpFrameData->mnMouseCode );
+ TrackingEvent aTEvt( aMEvt, nFlags | TrackingEventFlags::End );
+ // CompatTracking effectively
+ if (!mpWindowImpl || mpWindowImpl->mbInDispose)
+ return Window::Tracking( aTEvt );
+ else
+ return Tracking( aTEvt );
}
}
@@ -576,34 +576,34 @@ long Window::GetDrawPixel( OutputDevice const * pDev, long nPixels ) const
static void lcl_HandleScrollHelper( ScrollBar* pScrl, double nN, bool isMultiplyByLineSize )
{
- if ( pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode() )
- {
- long nNewPos = pScrl->GetThumbPos();
-
- if ( nN == double(-LONG_MAX) )
- nNewPos += pScrl->GetPageSize();
- else if ( nN == double(LONG_MAX) )
- nNewPos -= pScrl->GetPageSize();
- else
- {
- // allowing both chunked and continuous scrolling
- if(isMultiplyByLineSize){
- nN*=pScrl->GetLineSize();
- }
+ if ( !(pScrl && nN && pScrl->IsEnabled() && pScrl->IsInputEnabled() && ! pScrl->IsInModalMode()) )
+ return;
- const double fVal = nNewPos - nN;
+ long nNewPos = pScrl->GetThumbPos();
- if ( !o3tl::convertsToAtLeast(fVal, LONG_MIN) )
- nNewPos = LONG_MIN;
- else if ( !o3tl::convertsToAtMost(fVal, LONG_MAX) )
- nNewPos = LONG_MAX;
- else
- nNewPos = static_cast<long>(fVal);
+ if ( nN == double(-LONG_MAX) )
+ nNewPos += pScrl->GetPageSize();
+ else if ( nN == double(LONG_MAX) )
+ nNewPos -= pScrl->GetPageSize();
+ else
+ {
+ // allowing both chunked and continuous scrolling
+ if(isMultiplyByLineSize){
+ nN*=pScrl->GetLineSize();
}
- pScrl->DoScroll( nNewPos );
+ const double fVal = nNewPos - nN;
+
+ if ( !o3tl::convertsToAtLeast(fVal, LONG_MIN) )
+ nNewPos = LONG_MIN;
+ else if ( !o3tl::convertsToAtMost(fVal, LONG_MAX) )
+ nNewPos = LONG_MAX;
+ else
+ nNewPos = static_cast<long>(fVal);
}
+ pScrl->DoScroll( nNewPos );
+
}
bool Window::HandleScrollCommand( const CommandEvent& rCmd,
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index 86b583e7b5b9..e0a4c16d18f7 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -162,30 +162,30 @@ static bool ImplHandleMouseFloatMode( vcl::Window* pChild, const Point& rMousePo
static void ImplHandleMouseHelpRequest( vcl::Window* pChild, const Point& rMousePos )
{
ImplSVHelpData& aHelpData = ImplGetSVHelpData();
- if ( !aHelpData.mpHelpWin ||
- !( aHelpData.mpHelpWin->IsWindowOrChild( pChild ) ||
- pChild->IsWindowOrChild( aHelpData.mpHelpWin ) ) )
- {
- HelpEventMode nHelpMode = HelpEventMode::NONE;
- if ( aHelpData.mbQuickHelp )
- nHelpMode = HelpEventMode::QUICK;
- if ( aHelpData.mbBalloonHelp )
- nHelpMode |= HelpEventMode::BALLOON;
- if ( bool(nHelpMode) )
- {
- if ( pChild->IsInputEnabled() && !pChild->IsInModalMode() )
- {
- HelpEvent aHelpEvent( rMousePos, nHelpMode );
- aHelpData.mbRequestingHelp = true;
- pChild->RequestHelp( aHelpEvent );
- aHelpData.mbRequestingHelp = false;
- }
- // #104172# do not kill keyboard activated tooltips
- else if ( aHelpData.mpHelpWin && !aHelpData.mbKeyboardHelp)
- {
- ImplDestroyHelpWindow( true );
- }
- }
+ if ( aHelpData.mpHelpWin &&
+ ( aHelpData.mpHelpWin->IsWindowOrChild( pChild ) ||
+ pChild->IsWindowOrChild( aHelpData.mpHelpWin ) ))
+ return;
+
+ HelpEventMode nHelpMode = HelpEventMode::NONE;
+ if ( aHelpData.mbQuickHelp )
+ nHelpMode = HelpEventMode::QUICK;
+ if ( aHelpData.mbBalloonHelp )
+ nHelpMode |= HelpEventMode::BALLOON;
+ if ( !(bool(nHelpMode)) )
+ return;
+
+ if ( pChild->IsInputEnabled() && !pChild->IsInModalMode() )
+ {
+ HelpEvent aHelpEvent( rMousePos, nHelpMode );
+ aHelpData.mbRequestingHelp = true;
+ pChild->RequestHelp( aHelpEvent );
+ aHelpData.mbRequestingHelp = false;
+ }
+ // #104172# do not kill keyboard activated tooltips
+ else if ( aHelpData.mpHelpWin && !aHelpData.mbKeyboardHelp)
+ {
+ ImplDestroyHelpWindow( true );
}
}
@@ -2323,25 +2323,25 @@ static void ImplHandleSalQueryCharPosition( vcl::Window *pWindow,
pChild = ImplGetKeyInputWindow( pWindow );
}
- if( pChild )
- {
- ImplCallCommand( pChild, CommandEventId::QueryCharPosition );
+ if( !pChild )
+ return;
- ImplWinData* pWinData = pChild->ImplGetWinData();
- if ( pWinData->mpCompositionCharRects && pEvt->mnCharPos < o3tl::make_unsigned( pWinData->mnCompositionCharRects ) )
- {
- const OutputDevice *pChildOutDev = pChild->GetOutDev();
- const tools::Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ];
- tools::Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect );
- Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) );
- pEvt->mnCursorBoundX = aAbsScreenPos.X();
- pEvt->mnCursorBoundY = aAbsScreenPos.Y();
- pEvt->mnCursorBoundWidth = aDeviceRect.GetWidth();
- pEvt->mnCursorBoundHeight = aDeviceRect.GetHeight();
- pEvt->mbVertical = pWinData->mbVertical;
- pEvt->mbValid = true;
- }
- }
+ ImplCallCommand( pChild, CommandEventId::QueryCharPosition );
+
+ ImplWinData* pWinData = pChild->ImplGetWinData();
+ if ( !(pWinData->mpCompositionCharRects && pEvt->mnCharPos < o3tl::make_unsigned( pWinData->mnCompositionCharRects )) )
+ return;
+
+ const OutputDevice *pChildOutDev = pChild->GetOutDev();
+ const tools::Rectangle& aRect = pWinData->mpCompositionCharRects[ pEvt->mnCharPos ];
+ tools::Rectangle aDeviceRect = pChildOutDev->ImplLogicToDevicePixel( aRect );
+ Point aAbsScreenPos = pChild->OutputToAbsoluteScreenPixel( pChild->ScreenToOutputPixel(aDeviceRect.TopLeft()) );
+ pEvt->mnCursorBoundX = aAbsScreenPos.X();
+ pEvt->mnCursorBoundY = aAbsScreenPos.Y();
+ pEvt->mnCursorBoundWidth = aDeviceRect.GetWidth();
+ pEvt->mnCursorBoundHeight = aDeviceRect.GetHeight();
+ pEvt->mbVertical = pWinData->mbVertical;
+ pEvt->mbValid = true;
}
bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pEvent )
diff --git a/vcl/source/window/wrkwin.cxx b/vcl/source/window/wrkwin.cxx
index 58d476d158f5..9f90025a74aa 100644
--- a/vcl/source/window/wrkwin.cxx
+++ b/vcl/source/window/wrkwin.cxx
@@ -140,21 +140,21 @@ void WorkWindow::ShowFullScreenMode( bool bFullScreenMode, sal_Int32 nDisplayScr
return;
mbFullScreenMode = bFullScreenMode;
- if ( !mbSysChild )
- {
- // Dispose of the canvas implementation, which might rely on
- // screen-specific system data.
- css::uno::Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
- if( xCanvas.is() )
- {
- css::uno::Reference< css::lang::XComponent > xCanvasComponent( xCanvas, css::uno::UNO_QUERY );
- if( xCanvasComponent.is() )
- xCanvasComponent->dispose();
- }
+ if ( mbSysChild )
+ return;
- mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = true;
- ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplayScreen );
+ // Dispose of the canvas implementation, which might rely on
+ // screen-specific system data.
+ css::uno::Reference< css::rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+ if( xCanvas.is() )
+ {
+ css::uno::Reference< css::lang::XComponent > xCanvasComponent( xCanvas, css::uno::UNO_QUERY );
+ if( xCanvasComponent.is() )
+ xCanvasComponent->dispose();
}
+
+ mpWindowImpl->mpFrameWindow->mpWindowImpl->mbWaitSystemResize = true;
+ ImplGetFrame()->ShowFullScreen( bFullScreenMode, nDisplayScreen );
}
void WorkWindow::StartPresentationMode( PresentationFlags nFlags )