[Libreoffice-commits] core.git: vcl/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 3 23:41:53 UTC 2020
vcl/source/window/NotebookBarAddonsMerger.cxx | 55 +-
vcl/source/window/brdwin.cxx | 50 +-
vcl/source/window/builder.cxx | 18
vcl/source/window/clipping.cxx | 54 +-
vcl/source/window/cursor.cxx | 149 +++----
vcl/source/window/dockingarea.cxx | 142 +++---
vcl/source/window/dockmgr.cxx | 332 +++++++--------
vcl/source/window/dockwin.cxx | 388 +++++++++---------
vcl/source/window/event.cxx | 20
vcl/source/window/floatwin.cxx | 32 -
vcl/source/window/layout.cxx | 240 +++++------
vcl/source/window/menu.cxx | 218 +++++-----
vcl/source/window/menubarwindow.cxx | 196 ++++-----
vcl/source/window/menufloatingwindow.cxx | 226 +++++-----
vcl/source/window/mouse.cxx | 71 +--
vcl/source/window/paint.cxx | 114 ++---
vcl/source/window/printdlg.cxx | 152 +++----
vcl/source/window/scrwnd.cxx | 28 -
vcl/source/window/seleng.cxx | 30 -
vcl/source/window/split.cxx | 28 -
vcl/source/window/splitwin.cxx | 136 +++---
vcl/source/window/stacking.cxx | 252 ++++++------
vcl/source/window/status.cxx | 232 +++++------
vcl/source/window/syswin.cxx | 102 ++--
vcl/source/window/tabpage.cxx | 30 -
vcl/source/window/taskpanelist.cxx | 54 +-
vcl/source/window/toolbox.cxx | 218 +++++-----
vcl/source/window/toolbox2.cxx | 545 ++++++++++++--------------
vcl/source/window/window.cxx | 422 ++++++++++----------
vcl/source/window/window2.cxx | 100 ++--
vcl/source/window/winproc.cxx | 84 ++--
vcl/source/window/wrkwin.cxx | 26 -
32 files changed, 2372 insertions(+), 2372 deletions(-)
New commits:
commit ce47b1a9c68a27fc37594148f6be2661f27120ea
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 4 00:04:11 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 4 01:41:02 2020 +0200
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 at collabora.co.uk>
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 );
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list