merged tag ooo/DEV300_m102
[LibreOffice.git] / vcl / win / source / app / saldata.cxx
blob1eb897b55b8d27dc62c7fd9ac6e9fe76afdb13e2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_vcl.hxx"
30 #include <tools/svwin.h>
31 #include "rtl/tencinfo.h"
32 #include <saldata.hxx>
33 #include <vcl/svapp.hxx>
36 // =======================================================================
38 rtl_TextEncoding ImplSalGetSystemEncoding()
40 static UINT nOldAnsiCodePage = 0;
41 static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
43 UINT nAnsiCodePage = GetACP();
44 if ( nAnsiCodePage != nOldAnsiCodePage )
46 rtl_TextEncoding nEnc
47 = rtl_getTextEncodingFromWindowsCodePage(nAnsiCodePage);
48 if (nEnc != RTL_TEXTENCODING_DONTKNOW)
49 eEncoding = nEnc;
52 return eEncoding;
55 // -----------------------------------------------------------------------
57 ByteString ImplSalGetWinAnsiString( const UniString& rStr, sal_Bool bFileName )
59 rtl_TextEncoding eEncoding = ImplSalGetSystemEncoding();
60 if ( bFileName )
62 return ByteString( rStr, eEncoding,
63 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_UNDERLINE |
64 RTL_UNICODETOTEXT_FLAGS_INVALID_UNDERLINE |
65 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
66 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
67 RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
69 else
71 return ByteString( rStr, eEncoding,
72 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_DEFAULT |
73 RTL_UNICODETOTEXT_FLAGS_INVALID_DEFAULT |
74 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACE |
75 RTL_UNICODETOTEXT_FLAGS_UNDEFINED_REPLACESTR |
76 RTL_UNICODETOTEXT_FLAGS_PRIVATE_MAPTO0 );
80 // -----------------------------------------------------------------------
82 UniString ImplSalGetUniString( const sal_Char* pStr, xub_StrLen nLen )
84 return UniString( pStr, nLen, ImplSalGetSystemEncoding(),
85 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
86 RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
87 RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
90 // =======================================================================
92 int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
94 int nRet;
95 wchar_t c1;
96 char c2;
99 // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
100 c1 = *pStr1;
101 c2 = *pStr2;
102 if ( (c1 >= 65) && (c1 <= 90) )
103 c1 += 32;
104 if ( (c2 >= 65) && (c2 <= 90) )
105 c2 += 32;
106 nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
107 if ( nRet != 0 )
108 break;
110 pStr1++;
111 pStr2++;
113 while ( c2 );
115 return nRet;
118 // =======================================================================
120 LONG ImplSetWindowLong( HWND hWnd, int nIndex, DWORD dwNewLong )
122 return SetWindowLongW( hWnd, nIndex, dwNewLong );
125 // -----------------------------------------------------------------------
127 LONG ImplGetWindowLong( HWND hWnd, int nIndex )
129 return GetWindowLongW( hWnd, nIndex );
132 // -----------------------------------------------------------------------
134 BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
136 return PostMessageW( hWnd, nMsg, wParam, lParam );
139 // -----------------------------------------------------------------------
141 BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
143 BOOL bRet = SendMessageW( hWnd, nMsg, wParam, lParam );
144 return bRet;
147 // -----------------------------------------------------------------------
149 BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
151 return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
154 // -----------------------------------------------------------------------
156 BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg )
158 return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
161 // -----------------------------------------------------------------------
163 LONG ImplDispatchMessage( CONST MSG *lpMsg )
165 return DispatchMessageW( lpMsg );