Author: leiw
Date: Fri Mar 16 05:58:28 2012
New Revision: 1301345
URL: http://svn.apache.org/viewvc?rev=1301345&view=rev
Log:
#i118954# Chart data will lost after copy to different file
Modified:
incubator/ooo/trunk/main/sc/inc/charthelper.hxx
incubator/ooo/trunk/main/sc/source/core/data/documen9.cxx
incubator/ooo/trunk/main/sc/source/core/tool/charthelper.cxx
Modified: incubator/ooo/trunk/main/sc/inc/charthelper.hxx
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/inc/charthelper.hxx?rev=1301345&r1=1301344&r2=1301345&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/inc/charthelper.hxx (original)
+++ incubator/ooo/trunk/main/sc/inc/charthelper.hxx Fri Mar 16 05:58:28 2012
@@ -45,6 +45,7 @@ public:
static sal_uInt16 DoUpdateAllCharts( ScDocument* pDoc );
static sal_uInt16 DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc
); //use this to replace ScDBFunc::DoUpdateCharts in future
static void AdjustRangesOfChartsOnDestinationPage( ScDocument* pSrcDoc,
ScDocument* pDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab );
+ static void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument*
pDestDoc, const SCTAB nDestTab );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument > GetChartFromSdrObject( SdrObject*
pObject );
static void GetChartRanges( const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartDocument >& xChartDoc,
::com::sun::star::uno::Sequence< rtl::OUString >& rRanges );
Modified: incubator/ooo/trunk/main/sc/source/core/data/documen9.cxx
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/data/documen9.cxx?rev=1301345&r1=1301344&r2=1301345&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/data/documen9.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/data/documen9.cxx Fri Mar 16
05:58:28 2012
@@ -131,6 +131,7 @@ void ScDocument::TransferDrawPage(ScDocu
// #71726# make sure the data references of charts are adapted
// (this must be after InsertObject!)
ScChartHelper::AdjustRangesOfChartsOnDestinationPage( pSrcDoc, this,
nSrcPos, nDestPos );
+ ScChartHelper::UpdateChartsOnDestinationPage(this, nDestPos);
}
void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
Modified: incubator/ooo/trunk/main/sc/source/core/tool/charthelper.cxx
URL:
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/core/tool/charthelper.cxx?rev=1301345&r1=1301344&r2=1301345&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/core/tool/charthelper.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/core/tool/charthelper.cxx Fri Mar 16
05:58:28 2012
@@ -37,6 +37,7 @@
#include <svx/svdpage.hxx>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/util/XModifiable.hpp>
using namespace com::sun::star;
using ::com::sun::star::uno::Reference;
@@ -179,6 +180,34 @@ void ScChartHelper::AdjustRangesOfCharts
}
//static
+void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const
SCTAB nDestTab )
+{
+ if( !pDestDoc )
+ return;
+ ScDrawLayer* pDrawLayer = pDestDoc->GetDrawLayer();
+ if( !pDrawLayer )
+ return;
+
+ SdrPage* pDestPage =
pDrawLayer->GetPage(static_cast<sal_uInt16>(nDestTab));
+ if( pDestPage )
+ {
+ SdrObjListIter aIter( *pDestPage, IM_FLAT );
+ SdrObject* pObject = aIter.Next();
+ while( pObject )
+ {
+ if( pObject->GetObjIdentifier() == OBJ_OLE2 &&
((SdrOle2Obj*)pObject)->IsChart() )
+ {
+ String aChartName = ((SdrOle2Obj*)pObject)->GetPersistName();
+ Reference< chart2::XChartDocument > xChartDoc(
pDestDoc->GetChartByName( aChartName ) );
+ Reference< util::XModifiable >
xModif(xChartDoc, uno::UNO_QUERY_THROW);
+ xModif->setModified( sal_True);
+ }
+ pObject = aIter.Next();
+ }
+ }
+}
+
+//static
uno::Reference< chart2::XChartDocument > ScChartHelper::GetChartFromSdrObject(
SdrObject* pObject )
{
uno::Reference< chart2::XChartDocument > xReturn;