tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / datastream.hxx
blobb7a0a36797f3122d556bbcba007c3eb4c58c4fd5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #pragma once
12 #include <sal/config.h>
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>
21 #include <documentstreamaccess.hxx>
23 class ScDocShell;
25 namespace sc {
27 namespace datastreams {
28 class ReaderThread;
31 class DataStream
33 public:
34 DataStream(const DataStream&) = delete;
35 const DataStream& operator=(const DataStream&) = delete;
37 struct Cell
39 struct Str
41 size_t Pos;
42 size_t Size;
45 union
47 Str maStr;
48 double mfValue;
51 bool mbValue;
53 Cell();
54 Cell( const Cell& r );
57 struct Line
59 OString maLine;
60 std::vector<Cell> maCells;
62 typedef std::vector<Line> LinesType;
64 enum MoveType { NO_MOVE, RANGE_DOWN, MOVE_DOWN, MOVE_UP };
66 static void MakeToolbarVisible();
67 static DataStream* Set(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
68 sal_Int32 nLimit, MoveType eMove);
70 DataStream(
71 ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
72 sal_Int32 nLimit, MoveType eMove);
74 ~DataStream();
76 ScRange GetRange() const;
77 const OUString& GetURL() const { return msURL; }
78 MoveType GetMove() const { return meOrigMove;}
79 bool IsRefreshOnEmptyLine() const { return mbRefreshOnEmptyLine;}
81 void Decode(
82 const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit,
83 MoveType eMove);
85 bool ImportData();
86 void StartImport();
87 void StopImport();
89 void SetRefreshOnEmptyLine( bool bVal );
91 private:
92 Line ConsumeLine();
93 void MoveData();
94 void Text2Doc();
95 void Refresh();
97 DECL_LINK( ImportTimerHdl, Timer*, void );
99 private:
100 ScDocShell* mpDocShell;
101 DocumentStreamAccess maDocAccess;
102 OUString msURL;
103 MoveType meOrigMove; // Initial move setting. This one gets saved to file.
104 MoveType meMove; // move setting during streaming, which may change in the middle.
105 bool mbRunning;
106 bool mbValuesInLine;
107 bool mbRefreshOnEmptyLine;
108 std::optional<LinesType> moLines;
109 size_t mnLinesCount;
110 size_t mnLinesSinceRefresh;
111 double mfLastRefreshTime;
112 SCROW mnCurRow;
113 ScRange maStartRange;
114 ScRange maEndRange;
116 Timer maImportTimer;
118 rtl::Reference<datastreams::ReaderThread> mxReaderThread;
119 bool mbIsFirst;
120 bool mbIsUpdate;
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */