LibreOffice Module sc (master) 1
difimp.cxx
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#include <svl/numformat.hxx>
21#include <tools/stream.hxx>
22#include <osl/diagnose.h>
23#include <dif.hxx>
24#include <docpool.hxx>
25#include <document.hxx>
26#include <fprogressbar.hxx>
27#include <ftools.hxx>
28#include <patattr.hxx>
29#include <scerrors.hxx>
30#include <scitems.hxx>
31#include <stringutil.hxx>
32#include <table.hxx>
33#include <memory>
34
35const std::u16string_view pKeyTABLE = u"TABLE";
36const std::u16string_view pKeyVECTORS = u"VECTORS";
37const std::u16string_view pKeyTUPLES = u"TUPLES";
38const std::u16string_view pKeyDATA = u"DATA";
39const std::u16string_view pKeyBOT = u"BOT";
40const std::u16string_view pKeyEOD = u"EOD";
41
43 const rtl_TextEncoding eVon )
44{
45 DifParser aDifParser( rIn, *pDoc, eVon );
46
47 SCTAB nBaseTab = rInsPos.Tab();
48
49 TOPIC eTopic = T_UNKNOWN;
50 bool bSyntErrWarn = false;
51 bool bOverflowWarn = false;
52
53 OUStringBuffer& rData = aDifParser.m_aData;
54
55 rIn.Seek( 0 );
56
57 ScfStreamProgressBar aPrgrsBar( rIn, pDoc->GetDocumentShell() );
58
59 while( eTopic != T_DATA && eTopic != T_END )
60 {
61 eTopic = aDifParser.GetNextTopic();
62
63 aPrgrsBar.Progress();
64
65 const bool bData = !rData.isEmpty();
66
67 switch( eTopic )
68 {
69 case T_TABLE:
70 {
71 if( aDifParser.nVector != 0 || aDifParser.nVal != 1 )
72 bSyntErrWarn = true;
73 if( bData )
74 pDoc->RenameTab(nBaseTab, rData.toString());
75 }
76 break;
77 case T_VECTORS:
78 {
79 if( aDifParser.nVector != 0 )
80 bSyntErrWarn = true;
81 }
82 break;
83 case T_TUPLES:
84 {
85 if( aDifParser.nVector != 0 )
86 bSyntErrWarn = true;
87 }
88 break;
89 case T_DATA:
90 {
91 if( aDifParser.nVector != 0 || aDifParser.nVal != 0 )
92 bSyntErrWarn = true;
93 }
94 break;
95 case T_LABEL:
96 case T_COMMENT:
97 case T_SIZE:
98 case T_PERIODICITY:
99 case T_MAJORSTART:
100 case T_MINORSTART:
101 case T_TRUELENGTH:
102 case T_UINITS:
103 case T_DISPLAYUNITS:
104 case T_END:
105 case T_UNKNOWN:
106 break;
107 default:
108 OSL_FAIL( "ScImportDif - missing enum" );
109 }
110
111 }
112
113 if( eTopic == T_DATA )
114 { // data starts here
115 SCCOL nBaseCol = rInsPos.Col();
116
117 SCCOL nColCnt = SCCOL_MAX;
118 SCROW nRowCnt = rInsPos.Row();
119 DifAttrCache aAttrCache;
120
121 DATASET eCurrent = D_UNKNOWN;
122
123 ScSetStringParam aStrParam; // used to set string value without number detection.
124 aStrParam.setTextInput();
125
126 while( eCurrent != D_EOD )
127 {
128 eCurrent = aDifParser.GetNextDataset();
129
130 aPrgrsBar.Progress();
131 ScAddress aPos(nColCnt, nRowCnt, nBaseTab);
132 const OUString aData = rData.makeStringAndClear();
133
134 switch( eCurrent )
135 {
136 case D_BOT:
137 if( nColCnt < SCCOL_MAX )
138 nRowCnt++;
139 nColCnt = nBaseCol;
140 break;
141 case D_EOD:
142 break;
143 case D_NUMERIC: // Number cell
144 if( nColCnt == SCCOL_MAX )
145 nColCnt = nBaseCol;
146
147 if( pDoc->ValidCol(nColCnt) && pDoc->ValidRow(nRowCnt) )
148 {
149 pDoc->EnsureTable(nBaseTab);
150
151 if( DifParser::IsV( aData.getStr() ) )
152 {
153 pDoc->SetValue(aPos, aDifParser.fVal);
154 aAttrCache.SetNumFormat( pDoc, nColCnt, nRowCnt,
155 aDifParser.nNumFormat );
156 }
157 else if( aData == "TRUE" || aData == "FALSE" )
158 {
159 pDoc->SetValue(aPos, aDifParser.fVal);
160 aAttrCache.SetNumFormat( pDoc, nColCnt, nRowCnt,
161 aDifParser.nNumFormat );
162 }
163 else if( aData == "NA" || aData == "ERROR" )
164 {
165 pDoc->SetString(aPos, aData, &aStrParam);
166 }
167 else
168 {
169 OUString aTmp = "#IND:" + aData + "?";
170 pDoc->SetString(aPos, aTmp, &aStrParam);
171 }
172 }
173 else
174 bOverflowWarn = true;
175
176 nColCnt++;
177 break;
178 case D_STRING: // Text cell
179 if( nColCnt == SCCOL_MAX )
180 nColCnt = nBaseCol;
181
182 if( pDoc->ValidCol(nColCnt) && pDoc->ValidRow(nRowCnt) )
183 {
184 if (!aData.isEmpty())
185 {
186 pDoc->EnsureTable(nBaseTab);
187 pDoc->SetTextCell(aPos, aData);
188 }
189 }
190 else
191 bOverflowWarn = true;
192
193 nColCnt++;
194 break;
195 case D_UNKNOWN:
196 break;
197 case D_SYNT_ERROR:
198 break;
199 default:
200 OSL_FAIL( "ScImportDif - missing enum" );
201 }
202 }
203
204 aAttrCache.Apply( *pDoc, nBaseTab );
205 }
206 else
207 return SCERR_IMPORT_FORMAT;
208
209 if( bSyntErrWarn )
210
211 // FIXME: Add proper warning!
213
214 else if( bOverflowWarn )
216 else
217 return ERRCODE_NONE;
218}
219
220DifParser::DifParser( SvStream& rNewIn, const ScDocument& rDoc, rtl_TextEncoding eCharSet )
221 : fVal(0.0)
222 , nVector(0)
223 , nVal(0)
224 , nNumFormat(0)
225 , pNumFormatter(rDoc.GetFormatTable())
226 , rIn(rNewIn)
227{
228 if ( rIn.GetStreamCharSet() != eCharSet )
229 {
230 OSL_FAIL( "CharSet passed overrides and modifies StreamCharSet" );
231 rIn.SetStreamCharSet( eCharSet );
232 }
233 rIn.StartReadingUnicodeText( eCharSet );
234}
235
237{
238 enum STATE { S_VectorVal, S_Data, S_END, S_START, S_UNKNOWN, S_ERROR_L2 };
239
240 static const std::u16string_view ppKeys[] =
241 {
242 pKeyTABLE, // 0
245 pKeyDATA,
246 u"LABEL",
247 u"COMMENT", // 5
248 u"SIZE",
249 u"PERIODICITY",
250 u"MAJORSTART",
251 u"MINORSTART",
252 u"TRUELENGTH", // 10
253 u"UINITS",
254 u"DISPLAYUNITS",
255 u"" // 13
256 };
257
258 static const TOPIC pTopics[] =
259 {
260 T_TABLE, // 0
261 T_VECTORS,
262 T_TUPLES,
263 T_DATA,
264 T_LABEL,
265 T_COMMENT, // 5
266 T_SIZE,
270 T_TRUELENGTH, // 10
271 T_UINITS,
273 T_UNKNOWN // 13
274 };
275
276 STATE eS = S_START;
277 OUString aLine;
278
279 nVector = 0;
280 nVal = 0;
281 TOPIC eRet = T_UNKNOWN;
282
283 while( eS != S_END )
284 {
285 if( !ReadNextLine( aLine ) )
286 {
287 eS = S_END;
288 eRet = T_END;
289 }
290
291 switch( eS )
292 {
293 case S_START:
294 {
295 const std::u16string_view* pRef;
296 sal_uInt16 nCnt = 0;
297 bool bSearch = true;
298
299 pRef = &ppKeys[ nCnt ];
300
301 while( bSearch )
302 {
303 if( aLine == *pRef )
304 {
305 eRet = pTopics[ nCnt ];
306 bSearch = false;
307 }
308 else
309 {
310 nCnt++;
311 pRef = &ppKeys[ nCnt ];
312 if( pRef->empty() )
313 bSearch = false;
314 }
315 }
316
317 if( !pRef->empty() )
318 eS = S_VectorVal;
319 else
320 eS = S_UNKNOWN;
321 }
322 break;
323 case S_VectorVal:
324 {
325 const sal_Unicode* pCur = aLine.getStr();
326
327 pCur = ScanIntVal( pCur, nVector );
328
329 if( pCur && *pCur == ',' )
330 {
331 pCur++;
332 ScanIntVal( pCur, nVal );
333 eS = S_Data;
334 }
335 else
336 eS = S_ERROR_L2;
337 }
338 break;
339 case S_Data:
340 OSL_ENSURE( aLine.getLength() >= 2,
341 "+GetNextTopic(): <String> is too short!" );
342 if( aLine.getLength() > 2 )
343 m_aData.append(aLine.subView(1, aLine.getLength() - 2));
344 else
345 m_aData.truncate();
346 eS = S_END;
347 break;
348 case S_END:
349 OSL_FAIL( "DifParser::GetNextTopic - unexpected state" );
350 break;
351 case S_UNKNOWN:
352 // skip 2 lines
353 ReadNextLine( aLine );
354 [[fallthrough]];
355 case S_ERROR_L2: // error happened in line 2
356 // skip 1 line
357 ReadNextLine( aLine );
358 eS = S_END;
359 break;
360 default:
361 OSL_FAIL( "DifParser::GetNextTopic - missing enum" );
362 }
363 }
364
365 return eRet;
366}
367
368static void lcl_DeEscapeQuotesDif(OUStringBuffer& rString)
369{
370 // Special handling for DIF import: Escaped (duplicated) quotes are resolved.
371 // Single quote characters are left in place because older versions didn't
372 // escape quotes in strings (and Excel doesn't when using the clipboard).
373 // The quotes around the string are removed before this function is called.
374
375 rString = rString.makeStringAndClear().replaceAll("\"\"", "\"");
376}
377
378// Determine if passed in string is numeric data and set fVal/nNumFormat if so
379DATASET DifParser::GetNumberDataset( const sal_Unicode* pPossibleNumericData )
380{
381 DATASET eRet = D_SYNT_ERROR;
382
383 OSL_ENSURE( pNumFormatter, "-DifParser::GetNumberDataset(): No Formatter, more fun!" );
384 OUString aTestVal( pPossibleNumericData );
385 sal_uInt32 nFormat = 0;
386 double fTmpVal;
387 if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
388 {
389 fVal = fTmpVal;
390 nNumFormat = nFormat;
391 eRet = D_NUMERIC;
392 }
393 else
394 eRet = D_SYNT_ERROR;
395
396 return eRet;
397}
398
399bool DifParser::ReadNextLine( OUString& rStr )
400{
401 if( aLookAheadLine.isEmpty() )
402 {
404 }
405 else
406 {
407 rStr = aLookAheadLine;
408 aLookAheadLine.clear();
409 return true;
410 }
411}
412
413// Look ahead in the stream to determine if the next line is the first line of
414// a valid data record structure
416{
417 const sal_Unicode* pCurrentBuffer;
418 bool bValidStructure = false;
419
420 OSL_ENSURE( aLookAheadLine.isEmpty(), "*DifParser::LookAhead(): LookAhead called twice in a row" );
422
423 pCurrentBuffer = aLookAheadLine.getStr();
424
425 switch( *pCurrentBuffer )
426 {
427 case '-': // Special Datatype
428 pCurrentBuffer++;
429
430 if( Is1_0( pCurrentBuffer ) )
431 {
432 bValidStructure = true;
433 }
434 break;
435 case '0': // Numeric Data
436 pCurrentBuffer++;
437 if( *pCurrentBuffer == ',' )
438 {
439 pCurrentBuffer++;
440 bValidStructure = ( GetNumberDataset(pCurrentBuffer) != D_SYNT_ERROR );
441 }
442 break;
443 case '1': // String Data
444 if( Is1_0( aLookAheadLine.getStr() ) )
445 {
446 bValidStructure = true;
447 }
448 break;
449 }
450 return bValidStructure;
451}
452
454{
455 DATASET eRet = D_UNKNOWN;
456 OUString aLine;
457 const sal_Unicode* pCurrentBuffer;
458
459 ReadNextLine( aLine );
460
461 pCurrentBuffer = aLine.getStr();
462
463 switch( *pCurrentBuffer )
464 {
465 case '-': // Special Datatype
466 pCurrentBuffer++;
467
468 if( Is1_0( pCurrentBuffer ) )
469 {
470 ReadNextLine( aLine );
471 if( IsBOT( aLine.getStr() ) )
472 eRet = D_BOT;
473 else if( IsEOD( aLine.getStr() ) )
474 eRet = D_EOD;
475 }
476 break;
477 case '0': // Numeric Data
478 pCurrentBuffer++; // value in fVal, 2. line in m_aData
479 if( *pCurrentBuffer == ',' )
480 {
481 pCurrentBuffer++;
482 eRet = GetNumberDataset(pCurrentBuffer);
483 OUString aTmpLine;
484 ReadNextLine( aTmpLine );
485 if ( eRet == D_SYNT_ERROR )
486 { // for broken records write "#ERR: data" to cell
487 m_aData = OUString::Concat("#ERR: ") + pCurrentBuffer + " (" + aTmpLine + ")";
488 eRet = D_STRING;
489 }
490 else
491 {
492 m_aData = aTmpLine;
493 }
494 }
495 break;
496 case '1': // String Data
497 if( Is1_0( aLine.getStr() ) )
498 {
499 ReadNextLine( aLine );
500 sal_Int32 nLineLength = aLine.getLength();
501 const sal_Unicode* pLine = aLine.getStr();
502
503 if( nLineLength >= 1 && *pLine == '"' )
504 {
505 // Quotes are not always escaped (duplicated), see lcl_DeEscapeQuotesDif
506 // A look ahead into the next line is needed in order to deal with
507 // multiline strings containing quotes
508 if( LookAhead() )
509 {
510 // Single line string
511 if( nLineLength >= 2 && pLine[nLineLength - 1] == '"' )
512 {
513 m_aData = aLine.subView( 1, nLineLength - 2 );
515 eRet = D_STRING;
516 }
517 }
518 else
519 {
520 // Multiline string
521 m_aData = aLine.subView( 1 );
522 bool bContinue = true;
523 while ( bContinue )
524 {
525 m_aData.append("\n");
526 bContinue = !rIn.eof() && ReadNextLine( aLine );
527 if( bContinue )
528 {
529 nLineLength = aLine.getLength();
530 if( nLineLength >= 1 )
531 {
532 pLine = aLine.getStr();
533 bContinue = !LookAhead();
534 if( bContinue )
535 {
536 m_aData.append(aLine);
537 }
538 else if( pLine[nLineLength - 1] == '"' )
539 {
540 m_aData.append(aLine.subView(0, nLineLength -1));
542 eRet = D_STRING;
543 }
544 }
545 }
546 }
547 }
548 }
549 }
550 break;
551 }
552
553 if( eRet == D_UNKNOWN )
554 ReadNextLine( aLine );
555
556 if( rIn.eof() )
557 eRet = D_EOD;
558
559 return eRet;
560}
561
562const sal_Unicode* DifParser::ScanIntVal( const sal_Unicode* pStart, sal_uInt32& rRet )
563{
564 // eat leading whitespace, not specified, but seen in the wild
565 while (*pStart == ' ' || *pStart == '\t')
566 ++pStart;
567
568 sal_Unicode cCurrent = *pStart;
569
570 if( IsNumber( cCurrent ) )
571 rRet = static_cast<sal_uInt32>( cCurrent - '0' );
572 else
573 return nullptr;
574
575 pStart++;
576 cCurrent = *pStart;
577
578 while( IsNumber( cCurrent ) && rRet < ( 0xFFFFFFFF / 10 ) )
579 {
580 rRet *= 10;
581 rRet += static_cast<sal_uInt32>( cCurrent - '0' );
582
583 pStart++;
584 cCurrent = *pStart;
585 }
586
587 return pStart;
588}
589
591 : mpCurrent(nullptr)
592{
593}
594
595void DifColumn::SetNumFormat( const ScDocument* pDoc, SCROW nRow, const sal_uInt32 nNumFormat )
596{
597 OSL_ENSURE( pDoc->ValidRow(nRow), "*DifColumn::SetNumFormat(): Row too big!" );
598
599 if( nNumFormat > 0 )
600 {
601 if(mpCurrent)
602 {
603 OSL_ENSURE( nRow > 0,
604 "*DifColumn::SetNumFormat(): more cannot be zero!" );
605 OSL_ENSURE( nRow > mpCurrent->nEnd,
606 "*DifColumn::SetNumFormat(): start from scratch?" );
607
608 if( mpCurrent->nNumFormat == nNumFormat && mpCurrent->nEnd == nRow - 1 )
609 mpCurrent->nEnd = nRow;
610 else
611 NewEntry( nRow, nNumFormat );
612 }
613 else
614 NewEntry(nRow,nNumFormat );
615 }
616 else
617 mpCurrent = nullptr;
618}
619
620void DifColumn::NewEntry( const SCROW nPos, const sal_uInt32 nNumFormat )
621{
622 maEntries.emplace_back();
623 mpCurrent = &maEntries.back();
625 mpCurrent->nNumFormat = nNumFormat;
626
627}
628
629void DifColumn::Apply( ScDocument& rDoc, const SCCOL nCol, const SCTAB nTab )
630{
631 ScPatternAttr aAttr( rDoc.GetPool() );
632 SfxItemSet &rItemSet = aAttr.GetItemSet();
633
634 for (const auto& rEntry : maEntries)
635 {
636 OSL_ENSURE( rEntry.nNumFormat > 0,
637 "+DifColumn::Apply(): Number format must not be 0!" );
638
639 rItemSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, rEntry.nNumFormat ) );
640
641 rDoc.ApplyPatternAreaTab( nCol, rEntry.nStart, nCol, rEntry.nEnd, nTab, aAttr );
642
643 rItemSet.ClearItem();
644 }
645}
646
648{
649}
650
652{
653}
654
655void DifAttrCache::SetNumFormat( const ScDocument* pDoc, const SCCOL nCol, const SCROW nRow, const sal_uInt32 nNumFormat )
656{
657 OSL_ENSURE( pDoc->ValidCol(nCol), "-DifAttrCache::SetNumFormat(): Col too big!" );
658
659 if( !maColMap.count(nCol) )
660 maColMap[ nCol ].reset( new DifColumn );
661
662 maColMap[ nCol ]->SetNumFormat( pDoc, nRow, nNumFormat );
663}
664
666{
667 for( SCCOL nCol : rDoc.GetWritableColumnsRange(nTab, 0, rDoc.MaxCol()) )
668 {
669 if( maColMap.count(nCol) )
670 maColMap[ nCol ]->Apply( rDoc, nCol, nTab );
671 }
672}
673
674/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCCOL SCCOL_MAX
Definition: address.hxx:56
std::map< SCCOL, std::unique_ptr< DifColumn > > maColMap
Definition: dif.hxx:149
void SetNumFormat(const ScDocument *pDoc, const SCCOL nCol, const SCROW nRow, const sal_uInt32 nNumFormat)
Definition: difimp.cxx:655
void Apply(ScDocument &, SCTAB nTab)
Definition: difimp.cxx:665
ENTRY * mpCurrent
Definition: dif.hxx:123
DifColumn()
Definition: difimp.cxx:590
std::vector< ENTRY > maEntries
Definition: dif.hxx:124
void NewEntry(const SCROW nPos, const sal_uInt32 nNumFormat)
Definition: difimp.cxx:620
void SetNumFormat(const ScDocument *pDoc, SCROW nRow, const sal_uInt32 nNumFormat)
Definition: difimp.cxx:595
void Apply(ScDocument &rDoc, const SCCOL nCol, const SCTAB nTab)
Definition: difimp.cxx:629
double fVal
Definition: dif.hxx:58
TOPIC GetNextTopic()
Definition: difimp.cxx:236
OUStringBuffer m_aData
Definition: dif.hxx:57
SvStream & rIn
Definition: dif.hxx:64
bool LookAhead()
Definition: difimp.cxx:415
DATASET GetNumberDataset(const sal_Unicode *pPossibleNumericData)
Definition: difimp.cxx:379
static bool IsBOT(const sal_Unicode *pRef)
Definition: dif.hxx:87
sal_uInt32 nVector
Definition: dif.hxx:59
static bool Is1_0(const sal_Unicode *pRef)
Definition: dif.hxx:97
DifParser(SvStream &, const ScDocument &, rtl_TextEncoding)
Definition: difimp.cxx:220
sal_uInt32 nVal
Definition: dif.hxx:60
static bool IsNumber(const sal_Unicode cChar)
Definition: dif.hxx:107
static bool IsEOD(const sal_Unicode *pRef)
Definition: dif.hxx:92
sal_uInt32 nNumFormat
Definition: dif.hxx:61
OUString aLookAheadLine
Definition: dif.hxx:65
bool ReadNextLine(OUString &rStr)
Definition: difimp.cxx:399
static const sal_Unicode * ScanIntVal(const sal_Unicode *pStart, sal_uInt32 &rRet)
Definition: difimp.cxx:562
DATASET GetNextDataset()
Definition: difimp.cxx:453
static bool IsV(const sal_Unicode *pRef)
Definition: dif.hxx:102
SvNumberFormatter * pNumFormatter
Definition: dif.hxx:63
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
SC_DLLPUBLIC ScColumnsRange GetWritableColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd)
Definition: document.cxx:2525
bool ValidRow(SCROW nRow) const
Definition: document.hxx:900
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:837
SC_DLLPUBLIC void SetTextCell(const ScAddress &rPos, const OUString &rStr)
Call this if you are not sure whether to put this as an edit text or a simple text.
Definition: document.cxx:3452
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6050
SC_DLLPUBLIC void EnsureTable(SCTAB nTab)
Definition: documen2.cxx:577
SC_DLLPUBLIC void ApplyPatternAreaTab(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, const ScPatternAttr &rAttr)
Definition: document.cxx:4770
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3391
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3477
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1083
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:899
virtual ErrCode ScImportDif(SvStream &, ScDocument *, const ScAddress &rInsPos, const rtl_TextEncoding eSrc) override
Definition: difimp.cxx:42
SfxItemSet & GetItemSet()
Definition: patattr.hxx:192
A simplified progress bar based on the stream position of an existing stream.
void Progress()
Sets the progress bar to the current stream position.
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
void StartReadingUnicodeText(rtl_TextEncoding eReadBomCharSet)
bool eof() const
bool ReadUniOrByteStringLine(OUString &rStr, rtl_TextEncoding eSrcCharSet, sal_Int32 nMaxCodepointsToRead=0xFFFE)
sal_uInt64 Seek(sal_uInt64 nPos)
void SetStreamCharSet(rtl_TextEncoding eCharSet)
rtl_TextEncoding GetStreamCharSet() const
TOPIC
Definition: dif.hxx:44
@ T_UINITS
Definition: dif.hxx:47
@ T_PERIODICITY
Definition: dif.hxx:47
@ T_TABLE
Definition: dif.hxx:46
@ T_TRUELENGTH
Definition: dif.hxx:47
@ T_TUPLES
Definition: dif.hxx:46
@ T_VECTORS
Definition: dif.hxx:46
@ T_LABEL
Definition: dif.hxx:46
@ T_END
Definition: dif.hxx:49
@ T_UNKNOWN
Definition: dif.hxx:45
@ T_MAJORSTART
Definition: dif.hxx:47
@ T_SIZE
Definition: dif.hxx:46
@ T_COMMENT
Definition: dif.hxx:46
@ T_DATA
Definition: dif.hxx:46
@ T_DISPLAYUNITS
Definition: dif.hxx:48
@ T_MINORSTART
Definition: dif.hxx:47
DATASET
Definition: dif.hxx:52
@ D_UNKNOWN
Definition: dif.hxx:52
@ D_EOD
Definition: dif.hxx:52
@ D_BOT
Definition: dif.hxx:52
@ D_SYNT_ERROR
Definition: dif.hxx:52
@ D_STRING
Definition: dif.hxx:52
@ D_NUMERIC
Definition: dif.hxx:52
static void lcl_DeEscapeQuotesDif(OUStringBuffer &rString)
Definition: difimp.cxx:368
const std::u16string_view pKeyTABLE
Definition: difimp.cxx:35
const std::u16string_view pKeyVECTORS
Definition: difimp.cxx:36
const std::u16string_view pKeyTUPLES
Definition: difimp.cxx:37
const std::u16string_view pKeyDATA
Definition: difimp.cxx:38
const std::u16string_view pKeyEOD
Definition: difimp.cxx:40
const std::u16string_view pKeyBOT
Definition: difimp.cxx:39
float u
#define ERRCODE_NONE
sal_uInt16 nPos
STATE
constexpr OUStringLiteral aData
#define SCERR_IMPORT_FORMAT
Definition: scerrors.hxx:33
#define SCWARN_IMPORT_RANGE_OVERFLOW
Definition: scerrors.hxx:61
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
sal_uInt32 nNumFormat
Definition: dif.hxx:118
SCROW nEnd
Definition: dif.hxx:120
SCROW nStart
Definition: dif.hxx:119
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:35
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is.
Definition: stringutil.cxx:39
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17