merge the formfield patch from ooo-build
[ooovba.git] / sc / source / filter / inc / xlstring.hxx
blob0a078a4a56ae03e2b371f44e5ea47298210ee25f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xlstring.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XLSTRING_HXX
32 #define SC_XLSTRING_HXX
34 #include "ftools.hxx"
36 // Constants and enumerations =================================================
38 /** Flags used to specify import/export mode of strings. */
39 typedef sal_uInt16 XclStrFlags;
41 const XclStrFlags EXC_STR_DEFAULT = 0x0000; /// Default string settings.
42 const XclStrFlags EXC_STR_FORCEUNICODE = 0x0001; /// Always use UCS-2 characters (default: try to compress). BIFF8 only.
43 const XclStrFlags EXC_STR_8BITLENGTH = 0x0002; /// 8-bit string length field (default: 16-bit).
44 const XclStrFlags EXC_STR_SMARTFLAGS = 0x0004; /// Omit flags on empty string (default: read/write always). BIFF8 only.
45 const XclStrFlags EXC_STR_SEPARATEFORMATS = 0x0008; /// Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unformatted string.
46 const XclStrFlags EXC_STR_NOHEADER = 0x0010; /// Export: Don't write the length and flag fields.
48 // ----------------------------------------------------------------------------
50 const sal_uInt16 EXC_STR_MAXLEN_8BIT = 0x00FF;
51 const sal_uInt16 EXC_STR_MAXLEN = 0xFFFF;
53 const sal_uInt8 EXC_STRF_16BIT = 0x01;
54 const sal_uInt8 EXC_STRF_FAREAST = 0x04;
55 const sal_uInt8 EXC_STRF_RICH = 0x08;
56 const sal_uInt8 EXC_STRF_UNKNOWN = 0xF2;
58 // Fixed-size characters
59 const sal_uInt8 EXC_LF_C = '\x0A'; /// LF character (used for line break).
60 const sal_uInt16 EXC_LF = EXC_LF_C; /// LF character (unicode).
61 const sal_uInt8 EXC_NUL_C = '\x00'; /// NUL chararcter.
62 const sal_uInt16 EXC_NUL = EXC_NUL_C; /// NUL chararcter (unicode).
64 // Rich-string formatting runs ================================================
66 /** Represents a formatting run for rich-strings.
68 An Excel formatting run stores the first formatted character in a
69 rich-string and the index of a font used to format this and the following
70 characters.
72 struct XclFormatRun
74 sal_uInt16 mnChar; /// First character this format applies to.
75 sal_uInt16 mnFontIdx; /// Excel font index for the next characters.
77 explicit inline XclFormatRun() : mnChar( 0 ), mnFontIdx( 0 ) {}
78 explicit inline XclFormatRun( sal_uInt16 nChar, sal_uInt16 nFontIdx ) :
79 mnChar( nChar ), mnFontIdx( nFontIdx ) {}
82 inline bool operator==( const XclFormatRun& rLeft, const XclFormatRun& rRight )
84 return (rLeft.mnChar == rRight.mnChar) && (rLeft.mnFontIdx == rRight.mnFontIdx);
87 inline bool operator<( const XclFormatRun& rLeft, const XclFormatRun& rRight )
89 return (rLeft.mnChar < rRight.mnChar) || ((rLeft.mnChar == rRight.mnChar) && (rLeft.mnFontIdx < rRight.mnFontIdx));
92 // ----------------------------------------------------------------------------
94 /** A vector with all formatting runs for a rich-string. */
95 typedef ::std::vector< XclFormatRun > XclFormatRunVec;
97 // ============================================================================
99 #endif