1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SHELL_INC_INTERNAL_UTILITIES_HXX
21 #define INCLUDED_SHELL_INC_INTERNAL_UTILITIES_HXX
25 #if !defined WIN32_LEAN_AND_MEAN
26 #define WIN32_LEAN_AND_MEAN
36 #define STRSAFE_NO_DEPRECATE
39 /** Convert a string to a wstring
42 std::wstring
StringToWString(const std::string
& String
);
44 /** Convert a wstring to a string
47 std::string
WStringToString(const std::wstring
& String
);
49 /** Convert a string to a wstring
52 std::wstring
UTF8ToWString(const std::string
& String
);
54 /** Retrieve a string from the
55 resources of this module
57 std::wstring
GetResString(int ResId
);
59 /** helper function to judge if the string is only has spaces.
61 <TRUE>if the provided string contains only but at least one space
62 character else <FALSE/>.
64 bool HasOnlySpaces(const std::wstring
& String
);
66 /** convert LocaleSet pair into Windows LCID identifier.
68 Windows Locale Identifier corresponding to input LocaleSet.
71 /** Convert a long path name using Windows api call GetShortPathName
73 std::wstring
getShortPathName(const std::wstring
& aLongName
);
75 LCID
LocaleSetToLCID(const LocaleSet_t
& Locale
);
77 #if OSL_DEBUG_LEVEL >= 2
78 inline void OutputDebugStringFormatW(LPCWSTR pFormat
, ...)
83 va_start(args
, pFormat
);
84 StringCchVPrintfW(buffer
, sizeof(buffer
) / sizeof(*buffer
), pFormat
, args
);
86 OutputDebugStringW(buffer
);
89 static inline void OutputDebugStringFormatW(LPCWSTR
, ...) {}
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */