1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_vcl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "tools/svwin.h" 32*cdf0e10cSrcweir #include "rtl/tencinfo.h" 33*cdf0e10cSrcweir #include "vcl/svapp.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "win/saldata.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir // ======================================================================= 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir rtl_TextEncoding ImplSalGetSystemEncoding() 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir static UINT nOldAnsiCodePage = 0; 42*cdf0e10cSrcweir static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir UINT nAnsiCodePage = GetACP(); 45*cdf0e10cSrcweir if ( nAnsiCodePage != nOldAnsiCodePage ) 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir rtl_TextEncoding nEnc 48*cdf0e10cSrcweir = rtl_getTextEncodingFromWindowsCodePage(nAnsiCodePage); 49*cdf0e10cSrcweir if (nEnc != RTL_TEXTENCODING_DONTKNOW) 50*cdf0e10cSrcweir eEncoding = nEnc; 51*cdf0e10cSrcweir } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir return eEncoding; 54*cdf0e10cSrcweir } 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir // ----------------------------------------------------------------------- 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir ByteString ImplSalGetWinAnsiString( const UniString& rStr, sal_Bool bFileName ) 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding(); 61*cdf0e10cSrcweir if ( bFileName ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir return ByteString( rStr, eEncoding, 64*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE | 65*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE | 66*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE | 67*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR | 68*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 ); 69*cdf0e10cSrcweir } 70*cdf0e10cSrcweir else 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir return ByteString( rStr, eEncoding, 73*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT | 74*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT | 75*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE | 76*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR | 77*cdf0e10cSrcweir RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 ); 78*cdf0e10cSrcweir } 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir // ----------------------------------------------------------------------- 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir return UniString( pStr, nLen, ImplSalGetSystemEncoding(), 86*cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT | 87*cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | 88*cdf0e10cSrcweir RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT ); 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // ======================================================================= 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 ) 94*cdf0e10cSrcweir { 95*cdf0e10cSrcweir int nRet; 96*cdf0e10cSrcweir wchar_t c1; 97*cdf0e10cSrcweir char c2; 98*cdf0e10cSrcweir do 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln 101*cdf0e10cSrcweir c1 = *pStr1; 102*cdf0e10cSrcweir c2 = *pStr2; 103*cdf0e10cSrcweir if ( (c1 >= 65) && (c1 <= 90) ) 104*cdf0e10cSrcweir c1 += 32; 105*cdf0e10cSrcweir if ( (c2 >= 65) && (c2 <= 90) ) 106*cdf0e10cSrcweir c2 += 32; 107*cdf0e10cSrcweir nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2)); 108*cdf0e10cSrcweir if ( nRet != 0 ) 109*cdf0e10cSrcweir break; 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir pStr1++; 112*cdf0e10cSrcweir pStr2++; 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir while ( c2 ); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir return nRet; 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir // ======================================================================= 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong ) 122*cdf0e10cSrcweir { 123*cdf0e10cSrcweir return SetWindowLongW( hWnd, nIndex, dwNewLong ); 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir // ----------------------------------------------------------------------- 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir LONG ImplGetWindowLong( HWND hWnd, int nIndex ) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir return GetWindowLongW( hWnd, nIndex ); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir // ----------------------------------------------------------------------- 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir return PostMessageW( hWnd, nMsg, wParam, lParam ); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // ----------------------------------------------------------------------- 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam ); 145*cdf0e10cSrcweir return bRet; 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // ----------------------------------------------------------------------- 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax ); 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir // ----------------------------------------------------------------------- 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg ); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // ----------------------------------------------------------------------- 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir LONG ImplDispatchMessage( CONST MSG *lpMsg ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir return DispatchMessageW( lpMsg ); 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169