1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 * 4 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved. 5 * 6 * The contents of this file are subject to the terms of either the GNU Lesser 7 * General Public License Version 2.1 only ("LGPL") or the Common Development and 8 * Distribution License ("CDDL")(collectively, the "License"). You may not use this 9 * file except in compliance with the License. You can obtain a copy of the CDDL at 10 * http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at 11 * http://www.opensource.org/licenses/lgpl-license.php. See the License for the 12 * specific language governing permissions and limitations under the License. When 13 * distributing the software, include this License Header Notice in each file and 14 * include the full text of the License in the License file as well as the 15 * following notice: 16 * 17 * NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE 18 * (CDDL) 19 * For Covered Software in this distribution, this License shall be governed by the 20 * laws of the State of California (excluding conflict-of-law provisions). 21 * Any litigation relating to this License shall be subject to the jurisdiction of 22 * the Federal Courts of the Northern District of California and the state courts 23 * of the State of California, with venue lying in Santa Clara County, California. 24 * 25 * Contributor(s): 26 * 27 * If you wish your version of this file to be governed by only the CDDL or only 28 * the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to 29 * include this software in this distribution under the [CDDL or LGPL Version 2.1] 30 * license." If you don't indicate a single choice of license, a recipient has the 31 * option to distribute your version of this file under either the CDDL or the LGPL 32 * Version 2.1, or to extend the choice of license to its licensees as provided 33 * above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL 34 * Version 2 license, then the option applies only if the new code is made subject 35 * to such option by the copyright holder. 36 */ 37 38 #ifndef SUNPY_IMI_SESSION_VIEW_H 39 #define SUNPY_IMI_SESSION_VIEW_H 40 41 #include "portability.h" 42 43 #include "imi_options.h" 44 45 #include "imi_context.h" 46 #include "imi_winHandler.h" 47 #include "imi_uiobjects.h" 48 49 class CIMIView; 50 51 class CIMIViewFactory { 52 static int sm_mapInit; 53 public: 54 enum { 55 SVT_NONE = 0, 56 SVT_MODERN, 57 SVT_CLASSIC 58 }; 59 60 static CIMIView * 61 createView(int viewType); 62 }; 63 64 class CIMIView { 65 public: 66 enum { 67 KEYEVENT_USED = (1), 68 PREEDIT_MASK = (1<<2), 69 CANDIDATE_MASK = (1<<3) 70 }; 71 72 public: 73 static int s_CandiWindowSize; 74 75 public: 76 CIMIView(); 77 78 /**{*/ 79 CIMIOptions* getPreference(void) 80 { return m_pPref; } 81 82 void attachWinHandler(CIMIWinHandler* wh) 83 { mp_winHandler = wh; } 84 85 CIMIWinHandler* getWinHandler(void) 86 { return mp_winHandler; } 87 88 CIMIContext* getIC(void) 89 { return m_pIC; } 90 /**}*/ 91 92 /*@{*/ 93 virtual ~CIMIView(); 94 95 virtual int getViewType(void); 96 97 virtual void setPreference(const CIMIOptions* pp); 98 99 virtual void attachIC(CIMIContext* pIC); 100 101 virtual unsigned clearIC(void); 102 103 virtual void updateWindows(unsigned int mask); 104 105 virtual void setStatusAttrValue(int key, int value); 106 107 virtual int onKeyEvent(unsigned keycode, unsigned keyvalue, unsigned modifier); 108 109 virtual int onCandidatePageRequest(int pgno, bool relative); //pgno == -1, relative == false means last page 110 111 virtual int onCandidateSelectRequest(int index); 112 113 virtual int getStatusAttrValue(int key); 114 /*@}*/ 115 116 /* Functions to retrieve the Preedit/Candidate list */ 117 /*@{*/ 118 virtual void getInputString(wstring& s); 119 120 virtual void getPreeditString(IPreeditString& ps); 121 122 virtual void getCandidateList(ICandidateList& cl, int start, int size); 123 /*@}*/ 124 125 protected: 126 /*@{*/ 127 /** Punc include . , ; : ? " ... */ 128 static bool 129 isPuncChar(TWCHAR key); 130 131 /** simbol is those not punc, but has full wide mode */ 132 static bool 133 isSimbolChar(TWCHAR key); 134 135 /** Whether or not the wide char wc is a end-of-senetence puncuation */ 136 static bool 137 isTermPuncWide(TWCHAR wc); 138 /*@}*/ 139 140 /*@{*/ 141 /** Map the half Punc char into its full wide char*/ 142 TWCHAR 143 getFullPunc(TWCHAR key); 144 145 /** Map the half simbol char into its full wide char*/ 146 TWCHAR 147 getFullSimbol(TWCHAR key); 148 /*@}*/ 149 150 protected: 151 /*@{*/ 152 CIMIContext *m_pIC; 153 CIMIWinHandler* mp_winHandler; 154 /*@}*/ 155 156 /*@{*/ 157 bool m_CN; 158 bool m_FullPunc; 159 bool m_FullSimbol; 160 bool m_bRightFullDblQuote; 161 162 CIMIOptions* m_pPref; 163 /*@}*/ 164 }; 165 166 #endif 167