1*9f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9f62ea84SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9f62ea84SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9f62ea84SAndrew Rist * distributed with this work for additional information
6*9f62ea84SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9f62ea84SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9f62ea84SAndrew Rist * "License"); you may not use this file except in compliance
9*9f62ea84SAndrew Rist * with the License. You may obtain a copy of the License at
10*9f62ea84SAndrew Rist *
11*9f62ea84SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*9f62ea84SAndrew Rist *
13*9f62ea84SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9f62ea84SAndrew Rist * software distributed under the License is distributed on an
15*9f62ea84SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9f62ea84SAndrew Rist * KIND, either express or implied. See the License for the
17*9f62ea84SAndrew Rist * specific language governing permissions and limitations
18*9f62ea84SAndrew Rist * under the License.
19*9f62ea84SAndrew Rist *
20*9f62ea84SAndrew Rist *************************************************************/
21*9f62ea84SAndrew Rist
22*9f62ea84SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "tools/svwin.h"
28cdf0e10cSrcweir #include "rtl/tencinfo.h"
29cdf0e10cSrcweir #include "vcl/svapp.hxx"
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include "win/saldata.hxx"
32cdf0e10cSrcweir
33cdf0e10cSrcweir // =======================================================================
34cdf0e10cSrcweir
ImplSalGetSystemEncoding()35cdf0e10cSrcweir rtl_TextEncoding ImplSalGetSystemEncoding()
36cdf0e10cSrcweir {
37cdf0e10cSrcweir static UINT nOldAnsiCodePage = 0;
38cdf0e10cSrcweir static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
39cdf0e10cSrcweir
40cdf0e10cSrcweir UINT nAnsiCodePage = GetACP();
41cdf0e10cSrcweir if ( nAnsiCodePage != nOldAnsiCodePage )
42cdf0e10cSrcweir {
43cdf0e10cSrcweir rtl_TextEncoding nEnc
44cdf0e10cSrcweir = rtl_getTextEncodingFromWindowsCodePage(nAnsiCodePage);
45cdf0e10cSrcweir if (nEnc != RTL_TEXTENCODING_DONTKNOW)
46cdf0e10cSrcweir eEncoding = nEnc;
47cdf0e10cSrcweir }
48cdf0e10cSrcweir
49cdf0e10cSrcweir return eEncoding;
50cdf0e10cSrcweir }
51cdf0e10cSrcweir
52cdf0e10cSrcweir // -----------------------------------------------------------------------
53cdf0e10cSrcweir
ImplSalGetWinAnsiString(const UniString & rStr,sal_Bool bFileName)54cdf0e10cSrcweir ByteString ImplSalGetWinAnsiString( const UniString& rStr, sal_Bool bFileName )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding();
57cdf0e10cSrcweir if ( bFileName )
58cdf0e10cSrcweir {
59cdf0e10cSrcweir return ByteString( rStr, eEncoding,
60cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE |
61cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
62cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
63cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
64cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
65cdf0e10cSrcweir }
66cdf0e10cSrcweir else
67cdf0e10cSrcweir {
68cdf0e10cSrcweir return ByteString( rStr, eEncoding,
69cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
70cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
71cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
72cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
73cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
74cdf0e10cSrcweir }
75cdf0e10cSrcweir }
76cdf0e10cSrcweir
77cdf0e10cSrcweir // -----------------------------------------------------------------------
78cdf0e10cSrcweir
ImplSalGetUniString(const sal_Char * pStr,xub_StrLen nLen)79cdf0e10cSrcweir UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir return UniString( pStr, nLen, ImplSalGetSystemEncoding(),
82cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
83cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
84cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir // =======================================================================
88cdf0e10cSrcweir
ImplSalWICompareAscii(const wchar_t * pStr1,const char * pStr2)89cdf0e10cSrcweir int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
90cdf0e10cSrcweir {
91cdf0e10cSrcweir int nRet;
92cdf0e10cSrcweir wchar_t c1;
93cdf0e10cSrcweir char c2;
94cdf0e10cSrcweir do
95cdf0e10cSrcweir {
96cdf0e10cSrcweir // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
97cdf0e10cSrcweir c1 = *pStr1;
98cdf0e10cSrcweir c2 = *pStr2;
99cdf0e10cSrcweir if ( (c1 >= 65) && (c1 <= 90) )
100cdf0e10cSrcweir c1 += 32;
101cdf0e10cSrcweir if ( (c2 >= 65) && (c2 <= 90) )
102cdf0e10cSrcweir c2 += 32;
103cdf0e10cSrcweir nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
104cdf0e10cSrcweir if ( nRet != 0 )
105cdf0e10cSrcweir break;
106cdf0e10cSrcweir
107cdf0e10cSrcweir pStr1++;
108cdf0e10cSrcweir pStr2++;
109cdf0e10cSrcweir }
110cdf0e10cSrcweir while ( c2 );
111cdf0e10cSrcweir
112cdf0e10cSrcweir return nRet;
113cdf0e10cSrcweir }
114cdf0e10cSrcweir
115cdf0e10cSrcweir // =======================================================================
116cdf0e10cSrcweir
ImplSetWindowLong(HWND hWnd,int nIndex,DWORD dwNewLong)117cdf0e10cSrcweir LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong )
118cdf0e10cSrcweir {
119cdf0e10cSrcweir return SetWindowLongW( hWnd, nIndex, dwNewLong );
120cdf0e10cSrcweir }
121cdf0e10cSrcweir
122cdf0e10cSrcweir // -----------------------------------------------------------------------
123cdf0e10cSrcweir
ImplGetWindowLong(HWND hWnd,int nIndex)124cdf0e10cSrcweir LONG ImplGetWindowLong( HWND hWnd, int nIndex )
125cdf0e10cSrcweir {
126cdf0e10cSrcweir return GetWindowLongW( hWnd, nIndex );
127cdf0e10cSrcweir }
128cdf0e10cSrcweir
129cdf0e10cSrcweir // -----------------------------------------------------------------------
130cdf0e10cSrcweir
ImplPostMessage(HWND hWnd,UINT nMsg,WPARAM wParam,LPARAM lParam)131cdf0e10cSrcweir BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
132cdf0e10cSrcweir {
133cdf0e10cSrcweir return PostMessageW( hWnd, nMsg, wParam, lParam );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir
136cdf0e10cSrcweir // -----------------------------------------------------------------------
137cdf0e10cSrcweir
ImplSendMessage(HWND hWnd,UINT nMsg,WPARAM wParam,LPARAM lParam)138cdf0e10cSrcweir BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam );
141cdf0e10cSrcweir return bRet;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir
144cdf0e10cSrcweir // -----------------------------------------------------------------------
145cdf0e10cSrcweir
ImplGetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax)146cdf0e10cSrcweir BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
147cdf0e10cSrcweir {
148cdf0e10cSrcweir return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
149cdf0e10cSrcweir }
150cdf0e10cSrcweir
151cdf0e10cSrcweir // -----------------------------------------------------------------------
152cdf0e10cSrcweir
ImplPeekMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax,UINT wRemoveMsg)153cdf0e10cSrcweir BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg )
154cdf0e10cSrcweir {
155cdf0e10cSrcweir return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
158cdf0e10cSrcweir // -----------------------------------------------------------------------
159cdf0e10cSrcweir
ImplDispatchMessage(CONST MSG * lpMsg)160cdf0e10cSrcweir LONG ImplDispatchMessage( CONST MSG *lpMsg )
161cdf0e10cSrcweir {
162cdf0e10cSrcweir return DispatchMessageW( lpMsg );
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165