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/.
9 * This file incorporates work covered by the following license notice:
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 .
24 #include <string_view>
27 #include <rtl/ustring.hxx>
28 #include <rtl/ustrbuf.hxx>
33 class SvNumberFormatter
;
36 extern const std::u16string_view pKeyTABLE
;
37 extern const std::u16string_view pKeyVECTORS
;
38 extern const std::u16string_view pKeyTUPLES
;
39 extern const std::u16string_view pKeyDATA
;
40 extern const std::u16string_view pKeyBOT
;
41 extern const std::u16string_view pKeyEOD
;
46 T_TABLE
, T_VECTORS
, T_TUPLES
, T_DATA
, T_LABEL
, T_COMMENT
, T_SIZE
,
47 T_PERIODICITY
, T_MAJORSTART
, T_MINORSTART
, T_TRUELENGTH
, T_UINITS
,
52 enum DATASET
{ D_BOT
, D_EOD
, D_NUMERIC
, D_STRING
, D_UNKNOWN
, D_SYNT_ERROR
};
57 OUStringBuffer m_aData
;
61 sal_uInt32 nNumFormat
;
63 SvNumberFormatter
* pNumFormatter
;
65 OUString aLookAheadLine
;
67 bool ReadNextLine( OUString
& rStr
);
69 DATASET
GetNumberDataset( const sal_Unicode
* pPossibleNumericData
);
70 static inline bool IsBOT( const sal_Unicode
* pRef
);
71 static inline bool IsEOD( const sal_Unicode
* pRef
);
72 static inline bool Is1_0( const sal_Unicode
* pRef
);
74 DifParser( SvStream
&, const ScDocument
&, rtl_TextEncoding
);
78 DATASET
GetNextDataset();
80 static const sal_Unicode
* ScanIntVal( const sal_Unicode
* pStart
, sal_uInt32
& rRet
);
82 static inline bool IsNumber( const sal_Unicode cChar
);
84 static inline bool IsV( const sal_Unicode
* pRef
);
87 inline bool DifParser::IsBOT( const sal_Unicode
* pRef
)
89 return pRef
== pKeyBOT
;
92 inline bool DifParser::IsEOD( const sal_Unicode
* pRef
)
94 return pRef
== pKeyEOD
;
97 inline bool DifParser::Is1_0( const sal_Unicode
* pRef
)
99 return pRef
== std::u16string_view(u
"1,0");
102 inline bool DifParser::IsV( const sal_Unicode
* pRef
)
104 return pRef
== std::u16string_view(u
"V");
107 inline bool DifParser::IsNumber( const sal_Unicode cChar
)
109 return ( cChar
>= '0' && cChar
<= '9' );
114 friend class DifAttrCache
;
118 sal_uInt32 nNumFormat
;
124 std::vector
<ENTRY
> maEntries
;
128 void SetNumFormat( const ScDocument
* pDoc
, SCROW nRow
, const sal_uInt32 nNumFormat
);
130 void NewEntry( const SCROW nPos
, const sal_uInt32 nNumFormat
);
132 void Apply( ScDocument
&rDoc
, const SCCOL nCol
, const SCTAB nTab
);
143 void SetNumFormat( const ScDocument
* pDoc
, const SCCOL nCol
, const SCROW nRow
, const sal_uInt32 nNumFormat
);
145 void Apply( ScDocument
&, SCTAB nTab
);
149 std::map
<SCCOL
, std::unique_ptr
<DifColumn
>> maColMap
;
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */