Bump version to 4.1-6
[LibreOffice.git] / vcl / win / source / app / saldata.cxx
blobfc9967459dda4387319152040fd0da13db979847
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <svsys.h>
21 #include "rtl/tencinfo.h"
22 #include "vcl/svapp.hxx"
24 #include "win/saldata.hxx"
26 // =======================================================================
28 rtl_TextEncoding ImplSalGetSystemEncoding()
30 static UINT nOldAnsiCodePage = 0;
31 static rtl_TextEncoding eEncoding = RTL_TEXTENCODING_MS_1252;
33 UINT nAnsiCodePage = GetACP();
34 if ( nAnsiCodePage != nOldAnsiCodePage )
36 rtl_TextEncoding nEnc
37 = rtl_getTextEncodingFromWindowsCodePage(nAnsiCodePage);
38 if (nEnc != RTL_TEXTENCODING_DONTKNOW)
39 eEncoding = nEnc;
42 return eEncoding;
45 // -----------------------------------------------------------------------
47 OUString ImplSalGetUniString(const sal_Char* pStr, sal_Int32 const nLen)
49 return OUString( pStr, (-1 == nLen) ? strlen(pStr) : nLen,
50 ImplSalGetSystemEncoding(),
51 RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
52 RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
53 RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT );
56 // =======================================================================
58 int ImplSalWICompareAscii( const wchar_t* pStr1, const char* pStr2 )
60 int nRet;
61 wchar_t c1;
62 char c2;
65 // change to LowerCase if the char is between 'A' and 'Z'
66 c1 = *pStr1;
67 c2 = *pStr2;
68 if ( (c1 >= 65) && (c1 <= 90) )
69 c1 += 32;
70 if ( (c2 >= 65) && (c2 <= 90) )
71 c2 += 32;
72 nRet = ((sal_Int32)c1)-((sal_Int32)((unsigned char)c2));
73 if ( nRet != 0 )
74 break;
76 pStr1++;
77 pStr2++;
79 while ( c2 );
81 return nRet;
84 // =======================================================================
86 BOOL ImplPostMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
88 return PostMessageW( hWnd, nMsg, wParam, lParam );
91 // -----------------------------------------------------------------------
93 BOOL ImplSendMessage( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam )
95 return SendMessageW( hWnd, nMsg, wParam, lParam );
98 // -----------------------------------------------------------------------
100 BOOL ImplGetMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax )
102 return GetMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax );
105 // -----------------------------------------------------------------------
107 BOOL ImplPeekMessage( LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg )
109 return PeekMessageW( lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg );
112 // -----------------------------------------------------------------------
114 LONG ImplDispatchMessage( CONST MSG *lpMsg )
116 return DispatchMessageW( lpMsg );
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */