Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / vcl / inputctx.hxx
blob95c860e1a90203309dcd9e8b54412c827c40174b
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 enum class InputContextFlags
31 NONE = 0x0000,
32 Text = 0x0001,
33 ExtText = 0x0002
35 namespace o3tl
37 template<> struct typed_flags<InputContextFlags> : is_typed_flags<InputContextFlags, 0x0003> {};
41 class VCL_DLLPUBLIC InputContext
43 private:
44 vcl::Font maFont;
45 InputContextFlags mnOptions;
47 public:
48 InputContext() { mnOptions = InputContextFlags::NONE; }
49 InputContext( const InputContext& rInputContext ) :
50 maFont( rInputContext.maFont )
51 { mnOptions = rInputContext.mnOptions; }
52 InputContext( const vcl::Font& rFont, InputContextFlags nOptions = InputContextFlags::NONE ) :
53 maFont( rFont )
54 { mnOptions = nOptions; }
56 const vcl::Font& GetFont() const { return maFont; }
58 void SetOptions( InputContextFlags nOptions ) { mnOptions = nOptions; }
59 InputContextFlags GetOptions() const { return mnOptions; }
61 InputContext& operator=( const InputContext& rInputContext );
62 bool operator==( const InputContext& rInputContext ) const;
63 bool operator!=( const InputContext& rInputContext ) const
64 { return !(InputContext::operator==( rInputContext )); }
67 inline InputContext& InputContext::operator=( const InputContext& rInputContext )
69 maFont = rInputContext.maFont;
70 mnOptions = rInputContext.mnOptions;
71 return *this;
74 inline bool InputContext::operator==( const InputContext& rInputContext ) const
76 return ((mnOptions == rInputContext.mnOptions) &&
77 (maFont == rInputContext.maFont));
80 #endif // INCLUDED_VCL_INPUTCTX_HXX
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */