bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / filter / msfilter / util.hxx
blobc4197c8b2d1e689c876a8390a35c6769743c0dd9
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>
21 class Color;
23 namespace com { namespace sun { namespace star {
24 namespace awt { struct Size; }
25 namespace lang { struct Locale; }
26 } } }
28 namespace msfilter {
29 namespace 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 sal_uInt32 BGRToRGB(sal_uInt32 nColour);
39 /** Convert from DTTM to Writer's DateTime
41 MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( 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 );
67 /** Paper size in 1/100 millimeters. */
68 struct MSFILTER_DLLPUBLIC ApiPaperSize
70 sal_Int32 mnWidth;
71 sal_Int32 mnHeight;
74 class MSFILTER_DLLPUBLIC PaperSizeConv
76 public:
77 static sal_Int32 getMSPaperSizeIndex( const css::awt::Size& rSize );
78 static const ApiPaperSize& getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex );
81 /**
82 * Finds the quoted text in a field instruction text.
84 * Example: SEQ "Figure" \someoption -> "Figure"
86 MSFILTER_DLLPUBLIC OUString findQuotedText( const OUString& rCommand, const sal_Char* cStartQuote, const sal_Unicode uEndQuote );
88 class MSFILTER_DLLPUBLIC WW8ReadFieldParams
90 private:
91 const OUString aData;
92 sal_Int32 nFnd;
93 sal_Int32 nNext;
94 sal_Int32 nSavPtr;
95 public:
96 WW8ReadFieldParams( const OUString& rData );
98 bool GoToTokenParam();
99 sal_Int32 SkipToNextToken();
100 sal_Int32 GetTokenSttPtr() const { return nFnd; }
102 sal_Int32 FindNextStringPiece( sal_Int32 _nStart = -1 );
103 bool GetTokenSttFromTo(sal_Int32* _pFrom, sal_Int32* _pTo, sal_Int32 _nMax);
105 OUString GetResult() const;
108 struct MSFILTER_DLLPUBLIC EquationResult
110 OUString sResult;
111 OUString sType;
114 MSFILTER_DLLPUBLIC EquationResult ParseCombinedChars(const OUString& rStr);
116 /// Similar to EnhancedCustomShapeTypeNames::Get(), but it also supports OOXML types and returns a drawingML string.
117 MSFILTER_DLLPUBLIC const char* GetOOXMLPresetGeometry( const char* sShapeType );
119 /// Similar to EnhancedCustomShapeTypeNames::Get(), but returns an MSO_SPT (binary / VML type).
120 MSFILTER_DLLPUBLIC MSO_SPT GETVMLShapeType(const OString& aType);
123 * The following function checks if a MSO shapetype is allowed to have textboxcontent.
125 * @param nShapeType shape to check
127 MSFILTER_DLLPUBLIC bool HasTextBoxContent(sal_uInt32 nShapeType);
130 * Convert the input color value to an ico value (0..16)
132 * @param[in] rCol input color for conversion
134 * @return ico value [0..16]
136 MSFILTER_DLLPUBLIC sal_uInt8 TransColToIco( const Color& rCol );
142 #endif
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */