jdk/src/windows/native/sun/windows/awt_InputTextInfor.cpp
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 5506 202f599c92aa
child 23010 6dadb192ad81
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
     2
 * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1955
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
    25
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
    26
#include "awt.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <imm.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "awt_Component.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "awt_InputTextInfor.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#define WCHAR_SZ sizeof(WCHAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#define DWORD_SZ sizeof(DWORD)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
// The start and end index of the result and composition in GCS_INDEX array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#define START_RESULTSTR 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define END_RESULTSTR 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define START_COMPSTR 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define END_COMPSTR 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
// The GCS_INDEX array is partitioned into 2 parts, one is result string related and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
// other is composing string related.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
const DWORD AwtInputTextInfor::GCS_INDEX[9]= {GCS_RESULTSTR, GCS_RESULTREADSTR, GCS_RESULTCLAUSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                                              GCS_RESULTREADCLAUSE, GCS_COMPSTR, GCS_COMPREADSTR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                                              GCS_COMPCLAUSE, GCS_COMPREADCLAUSE,GCS_COMPATTR};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
/* Default constructor */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
AwtInputTextInfor::AwtInputTextInfor() :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    m_flags(0), m_cursorPosW(0), m_jtext(NULL), m_pResultTextInfor(NULL), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    m_cStrW(0), m_cReadStrW(0), m_cClauseW(0), m_cReadClauseW(0), m_cAttrW(0), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    m_lpStrW(NULL), m_lpReadStrW(NULL), m_lpClauseW(NULL), m_lpReadClauseW(NULL), m_lpAttrW(NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
{}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/* Retrieve the context data from the current IMC.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
   Params:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
   HIMC hIMC - the input method context, must NOT be NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
   LPARAMS flags - message param to WM_IME_COMPOSITION.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
   Returns 0 if success.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
int
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
AwtInputTextInfor::GetContextData(HIMC hIMC, const LPARAM flags) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    DASSERT(hIMC != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    m_flags = flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    // Based on different flags received, we use different GCS_XXX from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    // GCS_INDEX array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    int startIndex = 0, endIndex = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    if (flags & GCS_COMPSTR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        startIndex = START_COMPSTR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        endIndex = END_COMPSTR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        /* For some window input method such as Chinese QuanPing, when the user
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * commits some text, the IMM sends WM_IME_COMPOSITION with GCS_COMPSTR/GCS_RESULTSTR.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * So we have to extract the result string from IMC. For most of other cases,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
         * m_pResultTextInfor is NULL and this is why we choose to have a pointer as its member
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * rather than having a list of the result string information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        if (flags & GCS_RESULTSTR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
            m_pResultTextInfor = new AwtInputTextInfor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
            m_pResultTextInfor->GetContextData(hIMC, GCS_RESULTSTR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    } else if (flags & GCS_RESULTSTR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        startIndex = START_RESULTSTR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        endIndex = END_RESULTSTR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    } else { // unknown flags.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /* Get the data from the input context */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    LONG   cbData[5] = {0};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    LPVOID lpData[5] = {NULL};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    for (int i = startIndex, j = 0; i <= endIndex; i++, j++) {
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
    93
        cbData[j] = ::ImmGetCompositionString(hIMC, GCS_INDEX[i], NULL, 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        if (cbData[j] == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            lpData[j] = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            LPBYTE lpTemp = new BYTE[cbData[j]];
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
    98
            cbData[j] = ::ImmGetCompositionString(hIMC, GCS_INDEX[i], lpTemp, cbData[j]);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            if (IMM_ERROR_GENERAL != cbData[j]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                lpData[j] = (LPVOID)lpTemp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                lpData[j] = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    // Assign the context data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    m_cStrW = cbData[0]/WCHAR_SZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    m_lpStrW = (LPWSTR)lpData[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    m_cReadStrW = cbData[1]/WCHAR_SZ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    m_lpReadStrW = (LPWSTR)lpData[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    m_cClauseW = cbData[2]/DWORD_SZ - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    m_lpClauseW = (LPDWORD)lpData[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    m_cReadClauseW = cbData[3]/DWORD_SZ - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    m_lpReadClauseW = (LPDWORD)lpData[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    if (cbData[4] > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        m_cAttrW = cbData[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        m_lpAttrW = (LPBYTE)lpData[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    // Get the cursor position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    if (flags & GCS_COMPSTR) {
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   128
        m_cursorPosW = ::ImmGetCompositionString(hIMC, GCS_CURSORPOS,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                                                NULL, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    if (m_cStrW > 0) {
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   134
        m_jtext = MakeJavaString(env, m_lpStrW, m_cStrW);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    // Merge the string if necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    if (m_pResultTextInfor != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        jstring jresultText = m_pResultTextInfor->GetText();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        if (m_jtext != NULL && jresultText != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            jstring jMergedtext = (jstring)JNU_CallMethodByName(env, NULL, jresultText,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                                                "concat",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                                                "(Ljava/lang/String;)Ljava/lang/String;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                                                m_jtext).l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            DASSERT(!safe_ExceptionOccurred(env));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            DASSERT(jMergedtext != NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            env->DeleteLocalRef(m_jtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            m_jtext = jMergedtext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        else if (m_jtext == NULL && jresultText != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            /* No composing text, assign the committed text to m_jtext */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            m_jtext = (jstring)env->NewLocalRef(jresultText);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * Destructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * free the pointer in the m_lpInfoStrW array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
AwtInputTextInfor::~AwtInputTextInfor() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    if (m_jtext) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        env->DeleteLocalRef(m_jtext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        m_jtext = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    delete [] m_lpStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    delete [] m_lpReadStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    delete [] m_lpClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    delete [] m_lpReadClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    delete [] m_lpAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    if (m_pResultTextInfor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        delete m_pResultTextInfor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        m_pResultTextInfor = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   185
jstring AwtInputTextInfor::MakeJavaString(JNIEnv* env, LPWSTR lpStrW, int cStrW) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   187
    if (env == NULL || lpStrW == NULL || cStrW == 0) {
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   188
        return NULL;
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   189
    } else {
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   190
        return env->NewString(reinterpret_cast<jchar*>(lpStrW), cStrW);
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   191
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
//  Convert Clause and Reading Information for DBCS string to that for Unicode string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
//  *lpBndClauseW and *lpReadingClauseW  must be deleted by caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
int AwtInputTextInfor::GetClauseInfor(int*& lpBndClauseW, jstring*& lpReadingClauseW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    if ( m_cStrW ==0 || m_cClauseW ==0 || m_cClauseW != m_cReadClauseW ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
         m_lpClauseW == NULL || m_lpReadClauseW == NULL ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
         m_lpClauseW[0] != 0 || m_lpClauseW[m_cClauseW] != (DWORD)m_cStrW ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
         m_lpReadClauseW[0] != 0 || m_lpReadClauseW[m_cReadClauseW] != (DWORD)m_cReadStrW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        lpBndClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        lpReadingClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    int*    bndClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    jstring* readingClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    //Convert ANSI string caluse information to UNICODE string clause information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        bndClauseW = new int[m_cClauseW + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        readingClauseW = new jstring[m_cClauseW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    } catch (std::bad_alloc&) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        lpBndClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        lpReadingClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        delete [] bndClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        throw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    for ( int cls = 0; cls < m_cClauseW; cls++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        bndClauseW[cls] = m_lpClauseW[cls];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        if ( m_lpReadClauseW[cls + 1] <= (DWORD)m_cReadStrW ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            LPWSTR lpHWStrW = m_lpReadStrW + m_lpReadClauseW[cls];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
            int cHWStrW = m_lpReadClauseW[cls+1] - m_lpReadClauseW[cls];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            if (PRIMARYLANGID(AwtComponent::GetInputLanguage()) == LANG_JAPANESE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
                LCID lcJPN = MAKELCID(MAKELANGID(LANG_JAPANESE,SUBLANG_DEFAULT),SORT_DEFAULT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                // Reading string is given in half width katakana in Japanese Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                //  Convert it to full width katakana.
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   236
                int cFWStrW = ::LCMapString(lcJPN, LCMAP_FULLWIDTH, lpHWStrW, cHWStrW, NULL, 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                LPWSTR lpFWStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                    lpFWStrW = new WCHAR[cFWStrW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                } catch (std::bad_alloc&) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                    lpBndClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                    lpReadingClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                    delete [] bndClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
                    delete [] readingClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                    throw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
1954
b93b85df3211 6585765: RFE: Remove Unicows-related code from AWT
art
parents: 2
diff changeset
   248
                ::LCMapString(lcJPN, LCMAP_FULLWIDTH, lpHWStrW, cHWStrW, lpFWStrW, cFWStrW);
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   249
                readingClauseW[cls] = MakeJavaString(env, lpFWStrW, cFWStrW);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                delete [] lpFWStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
            } else {
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   252
                readingClauseW[cls] = MakeJavaString(env, lpHWStrW, cHWStrW);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        else {
1955
e4f3afbad6e9 6741364: Some input method problems after the fix for 6585765
art
parents: 1954
diff changeset
   256
            readingClauseW[cls] = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    bndClauseW[m_cClauseW] = m_cStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    int retVal = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    int cCommittedStrW = GetCommittedTextLength();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    /* The conditions to merge the clause information are described below:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
       Senario 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
       m_flags & GCS_RESULTSTR is true only, this case m_pResultTextInfor must be NULL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
       No need to merge.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
       Senario 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
       m_flags & GCS_COMPSTR is true only, this case m_pResultTextInfor is also NULL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
       No need to merge either.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
       Senario 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
       m_flags & GCS_COMPSTR and m_flags & GCS_RESULTSTR both yield to true, in this case
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
       m_pResultTextInfor won't be NULL and if there is nothing to commit though, we don't
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
       have to merge. Or if the current composing string size is 0, we don't have to merge either.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
       So in clusion, the three conditions not not merge are:
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   280
       1. no committed string
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
       2. m_pResultTextInfor points to NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
       3. the current string size is 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
       Same rule applies to merge the attribute information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    if (m_cStrW == 0 || cCommittedStrW == 0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        m_pResultTextInfor == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        lpBndClauseW = bndClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        lpReadingClauseW = readingClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        retVal = m_cClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    } else { /* partial commit case */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        int* bndResultClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        jstring* readingResultClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        int cResultClauseW = m_pResultTextInfor->GetClauseInfor(bndResultClauseW, readingResultClauseW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        // Concatenate Clause information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        int cMergedClauseW = m_cClauseW + cResultClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        int* bndMergedClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        jstring* readingMergedClauseW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
            bndMergedClauseW = new int[cMergedClauseW+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            readingMergedClauseW = new jstring[cMergedClauseW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
        } catch (std::bad_alloc&) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            delete [] bndMergedClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            throw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        int i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        if (cResultClauseW > 0 && bndResultClauseW && readingResultClauseW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            for (; i < cResultClauseW; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                bndMergedClauseW[i] = bndResultClauseW[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                readingMergedClauseW[i] = readingResultClauseW[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        if (m_cClauseW > 0 && bndClauseW && readingClauseW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            for(int j = 0; j < m_cClauseW; j++, i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                bndMergedClauseW[i] = bndClauseW[j] + cCommittedStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                readingMergedClauseW[i] = readingClauseW[j];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
        delete [] bndClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        delete [] readingClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        bndMergedClauseW[cMergedClauseW] = m_cStrW + cCommittedStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        lpBndClauseW = bndMergedClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        lpReadingClauseW = readingMergedClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        retVal = cMergedClauseW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
//  Convert Attribute Information for DBCS string to that for Unicode string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
//  *lpBndAttrW and *lpValAttrW  must be deleted by caller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
int AwtInputTextInfor::GetAttributeInfor(int*& lpBndAttrW, BYTE*& lpValAttrW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    if (m_cStrW == 0 || m_cAttrW != m_cStrW) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        lpBndAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        lpValAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    int* bndAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    BYTE* valAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    //Scan attribute byte array and make attribute run information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        bndAttrW = new int[m_cAttrW + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        valAttrW = new BYTE[m_cAttrW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    } catch (std::bad_alloc&) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        lpBndAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        lpValAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        delete [] bndAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        throw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    int cAttrWT = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    bndAttrW[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    valAttrW[0] = m_lpAttrW[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    /* remove duplicate attribute in the m_lpAttrW array. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    for ( int offW = 1; offW < m_cAttrW; offW++ ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        if ( m_lpAttrW[offW] != valAttrW[cAttrWT]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            cAttrWT++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            bndAttrW[cAttrWT] = offW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            valAttrW[cAttrWT] = m_lpAttrW[offW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    bndAttrW[++cAttrWT] =  m_cStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    int retVal = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    int cCommittedStrW = GetCommittedTextLength();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    if (m_cStrW == 0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        cCommittedStrW == 0 || m_pResultTextInfor == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        lpBndAttrW = bndAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        lpValAttrW = valAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        retVal = cAttrWT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        int cMergedAttrW = 1 + cAttrWT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        int*    bndMergedAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        BYTE*   valMergedAttrW = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
            bndMergedAttrW = new int[cMergedAttrW+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            valMergedAttrW = new BYTE[cMergedAttrW];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        } catch (std::bad_alloc&) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            delete [] bndMergedAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            throw;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        bndMergedAttrW[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        valMergedAttrW[0] = ATTR_CONVERTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        for (int j = 0; j < cAttrWT; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            bndMergedAttrW[j+1] = bndAttrW[j]+cCommittedStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            valMergedAttrW[j+1] = valAttrW[j];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        bndMergedAttrW[cMergedAttrW] = m_cStrW + cCommittedStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        delete [] bndAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        delete [] valAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        lpBndAttrW = bndMergedAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        lpValAttrW = valMergedAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        retVal = cMergedAttrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
// Returns the cursor position of the current composition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
// returns 0 if the current mode is not GCS_COMPSTR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
int AwtInputTextInfor::GetCursorPosition() const {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    if (m_flags & GCS_COMPSTR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        return m_cursorPosW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
// Returns the committed text length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
int AwtInputTextInfor::GetCommittedTextLength() const {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    if ((m_flags & GCS_COMPSTR) && m_pResultTextInfor) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        return m_pResultTextInfor->GetCommittedTextLength();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    if (m_flags & GCS_RESULTSTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        return m_cStrW;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
}