[Libreoffice-commits] core.git: 8 commits - include/tools officecfg/registry postprocess/packimages sc/inc sc/Library_sc.mk sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk tools/source

Matúš Kukan matus.kukan at gmail.com
Wed Nov 13 01:35:34 PST 2013


 include/tools/stream.hxx                                             |   22 
 officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu    |   21 
 officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu |   11 
 postprocess/packimages/image-sort.lst                                |    1 
 sc/Library_sc.mk                                                     |    4 
 sc/UIConfig_scalc.mk                                                 |    2 
 sc/inc/refreshtimer.hxx                                              |   87 -
 sc/inc/refreshtimerprotector.hxx                                     |   28 
 sc/inc/sc.hrc                                                        |    4 
 sc/sdi/cellsh.sdi                                                    |    3 
 sc/sdi/scalc.sdi                                                     |   70 +
 sc/source/core/data/documen2.cxx                                     |    1 
 sc/source/core/tool/refreshtimer.cxx                                 |   76 +
 sc/source/ui/inc/cellsh.hxx                                          |    3 
 sc/source/ui/inc/datastreams.hxx                                     |   55 +
 sc/source/ui/inc/docsh.hxx                                           |    3 
 sc/source/ui/miscdlgs/datastreams.cxx                                |  179 +++
 sc/source/ui/miscdlgs/datastreamsdlg.cxx                             |  113 ++
 sc/source/ui/view/cellsh.cxx                                         |    2 
 sc/source/ui/view/cellsh2.cxx                                        |   15 
 sc/uiconfig/scalc/menubar/menubar.xml                                |    1 
 sc/uiconfig/scalc/toolbar/datastreams.xml                            |   14 
 sc/uiconfig/scalc/ui/datastreams.ui                                  |  473 ++++++++++
 tools/source/stream/stream.cxx                                       |   57 +
 24 files changed, 1168 insertions(+), 77 deletions(-)

New commits:
commit 4dc9dc6a53870217de8b9e0b9ac434fbf3a67440
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Tue Nov 12 19:58:29 2013 +0100

    datastreams: add toolbar buttons to stop / resume streaming
    
    Change-Id: I601a4a174ea191c799623d29ed6eb229f9f372da

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 9b03873..f397ed9 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1293,6 +1293,22 @@
           <value xml:lang="en-US">Strea~ms...</value>
         </prop>
       </node>
+      <node oor:name=".uno:DataStreamsPlay" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Resume streaming</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
+      <node oor:name=".uno:DataStreamsStop" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Stop streaming</value>
+        </prop>
+        <prop oor:name="Properties" oor:type="xs:int">
+          <value>1</value>
+        </prop>
+      </node>
       <node oor:name=".uno:ManageXMLSource" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">~XML Source...</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
index 4b201a1..8ef44d3 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcWindowState.xcu
@@ -54,6 +54,17 @@
           <value>true</value>
         </prop>
       </node>
+      <node oor:name="private:resource/toolbar/datastreams" oor:op="replace">
+        <prop oor:name="Docked" oor:type="xs:boolean">
+          <value>false</value>
+        </prop>
+        <prop oor:name="UIName" oor:type="xs:string">
+          <value xml:lang="en-US">Data Streams</value>
+        </prop>
+        <prop oor:name="Visible" oor:type="xs:boolean">
+          <value>true</value>
+        </prop>
+      </node>
       <node oor:name="private:resource/toolbar/drawobjectbar" oor:op="replace">
         <prop oor:name="DockPos" oor:type="xs:string">
           <value>0,1</value>
diff --git a/postprocess/packimages/image-sort.lst b/postprocess/packimages/image-sort.lst
index 223668c..823528a 100644
--- a/postprocess/packimages/image-sort.lst
+++ b/postprocess/packimages/image-sort.lst
@@ -103,6 +103,7 @@ modules/scalc/toolbar/arrowshapes.xml
 modules/scalc/toolbar/basicshapes.xml
 modules/scalc/toolbar/calloutshapes.xml
 modules/scalc/toolbar/colorbar.xml
