diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-19 15:17:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2013-12-19 15:33:09 -0500 |
commit | 23f09302199c903b63064760d9d4a3fd34ff0fe5 (patch) | |
tree | f1aa9410c5927ccef569c5fbd28ecc6bb10941a2 /sc/source/ui/docshell/docsh.cxx | |
parent | a6b2103b8b35aa7c25eabc3d38adca167a9f9f4e (diff) |
Properly import data stream data from ods.
Change-Id: Iedae2226ba08c614f1b700a5444715a990899d38
Diffstat (limited to 'sc/source/ui/docshell/docsh.cxx')
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index ca39e78c6118..3e182701fce8 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -119,6 +119,8 @@ #include "dpobject.hxx" #include "markdata.hxx" #include "orcusfilters.hxx" +#include <datastream.hxx> +#include <documentlinkmgr.hxx> #include <config_telepathy.h> @@ -400,6 +402,36 @@ private: ScDocument* mpDoc; }; +void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rData ) +{ + if (!rData.mpDataStream) + return; + + const sc::ImportPostProcessData::DataStream& r = *rData.mpDataStream; + if (!r.maRange.IsValid()) + return; + + // Break the streamed range into the top range and the height limit. A + // height limit of 0 means unlimited i.e. the streamed data will go all + // the way to the last row. + + ScRange aTopRange = r.maRange; + aTopRange.aEnd.SetRow(aTopRange.aStart.Row()); + sal_Int32 nLimit = r.maRange.aEnd.Row() - r.maRange.aStart.Row() + 1; + if (r.maRange.aEnd.Row() == MAXROW) + // Unlimited range. + nLimit = 0; + + sc::DataStream::MoveType eMove = + r.meInsertPos == sc::ImportPostProcessData::DataStream::InsertTop ? + sc::DataStream::MOVE_DOWN : sc::DataStream::RANGE_DOWN; + + sc::DataStream* pStrm = new sc::DataStream(&rShell, r.maURL, aTopRange, nLimit, eMove, 0); + pStrm->SetRefreshOnEmptyLine(r.mbRefreshOnEmpty); + sc::DocumentLinkManager& rMgr = rShell.GetDocument()->GetDocLinkManager(); + rMgr.setDataStream(pStrm); +} + } sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStor ) @@ -430,6 +462,8 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un if ( nError ) pLoadMedium->SetError( nError, OUString( OSL_LOG_PREFIX ) ); + processDataStream(*this, aImport.GetImportPostProcessData()); + //if the document was not generated by LibreOffice, do hard recalc in case some other document //generator saved cached formula results that differ from LibreOffice's calculated results or //did not use cached formula results. |