[Libreoffice-commits] core.git: Branch 'private/matus/sc-hacks' - 232 commits - basctl/source basebmp/source basebmp/test basegfx/source basegfx/test basic/qa basic/source bin/get-bugzilla-attachments-by-mimetype bin/lo-generate-source-tarball bridges/source canvas/source chart2/AllLangResTarget_chartcontroller.mk chart2/source chart2/uiconfig chart2/UIConfig_chart2.mk config_host/config_eot.h.in config_host.mk.in configure.ac connectivity/CppunitTest_connectivity_commontools.mk connectivity/Library_dbase.mk connectivity/Library_dbtools.mk connectivity/Library_firebird_sdbc.mk connectivity/qa connectivity/source connectivity/workben cppuhelper/source cppuhelper/test cpputools/source cui/source dbaccess/CppunitTest_dbaccess_dialog_save.mk dbaccess/CppunitTest_dbaccess_firebird_test.mk dbaccess/CppunitTest_dbaccess_macros_test.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/source desktop/source download.lst dtrans/source editeng/source embeddedobj/source embedserv/source eventattacher/ source extensions/source external/libebook external/libeot external/liblangtag external/libxml2 external/libxslt external/Module_external.mk filter/Configuration_filter.mk filter/source forms/source formula/source fpicker/source framework/source helpcompiler/source helpcontent2 hwpfilter/qa i18nlangtag/source i18npool/qa i18npool/source i18nutil/source icon-themes/galaxy idlc/source idl/inc idl/source include/apple_remote include/avmedia include/basebmp include/basic include/canvas include/codemaker include/com include/comphelper include/connectivity include/cppu include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/helpcompiler include/i18nlangtag include/i18nutil include/jvmaccess include/jvmfwk include/linguistic include/oox include/osl include/package include/registry include/rtl include/sal include/salhelper include/sax include/sfx2 include/shell include/sot include/store include/svl include/svt ools include/svx include/test include/toolkit include/tools include/ucbhelper include/uno include/unoidl include/unotest include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader include/xmlscript ios/Module_ios.mk io/source io/test jvmfwk/plugins jvmfwk/source lingucomponent/source linguistic/source linguistic/workben lotuswordpro/source Makefile.fetch mysqlc/source odk/examples offapi/com officecfg/registry oox/source package/source padmin/source postprocess/CustomTarget_registry.mk postprocess/packimages pyuno/source registry/workben remotebridges/examples reportdesign/source RepositoryExternal.mk sal/qa sal/rtl sax/source scaddins/source sccomp/source sc/CppunitTest_sc_chart_regression_test.mk sc/inc sc/Library_sc.mk sc/Module_sc.mk sc/qa scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sdext/source sd/source sfx2/inc sfx2/qa sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/source slideshow/source smoketest/smoketest.cxx solenv /gbuild sot/source starmath/source store/workben svl/source svtools/source svx/source svx/uiconfig sw/CppunitTest_sw_htmlexport.mk sw/inc sw/qa sw/source sysui/CustomTarget_share.mk sysui/desktop test/Library_subsequenttest.mk test/source testtools/source toolkit/source tools/qa tools/source ucb/source ucb/workben unodevtools/source unotest/source unotools/source unoxml/source uui/source vbahelper/source vcl/aqua vcl/generic vcl/inc vcl/qa vcl/source vcl/unx vcl/win writerfilter/Library_writerfilter.mk writerfilter/source writerperfect/Library_wpftwriter.mk writerperfect/source writerperfect/util xmlhelp/source xmloff/inc xmloff/source xmlreader/source xmlscript/source xmlscript/test xmlsecurity/source
Matúš Kukan
matus.kukan at gmail.com
Tue Nov 12 14:15:15 PST 2013
Rebased ref, commits from common ancestor:
commit 3503d7c2d935f34fcaa3ed10b9a99139c4896e4d
Author: Matúš Kukan <matus.kukan at gmail.com>
Date: Tue Nov 12 19:58:29 2013 +0100
datastreams: add toolbar buttons to stop / resume importing
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..869e583 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 importing</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 importing</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 4e6ef14..bc8a780 100644
--- a/sc/source/ui/inc/datastreams.hxx
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -44,13 +44,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 9d4768c..523d756 100644
--- a/sc/source/ui/miscdlgs/datastreams.cxx
+++ b/sc/source/ui/miscdlgs/datastreams.cxx
@@ -58,6 +58,7 @@ DataStreams::DataStreams(ScDocShell *pScDocShell):
, mpScDocShell(pScDocShell)
, mpScDocument(mpScDocShell->GetDocument())
, meMove(NO_MOVE)
+ , mbRunning(false)
{
mxThread = new datastreams::CallerThread( this );
mxThread->launch();
@@ -74,6 +75,8 @@ DataStreams::~DataStreams()
void DataStreams::Start()
{
+ if (mbRunning)
+ return;
mbIsUndoEnabled = mpScDocument->IsUndoEnabled();
mpScDocument->EnableUndo(false);
mbRunning = true;
@@ -82,6 +85,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 d99af8b..f7c2a43 100644
--- a/sc/source/ui/miscdlgs/datastreamsdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
@@ -20,7 +20,6 @@ class DataStreamsDlg : public ModelessDialog
SvtURLBox* m_pCbUrl;
PushButton* m_pBtnBrowse;
- PushButton* m_pBtnStop;
RadioButton* m_pRBDirectData;
RadioButton* m_pRBScriptData;
RadioButton* m_pRBDataDown;
@@ -35,7 +34,6 @@ class DataStreamsDlg : public ModelessDialog
DECL_LINK(UpdateHdl, void *);
DECL_LINK(BrowseHdl, void *);
DECL_LINK(StartHdl, 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 ) );
m_pBtnOk->SetClickHdl( LINK( this, DataStreamsDlg, StartHdl ) );
m_pBtnOk->SetClickHdl( LINK( this, DataStreamsDlg, StartHdl ) );
UpdateEnable();
@@ -101,12 +97,6 @@ IMPL_LINK_NOARG(DataStreamsDlg, StartHdl)
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 1b64b5de400d12a56ba14a04be4432128f4b7644
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 374a891..4e6ef14 100644
--- a/sc/source/ui/inc/datastreams.hxx
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -14,6 +14,7 @@
#include <boost/scoped_ptr.hpp>
+namespace { class DataStreamsDlg; }
class Dialog;
class ScDocShell;
class ScDocument;
@@ -24,27 +25,32 @@ namespace datastreams { class CallerThread; }
class DataStreams : boost::noncopyable
{
+ friend DataStreamsDlg;
+ enum MoveEnum { NO_MOVE, RANGE_DOWN, MOVE_DOWN, MOVE_UP };
Dialog *mpDialog;
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 4cbb0ae..9d4768c 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 {
@@ -55,7 +57,7 @@ DataStreams::DataStreams(ScDocShell *pScDocShell):
mpDialog(NULL)
, mpScDocShell(pScDocShell)
, mpScDocument(mpScDocShell->GetDocument())
- , mbMove(false)
+ , meMove(NO_MOVE)
{
mxThread = new datastreams::CallerThread( this );
mxThread->launch();
@@ -82,23 +84,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)
@@ -108,15 +108,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()
@@ -128,8 +139,6 @@ bool DataStreams::ImportData()
return mbRunning;
}
- SolarMutexGuard aGuard;
- Move();
SCROW nHeight = mpRange->aEnd.Row() - mpRange->aStart.Row() + 1;
OStringBuffer aBuf;
OString sTmp;
@@ -139,17 +148,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;
diff --git a/sc/source/ui/miscdlgs/datastreamsdlg.cxx b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
index 4519c60..d99af8b 100644
--- a/sc/source/ui/miscdlgs/datastreamsdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
@@ -90,14 +90,12 @@ IMPL_LINK_NOARG(DataStreamsDlg, BrowseHdl)
IMPL_LINK_NOARG(DataStreamsDlg, StartHdl)
{
bool bIsScript = m_pRBScriptData->IsChecked();
- mpDataStreams->Set(m_pCbUrl->GetText(), bIsScript, m_pEdRange->GetText());
- if (!m_pRBNoMove->IsChecked())
- {
- sal_Int32 nLimit = 0;
- if (m_pRBMaxLimit->IsChecked())
- nLimit = m_pEdLimit->GetText().toInt32();
- mpDataStreams->SetMove(nLimit);
- }
+ 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();
UpdateEnable();
return 0;
commit ed85dafc2f83c573303a33f795e69a2a78812cf1
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..374a891
--- /dev/null
+++ b/sc/source/ui/inc/datastreams.hxx
@@ -0,0 +1,50 @@
+/* -*- 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/scoped_ptr.hpp>
+
+class Dialog;
+class ScDocShell;
+class ScDocument;
+class ScRange;
+class SvStream;
+class Window;
+namespace datastreams { class CallerThread; }
+
+class DataStreams : boost::noncopyable
+{
+ Dialog *mpDialog;
+ 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..4cbb0ae
--- /dev/null
+++ b/sc/source/ui/miscdlgs/datastreams.cxx
@@ -0,0 +1,158 @@
+/* -*- 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):
+ mpDialog(NULL)
+ , 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..4519c60
--- /dev/null
+++ b/sc/source/ui/miscdlgs/datastreamsdlg.cxx
@@ -0,0 +1,134 @@
+/* -*- 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 ModelessDialog
+{
+ 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(StartHdl, void *);
+ DECL_LINK(StopHdl, void *);
+
+ void UpdateEnable();
+
+public:
+ DataStreamsDlg(DataStreams *pDataStreams, Window* pParent);
+ ~DataStreamsDlg();
+};
+
+DataStreamsDlg::DataStreamsDlg(DataStreams *pDataStreams, Window* pParent)
+ : ModelessDialog(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 ) );
+ m_pBtnOk->SetClickHdl( LINK( this, DataStreamsDlg, StartHdl ) );
+ m_pBtnOk->SetClickHdl( LINK( this, DataStreamsDlg, StartHdl ) );
+ UpdateEnable();
+ Show();
+}
+
+DataStreamsDlg::~DataStreamsDlg()
+{
+}
+
+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, StartHdl)
+{
+ bool bIsScript = m_pRBScriptData->IsChecked();
+ mpDataStreams->Set(m_pCbUrl->GetText(), bIsScript, m_pEdRange->GetText());
+ if (!m_pRBNoMove->IsChecked())
+ {
+ sal_Int32 nLimit = 0;
+ if (m_pRBMaxLimit->IsChecked())
+ nLimit = m_pEdLimit->GetText().toInt32();
+ mpDataStreams->SetMove(nLimit);
+ }
+ mpDataStreams->Start();
+ 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)
+{
+ if (!mpDialog)
+ mpDialog = new DataStreamsDlg(this, pParent);
+ mpDialog->Show();
+}
+
+/* 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 4bc7c9a2e15550ac0f2dfa86388ff0b965ed56ee
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 d20e42c84206e418b28de48278fdcf52e68f7572
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 4fa04dc08709694f91b99e868ec12671280cce1e
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 8dd78e321dd9082fbb302e8ee0ce74f9747fa287
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 fa19986e894aff259722e6e753a7212f70d900c9
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;
commit a621bdb0aad19a3a5ee4ff7089fca7cfe0ba1467
Author: David Tardon <dtardon at redhat.com>
Date: Tue Nov 12 21:14:32 2013 +0100
add config header for EOT
Change-Id: I1a3e01243c6f98fb5f055a1783bb13a1cbfc1efe
diff --git a/config_host/config_eot.h.in b/config_host/config_eot.h.in
new file mode 100644
index 0000000..d1c87a0
--- /dev/null
+++ b/config_host/config_eot.h.in
@@ -0,0 +1,6 @@
+#ifndef CONFIG_EOT_H
+#define CONFIG_EOT_H
+
+#define ENABLE_EOT 0
+
+#endif
diff --git a/configure.ac b/configure.ac
index e2a79bb..6d7dcf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12664,6 +12664,7 @@ AC_CONFIG_FILES([config_host.mk
ios/lo.xcconfig])
AC_CONFIG_HEADERS([config_host/config_buildid.h])
AC_CONFIG_HEADERS([config_host/config_clang.h])
+AC_CONFIG_HEADERS([config_host/config_eot.h])
AC_CONFIG_HEADERS([config_host/config_features.h])
AC_CONFIG_HEADERS([config_host/config_folders.h])
AC_CONFIG_HEADERS([config_host/config_gcc.h])
commit d3ffdf5e7db40ab026a4d55bfe231ab5817c4142
Author: Andras Timar <andras.timar at collabora.com>
Date: Tue Nov 12 20:55:23 2013 +0100
fdo#46410 fix FindRange
Change-Id: I7aada76bc2e8e767f36016eee5e57267b3718b13
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 49c1c20..9059e17 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -389,8 +389,7 @@ void SwEditShell::ApplyAutoMark()
// todo/mba: assuming that notes shouldn't be searched
sal_Bool bSearchInNotes = sal_False;
sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, DOCPOS_START, DOCPOS_END, bCancel,
- (FindRanges)(FND_IN_SELALL|FND_IN_BODYONLY|FND_IN_OTHER),
- sal_False );
+ (FindRanges)(FND_IN_SELALL), sal_False );
if(nRet)
{
commit 7c320e1a2518707dcdefc4680db67030f4c31386
Author: Philipp Weissenbacher <p.weissenbacher at gmail.com>
Date: Sun Nov 10 17:54:14 2013 +0100
Translate German comments
Change-Id: I7e0ece1089edad3065e794a4c0e138ffa858bfc2
Reviewed-on: https://gerrit.libreoffice.org/6631
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Eike Rathke <erack at redhat.com>
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index fbcdd9d..bff7c71 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -60,8 +60,6 @@
// in fuins1.cxx
extern void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage );
-//------------------------------------------------------------------------
-
ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
maRange( rRange ),
mpDoc( pDocP ),
@@ -77,9 +75,9 @@ ScEEImport::ScEEImport( ScDocument* pDocP, const ScRange& rRange ) :
ScEEImport::~ScEEImport()
{
- // Reihenfolge wichtig, sonst knallt's irgendwann irgendwo in irgendeinem Dtor!
- // Ist gewaehrleistet, da ScEEImport Basisklasse ist
- delete mpEngine; // nach Parser!
+ // Sequence important, or else we crash in some dtor!
+ // Is guaranteed as ScEEImport is base class
+ delete mpEngine; // After Parser!
}
@@ -151,8 +149,8 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
if ( nRow != nLastMergedRow )
nMergeColAdd = 0;
SCCOL nCol = nStartCol + pE->nCol + nMergeColAdd;
- // RowMerge feststellen, pures ColMerge und ColMerge der ersten
- // MergeRow bereits beim parsen
+ // Determine RowMerge
+ // Pure ColMerge and ColMerge of the first MergeRow already done during parsing
if ( nRow <= nOverlapRowMax )
{
while ( nCol <= MAXCOL && mpDoc->HasAttrib( nCol, nRow, nTab,
@@ -163,20 +161,21 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
nLastMergedRow = nRow;
}
- // fuer zweiten Durchlauf eintragen
+ // Add for second run
pE->nCol = nCol;
pE->nRow = nRow;
if ( ValidCol(nCol) && ValidRow(nRow) )
{
SfxItemSet aSet = mpEngine->GetAttribs( pE->aSel );
- // Default raus, wir setzen selber links/rechts je nachdem ob Text
- // oder Zahl; EditView.GetAttribs liefert immer kompletten Set
- // mit Defaults aufgefuellt
+ // Remove default: we set left/right ourselves depending on Text or
+ // Number
+ // EditView.GetAttribs always returns complete Set filled with
+ // defaults
const SfxPoolItem& rItem = aSet.Get( EE_PARA_JUST );
if ( ((const SvxAdjustItem&)rItem).GetAdjust() == SVX_ADJUST_LEFT )
aSet.ClearItem( EE_PARA_JUST );
- // Testen, ob einfacher String ohne gemischte Attribute
+ // Test whether simple String without mixed attributes
sal_Bool bSimple = ( pE->aSel.nStartPara == pE->aSel.nEndPara );
for (sal_uInt16 nId = EE_CHAR_START; nId <= EE_CHAR_END && bSimple; nId++)
{
@@ -186,7 +185,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
bSimple = false;
else if (eState == SFX_ITEM_SET)
{
- if ( nId == EE_CHAR_ESCAPEMENT ) // Hoch-/Tiefstellen immer ueber EE
+ if ( nId == EE_CHAR_ESCAPEMENT ) // Super-/Subscript always via EE
{
if ( (SvxEscapement)((const SvxEscapementItem*)pItem)->GetEnumValue()
!= SVX_ESCAPEMENT_OFF )
@@ -195,7 +194,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
}
if ( bSimple )
- { // Feldbefehle enthalten?
+ { // Contains field commands?
SfxItemState eFieldState = aSet.GetItemState( EE_FEATURE_FIELD, false );
if ( eFieldState == SFX_ITEM_DONTCARE || eFieldState == SFX_ITEM_SET )
bSimple = false;
@@ -207,7 +206,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
sal_uInt32 nNumForm = 0;
LanguageType eNumLang = LANGUAGE_NONE;
if ( pE->pNumStr )
- { // SDNUM muss sein wenn SDVAL
+ { // SDNUM needs to be if SDVAL
aNumStr = *pE->pNumStr;
if ( pE->pValStr )
aValStr = *pE->pValStr;
@@ -215,7 +214,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
nNumForm, eNumLang, aValStr, aNumStr, *pFormatter );
}
- // Attribute setzen
+ // Set attributes
ScPatternAttr aAttr( pDocPool );
aAttr.GetFromEditItemSet( &aSet );
SfxItemSet& rSet = aAttr.GetItemSet();
@@ -289,8 +288,8 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
}
if ( pE->nColOverlap > 1 || pE->nRowOverlap > 1 )
- { // merged cells, mit SfxItemSet Put schneller als mit
- // nachtraeglichem ScDocument DoMerge
+ { // Merged cells, with SfxItemSet.Put() is faster than
+ // with ScDocument.DoMerge() afterwards
ScMergeAttr aMerge( pE->nColOverlap, pE->nRowOverlap );
rSet.Put( aMerge );
SCROW nRO = 0;
@@ -317,7 +316,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
aAttr.SetStyleSheet( (ScStyleSheet*)pStyleSheet );
mpDoc->SetPattern( nCol, nRow, nTab, aAttr, sal_True );
- // Daten eintragen
+ // Add data
if (bSimple)
{
ScSetStringParam aParam;
@@ -332,7 +331,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
{
// maybe ALT text of IMG or similar
mpDoc->SetString( nCol, nRow, nTab, pE->aAltText, &aParam );
- // wenn SelRange komplett leer kann nachfolgender Text im gleichen Absatz liegen!
+ // If SelRange is completely empty, the succeeding text can be in the same paragraph!
}
else
{
@@ -418,7 +417,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
if ( bSizeColsRows )
{
- // Spaltenbreiten
+ // Column widths
ColWidthsMap& rColWidths = mpParser->GetColWidths();
if ( !rColWidths.empty() )
{
@@ -435,11 +434,11 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
pProgress->SetState( ++nProgress );
}
}
- DELETEZ( pProgress ); // SetOptimalHeight hat seinen eigenen ProgressBar
- // Zeilenhoehen anpassen, Basis 100% Zoom
+ DELETEZ( pProgress ); // SetOptimalHeight has its own ProgressBar
+ // Adjust line height, base is 100% zoom
Fraction aZoom( 1, 1 );
- double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom
- / nOutputFactor; // Faktor ist Drucker zu Bildschirm
+ // Factor is printer to display ratio
+ double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / nOutputFactor;
double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom;
VirtualDevice aVirtDev;
mpDoc->SetOptimalHeight( 0, nEndRow, 0,
@@ -458,7 +457,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
}
if ( bHasGraphics )
{
- // Grafiken einfuegen
+ // Insert graphics
for ( size_t i = 0, nListSize = mpParser->ListSize(); i < nListSize; ++i )
{
pE = mpParser->ListEntry( i );
@@ -504,7 +503,7 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEPa
nHeight = aLogicSize.Height();
nDir = pI->nDir;
}
- // Spaltenbreiten
+ // Column widths
ColWidthsMap& rColWidths = mpParser->GetColWidths();
long nThisWidth = 0;
ColWidthsMap::const_iterator it = rColWidths.find( nCol );
@@ -519,14 +518,14 @@ sal_Bool ScEEImport::GraphicSize( SCCOL nCol, SCROW nRow, SCTAB /*nTab*/, ScEEPa
nColWidths += it2->second;
}
if ( nWidth > nColWidths )
- { // Differenz nur in der ersten Spalte eintragen
+ { // Only insert difference in first column
rColWidths[ nCol ] = nWidth - nColWidths + nThisWidth;
}
- // Zeilenhoehen, Differenz auf alle betroffenen Zeilen verteilen
+ // Distribute line height difference between all affected lines
SCROW nRowSpan = pE->nRowOverlap;
nHeight /= nRowSpan;
if ( nHeight == 0 )
- nHeight = 1; // fuer eindeutigen Vergleich
+ nHeight = 1; // For definite comparison
for ( SCROW nR = nRow; nR < nRow + nRowSpan; nR++ )
{
RowHeightMap::const_iterator it2 = maRowHeights.find( nR );
@@ -566,24 +565,25 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
{
ScHTMLImage* pI = &pE->maImageList[ i ];
if ( nDir & nHorizontal )
- { // horizontal
+ { // Horizontal
aInsertPos.X() += aLogicSize.Width();
aInsertPos.X() += aSpace.X();
aInsertPos.Y() = aCellInsertPos.Y();
}
else
- { // vertikal
+ { // Vertical
aInsertPos.X() = aCellInsertPos.X();
aInsertPos.Y() += aLogicSize.Height();
aInsertPos.Y() += aSpace.Y();
}
- // Offset des Spacings drauf
+ // Add offset of Spacing
aSpace = pDefaultDev->PixelToLogic( pI->aSpace, MapMode( MAP_100TH_MM ) );
aInsertPos += aSpace;
Size aSizePix = pI->aSize;
aLogicSize = pDefaultDev->PixelToLogic( aSizePix, MapMode( MAP_100TH_MM ) );
- // Groesse begrenzen
+
+ // Limit size
::ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() );
if ( pI->pGraphic )
@@ -600,7 +600,7 @@ void ScEEImport::InsertGraphic( SCCOL nCol, SCROW nRow, SCTAB nTab,
// See #i37444#.
pObj->SetGraphicLink( pI->aURL, pI->aFilterName );
- pObj->SetLogicRect( aRect ); // erst nach InsertObject !!!
+ pObj->SetLogicRect( aRect ); // Only after InsertObject!
}
nDir = pI->nDir;
}
@@ -617,7 +617,7 @@ ScEEParser::ScEEParser( EditEngine* pEditP ) :
nColMax(0),
nRowMax(0)
{
- // pPool wird spaeter bei RTFIMP_START dem SvxRTFParser untergejubelt
+ // pPool is foisted on SvxRTFParser at RTFIMP_START later on
pPool->SetSecondaryPool( pDocPool );
pPool->FreezeIdRanges();
NewActEntry( NULL );
@@ -629,7 +629,7 @@ ScEEParser::~ScEEParser()
delete pActEntry;
if ( !maList.empty() ) maList.clear();
- // Pool erst loeschen nachdem die Listen geloescht wurden
+ // Don't delete Pool until the lists have been deleted
pPool->SetSecondaryPool( NULL );
SfxItemPool::Free(pDocPool);
SfxItemPool::Free(pPool);
@@ -637,13 +637,10 @@ ScEEParser::~ScEEParser()
void ScEEParser::NewActEntry( ScEEParseEntry* pE )
-{ // neuer freifliegender pActEntry
+{ // New free-flying pActEntry
pActEntry = new ScEEParseEntry( pPool );
pActEntry->aSel.nStartPara = (pE ? pE->aSel.nEndPara + 1 : 0);
pActEntry->aSel.nStartPos = 0;
}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx
index e0efa75..f5f5d8f 100644
--- a/sc/source/filter/rtf/rtfexp.cxx
+++ b/sc/source/filter/rtf/rtfexp.cxx
@@ -42,8 +42,6 @@
#include "stlpool.hxx"
#include "ftools.hxx"
-//------------------------------------------------------------------
-
FltError ScFormatFilterPluginImpl::ScExportRTF( SvStream& rStrm, ScDocument* pDoc,
const ScRange& rRange, const rtl_TextEncoding /*eNach*/ )
{
@@ -71,7 +69,7 @@ sal_uLong ScRTFExport::Write()
rStrm << '{' << OOO_STRING_SVTOOLS_RTF_RTF;
rStrm << OOO_STRING_SVTOOLS_RTF_ANSI << SAL_NEWLINE_STRING;
- // Daten
+ // Data
for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ )
{
if ( nTab > aRange.aStart.Tab() )
@@ -143,7 +141,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
rStrm << OOO_STRING_SVTOOLS_RTF_CELLX << OString::number(pCellX[nCol+1]).getStr();
if ( (nCol & 0x0F) == 0x0F )
- rStrm << SAL_NEWLINE_STRING; // Zeilen nicht zu lang werden lassen
+ rStrm << SAL_NEWLINE_STRING; // Do not let lines get too long
}
rStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << OOO_STRING_SVTOOLS_RTF_INTBL << SAL_NEWLINE_STRING;
@@ -152,7 +150,7 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow )
{
WriteCell( nTab, nRow, nCol );
if ( rStrm.Tell() - nStrmPos > 255 )
- { // Zeilen nicht zu lang werden lassen
+ { // Do not let lines get too long
rStrm << SAL_NEWLINE_STRING;
nStrmPos = rStrm.Tell();
}
@@ -188,7 +186,7 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
{
EditEngine& rEngine = GetEditEngine();
rEngine.SetText(*pObj);
- aContent = rEngine.GetText(LINEEND_LF); // LineFeed zwischen Absaetzen!
+ aContent = rEngine.GetText(LINEEND_LF); // LineFeed in between paragraphs!
}
}
break;
@@ -251,5 +249,4 @@ void ScRTFExport::WriteCell( SCTAB nTab, SCROW nRow, SCCOL nCol )
rStrm << OOO_STRING_SVTOOLS_RTF_PLAIN;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/rtf/rtfparse.cxx b/sc/source/filter/rtf/rtfparse.cxx
index 7ededf1..69277d6 100644
--- a/sc/source/filter/rtf/rtfparse.cxx
+++ b/sc/source/filter/rtf/rtfparse.cxx
@@ -33,7 +33,7 @@
#include "document.hxx"
#include "docpool.hxx"
-#define SC_RTFTWIPTOL 10 // 10 Twips Toleranz bei Spaltenbestimmung
+#define SC_RTFTWIPTOL 10 // 10 Twips tolerance when determining columns
@@ -51,7 +51,7 @@ ScRTFParser::ScRTFParser( EditEngine* pEditP ) :
// RTF default FontSize 12Pt
long nMM = OutputDevice::LogicToLogic( 12, MAP_POINT, MAP_100TH_MM );
pPool->SetPoolDefaultItem( SvxFontHeightItem( nMM, 100, EE_CHAR_FONTHEIGHT ) );
- // freifliegender pInsDefault
+ // Free-flying pInsDefault
pInsDefault = new ScRTFCellDefault( pPool );
}
@@ -74,18 +74,18 @@ sal_uLong ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL )
if ( !maList.empty() )
{
ScEEParseEntry* pE = maList.back();
- if ( // komplett leer
+ if ( // Completely empty
( ( pE->aSel.nStartPara == pE->aSel.nEndPara
&& pE->aSel.nStartPos == pE->aSel.nEndPos
)
- || // leerer Paragraph
+ || // Empty paragraph
( pE->aSel.nStartPara + 1 == pE->aSel.nEndPara
&& pE->aSel.nStartPos == pEdit->GetTextLen( pE->aSel.nStartPara )
&& pE->aSel.nEndPos == 0
)
)
)
- { // den letzten leeren Absatz nicht uebernehmen
+ { // Don't take over the last paragraph
maList.pop_back();
}
}
@@ -98,9 +98,9 @@ sal_uLong ScRTFParser::Read( SvStream& rStream, const OUString& rBaseURL )
void ScRTFParser::EntryEnd( ScEEParseEntry* pE, const ESelection& aSel )
{
- // Paragraph -2 stript den angehaengten leeren Paragraph
+ // Paragraph -2 strips the attached empty paragraph
pE->aSel.nEndPara = aSel.nEndPara - 2;
- // obwohl das nEndPos heisst, ist das letzte Position + 1
+ // Although it's called nEndPos, the last one is position + 1
pE->aSel.nEndPos = pEdit->GetTextLen( aSel.nEndPara - 1 );
}
@@ -124,10 +124,10 @@ sal_Bool ScRTFParser::SeekTwips( sal_uInt16 nTwips, SCCOL* pCol )
if ( !nCount )
return false;
SCCOL nCol = *pCol;
- // nCol ist Einfuegeposition, da liegt der Naechsthoehere (oder auch nicht)
+ // nCol is insertion position; the next one higher up is there (or not)
if ( nCol < static_cast<SCCOL>(nCount) && (((*pColTwips)[nCol] - SC_RTFTWIPTOL) <= nTwips) )
return sal_True;
- // nicht kleiner als alles andere? dann mit Naechstniedrigerem vergleichen
+ // Not smaller than everything else? Then compare with the next lower one
else if ( nCol != 0 && (((*pColTwips)[nCol-1] + SC_RTFTWIPTOL) >= nTwips) )
{
(*pCol)--;
@@ -150,13 +150,13 @@ void ScRTFParser::ColAdjust()
nCol = 0;
pE->nCol = nCol;
if ( pE->nColOverlap > 1 )
- nCol = nCol + pE->nColOverlap; // merged cells mit \clmrg
+ nCol = nCol + pE->nColOverlap; // Merged cells with \clmrg
else
{
SeekTwips( pE->nTwips, &nCol );
if ( ++nCol <= pE->nCol )
- nCol = pE->nCol + 1; // verschobene Zell-X
- pE->nColOverlap = nCol - pE->nCol; // merged cells ohne \clmrg
+ nCol = pE->nCol + 1; // Moved cell X
+ pE->nColOverlap = nCol - pE->nCol; // Merged cells without \clmrg
}
if ( nCol > nColMax )
nColMax = nCol;
@@ -189,11 +189,11 @@ IMPL_LINK( ScRTFParser, RTFImportHdl, ImportInfo*, pInfo )
break;
case RTFIMP_END:
if ( pInfo->aSelection.nEndPos )
- { // falls noch Text: letzten Absatz erzeugen
+ { // If still text: create last paragraph
pActDefault = NULL;
pInfo->nToken = RTF_PAR;
- // EditEngine hat keinen leeren Paragraph mehr angehaengt
- // den EntryEnd strippen koennte
+ // EditEngine did not attach an empty paragraph anymore
+ // which EntryEnd could strip
pInfo->aSelection.nEndPara++;
ProcToken( pInfo );
}
@@ -210,15 +210,15 @@ IMPL_LINK( ScRTFParser, RTFImportHdl, ImportInfo*, pInfo )
return 0;
}
-
-// bei RTF_INTBL bzw. am Anfang von erstem RTF_CELL nach RTF_CELLX wenn es
-// kein RTF_INTBL gab, bad behavior
+// Bad behavior:
+// For RTF_INTBL or respectively at the start of the first RTF_CELL
+// after RTF_CELLX if there was no RTF_INTBL
void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
{
if ( bNewDef )
{
bNewDef = false;
- // rechts nicht buendig? => neue Tabelle
+ // Not flush on the right? => new table
if ( nLastWidth && !maDefaultList.empty() )
{
const ScRTFCellDefault& rD = maDefaultList.back();
@@ -235,7 +235,7 @@ void ScRTFParser::NewCellRow( ImportInfo* /*pInfo*/ )
}
}
}
- // TwipCols aufbauen, erst nach nLastWidth Vergleich!
+ // Build up TwipCols only after nLastWidth comparison!
for ( size_t i = 0, n = maDefaultList.size(); i < n; ++i )
{
const ScRTFCellDefault& rD = maDefaultList[i];
@@ -309,9 +309,9 @@ void ScRTFParser::ProcToken( ImportInfo* pInfo )
mnCurPos = maDefaultList.size() - 1;
}
OSL_ENSURE( pDefMerge, "RTF_CLMRG: pDefMerge==0" );
- if ( pDefMerge ) // sonst rottes RTF
- pDefMerge->nColOverlap++; // mehrere nacheinander moeglich
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list