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 #ifndef INCLUDED_SC_SOURCE_UI_INC_DATASTREAM_HXX
11 #define INCLUDED_SC_SOURCE_UI_INC_DATASTREAM_HXX
12 
13 #include <sal/config.h>
14 
15 #include <rtl/ref.hxx>
16 #include <rtl/ustring.hxx>
17 #include <vcl/timer.hxx>
18 #include <address.hxx>
19 
20 #include <vector>
21 
22 #include <documentstreamaccess.hxx>
23 
24 class ScDocShell;
25 
26 namespace sc {
27 
28 namespace datastreams {
29  class ReaderThread;
30 }
31 
33 {
34 public:
35  DataStream(const DataStream&) = delete;
36  const DataStream& operator=(const DataStream&) = delete;
37 
38  struct Cell
39  {
40  struct Str
41  {
42  size_t Pos;
43  size_t Size;
44  };
45 
46  union
47  {
49  double mfValue;
50  };
51 
52  bool mbValue;
53 
54  Cell();
55  Cell( const Cell& r );
56  };
57 
58  struct Line
59  {
60  OString maLine;
61  std::vector<Cell> maCells;
62  };
63  typedef std::vector<Line> LinesType;
64 
66  enum { VALUES_IN_LINE = 2 };
67 
68  static void MakeToolbarVisible();
69  static DataStream* Set(ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
70  sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings);
71 
72  DataStream(
73  ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
74  sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings);
75 
76  ~DataStream();
77 
78  ScRange GetRange() const;
79  const OUString& GetURL() const { return msURL; }
80  MoveType GetMove() const { return meOrigMove;}
82 
83  void Decode(
84  const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit,
85  MoveType eMove, const sal_uInt32 nSettings);
86 
87  bool ImportData();
88  void StartImport();
89  void StopImport();
90 
91  void SetRefreshOnEmptyLine( bool bVal );
92 
93 private:
94  Line ConsumeLine();
95  void MoveData();
96  void Text2Doc();
97  void Refresh();
98 
99  DECL_LINK( ImportTimerHdl, Timer*, void );
100 
101 private:
104  OUString msURL;
105  sal_uInt32 mnSettings;
106  MoveType meOrigMove; // Initial move setting. This one gets saved to file.
107  MoveType meMove; // move setting during streaming, which may change in the middle.
108  bool mbRunning;
111  std::unique_ptr<LinesType> mpLines;
112  size_t mnLinesCount;
118 
120 
122  bool mbIsFirst;
124 };
125 
126 }
127 
128 #endif
129 
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< Line > LinesType
Definition: datastream.hxx:63
size_t mnLinesCount
Definition: datastream.hxx:112
MoveType meMove
Definition: datastream.hxx:107
DataStream(const DataStream &)=delete
sal_uInt32 mnSettings
Definition: datastream.hxx:105
const OUString & GetURL() const
Definition: datastream.hxx:79
ScDocShell * mpDocShell
Definition: datastream.hxx:102
Provides methods to allow direct shifting of document content without broadcasting or shifting of bro...
void StartImport()
Definition: datastream.cxx:376
DocumentStreamAccess maDocAccess
Definition: datastream.hxx:103
void SetRefreshOnEmptyLine(bool bVal)
Definition: datastream.cxx:403
MoveType meOrigMove
Definition: datastream.hxx:106
DECL_LINK(ImportTimerHdl, Timer *, void)
double mfLastRefreshTime
Definition: datastream.hxx:114
rtl::Reference< datastreams::ReaderThread > mxReaderThread
Definition: datastream.hxx:121
bool mbRefreshOnEmptyLine
Definition: datastream.hxx:110
size_t mnLinesSinceRefresh
Definition: datastream.hxx:113
ScRange maEndRange
Definition: datastream.hxx:117
Line ConsumeLine()
Definition: datastream.cxx:308
void Decode(const OUString &rURL, const ScRange &rRange, sal_Int32 nLimit, MoveType eMove, const sal_uInt32 nSettings)
Definition: datastream.cxx:340
sal_Int32 SCROW
Definition: types.hxx:18
MoveType GetMove() const
Definition: datastream.hxx:80
static DataStream * Set(ScDocShell *pShell, const OUString &rURL, const ScRange &rRange, sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings)
Definition: datastream.cxx:263
static void MakeToolbarVisible()
Definition: datastream.cxx:238
const DataStream & operator=(const DataStream &)=delete
ScRange GetRange() const
Definition: datastream.cxx:333
std::vector< Cell > maCells
Definition: datastream.hxx:61
std::unique_ptr< LinesType > mpLines
Definition: datastream.hxx:111
bool IsRefreshOnEmptyLine() const
Definition: datastream.hxx:81
ScRange maStartRange
Definition: datastream.hxx:116
OUString msURL
Definition: datastream.hxx:104