LCOV - code coverage report
Current view: top level - vcl/source/window - menuwindow.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 48 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "menuwindow.hxx"
      21             : #include "menuitemlist.hxx"
      22             : 
      23             : #include <vcl/help.hxx>
      24             : #include <vcl/menu.hxx>
      25             : #include <vcl/settings.hxx>
      26             : #include <vcl/svapp.hxx>
      27             : #include <vcl/window.hxx>
      28             : 
      29           0 : static sal_uLong ImplChangeTipTimeout( sal_uLong nTimeout, vcl::Window *pWindow )
      30             : {
      31           0 :     AllSettings aAllSettings( pWindow->GetSettings() );
      32           0 :     HelpSettings aHelpSettings( aAllSettings.GetHelpSettings() );
      33           0 :     sal_uLong nRet = aHelpSettings.GetTipTimeout();
      34           0 :     aHelpSettings.SetTipTimeout( nTimeout );
      35           0 :     aAllSettings.SetHelpSettings( aHelpSettings );
      36           0 :     pWindow->SetSettings( aAllSettings );
      37           0 :     return nRet;
      38             : }
      39             : 
      40           0 : bool MenuWindow::ImplHandleHelpEvent(vcl::Window* pMenuWindow, Menu* pMenu, sal_uInt16 nHighlightedItem,
      41             :         const HelpEvent& rHEvt, const Rectangle &rHighlightRect)
      42             : {
      43           0 :     if( ! pMenu )
      44           0 :         return false;
      45             : 
      46           0 :     bool bDone = false;
      47           0 :     sal_uInt16 nId = 0;
      48             : 
      49           0 :     if ( nHighlightedItem != ITEMPOS_INVALID )
      50             :     {
      51           0 :         MenuItemData* pItemData = pMenu->GetItemList()->GetDataFromPos( nHighlightedItem );
      52           0 :         if ( pItemData )
      53           0 :             nId = pItemData->nId;
      54             :     }
      55             : 
      56           0 :     if ( ( rHEvt.GetMode() & HelpEventMode::BALLOON ) && pMenuWindow )
      57             :     {
      58           0 :         Point aPos;
      59           0 :         if( rHEvt.KeyboardActivated() )
      60           0 :             aPos = rHighlightRect.Center();
      61             :         else
      62           0 :             aPos = rHEvt.GetMousePosPixel();
      63             : 
      64           0 :         Rectangle aRect( aPos, Size() );
      65           0 :         if (!pMenu->GetHelpText(nId).isEmpty())
      66           0 :             Help::ShowBalloon( pMenuWindow, aPos, pMenu->GetHelpText( nId ) );
      67             :         else
      68             :         {
      69             :             // give user a chance to read the full filename
      70           0 :             sal_uLong oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow );
      71             :             // call always, even when strlen==0 to correctly remove tip
      72           0 :             Help::ShowQuickHelp( pMenuWindow, aRect, pMenu->GetTipHelpText( nId ) );
      73           0 :             ImplChangeTipTimeout( oldTimeout, pMenuWindow );
      74             :         }
      75           0 :         bDone = true;
      76             :     }
      77           0 :     else if ( ( rHEvt.GetMode() &HelpEventMode::QUICK ) && pMenuWindow )
      78             :     {
      79           0 :         Point aPos = rHEvt.GetMousePosPixel();
      80           0 :         Rectangle aRect( aPos, Size() );
      81             :         // give user a chance to read the full filename
      82           0 :         sal_uLong oldTimeout=ImplChangeTipTimeout( 60000, pMenuWindow );
      83             :         // call always, even when strlen==0 to correctly remove tip
      84           0 :         Help::ShowQuickHelp( pMenuWindow, aRect, pMenu->GetTipHelpText( nId ) );
      85           0 :         ImplChangeTipTimeout( oldTimeout, pMenuWindow );
      86           0 :         bDone = true;
      87             :     }
      88           0 :     else if ( rHEvt.GetMode() & (HelpEventMode::CONTEXT | HelpEventMode::EXTENDED) )
      89             :     {
      90             :         // is help in the application selected
      91           0 :         Help* pHelp = Application::GetHelp();
      92           0 :         if ( pHelp )
      93             :         {
      94             :             // is an id available, then call help with the id, otherwise
      95             :             // use help-index
      96           0 :             OUString aCommand = pMenu->GetItemCommand( nId );
      97           0 :             OString aHelpId(  pMenu->GetHelpId( nId ) );
      98           0 :             if( aHelpId.isEmpty() )
      99           0 :                 aHelpId = OOO_HELP_INDEX;
     100             : 
     101           0 :             if ( !aCommand.isEmpty() )
     102           0 :                 pHelp->Start( aCommand, NULL );
     103             :             else
     104           0 :                 pHelp->Start( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ), NULL );
     105             :         }
     106           0 :         bDone = true;
     107             :     }
     108           0 :     return bDone;
     109             : }
     110             : 
     111             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11