LCOV - code coverage report
Current view: top level - include/vcl - inputctx.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 18 100.0 %
Date: 2015-06-13 12:38:46 Functions: 9 9 100.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_INPUTCTX_HXX
      21             : #define INCLUDED_VCL_INPUTCTX_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/font.hxx>
      26             : #include <o3tl/typed_flags_set.hxx>
      27             : 
      28             : 
      29             : // - InputContext-Flags -
      30             : 
      31             : 
      32             : enum class InputContextFlags
      33             : {
      34             :     NONE         = 0x0000,
      35             :     Text         = 0x0001,
      36             :     ExtText      = 0x0002,
      37             :     ExtTextOn    = 0x0004,
      38             :     ExtTextOff   = 0x0008,
      39             : };
      40             : namespace o3tl
      41             : {
      42             :     template<> struct typed_flags<InputContextFlags> : is_typed_flags<InputContextFlags, 0x000f> {};
      43             : }
      44             : 
      45             : 
      46             : // - InputContext -
      47             : 
      48             : 
      49      285106 : class VCL_DLLPUBLIC InputContext
      50             : {
      51             : private:
      52             :     vcl::Font          maFont;
      53             :     InputContextFlags  mnOptions;
      54             : 
      55             : public:
      56      275724 :                     InputContext() { mnOptions = InputContextFlags::NONE; }
      57        2788 :                     InputContext( const InputContext& rInputContext ) :
      58        2788 :                         maFont( rInputContext.maFont )
      59        2788 :                     { mnOptions = rInputContext.mnOptions; }
      60        7040 :                     InputContext( const vcl::Font& rFont, InputContextFlags nOptions = InputContextFlags::NONE ) :
      61        7040 :                         maFont( rFont )
      62        7040 :                     { mnOptions = nOptions; }
      63             : 
      64             :     void            SetFont( const vcl::Font& rFont ) { maFont = rFont; }
      65        5537 :     const vcl::Font& GetFont() const { return maFont; }
      66             : 
      67        3731 :     void              SetOptions( InputContextFlags nOptions ) { mnOptions = nOptions; }
      68        8325 :     InputContextFlags GetOptions() const { return mnOptions; }
      69             : 
      70             :     InputContext&   operator=( const InputContext& rInputContext );
      71             :     bool            operator==( const InputContext& rInputContext ) const;
      72             :     bool            operator!=( const InputContext& rInputContext ) const
      73             :                         { return !(InputContext::operator==( rInputContext )); }
      74             : };
      75             : 
      76       16308 : inline InputContext& InputContext::operator=( const InputContext& rInputContext )
      77             : {
      78       16308 :     maFont      = rInputContext.maFont;
      79       16308 :     mnOptions   = rInputContext.mnOptions;
      80       16308 :     return *this;
      81             : }
      82             : 
      83       18804 : inline bool InputContext::operator==( const InputContext& rInputContext ) const
      84             : {
      85       32084 :     return ((mnOptions  == rInputContext.mnOptions) &&
      86       32084 :             (maFont     == rInputContext.maFont));
      87             : }
      88             : 
      89             : #endif // INCLUDED_VCL_INPUTCTX_HXX
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11