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/.
10 #ifndef INCLUDED_MSFILTER_UTIL_HXX
11 #define INCLUDED_MSFILTER_UTIL_HXX
13 #include <rtl/textenc.h>
14 #include <tools/datetime.hxx>
15 #include <tools/color.hxx>
16 #include <com/sun/star/lang/Locale.hpp>
17 #include "filter/msfilter/msfilterdllapi.h"
18 #include <com/sun/star/awt/Size.hpp>
23 /// Returns the best-fit default 8bit encoding for a given locale
24 /// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
25 /// what the encoding is, but you know or can guess the language
26 MSFILTER_DLLPUBLIC rtl_TextEncoding
getBestTextEncodingFromLocale(const ::com::sun::star::lang::Locale
&rLocale
);
28 /// Convert a color in BGR format to RGB.
29 MSFILTER_DLLPUBLIC sal_uInt32
BGRToRGB(sal_uInt32 nColour
);
31 /** Convert from DTTM to Writer's DateTime
34 <a href="mailto:mmaher@openoffice.org">Martin Maher</a
36 MSFILTER_DLLPUBLIC DateTime
DTTM2DateTime( long lDTTM
);
38 /** Convert DateTime to xsd::dateTime string.
40 I guess there must be an implementation of this somewhere in LO, but I failed
41 to find it, unfortunately :-(
43 MSFILTER_DLLPUBLIC OString
DateTimeToOString( const DateTime
& rDateTime
);
45 /// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
46 /// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
47 /// best-fit replacement in terms of default available MSOffice symbol
50 /// Set bDisableUnicodeSupport when exporting to 8bit encodings
52 /// Used to map from [Open|Star]Symbol to some Windows font or other.
53 MSFILTER_DLLPUBLIC sal_Unicode
bestFitOpenSymbolToMSFont(sal_Unicode cBullet
,
54 rtl_TextEncoding
& r_ioChrSet
, OUString
& r_ioFontName
, bool bDisableUnicodeSupport
= false);
65 /** Categorize codepoints according to how MS seems to do it.
67 It's been bugging me for ages as to what codepoint MS considers in
68 what category. Tom Jebo has a post suggesting the criteria used here
69 and indicating its been submitting to the standards working group
70 as a proposed resolution.
72 MSFILTER_DLLPUBLIC TextCategory
categorizeCodePoint(sal_uInt32 codePoint
, const OUString
&rBcp47LanguageTag
);
74 /// Converts tools Color to HTML color (without leading hashmark).
75 MSFILTER_DLLPUBLIC OString
ConvertColor( const Color
&rColor
);
78 /** Paper size in 1/100 millimeters. */
79 struct MSFILTER_DLLPUBLIC ApiPaperSize
85 class MSFILTER_DLLPUBLIC PaperSizeConv
88 static sal_Int32
getMSPaperSizeIndex( const com::sun::star::awt::Size
& rSize
);
89 static const ApiPaperSize
& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex
);
93 * Finds the quoted text in a field instruction text.
95 * Example: SEQ "Figure" \someoption -> "Figure"
97 MSFILTER_DLLPUBLIC OUString
findQuotedText( const OUString
& rCommand
, const sal_Char
* cStartQuote
, const sal_Unicode uEndQuote
);
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */