Branch libreoffice-5-0-4
[LibreOffice.git] / include / vcl / inputctx.hxx
blob3cd78744299a3c98f4b02b6882a420830f850135
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_VCL_INPUTCTX_HXX
21 #define INCLUDED_VCL_INPUTCTX_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/font.hxx>
26 #include <o3tl/typed_flags_set.hxx>
29 // - InputContext-Flags -
32 enum class InputContextFlags
34 NONE = 0x0000,
35 Text = 0x0001,
36 ExtText = 0x0002,
37 ExtTextOn = 0x0004,
38 ExtTextOff = 0x0008,
40 namespace o3tl
42 template<> struct typed_flags<InputContextFlags> : is_typed_flags<InputContextFlags, 0x000f> {};
46 // - InputContext -
49 class VCL_DLLPUBLIC InputContext
51 private:
52 vcl::Font maFont;
53 InputContextFlags mnOptions;
55 public:
56 InputContext() { mnOptions = InputContextFlags::NONE; }
57 InputContext( const InputContext& rInputContext ) :
58 maFont( rInputContext.maFont )
59 { mnOptions = rInputContext.mnOptions; }
60 InputContext( const vcl::Font& rFont, InputContextFlags nOptions = InputContextFlags::NONE ) :
61 maFont( rFont )
62 { mnOptions = nOptions; }
64 void SetFont( const vcl::Font& rFont ) { maFont = rFont; }
65 const vcl::Font& GetFont() const { return maFont; }
67 void SetOptions( InputContextFlags nOptions ) { mnOptions = nOptions; }
68 InputContextFlags GetOptions() const { return mnOptions; }
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 )); }
76 inline InputContext& InputContext::operator=( const InputContext& rInputContext )
78 maFont = rInputContext.maFont;
79 mnOptions = rInputContext.mnOptions;
80 return *this;
83 inline bool InputContext::operator==( const InputContext& rInputContext ) const
85 return ((mnOptions == rInputContext.mnOptions) &&
86 (maFont == rInputContext.maFont));
89 #endif // INCLUDED_VCL_INPUTCTX_HXX
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */