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#include <menubarvalue.hxx>
37
38// document closing button
39#define IID_DOCUMENTCLOSE 1
40
42 ToolBox( pParent, 0 ),
43 lastSize(-1)
44{
46}
47
49{
50 Window::DataChanged( rDCEvt );
51
52 if ( rDCEvt.GetFlags() & AllSettingsFlags::STYLE )
53 {
56 SetImages( 0, true);
57 }
58}
59
61{
63 if( GetItemCount() == 0 )
64 {
65 aTbx->InsertItem(ToolBoxItemId(IID_DOCUMENTCLOSE), Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC));
66 }
67 else
68 {
69 ImplToolItems::size_type nItems = GetItemCount();
70 for( ImplToolItems::size_type i = 0; i < nItems; i++ )
71 {
73 aTbx->InsertItem( nId, GetItemImage( nId ) );
74 }
75 }
76 maMinSize = aTbx->CalcWindowSizePixel();
77
78 aTbx.disposeAndClear();
79}
80
81void DecoToolBox::SetImages( tools::Long nMaxHeight, bool bForce )
82{
84
85 if( !nMaxHeight && lastSize != -1 )
86 nMaxHeight = lastSize + border; // don't change anything if called with 0
87
88 if( nMaxHeight < getMinSize().Height() )
89 nMaxHeight = getMinSize().Height();
90
91 if( (lastSize == nMaxHeight - border) && !bForce )
92 return;
93
94 lastSize = nMaxHeight - border;
95
96 Color aEraseColor( ColorTransparency, 255, 255, 255, 255 );
97 BitmapEx aBmpExDst( maImage.GetBitmapEx() );
98 BitmapEx aBmpExSrc( aBmpExDst );
99
100 aEraseColor.SetAlpha( 0 );
101 aBmpExDst.Erase( aEraseColor );
102 aBmpExDst.Scale( Size( lastSize, lastSize ) );
103
104 tools::Rectangle aSrcRect( Point(0,0), maImage.GetSizePixel() );
108
109 aBmpExDst.CopyPixel( aDestRect, aSrcRect, &aBmpExSrc );
111
112}
113
115 Window( pParent, 0 ),
116 m_aCloseBtn(VclPtr<DecoToolBox>::Create(this)),
119{
121 m_pMenu = nullptr;
122 m_pActivePopup = nullptr;
125 mbAutoPopup = true;
126 m_bIgnoreFirstMove = true;
127
128 m_aCloseBtn->maImage = Image(StockImage::Yes, SV_RESID_BITMAP_CLOSEDOC);
129
133
135 m_aCloseBtn->SetSelectHdl(LINK(this, MenuBarWindow, CloseHdl));
136 m_aCloseBtn->AddEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
138
140 m_aFloatBtn->SetQuickHelpText(VclResId(SV_HELPTEXT_RESTORE));
141
143 m_aHideBtn->SetQuickHelpText(VclResId(SV_HELPTEXT_MINIMIZE));
144
146
147 AddEventListener(LINK(this, MenuBarWindow, ShowHideListener));
148}
149
151{
152 disposeOnce();
153}
154
156{
157 m_aCloseBtn->RemoveEventListener(LINK(this, MenuBarWindow, ToolboxEventHdl));
158 RemoveEventListener(LINK(this, MenuBarWindow, ShowHideListener));
159
164 m_pMenu.clear();
167
168 Window::dispose();
169}
170
172{
173 m_pMenu = pMen;
176 if (pMen)
177 {
179 m_aCloseBtn->Show(pMen->HasCloseButton() || !m_aAddButtons.empty());
181 m_aHideBtn->Show(pMen->HasHideButton());
182 }
183 Invalidate();
184
185 // show and connect native menubar
186 if( m_pMenu && m_pMenu->ImplGetSalMenu() )
187 {
190
193 }
194}
195
197{
198 setPosSizePixel(0, 0, 0, nHeight, PosSizeFlags::Height);
199}
200
201void MenuBarWindow::ShowButtons( bool bClose, bool bFloat, bool bHide )
202{
204 m_aCloseBtn->Show(bClose || !m_aAddButtons.empty());
205 if (m_pMenu->mpSalMenu)
206 m_pMenu->mpSalMenu->ShowCloseButton(bClose);
207 m_aFloatBtn->Show( bFloat );
208 m_aHideBtn->Show( bHide );
209 Resize();
210}
211
213{
214 return m_aCloseBtn->getMinSize();
215}
216
218{
219 if( ! m_pMenu )
220 return;
221
222 if( m_aCloseBtn->GetCurItemId() == ToolBoxItemId(IID_DOCUMENTCLOSE) )
223 {
224 // #i106052# call close hdl asynchronously to ease handler implementation
225 // this avoids still being in the handler while the DecoToolBox already
226 // gets destroyed
227 Application::PostUserEvent(static_cast<MenuBar*>(m_pMenu.get())->GetCloseButtonClickHdl());
228 }
229 else
230 {
231 std::map<sal_uInt16,AddButtonEntry>::iterator it = m_aAddButtons.find(sal_uInt16(m_aCloseBtn->GetCurItemId()));
232 if( it != m_aAddButtons.end() )
233 {
235 aArg.nId = it->first;
236 aArg.bHighlight = (sal_uInt16(m_aCloseBtn->GetHighlightItemId()) == it->first);
237 it->second.m_aSelectLink.Call( aArg );
238 }
239 }
240}
241
242IMPL_LINK( MenuBarWindow, ToolboxEventHdl, VclWindowEvent&, rEvent, void )
243{
244 if( ! m_pMenu )
245 return;
246
248 aArg.nId = 0xffff;
249 aArg.bHighlight = (rEvent.GetId() == VclEventId::ToolboxHighlight);
250 if( rEvent.GetId() == VclEventId::ToolboxHighlight )
251 aArg.nId =sal_uInt16(m_aCloseBtn->GetHighlightItemId());
252 else if( rEvent.GetId() == VclEventId::ToolboxHighlightOff )
253 {
254 auto nPos = static_cast<ToolBox::ImplToolItems::size_type>(reinterpret_cast<sal_IntPtr>(rEvent.GetData()));
255 aArg.nId = sal_uInt16(m_aCloseBtn->GetItemId(nPos));
256 }
257 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( aArg.nId );
258 if( it != m_aAddButtons.end() )
259 {
260 it->second.m_aHighlightLink.Call( aArg );
261 }
262}
263
264IMPL_LINK( MenuBarWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
265{
266 if( ! m_pMenu )
267 return;
268
269 if( rEvent.GetId() == VclEventId::WindowShow )
270 m_pMenu->ImplCallEventListeners( VclEventId::MenuShow, ITEMPOS_INVALID );
271 else if( rEvent.GetId() == VclEventId::WindowHide )
272 m_pMenu->ImplCallEventListeners( VclEventId::MenuHide, ITEMPOS_INVALID );
273}
274
275void MenuBarWindow::ImplCreatePopup( bool bPreSelectFirst )
276{
278 if ( !pItemData )
279 return;
280
281 m_bIgnoreFirstMove = true;
282 if ( m_pActivePopup && ( m_pActivePopup != pItemData->pSubMenu ) )
283 {
285 }
286 if ( !(pItemData->bEnabled && pItemData->pSubMenu && ( m_nHighlightedItem != ITEMPOS_INVALID ) &&
287 ( pItemData->pSubMenu != m_pActivePopup )) )
288 return;
289
290 m_pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
291 tools::Long nX = 0;
292 MenuItemData* pData = nullptr;
293 for ( sal_uLong n = 0; n < m_nHighlightedItem; n++ )
294 {
296 nX += pData->aSz.Width();
297 }
298 pData = m_pMenu->pItemList->GetDataFromPos( m_nHighlightedItem );
299 Point aItemTopLeft( nX, 0 );
300 Point aItemBottomRight( aItemTopLeft );
301 aItemBottomRight.AdjustX(pData->aSz.Width() );
302
303 if (pData->bHiddenOnGUI)
304 {
308
309 for (sal_uInt16 i = m_nHighlightedItem; i < m_pMenu->GetItemCount(); ++i)
310 {
311 sal_uInt16 nId = m_pMenu->GetItemId(i);
312
313 MenuItemData* pParentItemData = m_pMenu->GetItemList()->GetData(nId);
314 assert(pParentItemData);
315 mpParentPopup->InsertItem(nId, pParentItemData->aText, pParentItemData->nBits, pParentItemData->sIdent);
316 mpParentPopup->SetHelpId(nId, pParentItemData->aHelpId);
317 mpParentPopup->SetHelpText(nId, pParentItemData->aHelpText);
318 mpParentPopup->SetAccelKey(nId, pParentItemData->aAccelKey);
319 mpParentPopup->SetItemCommand(nId, pParentItemData->aCommandStr);
321
322 PopupMenu* pPopup = m_pMenu->GetPopupMenu(nId);
324 }
325 }
326 // the menu bar could have height 0 in fullscreen mode:
327 // so do not use always WindowHeight, as ItemHeight < WindowHeight.
328 if ( GetSizePixel().Height() )
329 {
330 // #107747# give menuitems the height of the menubar
331 aItemBottomRight.AdjustY(GetOutputSizePixel().Height()-1 );
332 }
333
334 // ImplExecute is not modal...
335 // #99071# do not grab the focus, otherwise it will be restored to the menubar
336 // when the frame is reactivated later
337 //GrabFocus();
338 m_pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Down | FloatWinPopupFlags::NoHorzPlacement, m_pMenu, bPreSelectFirst );
339 // does not have a window, if aborted before or if there are no entries
342 else
343 m_pActivePopup = nullptr;
344}
345
347{
348 if ( !m_pActivePopup )
349 return;
350
352 if( static_cast<FloatingWindow *>(m_pActivePopup->pWindow.get())->IsInCleanUp() )
353 return; // kill it later
354
357
361 // check for pActivePopup, if stopped by deactivate...
363 {
364 if (mpParentPopup)
365 {
366 for (sal_uInt16 i = 0; i < mpParentPopup->GetItemCount(); ++i)
367 {
368 sal_uInt16 nId = mpParentPopup->GetItemId(i);
369 MenuItemData* pParentItemData = mpParentPopup->GetItemList()->GetData(nId);
370 assert(pParentItemData);
371 pParentItemData->pSubMenu = nullptr;
372 }
373 }
377 }
378 m_pActivePopup = nullptr;
379}
380
381void MenuBarWindow::PopupClosed( Menu const * pPopup )
382{
383 if ( pPopup == m_pActivePopup )
384 {
387 }
388}
389
391{
392 mbAutoPopup = true;
393 sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
394 if ( ( nEntry != ITEMPOS_INVALID ) && !m_pActivePopup )
395 {
396 ChangeHighlightItem( nEntry, false );
397 }
398 else
399 {
402 }
403}
404
406{
407}
408
410{
411 if ( rMEvt.IsSynthetic() || rMEvt.IsEnterWindow() )
412 return;
413
414 if ( rMEvt.IsLeaveWindow() )
415 {
417 Invalidate(); //HighlightItem( nRolloveredItem, false );
418
420 return;
421 }
422
423 sal_uInt16 nEntry = ImplFindEntry( rMEvt.GetPosPixel() );
425 {
426 if ( m_nRolloveredItem != nEntry )
427 {
429 Invalidate(); //HighlightItem( nRolloveredItem, false );
430
431 m_nRolloveredItem = nEntry;
432 Invalidate(); //HighlightItem( nRolloveredItem, true );
433 }
434 return;
435 }
436 m_nRolloveredItem = nEntry;
437
439 {
440 m_bIgnoreFirstMove = false;
441 return;
442 }
443
444 if ( ( nEntry != ITEMPOS_INVALID )
445 && ( nEntry != m_nHighlightedItem ) )
446 ChangeHighlightItem( nEntry, false );
447}
448
449void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool bAllowRestoreFocus, bool bDefaultToDocument)
450{
451 if( ! m_pMenu )
452 return;
453
454 // #57934# close active popup if applicable, as TH's background storage works.
455 MenuItemData* pNextData = m_pMenu->pItemList->GetDataFromPos( n );
456 if ( m_pActivePopup && m_pActivePopup->ImplGetWindow() && ( !pNextData || ( m_pActivePopup != pNextData->pSubMenu ) ) )
457 KillActivePopup(); // pActivePopup when applicable without pWin, if Rescheduled in Activate()
458
459 // activate menubar only ones per cycle...
460 bool bJustActivated = false;
462 {
464 // #105406# avoid saving the focus when we already have the focus
465 bool bNoSaveFocus = (this == ImplGetSVData()->mpWinData->mpFocusWin.get());
466
467 if( m_xSaveFocusId != nullptr )
468 {
470 {
471 m_xSaveFocusId = nullptr;
472 if( !bNoSaveFocus )
473 m_xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated
474 }
475 else {
476 ; // do nothing: we 're activated again from taskpanelist, focus was already saved
477 }
478 }
479 else
480 {
481 if( !bNoSaveFocus )
482 m_xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated
483 }
484 m_pMenu->bInCallback = true; // set here if Activate overridden
485 m_pMenu->Activate();
486 m_pMenu->bInCallback = false;
487 bJustActivated = true;
488 }
489 else if ( ( m_nHighlightedItem != ITEMPOS_INVALID ) && ( n == ITEMPOS_INVALID ) )
490 {
491 m_pMenu->bInCallback = true;
493 m_pMenu->bInCallback = false;
495 if (!ImplGetSVData()->mpWinData->mbNoSaveFocus)
496 {
497 VclPtr<vcl::Window> xTempFocusId;
499 xTempFocusId = m_xSaveFocusId;
500 m_xSaveFocusId = nullptr;
501
502 if (bAllowRestoreFocus)
503 {
504 // tdf#115227 the popup is already killed, so temporarily set us as the
505 // focus window, so we could avoid sending superfluous activate events
506 // to top window listeners.
507 if (xTempFocusId || bDefaultToDocument)
509
510 // #105406# restore focus to document if we could not save focus before
511 if (!xTempFocusId && bDefaultToDocument)
513 else
514 Window::EndSaveFocus(xTempFocusId);
515 }
516 }
517 }
518
520 {
522 Invalidate(); //HighlightItem( nHighlightedItem, false );
523
525 }
526
528 SAL_WARN_IF( ( m_nHighlightedItem != ITEMPOS_INVALID ) && !m_pMenu->ImplIsVisible( m_nHighlightedItem ), "vcl", "ChangeHighlightItem: Not visible!" );
530 Invalidate(); //HighlightItem( nHighlightedItem, true );
532 Invalidate(); //HighlightItem( nRolloveredItem, true );
534
535 if( mbAutoPopup )
536 ImplCreatePopup( bSelectEntry );
537
538 // #58935# #73659# Focus, if no popup underneath...
539 if ( bJustActivated && !m_pActivePopup )
540 GrabFocus();
541}
542
543static int ImplGetTopDockingAreaHeight( vcl::Window const *pWindow )
544{
545 // find docking area that is top aligned and return its height
546 // note: dockingareas are direct children of the SystemWindow
547 if( pWindow->ImplGetFrameWindow() )
548 {
549 vcl::Window *pWin = pWindow->ImplGetFrameWindow()->GetWindow( GetWindowType::FirstChild ); //mpWindowImpl->mpFirstChild;
550 while( pWin )
551 {
552 if( pWin->IsSystemWindow() )
553 {
554 vcl::Window *pChildWin = pWin->GetWindow( GetWindowType::FirstChild ); //mpWindowImpl->mpFirstChild;
555 while( pChildWin )
556 {
557 DockingAreaWindow *pDockingArea = nullptr;
558 if ( pChildWin->GetType() == WindowType::DOCKINGAREA )
559 pDockingArea = static_cast< DockingAreaWindow* >( pChildWin );
560
561 if( pDockingArea && pDockingArea->GetAlign() == WindowAlign::Top &&
562 pDockingArea->IsVisible() && pDockingArea->GetOutputSizePixel().Height() != 0 )
563 {
564 return pDockingArea->GetOutputSizePixel().Height();
565 }
566
567 pChildWin = pChildWin->GetWindow( GetWindowType::Next ); //mpWindowImpl->mpNext;
568 }
569
570 }
571
572 pWin = pWin->GetWindow( GetWindowType::Next ); //mpWindowImpl->mpNext;
573 }
574 }
575 return 0;
576}
577
578static void ImplAddNWFSeparator(vcl::RenderContext& rRenderContext, const Size& rSize, const MenubarValue& rMenubarValue)
579{
580 // add a separator if
581 // - we have an adjacent docking area
582 // - and if toolbars would draw them as well (mbDockingAreaSeparateTB must not be set, see dockingarea.cxx)
583 if (rMenubarValue.maTopDockingAreaHeight
584 && !ImplGetSVData()->maNWFData.mbDockingAreaSeparateTB
585 && !ImplGetSVData()->maNWFData.mbDockingAreaAvoidTBFrames)
586 {
587 // note: the menubar only provides the upper (dark) half of it, the rest (bright part) is drawn by the docking area
588
589 rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
590 tools::Rectangle aRect(Point(), rSize);
591 rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
592 }
593}
594
595void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos)
596{
597 if (!m_pMenu)
598 return;
599
600 tools::Long nX = 0;
601 size_t nCount = m_pMenu->pItemList->size();
602
603 Size aOutputSize = GetOutputSizePixel();
604 aOutputSize.AdjustWidth( -(m_aCloseBtn->GetSizePixel().Width()) );
605
606 for (size_t n = 0; n < nCount; n++)
607 {
608 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
609 if (n == nPos)
610 {
611 if (pData->eType != MenuItemType::SEPARATOR)
612 {
613 // #107747# give menuitems the height of the menubar
614 tools::Rectangle aRect(Point(nX, 1), Size(pData->aSz.Width(), aOutputSize.Height() - 2));
615 rRenderContext.Push(vcl::PushFlags::CLIPREGION);
616 rRenderContext.IntersectClipRegion(aRect);
617 bool bRollover, bHighlight;
618 if (!ImplGetSVData()->maNWFData.mbRolloverMenubar)
619 {
620 bHighlight = true;
621 bRollover = nPos != m_nHighlightedItem;
622 }
623 else
624 {
625 bRollover = nPos == m_nRolloveredItem;
626 bHighlight = nPos == m_nHighlightedItem;
627 }
630 {
631 // draw background (transparency)
632 MenubarValue aControlValue;
634
635 if (!Application::GetSettings().GetStyleSettings().GetPersonaHeader().IsEmpty() )
636 Erase(rRenderContext);
637 else
638 {
639 tools::Rectangle aBgRegion(Point(), aOutputSize);
641 ControlState::ENABLED, aControlValue, OUString());
642 }
643
644 ImplAddNWFSeparator(rRenderContext, aOutputSize, aControlValue);
645
646 // draw selected item
648 if (bRollover)
650 else
653 aRect, nState, aControlValue, OUString() );
654 }
655 else
656 {
657 if (bRollover)
658 rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuBarRolloverColor());
659 else
660 rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
661 rRenderContext.SetLineColor();
662 rRenderContext.DrawRect(aRect);
663 }
664 rRenderContext.Pop();
665
666 m_pMenu->ImplPaint(rRenderContext, aOutputSize, 0, 0, pData, bHighlight, false, bRollover);
667 }
668 return;
669 }
670
671 nX += pData->aSz.Width();
672 }
673}
674
676{
677 tools::Rectangle aRect;
678 if( m_pMenu )
679 {
680 tools::Long nX = 0;
681 size_t nCount = m_pMenu->pItemList->size();
682 for ( size_t n = 0; n < nCount; n++ )
683 {
684 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
685 if ( n == nPos )
686 {
687 if ( pData->eType != MenuItemType::SEPARATOR )
688 // #107747# give menuitems the height of the menubar
689 aRect = tools::Rectangle( Point( nX, 1 ), Size( pData->aSz.Width(), GetOutputSizePixel().Height()-2 ) );
690 break;
691 }
692
693 nX += pData->aSz.Width();
694 }
695 }
696 return aRect;
697}
698
699void MenuBarWindow::KeyInput( const KeyEvent& rKEvent )
700{
701 if ( !HandleKeyEvent( rKEvent ) )
702 Window::KeyInput( rKEvent );
703}
704
705bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu )
706{
707 if (!m_pMenu)
708 return false;
709
710 if (m_pMenu->bInCallback)
711 return true; // swallow
712
713 bool bDone = false;
714 sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
715
716 if( GetParent() )
717 {
719 {
720 SystemWindow *pSysWin = static_cast<SystemWindow*>(GetParent()->GetWindow( GetWindowType::Client ));
721 if( pSysWin->GetTaskPaneList() )
722 if( pSysWin->GetTaskPaneList()->HandleKeyEvent( rKEvent ) )
723 return true;
724 }
725 }
726
727 // no key events if native menus
729 {
730 return false;
731 }
732
733 if ( nCode == KEY_MENU && !rKEvent.GetKeyCode().IsShift() ) // only F10, not Shift-F10
734 {
735 mbAutoPopup = false;
737 {
738 ChangeHighlightItem( 0, false );
739 GrabFocus();
740 }
741 else
742 {
744 m_xSaveFocusId = nullptr;
745 }
746 bDone = true;
747 }
748 else if ( bFromMenu )
749 {
750 if ( ( nCode == KEY_LEFT ) || ( nCode == KEY_RIGHT ) ||
751 ( nCode == KEY_HOME ) || ( nCode == KEY_END ) )
752 {
753 sal_uInt16 n = m_nHighlightedItem;
754 if ( n == ITEMPOS_INVALID )
755 {
756 if ( nCode == KEY_LEFT)
757 n = 0;
758 else
759 n = m_pMenu->GetItemCount()-1;
760 }
761
762 sal_uInt16 nLoop = n;
763
764 if( nCode == KEY_HOME )
765 { n = sal_uInt16(-1); nLoop = n+1; }
766 if( nCode == KEY_END )
767 { n = m_pMenu->GetItemCount(); nLoop = n-1; }
768
769 do
770 {
771 if ( nCode == KEY_LEFT || nCode == KEY_END )
772 {
773 if ( n )
774 n--;
775 else
776 n = m_pMenu->GetItemCount()-1;
777 }
778 if ( nCode == KEY_RIGHT || nCode == KEY_HOME )
779 {
780 n++;
781 if ( n >= m_pMenu->GetItemCount() )
782 n = 0;
783 }
784
786 if (pData->eType != MenuItemType::SEPARATOR &&
789 {
790 ChangeHighlightItem( n, true );
791 break;
792 }
793 } while ( n != nLoop );
794 bDone = true;
795 }
796 else if ( nCode == KEY_RETURN )
797 {
799 else
800 if ( !mbAutoPopup )
801 {
802 ImplCreatePopup( true );
803 mbAutoPopup = true;
804 }
805 bDone = true;
806 }
807 else if ( ( nCode == KEY_UP ) || ( nCode == KEY_DOWN ) )
808 {
809 if ( !mbAutoPopup )
810 {
811 ImplCreatePopup( true );
812 mbAutoPopup = true;
813 }
814 bDone = true;
815 }
816 else if ( nCode == KEY_ESCAPE || ( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() ) )
817 {
818 if( m_pActivePopup )
819 {
820 // hide the menu and remove the focus...
821 mbAutoPopup = false;
823 }
824
826
827 if( nCode == KEY_F6 && rKEvent.GetKeyCode().IsMod1() )
828 {
829 // put focus into document
831 }
832
833 bDone = true;
834 }
835 }
836
837 if ( !bDone && ( bFromMenu || rKEvent.GetKeyCode().IsMod2() ) )
838 {
839 sal_Unicode nCharCode = rKEvent.GetCharCode();
840 if ( nCharCode )
841 {
842 size_t nEntry, nDuplicates;
843 MenuItemData* pData = m_pMenu->GetItemList()->SearchItem( nCharCode, rKEvent.GetKeyCode(), nEntry, nDuplicates, m_nHighlightedItem );
844 if ( pData && (nEntry != ITEMPOS_INVALID) )
845 {
846 mbAutoPopup = true;
847 ChangeHighlightItem( nEntry, true );
848 bDone = true;
849 }
850 }
851 }
852
853 return bDone;
854}
855
857{
858 if (!m_pMenu)
859 return;
860
861 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
862
863 Size aOutputSize = GetOutputSizePixel();
864
865 // no VCL paint if native menus
867 return;
868
869 // Make sure that all actual rendering happens in one go to avoid flicker.
870 vcl::BufferDevice pBuffer(this, rRenderContext);
871
873 {
874 MenubarValue aMenubarValue;
876
877 if (!rStyleSettings.GetPersonaHeader().IsEmpty())
878 Erase(*pBuffer);
879 else
880 {
881 tools::Rectangle aCtrlRegion( Point(), aOutputSize );
882
884 ControlState::ENABLED, aMenubarValue, OUString());
885 }
886
887 ImplAddNWFSeparator(*pBuffer, aOutputSize, aMenubarValue);
888 }
889
890 // shrink the area of the buttons
891 aOutputSize.AdjustWidth( -(m_aCloseBtn->GetSizePixel().Width()) );
892
893 pBuffer->SetFillColor(rStyleSettings.GetMenuColor());
894 m_pMenu->ImplPaint(*pBuffer, aOutputSize, 0);
895
900
901 // in high contrast mode draw a separating line on the lower edge
903 rStyleSettings.GetHighContrastMode())
904 {
906 pBuffer->SetLineColor(COL_WHITE);
907 pBuffer->SetMapMode(MapMode(MapUnit::MapPixel));
908 Size aSize = GetSizePixel();
909 pBuffer->DrawLine(Point(0, aSize.Height() - 1),
910 Point(aSize.Width() - 1, aSize.Height() - 1));
911 pBuffer->Pop();
912 }
913}
914
916{
917 Size aOutSz = GetOutputSizePixel();
918 tools::Long n = aOutSz.Height()-4;
919 tools::Long nX = aOutSz.Width()-3;
920 tools::Long nY = 2;
921
922 if ( m_aCloseBtn->IsVisible() )
923 {
924 m_aCloseBtn->Hide();
926 Size aTbxSize( m_aCloseBtn->CalcWindowSizePixel() );
927 nX -= aTbxSize.Width();
928 tools::Long nTbxY = (aOutSz.Height() - aTbxSize.Height())/2;
929 m_aCloseBtn->setPosSizePixel(nX, nTbxY, aTbxSize.Width(), aTbxSize.Height());
930 nX -= 3;
931 m_aCloseBtn->Show();
932 }
933 if ( m_aFloatBtn->IsVisible() )
934 {
935 nX -= n;
936 m_aFloatBtn->setPosSizePixel( nX, nY, n, n );
937 }
938 if ( m_aHideBtn->IsVisible() )
939 {
940 nX -= n;
941 m_aHideBtn->setPosSizePixel( nX, nY, n, n );
942 }
943
946
947 Invalidate();
948}
949
950sal_uInt16 MenuBarWindow::ImplFindEntry( const Point& rMousePos ) const
951{
952 if( m_pMenu )
953 {
954 tools::Long nX = 0;
955 size_t nCount = m_pMenu->pItemList->size();
956 for ( size_t n = 0; n < nCount; n++ )
957 {
958 MenuItemData* pData = m_pMenu->pItemList->GetDataFromPos( n );
959 if ( m_pMenu->ImplIsVisible( n ) )
960 {
961 nX += pData->aSz.Width();
962 if ( nX > rMousePos.X() )
963 return static_cast<sal_uInt16>(n);
964 }
965 }
966 }
967 return ITEMPOS_INVALID;
968}
969
971{
972 sal_uInt16 nId = m_nHighlightedItem;
973 if ( rHEvt.GetMode() & HelpEventMode::CONTEXT )
975
977 if( !ImplHandleHelpEvent( this, m_pMenu, nId, rHEvt, aHighlightRect ) )
978 Window::RequestHelp( rHEvt );
979}
980
982{
983 Window::StateChanged( nType );
984
987 {
989 Invalidate();
990 }
992 {
993 Invalidate();
994 }
995 else if(m_pMenu)
996 {
998 }
999}
1000
1002{
1003 if (!m_pMenu)
1004 return;
1005
1007
1008 // if the font was changed.
1009 tools::Long nHeight = m_pMenu->ImplCalcSize(this).Height();
1010
1011 // depending on the native implementation or the displayable flag
1012 // the menubar windows is suppressed (ie, height=0)
1013 if (!static_cast<MenuBar*>(m_pMenu.get())->IsDisplayable() ||
1015 {
1016 nHeight = 0;
1017 }
1018 setPosSizePixel(0, 0, 0, nHeight, PosSizeFlags::Height);
1019 GetParent()->Resize();
1020 Invalidate();
1021 Resize();
1022
1024}
1025
1027{
1028 Window::ApplySettings(rRenderContext);
1029 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
1030
1031 SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
1032
1034 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->ImplGetSalMenu() : nullptr;
1035 if (pNativeMenu)
1036 pNativeMenu->ApplyPersona();
1037 if (!rPersonaBitmap.IsEmpty())
1038 {
1039 Wallpaper aWallpaper(rPersonaBitmap);
1041 aWallpaper.SetColor(Application::GetSettings().GetStyleSettings().GetWorkspaceColor());
1042
1043 rRenderContext.SetBackground(aWallpaper);
1044 SetPaintTransparent(false);
1046 }
1048 {
1049 rRenderContext.SetBackground(); // background will be drawn by NWF
1050 }
1051 else
1052 {
1053 Wallpaper aWallpaper;
1055 rRenderContext.SetBackground(aWallpaper);
1056 SetPaintTransparent(false);
1058 }
1059
1060 rRenderContext.SetTextColor(rStyleSettings.GetMenuBarTextColor());
1061 rRenderContext.SetTextFillColor();
1062 rRenderContext.SetLineColor();
1063}
1064
1066{
1069 return;
1070
1071 AllSettings aSettings(GetSettings());
1072 ImplGetFrame()->UpdateSettings(aSettings); // to update persona
1073 StyleSettings aStyle(aSettings.GetStyleSettings());
1075 if (aHighlightTextColor != COL_TRANSPARENT)
1076 {
1077 aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
1078 }
1079 aSettings.SetStyleSettings(aStyle);
1080 GetOutDev()->SetSettings(aSettings);
1081}
1082
1084{
1085 Window::DataChanged( rDCEvt );
1086
1087 if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1089 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1090 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1091 {
1094 LayoutChanged();
1095 }
1096}
1097
1099{
1100 if ( !HasChildPathFocus( true ) )
1101 ChangeHighlightItem( ITEMPOS_INVALID, false, false );
1102}
1103
1105{
1106 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->ImplGetSalMenu() : nullptr;
1107 if (pNativeMenu && pNativeMenu->TakeFocus())
1108 return;
1109
1111 {
1112 mbAutoPopup = false; // do not open menu when activated by focus handling like taskpane cycling
1113 ChangeHighlightItem( 0, false );
1114 }
1115}
1116
1117css::uno::Reference<css::accessibility::XAccessible> MenuBarWindow::CreateAccessible()
1118{
1119 css::uno::Reference<css::accessibility::XAccessible> xAcc;
1120
1121 if (m_pMenu)
1122 xAcc = m_pMenu->GetAccessible();
1123
1124 return xAcc;
1125}
1126
1127sal_uInt16 MenuBarWindow::AddMenuBarButton( const Image& i_rImage, const Link<MenuBarButtonCallbackArg&,bool>& i_rLink, const OUString& i_rToolTip )
1128{
1129 // find first free button id
1130 sal_uInt16 nId = IID_DOCUMENTCLOSE;
1131 std::map< sal_uInt16, AddButtonEntry >::const_iterator it;
1132 do
1133 {
1134 nId++;
1135 it = m_aAddButtons.find( nId );
1136 } while( it != m_aAddButtons.end() && nId < 128 );
1137 SAL_WARN_IF( nId >= 128, "vcl", "too many addbuttons in menubar" );
1138 AddButtonEntry& rNewEntry = m_aAddButtons[nId];
1139 rNewEntry.m_aSelectLink = i_rLink;
1143 LayoutChanged();
1144
1145 if( m_pMenu->mpSalMenu )
1146 m_pMenu->mpSalMenu->AddMenuBarButton( SalMenuButtonItem( nId, i_rImage, i_rToolTip ) );
1147
1148 return nId;
1149}
1150
1152{
1153 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( nId );
1154 if( it != m_aAddButtons.end() )
1155 it->second.m_aHighlightLink = rLink;
1156}
1157
1159{
1160 tools::Rectangle aRect;
1161 if( m_aAddButtons.find( nId ) != m_aAddButtons.end() )
1162 {
1163 if( m_pMenu->mpSalMenu )
1164 {
1165 aRect = m_pMenu->mpSalMenu->GetMenuBarButtonRectPixel( nId, ImplGetWindowImpl()->mpFrame );
1166 if( aRect == tools::Rectangle( Point( -1, -1 ), Size( 1, 1 ) ) )
1167 {
1168 // system menu button is somewhere but location cannot be determined
1169 return tools::Rectangle();
1170 }
1171 }
1172
1173 if( aRect.IsEmpty() )
1174 {
1177 aRect.Move( aOffset.X(), aOffset.Y() );
1178 }
1179 }
1180 return aRect;
1181}
1182
1184{
1185 ToolBox::ImplToolItems::size_type nPos = m_aCloseBtn->GetItemPos(ToolBoxItemId(nId));
1187 m_aAddButtons.erase( nId );
1189 LayoutChanged();
1190
1191 if( m_pMenu->mpSalMenu )
1192 m_pMenu->mpSalMenu->RemoveMenuBarButton( nId );
1193}
1194
1195bool MenuBarWindow::HandleMenuButtonEvent( sal_uInt16 i_nButtonId )
1196{
1197 std::map< sal_uInt16, AddButtonEntry >::iterator it = m_aAddButtons.find( i_nButtonId );
1198 if( it != m_aAddButtons.end() )
1199 {
1201 aArg.nId = it->first;
1202 aArg.bHighlight = true;
1203 return it->second.m_aSelectLink.Call( aArg );
1204 }
1205 return false;
1206}
1207
1209{
1210 /* #i83908# do not use the menubar if it is native or invisible
1211 this relies on MenuBar::ImplCreate setting the height of the menubar
1212 to 0 in this case
1213 */
1214 SalMenu *pNativeMenu = m_pMenu ? m_pMenu->ImplGetSalMenu() : nullptr;
1215 if (pNativeMenu && pNativeMenu->VisibleMenuBar())
1216 return pNativeMenu->CanGetFocus();
1217 return GetSizePixel().Height() > 0;
1218}
1219
1220/* 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:638
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:999
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
Definition: BitmapEx.cxx:305
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
Definition: BitmapEx.cxx:461
bool CopyPixel(const tools::Rectangle &rRectDst, const tools::Rectangle &rRectSrc, const BitmapEx *pBmpExSrc)
Copy a rectangular area from another bitmap.
Definition: BitmapEx.cxx:409
bool IsEmpty() const
Definition: BitmapEx.cxx:186
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:969
bool IsInCleanUp() const
Definition: floatwin.hxx:131
HelpEventMode GetMode() const
Definition: event.hxx:208
Definition: image.hxx:40
BitmapEx GetBitmapEx() const
Definition: Image.cxx:96
Size GetSizePixel() const
Definition: Image.cxx:88
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)
void SetHeight(tools::Long nHeight)
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:460
bool HasHideButton() const
Definition: menu.hxx:452
bool IsDisplayable() const
Definition: menu.hxx:467
bool HasCloseButton() const
Definition: menu.hxx:450
bool HasFloatButton() const
Definition: menu.hxx:451
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:184
void Activate()
Definition: menu.cxx:256
std::unique_ptr< SalMenu > mpSalMenu
Definition: menu.hxx:157
SAL_DLLPRIVATE bool ImplCurrentlyHiddenOnGUI(sal_uInt16 nPos) const
Definition: menu.cxx:1197
css::uno::Reference< css::accessibility::XAccessible > GetAccessible()
Definition: menu.cxx:1307
void SetHelpId(sal_uInt16 nItemId, const OUString &rHelpId)
Definition: menu.cxx:1148
bool bCanceled
Terminated during a callback.
Definition: menu.hxx:151
SAL_DLLPRIVATE void ImplKillLayoutData() const
Definition: menu.cxx:2215
SAL_DLLPRIVATE Size ImplCalcSize(vcl::Window *pWin)
Definition: menu.cxx:1431
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: menu.cxx:641
void SetAccelKey(sal_uInt16 nItemId, const vcl::KeyCode &rKeyCode)
Definition: menu.cxx:785
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:1728
void Deactivate()
Definition: menu.cxx:287
void SetItemCommand(sal_uInt16 nItemId, const OUString &rCommand)
Definition: menu.cxx:1054
PopupMenu * GetPopupMenu(sal_uInt16 nItemId) const
Definition: menu.cxx:775
SAL_DLLPRIVATE bool ImplIsVisible(sal_uInt16 nPos) const
Definition: menu.cxx:1211
VclPtr< vcl::Window > pWindow
Definition: menu.hxx:128
SAL_DLLPRIVATE void ImplCallHighlight(sal_uInt16 nHighlightItem)
Definition: menu.cxx:2111
void SetPopupMenu(sal_uInt16 nItemId, PopupMenu *pMenu)
Definition: menu.cxx:738
void SetHelpCommand(sal_uInt16 nItemId, const OUString &rString)
Definition: menu.cxx:1073
void SetHelpText(sal_uInt16 nItemId, const OUString &rString)
Definition: menu.cxx:1091
bool bInCallback
In Activate/Deactivate.
Definition: menu.hxx:152
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OUString &rIdent={}, sal_uInt16 nPos=MENU_APPEND)
Definition: menu.cxx:432
MenuItemList * GetItemList() const
Definition: menu.hxx:350
sal_uInt16 GetItemCount() const
Definition: menu.cxx:577
SAL_DLLPRIVATE vcl::Window * ImplGetWindow() const
Definition: menu.hxx:211
std::unique_ptr< MenuItemList > pItemList
Definition: menu.hxx:126
int maTopDockingAreaHeight
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:170
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:215
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:161
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:597
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:32
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
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:288
void IntersectClipRegion(const tools::Rectangle &rRect)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
SAL_DLLPRIVATE sal_uInt16 ImplExecute(const VclPtr< vcl::Window > &pParentWin, const tools::Rectangle &rRect, FloatWinPopupFlags nPopupModeFlags, Menu *pSFrom, bool bPreSelectFirst)
Definition: menu.cxx:3041
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const
Definition: menu.cxx:2686
void SetSymbol(SymbolType eSymbol)
Definition: button.cxx:1630
virtual void UpdateSettings(AllSettings &rSettings)=0
virtual void SetMenu(SalMenu *pSalMenu)=0
virtual bool CanGetFocus() const
Definition: salmenu.hxx:83
virtual bool TakeFocus()
Definition: salmenu.hxx:84
virtual void ShowMenuBar(bool)
Definition: salmenu.hxx:65
virtual void SetFrame(const SalFrame *pFrame)=0
virtual bool VisibleMenuBar()=0
virtual void ApplyPersona()
Definition: salvtables.cxx:236
A construction helper for ScopedVclPtr.
Definition: vclptr.hxx:409
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:2806
vcl::Window * GetParent() const
Definition: window2.cxx:1123
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:312
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3004
WindowType GetType() const
Definition: window2.cxx:1000
virtual void Resize()
Definition: window.cxx:1835
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1036
void SetParentClipMode(ParentClipMode nMode=ParentClipMode::NONE)
void GrabFocus()
Definition: window.cxx:2976
void Erase(vcl::RenderContext &rRenderContext)
Definition: paint.cxx:1595
void GrabFocusToDocument()
Definition: window.cxx:2986
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
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:2666
void Hide()
Definition: window.hxx:879
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:307
SalFrame * ImplGetFrame() const
Definition: window2.cxx:879
bool IsSystemWindow() const
Definition: window2.cxx:1023
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
SAL_DLLPRIVATE ImplFrameData * ImplGetFrameData()
Definition: window2.cxx:874
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2173
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1025
bool IsVisible() const
Definition: window2.cxx:1128
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
void SetQuickHelpText(const OUString &rHelpText)
Definition: window2.cxx:1252
void SetType(WindowType nType)
Definition: window2.cxx:994
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:937
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
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:403
ImplSVWinData * mpWinData
Definition: svdata.hxx:400
::Color maMenuBarHighlightTextColor
Definition: svdata.hxx:318
bool mbNoSaveFocus
Definition: svdata.hxx:267
VclPtr< vcl::Window > mpFocusWin
Definition: svdata.hxx:251
bool mbNoDeactivate
Definition: svdata.hxx:266
Link< MenuBarButtonCallbackArg &, bool > m_aSelectLink
vcl::KeyCode aAccelKey
VclPtr< Menu > pSubMenu
OUString sIdent
MenuItemBits nBits
OUString aHelpId
OUString aHelpText
OUString aCommandStr
OUString aHelpCommandStr
OUString aText
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77
OUString VclResId(TranslateId aId)
Definition: svdata.cxx:261
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