LibreOffice Module vcl (master) 1
menubarwindow.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "menubarwindow.hxx"
21#include "menuitemlist.hxx"
23
24#include <vcl/dockingarea.hxx>
25#include <vcl/settings.hxx>
26#include <vcl/taskpanelist.hxx>
27#include <sal/log.hxx>
28
29#include <salframe.hxx>
30#include <salmenu.hxx>
31#include <svdata.hxx>
32#include <strings.hrc>
33#include <bitmaps.hlst>
34#include <window.h>
35#include "bufferdevice.hxx"
36
37// document closing button
38#define IID_DOCUMENTCLOSE 1
39
41 ToolBox( pParent, 0 ),
42 lastSize(-1)
43{
45}
46
48{
49 Window::DataChanged( rDCEvt );
50
51 if ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )
52 {
55 SetImages( 0, true);
56 }
57}
58
60{
62 if( GetItemCount() == 0 )
63 {
64 aTbx->InsertItem(ToolBoxItemId(IID_DOCUMENTCLOSE), Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC));
65 }
66 else
67 {
68 ImplToolItems::size_type nItems = GetItemCount();
69 for( ImplToolItems::size_type i = 0; i < nItems; i++ )
70 {
72 aTbx->InsertItem( nId, GetItemImage( nId ) );
73 }
74 }
75 maMinSize = aTbx->CalcWindowSizePixel();
76
77 aTbx.disposeAndClear();
78}
79
80void DecoToolBox::SetImages( tools::Long nMaxHeight, bool bForce )
81{
83
84 if( !nMaxHeight && lastSize != -1 )
85 nMaxHeight = lastSize + border; // don't change anything if called with 0
86
87 if( nMaxHeight < getMinSize().Height() )
88 nMaxHeight = getMinSize().Height();
89
90 if( (lastSize == nMaxHeight - border) && !bForce )
91 return;
92
93 lastSize = nMaxHeight - border;
94
95 Color aEraseColor( ColorTransparency, 255, 255, 255, 255 );
96 BitmapEx aBmpExDst( maImage.GetBitmapEx() );
97 BitmapEx aBmpExSrc( aBmpExDst );
98
99 aEraseColor.SetAlpha( 0 );
100 aBmpExDst.Erase( aEraseColor );
101 aBmpExDst.Scale( Size( lastSize, lastSize ) );
102
103 tools::Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() );
107
108 aBmpExDst.CopyPixel( aDestRect, aSrcRect, &aBmpExSrc );
110
111}
112
114 Window( pParent, 0 ),
115 m_aCloseBtn(VclPtr<DecoToolBox>::Create(this)),
118{
120 m_pMenu = nullptr;
121 m_pActivePopup = nullptr;
124 mbAutoPopup = true;
125 m_bIgnoreFirstMove = true;
126
127 m_aCloseBtn->maImage = Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC);
128
132
134 m_aCloseBtn->SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
135 m_aCloseBtn->AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
137
139 m_aFloatBtn->SetQuickHelpText(VclResId(SV_HELPTEXT_RESTORE));
140
142 m_aHideBtn->SetQuickHelpText(VclResId(SV_HELPTEXT_MINIMIZE));
143
145
146 AddEventListener(LINK(this, MenuBarWindow, ShowHideListener));
147}
148
150{
151 disposeOnce();
152}
153
155{
156 m_aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
157 RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener));
158
163 m_pMenu.clear();
166
167 Window::dispose();
168}
169
171{
172 if (pMenu == m_pMenu)
173 return;
174 m_pMenu = pMenu;
175
178
179 if (!pMenu)
180 {
182 return;
183 }
184 SalMenu* pSalMenu = pMenu->ImplGetSalMenu();
185 const bool bHasNativeMenuBar = pSalMenu && pSalMenu->HasNativeMenuBar();
186
187 // no menubar window drawing needed in case of a native menu bar
188 SetPaintTransparent(bHasNativeMenuBar);
189 m_aCloseBtn->ShowItem(ToolBoxItemId(IID_DOCUMENTCLOSE), !bHasNativeMenuBar && pMenu->HasCloseButton());
190 m_aCloseBtn->Show(!bHasNativeMenuBar && (pMenu->HasCloseButton() || !m_aAddButtons.empty()));
191 m_aFloatBtn->Show(!bHasNativeMenuBar && pMenu->HasFloatButton());
192 m_aHideBtn->Show(!bHasNativeMenuBar && pMenu->HasHideButton());
193
194 // connect native popup menu / menubar and show it
195 if (pSalMenu)
196 {
197 SalFrame* pFrame = ImplGetFrame();
198 assert(pFrame);
199 if (bHasNativeMenuBar)
200 pFrame->SetMenu(pSalMenu);
201 pSalMenu->SetFrame(pFrame);
202 if (bHasNativeMenuBar)
203 pSalMenu->ShowMenuBar(true);
204 }
205
207}
208
209void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide )
210{
212 m_aCloseBtn->Show(bClose || !m_aAddButtons.empty());
213 if (m_pMenu->mpSalMenu)
214 m_pMenu->mpSalMenu->ShowCloseButton(bClose);
215 m_aFloatBtn->Show( bFloat );
216 m_aHideBtn->Show( bHide );
217 Resize();
218}
219
221{
222 return m_aCloseBtn->getMinSize();
223}
224
226{
227 if( ! m_pMenu )
228 return;
229
230 if( m_aCloseBtn->GetCurItemId() == ToolBoxItemId(IID_DOCUMENTCLOSE) )
231 {
232 // #i106052# call close hdl asynchronously to ease handler implementation
233 // this avoids still being in the handler while the DecoToolBox already
234 // gets destroyed
235 Application::PostUserEvent(static_cast<MenuBar*>(m_pMenu.get())->GetCloseButtonClickHdl());
236 }
237 else
238 {
239 std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(sal_uInt16(m_aCloseBtn->GetCurItemId()));
240 if( it != m_aAddButtons.end() )
241 {
243 aArg.nId = it->first;
244 aArg.bHighlight = (sal_uInt16(m_aCloseBtn->GetHighlightItemId()) == it->first);
245 it->second.m_aSelectLink.Call( aArg );
246 }
247 }
248}
249
250IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void )
251{
252 if( ! m_pMenu )
253 return;
254
256 aArg.nId = 0xffff;
257 aArg.bHighlight = (rEvent.GetId() == VclEventId::ToolboxHighlight);
258 if( rEvent.GetId() == VclEventId::ToolboxHighlight )
259 aArg.nId =sal_uInt16(m_aCloseBtn->GetHighlightItemId());
260 else if( rEvent.GetId() == VclEventId::ToolboxHighlightOff )
261 {
262 auto nPos = static_cast<ToolBox::ImplToolItems::size_type>(reinterpret_cast<sal_IntPtr>(rEvent.GetData()));
263 aArg.nId = sal_uInt16(m_aCloseBtn->GetItemId(nPos));
264 }
265 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId );
266 if( it != m_aAddButtons.end() )
267 {
268 it->second.m_aHighlightLink.Call( aArg );
269 }
270}
271
272IMPL_LINK( MenuBarWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
273{
274 if( ! m_pMenu )
275 return;
276
277 if( rEvent.GetId() == VclEventId::WindowShow )
278 m_pMenu->ImplCallEventListeners( VclEventId::MenuShow, ITEMPOS_INVALID );
279 else if( rEvent.GetId() == VclEventId::WindowHide )
280 m_pMenu->ImplCallEventListeners( VclEventId::MenuHide, ITEMPOS_INVALID );
281}
282
283void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst )
284{
286 if ( !pItemData )
287 return;
288
289 m_bIgnoreFirstMove = true;
290 if ( m_pActivePopup && ( m_pActivePopup != pItemData->pSubMenu ) )
291 {
293 }
294 if ( !(pItemData->bEnabled && pItemData->pSubMenu && ( m_nHighlightedItem != ITEMPOS_INVALID ) &&
295 ( pItemData->pSubMenu != m_pActivePopup )) )
296 return;
297
298 m_pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
299 tools::Long nX = 0;
300 MenuItemData* pData = nullptr;
301 for ( sal_uLong n = 0; n < m_nHighlightedItem; n++ )
302 {
304 nX += pData->aSz.Width();
305 }
306 pData = m_pMenu->pItemList->GetDataFromPos( m_nHighlightedItem );
307 Point aItemTopLeft( nX, 0 );
308 Point aItemBottomRight( aItemTopLeft );
309 aItemBottomRight.AdjustX(pData->aSz.Width() );
310
311 if (pData->bHiddenOnGUI)
312 {
316
317 for (sal_uInt16 i = m_nHighlightedItem; i < m_pMenu->GetItemCount(); ++i)
318 {
319 sal_uInt16 nId = m_pMenu->GetItemId(i);
320
321 MenuItemData* pParentItemData = m_pMenu->GetItemList()->GetData(nId);
322 assert(pParentItemData);
323 mpParentPopup->InsertItem(nId, pParentItemData->aText, pParentItemData->nBits, pParentItemData->sIdent);
324 mpParentPopup->SetHelpId(nId, pParentItemData->aHelpId);
325 mpParentPopup->SetHelpText(nId, pParentItemData->aHelpText);
326 mpParentPopup->SetAccelKey(nId, pParentItemData->aAccelKey);
327 mpParentPopup->SetItemCommand(nId, pParentItemData->aCommandStr);
329
330 PopupMenu* pPopup = m_pMenu->GetPopupMenu(nId);
332 }
333 }
334 // the menu bar could have height 0 in fullscreen mode:
335 // so do not use always WindowHeight, as ItemHeight < WindowHeight.
336 if ( GetSizePixel().Height() )
337 {
338 // #107747# give menuitems the height of the menubar
339 aItemBottomRight.AdjustY(GetOutputSizePixel().Height()-1 );
340 }
341
342 // ImplExecute is not modal...
343 // #99071# do not grab the focus, otherwise it will be restored to the menubar
344 // when the frame is reactivated later
345 //GrabFocus();
346 m_pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Down | FloatWinPopupFlags::NoHorzPlacement, m_pMenu, bPreSelectFirst );
347 // does not have a window, if aborted before or if there are no entries
350 else
351 m_pActivePopup = nullptr;
352}
353
355{
356 if ( !m_pActivePopup )
357 return;
358
360 if( static_cast<FloatingWindow *>(m_pActivePopup->pWindow.get())->IsInCleanUp() )
361 return; // kill it later
362
365
369 // check for pActivePopup, if stopped by deactivate...
371 {
372 if (mpParentPopup)
373 {
374 for (sal_uInt16 i = 0; i < mpParentPopup->GetItemCount(); ++i)
375 {
376 sal_uInt16 nId = mpParentPopup->GetItemId(i);
377 MenuItemData* pParentItemData = mpParentPopup->GetItemList()->GetData(nId);
378 assert(pParentItemData);
379 pParentItemData->pSubMenu = nullptr;
380 }
381 }
385 }
386 m_pActivePopup = nullptr;
387}
388
389void MenuBarWindow::PopupClosed( Menu const * pPopup )
390{
391 if ( pPopup == m_pActivePopup )
392 {
395 }
396}
397
399{
400 mbAutoPopup = true;
401 sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
402 if ( ( nEntry != ITEMPOS_INVALID ) && !m_pActivePopup )
403 {
404 ChangeHighlightItem( nEntry, false );
405 }
406 else
407 {
410 }
411}
412
414{
415}
416
418{
419 if ( rMEvt.IsSynthetic() || rMEvt.IsEnterWindow() )
420 return;
421
422 if ( rMEvt.IsLeaveWindow() )
423 {
425 Invalidate(); //HighlightItem( nRolloveredItem, false );
426
428 return;
429 }
430
431 sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
433 {
434 if ( m_nRolloveredItem != nEntry )
435 {
437 Invalidate(); //HighlightItem( nRolloveredItem, false );
438
439 m_nRolloveredItem = nEntry;
440 Invalidate(); //HighlightItem( nRolloveredItem, true );
441 }
442 return;
443 }
444 m_nRolloveredItem = nEntry;
445
447 {
448 m_bIgnoreFirstMove = false;
449 return;
450 }
451
452 if ( ( nEntry != ITEMPOS_INVALID )
453 && ( nEntry != m_nHighlightedItem ) )
454 ChangeHighlightItem( nEntry, false );
455}
456
457void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool bAllowRestoreFocus, bool bDefaultToDocument)
458{
459 if( ! m_pMenu )
460 return;
461
462 // #57934# close active popup if applicable, as TH's background storage works.
463 MenuItemData* pNextData = m_pMenu->pItemList->GetDataFromPos( n );
464 if ( m_pActivePopup && m_pActivePopup->ImplGetWindow() && ( !pNextData || ( m_pActivePopup != pNextData->pSubMenu ) ) )
465 KillActivePopup(); // pActivePopup when applicable without pWin, if Rescheduled in Activate()
466
467 // activate menubar only ones per cycle...
468 bool bJustActivated = false;
470 {
472 // #105406# avoid saving the focus when we already have the focus
473 bool bNoSaveFocus = (this == ImplGetSVData()->mpWinData->mpFocusWin.get());
474
475 if( m_xSaveFocusId != nullptr )
476 {
478 {
479 m_xSaveFocusId = nullptr;
480 if( !bNoSaveFocus )
481 m_xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated
482 }
483 else {
484 ; // do nothing: we 're activated again from taskpanelist, focus was already saved
485 }
486 }
487 else
488 {
489 if( !bNoSaveFocus )
490 m_xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated
491 }
492 m_pMenu->bInCallback = true; // set here if Activate overridden
493 m_pMenu->Activate();
494 m_pMenu->bInCallback = false;
495 bJustActivated = true;
496 }
497 else if ( ( m_nHighlightedItem != ITEMPOS_INVALID ) && ( n == ITEMPOS_INVALID ) )
498 {
499 m_pMenu->bInCallback = true;
501 m_pMenu->bInCallback = false;
503 if (!ImplGetSVData()->mpWinData->mbNoSaveFocus)
504 {
505 VclPtr<vcl::Window> xTempFocusId;
507 xTempFocusId = m_xSaveFocusId;
508 m_xSaveFocusId = nullptr;
509
510 if (bAllowRestoreFocus)
511 {
512 // tdf#115227 the popup is already killed, so temporarily set us as the
513 // focus window, so we could avoid sending superfluous activate events
514 // to top window listeners.
515 if (xTempFocusId || bDefaultToDocument)
517
518 // #105406# restore focus to document if we could not save focus before
519 if (!xTempFocusId && bDefaultToDocument)
521 else
522 Window::EndSaveFocus(xTempFocusId);
523 }
524 }
525 }
526
528 {
530 Invalidate(); //HighlightItem( nHighlightedItem, false );
531
533 }
534
536 SAL_WARN_IF( ( m_nHighlightedItem != ITEMPOS_INVALID ) && !m_pMenu->ImplIsVisible( m_nHighlightedItem ), "vcl", "ChangeHighlightItem: Not visible!" );
538 Invalidate(); //HighlightItem( nHighlightedItem, true );
540 Invalidate(); //HighlightItem( nRolloveredItem, true );
542
543 if( mbAutoPopup )
544 ImplCreatePopup( bSelectEntry );
545
546 // #58935# #73659# Focus, if no popup underneath...
547 if ( bJustActivated && !m_pActivePopup )
548 GrabFocus();
549}
550
551static int ImplGetTopDockingAreaHeight( vcl::Window const *pWindow )
552{
553 // find docking area that is top aligned and return its height
554 // note: dockingareas are direct children of the SystemWindow
555 if( pWindow->ImplGetFrameWindow() )
556 {
557 vcl::Window *pWin = pWindow->ImplGetFrameWindow()->GetWindow( GetWindowType::FirstChild ); //mpWindowImpl->mpFirstChild;
558 while( pWin )
559 {
560 if( pWin->IsSystemWindow() )
561 {
562 vcl::Window *pChildWin = pWin->GetWindow( GetWindowType::FirstChild ); //mpWindowImpl->mpFirstChild;
563 while( pChildWin )
564 {
565 DockingAreaWindow *pDockingArea = nullptr;
566 if ( pChildWin->GetType() == WindowType::DOCKINGAREA )
567 pDockingArea = static_cast< DockingAreaWindow* >( pChildWin );
568
569 if( pDockingArea && pDockingArea->GetAlign() == WindowAlign::Top &&
570 pDockingArea->IsVisible() && pDockingArea->GetOutputSizePixel().Height() != 0 )
571 {
572 return pDockingArea->GetOutputSizePixel().Height();
573 }
574
575 pChildWin = pChildWin->GetWindow( GetWindowType::Next ); //mpWindowImpl->mpNext;
576 }
577
578 }
579
580 pWin = pWin->GetWindow( GetWindowType::Next ); //mpWindowImpl->mpNext;
581 }
582 }
583 return 0;
584}
585
586static void ImplAddNWFSeparator(vcl::RenderContext& rRenderContext, const Size& rSize, const MenubarValue& rMenubarValue)
587{
588 // add a separator if
589 // - we have an adjacent docking area
590 // - and if toolbars would draw them as well (mbDockingAreaSeparateTB must not be set, see dockingarea.cxx)
591 if (rMenubarValue.maTopDockingAreaHeight
592 && !ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB
593 && !ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames)
594 {
595 // note: the menubar only provides the upper (dark) half of it, the rest (bright part) is drawn by the docking area
596
597 rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
598 tools::Rectangle aRect(Point(), rSize);
599 rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
600 }
601}
602
603void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos)
604{
605 if (!m_pMenu)
606 return;
607
608 tools::Long nX = 0;
609 size_t nCount = m_pMenu->pItemList->size();
610
611 Size aOutputSize = GetOutputSizePixel();
612 aOutputSize.AdjustWidth( -(m_aCloseBtn->GetSizePixel().Width()) );
613
614 for (size_t n = 0; n < nCount; n++)
615 {
616 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
617 if (n == nPos)
618 {
619 if (pData->eType != MenuItemType::SEPARATOR)
620 {
621 // #107747# give menuitems the height of the menubar
622 tools::Rectangle aRect(Point(nX, 1), Size(pData->aSz.Width(), aOutputSize.Height() - 2));
623 rRenderContext.Push(vcl::PushFlags::CLIPREGION);
624 rRenderContext.IntersectClipRegion(aRect);
625 bool bRollover, bHighlight;
626 if (!ImplGetSVData()->maNWFData.mbRolloverMenubar)
627 {
628 bHighlight = true;
629 bRollover = nPos != m_nHighlightedItem;
630 }
631 else
632 {
633 bRollover = nPos == m_nRolloveredItem;
634 bHighlight = nPos == m_nHighlightedItem;
635 }
638 {
639 // draw background (transparency)
640 MenubarValue aControlValue;
642
643 if (!Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
644 Erase(rRenderContext);
645 else
646 {
647 tools::Rectangle aBgRegion(Point(), aOutputSize);
649 ControlState::ENABLED, aControlValue, OUString());
650 }
651
652 ImplAddNWFSeparator(rRenderContext, aOutputSize, aControlValue);
653
654 // draw selected item
656 if (bRollover)
658 else
661 aRect, nState, aControlValue, OUString() );
662 }
663 else
664 {
665 if (bRollover)
666 rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuBarRolloverColor());
667 else
668 rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
669 rRenderContext.SetLineColor();
670 rRenderContext.DrawRect(aRect);
671 }
672 rRenderContext.Pop();
673
674 m_pMenu->ImplPaint(rRenderContext, aOutputSize, 0, 0, pData, bHighlight, false, bRollover);
675 }
676 return;
677 }
678
679 nX += pData->aSz.Width();
680 }
681}
682
684{
685 tools::Rectangle aRect;
686 if( m_pMenu )
687 {
688 tools::Long nX = 0;
689 size_t nCount = m_pMenu->pItemList->size();
690 for ( size_t n = 0; n < nCount; n++ )
691 {
692 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
693 if ( n == nPos )
694 {
695 if ( pData->eType != MenuItemType::SEPARATOR )
696 // #107747# give menuitems the height of the menubar
697 aRect = tools::Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) );
698 break;
699 }
700
701 nX += pData->aSz.Width();
702 }
703 }
704 return aRect;
705}
706
707void MenuBarWindow::KeyInput( const KeyEvent& rKEvent )
708{
709 if ( !HandleKeyEvent( rKEvent ) )
710 Window::KeyInput( rKEvent );
711}
712
713bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
714{
715 if (!m_pMenu)
716 return false;
717
718 if (m_pMenu->bInCallback)
719 return true; // swallow
720
721 bool bDone = false;
722 sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
723
724 if( GetParent() )
725 {
727 {
728 SystemWindow *pSysWin = static_cast<SystemWindow*>(GetParent()->GetWindow( GetWindowType::Client ));
729 if( pSysWin->GetTaskPaneList() )
730 if( pSysWin->GetTaskPaneList()->HandleKeyEvent( rKEvent ) )
731 return true;
732 }
733 }
734
735 // no key events if native menus
737 return false;
738
739 if ( nCode == KEY_MENU && !rKEvent.GetKeyCode().IsShift() ) // only F10, not Shift-F10
740 {
741 mbAutoPopup = false;
743 {
744 ChangeHighlightItem( 0, false );
745 GrabFocus();
746 }
747 else
748 {
750 m_xSaveFocusId = nullptr;
751 }
752 bDone = true;
753 }
754 else if ( bFromMenu )
755 {
756 if ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ||
757 ( nCode == KEY_HOME ) || ( nCode == KEY_END ) )
758 {
759 sal_uInt16 n = m_nHighlightedItem;
760 if ( n == ITEMPOS_INVALID )
761 {
762 if ( nCode == KEY_LEFT)
763 n = 0;
764 else
765 n = m_pMenu->GetItemCount()-1;
766 }
767
768 sal_uInt16 nLoop = n;
769
770 if( nCode == KEY_HOME )
771 { n = sal_uInt16(-1); nLoop = n+1; }
772 if( nCode == KEY_END )
773 { n = m_pMenu->GetItemCount(); nLoop = n-1; }
774
775 do
776 {
777 if ( nCode == KEY_LEFT || nCode == KEY_END )
778 {
779 if ( n )
780 n--;
781 else
782 n = m_pMenu->GetItemCount()-1;
783 }
784 if ( nCode == KEY_RIGHT || nCode == KEY_HOME )
785 {
786 n++;
787 if ( n >= m_pMenu->GetItemCount() )
788 n = 0;
789 }
790
792 if (pData->eType != MenuItemType::SEPARATOR &&
795 {
796 ChangeHighlightItem( n, true );
797 break;
798 }
799 } while ( n != nLoop );
800 bDone = true;
801 }
802 else if ( nCode == KEY_RETURN )
803 {
805 else
806 if ( !mbAutoPopup )
807 {
808 ImplCreatePopup( true );
809 mbAutoPopup = true;
810 }
811 bDone = true;
812 }
813 else if ( ( nCode == KEY_UP ) || ( nCode == KEY_DOWN ) )
814 {
815 if ( !mbAutoPopup )
816 {
817 ImplCreatePopup( true );
818 mbAutoPopup = true;
819 }
820 bDone = true;
821 }
822 else if ( nCode == KEY_ESCAPE || ( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() ) )
823 {
824 if( m_pActivePopup )
825 {
826 // hide the menu and remove the focus...
827 mbAutoPopup = false;
829 }
830
832
833 if( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() )
834 {
835 // put focus into document
837 }
838
839 bDone = true;
840 }
841 }
842
843 if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsMod2() ) )
844 {
845 sal_Unicode nCharCode = rKEvent.GetCharCode();
846 if ( nCharCode )
847 {
848 size_t nEntry, nDuplicates;
849 MenuItemData* pData = m_pMenu->GetItemList()->SearchItem( nCharCode, rKEvent.GetKeyCode(), nEntry, nDuplicates, m_nHighlightedItem );
850 if ( pData && (nEntry != ITEMPOS_INVALID) )
851 {
852 mbAutoPopup = true;
853 ChangeHighlightItem( nEntry, true );
854 bDone = true;
855 }
856 }
857 }
858
859 return bDone;
860}
861
863{
864 if (!m_pMenu)
865 return;
866
867 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
868
869 Size aOutputSize = GetOutputSizePixel();
870
871 // no VCL paint if native menus
873 return;
874
875 // Make sure that all actual rendering happens in one go to avoid flicker.
876 vcl::BufferDevice pBuffer(this, rRenderContext);
877
879 {
880 MenubarValue aMenubarValue;
882
883 if (!rStyleSettings.GetPersonaHeader().IsEmpty())
884 Erase(*pBuffer);
885 else
886 {
887 tools::Rectangle aCtrlRegion( Point(), aOutputSize );
888
890 ControlState::ENABLED, aMenubarValue, OUString());
891 }
892
893 ImplAddNWFSeparator(*pBuffer, aOutputSize, aMenubarValue);
894 }
895
896 // shrink the area of the buttons
897 aOutputSize.AdjustWidth( -(m_aCloseBtn->GetSizePixel().Width()) );
898
899 pBuffer->SetFillColor(rStyleSettings.GetMenuColor());
900 m_pMenu->ImplPaint(*pBuffer, aOutputSize, 0);
901
906
907 // in high contrast mode draw a separating line on the lower edge
909 rStyleSettings.GetHighContrastMode())
910 {
912 pBuffer->SetLineColor(COL_WHITE);
913 pBuffer->SetMapMode(MapMode(MapUnit::MapPixel));
914 Size aSize = GetSizePixel();
915 pBuffer->DrawLine(Point(0, aSize.Height() - 1),
916 Point(aSize.Width() - 1, aSize.Height() - 1));
917 pBuffer->Pop();
918 }
919}
920
922{
923 Size aOutSz = GetOutputSizePixel();
924 tools::Long n = aOutSz.Height()-4;
925 tools::Long nX = aOutSz.Width()-3;
926 tools::Long nY = 2;
927
928 if ( m_aCloseBtn->IsVisible() )
929 {
930 m_aCloseBtn->Hide();
932 Size aTbxSize( m_aCloseBtn->CalcWindowSizePixel() );
933 nX -= aTbxSize.Width();
934 tools::Long nTbxY = (aOutSz.Height() - aTbxSize.Height())/2;
935 m_aCloseBtn->setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
936 nX -= 3;
937 m_aCloseBtn->Show();
938 }
939 if ( m_aFloatBtn->IsVisible() )
940 {
941 nX -= n;
942 m_aFloatBtn->setPosSizePixel( nX, nY, n, n );
943 }
944 if ( m_aHideBtn->IsVisible() )
945 {
946 nX -= n;
947 m_aHideBtn->setPosSizePixel( nX, nY, n, n );
948 }
949
952
953 Invalidate();
954}
955
956sal_uInt16 MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const
957{
958 if( m_pMenu )
959 {
960 tools::Long nX = 0;
961 size_t nCount = m_pMenu->pItemList->size();
962 for ( size_t n = 0; n < nCount; n++ )
963 {
964 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
965 if ( m_pMenu->ImplIsVisible( n ) )
966 {
967 nX += pData->aSz.Width();
968 if ( nX > rMousePos.X() )
969 return static_cast<sal_uInt16>(n);
970 }
971 }
972 }
973 return ITEMPOS_INVALID;
974}
975
977{
978 sal_uInt16 nId = m_nHighlightedItem;
979 if ( rHEvt.GetMode() & HelpEventMode::CONTEXT )
981
983 if( !ImplHandleHelpEvent( this, m_pMenu, nId, rHEvt, aHighlightRect ) )
984 Window::RequestHelp( rHEvt );
985}
986
988{
989 Window::StateChanged( nType );
990
993 {
995 Invalidate();
996 }
998 {
999 Invalidate();
1000 }
1001 else if(m_pMenu)
1002 {
1004 }
1005}
1006
1008{
1009 if (!m_pMenu)
1010 return;
1011
1013
1014 // depending on the native implementation or the displayable flag
1015 // the menubar windows is suppressed (ie, height=0)
1016 tools::Long nHeight = 0;
1017 const bool bHasNativeMenuBar = m_pMenu->GetNativeMenuBar();
1018 if (bHasNativeMenuBar)
1019 nHeight = m_pMenu->ImplGetSalMenu()->GetMenuBarHeight();
1020 else if (static_cast<MenuBar*>(m_pMenu.get())->IsDisplayable())
1021 nHeight = m_pMenu->ImplCalcSize(this).Height();
1022
1023 setPosSizePixel(0, 0, 0, nHeight, PosSizeFlags::Height);
1024 GetParent()->Resize();
1025
1026 if (!bHasNativeMenuBar)
1027 {
1028 Invalidate();
1029 Resize();
1031 }
1032}
1033
1035{
1036 Window::ApplySettings(rRenderContext);
1037 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
1038
1039 SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
1040
1042 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->ImplGetSalMenu() : nullptr;
1043 if (pNativeMenu)
1044 pNativeMenu->ApplyPersona();
1045 if (!rPersonaBitmap.IsEmpty())
1046 {
1047 Wallpaper aWallpaper(rPersonaBitmap);
1049 aWallpaper.SetColor(Application::GetSettings().GetStyleSettings().GetWorkspaceColor());
1050
1051 rRenderContext.SetBackground(aWallpaper);
1052 SetPaintTransparent(false);
1054 }
1056 {
1057 rRenderContext.SetBackground(); // background will be drawn by NWF
1058 }
1059 else
1060 {
1061 Wallpaper aWallpaper;
1063 rRenderContext.SetBackground(aWallpaper);
1064 SetPaintTransparent(false);
1066 }
1067
1068 rRenderContext.SetTextColor(rStyleSettings.GetMenuBarTextColor());
1069 rRenderContext.SetTextFillColor();
1070 rRenderContext.SetLineColor();
1071}
1072
1074{
1077 return;
1078
1079 AllSettings aSettings(GetSettings());
1080 ImplGetFrame()->UpdateSettings(aSettings); // to update persona
1081 StyleSettings aStyle(aSettings.GetStyleSettings());
1083 if (aHighlightTextColor != COL_TRANSPARENT)
1084 {
1085 aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
1086 }
1087 aSettings.SetStyleSettings(aStyle);
1088 GetOutDev()->SetSettings(aSettings);
1089}
1090
1092{
1093 Window::DataChanged( rDCEvt );
1094
1095 if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1097 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1098 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1099 {
1102 LayoutChanged();
1103 }
1104}
1105
1107{
1108 if ( !HasChildPathFocus( true ) )
1109 ChangeHighlightItem( ITEMPOS_INVALID, false, false );
1110}
1111
1113{
1114 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->ImplGetSalMenu() : nullptr;
1115 if (pNativeMenu && pNativeMenu->TakeFocus())
1116 return;
1117
1119 {
1120 mbAutoPopup = false; // do not open menu when activated by focus handling like taskpane cycling
1121 ChangeHighlightItem( 0, false );
1122 }
1123}
1124
1125css::uno::Reference<css::accessibility::XAccessible> MenuBarWindow::CreateAccessible()
1126{
1127 css::uno::Reference<css::accessibility::XAccessible> xAcc;
1128
1129 if (m_pMenu)
1130 xAcc = m_pMenu->GetAccessible();
1131
1132 return xAcc;
1133}
1134
1135sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip )
1136{
1137 // find first free button id
1138 sal_uInt16 nId = IID_DOCUMENTCLOSE;
1139 std::map< sal_uInt16, AddButtonEntry >::const_iterator it;
1140 do
1141 {
1142 nId++;
1143 it = m_aAddButtons.find( nId );
1144 } while( it != m_aAddButtons.end() && nId < 128 );
1145 SAL_WARN_IF( nId >= 128, "vcl", "too many addbuttons in menubar" );
1146 AddButtonEntry& rNewEntry = m_aAddButtons[nId];
1147 rNewEntry.m_aSelectLink = i_rLink;
1151 LayoutChanged();
1152
1153 if( m_pMenu->mpSalMenu )
1154 m_pMenu->mpSalMenu->AddMenuBarButton( SalMenuButtonItem( nId, i_rImage, i_rToolTip ) );
1155
1156 return nId;
1157}
1158
1160{
1161 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( nId );
1162 if( it != m_aAddButtons.end() )
1163 it->second.m_aHighlightLink = rLink;
1164}
1165
1167{
1168 tools::Rectangle aRect;
1169 if( m_aAddButtons.find( nId ) != m_aAddButtons.end() )
1170 {
1171 if( m_pMenu->mpSalMenu )
1172 {
1173 aRect = m_pMenu->mpSalMenu->GetMenuBarButtonRectPixel( nId, ImplGetWindowImpl()->mpFrame );
1174 if( aRect == tools::Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) )
1175 {
1176 // system menu button is somewhere but location cannot be determined
1177 return tools::Rectangle();
1178 }
1179 }
1180
1181 if( aRect.IsEmpty() )
1182 {
1185 aRect.Move( aOffset.X(), aOffset.Y() );
1186 }
1187 }
1188 return aRect;
1189}
1190
1192{
1193 ToolBox::ImplToolItems::size_type nPos = m_aCloseBtn->GetItemPos(ToolBoxItemId(nId));
1195 m_aAddButtons.erase( nId );
1197 LayoutChanged();
1198
1199 if( m_pMenu->mpSalMenu )
1200 m_pMenu->mpSalMenu->RemoveMenuBarButton( nId );
1201}
1202
1203bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId )
1204{
1205 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( i_nButtonId );
1206 if( it != m_aAddButtons.end() )
1207 {
1209 aArg.nId = it->first;
1210 aArg.bHighlight = true;
1211 return it->second.m_aSelectLink.Call( aArg );
1212 }
1213 return false;
1214}
1215
1217{
1218 /* #i83908# do not use the menubar if it is native or invisible
1219 this relies on MenuBar::ImplCreate setting the height of the menubar
1220 to 0 in this case
1221 */
1222 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->GetNativeMenuBar() : nullptr;
1223 if (pNativeMenu)
1224 return pNativeMenu->CanGetFocus();
1225 return GetSizePixel().Height() > 0;
1226}
1227
1228/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:761
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Post a user event to the default window.
Definition: svapp.cxx:1122
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
Definition: BitmapEx.cxx:296
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: BitmapEx.cxx:452
bool CopyPixel(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const BitmapEx *pBmpExSrc)
Copy a rectangular area from another bitmap.
Definition: BitmapEx.cxx:400
bool IsEmpty() const
Definition: BitmapEx.cxx:177
void SetAlpha(sal_uInt8 nAlpha)
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
Toolbox that holds the close button (right hand side of the menubar).
void DataChanged(const DataChangedEvent &rDCEvt) override
tools::Long lastSize
const Size & getMinSize() const
void calcMinSize()
DecoToolBox(vcl::Window *pParent)
void SetImages(tools::Long nMaxHeight, bool bForce=false)
Size GetSizePixel() const override
Definition: dockwin.cxx:866
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
Definition: dockwin.cxx:822
void AddPopupModeWindow(vcl::Window *pWindow)
Definition: floatwin.cxx:954
bool IsInCleanUp() const
Definition: floatwin.hxx:131
HelpEventMode GetMode() const
Definition: event.hxx:208
Definition: image.hxx:40
BitmapEx GetBitmapEx() const
Definition: Image.cxx:94
Size GetSizePixel() const
Definition: Image.cxx:86
sal_Unicode GetCharCode() const
Definition: event.hxx:56
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
Class that implements the actual window of the menu bar.
void HighlightItem(vcl::RenderContext &rRenderContext, sal_uInt16 nPos)
VclPtr< vcl::Window > m_xSaveFocusId
VclPtr< PopupMenu > mpParentPopup
void ChangeHighlightItem(sal_uInt16 n, bool bSelectPopupEntry, bool bAllowRestoreFocus=true, bool bDefaultToDocument=true)
void RemoveMenuBarButton(sal_uInt16 nId)
void PopupClosed(Menu const *pMenu)
bool HandleMenuButtonEvent(sal_uInt16 i_nButtonId)
void ImplCreatePopup(bool bPreSelectFirst)
void GetFocus() override
sal_uInt16 AddMenuBarButton(const Image &, const Link< MenuBarButtonCallbackArg &, bool > &, const OUString &)
Add an arbitrary button to the menubar that will appear next to the close button.
sal_uInt16 m_nHighlightedItem
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
void ShowButtons(bool bClose, bool bFloat, bool bHide)
void ImplInitStyleSettings()
VclPtr< PushButton > m_aFloatBtn
virtual ~MenuBarWindow() override
virtual void Resize() override
void SetMenuBarButtonHighlightHdl(sal_uInt16 nId, const Link< MenuBarButtonCallbackArg &, bool > &)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
tools::Rectangle GetMenuBarButtonRectPixel(sal_uInt16 nId)
std::map< sal_uInt16, AddButtonEntry > m_aAddButtons
VclPtr< Menu > m_pMenu
MenuBarWindow(vcl::Window *pParent)
sal_uInt16 m_nRolloveredItem
VclPtr< PopupMenu > m_pActivePopup
virtual void RequestHelp(const HelpEvent &rHEvt) override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SetMenu(MenuBar *pMenu)
void KillActivePopup()
void StateChanged(StateChangedType nType) override
VclPtr< DecoToolBox > m_aCloseBtn
void DataChanged(const DataChangedEvent &rDCEvt) override
tools::Rectangle ImplGetItemRect(sal_uInt16 nPos) const
sal_uInt16 ImplFindEntry(const Point &rMousePos) const
virtual void MouseMove(const MouseEvent &rMEvt) override
Size const & MinCloseButtonSize() const
void LoseFocus() override
bool CanGetFocus() const
VclPtr< PushButton > m_aHideBtn
virtual void KeyInput(const KeyEvent &rKEvent) override
bool HandleKeyEvent(const KeyEvent &rKEvent, bool bFromMenu=true)
const Link< void *, void > & GetCloseButtonClickHdl() const
Definition: menu.hxx:455
bool HasHideButton() const
Definition: menu.hxx:447
bool IsDisplayable() const
Definition: menu.hxx:462
bool HasCloseButton() const
Definition: menu.hxx:445
bool HasFloatButton() const
Definition: menu.hxx:446
MenuItemData * GetData(sal_uInt16 nSVId, size_t &rPos) const
MenuItemData * GetDataFromPos(size_t nPos) const
MenuItemData * SearchItem(sal_Unicode cSelectChar, vcl::KeyCode aKeyCode, size_t &rPos, size_t &nDuplicates, size_t nCurrentPos) const
static bool ImplHandleHelpEvent(vcl::Window *pMenuWindow, Menu const *pMenu, sal_uInt16 nHighlightedItem, const HelpEvent &rHEvt, const tools::Rectangle &rHighlightRect)
Show the appropriate help tooltip.
Definition: menuwindow.cxx:40
Definition: menu.hxx:116
SAL_DLLPRIVATE void ImplCallEventListeners(VclEventId nEvent, sal_uInt16 nPos)
Definition: menu.cxx:383
SAL_DLLPRIVATE SalMenu * ImplGetSalMenu()
Definition: menu.hxx:181
void Activate()
Definition: menu.cxx:256
std::unique_ptr< SalMenu > mpSalMenu
Definition: menu.hxx:157
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OString &rIdent=OString(), sal_uInt16 nPos=MENU_APPEND)
Definition: menu.cxx:432
SAL_DLLPRIVATE bool ImplCurrentlyHiddenOnGUI(sal_uInt16 nPos) const
Definition: menu.cxx:1169
css::uno::Reference< css::accessibility::XAccessible > GetAccessible()
Definition: menu.cxx:1279
bool bCanceled
Terminated during a callback.
Definition: menu.hxx:151
SAL_DLLPRIVATE void ImplKillLayoutData() const
Definition: menu.cxx:2187
SAL_DLLPRIVATE Size ImplCalcSize(vcl::Window *pWin)
Definition: menu.cxx:1403
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: menu.cxx:623
void SetAccelKey(sal_uInt16 nItemId, const vcl::KeyCode &rKeyCode)
Definition: menu.cxx:760
SAL_DLLPRIVATE void ImplPaint(vcl::RenderContext &rRenderContext, Size const &rSize, sal_uInt16 nBorder, tools::Long nOffY=0, MenuItemData const *pThisDataOnly=nullptr, bool bHighlighted=false, bool bLayout=false, bool bRollover=false) const
Definition: menu.cxx:1700
void Deactivate()
Definition: menu.cxx:287
void SetItemCommand(sal_uInt16 nItemId, const OUString &rCommand)
Definition: menu.cxx:1029
PopupMenu * GetPopupMenu(sal_uInt16 nItemId) const
Definition: menu.cxx:750
SAL_DLLPRIVATE bool ImplIsVisible(sal_uInt16 nPos) const
Definition: menu.cxx:1183
VclPtr< vcl::Window > pWindow
Definition: menu.hxx:128
SAL_DLLPRIVATE void ImplCallHighlight(sal_uInt16 nHighlightItem)
Definition: menu.cxx:2083
void SetPopupMenu(sal_uInt16 nItemId, PopupMenu *pMenu)
Definition: menu.cxx:713
void SetHelpCommand(sal_uInt16 nItemId, const OUString &rString)
Definition: menu.cxx:1048
void SetHelpText(sal_uInt16 nItemId, const OUString &rString)
Definition: menu.cxx:1066
bool bInCallback
In Activate/Deactivate.
Definition: menu.hxx:152
MenuItemList * GetItemList() const
Definition: menu.hxx:345
SAL_DLLPRIVATE SalMenu * GetNativeMenuBar()
Definition: menu.cxx:2210
sal_uInt16 GetItemCount() const
Definition: menu.cxx:577
SAL_DLLPRIVATE vcl::Window * ImplGetWindow() const
Definition: menu.hxx:210
std::unique_ptr< MenuItemList > pItemList
Definition: menu.hxx:126
void SetHelpId(sal_uInt16 nItemId, const OString &rHelpId)
Definition: menu.cxx:1120
bool IsEnterWindow() const
Definition: event.hxx:138
bool IsSynthetic() const
Definition: event.hxx:142
bool IsLeaveWindow() const
Definition: event.hxx:140
const Point & GetPosPixel() const
Definition: event.hxx:123
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:216
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:161
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:650
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
void SetFillColor()
Definition: fill.cxx:29
void SetTextFillColor()
Definition: text.cxx:734
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:33
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:92
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
const AllSettings & GetSettings() const
Definition: outdev.hxx:289
void IntersectClipRegion(const tools::Rectangle &rRect)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr< vcl::Window > &pParentWin, const tools::Rectangle &rRect, FloatWinPopupFlags nPopupModeFlags, Menu *pSFrom, bool bPreSelectFirst)
Definition: menu.cxx:3013
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const
Definition: menu.cxx:2658
void SetSymbol(SymbolType eSymbol)
Definition: button.cxx:1613
A SalFrame is a system window (e.g. an X11 window).
Definition: salframe.hxx:115
virtual void UpdateSettings(AllSettings &rSettings)=0
virtual void SetMenu(SalMenu *pSalMenu)=0
virtual int GetMenuBarHeight() const
Return the height of the native menu bar.
Definition: salvtables.cxx:236
virtual bool CanGetFocus() const
Definition: salmenu.hxx:92
virtual bool TakeFocus()
Definition: salmenu.hxx:93
virtual void ShowMenuBar(bool)
Change visibility of the native menu bar.
Definition: salvtables.cxx:238
virtual void SetFrame(const SalFrame *pFrame)=0
virtual bool HasNativeMenuBar()=0
Return true, if the implementation supports a native menu bar (or wants to suppress LO's menu bar,...
virtual void ApplyPersona()
Definition: salvtables.cxx:240
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:408
constexpr tools::Long Height() const
tools::Long AdjustWidth(tools::Long n)
constexpr tools::Long Width() const
const Color & GetMenuBarRolloverColor() const
BitmapEx const & GetPersonaHeader() const
bool GetHighContrastMode() const
const Color & GetMenuColor() const
const Color & GetMenuHighlightColor() const
const Color & GetMenuBarTextColor() const
const vcl::Font & GetMenuFont() const
Color GetSeparatorColor() const
void SetMenuHighlightTextColor(const Color &rColor)
TaskPaneList * GetTaskPaneList()
Definition: syswin.cxx:240
bool HandleKeyEvent(const KeyEvent &rKeyEvent)
A toolbar: contains all those icons, typically below the menu bar.
Definition: toolbox.hxx:74
ToolBoxItemId GetItemId(ImplToolItems::size_type nPos) const
Definition: toolbox2.cxx:746
void SetSelectHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:454
void RemoveItem(ImplToolItems::size_type nPos)
Definition: toolbox2.cxx:537
void SetQuickHelpText(ToolBoxItemId nItemId, const OUString &rText)
Definition: toolbox2.cxx:1321
Size CalcWindowSizePixel()
Definition: toolbox.hxx:519
bool IsItemVisible(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1277
ImplToolItems::size_type GetItemCount() const
Definition: toolbox2.cxx:712
void ShowItem(ToolBoxItemId nItemId, bool bVisible=true)
Shows or hides items.
Definition: toolbox2.cxx:1251
Image GetItemImage(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1012
virtual void InsertItem(const OUString &rCommand, const css::uno::Reference< css::frame::XFrame > &rFrame, ToolBoxItemBits nBits, const Size &rRequestedSize, ImplToolItems::size_type nPos=APPEND)
Insert a command (like '.uno:Save').
Definition: toolbox2.cxx:440
tools::Rectangle GetItemRect(ToolBoxItemId nItemId)
Definition: toolbox2.cxx:838
void SetItemImage(ToolBoxItemId nItemId, const Image &rImage)
Definition: toolbox2.cxx:966
ImplToolItems::size_type GetItemPos(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:722
A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for refer...
Definition: vclptr.hxx:58
void disposeAndClear()
Definition: vclptr.hxx:200
void clear()
Definition: vclptr.hxx:190
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
bool isDisposed() const
void SetStyle(WallpaperStyle eStyle)
Definition: wall.cxx:165
void SetColor(const Color &rColor)
Definition: wall.cxx:156
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr Point BottomRight() const
constexpr bool IsEmpty() const
constexpr Point BottomLeft() const
Buffers drawing on a vcl::RenderContext using a VirtualDevice.
bool IsMod1() const
Definition: keycod.hxx:56
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
bool IsShift() const
Definition: keycod.hxx:54
bool IsMod2() const
Definition: keycod.hxx:58
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2808
vcl::Window * GetParent() const
Definition: window2.cxx:1121
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:308
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3009
WindowType GetType() const
Definition: window2.cxx:998
virtual void Resize()
Definition: window.cxx:1837
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
void SetParentClipMode(ParentClipMode nMode=ParentClipMode::NONE)
void GrabFocus()
Definition: window.cxx:2981
void Erase(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1596
void GrabFocusToDocument()
Definition: window.cxx:2991
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2189
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2668
void Hide()
Definition: window.hxx:885
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:303
SalFrame * ImplGetFrame() const
Definition: window2.cxx:867
bool IsSystemWindow() const
Definition: window2.cxx:1021
virtual Size GetSizePixel() const
Definition: window.cxx:2404
Size GetOutputSizePixel() const
Definition: window3.cxx:89
SAL_DLLPRIVATE ImplFrameData * ImplGetFrameData()
Definition: window2.cxx:862
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2175
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1025
bool IsVisible() const
Definition: window2.cxx:1126
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
void SetQuickHelpText(const OUString &rHelpText)
Definition: window2.cxx:1250
void SetType(WindowType nType)
Definition: window2.cxx:992
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:925
void SetBackground()
Definition: window3.cxx:100
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
ColorTransparency
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
sal_Int32 nState
sal_Int64 n
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_F6
Definition: keycodes.hxx:88
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_MENU
Definition: keycodes.hxx:147
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
constexpr auto ITEMPOS_INVALID
Invalid menu item id.
Definition: menu.hxx:100
IMPL_LINK(MenuBarWindow, ToolboxEventHdl, VclWindowEvent &, rEvent, void)
#define IID_DOCUMENTCLOSE
static void ImplAddNWFSeparator(vcl::RenderContext &rRenderContext, const Size &rSize, const MenubarValue &rMenubarValue)
IMPL_LINK_NOARG(MenuBarWindow, CloseHdl, ToolBox *, void)
static int ImplGetTopDockingAreaHeight(vcl::Window const *pWindow)
std::unique_ptr< sal_Int32[]> pData
sal_uInt16 nCode
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
long Long
sal_Int16 nId
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
ImplSVNWFData maNWFData
Definition: svdata.hxx:406
ImplSVWinData * mpWinData
Definition: svdata.hxx:403
::Color maMenuBarHighlightTextColor
Definition: svdata.hxx:321
bool mbNoSaveFocus
Definition: svdata.hxx:271
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:255
bool mbNoDeactivate
Definition: svdata.hxx:270
Link< MenuBarButtonCallbackArg &, bool > m_aSelectLink
vcl::KeyCode aAccelKey
VclPtr< Menu > pSubMenu
OString sIdent
MenuItemBits nBits
OUString aHelpText
OUString aCommandStr
OUString aHelpCommandStr
OUString aText
OString aHelpId
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
OUString VclResId(TranslateId aId)
Definition: svdata.cxx:260
o3tl::strong_int< sal_uInt16, struct ToolBoxItemIdTag > ToolBoxItemId
Definition: toolboxid.hxx:14
sal_uInt16 sal_Unicode
@ ToolboxHighlightOff
StateChangedType
Definition: window.hxx:291
WinBits const WB_NOPOINTERFOCUS
Definition: wintypes.hxx:155
WinBits const WB_SMALLSTYLE
Definition: wintypes.hxx:184
WinBits const WB_RECTSTYLE
Definition: wintypes.hxx:183