summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/main/ChartController.cxx
diff options
context:
space:
mode:
authorBjörn Milcke <bm@openoffice.org>2003-11-04 11:37:45 +0000
committerBjörn Milcke <bm@openoffice.org>2003-11-04 11:37:45 +0000
commit759b3eb17c50b66794547ed560358678123bddf7 (patch)
treee7ea3c7c200523c737f18fd44310932771f17fcc /chart2/source/controller/main/ChartController.cxx
parentadded ==operator for Position3D (diff)
downloadcore-759b3eb17c50b66794547ed560358678123bddf7.tar.gz
core-759b3eb17c50b66794547ed560358678123bddf7.zip
ChartType concept: the template creates the diagram. To determine with which
template an existing Diagram was probably created, the data series tree is searched and according to the result the template is guessed. OldApi chart type support SubGrid added
Diffstat (limited to 'chart2/source/controller/main/ChartController.cxx')
-rw-r--r--chart2/source/controller/main/ChartController.cxx69
1 files changed, 38 insertions, 31 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index c21b4983e565..2fc602a1fa87 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ChartController.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: iha $ $Date: 2003-10-30 12:15:45 $
+ * last change: $Author: bm $ $Date: 2003-11-04 12:37:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,7 @@
#include "ChartWindow.hxx"
#include "DrawModelWrapper.hxx"
#include "DrawViewWrapper.hxx"
+#include "DataSeriesTreeHelper.hxx"
#include "macros.hxx"
@@ -90,6 +91,9 @@
#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XSTACKABLESCALEGROUP_HPP_
#include <drafts/com/sun/star/chart2/XStackableScaleGroup.hpp>
#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XCHARTTYPETEMPLATE_HPP_
+#include <drafts/com/sun/star/chart2/XChartTypeTemplate.hpp>
+#endif
//-------
// header for define RET_OK
@@ -1077,52 +1081,55 @@ void SAL_CALL ChartController::executeDispatch_ChartType()
//-------------------------------------------------------------
//convert properties to ItemSet
- uno::Reference< beans::XPropertySet > xProp;
- uno::Reference< XChartDocument > xChartDoc( m_aModel->getModel(), uno::UNO_QUERY );
- if( xChartDoc.is())
- xProp.set( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
- DBG_ASSERT( xProp.is(), "Invalid ChartTypeManager" );
+ uno::Reference< XChartDocument > xChartDoc( m_aModel->getModel(), uno::UNO_QUERY );
+ DBG_ASSERT( xChartDoc.is(), "Invalid XChartDocument" );
+ if( !xChartDoc.is())
+ return;
+ uno::Reference< XDiagram > xDia( xChartDoc->getDiagram() );
+ DBG_ASSERT( xDia.is(), "No Diagram set!" );
+ uno::Reference< XChartTypeTemplate > xTemplate;
+ if( xChartDoc.is())
{
- wrapper::ChartTypeItemConverter aItemConverter( xProp, m_pDrawModelWrapper->GetItemPool() );
- SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();//creates only an empty itemset
- aItemConverter.FillItemSet( aItemSet );
+ uno::Reference< lang::XMultiServiceFactory > xCTManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+// wrapper::ChartTypeItemConverter aItemConverter( xCTManager, xProp, m_pDrawModelWrapper->GetItemPool() );
+// SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet();//creates only an empty itemset
+// aItemConverter.FillItemSet( aItemSet );
//-------------------------------------------------------------
//prepare and open dialog
Window* pParent( NULL );
- SchDiagramTypeDlg aDlg( pParent, aItemSet );
+ SchDiagramTypeDlg aDlg( pParent, xDia, xCTManager );
if( aDlg.Execute() == RET_OK )
{
- SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
- aDlg.GetAttr( aOutItemSet );
+// SfxItemSet aOutItemSet = aItemConverter.CreateEmptyItemSet();
+// aDlg.GetAttr( aOutItemSet );
+
+// bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
- bChanged = aItemConverter.ApplyItemSet( aOutItemSet );//model should be changed now
+// // XPropertySet may have been changed
+// uno::Reference< beans::XPropertySet > xNewProp( aItemConverter.GetPropertySet());
+// bChanged = bChanged || (xProp != xNewProp);
+// xProp = xNewProp;
+ xTemplate.set( aDlg.getTemplate());
+ bChanged = true;
}
}
try
{
//make sure that all objects using m_pDrawModelWrapper or m_pChartView are already deleted
- if(bChanged &&
- xChartDoc.is())
+ if( bChanged &&
+ xTemplate.is() )
{
- uno::Reference< lang::XMultiServiceFactory > xFact( xProp, uno::UNO_QUERY );
- if( xFact.is() )
- {
- ::rtl::OUString aServiceName;
- if( xProp->getPropertyValue( C2U( "ChartStyleTemplateServiceName" )) >>= aServiceName )
- {
- uno::Reference< XChartTypeTemplate > xTemplate(
- xFact->createInstance( aServiceName ), uno::UNO_QUERY );
- xChartDoc->setChartTypeTemplate( xTemplate );
- if( xTemplate.is())
- xTemplate->changeDiagram( xChartDoc->getDiagram() );
- impl_rebuildView();
- }
- }
+ xChartDoc->setDiagram(
+ xTemplate->createDiagram(
+ helper::DataSeriesTreeHelper::getDataSeriesFromDiagram(
+ xChartDoc->getDiagram())));
+
+ impl_rebuildView();
}
}
- catch( uno::RuntimeException& e)
+ catch( uno::Exception& e)
{
ASSERT_EXCEPTION( e );
}