[Libreoffice-commits] core.git: Branch 'private/kohei/calc-data-stream' - 2 commits - sc/source
Kohei Yoshida
kohei.yoshida at collabora.com
Thu Dec 19 12:12:19 PST 2013
sc/source/filter/xml/xmlexprt.cxx | 46 ++++++++++++++++++++++++++++++++
sc/source/filter/xml/xmlexprt.hxx | 1
sc/source/ui/docshell/datastream.cxx | 9 +++++-
sc/source/ui/inc/datastream.hxx | 4 ++
sc/source/ui/miscdlgs/datastreamdlg.cxx | 2 -
5 files changed, 59 insertions(+), 3 deletions(-)
New commits:
commit 2bd063d8ea57ebbf8981c601c0d0c41be1a27827
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Dec 19 10:54:25 2013 -0500
Unlimited when the end row is MAXROW.
The top row may not always be row 1, so we can't rely on the total row count.
Change-Id: Ia13bf6931636b15c8b673d3eed91488e6cec0def
diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx
index 17b9e6e..cc58195 100644
--- a/sc/source/ui/miscdlgs/datastreamdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx
@@ -126,7 +126,7 @@ void DataStreamDlg::Init( const DataStream& rStrm )
m_pEdRange->SetText(aStr);
SCROW nRows = aRange.aEnd.Row() - aRange.aStart.Row() + 1;
- if (nRows == MAXROWCOUNT)
+ if (aRange.aEnd.Row() == MAXROW)
m_pRBUnlimited->Check();
else
{
commit 02a86f8b4eaad15f32c8c84c8e25c330a11d7b58
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Dec 19 10:31:41 2013 -0500
Save the data stream settings to ODS but only for 1.2 extended.
And only when the experimental mode is turned on.
Change-Id: I49dc8a2588cae5ee4a987a47d882672efb93e1c2
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 74c20da..f8851f1 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -62,6 +62,7 @@
#include "editattributemap.hxx"
#include <arealink.hxx>
#include <datastream.hxx>
+#include <documentlinkmgr.hxx>
#include <xmloff/xmltoken.hxx>
#include <xmloff/xmlnmspe.hxx>
@@ -109,6 +110,7 @@
#include <editeng/outlobj.hxx>
#include <svx/svditer.hxx>
#include <svx/svdpage.hxx>
+#include <svtools/miscopt.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -1943,6 +1945,7 @@ void ScXMLExport::_ExportContent()
}
WriteExternalRefCaches();
WriteNamedExpressions();
+ WriteDataStream();
aExportDatabaseRanges.WriteDatabaseRanges();
ScXMLExportDataPilot aExportDataPilot(*this);
aExportDataPilot.WriteDataPilots(xSpreadDoc);
@@ -4039,6 +4042,49 @@ void ScXMLExport::WriteNamedExpressions()
WriteNamedRange(pNamedRanges);
}
+void ScXMLExport::WriteDataStream()
+{
+ if (!pDoc)
+ return;
+
+ SvtMiscOptions aMiscOptions;
+ if (!aMiscOptions.IsExperimentalMode())
+ // Export this only in experimental mode.
+ return;
+
+ if (getDefaultVersion() <= SvtSaveOptions::ODFVER_012)
+ // Export this only for 1.2 extended and above.
+ return;
+
+ const sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager();
+ const sc::DataStream* pStrm = rMgr.getDataStream();
+ if (!pStrm)
+ // No data stream.
+ return;
+
+ // Source URL
+ AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetRelativeReference(pStrm->GetURL()));
+
+ // Streamed range
+ ScRange aRange = pStrm->GetRange();
+ OUString aRangeStr;
+ ScRangeStringConverter::GetStringFromRange(
+ aRangeStr, aRange, pDoc, formula::FormulaGrammar::CONV_OOO);
+ AddAttribute(XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, aRangeStr);
+
+ // Empty line refresh option.
+ AddAttribute(XML_NAMESPACE_CALC_EXT, XML_EMPTY_LINE_REFRESH, pStrm->IsRefreshOnEmptyLine() ? XML_TRUE : XML_FALSE);
+
+ // New data insertion position. Either top of bottom. Default to bottom.
+ xmloff::token::XMLTokenEnum eInsertPosition = XML_BOTTOM;
+ if (pStrm->GetMove() == sc::DataStream::MOVE_DOWN)
+ eInsertPosition = XML_TOP;
+
+ AddAttribute(XML_NAMESPACE_CALC_EXT, XML_INSERTION_POSITION, eInsertPosition);
+
+ SvXMLElementExport aElem(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_STREAM_SOURCE, true, true);
+}
+
void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName)
{
//write a global or local ScRangeName
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 4ece1d5..564009d 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -198,6 +198,7 @@ class ScXMLExport : public SvXMLExport
void WriteTheLabelRanges(const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument >& xSpreadDoc);
void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, bool bColumn );
void WriteNamedExpressions();
+ void WriteDataStream();
void WriteNamedRange(ScRangeName* pRangeName);
void ExportConditionalFormat(SCTAB nTab);
void WriteExternalRefCaches();
diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx
index a68d338..edd0e2a 100644
--- a/sc/source/ui/docshell/datastream.cxx
+++ b/sc/source/ui/docshell/datastream.cxx
@@ -208,6 +208,7 @@ DataStream::DataStream(ScDocShell *pShell, const OUString& rURL, const ScRange&
mpDocShell(pShell),
mpDoc(mpDocShell->GetDocument()),
maDocAccess(*mpDoc),
+ meOrigMove(NO_MOVE),
meMove(NO_MOVE),
mbRunning(false),
mbValuesInLine(false),
@@ -268,9 +269,14 @@ ScRange DataStream::GetRange() const
return aRange;
}
+bool DataStream::IsRefreshOnEmptyLine() const
+{
+ return mbRefreshOnEmptyLine;
+}
+
DataStream::MoveType DataStream::GetMove() const
{
- return meMove;
+ return meOrigMove;
}
void DataStream::Decode(const OUString& rURL, const ScRange& rRange,
@@ -279,6 +285,7 @@ void DataStream::Decode(const OUString& rURL, const ScRange& rRange,
msURL = rURL;
mnLimit = nLimit;
meMove = eMove;
+ meOrigMove = eMove;
mnSettings = nSettings;
mbValuesInLine = mnSettings & VALUES_IN_LINE;
diff --git a/sc/source/ui/inc/datastream.hxx b/sc/source/ui/inc/datastream.hxx
index b7cd712..5a4d8cd 100644
--- a/sc/source/ui/inc/datastream.hxx
+++ b/sc/source/ui/inc/datastream.hxx
@@ -62,6 +62,7 @@ public:
const sal_Int32& GetLimit() const { return mnLimit; }
MoveType GetMove() const;
const sal_uInt32& GetSettings() const { return mnSettings; }
+ bool IsRefreshOnEmptyLine() const;
void Decode(
const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit,
@@ -83,7 +84,8 @@ private:
OUString msURL;
sal_Int32 mnLimit;
sal_uInt32 mnSettings;
- MoveType meMove;
+ MoveType meOrigMove; // Initial move setting. This one gets saved to file.
+ MoveType meMove; // move setting during streaming, which may change in the middle.
bool mbRunning;
bool mbValuesInLine;
bool mbRefreshOnEmptyLine;
More information about the Libreoffice-commits
mailing list