tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / filter / msfilter / util.hxx
blob495c8ed1358165cd29b244684bb6d74d654cb9b3
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_UTIL_HXX
11 #define INCLUDED_FILTER_MSFILTER_UTIL_HXX
13 #include <filter/msfilter/msfilterdllapi.h>
14 #include <svx/msdffdef.hxx>
15 #include <rtl/string.hxx>
16 #include <rtl/textenc.h>
17 #include <rtl/ustring.hxx>
18 #include <sal/types.h>
19 #include <tools/datetime.hxx>
20 #include <tools/long.hxx>
22 class Color;
24 namespace com::sun::star {
25 namespace awt { struct Size; }
26 namespace lang { struct Locale; }
29 namespace msfilter::util {
31 /// Returns the best-fit default 8bit encoding for a given locale
32 /// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
33 /// what the encoding is, but you know or can guess the language
34 MSFILTER_DLLPUBLIC rtl_TextEncoding getBestTextEncodingFromLocale(const css::lang::Locale &rLocale);
36 /// Convert a color in BGR format to RGB.
37 MSFILTER_DLLPUBLIC ::Color BGRToRGB(sal_uInt32 nColour);
39 /** Convert from DTTM to Writer's DateTime
41 MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( tools::Long lDTTM );
43 /** Convert DateTime to xsd::dateTime string.
45 I guess there must be an implementation of this somewhere in LO, but I failed
46 to find it, unfortunately :-(
49 /// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
50 /// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
51 /// best-fit replacement in terms of default available MSOffice symbol
52 /// fonts.
53 ///
54 /// Used to map from [Open|Star]Symbol to some Windows font or other.
55 MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
56 rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName);
59 /**
60 * Converts tools Color to HTML color (without leading hashmark).
62 * @param rColor color to convert
64 MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
65 MSFILTER_DLLPUBLIC OUString ConvertColorOU( const Color &rColor );
68 /** Paper size in 1/100 millimeters. */
69 struct MSFILTER_DLLPUBLIC ApiPaperSize
71 sal_Int32 mnWidth;
72 sal_Int32 mnHeight;
75 class MSFILTER_DLLPUBLIC PaperSizeConv
77 public:
78 static sal_Int32 getMSPaperSizeIndex( const css::awt::Size& rSize );
79 static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
82 MSFILTER_DLLPUBLIC OUString CreateDOCXStyleId(std::u16string_view aName);
84 /**
85 * Finds the quoted text in a field instruction text.
87 * Example: SEQ "Figure" \someoption -> "Figure"
89 MSFILTER_DLLPUBLIC std::u16string_view findQuotedText( std::u16string_view rCommand, std::u16string_view cStartQuote, const sal_Unicode uEndQuote );
91 class MSFILTER_DLLPUBLIC WW8ReadFieldParams
93 private:
94 const OUString aData;
95 sal_Int32 nFnd;
96 sal_Int32 nNext;
97 sal_Int32 nSavPtr;
98 public:
99 WW8ReadFieldParams( OUString aData );
101 bool GoToTokenParam();
102 sal_Int32 SkipToNextToken();
103 sal_Int32 GetTokenSttPtr() const { return nFnd; }
105 sal_Int32 FindNextStringPiece( sal_Int32 _nStart = -1 );
106 bool GetTokenSttFromTo(sal_Int32* _pFrom, sal_Int32* _pTo, sal_Int32 _nMax);
108 OUString GetResult() const;
111 struct MSFILTER_DLLPUBLIC EquationResult
113 OUString sResult;
114 OUString sType;
117 MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
119 /// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawingML string.
120 MSFILTER_DLLPUBLIC OString GetOOXMLPresetGeometry( std::u16string_view rShapeType );
122 /// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
123 MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(std::u16string_view aType);
126 * The following function checks if a MSO shapetype is allowed to have textboxcontent.
128 * @param nShapeType shape to check
130 MSFILTER_DLLPUBLIC bool HasTextBoxContent(sal_uInt32 nShapeType);
133 * Convert the input color value to an ico value (0..16)
135 * @param[in] rCol input color for conversion
137 * @return ico value [0..16]
139 MSFILTER_DLLPUBLIC sal_uInt8 TransColToIco( const Color& rCol );
145 #endif
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */