xref: /trunk/main/vcl/inc/vcl/inputctx.hxx (revision 0d63794c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _VCL_INPUTCTX_HXX
25 #define _VCL_INPUTCTX_HXX
26 
27 #include <vcl/sv.h>
28 #include <vcl/dllapi.h>
29 #include <vcl/font.hxx>
30 
31 // ----------------------
32 // - InputContext-Flags -
33 // ----------------------
34 
35 #define INPUTCONTEXT_TEXT				((sal_uLong)0x00000001)
36 #define INPUTCONTEXT_EXTTEXTINPUT		((sal_uLong)0x00000002)
37 #define INPUTCONTEXT_EXTTEXTINPUT_ON	((sal_uLong)0x00000004)
38 #define INPUTCONTEXT_EXTTEXTINPUT_OFF	((sal_uLong)0x00000008)
39 
40 // ----------------
41 // - InputContext -
42 // ----------------
43 
44 class VCL_DLLPUBLIC InputContext
45 {
46 private:
47 	Font			maFont;
48 	sal_uLong			mnOptions;
49 
50 public:
InputContext()51 					InputContext() { mnOptions = 0; }
InputContext(const InputContext & rInputContext)52 					InputContext( const InputContext& rInputContext ) :
53 						maFont( rInputContext.maFont )
54 					{ mnOptions = rInputContext.mnOptions; }
InputContext(const Font & rFont,sal_uLong nOptions=0)55 					InputContext( const Font& rFont, sal_uLong nOptions = 0 ) :
56 						maFont( rFont )
57 					{ mnOptions = nOptions; }
58 
SetFont(const Font & rFont)59 	void			SetFont( const Font& rFont ) { maFont = rFont; }
GetFont() const60 	const Font& 	GetFont() const { return maFont; }
61 
SetOptions(sal_uLong nOptions)62 	void			SetOptions( sal_uLong nOptions ) { mnOptions = nOptions; }
GetOptions() const63 	sal_uLong			GetOptions() const { return mnOptions; }
64 
65 	InputContext&	operator=( const InputContext& rInputContext );
66 	sal_Bool			operator==( const InputContext& rInputContext ) const;
operator !=(const InputContext & rInputContext) const67 	sal_Bool			operator!=( const InputContext& rInputContext ) const
68 						{ return !(InputContext::operator==( rInputContext )); }
69 };
70 
operator =(const InputContext & rInputContext)71 inline InputContext& InputContext::operator=( const InputContext& rInputContext )
72 {
73 	maFont		= rInputContext.maFont;
74 	mnOptions	= rInputContext.mnOptions;
75 	return *this;
76 }
77 
operator ==(const InputContext & rInputContext) const78 inline sal_Bool InputContext::operator==( const InputContext& rInputContext ) const
79 {
80 	return ((mnOptions	== rInputContext.mnOptions) &&
81 			(maFont 	== rInputContext.maFont));
82 }
83 
84 #endif // _VCL_INPUTCTX_HXX
85