diff options
author | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-06-09 18:27:24 +0200 |
---|---|---|
committer | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-07-15 15:44:02 +0200 |
commit | c88a3d3e8c718bfc448b3030af388d1361efe015 (patch) | |
tree | 6807bd5cefcddcc9f890044bd876030520b47fcb | |
parent | a5d4e237049abec3b6c7d13f25d8bb0773d1df5a (diff) |
Refactored IDocumentChartDataProviderAccess in SwDoc.
Into the new class DocumentChartDataProviderManager.
Change-Id: I3be038ba276642546223c0c2fba3bea21980b33d
-rw-r--r-- | sw/Library_sw.mk | 1 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 15 | ||||
-rw-r--r-- | sw/source/core/attr/format.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentChartDataProviderManager.cxx | 107 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/doc/docchart.cxx | 66 | ||||
-rw-r--r-- | sw/source/core/doc/docnew.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/doc/tblrwcl.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/edit/edtab.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentChartDataProviderManager.hxx | 68 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/table/chartins.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 1 |
18 files changed, 228 insertions, 103 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index cef9a2c0f1e6..a12d5165a4b3 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -188,6 +188,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/docxforms \ sw/source/core/doc/DocumentSettingManager \ sw/source/core/doc/DocumentDrawModelManager \ + sw/source/core/doc/DocumentChartDataProviderManager \ 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 2f84c0d44bea..e26b810ad93a 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -32,7 +32,6 @@ #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentTimerAccess.hxx> -#include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentOutlineNodes.hxx> #include <IDocumentListItems.hxx> @@ -55,12 +54,9 @@ class SwList; #include <chcmprse.hxx> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> -#include <rtl/ref.hxx> -#include <svx/svdtypes.hxx> #include <sfx2/objsh.hxx> #include <svl/style.hxx> #include <editeng/numitem.hxx> -#include <com/sun/star/chart2/data/XDataProvider.hpp> #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> @@ -207,6 +203,7 @@ namespace sw { class DocumentSettingManager; class DocumentDeviceManager; class DocumentDrawModelManager; + class DocumentChartDataProviderManager; } namespace com { namespace sun { namespace star { @@ -254,7 +251,6 @@ class SW_DLLPUBLIC SwDoc : public IDocumentState, public IDocumentLayoutAccess, public IDocumentTimerAccess, - public IDocumentChartDataProviderAccess, public IDocumentListItems, public IDocumentOutlineNodes, public IDocumentListsAccess, @@ -288,6 +284,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager; const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager; const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager; + const ::boost::scoped_ptr< ::sw::DocumentChartDataProviderManager > m_pDocumentChartDataProviderManager; ::boost::scoped_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess; // Pointer @@ -364,9 +361,6 @@ class SW_DLLPUBLIC SwDoc : SwModify *mpUnoCallBack; IGrammarContact *mpGrammarContact; //< for grammar checking in paragraphs during editing - mutable rtl::Reference<SwChartDataProvider> maChartDataProviderImplRef; - SwChartLockController_Helper *mpChartControllerHelper; - // table of forbidden characters of this document rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable; com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > mxVbaEvents; @@ -789,9 +783,8 @@ public: virtual void StartBackgroundJobs() SAL_OVERRIDE; // IDocumentChartDataProviderAccess - virtual SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const SAL_OVERRIDE; - virtual void CreateChartInternalDataProviders( const SwTable *pTable ) SAL_OVERRIDE; - virtual SwChartLockController_Helper & GetChartControllerHelper() SAL_OVERRIDE; + IDocumentChartDataProviderAccess const & getIDocumentChartDataProviderAccess() const; + IDocumentChartDataProviderAccess & getIDocumentChartDataProviderAccess(); // IDocumentListItems virtual void addListItem( const SwNodeNum& rNodeNum ) SAL_OVERRIDE; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index e0be94b6e6ae..fba99b858304 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -765,7 +765,7 @@ const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return Ge IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); } IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); } IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); } -IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); } +IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return & GetDoc()->getIDocumentChartDataProviderAccess(); } void SwFmt::GetGrabBagItem(uno::Any& rVal) const { diff --git a/sw/source/core/doc/DocumentChartDataProviderManager.cxx b/sw/source/core/doc/DocumentChartDataProviderManager.cxx new file mode 100644 index 000000000000..7e8717e4d71a --- /dev/null +++ b/sw/source/core/doc/DocumentChartDataProviderManager.cxx @@ -0,0 +1,107 @@ +/* -*- 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 <DocumentChartDataProviderManager.hxx> + +#include <doc.hxx> +#include <vcl/svapp.hxx> +#include <swtable.hxx> +#include <unochart.hxx> +#include <frmfmt.hxx> +#include <ndole.hxx> +#include <com/sun/star/chart2/XChartDocument.hpp> + + +using namespace com::sun::star; +using namespace com::sun::star::uno; + +namespace sw { + +DocumentChartDataProviderManager::DocumentChartDataProviderManager( SwDoc& i_rSwdoc ) : m_rSwdoc( i_rSwdoc ), + maChartDataProviderImplRef(), + mpChartControllerHelper( 0 ) +{ + +} + +SwChartDataProvider * DocumentChartDataProviderManager::GetChartDataProvider( bool bCreate ) const +{ + // since there must be only one instance of this object per document + // we need a mutex here + SolarMutexGuard aGuard; + + if (bCreate && !maChartDataProviderImplRef.is()) + { + maChartDataProviderImplRef = new SwChartDataProvider( & m_rSwdoc ); + } + return maChartDataProviderImplRef.get(); +} +} + +void DocumentChartDataProviderManager::CreateChartInternalDataProviders( const SwTable *pTable ) +{ + if (pTable) + { + OUString aName( pTable->GetFrmFmt()->GetName() ); + SwOLENode *pONd; + SwStartNode *pStNd; + SwNodeIndex aIdx( *m_rSwdoc.GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 ); + while (0 != (pStNd = aIdx.GetNode().GetStartNode())) + { + ++aIdx; + if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) && + aName == pONd->GetChartTblName() /* OLE node is chart? */ && + 0 != (pONd->getLayoutFrm( m_rSwdoc.GetCurrentLayout() )) /* chart frame is not hidden */ ) + { + uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef(); + if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) ) + { + uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY ); + if (xChart.is()) + xChart->createInternalDataProvider( sal_True ); + + // there may be more than one chart for each table thus we need to continue the loop... + } + } + aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); + } + } +} + +SwChartLockController_Helper & DocumentChartDataProviderManager::GetChartControllerHelper() +{ + if (!mpChartControllerHelper) + { + mpChartControllerHelper = new SwChartLockController_Helper( & m_rSwdoc ); + } + return *mpChartControllerHelper; +} + +DocumentChartDataProviderManager::~DocumentChartDataProviderManager() +{ + // clean up chart related structures... + // Note: the chart data provider gets already disposed in ~SwDocShell + // since all UNO API related functionality requires an existing SwDocShell + // this assures that dipose gets called if there is need for it. + maChartDataProviderImplRef.clear(); + delete mpChartControllerHelper; +} + +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index cfe2ef95afd1..4d0766017b8f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -110,6 +110,7 @@ #include <view.hxx> #include <DocumentDeviceManager.hxx> #include <DocumentSettingManager.hxx> +#include <DocumentChartDataProviderManager.hxx> #include <wdocsh.hxx> #include <prtopt.hxx> @@ -215,6 +216,17 @@ IDocumentSettingAccess & SwDoc::getIDocumentSettingAccess() return *m_pDocumentSettingManager; } +/* IDocumentChartDataProviderAccess */ +IDocumentChartDataProviderAccess const & SwDoc::getIDocumentChartDataProviderAccess() const +{ + return *m_pDocumentChartDataProviderManager; +} + +IDocumentChartDataProviderAccess & SwDoc::getIDocumentChartDataProviderAccess() +{ + return *m_pDocumentChartDataProviderManager; +} + sal_uInt32 SwDoc::getRsid() const { return mnRsid; diff --git a/sw/source/core/doc/docchart.cxx b/sw/source/core/doc/docchart.cxx index 9902337ac2ec..4e294dede6f2 100644 --- a/sw/source/core/doc/docchart.cxx +++ b/sw/source/core/doc/docchart.cxx @@ -17,20 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <com/sun/star/frame/XModel.hpp> - -#include <com/sun/star/chart2/XChartDocument.hpp> - #include <float.h> #include <hintids.hxx> #include <vcl/window.hxx> #include <doc.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <docary.hxx> #include <ndindex.hxx> #include <swtable.hxx> #include <ndtxt.hxx> #include <calc.hxx> -#include <frmfmt.hxx> #include <cellfml.hxx> #include <viewsh.hxx> #include <ndole.hxx> @@ -40,13 +36,9 @@ #include <tblsel.hxx> #include <cellatr.hxx> #include <osl/mutex.hxx> -#include <vcl/svapp.hxx> #include <unochart.hxx> -using namespace com::sun::star; -using namespace com::sun::star::uno; - void SwTable::UpdateCharts() const { GetFrmFmt()->GetDoc()->UpdateCharts( GetFrmFmt()->GetName() ); @@ -127,7 +119,7 @@ void SwDoc::_UpdateCharts( const SwTable& rTbl, SwViewShell& rVSh ) const aName == pONd->GetChartTblName() && pONd->getLayoutFrm( rVSh.GetLayout() ) ) { - SwChartDataProvider *pPCD = GetChartDataProvider(); + SwChartDataProvider *pPCD = getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD) pPCD->InvalidateTable( &rTbl ); // following this the framework will now take care of repainting @@ -187,7 +179,7 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName ) GetEditShell( &pVSh ); SwTable* pTable = SwTable::FindTable( &rTblFmt ); - SwChartDataProvider *pPCD = GetChartDataProvider(); + SwChartDataProvider *pPCD = getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD) pPCD->InvalidateTable( pTable ); // following this the framework will now take care of repainting @@ -198,56 +190,4 @@ void SwDoc::SetTableName( SwFrmFmt& rTblFmt, const OUString &rNewName ) SetModified(); } -SwChartDataProvider * SwDoc::GetChartDataProvider( bool bCreate ) const -{ - // since there must be only one instance of this object per document - // we need a mutex here - SolarMutexGuard aGuard; - - if (bCreate && !maChartDataProviderImplRef.is()) - { - maChartDataProviderImplRef = new SwChartDataProvider( this ); - } - return maChartDataProviderImplRef.get(); -} - -void SwDoc::CreateChartInternalDataProviders( const SwTable *pTable ) -{ - if (pTable) - { - OUString aName( pTable->GetFrmFmt()->GetName() ); - SwOLENode *pONd; - SwStartNode *pStNd; - SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 ); - while (0 != (pStNd = aIdx.GetNode().GetStartNode())) - { - ++aIdx; - if( 0 != ( pONd = aIdx.GetNode().GetOLENode() ) && - aName == pONd->GetChartTblName() /* OLE node is chart? */ && - 0 != (pONd->getLayoutFrm( GetCurrentLayout() )) /* chart frame is not hidden */ ) - { - uno::Reference < embed::XEmbeddedObject > xIP = pONd->GetOLEObj().GetOleRef(); - if ( svt::EmbeddedObjectRef::TryRunningState( xIP ) ) - { - uno::Reference< chart2::XChartDocument > xChart( xIP->getComponent(), UNO_QUERY ); - if (xChart.is()) - xChart->createInternalDataProvider( sal_True ); - - // there may be more than one chart for each table thus we need to continue the loop... - } - } - aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); - } - } -} - -SwChartLockController_Helper & SwDoc::GetChartControllerHelper() -{ - if (!mpChartControllerHelper) - { - mpChartControllerHelper = new SwChartLockController_Helper( this ); - } - return *mpChartControllerHelper; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 60a4df370413..e39e41a432ea 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -90,6 +90,7 @@ #include <DocumentDeviceManager.hxx> #include <DocumentSettingManager.hxx> #include <DocumentDrawModelManager.hxx> +#include <DocumentChartDataProviderManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -195,6 +196,7 @@ SwDoc::SwDoc() m_pUndoManager(new ::sw::UndoManager( boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *this, *this)), m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)), + m_pDocumentChartDataProviderManager( new sw::DocumentChartDataProviderManager( *this ) ), m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ), mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ), @@ -240,8 +242,6 @@ SwDoc::SwDoc() mpLayoutCache( 0 ), mpUnoCallBack(new SwModify(0)), mpGrammarContact(createGrammarContact()), - maChartDataProviderImplRef(), - mpChartControllerHelper( 0 ), mpListItemsList( new tImplSortedNodeNumList() ), // #i83479# m_pXmlIdRegistry(), mnAutoFmtRedlnCommentNo( 0 ), @@ -445,13 +445,6 @@ SwDoc::~SwDoc() delete mpListItemsList; mpListItemsList = 0; - // clean up chart related structures... - // Note: the chart data provider gets already disposed in ~SwDocShell - // since all UNO API related functionality requires an existing SwDocShell - // this assures that dipose gets called if there is need for it. - maChartDataProviderImplRef.clear(); - delete mpChartControllerHelper; - delete mpGrammarContact; mpGrammarContact = 0; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index b5bad26e746a..951e6b110720 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -30,6 +30,7 @@ #include <fmtornt.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <cntfrm.hxx> #include <tabfrm.hxx> #include <frmtool.hxx> @@ -537,7 +538,7 @@ bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bRes = true; } - SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); + SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD && nCnt) pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); pDoc->UpdateCharts( GetFrmFmt()->GetName() ); @@ -637,7 +638,7 @@ bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, CHECKBOXWIDTH; CHECKTABLELAYOUT; - SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); + SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD && nCnt) pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind ); pDoc->UpdateCharts( GetFrmFmt()->GetName() ); @@ -1005,7 +1006,7 @@ bool SwTable::DeleteSel( PrepareDelBoxes( rBoxes ); - SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); + SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); // Delete boxes from last to first for (size_t n = 0; n < rBoxes.size(); ++n) { @@ -1047,7 +1048,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table too complex to be handled with chart. // Thus we tell the charts to use their own data provider and forget about this table - pDoc->CreateChartInternalDataProviders( this ); + pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this ); SetHTMLTableLayout( 0 ); // Delete HTML Layout @@ -1189,7 +1190,7 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ) // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table too complex to be handled with chart. // Thus we tell the charts to use their own data provider and forget about this table - pDoc->CreateChartInternalDataProviders( this ); + pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this ); SetHTMLTableLayout( 0 ); // Delete HTML Layout SwSelBoxes aSelBoxes(rBoxes); @@ -1641,7 +1642,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes, // TL_CHART2: splitting/merging of a number of cells or rows will usually make // the table too complex to be handled with chart. // Thus we tell the charts to use their own data provider and forget about this table - pDoc->CreateChartInternalDataProviders( this ); + pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this ); SetHTMLTableLayout( 0 ); // Delete HTML Layout diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 327e9fa42a2e..ce9cb39904ca 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -41,6 +41,7 @@ #include <IDocumentUndoRedo.hxx> #include <UndoManager.hxx> #include <DocumentSettingManager.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swcrsr.hxx> @@ -3520,7 +3521,7 @@ bool SwNodes::MergeTable( const SwNodeIndex& rPos, bool bWithPrev, // TL_CHART2: // tell the charts about the table to be deleted and have them use their own data - GetDoc()->CreateChartInternalDataProviders( &rDelTbl ); + GetDoc()->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( &rDelTbl ); // Sync the TableFormat's Width { diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 3efe0e9cd924..8d1d1231c6a0 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -31,6 +31,7 @@ #include <editsh.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -149,7 +150,7 @@ bool SwEditShell::TableToText( sal_Unicode cCh ) // TL_CHART2: // tell the charts about the table to be deleted and have them use their own data - GetDoc()->CreateChartInternalDataProviders( &pTblNd->GetTable() ); + GetDoc()->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( &pTblNd->GetTable() ); StartAllAction(); diff --git a/sw/source/core/inc/DocumentChartDataProviderManager.hxx b/sw/source/core/inc/DocumentChartDataProviderManager.hxx new file mode 100644 index 000000000000..e646adc704f8 --- /dev/null +++ b/sw/source/core/inc/DocumentChartDataProviderManager.hxx @@ -0,0 +1,68 @@ +/* -*- 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_DOCUMENTCHARTDATAPROVIDEMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTCHARTDATAPROVIDEMANAGER_HXX + +#include <IDocumentChartDataProviderAccess.hxx> +#include <boost/utility.hpp> + +#include <rtl/ref.hxx> + +namespace com { namespace sun { namespace star { namespace frame { + class XModel; +}}}} + +class SwTable; +class SwChartDataProvider; +class SwChartLockController_Helper; +class SwDoc; + + +namespace sw { + +class DocumentChartDataProviderManager : public IDocumentChartDataProviderAccess, + public ::boost::noncopyable +{ + +public: + + DocumentChartDataProviderManager( SwDoc& i_rSwdoc ); + + SwChartDataProvider * GetChartDataProvider( bool bCreate = false ) const SAL_OVERRIDE; + + void CreateChartInternalDataProviders( const SwTable *pTable ) SAL_OVERRIDE; + + SwChartLockController_Helper & GetChartControllerHelper() SAL_OVERRIDE; + + virtual ~DocumentChartDataProviderManager(); + +private: + + SwDoc& m_rSwdoc; + + mutable rtl::Reference<SwChartDataProvider> maChartDataProviderImplRef; + SwChartLockController_Helper *mpChartControllerHelper; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index bc717389af72..240ed4c0c80e 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -35,6 +35,7 @@ #include <doc.hxx> #include <docredln.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <editsh.hxx> #include <docary.hxx> #include <ndtxt.hxx> @@ -1008,7 +1009,8 @@ void _SaveTable::CreateNew( SwTable& rTbl, bool bCreateFrms, : nLineCount; SwDoc *pDoc = rTbl.GetFrmFmt()->GetDoc(); - SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); +<<<<<<< HEAD + SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); size_t n = 0; for( ; n < aParent.GetTabLines().size(); ++n ) { @@ -1691,7 +1693,7 @@ void SwUndoTblNdsChg::UndoImpl(::sw::UndoRedoContext & rContext) _FndBox aTmpBox( 0, 0 ); // ? TL_CHART2: notification or locking of controller required ? - SwChartDataProvider *pPCD = rDoc.GetChartDataProvider(); + SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider(); SwSelBoxes aDelBoxes; std::vector< std::pair<SwTableBox *, sal_uLong> > aDelNodes; if( IsDelBox() ) @@ -1984,7 +1986,7 @@ CHECKTABLE(pTblNd->GetTable()) CHECKTABLE(pTblNd->GetTable()) - SwChartDataProvider *pPCD = rDoc.GetChartDataProvider(); + SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider(); // 2. deleted the inserted boxes // delete nodes (from last to first) for( size_t n = aNewSttNds.size(); n; ) @@ -3065,7 +3067,7 @@ void SwUndoMergeTbl::UndoImpl(::sw::UndoRedoContext & rContext) ClearFEShellTabCols(); // TL_CHART2: need to inform chart of probably changed cell names - SwChartDataProvider *pPCD = pDoc->GetChartDataProvider(); + SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider(); if (pPCD) { pDoc->UpdateCharts( pTbl->GetFrmFmt()->GetName() ); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 4718c47df4f4..d4ab8778d3d3 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -37,6 +37,7 @@ #include <unocrsr.hxx> #include <unotbl.hxx> #include <doc.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <frmfmt.hxx> #include <docsh.hxx> #include <ndole.hxx> @@ -1523,7 +1524,7 @@ void SwChartDataProvider::InvalidateTable( const SwTable *pTable ) if (pTable) { if (!bDisposed) - pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking(); + pTable->GetFrmFmt()->GetDoc()->getIDocumentChartDataProviderAccess().GetChartControllerHelper().StartOrContinueLocking(); const Set_DataSequenceRef_t &rSet = aDataSequences[ pTable ]; Set_DataSequenceRef_t::const_iterator aIt( rSet.begin() ); @@ -1548,7 +1549,7 @@ bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox &rB if (pTable) { if (!bDisposed) - pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking(); + pTable->GetFrmFmt()->GetDoc()->getIDocumentChartDataProviderAccess().GetChartControllerHelper().StartOrContinueLocking(); Set_DataSequenceRef_t &rSet = aDataSequences[ pTable ]; @@ -1604,7 +1605,7 @@ void SwChartDataProvider::DisposeAllDataSequences( const SwTable *pTable ) if (pTable) { if (!bDisposed) - pTable->GetFrmFmt()->GetDoc()->GetChartControllerHelper().StartOrContinueLocking(); + pTable->GetFrmFmt()->GetDoc()->getIDocumentChartDataProviderAccess().GetChartControllerHelper().StartOrContinueLocking(); //! make a copy of the STL container! //! This is necessary since calling 'dispose' will implicitly remove an element diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 25fc8b19b199..4c2e4af66231 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -22,6 +22,7 @@ #include <hintids.hxx> #include <svx/svxids.hrc> #include <doc.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <docary.hxx> #include <fmtcol.hxx> #include <poolfmt.hxx> @@ -820,7 +821,7 @@ uno::Reference< uno::XInterface > SwXServiceProvider::MakeInstance(sal_uInt16 // charts using table data. OSL_ASSERT( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ); if( pDoc->GetDocShell()->GetCreateMode() != SFX_CREATE_MODE_EMBEDDED ) - xRet = (cppu::OWeakObject*) pDoc->GetChartDataProvider( true /* create - if not yet available */ ); + xRet = (cppu::OWeakObject*) pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ); break; case SW_SERVICE_TYPE_META: xRet = static_cast< ::cppu::OWeakObject* >( new SwXMeta(pDoc) ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 719282e6702e..20d8404c3d66 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -62,6 +62,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <docfac.hxx> #include <docstyle.hxx> #include <shellio.hxx> @@ -366,8 +367,8 @@ SwDocShell::~SwDocShell() // disable chart related objects now because in ~SwDoc it may be to late for this if( mpDoc ) { - mpDoc->GetChartControllerHelper().Disconnect(); - SwChartDataProvider *pPCD = mpDoc->GetChartDataProvider(); + mpDoc->getIDocumentChartDataProviderAccess().GetChartControllerHelper().Disconnect(); + SwChartDataProvider *pPCD = mpDoc->getIDocumentChartDataProvdiderAccess().GetChartDataProvider(); if (pPCD) pPCD->dispose(); } @@ -682,6 +683,6 @@ void SwDocShell::SubInitNew() */ IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return &mpDoc->getIDocumentDeviceAccess(); } const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return &mpDoc->getIDocumentSettingAccess(); } -IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return mpDoc; } +IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return &mpDoc->getIDocumentChartDataProviderAccess(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 190c81f23d82..4f27e883f077 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -69,6 +69,7 @@ #include <view.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <uitool.hxx> #include <cmdid.h> #include <globals.hrc> diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx index 9a59c52ad5d7..9750d2e178f7 100644 --- a/sw/source/uibase/table/chartins.cxx +++ b/sw/source/uibase/table/chartins.cxx @@ -22,6 +22,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/basedlgs.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <sfx2/app.hxx> #include <swtypes.hxx> diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 10f618579510..93c336fff758 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -97,6 +97,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentChartDataProviderAccess.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svl/zforlist.hxx> #include <drawdoc.hxx> |