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 
19 #include <vector>
20 
21 #include <documentstreamaccess.hxx>
22 
23 class ScDocShell;
24 
25 namespace sc {
26 
27 namespace datastreams {
28  class ReaderThread;
29 }
30 
32 {
33 public:
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 
71  DataStream(
72  ScDocShell *pShell, const OUString& rURL, const ScRange& rRange,
73  sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings);
74 
75  ~DataStream();
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 
92 private:
93  Line ConsumeLine();
94  void MoveData();
95  void Text2Doc();
96  void Refresh();
97 
98  DECL_LINK( ImportTimerHdl, Timer*, void );
99 
100 private:
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.
107  bool mbRunning;
110  std::unique_ptr<LinesType> mpLines;
111  size_t mnLinesCount;
117 
119 
121  bool mbIsFirst;
123 };
124 
125 }
126 
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< Line > LinesType
Definition: datastream.hxx:62
size_t mnLinesCount
Definition: datastream.hxx:111
MoveType meMove
Definition: datastream.hxx:106
DataStream(const DataStream &)=delete
sal_uInt32 mnSettings
Definition: datastream.hxx:104
const OUString & GetURL() const
Definition: datastream.hxx:78
ScDocShell * mpDocShell
Definition: datastream.hxx:101
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:102
void SetRefreshOnEmptyLine(bool bVal)
Definition: datastream.cxx:403
MoveType meOrigMove
Definition: datastream.hxx:105
DECL_LINK(ImportTimerHdl, Timer *, void)
double mfLastRefreshTime
Definition: datastream.hxx:113
rtl::Reference< datastreams::ReaderThread > mxReaderThread
Definition: datastream.hxx:120
bool mbRefreshOnEmptyLine
Definition: datastream.hxx:109
size_t mnLinesSinceRefresh
Definition: datastream.hxx:112
ScRange maEndRange
Definition: datastream.hxx:116
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:17
MoveType GetMove() const
Definition: datastream.hxx:79
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:60
std::unique_ptr< LinesType > mpLines
Definition: datastream.hxx:110
bool IsRefreshOnEmptyLine() const
Definition: datastream.hxx:80
ScRange maStartRange
Definition: datastream.hxx:115
OUString msURL
Definition: datastream.hxx:103