LCOV - code coverage report
Current view: top level - include/vcl - keycod.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 51 0.0 %
Date: 2014-04-14 Functions: 0 18 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             : #ifndef INCLUDED_VCL_KEYCOD_HXX
      21             : #define INCLUDED_VCL_KEYCOD_HXX
      22             : 
      23             : #include <rtl/ustring.hxx>
      24             : #include <tools/resid.hxx>
      25             : #include <vcl/dllapi.h>
      26             : #include <vcl/keycodes.hxx>
      27             : #include <vcl/vclenum.hxx>
      28             : 
      29             : class Window;
      30             : 
      31             : class VCL_DLLPUBLIC KeyCode
      32             : {
      33             : private:
      34             :     sal_uInt16      nCode;
      35             :     KeyFuncType eFunc;
      36             : 
      37             : public:
      38           0 :                 KeyCode() { nCode = 0; eFunc = KEYFUNC_DONTKNOW; }
      39             :                 KeyCode( const ResId& rResId );
      40           0 :                 KeyCode( sal_uInt16 nKey, sal_uInt16 nModifier = 0 )
      41           0 :                     { nCode = nKey | nModifier; eFunc = KEYFUNC_DONTKNOW; }
      42             :                 KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 );
      43             :                 KeyCode( KeyFuncType eFunction );
      44             : 
      45           0 :     sal_uInt16      GetFullCode() const { return nCode; }
      46           0 :     KeyFuncType GetFullFunction() const { return eFunc; }
      47             :     bool        IsDefinedKeyCodeEqual( const KeyCode& rKeyCode ) const;
      48             : 
      49           0 :     sal_uInt16      GetCode() const
      50           0 :                     { return (nCode & KEY_CODE); }
      51             : 
      52           0 :     sal_uInt16      GetModifier() const
      53           0 :                     { return (nCode & KEY_MODTYPE); }
      54           0 :     sal_uInt16      GetAllModifier() const
      55           0 :                     { return (nCode & KEY_ALLMODTYPE); }
      56           0 :     bool        IsShift() const
      57           0 :                     { return ((nCode & KEY_SHIFT) != 0); }
      58           0 :     bool        IsMod1() const
      59           0 :                     { return ((nCode & KEY_MOD1) != 0); }
      60           0 :     bool        IsMod2() const
      61           0 :                     { return ((nCode & KEY_MOD2) != 0); }
      62           0 :     bool        IsMod3() const
      63           0 :                     { return ((nCode & KEY_MOD3) != 0); }
      64           0 :     sal_uInt16      GetGroup() const
      65           0 :                     { return (nCode & KEYGROUP_TYPE); }
      66             : 
      67             :     OUString        GetName( Window* pWindow = NULL ) const;
      68             : 
      69           0 :     bool        IsFunction() const
      70           0 :                     { return ((eFunc != KEYFUNC_DONTKNOW) ? true : false); }
      71             : 
      72             :     KeyFuncType GetFunction() const;
      73             : 
      74             :     KeyCode&    operator = ( const KeyCode& rKeyCode );
      75             :     bool        operator ==( const KeyCode& rKeyCode ) const;
      76             :     bool        operator !=( const KeyCode& rKeyCode ) const;
      77             : };
      78             : 
      79           0 : inline KeyCode::KeyCode( sal_uInt16 nKey, bool bShift, bool bMod1, bool bMod2, bool bMod3 )
      80             : {
      81           0 :     nCode = nKey;
      82           0 :     if( bShift )
      83           0 :         nCode |= KEY_SHIFT;
      84           0 :     if( bMod1 )
      85           0 :         nCode |= KEY_MOD1;
      86           0 :     if( bMod2 )
      87           0 :         nCode |= KEY_MOD2;
      88           0 :     if( bMod3 )
      89           0 :         nCode |= KEY_MOD3;
      90           0 :     eFunc = KEYFUNC_DONTKNOW;
      91           0 : }
      92             : 
      93           0 : inline bool KeyCode::operator ==( const KeyCode& rKeyCode ) const
      94             : {
      95           0 :     if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) )
      96           0 :         return (nCode == rKeyCode.nCode);
      97             :     else
      98           0 :         return (GetFunction() == rKeyCode.GetFunction());
      99             : }
     100             : 
     101           0 : inline bool KeyCode::operator !=( const KeyCode& rKeyCode ) const
     102             : {
     103           0 :     if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) )
     104           0 :         return (nCode != rKeyCode.nCode);
     105             :     else
     106           0 :         return (GetFunction() != rKeyCode.GetFunction());
     107             : }
     108             : 
     109           0 : inline bool KeyCode::IsDefinedKeyCodeEqual( const KeyCode& rKeyCode ) const
     110             : {
     111           0 :     if ( (eFunc == KEYFUNC_DONTKNOW) && (rKeyCode.eFunc == KEYFUNC_DONTKNOW) )
     112           0 :         return (GetFullCode() == rKeyCode.GetFullCode());
     113           0 :     return (GetFunction() == rKeyCode.GetFunction());
     114             : }
     115             : 
     116           0 : inline KeyCode& KeyCode::operator = ( const KeyCode& rKeyCode )
     117             : {
     118           0 :     nCode = rKeyCode.nCode;
     119           0 :     eFunc = rKeyCode.eFunc;
     120             : 
     121           0 :     return *this;
     122             : }
     123             : 
     124             : #endif // INCLUDED_VCL_KEYCOD_HXX
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10