tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / filter / msfilter / rtfutil.hxx
blob44ed15c7085708cc930abfecf125ffb48aefdde5
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/.
8 */
10 #ifndef INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
11 #define INCLUDED_FILTER_MSFILTER_RTFUTIL_HXX
13 #include <filter/msfilter/msfilterdllapi.h>
14 #include <rtl/string.hxx>
15 #include <rtl/textenc.h>
16 #include <sal/types.h>
17 #include <tools/solar.h>
19 // RTF values are often multiplied by 2^16
20 #define RTF_MULTIPLIER 65536
22 class SvStream;
24 namespace msfilter::rtfutil
26 /// Outputs a single character in hex form.
27 MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen);
29 /// Handles correct unicode and legacy export of a single character.
30 MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int* pUCMode, rtl_TextEncoding eDestEnc,
31 bool* pSuccess, bool bUnicode = true);
33 /**
34 * Handles correct unicode and legacy export of a string.
36 * @param rStr the string to export
37 * @param eDestEnc the legacy encoding to use
38 * @param bUnicode if unicode output is wanted as well, or just legacy
40 MSFILTER_DLLPUBLIC OString OutString(std::u16string_view rStr, rtl_TextEncoding eDestEnc,
41 bool bUnicode = true);
43 /**
44 * Handles correct unicode and legacy export of a string, when a
45 * '{' \upr '{' keyword ansi_text '}{\*' \ud '{' keyword Unicode_text '}}}'
46 * construct should be used.
48 * @param pToken the keyword
49 * @param rStr the text to export
50 * @param eDestEnc the legacy encoding to use
52 MSFILTER_DLLPUBLIC OString OutStringUpr(std::string_view pToken, std::u16string_view rStr,
53 rtl_TextEncoding eDestEnc);
55 /**
56 * Get the numeric value of a single character, representing a hex value.
58 * @return -1 on failure
60 MSFILTER_DLLPUBLIC int AsHex(char ch);
62 /// Writes binary data as a hex dump.
63 MSFILTER_DLLPUBLIC OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize,
64 SvStream* pStream = nullptr, sal_uInt32 nLimit = 64);
66 /**
67 * Extract OLE2 data from an \objdata hex dump.
69 MSFILTER_DLLPUBLIC bool ExtractOLE2FromObjdata(const OString& rObjdata, SvStream& rOle2);
71 /// Strips the header of a WMF file.
72 MSFILTER_DLLPUBLIC bool StripMetafileHeader(const sal_uInt8*& rpGraphicAry, sal_uInt64& rSize);
75 #endif
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */