LibreOffice Module sc (master) 1
datastream.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
10#pragma once
11
12#include <sal/config.h>
13
14#include <rtl/ref.hxx>
15#include <rtl/ustring.hxx>
16#include <vcl/timer.hxx>
17#include <address.hxx>
18#include <optional>
19#include <vector>
20
22
23class ScDocShell;
24
25namespace sc {
26
27namespace datastreams {
28 class ReaderThread;
29}
30
32{
33public:
34 DataStream(const DataStream&) = delete;
35 const DataStream& operator=(const DataStream&) = delete;
36
37 struct Cell
38 {
39 struct Str
40 {
41 size_t Pos;
42 size_t Size;
43 };
44
45 union
46 {
48 double mfValue;
49 };
50
51 bool mbValue;
52
53 Cell();
54 Cell( const Cell& r );
55 };
56
57 struct Line
58 {
59 OString maLine;
60 std::vector<Cell> maCells;
61 };
62 typedef std::vector<Line> LinesType;
63
65 enum { VALUES_IN_LINE = 2 };
66
67 static void MakeToolbarVisible();
68 static DataStream* Set(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
69 sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings);
70
72 ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
73 sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings);
74
76
77 ScRange GetRange() const;
78 const OUString& GetURL() const { return msURL; }
79 MoveType GetMove() const { return meOrigMove;}
81
82 void Decode(
83 const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit,
84 MoveType eMove, const sal_uInt32 nSettings);
85
86 bool ImportData();
87 void StartImport();
88 void StopImport();
89
90 void SetRefreshOnEmptyLine( bool bVal );
91
92private:
94 void MoveData();
95 void Text2Doc();
96 void Refresh();
97
98 DECL_LINK( ImportTimerHdl, Timer*, void );
99
100private:
103 OUString msURL;
104 sal_uInt32 mnSettings;
105 MoveType meOrigMove; // Initial move setting. This one gets saved to file.
106 MoveType meMove; // move setting during streaming, which may change in the middle.
110 std::optional<LinesType> moLines;
117
119
123};
124
125}
126
127/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
double mfLastRefreshTime
Definition: datastream.hxx:113
size_t mnLinesSinceRefresh
Definition: datastream.hxx:112
void StartImport()
Definition: datastream.cxx:382
std::vector< Line > LinesType
Definition: datastream.hxx:62
MoveType GetMove() const
Definition: datastream.hxx:79
DocumentStreamAccess maDocAccess
Definition: datastream.hxx:102
sal_uInt32 mnSettings
Definition: datastream.hxx:104
const OUString & GetURL() const
Definition: datastream.hxx:78
bool IsRefreshOnEmptyLine() const
Definition: datastream.hxx:80
OUString msURL
Definition: datastream.hxx:103
bool mbRefreshOnEmptyLine
Definition: datastream.hxx:109
static void MakeToolbarVisible()
Definition: datastream.cxx:236
ScRange maStartRange
Definition: datastream.hxx:115
ScRange maEndRange
Definition: datastream.hxx:116
DECL_LINK(ImportTimerHdl, Timer *, void)
void Decode(const OUString &rURL, const ScRange &rRange, sal_Int32 nLimit, MoveType eMove, const sal_uInt32 nSettings)
Definition: datastream.cxx:346
ScDocShell * mpDocShell
Definition: datastream.hxx:101
MoveType meOrigMove
Definition: datastream.hxx:105
MoveType meMove
Definition: datastream.hxx:106
static DataStream * Set(ScDocShell *pShell, const OUString &rURL, const ScRange &rRange, sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings)
Definition: datastream.cxx:265
void SetRefreshOnEmptyLine(bool bVal)
Definition: datastream.cxx:409
rtl::Reference< datastreams::ReaderThread > mxReaderThread
Definition: datastream.hxx:120
DataStream(const DataStream &)=delete
std::optional< LinesType > moLines
Definition: datastream.hxx:110
Line ConsumeLine()
Definition: datastream.cxx:311
const DataStream & operator=(const DataStream &)=delete
size_t mnLinesCount
Definition: datastream.hxx:111
ScRange GetRange() const
Definition: datastream.cxx:339
Provides methods to allow direct shifting of document content without broadcasting or shifting of bro...
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
std::vector< Cell > maCells
Definition: datastream.hxx:60
sal_Int32 SCROW
Definition: types.hxx:17