LibreOffice Module vcl (master)  1
menufloatingwindow.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 "menufloatingwindow.hxx"
21 #include "menuitemlist.hxx"
22 #include "menubarwindow.hxx"
23 #include "bufferdevice.hxx"
24 
25 #include <sal/log.hxx>
26 #include <salframe.hxx>
27 #include <svdata.hxx>
28 #include <vcl/decoview.hxx>
29 #include <vcl/settings.hxx>
30 #include <window.h>
31 
33  FloatingWindow( pParent, nStyle ),
34  pMenu(pMen),
35  nHighlightedItem(ITEMPOS_INVALID),
36  nMBDownPos(ITEMPOS_INVALID),
37  nScrollerHeight(0),
38  nFirstEntry(0),
39  nPosInParent(ITEMPOS_INVALID),
40  bInExecute(false),
41  bScrollMenu(false),
42  bScrollUp(false),
43  bScrollDown(false),
44  bIgnoreFirstMove(true),
45  bKeyInput(false)
46 {
47  mpWindowImpl->mbMenuFloatingWindow= true;
48 
49  ApplySettings(*this);
50 
51  SetPopupModeEndHdl( LINK( this, MenuFloatingWindow, PopupEnd ) );
52 
53  aHighlightChangedTimer.SetInvokeHandler( LINK( this, MenuFloatingWindow, HighlightChanged ) );
54  aHighlightChangedTimer.SetTimeout( GetSettings().GetMouseSettings().GetMenuDelay() );
55  aHighlightChangedTimer.SetDebugName( "vcl::MenuFloatingWindow aHighlightChangedTimer" );
56 
57  aSubmenuCloseTimer.SetTimeout( GetSettings().GetMouseSettings().GetMenuDelay() );
59  aSubmenuCloseTimer.SetDebugName( "vcl::MenuFloatingWindow aSubmenuCloseTimer" );
60 
62  aScrollTimer.SetDebugName( "vcl::MenuFloatingWindow aScrollTimer" );
63 
64  AddEventListener( LINK( this, MenuFloatingWindow, ShowHideListener ) );
65 }
66 
68 {
69  if( !pMenu )
70  return;
71 
72  // #105373# notify toolkit that highlight was removed
73  // otherwise the entry will not be read when the menu is opened again
77  {
78  // #102461# remove highlight in parent
79  size_t i, nCount = pMenu->pStartedFrom->pItemList->size();
80  for(i = 0; i < nCount; i++)
81  {
82  MenuItemData* pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );
83  if( pData && ( pData->pSubMenu == pMenu ) )
84  break;
85  }
86  if( i < nCount )
87  {
89  if (pPWin)
90  pPWin->InvalidateItem(i);
91  }
92  }
93 
94  // free the reference to the accessible component
95  SetAccessible( css::uno::Reference< css::accessibility::XAccessible >() );
96 
98 
99  // #95056# invalidate screen area covered by system window
100  // so this can be taken into account if the commandhandler performs a scroll operation
101  if( GetParent() )
102  {
104  GetParent()->Invalidate( aInvRect );
105  }
106  pMenu = nullptr;
107  RemoveEventListener( LINK( this, MenuFloatingWindow, ShowHideListener ) );
108 
109  aScrollTimer.Stop();
114 
115 }
116 
118 {
119  disposeOnce();
120 }
121 
123 {
124  doShutdown();
125  pMenu.clear();
129 }
130 
132 {
133  InitMenuClipRegion(*this); // FIXME
134 }
135 
137 {
138  FloatingWindow::ApplySettings(rRenderContext);
139 
142  {
143  AllSettings aSettings(GetSettings());
144  ImplGetFrame()->UpdateSettings(aSettings); // Update theme colors.
145  StyleSettings aStyle(aSettings.GetStyleSettings());
146  Color aHighlightTextColor = ImplGetSVData()->maNWFData.maMenuBarHighlightTextColor;
147  if (aHighlightTextColor != COL_TRANSPARENT)
148  {
149  aStyle.SetMenuHighlightTextColor(aHighlightTextColor);
150  }
151  aSettings.SetStyleSettings(aStyle);
152  OutputDevice::SetSettings(aSettings);
153  }
154 
155  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
156  SetPointFont(rRenderContext, rStyleSettings.GetMenuFont());
157 
159  {
160  rRenderContext.SetBackground(); // background will be drawn by NWF
161  }
162  else
163  rRenderContext.SetBackground(Wallpaper(rStyleSettings.GetMenuColor()));
164 
165  rRenderContext.SetTextColor(rStyleSettings.GetMenuTextColor());
166  rRenderContext.SetTextFillColor();
167  rRenderContext.SetLineColor();
168 }
169 
172 {
173  long nY = 0;
174  if( pMenu )
175  {
176  // avoid crash if somehow menu got disposed, and MenuItemList is empty (workaround for tdf#104686)
177  if ( nFirstEntry > 0 && !pMenu->GetItemList()->GetDataFromPos(nFirstEntry - 1) )
178  {
179  return 0;
180  }
181 
182  for ( sal_uInt16 n = 0; n < nFirstEntry; n++ )
183  nY += pMenu->GetItemList()->GetDataFromPos( n )->aSz.Height();
184  nY -= pMenu->GetTitleHeight();
185  }
186  return -nY;
187 }
188 
190 {
191  Size aOutSz = GetOutputSizePixel();
192  tools::Rectangle aRect( Point(), aOutSz );
193  aRect.AdjustTop(nScrollerHeight );
194  aRect.AdjustBottom( -nScrollerHeight );
195 
196  vcl::Region aRegion(aRect);
197 
198  return aRegion;
199 }
200 
202 {
203  if (IsScrollMenu())
204  {
205  rRenderContext.SetClipRegion(ImplCalcClipRegion());
206  }
207  else
208  {
209  rRenderContext.SetClipRegion();
210  }
211 }
212 
213 void MenuFloatingWindow::ImplHighlightItem( const MouseEvent& rMEvt, bool bMBDown )
214 {
215  if( ! pMenu )
216  return;
217 
218  long nY = GetInitialItemY();
219  long nMouseY = rMEvt.GetPosPixel().Y();
220  Size aOutSz = GetOutputSizePixel();
221  if ( ( nMouseY >= nY ) && ( nMouseY < aOutSz.Height() ) )
222  {
223  bool bHighlighted = false;
224  size_t nCount = pMenu->pItemList->size();
225  for ( size_t n = 0; !bHighlighted && ( n < nCount ); n++ )
226  {
227  if ( pMenu->ImplIsVisible( n ) )
228  {
229  MenuItemData* pItemData = pMenu->pItemList->GetDataFromPos( n );
230  long nOldY = nY;
231  nY += pItemData->aSz.Height();
232  if ( ( nOldY <= nMouseY ) && ( nY > nMouseY ) && pMenu->ImplIsSelectable( n ) )
233  {
234  bool bPopupArea = true;
235  if ( pItemData->nBits & MenuItemBits::POPUPSELECT )
236  {
237  // only when clicked over the arrow...
238  Size aSz = GetOutputSizePixel();
239  long nFontHeight = GetTextHeight();
240  bPopupArea = ( rMEvt.GetPosPixel().X() >= ( aSz.Width() - nFontHeight - nFontHeight/4 ) );
241  }
242 
243  if ( bMBDown )
244  {
245  if ( n != nHighlightedItem )
246  {
247  ChangeHighlightItem( static_cast<sal_uInt16>(n), false );
248  }
249 
250  bool bAllowNewPopup = true;
251  if ( pActivePopup )
252  {
253  MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
254  bAllowNewPopup = pData && ( pData->pSubMenu != pActivePopup );
255  if ( bAllowNewPopup )
256  KillActivePopup();
257  }
258 
259  if ( bPopupArea && bAllowNewPopup )
260  {
261  HighlightChanged( nullptr );
262  }
263  }
264  else
265  {
266  if ( n != nHighlightedItem )
267  {
268  ChangeHighlightItem( static_cast<sal_uInt16>(n), true );
269  }
270  else if ( pItemData->nBits & MenuItemBits::POPUPSELECT )
271  {
272  if ( bPopupArea && ( pActivePopup != pItemData->pSubMenu ) )
273  HighlightChanged( nullptr );
274  }
275  }
276  bHighlighted = true;
277  }
278  }
279  }
280  if ( !bHighlighted )
282  }
283  else
284  {
285  ImplScroll( rMEvt.GetPosPixel() );
287  }
288 }
289 
291 {
292  // "this" will be deleted before the end of this method!
293  Menu* pM = pMenu;
294  if ( bInExecute )
295  {
296  End();
297  if ( pActivePopup )
298  {
299  KillActivePopup(); // should be ok to just remove it
300  //pActivePopup->bCanceled = true;
301  }
302  pMenu->bInCallback = true;
303  pMenu->Deactivate();
304  pMenu->bInCallback = false;
305  }
306  else
307  {
308  if (pMenu && pMenu->pStartedFrom)
309  pMenu->pStartedFrom->ClosePopup(pMenu);
310  }
311 
312  if ( pM )
313  pM->pStartedFrom = nullptr;
314 }
315 
317 {
318  ImplScroll( GetPointerPosPixel() );
319 }
320 
321 IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer, void )
322 {
323  if( ! pMenu )
324  return;
325 
326  MenuItemData* pItemData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
327  if ( pItemData )
328  {
329  if ( pActivePopup && ( pActivePopup != pItemData->pSubMenu ) )
330  {
331  FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
332  SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
333  KillActivePopup();
334  SetPopupModeFlags( nOldFlags );
335  }
336  if ( pItemData->bEnabled && pItemData->pSubMenu && pItemData->pSubMenu->GetItemCount() && ( pItemData->pSubMenu != pActivePopup ) )
337  {
338  pActivePopup = static_cast<PopupMenu*>(pItemData->pSubMenu.get());
339  long nY = nScrollerHeight+ImplGetStartY();
340  MenuItemData* pData = nullptr;
341  for ( sal_uLong n = 0; n < nHighlightedItem; n++ )
342  {
343  pData = pMenu->pItemList->GetDataFromPos( n );
344  nY += pData->aSz.Height();
345  }
346  pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
347  Size MySize = GetOutputSizePixel();
348  Point aItemTopLeft( 0, nY );
349  Point aItemBottomRight( aItemTopLeft );
350  aItemBottomRight.AdjustX(MySize.Width() );
351  aItemBottomRight.AdjustY(pData->aSz.Height() );
352 
353  // shift the popups a little
354  aItemTopLeft.AdjustX(2 );
355  aItemBottomRight.AdjustX( -2 );
356  if ( nHighlightedItem )
357  aItemTopLeft.AdjustY( -2 );
358  else
359  {
360  sal_Int32 nL, nT, nR, nB;
361  GetBorder( nL, nT, nR, nB );
362  aItemTopLeft.AdjustY( -nT );
363  }
364 
365  // pTest: crash due to Reschedule() in call of Activate()
366  // Also it is prevented that submenus are displayed which
367  // were for long in Activate Rescheduled and which should not be
368  // displayed now.
369  Menu* pTest = pActivePopup;
370  FloatWinPopupFlags nOldFlags = GetPopupModeFlags();
371  SetPopupModeFlags( GetPopupModeFlags() | FloatWinPopupFlags::NoAppFocusClose );
372  sal_uInt16 nRet = pActivePopup->ImplExecute( this, tools::Rectangle( aItemTopLeft, aItemBottomRight ), FloatWinPopupFlags::Right, pMenu, pTimer == nullptr );
373  SetPopupModeFlags( nOldFlags );
374 
375  // nRet != 0, if it was stopped during Activate()...
376  if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() )
377  pActivePopup->ImplGetFloatingWindow()->AddPopupModeWindow( this );
378  }
379  }
380 }
381 
382 IMPL_LINK_NOARG(MenuFloatingWindow, SubmenuClose, Timer *, void)
383 {
384  if( pMenu && pMenu->pStartedFrom )
385  {
386  MenuFloatingWindow* pWin = static_cast<MenuFloatingWindow*>(pMenu->pStartedFrom->GetWindow());
387  if( pWin )
388  pWin->KillActivePopup();
389  }
390 }
391 
392 IMPL_LINK( MenuFloatingWindow, ShowHideListener, VclWindowEvent&, rEvent, void )
393 {
394  if( ! pMenu )
395  return;
396 
397  if( rEvent.GetId() == VclEventId::WindowShow )
398  pMenu->ImplCallEventListeners( VclEventId::MenuShow, ITEMPOS_INVALID );
399  else if( rEvent.GetId() == VclEventId::WindowHide )
400  pMenu->ImplCallEventListeners( VclEventId::MenuHide, ITEMPOS_INVALID );
401 }
402 
404 {
405  bScrollMenu = b;
406  nScrollerHeight = b ? static_cast<sal_uInt16>(GetSettings().GetStyleSettings().GetScrollBarSize()) /2 : 0;
407  bScrollDown = true;
408  InitMenuClipRegion(*this);
409 }
410 
412 {
413  if (bInExecute)
414  return;
415  bInExecute = true;
416  if (GetParent())
418 }
419 
421 {
422  if (HasChildPathFocus())
423  return true;
424  PopupMenu* pSub = GetActivePopup();
425  if (!pSub)
426  return false;
427  return pSub->ImplGetFloatingWindow()->HasChildPathFocus();
428 }
429 
431 {
432  if (!bInExecute)
433  return;
434 
435  if (GetParent() && !GetParent()->IsDisposed())
437 
438  // restore focus to previous window if we still have the focus
440  xSaveFocusId = nullptr;
441  if (xFocusId != nullptr && MenuInHierarchyHasFocus())
442  {
444  Window::EndSaveFocus(xFocusId);
445  }
446 
447  bInExecute = false;
448 }
449 
451 {
452  ImplSVData* pSVData = ImplGetSVData();
453 
454  pSVData->maAppData.mpActivePopupMenu = static_cast<PopupMenu*>(pMenu.get());
455 
456  Start();
457 
458  while (bInExecute)
460 
461  pSVData->maAppData.mpActivePopupMenu = nullptr;
462 }
463 
465 {
466  End();
467 
469 
471  if (pActivePopup)
472  {
473  KillActivePopup();
474  }
475  // notify parent, needed for accessibility
476  if( pMenu && pMenu->pStartedFrom )
478 }
479 
481 {
482  if ( pActivePopup && ( !pThisOnly || ( pThisOnly == pActivePopup ) ) )
483  {
484  if( pActivePopup->pWindow )
485  if( static_cast<FloatingWindow *>(pActivePopup->pWindow.get())->IsInCleanUp() )
486  return; // kill it later
487  if ( pActivePopup->bInCallback )
488  pActivePopup->bCanceled = true;
489 
490  // For all actions pActivePopup = 0, if e.g.
491  // PopupModeEndHdl the popups to destroy were called synchronous
492  PopupMenu* pPopup = pActivePopup;
493  pActivePopup = nullptr;
494  pPopup->bInCallback = true;
495  pPopup->Deactivate();
496  pPopup->bInCallback = false;
497  if ( pPopup->ImplGetWindow() )
498  {
499  pPopup->ImplGetFloatingWindow()->StopExecute();
500  pPopup->ImplGetFloatingWindow()->doShutdown();
501  pPopup->pWindow->SetParentToDefaultWindow();
502  pPopup->pWindow.disposeAndClear();
503 
504  Update();
505  }
506  }
507 }
508 
510 {
511  Menu* pStart = pMenu ? pMenu->ImplGetStartMenu() : nullptr;
512 
513  // if started elsewhere, cleanup there as well
514  MenuFloatingWindow* pCleanUpFrom = this;
515  MenuFloatingWindow* pWin = this;
516  while (pWin && !pWin->bInExecute &&
517  pWin->pMenu->pStartedFrom && !pWin->pMenu->pStartedFrom->IsMenuBar())
518  {
519  pWin = static_cast<PopupMenu*>(pWin->pMenu->pStartedFrom.get())->ImplGetFloatingWindow();
520  }
521  if ( pWin )
522  pCleanUpFrom = pWin;
523 
524  // this window will be destroyed => store date locally...
525  Menu* pM = pMenu;
526  sal_uInt16 nItem = nHighlightedItem;
527 
528  pCleanUpFrom->StopExecute();
529 
530  if ( nItem != ITEMPOS_INVALID && pM )
531  {
532  MenuItemData* pItemData = pM->GetItemList()->GetDataFromPos( nItem );
533  if ( pItemData && !pItemData->bIsTemporary )
534  {
535  pM->nSelectedId = pItemData->nId;
536  pM->sSelectedIdent = pItemData->sIdent;
537  if (pStart)
538  {
539  pStart->nSelectedId = pItemData->nId;
540  pStart->sSelectedIdent = pItemData->sIdent;
541  }
542 
543  pM->ImplSelect();
544  }
545  }
546 }
547 
548 void MenuFloatingWindow::EndExecute( sal_uInt16 nId )
549 {
550  size_t nPos;
551  if ( pMenu && pMenu->GetItemList()->GetData( nId, nPos ) )
552  nHighlightedItem = nPos;
553  else
555 
556  EndExecute();
557 }
558 
560 {
561  // TH creates a ToTop on this window, but the active popup
562  // should stay on top...
563  // due to focus change this would close all menus -> don't do it (#94123)
564  //if ( pActivePopup && pActivePopup->ImplGetWindow() && !pActivePopup->ImplGetFloatingWindow()->pActivePopup )
565  // pActivePopup->ImplGetFloatingWindow()->ToTop( ToTopFlags::NoGrabFocus );
566 
567  ImplHighlightItem( rMEvt, true );
568 
570 }
571 
573 {
575  // nMBDownPos store in local variable and reset immediately,
576  // as it will be too late after EndExecute
577  sal_uInt16 _nMBDownPos = nMBDownPos;
579  if ( pData && pData->bEnabled && ( pData->eType != MenuItemType::SEPARATOR ) )
580  {
581  if ( !pData->pSubMenu )
582  {
583  EndExecute();
584  }
585  else if ( ( pData->nBits & MenuItemBits::POPUPSELECT ) && ( nHighlightedItem == _nMBDownPos ) && ( rMEvt.GetClicks() == 2 ) )
586  {
587  // not when clicked over the arrow...
588  Size aSz = GetOutputSizePixel();
589  long nFontHeight = GetTextHeight();
590  if ( rMEvt.GetPosPixel().X() < ( aSz.Width() - nFontHeight - nFontHeight/4 ) )
591  EndExecute();
592  }
593  }
594 
595 }
596 
598 {
599  if ( !IsVisible() || rMEvt.IsSynthetic() || rMEvt.IsEnterWindow() )
600  return;
601 
602  if ( rMEvt.IsLeaveWindow() )
603  {
604  // #102461# do not remove highlight if a popup menu is open at this position
605  MenuItemData* pData = pMenu ? pMenu->pItemList->GetDataFromPos( nHighlightedItem ) : nullptr;
606  // close popup with some delayed if we leave somewhere else
607  if( pActivePopup && pData && pData->pSubMenu != pActivePopup )
609 
610  if( !pActivePopup || (pData && pData->pSubMenu != pActivePopup ) )
612 
613  if ( IsScrollMenu() )
614  ImplScroll( rMEvt.GetPosPixel() );
615  }
616  else
617  {
619  if( bIgnoreFirstMove )
620  bIgnoreFirstMove = false;
621  else
622  ImplHighlightItem( rMEvt, false );
623  }
624 }
625 
627 {
628  KillActivePopup();
629  Update();
630 
631  if (!pMenu)
632  return;
633 
634  Invalidate();
635 
637 
638  if ( bScrollUp && bUp )
639  {
641  SAL_WARN_IF( nFirstEntry == ITEMPOS_INVALID, "vcl", "Scroll?!" );
642 
643  // avoid crash if somehow menu got disposed, and MenuItemList is empty (workaround for tdf#104686)
644  const auto pItemData = pMenu->GetItemList()->GetDataFromPos( nFirstEntry );
645  if ( pItemData )
646  {
647  long nScrollEntryHeight = pItemData->aSz.Height();
648 
649  if ( !bScrollDown )
650  {
651  bScrollDown = true;
652  Invalidate();
653  }
654 
656  {
657  bScrollUp = false;
658  Invalidate();
659  }
660 
661  Scroll( 0, nScrollEntryHeight, ImplCalcClipRegion().GetBoundRect(), ScrollFlags::Clip );
662  }
663  }
664  else if ( bScrollDown && !bUp )
665  {
666  // avoid crash if somehow menu got disposed, and MenuItemList is empty (workaround for tdf#104686)
667  const auto pItemData = pMenu->GetItemList()->GetDataFromPos( nFirstEntry );
668  if ( pItemData )
669  {
670  long nScrollEntryHeight = pItemData->aSz.Height();
671 
673  SAL_WARN_IF( nFirstEntry == ITEMPOS_INVALID, "vcl", "Scroll?!" );
674 
675  if ( !bScrollUp )
676  {
677  bScrollUp = true;
678  Invalidate();
679  }
680 
681  long nHeight = GetOutputSizePixel().Height();
682  sal_uInt16 nLastVisible;
683  static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( nHeight, nFirstEntry, &nLastVisible );
684  if ( pMenu->ImplGetNextVisible( nLastVisible ) == ITEMPOS_INVALID )
685  {
686  bScrollDown = false;
687  Invalidate();
688  }
689 
690  Scroll( 0, -nScrollEntryHeight, ImplCalcClipRegion().GetBoundRect(), ScrollFlags::Clip );
691  }
692  }
693 
694  Invalidate();
695 }
696 
697 void MenuFloatingWindow::ImplScroll( const Point& rMousePos )
698 {
699  Size aOutSz = GetOutputSizePixel();
700 
701  long nY = nScrollerHeight;
702  long nMouseY = rMousePos.Y();
703  long nDelta = 0;
704 
705  if ( bScrollUp && ( nMouseY < nY ) )
706  {
707  ImplScroll( true );
708  nDelta = nY - nMouseY;
709  }
710  else if ( bScrollDown && ( nMouseY > ( aOutSz.Height() - nY ) ) )
711  {
712  ImplScroll( false );
713  nDelta = nMouseY - ( aOutSz.Height() - nY );
714  }
715 
716  if ( nDelta )
717  {
718  aScrollTimer.Stop(); // if scrolled through MouseMove.
719  long nTimeout;
720  if ( nDelta < 3 )
721  nTimeout = 200;
722  else if ( nDelta < 5 )
723  nTimeout = 100;
724  else if ( nDelta < 8 )
725  nTimeout = 70;
726  else if ( nDelta < 12 )
727  nTimeout = 40;
728  else
729  nTimeout = 20;
730  aScrollTimer.SetTimeout( nTimeout );
732  }
733 }
734 void MenuFloatingWindow::ChangeHighlightItem( sal_uInt16 n, bool bStartPopupTimer )
735 {
736  // #57934# if necessary, immediately close the active, as TH's backgroundstorage works.
737  // #65750# we prefer to refrain from the background storage of small lines.
738  // otherwise the menus are difficult to operate.
739  // MenuItemData* pNextData = pMenu->pItemList->GetDataFromPos( n );
740  // if ( pActivePopup && pNextData && ( pActivePopup != pNextData->pSubMenu ) )
741  // KillActivePopup();
742 
744  if( ! pMenu )
745  return;
746 
748  {
751  }
752 
753  nHighlightedItem = n;
754  SAL_WARN_IF( !pMenu->ImplIsVisible( nHighlightedItem ) && nHighlightedItem != ITEMPOS_INVALID, "vcl", "ChangeHighlightItem: Not visible!" );
756  {
758  {
759  // #102461# make sure parent entry is highlighted as well
760  size_t i, nCount = pMenu->pStartedFrom->pItemList->size();
761  for(i = 0; i < nCount; i++)
762  {
763  MenuItemData* pData = pMenu->pStartedFrom->pItemList->GetDataFromPos( i );
764  if( pData && ( pData->pSubMenu == pMenu ) )
765  break;
766  }
767  if( i < nCount )
768  {
770  if( pPWin && pPWin->nHighlightedItem != i )
771  {
772  pPWin->InvalidateItem(i);
773  pPWin->nHighlightedItem = i;
774  }
775  }
776  }
779  }
780  else
781  {
782  pMenu->nSelectedId = 0;
783  pMenu->sSelectedIdent.clear();
784  }
785 
786  if ( bStartPopupTimer )
787  {
788  // #102438# Menu items are not selectable
789  // If a menu item is selected by an AT-tool via the XAccessibleAction, XAccessibleValue
790  // or XAccessibleSelection interface, and the parent popup menus are not executed yet,
791  // the parent popup menus must be executed SYNCHRONOUSLY, before the menu item is selected.
792  if ( GetSettings().GetMouseSettings().GetMenuDelay() )
794  else
795  HighlightChanged( &aHighlightChangedTimer );
796  }
797 }
798 
801 long MenuFloatingWindow::GetInitialItemY(long *pStartY) const
802 {
803  long nStartY = ImplGetStartY();
804  if (pStartY)
805  *pStartY = nStartY;
806  return nScrollerHeight + nStartY +
808 }
809 
812 {
813  if (!pMenu)
814  return;
815 
816  long nY = GetInitialItemY();
817  size_t nCount = pMenu->pItemList->size();
818  for (size_t n = 0; n < nCount; n++)
819  {
820  MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
821  long nHeight = pData->aSz.Height();
822  if (n == nPos)
823  {
824  Size aWidth( GetSizePixel() );
825  tools::Rectangle aRect(Point(0, nY), Size(aWidth.Width(), nHeight));
826  Invalidate( aRect );
827  }
828  nY += nHeight;
829  }
830 }
831 
832 void MenuFloatingWindow::RenderHighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos)
833 {
834  if (!pMenu)
835  return;
836 
837  Size aSz(GetOutputSizePixel());
838 
839  long nX = 0;
840  long nStartY;
841  long nY = GetInitialItemY(&nStartY);
842 
843  int nOuterSpaceX = ImplGetSVData()->maNWFData.mnMenuFormatBorderX;
844 
845  size_t nCount = pMenu->pItemList->size();
846  for (size_t n = 0; n < nCount; n++)
847  {
848  MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
849  if (n == nPos)
850  {
851  SAL_WARN_IF(!pMenu->ImplIsVisible(n), "vcl", "Highlight: Item not visible!");
852  if (pData->eType != MenuItemType::SEPARATOR)
853  {
854  bool bRestoreLineColor = false;
855  Color oldLineColor;
856  bool bDrawItemRect = true;
857 
858  tools::Rectangle aItemRect(Point(nX + nOuterSpaceX, nY), Size(aSz.Width() - 2 * nOuterSpaceX, pData->aSz.Height()));
859  if (pData->nBits & MenuItemBits::POPUPSELECT)
860  {
861  long nFontHeight = GetTextHeight();
862  aItemRect.AdjustRight( -(nFontHeight + nFontHeight / 4) );
863  }
864 
866  {
867  Size aPxSize(GetOutputSizePixel());
868  rRenderContext.Push(PushFlags::CLIPREGION);
869  rRenderContext.IntersectClipRegion(tools::Rectangle(Point(nX, nY), Size(aSz.Width(), pData->aSz.Height())));
870  tools::Rectangle aCtrlRect(Point(nX, 0), Size(aPxSize.Width()-nX, aPxSize.Height()));
871  MenupopupValue aVal(pMenu->nTextPos-GUTTERBORDER, aItemRect);
873  aCtrlRect, ControlState::ENABLED, aVal, OUString());
875  {
876  bDrawItemRect = false;
877  if (!rRenderContext.DrawNativeControl(ControlType::MenuPopup, ControlPart::MenuItem, aItemRect,
881  aVal, OUString()))
882  {
883  bDrawItemRect = true;
884  }
885  }
886  else
887  bDrawItemRect = true;
888  rRenderContext.Pop();
889  }
890  if (bDrawItemRect)
891  {
892  if (pData->bEnabled)
893  rRenderContext.SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
894  else
895  {
896  rRenderContext.SetFillColor();
897  oldLineColor = rRenderContext.GetLineColor();
898  rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuHighlightColor());
899  bRestoreLineColor = true;
900  }
901 
902  rRenderContext.DrawRect(aItemRect);
903  }
904  pMenu->ImplPaint(rRenderContext, GetOutputSizePixel(), nScrollerHeight, nStartY, pData, true/*bHighlight*/);
905  if (bRestoreLineColor)
906  rRenderContext.SetLineColor(oldLineColor);
907  }
908  return;
909  }
910 
911  nY += pData->aSz.Height();
912  }
913 }
914 
916 {
917  if( ! pMenu )
918  return tools::Rectangle();
919 
920  tools::Rectangle aRect;
921  Size aSz = GetOutputSizePixel();
922  long nStartY = ImplGetStartY();
923  long nY = nScrollerHeight+nStartY;
924 
925  size_t nCount = pMenu->pItemList->size();
926  for ( size_t n = 0; n < nCount; n++ )
927  {
928  MenuItemData* pData = pMenu->pItemList->GetDataFromPos( n );
929  if ( n == nPos )
930  {
931  SAL_WARN_IF( !pMenu->ImplIsVisible( n ), "vcl", "ImplGetItemRect: Item not visible!" );
932  if ( pData->eType != MenuItemType::SEPARATOR )
933  {
934  aRect = tools::Rectangle( Point( 0, nY ), Size( aSz.Width(), pData->aSz.Height() ) );
935  if ( pData->nBits & MenuItemBits::POPUPSELECT )
936  {
937  long nFontHeight = GetTextHeight();
938  aRect.AdjustRight( -(nFontHeight + nFontHeight/4) );
939  }
940  }
941  break;
942  }
943  nY += pData->aSz.Height();
944  }
945  return aRect;
946 }
947 
948 void MenuFloatingWindow::ImplCursorUpDown( bool bUp, bool bHomeEnd )
949 {
950  if( ! pMenu )
951  return;
952 
953  const StyleSettings& rSettings = GetSettings().GetStyleSettings();
954 
955  sal_uInt16 n = nHighlightedItem;
956  if ( n == ITEMPOS_INVALID )
957  {
958  if ( bUp )
959  n = 0;
960  else
961  n = pMenu->GetItemCount()-1;
962  }
963 
964  sal_uInt16 nLoop = n;
965 
966  if( bHomeEnd )
967  {
968  // absolute positioning
969  if( bUp )
970  {
971  n = pMenu->GetItemCount();
972  nLoop = n-1;
973  }
974  else
975  {
976  n = sal_uInt16(-1);
977  nLoop = n+1;
978  }
979  }
980 
981  do
982  {
983  if ( bUp )
984  {
985  if ( n )
986  n--;
987  else
988  if ( !IsScrollMenu() || ( nHighlightedItem == ITEMPOS_INVALID ) )
989  n = pMenu->GetItemCount()-1;
990  else
991  break;
992  }
993  else
994  {
995  n++;
996  if ( n >= pMenu->GetItemCount() )
997  {
998  if ( !IsScrollMenu() || ( nHighlightedItem == ITEMPOS_INVALID ) )
999  n = 0;
1000  else
1001  break;
1002  }
1003  }
1004 
1005  MenuItemData* pData = pMenu->GetItemList()->GetDataFromPos( n );
1006  if ( ( pData->bEnabled || !rSettings.GetSkipDisabledInMenus() )
1007  && ( pData->eType != MenuItemType::SEPARATOR ) && pMenu->ImplIsVisible( n ) && pMenu->ImplIsSelectable( n ) )
1008  {
1009  // Is selection in visible area?
1010  if ( IsScrollMenu() )
1011  {
1013 
1014  while ( n < nFirstEntry )
1015  ImplScroll( true );
1016 
1017  Size aOutSz = GetOutputSizePixel();
1018  sal_uInt16 nLastVisible;
1019  static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
1020  while ( n > nLastVisible )
1021  {
1022  ImplScroll( false );
1023  static_cast<PopupMenu*>(pMenu.get())->ImplCalcVisEntries( aOutSz.Height(), nFirstEntry, &nLastVisible );
1024  }
1025  }
1026  ChangeHighlightItem( n, false );
1027  break;
1028  }
1029  } while ( n != nLoop );
1030 }
1031 
1033 {
1034  VclPtr<vcl::Window> xWindow = this;
1035 
1036  bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
1037  sal_uInt16 nCode = rKEvent.GetKeyCode().GetCode();
1038  bKeyInput = true;
1039  switch ( nCode )
1040  {
1041  case KEY_UP:
1042  case KEY_DOWN:
1043  {
1044  ImplCursorUpDown( nCode == KEY_UP );
1045  }
1046  break;
1047  case KEY_END:
1048  case KEY_HOME:
1049  {
1050  ImplCursorUpDown( nCode == KEY_END, true );
1051  }
1052  break;
1053  case KEY_F6:
1054  case KEY_ESCAPE:
1055  {
1056  // Ctrl-F6 acts like ESC here, the menu bar however will then put the focus in the document
1057  if( nCode == KEY_F6 && !rKEvent.GetKeyCode().IsMod1() )
1058  break;
1059  if( pMenu )
1060  {
1061  if ( !pMenu->pStartedFrom )
1062  {
1063  StopExecute();
1064  KillActivePopup();
1065  }
1066  else if (pMenu->pStartedFrom->IsMenuBar())
1067  {
1068  pMenu->pStartedFrom->MenuBarKeyInput(rKEvent);
1069  }
1070  else
1071  {
1072  StopExecute();
1073  PopupMenu* pPopupMenu = static_cast<PopupMenu*>(pMenu->pStartedFrom.get());
1074  MenuFloatingWindow* pFloat = pPopupMenu->ImplGetFloatingWindow();
1075  pFloat->GrabFocus();
1076  pFloat->KillActivePopup();
1077  pPopupMenu->ImplCallHighlight(pFloat->nHighlightedItem);
1078  }
1079  }
1080  }
1081  break;
1082  case KEY_LEFT:
1083  {
1084  if ( pMenu && pMenu->pStartedFrom )
1085  {
1086  StopExecute();
1087  if (pMenu->pStartedFrom->IsMenuBar())
1088  {
1089  pMenu->pStartedFrom->MenuBarKeyInput(rKEvent);
1090  }
1091  else
1092  {
1093  MenuFloatingWindow* pFloat = static_cast<PopupMenu*>(pMenu->pStartedFrom.get())->ImplGetFloatingWindow();
1094  pFloat->GrabFocus();
1095  pFloat->KillActivePopup();
1096  sal_uInt16 highlightItem = pFloat->GetHighlightedItem();
1097  pFloat->ChangeHighlightItem(highlightItem, false);
1098  }
1099  }
1100  }
1101  break;
1102  case KEY_RIGHT:
1103  {
1104  if( pMenu )
1105  {
1106  bool bDone = false;
1108  {
1110  if ( pData && pData->pSubMenu )
1111  {
1112  HighlightChanged( nullptr );
1113  bDone = true;
1114  }
1115  }
1116  if ( !bDone )
1117  {
1118  Menu* pStart = pMenu->ImplGetStartMenu();
1119  if (pStart && pStart->IsMenuBar())
1120  {
1121  // Forward...
1122  pStart->ImplGetWindow()->KeyInput( rKEvent );
1123  }
1124  }
1125  }
1126  }
1127  break;
1128  case KEY_RETURN:
1129  {
1130  if( pMenu )
1131  {
1133  if ( pData && pData->bEnabled )
1134  {
1135  if ( pData->pSubMenu )
1136  HighlightChanged( nullptr );
1137  else
1138  EndExecute();
1139  }
1140  else
1141  StopExecute();
1142  }
1143  }
1144  break;
1145  case KEY_MENU:
1146  {
1147  if( pMenu )
1148  {
1149  Menu* pStart = pMenu->ImplGetStartMenu();
1150  if (pStart && pStart->IsMenuBar())
1151  {
1152  // Forward...
1153  pStart->ImplGetWindow()->KeyInput( rKEvent );
1154  }
1155  }
1156  }
1157  break;
1158  default:
1159  {
1160  sal_Unicode nCharCode = rKEvent.GetCharCode();
1161  size_t nPos = 0;
1162  size_t nDuplicates = 0;
1163  MenuItemData* pData = (nCharCode && pMenu) ?
1164  pMenu->GetItemList()->SearchItem(nCharCode, rKEvent.GetKeyCode(), nPos, nDuplicates, nHighlightedItem) : nullptr;
1165  if (pData)
1166  {
1167  if ( pData->pSubMenu || nDuplicates > 1 )
1168  {
1169  ChangeHighlightItem( nPos, false );
1170  HighlightChanged( nullptr );
1171  }
1172  else
1173  {
1174  nHighlightedItem = nPos;
1175  EndExecute();
1176  }
1177  }
1178  else
1179  FloatingWindow::KeyInput( rKEvent );
1180  }
1181  }
1182 
1184  {
1185  MenuBar *pMenuBar = static_cast<MenuBar*>(pMenu->pStartedFrom.get());
1186  const bool bShowAccels = nCode != KEY_ESCAPE;
1187  if (pMenuBar->getMenuBarWindow()->GetMBWMenuKey() != bShowAccels)
1188  {
1189  pMenuBar->getMenuBarWindow()->SetMBWMenuKey(bShowAccels);
1190  pMenuBar->getMenuBarWindow()->SetMBWHideAccel(!bShowAccels);
1191  if (autoacc)
1193  }
1194  }
1195 
1196  // #105474# check if menu window was not destroyed
1197  if ( !xWindow->IsDisposed() )
1198  {
1199  bKeyInput = false;
1200  }
1201 }
1202 
1203 void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rPaintRect)
1204 {
1205  if (!pMenu)
1206  return;
1207 
1208  // Make sure that all actual rendering happens in one go to avoid flicker.
1209  vcl::BufferDevice pBuffer(this, rRenderContext);
1210 
1211  pBuffer->Push(PushFlags::CLIPREGION);
1212  pBuffer->SetClipRegion(vcl::Region(rPaintRect));
1213 
1215  {
1216  pBuffer->SetClipRegion();
1217  long nX = 0;
1218  Size aPxSize(GetOutputSizePixel());
1219  aPxSize.AdjustWidth( -nX );
1222  tools::Rectangle(Point(nX, 0), aPxSize), ControlState::ENABLED,
1223  aVal, OUString());
1224  InitMenuClipRegion(*pBuffer);
1225  }
1226  if (IsScrollMenu())
1227  {
1228  ImplDrawScroller(*pBuffer, true);
1229  ImplDrawScroller(*pBuffer, false);
1230  }
1231  pBuffer->SetFillColor(rRenderContext.GetSettings().GetStyleSettings().GetMenuColor());
1235 
1236  pBuffer->Pop();
1237 }
1238 
1240 {
1241  if (!pMenu)
1242  return;
1243 
1244  rRenderContext.SetClipRegion();
1245 
1246  Size aOutSz(GetOutputSizePixel());
1247  long nY = bUp ? 0 : (aOutSz.Height() - nScrollerHeight);
1248  long nX = 0;
1249  tools::Rectangle aRect(Point(nX, nY), Size(aOutSz.Width() - nX, nScrollerHeight));
1250 
1251  DecorationView aDecoView(&rRenderContext);
1253 
1255  if ((bUp && !bScrollUp) || (!bUp && !bScrollDown))
1256  nStyle |= DrawSymbolFlags::Disable;
1257 
1258  aDecoView.DrawSymbol(aRect, eSymbol, rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor(), nStyle);
1259 
1260  InitMenuClipRegion(rRenderContext);
1261 }
1262 
1264 {
1265  sal_uInt16 nId = nHighlightedItem;
1266  Menu* pM = pMenu;
1267  vcl::Window* pW = this;
1268 
1269  // #102618# Get item rect before destroying the window in EndExecute() call
1270  tools::Rectangle aHighlightRect( ImplGetItemRect( nHighlightedItem ) );
1271 
1272  if ( rHEvt.GetMode() & HelpEventMode::CONTEXT )
1273  {
1275  EndExecute();
1276  pW = nullptr;
1277  }
1278 
1279  if( !ImplHandleHelpEvent( pW, pM, nId, rHEvt, aHighlightRect ) )
1280  Window::RequestHelp( rHEvt );
1281 }
1282 
1284 {
1286 
1288  {
1289  ApplySettings(*this);
1290  Invalidate();
1291  }
1292 }
1293 
1295 {
1296  FloatingWindow::DataChanged( rDCEvt );
1297 
1298  if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1300  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1301  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1302  {
1303  ApplySettings(*this);
1304  Invalidate();
1305  }
1306 }
1307 
1309 {
1310  if ( rCEvt.GetCommand() == CommandEventId::Wheel )
1311  {
1312  const CommandWheelData* pData = rCEvt.GetWheelData();
1313  if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
1314  {
1315  ImplScroll( pData->GetDelta() > 0 );
1317  }
1318  }
1319 }
1320 
1321 css::uno::Reference<css::accessibility::XAccessible> MenuFloatingWindow::CreateAccessible()
1322 {
1323  css::uno::Reference<css::accessibility::XAccessible> xAcc;
1324 
1325  if (pMenu && !pMenu->pStartedFrom)
1326  xAcc = pMenu->GetAccessible();
1327 
1328  return xAcc;
1329 }
1330 
1331 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void StateChanged(StateChangedType nType) override
long Width() const
VclPtr< Menu > pSubMenu
void Deactivate()
Definition: menu.cxx:275
VclPtr< vcl::Window > xSaveFocusId
Point GetPointerPosPixel()
Definition: mouse.cxx:549
void RenderHighlightItem(vcl::RenderContext &rRenderContext, sal_uInt16 nPos)
void ImplHighlightItem(const MouseEvent &rMEvt, bool bMBDown)
void SetPopupModeEndHdl(const Link< FloatingWindow *, void > &rLink)
Definition: floatwin.hxx:152
void InvalidateItem(sal_uInt16 nPos)
Emit an Invalidate just for this item's area.
tools::Rectangle ImplGetItemRect(sal_uInt16 nPos)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible()
Definition: menu.cxx:1284
void ChangeHighlightItem(sal_uInt16 n, bool bStartPopupTimer)
VclPtr< PopupMenu > pActivePopup
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption)
Request rendering of a particular control and/or part.
SAL_DLLPRIVATE void ImplKillLayoutData() const
Definition: menu.cxx:2209
long AdjustWidth(long n)
int mnMenuFormatBorderX
Definition: svdata.hxx:267
long AdjustX(long nHorzMove)
const vcl::Font & GetMenuFont() const
virtual void StateChanged(StateChangedType nType) override
Definition: floatwin.cxx:626
MenuItemData * SearchItem(sal_Unicode cSelectChar, vcl::KeyCode aKeyCode, size_t &rPos, size_t &nDuplicates, size_t nCurrentPos) const
void SetStyleSettings(const StyleSettings &rSet)
long Height() const
void DecModalCount()
Definition: window.cxx:3609
bool mbNoDeactivate
Definition: svdata.hxx:216
ImplSVAppData maAppData
Definition: svdata.hxx:347
sal_uIntPtr sal_uLong
const StyleSettings & GetStyleSettings() const
VclPtr< PopupMenu > mpActivePopupMenu
Definition: svdata.hxx:143
ImplSVNWFData maNWFData
Definition: svdata.hxx:352
virtual Size GetSizePixel() const
Definition: window.cxx:2364
PopupMenu * GetActivePopup() 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
sal_Int16 nId
SAL_DLLPRIVATE void ImplCallEventListeners(VclEventId nEvent, sal_uInt16 nPos)
Definition: menu.cxx:371
void SetTextFillColor()
Definition: text.cxx:698
sal_uInt16 GetCode() const
Definition: keycod.hxx:53
DataChangedEventType GetType() const
Definition: event.hxx:348
void IntersectClipRegion(const tools::Rectangle &rRect)
virtual void Resize() override
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:213
const CommandWheelData * GetWheelData() const
const Color & GetMenuHighlightColor() const
#define KEY_LEFT
Definition: keycodes.hxx:112
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3008
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
HelpEventMode GetMode() const
Definition: event.hxx:192
VclPtr< Menu > pStartedFrom
Definition: menu.hxx:133
long AdjustBottom(long nVertMoveDelta)
MenuFloatingWindow(Menu *pMenu, vcl::Window *pParent, WinBits nStyle)
OString sSelectedIdent
Definition: menu.hxx:149
StateChangedType
Definition: window.hxx:311
sal_uInt16 nTextPos
Definition: menu.hxx:153
bool MenuInHierarchyHasFocus() const
sal_uInt16 GetClicks() const
Definition: event.hxx:120
sal_Int64 WinBits
sal_uInt16 sal_Unicode
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
sal_uInt16 GetTitleHeight() const
Definition: menu.hxx:339
void SetBackground()
long GetInitialItemY(long *pOptStartY=nullptr) const
Calculate the initial vertical pixel offset of the first item.
Buffers drawing on a vcl::RenderContext using a VirtualDevice.
SymbolType
Definition: vclenum.hxx:73
static void Yield()
Process the next event.
Definition: svapp.cxx:507
bool IsEnterWindow() const
Definition: event.hxx:122
Class that implements the actual window of the floating menu.
AllSettingsFlags GetFlags() const
Definition: event.hxx:349
void SetMBWMenuKey(bool val)
void SetAccessible(const css::uno::Reference< css::accessibility::XAccessible > &)
const Color & GetMenuTextColor() const
void IncModalCount()
Definition: window.cxx:3595
void KillActivePopup(PopupMenu *pThisOnly=nullptr)
bool mbAutoAccel
Definition: svdata.hxx:288
sal_uInt16 GetHighlightedItem() const
SAL_DLLPRIVATE sal_uInt16 ImplGetNextVisible(sal_uInt16 nPos) const
Definition: menu.cxx:622
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
const Color & GetMenuColor() const
void Update()
Definition: paint.cxx:1276
void SetMBWHideAccel(bool val)
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:67
void SetLineColor()
void clear()
Definition: vclptr.hxx:190
sal_uInt16 nId
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
bool IsLeaveWindow() const
Definition: event.hxx:124
std::unique_ptr< MenuItemList > pItemList
Definition: menu.hxx:132
long AdjustY(long nVertMove)
int mnMenuFormatBorderY
Definition: svdata.hxx:268
void InitMenuClipRegion(vcl::RenderContext &rRenderContext)
int i
CommandWheelMode GetMode() const
#define KEY_ESCAPE
Definition: keycodes.hxx:120
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1156
MenuItemType eType
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void SetFillColor()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
CommandEventId GetCommand() const
const Color & GetLineColor() const
Definition: outdev.hxx:618
sal_uInt16 GetModifier() const
SAL_DLLPRIVATE bool ImplIsSelectable(sal_uInt16 nPos) const
Definition: menu.cxx:1272
void SetTextColor(const Color &rColor)
Definition: text.cxx:663
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:511
DrawSymbolFlags
Definition: decoview.hxx:34
virtual void Start() override
Activates the timer task.
Definition: timer.cxx:83
void ImplScroll(const Point &rMousePos)
void ImplDrawScroller(vcl::RenderContext &rRenderContext, bool bUp)
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
vcl::Region ImplCalcClipRegion() const
virtual void UpdateSettings(AllSettings &rSettings)=0
SAL_DLLPRIVATE sal_uInt16 ImplGetPrevVisible(sal_uInt16 nPos) const
Definition: menu.cxx:612
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
SAL_DLLPRIVATE bool ImplIsVisible(sal_uInt16 nPos) const
Definition: menu.cxx:1189
MenuItemList * GetItemList() const
Definition: menu.hxx:350
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void SetTimeout(sal_uInt64 nTimeoutMs)
Definition: timer.cxx:89
virtual void RequestHelp(const HelpEvent &rHEvt) override
FloatWinPopupFlags
Definition: floatwin.hxx:31
void GrabFocus()
Definition: window.cxx:2980
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: floatwin.cxx:674
SAL_DLLPRIVATE Menu * ImplGetStartMenu()
Definition: menu.cxx:2097
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:889
vcl::Window * GetParent() const
Definition: window2.cxx:1086
virtual ~MenuFloatingWindow() override
long X() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
#define KEY_END
Definition: keycodes.hxx:115
SAL_DLLPRIVATE vcl::Window * ImplGetWindow() const
Definition: menu.hxx:213
SAL_DLLPRIVATE void ImplPaint(vcl::RenderContext &rRenderContext, Size const &rSize, sal_uInt16 nBorder, long nOffY=0, MenuItemData const *pThisDataOnly=nullptr, bool bHighlighted=false, bool bLayout=false, bool bRollover=false) const
Definition: menu.cxx:1712
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2136
SAL_DLLPRIVATE void ImplEndPopupMode(FloatWinPopupEndFlags nFlags, const VclPtr< vcl::Window > &xFocusId)
Definition: floatwin.cxx:813
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1768
ImplSVWinData maWinData
Definition: svdata.hxx:349
#define KEY_RETURN
Definition: keycodes.hxx:119
SAL_DLLPRIVATE void ImplSelect()
Definition: menu.cxx:318
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:302
void ImplCursorUpDown(bool bUp, bool bHomeEnd=false)
SalFrame * ImplGetFrame() const
Definition: window2.cxx:848
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:53
virtual void Scroll(long nHorzScroll, long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2944
MenuItemData * GetDataFromPos(size_t nPos) const
Definition: menu.hxx:121
virtual void MenuBarKeyInput(const KeyEvent &rEvent)
Forward the KeyInput call to the MenuBar.
Definition: menu.cxx:2205
#define KEY_DOWN
Definition: keycodes.hxx:110
OString sIdent
long AdjustRight(long nHorzMoveDelta)
void Stop()
Definition: scheduler.cxx:593
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
long GetDelta() const
bool IsSynthetic() const
Definition: event.hxx:126
const Color & GetButtonTextColor() const
#define SAL_WARN_IF(condition, area, stream)
virtual bool IsMenuBar() const =0
bool IsVisible() const
Definition: window2.cxx:1091
sal_Unicode GetCharCode() const
Definition: event.hxx:52
virtual void Command(const CommandEvent &rCEvt) override
sal_uInt16 GetItemCount() const
Definition: menu.cxx:586
sal_uInt16 nSelectedId
Definition: menu.hxx:148
bool IsMod1() const
Definition: keycod.hxx:60
MenuItemData * GetData(sal_uInt16 nSVId, size_t &rPos) const
long AdjustTop(long nVertMoveDelta)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
bool GetSkipDisabledInMenus() const
const Point & GetPosPixel() const
Definition: event.hxx:117
SAL_DLLPRIVATE MenuFloatingWindow * ImplGetFloatingWindow() const
Definition: menu.cxx:2682
bool IsDisposed() const
Definition: window.cxx:136
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: floatwin.cxx:184
#define KEY_F6
Definition: keycodes.hxx:88
#define KEY_HOME
Definition: keycodes.hxx:114
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
SAL_DLLPRIVATE void ImplCallHighlight(sal_uInt16 nHighlightItem)
Definition: menu.cxx:2105
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
Definition: event.cxx:307
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
Definition: decoview.cxx:805
Definition: timer.hxx:26
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
long GetScrollBarSize() const
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: floatwin.cxx:203
sal_Int32 nPos
virtual void KeyInput(const KeyEvent &rKEvent) override
::Color maMenuBarHighlightTextColor
Definition: svdata.hxx:269
long ImplGetStartY() const
Get a negative pixel offset for an offset menu.
bool IsInCleanUp() const
Definition: floatwin.hxx:148
#define KEY_RIGHT
Definition: keycodes.hxx:113
tools::Rectangle GetWindowExtentsRelative(vcl::Window *pRelativeWindow) const
Definition: window.cxx:2904
virtual void MouseMove(const MouseEvent &rMEvt) override
long Y() const
bool GetMBWMenuKey() const
void SetDebugName(const sal_Char *pDebugName)
Definition: task.hxx:81
MenuBarWindow * getMenuBarWindow()
Return the MenuBarWindow.
Definition: menu.cxx:2346
#define KEY_MENU
Definition: keycodes.hxx:147
#define KEY_UP
Definition: keycodes.hxx:111
MenuItemBits nBits