summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-10 09:13:08 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-08-10 19:13:55 +0200
commit631023655da490f9e5c5721389ccd34b491307be (patch)
tree62aa269150ac11adc1500f3015b35b13ad25fe2d /sc
parentec779d811ab5fcb0957f362086fe7856219bdff2 (diff)
external data: import all the csv data
Change-Id: Ifcb2c42594713ed263ef38c1ef0e8bc0efbce01e Reviewed-on: https://gerrit.libreoffice.org/40963 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/dataprovider.cxx55
1 files changed, 26 insertions, 29 deletions
diff --git a/sc/source/ui/docshell/dataprovider.cxx b/sc/source/ui/docshell/dataprovider.cxx
index 97dbea72fa8d..9d17c892cb96 100644
--- a/sc/source/ui/docshell/dataprovider.cxx
+++ b/sc/source/ui/docshell/dataprovider.cxx
@@ -249,43 +249,40 @@ void CSVFetchThread::execute()
{
OStringBuffer aBuffer(64000);
std::unique_ptr<SvStream> pStream = FetchStreamFromURL(maURL, aBuffer);
- if (pStream->good())
+ SCROW nCurRow = 0;
+ SCCOL nCol = 0;
+ while (pStream->good())
{
- LinesType aLines(10);
- SCROW nCurRow = 0;
- SCCOL nCol = 0;
- for (Line & rLine : aLines)
- {
- if (mbTerminate)
- break;
+ if (mbTerminate)
+ break;
+
+ Line aLine;
+ aLine.maCells.clear();
+ pStream->ReadLine(aLine.maLine);
+ CSVHandler aHdl(aLine, MAXCOL);
+ orcus::csv_parser<CSVHandler> parser(aLine.maLine.getStr(), aLine.maLine.getLength(), aHdl, maConfig);
+ parser.parse();
- rLine.maCells.clear();
- pStream->ReadLine(rLine.maLine);
- CSVHandler aHdl(rLine, MAXCOL);
- orcus::csv_parser<CSVHandler> parser(rLine.maLine.getStr(), rLine.maLine.getLength(), aHdl, maConfig);
- parser.parse();
+ if (aLine.maCells.empty())
+ {
+ break;
+ }
- if (rLine.maCells.empty())
+ nCol = 0;
+ const char* pLineHead = aLine.maLine.getStr();
+ for (auto& rCell : aLine.maCells)
+ {
+ if (rCell.mbValue)
{
- break;
+ mrDocument.SetValue(ScAddress(nCol, nCurRow, 0 /* Tab */), rCell.mfValue);
}
-
- nCol = 0;
- const char* pLineHead = rLine.maLine.getStr();
- for (auto& rCell : rLine.maCells)
+ else
{
- if (rCell.mbValue)
- {
- mrDocument.SetValue(ScAddress(nCol, nCurRow, 0 /* Tab */), rCell.mfValue);
- }
- else
- {
- mrDocument.SetString(nCol, nCurRow, 0 /* Tab */, OUString(pLineHead+rCell.maStr.Pos, rCell.maStr.Size, RTL_TEXTENCODING_UTF8));
- }
- ++nCol;
+ mrDocument.SetString(nCol, nCurRow, 0 /* Tab */, OUString(pLineHead+rCell.maStr.Pos, rCell.maStr.Size, RTL_TEXTENCODING_UTF8));
}
- nCurRow++;
+ ++nCol;
}
+ nCurRow++;
}
SolarMutexGuard aGuard;
mpIdle->Start();