+modules/scalc/toolbar/datastreams.xml
 modules/scalc/toolbar/drawbar.xml
 modules/scalc/toolbar/drawobjectbar.xml
 modules/scalc/toolbar/extrusionobjectbar.xml
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index c18ee1e..23c4972 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -29,6 +29,7 @@ $(eval $(call gb_UIConfig_add_toolbarfiles,modules/scalc,\
 	sc/uiconfig/scalc/toolbar/basicshapes \
 	sc/uiconfig/scalc/toolbar/calloutshapes \
 	sc/uiconfig/scalc/toolbar/colorbar \
+	sc/uiconfig/scalc/toolbar/datastreams \
 	sc/uiconfig/scalc/toolbar/drawbar \
 	sc/uiconfig/scalc/toolbar/drawobjectbar \
 	sc/uiconfig/scalc/toolbar/extrusionobjectbar \
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 021bbd2..a717395 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -91,6 +91,8 @@
 #define SID_SCFORMULAOPTIONS    (SC_VIEW_START + 20)
 #define SID_SCDEFAULTSOPTIONS   (SC_VIEW_START + 21)
 
+#define SID_DATA_STREAMS_PLAY   (SC_VIEW_START + 33)
+#define SID_DATA_STREAMS_STOP   (SC_VIEW_START + 34)
 #define SID_DATA_STREAMS        (SC_VIEW_START + 35)
 
 // slot-IDs for attributes
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 298e28c..470e319 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -52,6 +52,8 @@ interface CellSelection
     SID_SBA_BRW_INSERT      [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_SELECT_DB           [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_DATA_STREAMS        [ ExecMethod = ExecuteDB; ]
+    SID_DATA_STREAMS_PLAY   [ ExecMethod = ExecuteDB; ]
+    SID_DATA_STREAMS_STOP   [ ExecMethod = ExecuteDB; ]
     SID_MANAGE_XML_SOURCE   [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_SORT                [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_DATA_FORM           [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index e78ef95..ec4fbc1 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6148,6 +6148,52 @@ SfxVoidItem DataStreams SID_DATA_STREAMS
     GroupId = GID_DATA;
 ]
 
+SfxVoidItem DataStreamsPlay SID_DATA_STREAMS_PLAY
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_DATA;
+]
+
+SfxVoidItem DataStreamsStop SID_DATA_STREAMS_STOP
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = FALSE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = TRUE,
+    GroupId = GID_DATA;
+]
+
 SfxVoidItem ManageXMLSource SID_MANAGE_XML_SOURCE
 (SfxStringItem DbName SID_MANAGE_XML_SOURCE)
 [
diff --git a/sc/source/ui/inc/datastreams.hxx b/sc/source/ui/inc/datastreams.hxx
index d0af550..124ebef 100644
--- a/sc/source/ui/inc/datastreams.hxx
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -43,13 +43,13 @@ public:
     ~DataStreams();
     bool ImportData();
     void ShowDialog(Window *pParent);
+    void Start();
+    void Stop();
 
 private:
     void MoveData();
     void Set(const OUString& rUrl, bool bIsScript, const OUString& rRange,
             sal_Int32 nLimit, MoveEnum eMove);
-    void Start();
-    void Stop();
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/datastreams.cxx b/sc/source/ui/miscdlgs/datastreams.cxx
index 3a21566..1639dbc 100644
--- a/sc/source/ui/miscdlgs/datastreams.cxx
+++ b/sc/source/ui/miscdlgs/datastreams.cxx
@@ -57,6 +57,7 @@ DataStreams::DataStreams(ScDocShell *pScDocShell):
     mpScDocShell(pScDocShell)
     , mpScDocument(mpScDocShell->GetDocument())
     , meMove(NO_MOVE)
+    , mbRunning(false)
 {
     mxThread = new datastreams::CallerThread( this );
     mxThread->launch();
@@ -73,6 +74,8 @@ DataStreams::~DataStreams()
 
 void DataStreams::Start()
 {
+    if (mbRunning)
+        return;
     mbIsUndoEnabled = mpScDocument->IsUndoEnabled();
     mpScDocument->EnableUndo(false);
     mbRunning = true;
@@ -81,6 +84,8 @@ void DataStreams::Start()
 
 void DataStreams::Stop()
 {
+    if (!mbRunning)
+        return;
     mbRunning = false;
     mpScDocument->EnableUndo(mbIsUndoEnabled);
 }
diff --git a/sc/source/ui/miscdlgs/datastreamsdlg.cxx b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
index b2f5d27..1fa07af 100644
--- a/sc/source/ui/miscdlgs/datastreamsdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
@@ -20,7 +20,6 @@ class DataStreamsDlg : public ModalDialog
 
     SvtURLBox*      m_pCbUrl;
     PushButton*     m_pBtnBrowse;
-    PushButton*     m_pBtnStop;
     RadioButton*    m_pRBDirectData;
     RadioButton*    m_pRBScriptData;
     RadioButton*    m_pRBDataDown;
@@ -34,7 +33,6 @@ class DataStreamsDlg : public ModalDialog
 
     DECL_LINK(UpdateHdl, void *);
     DECL_LINK(BrowseHdl, void *);
-    DECL_LINK(StopHdl, void *);
 
     void UpdateEnable();
 
@@ -50,7 +48,6 @@ DataStreamsDlg::DataStreamsDlg(DataStreams *pDataStreams, Window* pParent)
 {
     get(m_pCbUrl, "url");
     get(m_pBtnBrowse, "browse");
-    get(m_pBtnStop, "stop");
     get(m_pRBDirectData, "directdata");
     get(m_pRBScriptData, "scriptdata");
     get(m_pRBDataDown, "datadown");
@@ -65,7 +62,6 @@ DataStreamsDlg::DataStreamsDlg(DataStreams *pDataStreams, Window* pParent)
     m_pCbUrl->SetSelectHdl( LINK( this, DataStreamsDlg, UpdateHdl ) );
     m_pEdRange->SetModifyHdl( LINK( this, DataStreamsDlg, UpdateHdl ) );
     m_pBtnBrowse->SetClickHdl( LINK( this, DataStreamsDlg, BrowseHdl ) );
-    m_pBtnStop->SetClickHdl( LINK( this, DataStreamsDlg, StopHdl ) );
     UpdateEnable();
 }
 
@@ -92,12 +88,6 @@ IMPL_LINK_NOARG(DataStreamsDlg, BrowseHdl)
     return 0;
 }
 
-IMPL_LINK_NOARG(DataStreamsDlg, StopHdl)
-{
-    mpDataStreams->Stop();
-    return 0;
-}
-
 IMPL_LINK_NOARG(DataStreamsDlg, UpdateHdl)
 {
     UpdateEnable();
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index b5d4bf7..4450bd9 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -738,6 +738,14 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                 pImpl->m_pDataStreams = new DataStreams(GetViewData()->GetDocShell());
             pImpl->m_pDataStreams->ShowDialog( pTabViewShell->GetDialogParent() );
             break;
+        case SID_DATA_STREAMS_PLAY:
+            if (pImpl->m_pDataStreams)
+                pImpl->m_pDataStreams->Start();
+            break;
+        case SID_DATA_STREAMS_STOP:
+            if (pImpl->m_pDataStreams)
+                pImpl->m_pDataStreams->Stop();
+            break;
         case SID_MANAGE_XML_SOURCE:
             ExecuteXMLSourceDialog();
         break;
diff --git a/sc/uiconfig/scalc/toolbar/datastreams.xml b/sc/uiconfig/scalc/toolbar/datastreams.xml
new file mode 100644
index 0000000..dd3a5e4
--- /dev/null
+++ b/sc/uiconfig/scalc/toolbar/datastreams.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd">
+<!--
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-->
+<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar">
+ <toolbar:toolbaritem xlink:href=".uno:DataStreamsPlay"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:DataStreamsStop"/>
+</toolbar:toolbar>
diff --git a/sc/uiconfig/scalc/ui/datastreams.ui b/sc/uiconfig/scalc/ui/datastreams.ui
index de211ec..12282f8 100644
--- a/sc/uiconfig/scalc/ui/datastreams.ui
+++ b/sc/uiconfig/scalc/ui/datastreams.ui
@@ -447,20 +447,6 @@
                 <property name="position">2</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkButton" id="stop">
-                <property name="label" translatable="yes">Stop</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -475,7 +461,6 @@
       <action-widget response="0">ok</action-widget>
       <action-widget response="0">cancel</action-widget>
       <action-widget response="0">help</action-widget>
-      <action-widget response="0">stop</action-widget>
     </action-widgets>
   </object>
   <object class="GtkAdjustment" id="adjustment1">
commit 2c9450105b1543268dc565808ddbd76317a05446
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Mon Nov 11 22:26:54 2013 +0100

    datastreams: implement moving the import range down until the limit is reached
    
    Change-Id: Iaaed4399a980697c37683d838fcb1f99208233e8

diff --git a/sc/source/ui/inc/datastreams.hxx b/sc/source/ui/inc/datastreams.hxx
index cd8bc09..d0af550 100644
--- a/sc/source/ui/inc/datastreams.hxx
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -16,6 +16,7 @@
 #include <boost/scoped_ptr.hpp>
 
 namespace datastreams { class CallerThread; }
+namespace { class DataStreamsDlg; }
 class ScDocShell;
 class ScDocument;
 class ScRange;
@@ -24,26 +25,31 @@ class Window;
 
 class DataStreams : boost::noncopyable
 {
+    friend DataStreamsDlg;
+    enum MoveEnum { NO_MOVE, RANGE_DOWN, MOVE_DOWN, MOVE_UP };
     ScDocShell *mpScDocShell;
     ScDocument *mpScDocument;
-    bool mbMove;
+    MoveEnum meMove;
     bool mbRunning;
     bool mbIsUndoEnabled;
     boost::scoped_ptr<ScRange> mpRange;
+    boost::scoped_ptr<ScRange> mpStartRange;
     boost::scoped_ptr<ScRange> mpEndRange;
     boost::scoped_ptr<SvStream> mpStream;
     rtl::Reference<datastreams::CallerThread> mxThread;
 
 public:
     DataStreams(ScDocShell *pScDocShell);
-    virtual ~DataStreams();
+    ~DataStreams();
     bool ImportData();
-    void Move();
     void ShowDialog(Window *pParent);
+
+private:
+    void MoveData();
+    void Set(const OUString& rUrl, bool bIsScript, const OUString& rRange,
+            sal_Int32 nLimit, MoveEnum eMove);
     void Start();
     void Stop();
-    void Set(const OUString& rUrl, bool bIsScript, const OUString& rRange);
-    void SetMove(sal_Int32 nLimit);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/datastreams.cxx b/sc/source/ui/miscdlgs/datastreams.cxx
index 9dd394b..3a21566 100644
--- a/sc/source/ui/miscdlgs/datastreams.cxx
+++ b/sc/source/ui/miscdlgs/datastreams.cxx
@@ -15,6 +15,8 @@
 #include <asciiopt.hxx>
 #include <docsh.hxx>
 #include <impex.hxx>
+#include <viewdata.hxx>
+#include <dbfunc.hxx>
 
 namespace datastreams {
 
@@ -54,7 +56,7 @@ private:
 DataStreams::DataStreams(ScDocShell *pScDocShell):
     mpScDocShell(pScDocShell)
     , mpScDocument(mpScDocShell->GetDocument())
-    , mbMove(false)
+    , meMove(NO_MOVE)
 {
     mxThread = new datastreams::CallerThread( this );
     mxThread->launch();
@@ -81,23 +83,21 @@ void DataStreams::Stop()
 {
     mbRunning = false;
     mpScDocument->EnableUndo(mbIsUndoEnabled);
-    mbMove = false;
 }
 
-void DataStreams::Set(const OUString& rUrl, bool bIsScript, const OUString& rRange)
+void DataStreams::Set(const OUString& rUrl, bool bIsScript,
+        const OUString& rRange, sal_Int32 nLimit, MoveEnum eMove)
 {
     mpRange.reset ( new ScRange() );
     mpRange->Parse(rRange, mpScDocument);
+    mpStartRange.reset( new ScRange(*mpRange.get()) );
     if (bIsScript)
         mpStream.reset( new SvScriptStream(rUrl) );
     else
         mpStream.reset( new SvFileStream(rUrl, STREAM_READ) );
-}
 
-void DataStreams::SetMove(sal_Int32 nLimit)
-{
     mpEndRange.reset( NULL );
-    mbMove = true;
+    meMove = eMove;
     sal_Int32 nHeight = mpRange->aEnd.Row() - mpRange->aStart.Row() + 1;
     nLimit = nHeight * (nLimit / nHeight);
     if (nLimit && mpRange->aStart.Row() + nLimit - 1 < MAXROW)
@@ -107,15 +107,26 @@ void DataStreams::SetMove(sal_Int32 nLimit)
     }
 }
 
-void DataStreams::Move()
+void DataStreams::MoveData()
 {
-    if (!mbMove)
-        return;
-    if (mpEndRange.get())
+    switch (meMove)
     {
-        mpScDocument->DeleteRow(*mpEndRange);
+        case RANGE_DOWN:
+            if (mpRange->aStart == mpEndRange->aStart)
+                meMove = MOVE_UP;
+            break;
+        case MOVE_UP:
+            mpScDocument->DeleteRow(*mpStartRange);
+            mpScDocument->InsertRow(*mpEndRange);
+            break;
+        case MOVE_DOWN:
+            if (mpEndRange.get())
+                mpScDocument->DeleteRow(*mpEndRange);
+            mpScDocument->InsertRow(*mpRange);
+            break;
+        case NO_MOVE:
+            break;
     }
-    mpScDocument->InsertRow(*mpRange);
 }
 
 bool DataStreams::ImportData()
@@ -127,8 +138,6 @@ bool DataStreams::ImportData()
         return mbRunning;
     }
 
-    SolarMutexGuard aGuard;
-    Move();
     SCROW nHeight = mpRange->aEnd.Row() - mpRange->aStart.Row() + 1;
     OStringBuffer aBuf;
     OString sTmp;
@@ -138,17 +147,25 @@ bool DataStreams::ImportData()
         aBuf.append(sTmp);
         aBuf.append('\n');
     }
+    SolarMutexGuard aGuard;
+    MoveData();
     SvMemoryStream aMemoryStream((void *)aBuf.getStr(), aBuf.getLength(), STREAM_READ);
     ScImportExport aImport(mpScDocument, *mpRange);
     aImport.SetSeparator(',');
     aImport.ImportStream(aMemoryStream, OUString(), FORMAT_STRING);
     // ImportStream calls PostPaint for relevant area,
     // we need to call it explicitly only when moving rows.
-    if (!mbMove)
+    if (meMove == NO_MOVE)
         return mbRunning;
 
+    if (meMove == RANGE_DOWN)
+    {
+        mpRange->Move(0, mpRange->aEnd.Row() - mpRange->aStart.Row() + 1, 0);
+        mpScDocShell->GetViewData()->GetView()->AlignToCursor(
+                mpRange->aStart.Col(), mpRange->aStart.Row(), SC_FOLLOW_JUMP);
+    }
     SCROW aEndRow = mpEndRange.get() ? mpEndRange->aEnd.Row() : MAXROW;
-    mpScDocShell->PostPaint( ScRange( mpRange->aStart, ScAddress( mpRange->aEnd.Col(),
+    mpScDocShell->PostPaint( ScRange( mpStartRange->aStart, ScAddress( mpRange->aEnd.Col(),
                     aEndRow, mpRange->aStart.Tab()) ), PAINT_GRID );
 
     return mbRunning;
commit ac435437e5777ac34858c5f097840d4e87810650
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Fri Nov 8 22:15:36 2013 +0100

    Implement data streams dialog that allows importing a stream of data
    
    in CSV format.
    It's possible to read directly from a URL
    or to run a process and read its output.
    
    Change-Id: I3266c3bb175b73f1023440cca40b2cfab5fcc201

diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index f65cf26..5754ad9 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -228,7 +228,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/core/tool/optutil \
     sc/source/core/tool/orcusxml \
     sc/source/core/tool/parclass \
-        sc/source/core/tool/platforminfo \
+    sc/source/core/tool/platforminfo \
     sc/source/core/tool/printopt \
     sc/source/core/tool/prnsave \
     sc/source/core/tool/progress \
@@ -440,6 +440,8 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
     sc/source/ui/miscdlgs/autofmt \
     sc/source/ui/miscdlgs/conflictsdlg \
     sc/source/ui/miscdlgs/crnrdlg \
+    sc/source/ui/miscdlgs/datastreams \
+    sc/source/ui/miscdlgs/datastreamsdlg \
     sc/source/ui/miscdlgs/highred \
     sc/source/ui/miscdlgs/optsolver \
     sc/source/ui/miscdlgs/protectiondlg \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 2aa1ff8..c18ee1e 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -68,6 +68,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/covariancedialog \
 	sc/uiconfig/scalc/ui/createnamesdialog \
 	sc/uiconfig/scalc/ui/dataform \
+	sc/uiconfig/scalc/ui/datastreams \
 	sc/uiconfig/scalc/ui/definedatabaserangedialog \
 	sc/uiconfig/scalc/ui/definename \
 	sc/uiconfig/scalc/ui/deletecells \
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index b44eb9f..d7be8ac 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -33,16 +33,19 @@ class SvxClipboardFmtItem;
 class TransferableDataHelper;
 class TransferableClipboardListener;
 class AbstractScLinkedAreaDlg;
+class DataStreams;
 
 struct CellShell_Impl
 {
     TransferableClipboardListener*  m_pClipEvtLstnr;
     AbstractScLinkedAreaDlg*        m_pLinkedDlg;
+    DataStreams*                    m_pDataStreams;
     SfxRequest*                     m_pRequest;
 
     CellShell_Impl() :
         m_pClipEvtLstnr( NULL ),
         m_pLinkedDlg( NULL ),
+        m_pDataStreams( NULL ),
         m_pRequest( NULL ) {}
 };
 
diff --git a/sc/source/ui/inc/datastreams.hxx b/sc/source/ui/inc/datastreams.hxx
new file mode 100644
index 0000000..cd8bc09
--- /dev/null
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
+
+namespace datastreams { class CallerThread; }
+class ScDocShell;
+class ScDocument;
+class ScRange;
+class SvStream;
+class Window;
+
+class DataStreams : boost::noncopyable
+{
+    ScDocShell *mpScDocShell;
+    ScDocument *mpScDocument;
+    bool mbMove;
+    bool mbRunning;
+    bool mbIsUndoEnabled;
+    boost::scoped_ptr<ScRange> mpRange;
+    boost::scoped_ptr<ScRange> mpEndRange;
+    boost::scoped_ptr<SvStream> mpStream;
+    rtl::Reference<datastreams::CallerThread> mxThread;
+
+public:
+    DataStreams(ScDocShell *pScDocShell);
+    virtual ~DataStreams();
+    bool ImportData();
+    void Move();
+    void ShowDialog(Window *pParent);
+    void Start();
+    void Stop();
+    void Set(const OUString& rUrl, bool bIsScript, const OUString& rRange);
+    void SetMove(sal_Int32 nLimit);
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/datastreams.cxx b/sc/source/ui/miscdlgs/datastreams.cxx
new file mode 100644
index 0000000..9dd394b
--- /dev/null
+++ b/sc/source/ui/miscdlgs/datastreams.cxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <datastreams.hxx>
+
+#include <osl/conditn.hxx>
+#include <rtl/strbuf.hxx>
+#include <salhelper/thread.hxx>
+#include <asciiopt.hxx>
+#include <docsh.hxx>
+#include <impex.hxx>
+
+namespace datastreams {
+
+class CallerThread : public salhelper::Thread
+{
+    DataStreams *mpDataStreams;
+public:
+    osl::Condition maStart;
+    bool mbTerminate;
+
+    CallerThread(DataStreams *pData):
+        Thread("CallerThread")
+        ,mpDataStreams(pData)
+        ,mbTerminate(false)
+    {}
+
+private:
+    virtual void execute()
+    {
+        while (!mbTerminate)
+        {
+            // wait for a small amount of time, so that
+            // painting methods have a chance to be called.
+            // And also to make UI more responsive.
+            TimeValue const aTime = {0, 100000};
+            maStart.wait();
+            maStart.reset();
+            if (!mbTerminate)
+                while (mpDataStreams->ImportData())
+                    wait(aTime);
+        };
+    }
+};
+
+}
+
+DataStreams::DataStreams(ScDocShell *pScDocShell):
+    mpScDocShell(pScDocShell)
+    , mpScDocument(mpScDocShell->GetDocument())
+    , mbMove(false)
+{
+    mxThread = new datastreams::CallerThread( this );
+    mxThread->launch();
+}
+
+DataStreams::~DataStreams()
+{
+    if (mbRunning)
+        Stop();
+    mxThread->mbTerminate = true;
+    mxThread->maStart.set();
+    mxThread->join();
+}
+
+void DataStreams::Start()
+{
+    mbIsUndoEnabled = mpScDocument->IsUndoEnabled();
+    mpScDocument->EnableUndo(false);
+    mbRunning = true;
+    mxThread->maStart.set();
+}
+
+void DataStreams::Stop()
+{
+    mbRunning = false;
+    mpScDocument->EnableUndo(mbIsUndoEnabled);
+    mbMove = false;
+}
+
+void DataStreams::Set(const OUString& rUrl, bool bIsScript, const OUString& rRange)
+{
+    mpRange.reset ( new ScRange() );
+    mpRange->Parse(rRange, mpScDocument);
+    if (bIsScript)
+        mpStream.reset( new SvScriptStream(rUrl) );
+    else
+        mpStream.reset( new SvFileStream(rUrl, STREAM_READ) );
+}
+
+void DataStreams::SetMove(sal_Int32 nLimit)
+{
+    mpEndRange.reset( NULL );
+    mbMove = true;
+    sal_Int32 nHeight = mpRange->aEnd.Row() - mpRange->aStart.Row() + 1;
+    nLimit = nHeight * (nLimit / nHeight);
+    if (nLimit && mpRange->aStart.Row() + nLimit - 1 < MAXROW)
+    {
+        mpEndRange.reset( new ScRange(*mpRange) );
+        mpEndRange->Move(0, nLimit - nHeight, 0);
+    }
+}
+
+void DataStreams::Move()
+{
+    if (!mbMove)
+        return;
+    if (mpEndRange.get())
+    {
+        mpScDocument->DeleteRow(*mpEndRange);
+    }
+    mpScDocument->InsertRow(*mpRange);
+}
+
+bool DataStreams::ImportData()
+{
+    if (!mpStream->good())
+    {
+        // if there is a problem with SvStream, stop running
+        mbRunning = false;
+        return mbRunning;
+    }
+
+    SolarMutexGuard aGuard;
+    Move();
+    SCROW nHeight = mpRange->aEnd.Row() - mpRange->aStart.Row() + 1;
+    OStringBuffer aBuf;
+    OString sTmp;
+    while (nHeight--)
+    {
+        mpStream->ReadLine(sTmp);
+        aBuf.append(sTmp);
+        aBuf.append('\n');
+    }
+    SvMemoryStream aMemoryStream((void *)aBuf.getStr(), aBuf.getLength(), STREAM_READ);
+    ScImportExport aImport(mpScDocument, *mpRange);
+    aImport.SetSeparator(',');
+    aImport.ImportStream(aMemoryStream, OUString(), FORMAT_STRING);
+    // ImportStream calls PostPaint for relevant area,
+    // we need to call it explicitly only when moving rows.
+    if (!mbMove)
+        return mbRunning;
+
+    SCROW aEndRow = mpEndRange.get() ? mpEndRange->aEnd.Row() : MAXROW;
+    mpScDocShell->PostPaint( ScRange( mpRange->aStart, ScAddress( mpRange->aEnd.Col(),
+                    aEndRow, mpRange->aStart.Tab()) ), PAINT_GRID );
+
+    return mbRunning;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/miscdlgs/datastreamsdlg.cxx b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
new file mode 100644
index 0000000..b2f5d27
--- /dev/null
+++ b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sfx2/filedlghelper.hxx>
+#include <svtools/inettbc.hxx>
+#include <vcl/dialog.hxx>
+#include <datastreams.hxx>
+
+namespace {
+
+class DataStreamsDlg : public ModalDialog
+{
+    DataStreams *mpDataStreams;
+
+    SvtURLBox*      m_pCbUrl;
+    PushButton*     m_pBtnBrowse;
+    PushButton*     m_pBtnStop;
+    RadioButton*    m_pRBDirectData;
+    RadioButton*    m_pRBScriptData;
+    RadioButton*    m_pRBDataDown;
+    RadioButton*    m_pRBRangeDown;
+    RadioButton*    m_pRBNoMove;
+    RadioButton*    m_pRBMaxLimit;
+    RadioButton*    m_pRBUnlimited;
+    Edit*           m_pEdRange;
+    Edit*           m_pEdLimit;
+    OKButton*       m_pBtnOk;
+
+    DECL_LINK(UpdateHdl, void *);
+    DECL_LINK(BrowseHdl, void *);
+    DECL_LINK(StopHdl, void *);
+
+    void UpdateEnable();
+
+public:
+    DataStreamsDlg(DataStreams *pDataStreams, Window* pParent);
+    ~DataStreamsDlg() {}
+    void Start();
+};
+
+DataStreamsDlg::DataStreamsDlg(DataStreams *pDataStreams, Window* pParent)
+    : ModalDialog(pParent, "DataStreamsDialog", "modules/scalc/ui/datastreams.ui")
+      , mpDataStreams(pDataStreams)
+{
+    get(m_pCbUrl, "url");
+    get(m_pBtnBrowse, "browse");
+    get(m_pBtnStop, "stop");
+    get(m_pRBDirectData, "directdata");
+    get(m_pRBScriptData, "scriptdata");
+    get(m_pRBDataDown, "datadown");
+    get(m_pRBRangeDown, "rangedown");
+    get(m_pRBNoMove, "nomove");
+    get(m_pRBMaxLimit, "maxlimit");
+    get(m_pRBUnlimited, "unlimited");
+    get(m_pEdRange, "range");
+    get(m_pEdLimit, "limit");
+    get(m_pBtnOk, "ok");
+
+    m_pCbUrl->SetSelectHdl( LINK( this, DataStreamsDlg, UpdateHdl ) );
+    m_pEdRange->SetModifyHdl( LINK( this, DataStreamsDlg, UpdateHdl ) );
+    m_pBtnBrowse->SetClickHdl( LINK( this, DataStreamsDlg, BrowseHdl ) );
+    m_pBtnStop->SetClickHdl( LINK( this, DataStreamsDlg, StopHdl ) );
+    UpdateEnable();
+}
+
+void DataStreamsDlg::Start()
+{
+    bool bIsScript = m_pRBScriptData->IsChecked();
+    sal_Int32 nLimit = 0;
+    if (m_pRBMaxLimit->IsChecked())
+        nLimit = m_pEdLimit->GetText().toInt32();
+    mpDataStreams->Set(m_pCbUrl->GetText(), bIsScript, m_pEdRange->GetText(),
+            nLimit, m_pRBNoMove->IsChecked() ? DataStreams::NO_MOVE :
+                    m_pRBRangeDown->IsChecked() ? DataStreams::RANGE_DOWN : DataStreams::MOVE_DOWN);
+    mpDataStreams->Start();
+}
+
+IMPL_LINK_NOARG(DataStreamsDlg, BrowseHdl)
+{
+    sfx2::FileDialogHelper aFileDialog(0, 0);
+    if ( aFileDialog.Execute() != ERRCODE_NONE )
+        return 0;
+
+    m_pCbUrl->SetText( aFileDialog.GetPath() );
+    UpdateEnable();
+    return 0;
+}
+
+IMPL_LINK_NOARG(DataStreamsDlg, StopHdl)
+{
+    mpDataStreams->Stop();
+    return 0;
+}
+
+IMPL_LINK_NOARG(DataStreamsDlg, UpdateHdl)
+{
+    UpdateEnable();
+    return 0;
+}
+
+void DataStreamsDlg::UpdateEnable()
+{
+    bool bOk = !m_pEdRange->GetText().isEmpty();
+    bOk = bOk && !m_pCbUrl->GetURL().isEmpty();
+    m_pBtnOk->Enable(bOk);
+}
+
+}
+
+void DataStreams::ShowDialog(Window *pParent)
+{
+    DataStreamsDlg aDialog(this, pParent);
+    if (aDialog.Execute() == RET_OK)
+        aDialog.Start();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index e1ed032..943379f 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -55,6 +55,7 @@
 #include "postit.hxx"
 #include "cliputil.hxx"
 #include "clipparam.hxx"
+#include "datastreams.hxx"
 #include "markdata.hxx"
 
 //------------------------------------------------------------------
@@ -98,6 +99,7 @@ ScCellShell::~ScCellShell()
     }
 
     delete pImpl->m_pLinkedDlg;
+    delete pImpl->m_pDataStreams;
     delete pImpl->m_pRequest;
     delete pImpl;
 }
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 12a46a8..b5d4bf7 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -56,6 +56,7 @@
 #include "scabstdlg.hxx"
 #include "impex.hxx"
 #include "asciiopt.hxx"
+#include "datastreams.hxx"
 #include "queryentry.hxx"
 #include "markdata.hxx"
 
@@ -733,6 +734,9 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
             }
             break;
         case SID_DATA_STREAMS:
+            if (!pImpl->m_pDataStreams)
+                pImpl->m_pDataStreams = new DataStreams(GetViewData()->GetDocShell());
+            pImpl->m_pDataStreams->ShowDialog( pTabViewShell->GetDialogParent() );
             break;
         case SID_MANAGE_XML_SOURCE:
             ExecuteXMLSourceDialog();
commit 599cb77a3969feb9502b9427e3301c78e5be7af3
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Nov 7 15:25:25 2013 +0100

    add data streams dialog .ui file
    
    Change-Id: I184f824804f93cc4f094cf4f77d3f3263575316b

diff --git a/sc/uiconfig/scalc/ui/datastreams.ui b/sc/uiconfig/scalc/ui/datastreams.ui
new file mode 100644
index 0000000..de211ec
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/datastreams.ui
@@ -0,0 +1,488 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkDialog" id="DataStreamsDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Live Data Streams</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkBox" id="dialog-vbox2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkFrame" id="frame">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkBox" id="box4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkBox" id="box12">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="hexpand">True</property>
+                            <property name="spacing">12</property>
+                            <child>
+                              <object class="GtkLabel" id="label6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">URL</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="svtlo-SvtURLBox" id="url">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="has_tooltip">True</property>
+                                <property name="tooltip_markup" translatable="yes">Enter the URL of the source document in the local file system or Internet here.</property>
+                                <property name="tooltip_text" translatable="yes">Enter the URL of the source document in the local file system or Internet here.</property>
+                                <property name="hexpand">True</property>
+                                <property name="has_entry">True</property>
+                                <property name="entry_text_column">0</property>
+                                <property name="id_column">1</property>
+                                <property name="max_width_chars">48</property>
+                                <child internal-child="entry">
+                                  <object class="GtkEntry" id="URLBox-entry">
+                                    <property name="can_focus">False</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="browse">
+                                <property name="label" translatable="yes">_...</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkBox" id="box13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="orientation">vertical</property>
+                            <child>
+                              <object class="GtkRadioButton" id="directdata">
+                                <property name="label" translatable="yes">Direct data feed</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="xalign">0</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">scriptdata</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkRadioButton" id="scriptdata">
+                                <property name="label" translatable="yes">Script to execute to obtain the data</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="xalign">0</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">directdata</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkFrame" id="frame1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label_xalign">0</property>
+                            <property name="shadow_type">none</property>
+                            <child>
+                              <object class="GtkAlignment" id="alignment1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="top_padding">6</property>
+                                <property name="left_padding">12</property>
+                                <child>
+                                  <object class="GtkEntry" id="range">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="invisible_char">●</property>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child type="label">
+                              <object class="GtkLabel" id="rangelabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">_Fill data into range</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Source stream</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkBox" id="box1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkRadioButton" id="datadown">
+                            <property name="label" translatable="yes">Move existing data down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">rangedown</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="rangedown">
+                            <property name="label" translatable="yes">Move the range down</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">datadown</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="nomove">
+                            <property name="label" translatable="yes">Overwrite existing data</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">datadown</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">When new data arrives</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkBox" id="box9">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <child>
+                          <object class="GtkBox" id="box10">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkRadioButton" id="maxlimit">
+                                <property name="label" translatable="yes">Limit to</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="xalign">0</property>
+                                <property name="active">True</property>
+                                <property name="draw_indicator">True</property>
+                                <property name="group">unlimited</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="limit">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">●</property>
+                                <property name="text" translatable="yes">1000</property>
+                                <property name="invisible_char_set">True</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="padding">6</property>
+                                <property name="position">2</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkRadioButton" id="unlimited">
+                            <property name="label" translatable="yes">_Unlimited</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="xalign">0</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">maxlimit</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Maximal amount of rows</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="padding">6</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">start</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="stop">
+                <property name="label" translatable="yes">Stop</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+      <action-widget response="0">help</action-widget>
+      <action-widget response="0">stop</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="lower">1</property>
+    <property name="upper">99999</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+</interface>
commit f116128500531ce3c95d8258a47ddd6d5cb7cb27
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Fri Nov 8 16:37:21 2013 +0100

    implement very simple SvScriptStream to read from process
    
    It inherits from SvStream, so it could be used easily.
    Basically, it's just a simple wrapper around
    osl_executeProcess_WithRedirectedIO() and osl_readFile().
    
    Change-Id: Ifa225c87d2c9be7e71ea113b0832a4fe83ec65b3

diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 3a62e98..e390407 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_TOOLS_STREAM_HXX
 
 #include <limits>
+#include <osl/process.h>
 #include <tools/toolsdllapi.h>
 #include <tools/solar.h>
 #include <tools/lineend.hxx>
@@ -362,7 +363,7 @@ public:
               @endcode
               causing endless loops ...
     */
-    bool            ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
+    virtual bool    ReadLine( OString& rStr, sal_Int32 nMaxBytesToRead = 0xFFFE );
     bool            WriteLine( const OString& rStr );
 
     /** Read a line of bytes.
@@ -470,10 +471,10 @@ public:
     friend SvStream& operator<<( SvStream& rStr, SvStrPtr f ); // for Manips
 
     /// end of input seen during previous i/o operation
-    bool            eof() const { return bIsEof; }
+    virtual bool eof() const { return bIsEof; }
 
     /// stream is broken
-    bool            bad() const { return GetError() != 0; }
+    virtual bool bad() const { return GetError() != 0; }
 
     /** Get state
 
@@ -488,7 +489,7 @@ public:
         If we try to read into a variable v and the operation fails, the value
         of v should be unchanged,
     */
-    bool good() const { return !(eof() || bad()); }
+    virtual bool good() const { return !(eof() || bad()); }
 };
 
 inline SvStream& operator<<( SvStream& rStr, SvStrPtr f )
@@ -759,6 +760,19 @@ public:
     virtual sal_Size remainingSize() { return GetBufSize() - Tell(); }
 };
 
+class TOOLS_DLLPUBLIC SvScriptStream: public SvStream
+{
+    oslProcess mpProcess;
+    oslFileHandle mpHandle;
+
+public:
+    SvScriptStream(const OUString& rUrl);
+    ~SvScriptStream();
+
+    virtual bool ReadLine(OString &rStr, sal_Int32) SAL_OVERRIDE;
+    virtual bool good() const SAL_OVERRIDE;
+};
+
 /** Data Copy Stream
 
     This class is the foundation for all classes, using SvData
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 32babd9..7cbdca7 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1961,6 +1961,63 @@ void SvMemoryStream::SetSize( sal_Size nNewSize )
     ReAllocateMemory( nDiff );
 }
 
+SvScriptStream::SvScriptStream(const OUString& rUrl):
+    mpProcess(NULL), mpHandle(NULL)
+{
+    oslProcessError rc;
+    rc = osl_executeProcess_WithRedirectedIO(
+        rUrl.pData,
+        NULL, 0,
+        osl_Process_HIDDEN,
+        NULL,
+        NULL,
+        NULL, 0,
+        &mpProcess,
+        NULL, &mpHandle, NULL);
+    if (osl_Process_E_None != rc)
+    {
+        mpProcess = NULL;
+        mpHandle = NULL;
+    }
+}
+
+SvScriptStream::~SvScriptStream()
+{
+    if (mpProcess)
+    {
+        osl_terminateProcess(mpProcess);
+        osl_freeProcessHandle(mpProcess);
+    }
+    if (mpHandle)
+        osl_closeFile(mpHandle);
+}
+
+bool SvScriptStream::ReadLine(OString &rStr, sal_Int32)
+{
+    rStr = OString();
+    if (!good())
+        return false;
+
+    OStringBuffer sBuf;
+    sal_Char aChar('\n');
+    sal_uInt64 nBytesRead;
+    while (osl_File_E_None == osl_readFile(mpHandle, &aChar, 1, &nBytesRead)
+            && nBytesRead == 1 && aChar != '\n')
+    {
+        sBuf.append( aChar );
+    }
+    rStr = sBuf.makeStringAndClear();
+    if (!rStr.isEmpty())
+        return true;
+
+    return false;
+}
+
+bool SvScriptStream::good() const
+{
+    return mpHandle != NULL;
+}
+
 TYPEINIT0 ( SvDataCopyStream )
 
 void SvDataCopyStream::Assign( const SvDataCopyStream& )
commit f2b3cedc01d66eb42d7ad94d158f3c7ea3c96c41
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Nov 7 15:51:31 2013 +0100

    add menu item for data streams dialog
    
    Change-Id: I2f27afbaf91b31be2711fcb581bfd86bc103f1cb

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 9a32ed6..9b03873 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1288,6 +1288,11 @@
           <value xml:lang="en-US">Select ~Range...</value>
         </prop>
       </node>
+      <node oor:name=".uno:DataStreams" oor:op="replace">
+        <prop oor:name="Label" oor:type="xs:string">
+          <value xml:lang="en-US">Strea~ms...</value>
+        </prop>
+      </node>
       <node oor:name=".uno:ManageXMLSource" oor:op="replace">
         <prop oor:name="Label" oor:type="xs:string">
           <value xml:lang="en-US">~XML Source...</value>
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index d901083..021bbd2 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -91,6 +91,8 @@
 #define SID_SCFORMULAOPTIONS    (SC_VIEW_START + 20)
 #define SID_SCDEFAULTSOPTIONS   (SC_VIEW_START + 21)
 
+#define SID_DATA_STREAMS        (SC_VIEW_START + 35)
+
 // slot-IDs for attributes
 #define SID_SCATTR_PROTECTION   (SC_VIEW_START + 36)    // protection-page
 
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 6fe3b24..298e28c 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -51,6 +51,7 @@ interface CellSelection
     SID_REFRESH_DBAREA      [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_SBA_BRW_INSERT      [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_SELECT_DB           [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
+    SID_DATA_STREAMS        [ ExecMethod = ExecuteDB; ]
     SID_MANAGE_XML_SOURCE   [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_SORT                [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
     SID_DATA_FORM           [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ]
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index e892023..e78ef95 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6124,6 +6124,30 @@ SfxVoidItem SelectDB SID_SELECT_DB
     GroupId = GID_DATA;
 ]
 
+SfxVoidItem DataStreams SID_DATA_STREAMS
+()
+[
+    /* flags: */
+    AutoUpdate = FALSE,
+    Cachable = Cachable,
+    FastCall = FALSE,
+    HasCoreId = FALSE,
+    HasDialog = TRUE,
+    ReadOnlyDoc = TRUE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+    Synchron;
+
+    /* config: */
+    AccelConfig = TRUE,
+    MenuConfig = TRUE,
+    StatusBarConfig = FALSE,
+    ToolBoxConfig = FALSE,
+    GroupId = GID_DATA;
+]
+
 SfxVoidItem ManageXMLSource SID_MANAGE_XML_SOURCE
 (SfxStringItem DbName SID_MANAGE_XML_SOURCE)
 [
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index c373d2d..12a46a8 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -732,7 +732,8 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
                 }
             }
             break;
-
+        case SID_DATA_STREAMS:
+            break;
         case SID_MANAGE_XML_SOURCE:
             ExecuteXMLSourceDialog();
         break;
diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml
index 04b059d..9bbc711 100644
--- a/sc/uiconfig/scalc/menubar/menubar.xml
+++ b/sc/uiconfig/scalc/menubar/menubar.xml
@@ -443,6 +443,7 @@
             <menu:menuitem menu:id=".uno:SelectDB"/>
             <menu:menuitem menu:id=".uno:DataAreaRefresh"/>
             <menu:menuseparator/>
+            <menu:menuitem menu:id=".uno:DataStreams"/>
             <menu:menuitem menu:id=".uno:ManageXMLSource"/>
             <menu:menuseparator/>
             <menu:menuitem menu:id=".uno:DataSort"/>
commit f7d01def98cf542172e0f1dcebb9f35964c5c1ee
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Oct 31 10:56:15 2013 +0100

    ScRefreshTimer: implement methods in source file
    
    And don't export any of them.
    
    Change-Id: Ib29eec6765f0fe71c9c7fbc82b0531f562b6404a

diff --git a/sc/inc/refreshtimer.hxx b/sc/inc/refreshtimer.hxx
index bbc5a9f..ff8fb12 100644
--- a/sc/inc/refreshtimer.hxx
+++ b/sc/inc/refreshtimer.hxx
@@ -22,80 +22,44 @@
 
 #include <vcl/timer.hxx>
 #include <osl/mutex.hxx>
-#include "scdllapi.h"
 
 class ScRefreshTimerControl
 {
-private:
-    ::osl::Mutex   aMutex;
-    sal_uInt16         nBlockRefresh;
+    ::osl::Mutex    aMutex;
+    sal_uInt16      nBlockRefresh;
 
 public:
     ScRefreshTimerControl() : nBlockRefresh(0) {}
-
-    void SetAllowRefresh( sal_Bool b )
-    {
-        if ( b && nBlockRefresh )
-            --nBlockRefresh;
-        else if ( !b && nBlockRefresh < (sal_uInt16)(~0) )
-            ++nBlockRefresh;
-    }
-
+    void SetAllowRefresh( sal_Bool b );
     sal_Bool IsRefreshAllowed() const { return !nBlockRefresh; }
-
     ::osl::Mutex& GetMutex() { return aMutex; }
 };
 
 class ScRefreshTimer : public AutoTimer
 {
-private:
     ScRefreshTimerControl * const * ppControl;
 
-    void Start()
-    {
-        if ( GetTimeout() )
-            AutoTimer::Start();
-    }
-
 public:
-    ScRefreshTimer() : ppControl(0) { SetTimeout( 0 ); }
-
-    ScRefreshTimer( sal_uLong nSeconds ) : ppControl(0)
-    {
-        SetTimeout( nSeconds * 1000 );
-        Start();
-    }
-
-    ScRefreshTimer( const ScRefreshTimer& r ) : AutoTimer( r ), ppControl(0) {}
-
+    ScRefreshTimer();
+    ScRefreshTimer( sal_uLong nSeconds );
+    ScRefreshTimer( const ScRefreshTimer& r );
     virtual ~ScRefreshTimer();
 
-    ScRefreshTimer& operator=( const ScRefreshTimer& r )
-    {
-        SetRefreshControl(0);
-        AutoTimer::operator=( r );
-        return *this;
-    }
-
-    sal_Bool operator==( const ScRefreshTimer& r ) const
-        { return GetTimeout() == r.GetTimeout(); }
-
-    sal_Bool operator!=( const ScRefreshTimer& r ) const
-        { return !ScRefreshTimer::operator==( r ); }
-
-    void StartRefreshTimer() { Start(); }
+    ScRefreshTimer& operator=( const ScRefreshTimer& r );
+    sal_Bool operator==( const ScRefreshTimer& r ) const;
+    sal_Bool operator!=( const ScRefreshTimer& r ) const;
 
-    void SetRefreshControl( ScRefreshTimerControl * const * pp ) { ppControl = pp; }
+    void StartRefreshTimer();
+    void SetRefreshControl( ScRefreshTimerControl * const * pp );
+    void SetRefreshHandler( const Link& rLink );
+    sal_uLong GetRefreshDelay() const;
+    void StopRefreshTimer();
 
-    void SetRefreshHandler( const Link& rLink ) { SetTimeoutHdl( rLink ); }
+    virtual void SetRefreshDelay( sal_uLong nSeconds );
+    virtual void Timeout();
 
-    sal_uLong GetRefreshDelay() const { return GetTimeout() / 1000; }
-
-    void StopRefreshTimer() { Stop(); }
-
-    SC_DLLPUBLIC virtual void SetRefreshDelay( sal_uLong nSeconds );
-
-    SC_DLLPUBLIC virtual void Timeout();
+private:
+    void Start();
 };
 
 #endif // SC_REFRESHTIMER_HXX
diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx
index 1c9900e..9834aae 100644
--- a/sc/source/core/tool/refreshtimer.cxx
+++ b/sc/source/core/tool/refreshtimer.cxx
@@ -20,6 +20,14 @@
 #include "refreshtimer.hxx"
 #include "refreshtimerprotector.hxx"
 
+void ScRefreshTimerControl::SetAllowRefresh( sal_Bool b )
+{
+    if ( b && nBlockRefresh )
+        --nBlockRefresh;
+    else if ( !b && nBlockRefresh < (sal_uInt16)(~0) )
+        ++nBlockRefresh;
+}
+
 ScRefreshTimerProtector::ScRefreshTimerProtector( ScRefreshTimerControl * const * pp )
         :
         ppControl( pp )
@@ -38,12 +46,68 @@ ScRefreshTimerProtector::~ScRefreshTimerProtector()
         (*ppControl)->SetAllowRefresh( true );
 }
 
+ScRefreshTimer::ScRefreshTimer() : ppControl(0)
+{
+    SetTimeout( 0 );
+}
+
+ScRefreshTimer::ScRefreshTimer( sal_uLong nSeconds ) : ppControl(0)
+{
+    SetTimeout( nSeconds * 1000 );
+    Start();
+}
+
+ScRefreshTimer::ScRefreshTimer( const ScRefreshTimer& r ) : AutoTimer( r ), ppControl(0)
+{
+}
+
 ScRefreshTimer::~ScRefreshTimer()
 {
     if ( IsActive() )
         Stop();
 }
 
+ScRefreshTimer& ScRefreshTimer::operator=( const ScRefreshTimer& r )
+{
+    SetRefreshControl(0);
+    AutoTimer::operator=( r );
+    return *this;
+}
+
+sal_Bool ScRefreshTimer::operator==( const ScRefreshTimer& r ) const
+{
+    return GetTimeout() == r.GetTimeout();
+}
+
+sal_Bool ScRefreshTimer::operator!=( const ScRefreshTimer& r ) const
+{
+    return !ScRefreshTimer::operator==( r );
+}
+
+void ScRefreshTimer::StartRefreshTimer()
+{
+    Start();
+}
+
+void ScRefreshTimer::SetRefreshControl( ScRefreshTimerControl * const * pp )
+{
+    ppControl = pp;
+}
+
+void ScRefreshTimer::SetRefreshHandler( const Link& rLink )
+{
+    SetTimeoutHdl( rLink );
+}
+
+sal_uLong ScRefreshTimer::GetRefreshDelay() const
+{
+    return GetTimeout() / 1000;
+}
+
+void ScRefreshTimer::StopRefreshTimer()
+{
+    Stop();
+}
 
 void ScRefreshTimer::SetRefreshDelay( sal_uLong nSeconds )
 {
@@ -55,7 +119,6 @@ void ScRefreshTimer::SetRefreshDelay( sal_uLong nSeconds )
         Start();
 }
 
-
 void ScRefreshTimer::Timeout()
 {
     if ( ppControl && *ppControl && (*ppControl)->IsRefreshAllowed() )
@@ -70,4 +133,10 @@ void ScRefreshTimer::Timeout()
     }
 }
 
+void ScRefreshTimer::Start()
+{
+    if ( GetTimeout() )
+        AutoTimer::Start();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4753b9a2435a6ddab54c99aee12c52b25bad7c06
Author: Matúš Kukan <matus.kukan at gmail.com>
Date:   Thu Oct 31 10:14:53 2013 +0100

    move ScRefreshTimerProtector into its own header file
    
    So that, we don't have to include "refreshtimer.hxx" in docsh.hxx.
    Also implement destructor in source file.
    
    Change-Id: Ie0251ad3511b44cf1dd6dae34e22ade0ab32cec4

diff --git a/sc/inc/refreshtimer.hxx b/sc/inc/refreshtimer.hxx
index 0ee9a37..bbc5a9f 100644
--- a/sc/inc/refreshtimer.hxx
+++ b/sc/inc/refreshtimer.hxx
@@ -46,21 +46,6 @@ public:
     ::osl::Mutex& GetMutex() { return aMutex; }
 };
 
-class ScRefreshTimerProtector
-{
-private:
-    ScRefreshTimerControl * const * ppControl;
-
-public:
-    ScRefreshTimerProtector( ScRefreshTimerControl * const * pp );
-
-    ~ScRefreshTimerProtector()
-    {
-        if ( ppControl && *ppControl )
-            (*ppControl)->SetAllowRefresh( true );
-    }
-};
-
 class ScRefreshTimer : public AutoTimer
 {
 private:
diff --git a/sc/inc/refreshtimerprotector.hxx b/sc/inc/refreshtimerprotector.hxx
new file mode 100644
index 0000000..d2169cd
--- /dev/null
+++ b/sc/inc/refreshtimerprotector.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef SC_REFRESHTIMERPROTECTOR_HXX
+#define SC_REFRESHTIMERPROTECTOR_HXX
+
+#include <sal/config.h>
+
+class ScRefreshTimerControl;
+
+class ScRefreshTimerProtector
+{
+    ScRefreshTimerControl * const * ppControl;
+
+public:
+    ScRefreshTimerProtector( ScRefreshTimerControl * const * pp );
+    ~ScRefreshTimerProtector();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 23a4bcf..6c112d5 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -89,6 +89,7 @@
 #include "formulacell.hxx"
 #include "clipcontext.hxx"
 #include "refupdatecontext.hxx"
+#include "refreshtimerprotector.hxx"
 #include "scopetools.hxx"
 #include "formulagroup.hxx"
 
diff --git a/sc/source/core/tool/refreshtimer.cxx b/sc/source/core/tool/refreshtimer.cxx
index 0ee309e..1c9900e 100644
--- a/sc/source/core/tool/refreshtimer.cxx
+++ b/sc/source/core/tool/refreshtimer.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "refreshtimer.hxx"
-
+#include "refreshtimerprotector.hxx"
 
 ScRefreshTimerProtector::ScRefreshTimerProtector( ScRefreshTimerControl * const * pp )
         :
@@ -32,6 +32,11 @@ ScRefreshTimerProtector::ScRefreshTimerProtector( ScRefreshTimerControl * const
     }
 }
 
+ScRefreshTimerProtector::~ScRefreshTimerProtector()
+{
+    if ( ppControl && *ppControl )
+        (*ppControl)->SetAllowRefresh( true );
+}
 
 ScRefreshTimer::~ScRefreshTimer()
 {
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 20a4833..818a63f 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -33,7 +33,7 @@
 #include "appoptio.hxx"
 #include "formulaopt.hxx"
 #include "shellids.hxx"
-#include "refreshtimer.hxx"
+#include "refreshtimerprotector.hxx"
 #include "optutil.hxx"
 #include "docuno.hxx"
 
@@ -61,6 +61,7 @@ class VirtualDevice;
 class ScImportOptions;
 class ScDocShellModificator;
 class ScOptSolverSave;
+class ScRefreshTimer;
 class ScSheetSaveData;
 class ScFlatBoolRowSegments;
 class HelperModelObj;


More information about the Libreoffice-commits mailing list