LibreOffice Module sc (master) 1
xlstring.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <vector>
23#include <sal/types.h>
25
26// Constants and enumerations =================================================
27
29enum class XclStrFlags : sal_uInt16 {
30 NONE = 0x0000,
31 ForceUnicode = 0x0001,
32 EightBitLength = 0x0002,
33 SmartFlags = 0x0004,
34 SeparateFormats = 0x0008,
35 NoHeader = 0x0010,
36};
37namespace o3tl {
38 template<> struct typed_flags<XclStrFlags> : is_typed_flags<XclStrFlags, 0x001f> {};
39}
40
41
42const sal_uInt16 EXC_STR_MAXLEN_8BIT = 0x00FF;
43const sal_uInt16 EXC_STR_MAXLEN = 0x7FFF;
44
49
50// Fixed-size characters
51const sal_uInt8 EXC_LF_C = '\x0A';
52const sal_uInt16 EXC_LF = EXC_LF_C;
53const sal_uInt8 EXC_NUL_C = '\x00';
54const sal_uInt16 EXC_NUL = EXC_NUL_C;
55
56// Rich-string formatting runs ================================================
57
65{
66 sal_uInt16 mnChar;
67 sal_uInt16 mnFontIdx;
68
69 explicit XclFormatRun() : mnChar( 0 ), mnFontIdx( 0 ) {}
70 explicit XclFormatRun( sal_uInt16 nChar, sal_uInt16 nFontIdx ) :
71 mnChar( nChar ), mnFontIdx( nFontIdx ) {}
72};
73
74inline bool operator==( const XclFormatRun& rLeft, const XclFormatRun& rRight )
75{
76 return (rLeft.mnChar == rRight.mnChar) && (rLeft.mnFontIdx == rRight.mnFontIdx);
77}
78
79inline bool operator<( const XclFormatRun& rLeft, const XclFormatRun& rRight )
80{
81 return (rLeft.mnChar < rRight.mnChar) || ((rLeft.mnChar == rRight.mnChar) && (rLeft.mnFontIdx < rRight.mnFontIdx));
82}
83
85typedef ::std::vector< XclFormatRun > XclFormatRunVec;
86
87/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
NONE
NUL character (unicode).
Definition: xlstring.hxx:65
sal_uInt16 mnChar
Definition: xlstring.hxx:66
XclFormatRun(sal_uInt16 nChar, sal_uInt16 nFontIdx)
Definition: xlstring.hxx:70
XclFormatRun()
Excel font index for the next characters.
Definition: xlstring.hxx:69
sal_uInt16 mnFontIdx
First character this format applies to.
Definition: xlstring.hxx:67
unsigned char sal_uInt8
const sal_uInt16 EXC_LF
LF character (used for line break).
Definition: xlstring.hxx:52
const sal_uInt8 EXC_STRF_RICH
Definition: xlstring.hxx:47
const sal_uInt16 EXC_STR_MAXLEN_8BIT
Definition: xlstring.hxx:42
const sal_uInt16 EXC_NUL
NUL character.
Definition: xlstring.hxx:54
const sal_uInt8 EXC_NUL_C
LF character (unicode).
Definition: xlstring.hxx:53
const sal_uInt16 EXC_STR_MAXLEN
Definition: xlstring.hxx:43
const sal_uInt8 EXC_LF_C
Definition: xlstring.hxx:51
bool operator<(const XclFormatRun &rLeft, const XclFormatRun &rRight)
Definition: xlstring.hxx:79
::std::vector< XclFormatRun > XclFormatRunVec
A vector with all formatting runs for a rich-string.
Definition: xlstring.hxx:85
XclStrFlags
Flags used to specify import/export mode of strings.
Definition: xlstring.hxx:29
@ EightBitLength
Always use UCS-2 characters (default: try to compress). BIFF8 only.
@ NoHeader
Import: Keep old formats when reading unformatted string (default: clear formats); Export: Write unfo...
@ SeparateFormats
Omit flags on empty string (default: read/write always). BIFF8 only.
@ ForceUnicode
Default string settings.
@ SmartFlags
8-bit string length field (default: 16-bit).
const sal_uInt8 EXC_STRF_UNKNOWN
Definition: xlstring.hxx:48
const sal_uInt8 EXC_STRF_FAREAST
Definition: xlstring.hxx:46
bool operator==(const XclFormatRun &rLeft, const XclFormatRun &rRight)
Definition: xlstring.hxx:74
const sal_uInt8 EXC_STRF_16BIT
Definition: xlstring.hxx:45