2004-04-07 04:54:36 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
2008-04-11 01:45:31 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-04-07 04:54:36 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef UTILITIES_HXX_INCLUDED
|
|
|
|
#define UTILITIES_HXX_INCLUDED
|
|
|
|
|
2004-09-08 08:24:55 -05:00
|
|
|
#include <malloc.h>
|
2006-06-19 08:14:19 -05:00
|
|
|
#if defined _MSC_VER
|
|
|
|
#pragma warning(push, 1)
|
|
|
|
#endif
|
2007-11-02 07:10:10 -05:00
|
|
|
#ifndef OS2
|
2004-09-08 08:24:55 -05:00
|
|
|
#include <windows.h>
|
2007-11-02 07:10:10 -05:00
|
|
|
#endif
|
2006-06-19 08:14:19 -05:00
|
|
|
#if defined _MSC_VER
|
|
|
|
#pragma warning(pop)
|
|
|
|
#endif
|
2004-09-08 08:24:55 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <io.h>
|
|
|
|
#include "internal/types.hxx"
|
|
|
|
|
2004-04-07 04:54:36 -05:00
|
|
|
#include <string>
|
2009-12-10 05:04:42 -06:00
|
|
|
#define STRSAFE_NO_DEPRECATE
|
2009-10-29 09:49:54 -05:00
|
|
|
#include <strsafe.h>
|
2004-04-07 04:54:36 -05:00
|
|
|
|
|
|
|
//---------------------------------
|
|
|
|
/** Convert a string to a wstring
|
|
|
|
using CP_ACP
|
|
|
|
*/
|
|
|
|
std::wstring StringToWString(const std::string& String);
|
|
|
|
|
|
|
|
//---------------------------------
|
|
|
|
/** Convert a wstring to a string
|
|
|
|
using CP_ACP
|
|
|
|
*/
|
|
|
|
std::string WStringToString(const std::wstring& String);
|
|
|
|
|
|
|
|
//---------------------------------
|
|
|
|
/** Retrieve a string from the
|
|
|
|
resources of this module
|
|
|
|
*/
|
|
|
|
std::wstring GetResString(int ResId);
|
|
|
|
|
|
|
|
//---------------------------------
|
|
|
|
/** Returns whether we are running
|
|
|
|
on Windows XP or not
|
|
|
|
*/
|
2007-01-02 09:12:16 -06:00
|
|
|
bool is_windows_xp_or_above();
|
2004-04-07 04:54:36 -05:00
|
|
|
|
2004-09-08 08:24:55 -05:00
|
|
|
//---------------------------------
|
|
|
|
/** helper function to judge if the string is only has spaces.
|
|
|
|
@returns
|
|
|
|
<TRUE>if the provided string contains only but at least one space
|
|
|
|
character else <FALSE/>.
|
|
|
|
*/
|
|
|
|
bool HasOnlySpaces(const std::wstring& String);
|
|
|
|
|
|
|
|
/** convert LocaleSet pair into Windows LCID identifier.
|
|
|
|
@returns
|
|
|
|
Windows Locale Identifier corresponding to input LocaleSet.
|
|
|
|
*/
|
|
|
|
|
2007-11-02 07:10:10 -05:00
|
|
|
#ifndef OS2
|
2004-09-08 08:24:55 -05:00
|
|
|
LCID LocaleSetToLCID( const LocaleSet_t & Locale );
|
2007-11-02 07:10:10 -05:00
|
|
|
#endif
|
2004-09-08 08:24:55 -05:00
|
|
|
|
2009-10-29 09:49:54 -05:00
|
|
|
//----------------------------------------------------------
|
|
|
|
#ifdef DEBUG
|
|
|
|
inline void OutputDebugStringFormat( LPCSTR pFormat, ... )
|
|
|
|
{
|
|
|
|
CHAR buffer[1024];
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start( args, pFormat );
|
|
|
|
StringCchVPrintfA( buffer, sizeof(buffer), pFormat, args );
|
|
|
|
OutputDebugStringA( buffer );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void OutputDebugStringFormat( LPCSTR, ... )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
//----------------------------------------------------------
|
|
|
|
|
|
|
|
|
2004-04-07 04:54:36 -05:00
|
|
|
#endif
|