include/xmloff/xmltoken.hxx | 3 + sc/Library_sc.mk | 1 sc/inc/document.hxx | 5 + sc/inc/documentlinkmgr.hxx | 36 ++++++++++++ sc/source/core/data/documen2.cxx | 14 ++++ sc/source/core/data/documen8.cxx | 5 - sc/source/filter/xml/xmlcelli.cxx | 20 ------ sc/source/ui/docshell/datastream.cxx | 88 +----------------------------- sc/source/ui/docshell/documentlinkmgr.cxx | 44 +++++++++++++++ sc/source/ui/inc/datastream.hxx | 11 --- sc/source/ui/view/cellsh2.cxx | 52 +++++++---------- xmloff/source/core/xmltoken.cxx | 3 + 12 files changed, 137 insertions(+), 145 deletions(-)
New commits: commit 65634915194bd3f27eda98fc0eb4fea0c11d6339 Author: Kohei Yoshida <[email protected]> Date: Wed Dec 18 23:51:27 2013 -0500 Switch away from using the sfx2 link manager for data stream. Change-Id: I05ac5a8151135ace7f4e351cfedab0170c8d9a57 diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 01a4ab9..8eeab59 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -404,6 +404,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/docshell/docsh6 \ sc/source/ui/docshell/docsh7 \ sc/source/ui/docshell/docsh8 \ + sc/source/ui/docshell/documentlinkmgr \ sc/source/ui/docshell/editable \ sc/source/ui/docshell/externalrefmgr \ sc/source/ui/docshell/impex \ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 74d9cd1..8d52830 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -70,6 +70,7 @@ class EditTextIterator; struct NoteEntry; struct FormulaGroupContext; class DocumentStreamAccess; +class DocumentLinkManager; } @@ -259,6 +260,7 @@ private: boost::scoped_ptr<svl::SharedStringPool> mpCellStringPool; boost::scoped_ptr<sc::FormulaGroupContext> mpFormulaGroupCxt; + mutable boost::scoped_ptr<sc::DocumentLinkManager> mpDocLinkMgr; SfxUndoManager* mpUndoManager; ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper @@ -480,6 +482,9 @@ public: SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const; + sc::DocumentLinkManager& GetDocLinkManager(); + const sc::DocumentLinkManager& GetDocLinkManager() const; + SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const; SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt ); SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const; diff --git a/sc/inc/documentlinkmgr.hxx b/sc/inc/documentlinkmgr.hxx new file mode 100644 index 0000000..ead5698 --- /dev/null +++ b/sc/inc/documentlinkmgr.hxx @@ -0,0 +1,36 @@ +/* -*- 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_DOCUMENTLINKMGR_HXX +#define SC_DOCUMENTLINKMGR_HXX + +#include <boost/noncopyable.hpp> + +namespace sc { + +class DataStream; +struct DocumentLinkManagerImpl; + +class DocumentLinkManager : boost::noncopyable +{ + DocumentLinkManagerImpl* mpImpl; + +public: + DocumentLinkManager(); + + void setDataStream( DataStream* p ); + DataStream* getDataStream(); + const DataStream* getDataStream() const; +}; + +} + +#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 2ee3828..58310967 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -95,6 +95,7 @@ #include "refreshtimerprotector.hxx" #include "scopetools.hxx" #include "formulagroup.hxx" +#include "documentlinkmgr.hxx" using namespace com::sun::star; @@ -266,6 +267,19 @@ sfx2::LinkManager* ScDocument::GetLinkManager() const return pLinkManager; } +sc::DocumentLinkManager& ScDocument::GetDocLinkManager() +{ + if (!mpDocLinkMgr) + mpDocLinkMgr.reset(new sc::DocumentLinkManager); + return *mpDocLinkMgr; +} + +const sc::DocumentLinkManager& ScDocument::GetDocLinkManager() const +{ + if (!mpDocLinkMgr) + mpDocLinkMgr.reset(new sc::DocumentLinkManager); + return *mpDocLinkMgr; +} void ScDocument::SetStorageGrammar( formula::FormulaGrammar::Grammar eGram ) { diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index dfd8a36..47ad103 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -86,7 +86,6 @@ #include "columniterator.hxx" #include "globalnames.hxx" #include "stringutil.hxx" -#include <datastream.hxx> #include <memory> #include <boost/scoped_ptr.hpp> @@ -1194,7 +1193,7 @@ bool ScDocument::HasAreaLinks() const const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks(); sal_uInt16 nCount = rLinks.size(); for (sal_uInt16 i=0; i<nCount; i++) - if ((*rLinks[i])->ISA(ScAreaLink) || (*rLinks[i])->ISA(sc::DataStream)) + if ((*rLinks[i])->ISA(ScAreaLink)) return true; } @@ -1209,7 +1208,7 @@ void ScDocument::UpdateAreaLinks() for (sal_uInt16 i=0; i<rLinks.size(); i++) { ::sfx2::SvBaseLink* pBase = *rLinks[i]; - if (pBase->ISA(ScAreaLink) || (*rLinks[i])->ISA(sc::DataStream)) + if (pBase->ISA(ScAreaLink)) pBase->Update(); } } diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index c506ee4..5b1b9dd 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -16,18 +16,14 @@ #include <osl/time.h> #include <rtl/strbuf.hxx> #include <salhelper/thread.hxx> -#include <sfx2/linkmgr.hxx> #include <sfx2/viewfrm.hxx> -#include <arealink.hxx> #include <datastreamdlg.hxx> -#include <dbfunc.hxx> #include <docsh.hxx> -#include <documentimport.hxx> -#include <impex.hxx> #include <rangelst.hxx> #include <tabvwsh.hxx> #include <viewdata.hxx> #include <stringutil.hxx> +#include <documentlinkmgr.hxx> #include <config_orcus.h> @@ -189,46 +185,9 @@ DataStream* DataStream::Set( ScDocShell *pShell, const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings) { - // Each DataStream needs a destination area in order to be exported. - // There can be only one ScAreaLink / DataStream per cell. - // So - if we don't need range (DataStream with mbValuesInLine == false), - // just find a free cell for now. - ScRange aDestArea; - if (rRange.IsValid()) - aDestArea = rRange; - - sfx2::LinkManager* pLinkManager = pShell->GetDocument()->GetLinkManager(); - sal_uInt16 nLinkPos = 0; - while (nLinkPos < pLinkManager->GetLinks().size()) - { - sfx2::SvBaseLink* pBase = *pLinkManager->GetLinks()[nLinkPos]; - if (!rRange.IsValid()) - { - if ( (pBase->ISA(ScAreaLink) && static_cast<ScAreaLink*> - (&(*pBase))->GetDestArea().aStart == aDestArea.aStart) - || (pBase->ISA(DataStream) && static_cast<DataStream*> - (&(*pBase))->GetRange().aStart == aDestArea.aStart) ) - { - aDestArea.Move(0, 1, 0); - nLinkPos = 0; - continue; - } - else - ++nLinkPos; - } - else if ( (pBase->ISA(ScAreaLink) && static_cast<ScAreaLink*> - (&(*pBase))->GetDestArea().aStart == aDestArea.aStart) - || (pBase->ISA(DataStream) && static_cast<DataStream*> - (&(*pBase))->GetRange().aStart == aDestArea.aStart) ) - { - pLinkManager->Remove( pBase ); - } - else - ++nLinkPos; - } - - DataStream* pLink = new DataStream(pShell, rURL, aDestArea, nLimit, eMove, nSettings); - pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, rURL, NULL, NULL ); + DataStream* pLink = new DataStream(pShell, rURL, rRange, nLimit, eMove, nSettings); + sc::DocumentLinkManager& rMgr = pShell->GetDocument()->GetDocLinkManager(); + rMgr.setDataStream(pLink); return pLink; } @@ -435,12 +394,6 @@ void DataStream::MoveData() } } -IMPL_LINK_NOARG(DataStream, RefreshHdl) -{ - ImportData(); - return 0; -} - #if ENABLE_ORCUS namespace { @@ -573,39 +526,6 @@ bool DataStream::ImportData() return mbRunning; } -sfx2::SvBaseLink::UpdateResult DataStream::DataChanged( - const OUString& , const css::uno::Any& ) -{ - MakeToolbarVisible(); - StopImport(); - bool bStart = true; - if (mnSettings & SCRIPT_STREAM && !mxReaderThread.is() && - officecfg::Office::Common::Security::Scripting::MacroSecurityLevel::get() >= 1) - { - MessageDialog aQBox( NULL, "QueryRunStreamScriptDialog", "modules/scalc/ui/queryrunstreamscriptdialog.ui"); - aQBox.set_primary_text( aQBox.get_primary_text().replaceFirst("%URL", msURL) ); - if (RET_YES != aQBox.Execute()) - bStart = false; - } - if (bStart) - StartImport(); - return SUCCESS; -} - -void DataStream::Edit( Window* pWindow, const Link& ) -{ - DataStreamDlg aDialog(mpDocShell, pWindow); - aDialog.Init(msURL, maStartRange, mnLimit, meMove, mnSettings); - if (aDialog.Execute() == RET_OK) - { - bool bWasRunning = mbRunning; - StopImport(); - aDialog.StartStream(this); - if (bWasRunning) - StartImport(); - } -} - } // namespace sc /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx new file mode 100644 index 0000000..2b9998f --- /dev/null +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -0,0 +1,44 @@ +/* -*- 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 <documentlinkmgr.hxx> +#include <datastream.hxx> + +#include <boost/noncopyable.hpp> +#include <boost/scoped_ptr.hpp> + +namespace sc { + +struct DocumentLinkManagerImpl : boost::noncopyable +{ + boost::scoped_ptr<DataStream> mpDataStream; + + DocumentLinkManagerImpl() : mpDataStream(NULL) {} +}; + +DocumentLinkManager::DocumentLinkManager() : mpImpl(new DocumentLinkManagerImpl) {} + +void DocumentLinkManager::setDataStream( DataStream* p ) +{ + mpImpl->mpDataStream.reset(p); +} + +DataStream* DocumentLinkManager::getDataStream() +{ + return mpImpl->mpDataStream.get(); +} + +const DataStream* DocumentLinkManager::getDataStream() const +{ + return mpImpl->mpDataStream.get(); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/datastream.hxx b/sc/source/ui/inc/datastream.hxx index 1cde20e..935e895 100644 --- a/sc/source/ui/inc/datastream.hxx +++ b/sc/source/ui/inc/datastream.hxx @@ -14,14 +14,12 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> -#include <sfx2/lnkbase.hxx> #include <address.hxx> #include <boost/noncopyable.hpp> #include <boost/scoped_ptr.hpp> #include <vector> -#include <rangelst.hxx> #include <documentstreamaccess.hxx> class ScDocShell; @@ -37,12 +35,11 @@ namespace datastreams { typedef std::vector<OString> LinesList; -class DataStream : boost::noncopyable, public sfx2::SvBaseLink +class DataStream : boost::noncopyable { OString ConsumeLine(); void MoveData(); void Text2Doc(); - DECL_LINK( RefreshHdl, void* ); public: enum MoveType { NO_MOVE, RANGE_DOWN, MOVE_DOWN, MOVE_UP }; @@ -58,11 +55,7 @@ public: ScDocShell *pShell, const OUString& rURL, const ScRange& rRange, sal_Int32 nLimit, MoveType eMove, sal_uInt32 nSettings); - virtual ~DataStream(); - // sfx2::SvBaseLink - virtual sfx2::SvBaseLink::UpdateResult DataChanged( - const OUString& , const css::uno::Any& ) SAL_OVERRIDE; - virtual void Edit(Window* , const Link& ) SAL_OVERRIDE; + ~DataStream(); ScRange GetRange() const; const OUString& GetURL() const { return msURL; } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 1b5aa69..1c7e89c 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -20,7 +20,6 @@ #include "scitems.hxx" #include <sfx2/viewfrm.hxx> #include <sfx2/app.hxx> -#include <sfx2/linkmgr.hxx> #include <sfx2/request.hxx> #include <svl/aeitem.hxx> #include <basic/sbxcore.hxx> @@ -62,6 +61,7 @@ #include "datastreamdlg.hxx" #include "queryentry.hxx" #include "markdata.hxx" +#include <documentlinkmgr.hxx> #include <config_orcus.h> @@ -737,36 +737,30 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } break; case SID_DATA_STREAMS: - { - sc::DataStreamDlg aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); - if (aDialog.Execute() == RET_OK) - aDialog.StartStream(); - } - break; + { + sc::DataStreamDlg aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); + if (aDialog.Execute() == RET_OK) + aDialog.StartStream(); + } + break; case SID_DATA_STREAMS_PLAY: - { - ScDocument *pDoc = GetViewData()->GetDocument(); - if (pDoc->GetLinkManager()) - { - const sfx2::SvBaseLinks& rLinks = pDoc->GetLinkManager()->GetLinks(); - for (size_t i = 0; i < rLinks.size(); i++) - if (sc::DataStream *pStream = dynamic_cast<sc::DataStream*>(&(*(*rLinks[i])))) - pStream->StartImport(); - } - } - break; + { + ScDocument *pDoc = GetViewData()->GetDocument(); + sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); + sc::DataStream* pStrm = rMgr.getDataStream(); + if (pStrm) + pStrm->StartImport(); + } + break; case SID_DATA_STREAMS_STOP: - { - ScDocument *pDoc = GetViewData()->GetDocument(); - if (pDoc->GetLinkManager()) - { - const sfx2::SvBaseLinks& rLinks = pDoc->GetLinkManager()->GetLinks(); - for (size_t i = 0; i < rLinks.size(); i++) - if (sc::DataStream *pStream = dynamic_cast<sc::DataStream*>(&(*(*rLinks[i])))) - pStream->StopImport(); - } - } - break; + { + ScDocument *pDoc = GetViewData()->GetDocument(); + sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); + sc::DataStream* pStrm = rMgr.getDataStream(); + if (pStrm) + pStrm->StopImport(); + } + break; case SID_MANAGE_XML_SOURCE: ExecuteXMLSourceDialog(); break; commit 374d6d9cfa66fc83c688f174be4ae09018055208 Author: Kohei Yoshida <[email protected]> Date: Wed Dec 18 20:56:26 2013 -0500 Remove the data stream bits from ods import. Will do this cleanly later. Change-Id: I1ca44c4522cd0ed7dd9d08bd483fe99a21e2994e diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index b1d0de3..e40a527 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1000,26 +1000,6 @@ void ScXMLTableRowCellContext::SetCellRangeSource( const ScAddress& rPosition ) rPosition.Row() + static_cast<SCROW>(pCellRangeSource->nRows - 1), rPosition.Tab() ); OUString sFilterName( pCellRangeSource->sFilterName ); OUString sSourceStr( pCellRangeSource->sSourceStr ); - OUString sRangeStr; - ScRangeStringConverter::GetStringFromRange( sRangeStr, aDestRange, pDoc, formula::FormulaGrammar::CONV_OOO ); - SvtMiscOptions aMiscOptions; - if (aMiscOptions.IsExperimentalMode() && pCellRangeSource->sFilterOptions == "DataStream") - { - ScRange aRange; - sal_uInt16 nRes = aRange.Parse(sRangeStr, pDoc); - if ((nRes & SCA_VALID) == SCA_VALID) - { - sc::DataStream::MoveType eMove = sc::DataStream::ToMoveType(sSourceStr); - sc::DataStream::Set( dynamic_cast<ScDocShell*>(pDoc->GetDocumentShell()) - , pCellRangeSource->sURL // rURL - , aRange - , sFilterName.toInt32() // nLimit - , eMove - , pCellRangeSource->nRefresh // nSettings - ); - } - return; - } ScAreaLink* pLink = new ScAreaLink( pDoc->GetDocumentShell(), pCellRangeSource->sURL, sFilterName, pCellRangeSource->sFilterOptions, sSourceStr, aDestRange, pCellRangeSource->nRefresh ); sfx2::LinkManager* pLinkManager = pDoc->GetLinkManager(); commit bef9fafe766c78d0d05767169536ee49f507f6f6 Author: Kohei Yoshida <[email protected]> Date: Wed Dec 18 20:51:48 2013 -0500 Add new XML tokens for ODS, for calc data stream import & export. Change-Id: I3b86a53a3fcbac8eab56a74c5c636e0ce0cb13e5 diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 71e41b0..50e4865 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -550,6 +550,7 @@ namespace xmloff { namespace token { XML_DATA_PILOT_TABLE, XML_DATA_PILOT_TABLES, XML_DATA_POINT, + XML_DATA_STREAM_SOURCE, XML_DATA_STYLE, XML_DATA_STYLE_NAME, XML_DATA_TYPE, @@ -669,6 +670,7 @@ namespace xmloff { namespace token { XML_EMBOSSED, XML_EMISSIVE_COLOR, XML_EMPTY, + XML_EMPTY_LINE_REFRESH, XML_ENABLE_NUMBERING, XML_ENABLED, XML_ENCODING, @@ -1022,6 +1024,7 @@ namespace xmloff { namespace token { XML_INPROCEEDINGS, XML_INSERTION, XML_INSERTION_CUT_OFF, + XML_INSERTION_POSITION, XML_INSET, XML_INSIDE, XML_INSTITUTION, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 95ce705..a652da0 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -554,6 +554,7 @@ namespace xmloff { namespace token { TOKEN( "data-pilot-table", XML_DATA_PILOT_TABLE ), TOKEN( "data-pilot-tables", XML_DATA_PILOT_TABLES ), TOKEN( "data-point", XML_DATA_POINT ), + TOKEN( "data-stream-source", XML_DATA_STREAM_SOURCE ), TOKEN( "data-style", XML_DATA_STYLE ), TOKEN( "data-style-name", XML_DATA_STYLE_NAME ), TOKEN( "data-type", XML_DATA_TYPE ), @@ -673,6 +674,7 @@ namespace xmloff { namespace token { TOKEN( "embossed", XML_EMBOSSED ), TOKEN( "emissive-color", XML_EMISSIVE_COLOR ), TOKEN( "empty", XML_EMPTY ), + TOKEN( "empty-line-refresh", XML_EMPTY_LINE_REFRESH ), TOKEN( "enable-numbering", XML_ENABLE_NUMBERING ), TOKEN( "enabled", XML_ENABLED ), TOKEN( "encoding", XML_ENCODING ), @@ -1027,6 +1029,7 @@ namespace xmloff { namespace token { TOKEN( "inproceedings", XML_INPROCEEDINGS ), TOKEN( "insertion", XML_INSERTION ), TOKEN( "insertion-cut-off", XML_INSERTION_CUT_OFF ), + TOKEN( "insertion-position", XML_INSERTION_POSITION ), TOKEN( "inset", XML_INSET ), TOKEN( "inside", XML_INSIDE ), TOKEN( "institution", XML_INSTITUTION ), _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
