summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorValentin Kettner <vakevk+libreoffice@gmail.com>2014-08-12 15:03:19 +0200
committerValentin Kettner <vakevk+libreoffice@gmail.com>2014-08-12 23:26:39 +0200
commit1f4d9846aeb40af1fbb0126f666766fe6c60d8ff (patch)
treebae39464957b8a1f570c18264c9ac8f908ef797d /sw
parent535971f3a166da6c0e44a6b7211c7f8c298f388f (diff)
Refactored IDocumentExternalData out of SwDoc.
Into the new class DocumentExternalDataManager. Change-Id: Ib863daec170044c46143b47a91739d4c0940d963
Diffstat (limited to 'sw')
-rw-r--r--sw/Library_sw.mk1
-rw-r--r--sw/inc/doc.hxx16
-rw-r--r--sw/source/core/doc/DocumentExternalDataManager.cxx34
-rw-r--r--sw/source/core/doc/doc.cxx23
-rw-r--r--sw/source/core/doc/docnew.cxx2
-rw-r--r--sw/source/core/inc/DocumentExternalDataManager.hxx45
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx5
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
8 files changed, 109 insertions, 22 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index 507b94ca2a60..66eb006bde62 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -201,6 +201,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
sw/source/core/doc/DocumentStateManager \
sw/source/core/doc/DocumentLayoutManager \
sw/source/core/doc/DocumentStylePoolManager \
+ sw/source/core/doc/DocumentExternalDataManager \
sw/source/core/doc/extinput \
sw/source/core/doc/fmtcol \
sw/source/core/doc/ftnidx \
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 3d6c2654cf4c..e000a919063f 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -22,7 +22,6 @@
// SwDoc interfaces
#include <IInterface.hxx>
#include <IDocumentMarkAccess.hxx>
-#include <IDocumentExternalData.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <vcl/timer.hxx>
@@ -191,6 +190,7 @@ class IDocumentStatistics;
class IDocumentState;
class IDocumentLayoutAccess;
class IDocumentStylePoolAccess;
+class IDocumentExternalData;
class _SetGetExpFlds;
namespace sw { namespace mark {
@@ -216,6 +216,7 @@ namespace sw {
class DocumentStateManager;
class DocumentLayoutManager;
class DocumentStylePoolManager;
+ class DocumentExternalDataManager;
}
namespace com { namespace sun { namespace star {
@@ -252,8 +253,7 @@ void StartGrammarChecking( SwDoc &rDoc );
// Represents the model of a Writer document.
class SW_DLLPUBLIC SwDoc :
- public IInterface,
- public IDocumentExternalData
+ public IInterface
{
friend class ::sw::DocumentContentOperationsManager;
@@ -295,6 +295,7 @@ class SW_DLLPUBLIC SwDoc :
const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager;
const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager;
const ::boost::scoped_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager;
+ const ::boost::scoped_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager;
// Pointer
SwFrmFmt *mpDfltFrmFmt; //< Default formats.
@@ -603,10 +604,11 @@ public:
IDocumentListsAccess const & getIDocumentListsAccess() const;
IDocumentListsAccess & getIDocumentListsAccess();
- // IDocumentExternalData
- virtual void setExternalData(::sw::tExternalDataType eType,
- ::sw::tExternalDataPointer pPayload) SAL_OVERRIDE;
- virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType) SAL_OVERRIDE;
+ //IDocumentExternalData
+ IDocumentExternalData const & getIDocumentExternalData() const;
+ IDocumentExternalData & getIDocumentExternalData();
+
+ //End of Interfaces
virtual void setDocReadOnly( bool b) { mbReadOnly = b; }
virtual bool getDocReadOnly() const { return mbReadOnly; }
diff --git a/sw/source/core/doc/DocumentExternalDataManager.cxx b/sw/source/core/doc/DocumentExternalDataManager.cxx
new file mode 100644
index 000000000000..3e751a316812
--- /dev/null
+++ b/sw/source/core/doc/DocumentExternalDataManager.cxx
@@ -0,0 +1,34 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#include <DocumentExternalDataManager.hxx>
+
+namespace sw
+{
+
+void DocumentExternalDataManager::setExternalData(::sw::tExternalDataType eType, ::sw::tExternalDataPointer pPayload)
+{
+ m_externalData[eType] = pPayload;
+}
+
+::sw::tExternalDataPointer DocumentExternalDataManager::getExternalData(::sw::tExternalDataType eType)
+{
+ return m_externalData[eType];
+}
+
+}
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 1827f24177ec..fad297ac4f30 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -34,6 +34,7 @@
#include <DocumentStateManager.hxx>
#include <DocumentStylePoolManager.hxx>
#include <DocumentLayoutManager.hxx>
+#include <DocumentExternalDataManager.hxx>
#include <UndoManager.hxx>
#include <hintids.hxx>
#include <tools/shl.hxx>
@@ -484,6 +485,17 @@ IDocumentStylePoolAccess & SwDoc::getIDocumentStylePoolAccess()
return *m_pDocumentStylePoolManager;
}
+//IDocumentExternalData
+IDocumentExternalData const & SwDoc::getIDocumentExternalData() const
+{
+ return *m_pDocumentExternalDataManager;
+}
+
+IDocumentExternalData & SwDoc::getIDocumentExternalData()
+{
+ return *m_pDocumentExternalDataManager;
+}
+
/* Implementations the next Interface here */
/*
@@ -1700,17 +1712,6 @@ SwDoc::GetVbaEventProcessor()
return mxVbaEvents;
}
-void SwDoc::setExternalData(::sw::tExternalDataType eType,
- ::sw::tExternalDataPointer pPayload)
-{
- m_externalData[eType] = pPayload;
-}
-
-::sw::tExternalDataPointer SwDoc::getExternalData(::sw::tExternalDataType eType)
-{
- return m_externalData[eType];
-}
-
sal_uInt16 SwNumRuleTbl::GetPos(const SwNumRule* pRule) const
{
const_iterator it = std::find(begin(), end(), pRule);
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index f81b9f1c25ad..1e129bf01c15 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -103,6 +103,7 @@
#include <DocumentStateManager.hxx>
#include <DocumentLayoutManager.hxx>
#include <DocumentStylePoolManager.hxx>
+#include <DocumentExternalDataManager.hxx>
#include <unochart.hxx>
#include <fldbas.hxx>
@@ -221,6 +222,7 @@ SwDoc::SwDoc()
m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ),
m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ),
m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ),
+ m_pDocumentExternalDataManager( new ::sw::DocumentExternalDataManager() ),
mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ),
mpColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, mpDfltFrmFmt ) ),
diff --git a/sw/source/core/inc/DocumentExternalDataManager.hxx b/sw/source/core/inc/DocumentExternalDataManager.hxx
new file mode 100644
index 000000000000..0dc063c4e7ee
--- /dev/null
+++ b/sw/source/core/inc/DocumentExternalDataManager.hxx
@@ -0,0 +1,45 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTEXTERNALDATAMANAGER_HXX
+#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTEXTERNALDATAMANAGER_HXX
+
+#include <IDocumentExternalData.hxx>
+#include <boost/utility.hpp>
+#include <sal/types.h>
+
+namespace sw {
+
+class DocumentExternalDataManager : public IDocumentExternalData,
+ public ::boost::noncopyable
+{
+
+public:
+ void setExternalData( ::sw::tExternalDataType eType, ::sw::tExternalDataPointer pPayload) SAL_OVERRIDE;
+ ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType) SAL_OVERRIDE;
+
+ virtual ~DocumentExternalDataManager() {};
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 534610f8e516..69689ec4767b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -62,6 +62,7 @@
#include <IDocumentStatistics.hxx>
#include <IDocumentStylePoolAccess.hxx>
#include <IDocumentLayoutAccess.hxx>
+#include <IDocumentExternalData.hxx>
#include <viewopt.hxx>
#include <docary.hxx>
#include <pam.hxx>
@@ -2832,7 +2833,7 @@ void WW8Export::WriteFkpPlcUsw()
// Write SttbfAssoc
WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *>
- (pDoc->getExternalData(::sw::STTBF_ASSOC).get());
+ (pDoc->getIDocumentExternalData().getExternalData(::sw::STTBF_ASSOC).get());
if ( pSttbfAssoc ) // #i106057#
{
@@ -2854,7 +2855,7 @@ void WW8Export::WriteFkpPlcUsw()
// Reclaim stored FIB data from document.
::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *>
- (pDoc->getExternalData(::sw::FIB).get());
+ (pDoc->getIDocumentExternalData().getExternalData(::sw::FIB).get());
if ( pFibData )
{
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 742f7091af1a..447cf1dae39d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -76,6 +76,7 @@
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentLayoutAccess.hxx>
#include <IDocumentStylePoolAccess.hxx>
+#include <IDocumentExternalData.hxx>
#include <docufld.hxx>
#include <swfltopt.hxx>
#include <viewsh.hxx>
@@ -4898,12 +4899,12 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
::sw::tExternalDataPointer pExternalFibData(pFibData);
- rDoc.setExternalData(::sw::FIB, pExternalFibData);
+ rDoc.getIDocumentExternalData().setExternalData(::sw::FIB, pExternalFibData);
::sw::tExternalDataPointer pSttbfAsoc
(new ::ww8::WW8Sttb<ww8::WW8Struct>(*pTableStream, pWwFib->fcSttbfAssoc, pWwFib->lcbSttbfAssoc));
- rDoc.setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc);
+ rDoc.getIDocumentExternalData().setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc);
if (pWwFib->fWriteReservation || pWwFib->fReadOnlyRecommended)
{