xref: /aoo41x/main/vcl/inc/vcl/inputctx.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _VCL_INPUTCTX_HXX
29 #define _VCL_INPUTCTX_HXX
30 
31 #include <vcl/sv.h>
32 #include <vcl/dllapi.h>
33 #include <vcl/font.hxx>
34 
35 // ----------------------
36 // - InputContext-Flags -
37 // ----------------------
38 
39 #define INPUTCONTEXT_TEXT				((sal_uLong)0x00000001)
40 #define INPUTCONTEXT_EXTTEXTINPUT		((sal_uLong)0x00000002)
41 #define INPUTCONTEXT_EXTTEXTINPUT_ON	((sal_uLong)0x00000004)
42 #define INPUTCONTEXT_EXTTEXTINPUT_OFF	((sal_uLong)0x00000008)
43 
44 // ----------------
45 // - InputContext -
46 // ----------------
47 
48 class VCL_DLLPUBLIC InputContext
49 {
50 private:
51 	Font			maFont;
52 	sal_uLong			mnOptions;
53 
54 public:
55 					InputContext() { mnOptions = 0; }
56 					InputContext( const InputContext& rInputContext ) :
57 						maFont( rInputContext.maFont )
58 					{ mnOptions = rInputContext.mnOptions; }
59 					InputContext( const Font& rFont, sal_uLong nOptions = 0 ) :
60 						maFont( rFont )
61 					{ mnOptions = nOptions; }
62 
63 	void			SetFont( const Font& rFont ) { maFont = rFont; }
64 	const Font& 	GetFont() const { return maFont; }
65 
66 	void			SetOptions( sal_uLong nOptions ) { mnOptions = nOptions; }
67 	sal_uLong			GetOptions() const { return mnOptions; }
68 
69 	InputContext&	operator=( const InputContext& rInputContext );
70 	sal_Bool			operator==( const InputContext& rInputContext ) const;
71 	sal_Bool			operator!=( const InputContext& rInputContext ) const
72 						{ return !(InputContext::operator==( rInputContext )); }
73 };
74 
75 inline InputContext& InputContext::operator=( const InputContext& rInputContext )
76 {
77 	maFont		= rInputContext.maFont;
78 	mnOptions	= rInputContext.mnOptions;
79 	return *this;
80 }
81 
82 inline sal_Bool InputContext::operator==( const InputContext& rInputContext ) const
83 {
84 	return ((mnOptions	== rInputContext.mnOptions) &&
85 			(maFont 	== rInputContext.maFont));
86 }
87 
88 #endif // _VCL_INPUTCTX_HXX
89