Line- and Scatter subtypes added (symbols, curve type)

This commit is contained in:
Björn Milcke
2003-11-20 17:12:27 +00:00
parent 3c6abd007b
commit ca82e0625d
11 changed files with 501 additions and 59 deletions

View File

@ -2,9 +2,9 @@
*
* $RCSfile: dlg_ChartType.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:07:34 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -323,7 +323,7 @@ bool lcl_IsCombiChart( SvxChartStyle eStyle )
{
try
{
OSL_TRACE( U2C( aServiceNames[i] ));
// OSL_TRACE( U2C( aServiceNames[i] ));
uno::Reference< chart2::XChartTypeTemplate > xTempl(
xCTManager->createInstance( aServiceNames[ i ] ), uno::UNO_QUERY_THROW );
@ -1143,7 +1143,7 @@ IMPL_LINK( SchDiagramTypeDlg, DoubleClickHdl, void *, EMPTYARG )
|*
\************************************************************************/
sal_Int32 SchDiagramTypeDlg::GetDepth()
sal_Int32 SchDiagramTypeDlg::GetDepth() const
{
return aMtrFldDeep.GetValue();
}
@ -1208,7 +1208,7 @@ IMPL_LINK( SchDiagramTypeDlg, ClickHdl, void *, EMPTYARG )
|*
\************************************************************************/
sal_Int32 SchDiagramTypeDlg::GetGranularity()
sal_Int32 SchDiagramTypeDlg::GetGranularity() const
{
return aMtrFldGran.GetValue();
}
@ -1279,6 +1279,23 @@ uno::Reference< chart2::XChartTypeTemplate > SchDiagramTypeDlg::getTemplate() co
lcl_GetTemplateServiceNameForChartStyle( eStyle )),
uno::UNO_QUERY );
if( lcl_IsBSplineChart( eStyle ) ||
lcl_IsCubicSplineChart( eStyle ))
{
try
{
uno::Reference< beans::XPropertySet > xProp( xResult, uno::UNO_QUERY_THROW );
xProp->setPropertyValue( C2U( "CurveResolution" ), uno::makeAny( GetGranularity()));
if( lcl_IsBSplineChart( eStyle ))
xProp->setPropertyValue( C2U( "SplineOrder" ), uno::makeAny( GetDepth()));
}
catch( uno::Exception & ex )
{
ASSERT_EXCEPTION( ex );
}
}
if( lcl_IsCombiChart( eStyle ))
{
try

View File

@ -2,9 +2,9 @@
*
* $RCSfile: dlg_ChartType.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: bm $ $Date: 2003-11-04 13:28:38 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -202,10 +202,10 @@ public:
//BM void GetAttr(SfxItemSet& rOutAttrs);
sal_Int32 GetDepth();
sal_Int32 GetDepth() const;
void SetDepth( sal_Int32 nDeep );
sal_Int32 GetGranularity();
sal_Int32 GetGranularity() const;
void SetGranularity( sal_Int32 nGranularity );
/** The value set here determines the maximum number of lines in a line/bar

View File

@ -2,9 +2,9 @@
*
* $RCSfile: ChartTypeTemplate.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:07:36 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -199,16 +199,26 @@ sal_Bool SAL_CALL ChartTypeTemplate::matchesTemplate(
if( aChartTypes[0]->getChartType()->getChartType().equals(
getDefaultChartType()->getChartType()))
{
uno::Reference< beans::XPropertySet > xProp( aChartTypes[0], uno::UNO_QUERY );
sal_Int32 nDim;
if( xProp.is() &&
(xProp->getPropertyValue( C2U( "Dimension" )) >>= nDim ))
try
{
bResult = (nDim == getDimension());
uno::Reference< beans::XPropertySet > xProp( aChartTypes[0]->getChartType(),
uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySetInfo > xInfo( xProp->getPropertySetInfo() );
sal_Int32 nDim;
if( xInfo.is() &&
xInfo->hasPropertyByName( C2U( "Dimension" )) &&
(xProp->getPropertyValue( C2U( "Dimension" )) >>= nDim ))
{
bResult = (nDim == getDimension());
}
else
// correct chart type, but without Dimension property
bResult = sal_True;
}
catch( uno::Exception & ex )
{
ASSERT_EXCEPTION( ex );
}
else
// correct chart type, but without Dimension property
bResult = sal_True;
if( bResult )
bResult = ( helper::DataSeriesTreeHelper::getStackMode( xParent ) ==

View File

@ -2,9 +2,9 @@
*
* $RCSfile: LineChartType.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: bm $ $Date: 2003-11-19 17:27:01 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -178,12 +178,20 @@ namespace chart
LineChartType::LineChartType(
sal_Int32 nDim /* = 2 */,
chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */ ) :
chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */,
sal_Int32 nResolution /* = 20 */,
sal_Int32 nOrder /* = 3 */ ) :
ChartType( nDim )
{
if( eCurveStyle != chart2::CurveStyle_LINES )
setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_CURVE_STYLE,
uno::makeAny( eCurveStyle ));
if( nResolution != 20 )
setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_CURVE_RESOLUTION,
uno::makeAny( nResolution ));
if( nOrder != 3 )
setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_SPLINE_ORDER,
uno::makeAny( nOrder ));
}
LineChartType::~LineChartType()

View File

@ -2,9 +2,9 @@
*
* $RCSfile: LineChartType.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: bm $ $Date: 2003-11-19 16:50:13 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -74,8 +74,10 @@ class LineChartType : public ChartType
{
public:
LineChartType( sal_Int32 nDim = 2,
::drafts::com::sun::star::chart2::CurveStyle eCurveStyle =
::drafts::com::sun::star::chart2::CurveStyle_LINES );
::drafts::com::sun::star::chart2::CurveStyle eCurveStyle =
::drafts::com::sun::star::chart2::CurveStyle_LINES,
sal_Int32 nResolution = 20,
sal_Int32 nOrder = 3 );
virtual ~LineChartType();
protected:

View File

@ -2,9 +2,9 @@
*
* $RCSfile: LineChartTypeTemplate.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:07:38 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -61,6 +61,7 @@
#include "LineChartTypeTemplate.hxx"
#include "LineChartType.hxx"
#include "macros.hxx"
#include "algohelper.hxx"
#include "DataSeriesTreeHelper.hxx"
#ifndef _DRAFTS_COM_SUN_STAR_CHART2_SYMBOLSTYLE_HPP_
@ -70,9 +71,104 @@
#include <drafts/com/sun/star/chart2/SymbolProperties.hpp>
#endif
#ifndef CHART_PROPERTYHELPER_HXX
#include "PropertyHelper.hxx"
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::rtl::OUString;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::osl::MutexGuard;
namespace
{
static const OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.LineChartTypeTemplate" ));
enum
{
PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER
};
void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
Property( C2U( "CurveResolution" ),
PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
Property( C2U( "SplineOrder" ),
PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
void lcl_AddDefaultsToMap(
::chart::helper::tPropertyValueMap & rOutMap )
{
OSL_ASSERT( rOutMap.end() == rOutMap.find( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
rOutMap[ PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ] =
uno::makeAny( sal_Int32( 20 ) );
// todo: check whether order 3 means polygons of order 3 or 2. (see
// http://www.people.nnov.ru/fractal/Splines/Basis.htm )
OSL_ASSERT( rOutMap.end() == rOutMap.find( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
rOutMap[ PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ] =
uno::makeAny( sal_Int32( 3 ) );
}
const Sequence< Property > & lcl_GetPropertySequence()
{
static Sequence< Property > aPropSeq;
// /--
MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( 0 == aPropSeq.getLength() )
{
// get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
// and sort them for access via bsearch
::std::sort( aProperties.begin(), aProperties.end(),
::chart::helper::PropertyNameLess() );
// transfer result to static Sequence
aPropSeq = ::chart::helper::VectorToSequence( aProperties );
}
return aPropSeq;
}
::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
{
static ::cppu::OPropertyArrayHelper aArrayHelper(
lcl_GetPropertySequence(),
/* bSorted = */ sal_True );
return aArrayHelper;
}
} // anonymous namespace
namespace chart
{
@ -85,14 +181,63 @@ LineChartTypeTemplate::LineChartTypeTemplate(
bool bSymbols,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
m_eStackMode( eStackMode ),
m_eCurveStyle( eCurveStyle ),
m_bHasSymbols( bSymbols ),
m_nDim( nDim )
::property::OPropertySet( m_aMutex ),
m_eStackMode( eStackMode ),
m_eCurveStyle( eCurveStyle ),
m_bHasSymbols( bSymbols ),
m_nDim( nDim )
{}
LineChartTypeTemplate::~LineChartTypeTemplate()
{}
// ____ OPropertySet ____
uno::Any LineChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
static helper::tPropertyValueMap aStaticDefaults;
// /--
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( 0 == aStaticDefaults.size() )
{
// initialize defaults
lcl_AddDefaultsToMap( aStaticDefaults );
}
helper::tPropertyValueMap::const_iterator aFound(
aStaticDefaults.find( nHandle ));
if( aFound == aStaticDefaults.end())
return uno::Any();
return (*aFound).second;
// \--
}
::cppu::IPropertyArrayHelper & SAL_CALL LineChartTypeTemplate::getInfoHelper()
{
return lcl_getInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL
LineChartTypeTemplate::getPropertySetInfo()
throw (uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo;
// /--
MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( !xInfo.is())
{
xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
getInfoHelper());
}
return xInfo;
// \--
}
sal_Int32 LineChartTypeTemplate::getDimension() const
{
@ -107,6 +252,15 @@ chart2::StackMode LineChartTypeTemplate::getStackMode() const
uno::Reference< chart2::XChartType > LineChartTypeTemplate::getDefaultChartType()
throw (uno::RuntimeException)
{
sal_Int32 nRes;
sal_Int32 nOrder;
if( ( getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ) >>= nRes ) &&
( getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ) >>= nOrder ) )
{
return new LineChartType( m_nDim, m_eCurveStyle, nRes, nOrder );
}
return new LineChartType( m_nDim, m_eCurveStyle );
}
@ -206,4 +360,20 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
return bResult;
}
// ----------------------------------------
Sequence< OUString > LineChartTypeTemplate::getSupportedServiceNames_Static()
{
Sequence< OUString > aServices( 2 );
aServices[ 0 ] = lcl_aServiceName;
aServices[ 1 ] = C2U( "drafts.com.sun.star.chart2.ChartTypeTemplate" );
return aServices;
}
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
APPHELPER_XSERVICEINFO_IMPL( LineChartTypeTemplate, lcl_aServiceName );
IMPLEMENT_FORWARD_XINTERFACE2( LineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
IMPLEMENT_FORWARD_XTYPEPROVIDER2( LineChartTypeTemplate, ChartTypeTemplate, OPropertySet )
} // namespace chart

View File

@ -2,9 +2,9 @@
*
* $RCSfile: LineChartTypeTemplate.hxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:07:38 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -62,6 +62,12 @@
#define CHART_LINECHARTTYPETEMPLATE_HXX
#include "ChartTypeTemplate.hxx"
#include "OPropertySet.hxx"
#include "MutexContainer.hxx"
#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_CHART2_STACKMODE_HPP_
#include <drafts/com/sun/star/chart2/StackMode.hpp>
@ -73,7 +79,10 @@
namespace chart
{
class LineChartTypeTemplate : public ChartTypeTemplate
class LineChartTypeTemplate :
public helper::MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
public:
explicit LineChartTypeTemplate(
@ -85,7 +94,25 @@ public:
bool bSymbols, sal_Int32 nDim = 2 );
virtual ~LineChartTypeTemplate();
/// XServiceInfo declarations
APPHELPER_XSERVICEINFO_DECL()
/// merge XInterface implementations
DECLARE_XINTERFACE()
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
protected:
// ____ OPropertySet ____
virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
throw(::com::sun::star::beans::UnknownPropertyException);
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
// ____ XPropertySet ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()
throw (::com::sun::star::uno::RuntimeException);
// ____ XChartTypeTemplate ____
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::chart2::XDiagram > SAL_CALL
createDiagram( const ::com::sun::star::uno::Sequence<

View File

@ -2,9 +2,9 @@
*
* $RCSfile: ScatterChartType.cxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:02:23 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -178,12 +178,20 @@ namespace chart
ScatterChartType::ScatterChartType(
sal_Int32 nDim /* = 2 */,
chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */ ) :
chart2::CurveStyle eCurveStyle /* chart2::CurveStyle_LINES */ ,
sal_Int32 nResolution /* = 20 */,
sal_Int32 nOrder /* = 3 */ ) :
ChartType( nDim )
{
if( eCurveStyle != chart2::CurveStyle_LINES )
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_STYLE,
uno::makeAny( eCurveStyle ));
if( nResolution != 20 )
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
uno::makeAny( nResolution ));
if( nOrder != 3 )
setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
uno::makeAny( nOrder ));
}
ScatterChartType::~ScatterChartType()

View File

@ -2,9 +2,9 @@
*
* $RCSfile: ScatterChartType.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:02:33 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -75,7 +75,9 @@ class ScatterChartType : public ChartType
public:
ScatterChartType( sal_Int32 nDim = 2,
::drafts::com::sun::star::chart2::CurveStyle eCurveStyle =
::drafts::com::sun::star::chart2::CurveStyle_LINES );
::drafts::com::sun::star::chart2::CurveStyle_LINES,
sal_Int32 nResolution = 20,
sal_Int32 nOrder = 3 );
virtual ~ScatterChartType();
protected:

View File

@ -2,9 +2,9 @@
*
* $RCSfile: ScatterChartTypeTemplate.cxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:02:46 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -61,6 +61,7 @@
#include "ScatterChartTypeTemplate.hxx"
#include "ScatterChartType.hxx"
#include "macros.hxx"
#include "algohelper.hxx"
#include "DataSeriesTreeHelper.hxx"
#ifndef _DRAFTS_COM_SUN_STAR_CHART2_SYMBOLSTYLE_HPP_
@ -70,43 +71,197 @@
#include <drafts/com/sun/star/chart2/SymbolProperties.hpp>
#endif
#ifndef CHART_PROPERTYHELPER_HXX
#include "PropertyHelper.hxx"
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::drafts::com::sun::star;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::rtl::OUString;
using ::com::sun::star::beans::Property;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Any;
using ::osl::MutexGuard;
namespace
{
static const OUString lcl_aServiceName(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ScatterChartTypeTemplate" ));
enum
{
PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER
};
void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
Property( C2U( "CurveResolution" ),
PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
Property( C2U( "SplineOrder" ),
PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
}
void lcl_AddDefaultsToMap(
::chart::helper::tPropertyValueMap & rOutMap )
{
OSL_ASSERT( rOutMap.end() == rOutMap.find( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
rOutMap[ PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ] =
uno::makeAny( sal_Int32( 20 ) );
// todo: check whether order 3 means polygons of order 3 or 2. (see
// http://www.people.nnov.ru/fractal/Splines/Basis.htm )
OSL_ASSERT( rOutMap.end() == rOutMap.find( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
rOutMap[ PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ] =
uno::makeAny( sal_Int32( 3 ) );
}
const Sequence< Property > & lcl_GetPropertySequence()
{
static Sequence< Property > aPropSeq;
// /--
MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( 0 == aPropSeq.getLength() )
{
// get properties
::std::vector< ::com::sun::star::beans::Property > aProperties;
lcl_AddPropertiesToVector( aProperties );
// and sort them for access via bsearch
::std::sort( aProperties.begin(), aProperties.end(),
::chart::helper::PropertyNameLess() );
// transfer result to static Sequence
aPropSeq = ::chart::helper::VectorToSequence( aProperties );
}
return aPropSeq;
}
::cppu::IPropertyArrayHelper & lcl_getInfoHelper()
{
static ::cppu::OPropertyArrayHelper aArrayHelper(
lcl_GetPropertySequence(),
/* bSorted = */ sal_True );
return aArrayHelper;
}
} // anonymous namespace
namespace chart
{
ScatterChartTypeTemplate::ScatterChartTypeTemplate(
uno::Reference<
Reference<
uno::XComponentContext > const & xContext,
const ::rtl::OUString & rServiceName,
const OUString & rServiceName,
chart2::CurveStyle eCurveStyle,
bool bSymbols,
sal_Int32 nDim /* = 2 */ ) :
ChartTypeTemplate( xContext, rServiceName ),
m_eCurveStyle( eCurveStyle ),
m_bHasSymbols( bSymbols ),
m_nDim( nDim )
::property::OPropertySet( m_aMutex ),
m_eCurveStyle( eCurveStyle ),
m_bHasSymbols( bSymbols ),
m_nDim( nDim )
{}
ScatterChartTypeTemplate::~ScatterChartTypeTemplate()
{}
// ____ OPropertySet ____
uno::Any ScatterChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
throw(beans::UnknownPropertyException)
{
static helper::tPropertyValueMap aStaticDefaults;
// /--
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( 0 == aStaticDefaults.size() )
{
// initialize defaults
lcl_AddDefaultsToMap( aStaticDefaults );
}
helper::tPropertyValueMap::const_iterator aFound(
aStaticDefaults.find( nHandle ));
if( aFound == aStaticDefaults.end())
return uno::Any();
return (*aFound).second;
// \--
}
::cppu::IPropertyArrayHelper & SAL_CALL ScatterChartTypeTemplate::getInfoHelper()
{
return lcl_getInfoHelper();
}
// ____ XPropertySet ____
uno::Reference< beans::XPropertySetInfo > SAL_CALL
ScatterChartTypeTemplate::getPropertySetInfo()
throw (uno::RuntimeException)
{
static uno::Reference< beans::XPropertySetInfo > xInfo;
// /--
MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if( !xInfo.is())
{
xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
getInfoHelper());
}
return xInfo;
// \--
}
sal_Int32 ScatterChartTypeTemplate::getDimension() const
{
return m_nDim;
}
uno::Reference< chart2::XChartType > ScatterChartTypeTemplate::getDefaultChartType()
Reference< chart2::XChartType > ScatterChartTypeTemplate::getDefaultChartType()
throw (uno::RuntimeException)
{
sal_Int32 nRes;
sal_Int32 nOrder;
if( ( getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ) >>= nRes ) &&
( getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ) >>= nOrder ) )
{
return new ScatterChartType( m_nDim, m_eCurveStyle, nRes, nOrder );
}
return new ScatterChartType( m_nDim, m_eCurveStyle );
}
// ____ XChartTypeTemplate ____
uno::Reference< chart2::XDiagram > SAL_CALL
Reference< chart2::XDiagram > SAL_CALL
ScatterChartTypeTemplate::createDiagram(
const uno::Sequence< uno::Reference< chart2::XDataSeries > >& aSeriesSeq )
const Sequence< Reference< chart2::XDataSeries > >& aSeriesSeq )
throw (uno::RuntimeException)
{
// set symbol type at data series
@ -119,7 +274,7 @@ uno::Reference< chart2::XDiagram > SAL_CALL
try
{
chart2::SymbolProperties aSymbProp;
uno::Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW );
Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW );
if( (xProp->getPropertyValue( C2U( "SymbolProperties" )) >>= aSymbProp ) )
{
aSymbProp.aStyle = eStyle;
@ -140,7 +295,7 @@ uno::Reference< chart2::XDiagram > SAL_CALL
}
sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
const uno::Reference< chart2::XDiagram >& xDiagram )
const Reference< chart2::XDiagram >& xDiagram )
throw (uno::RuntimeException)
{
sal_Bool bResult = ChartTypeTemplate::matchesTemplate( xDiagram );
@ -150,7 +305,7 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
{
try
{
uno::Reference< beans::XPropertySet > xCTProp(
Reference< beans::XPropertySet > xCTProp(
helper::DataSeriesTreeHelper::getChartTypeByIndex( xDiagram->getTree(), 0 ),
uno::UNO_QUERY_THROW );
chart2::CurveStyle eCurveStyle;
@ -168,7 +323,7 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
// check symbol-style
if( bResult )
{
uno::Sequence< uno::Reference< chart2::XDataSeries > > aSeriesSeq(
Sequence< Reference< chart2::XDataSeries > > aSeriesSeq(
helper::DataSeriesTreeHelper::getDataSeriesFromDiagram( xDiagram ));
chart2::SymbolStyle eStyle = m_bHasSymbols
? chart2::SymbolStyle_STANDARD
@ -179,7 +334,7 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
try
{
chart2::SymbolProperties aSymbProp;
uno::Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW );
Reference< beans::XPropertySet > xProp( aSeriesSeq[i], uno::UNO_QUERY_THROW );
if( (xProp->getPropertyValue( C2U( "SymbolProperties" )) >>= aSymbProp ) )
{
if( aSymbProp.aStyle != eStyle )
@ -199,4 +354,20 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
return bResult;
}
// ----------------------------------------
Sequence< OUString > ScatterChartTypeTemplate::getSupportedServiceNames_Static()
{
Sequence< OUString > aServices( 2 );
aServices[ 0 ] = lcl_aServiceName;
aServices[ 1 ] = C2U( "drafts.com.sun.star.chart2.ChartTypeTemplate" );
return aServices;
}
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
APPHELPER_XSERVICEINFO_IMPL( ScatterChartTypeTemplate, lcl_aServiceName );
IMPLEMENT_FORWARD_XINTERFACE2( ScatterChartTypeTemplate, ChartTypeTemplate, OPropertySet )
IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScatterChartTypeTemplate, ChartTypeTemplate, OPropertySet )
} // namespace chart

View File

@ -2,9 +2,9 @@
*
* $RCSfile: ScatterChartTypeTemplate.hxx,v $
*
* $Revision: 1.1 $
* $Revision: 1.2 $
*
* last change: $Author: bm $ $Date: 2003-11-20 17:02:55 $
* last change: $Author: bm $ $Date: 2003-11-20 18:12:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -62,6 +62,12 @@
#define CHART_SCATTERCHARTTYPETEMPLATE_HXX
#include "ChartTypeTemplate.hxx"
#include "OPropertySet.hxx"
#include "MutexContainer.hxx"
#ifndef _COMPHELPER_UNO3_HXX_
#include <comphelper/uno3.hxx>
#endif
#ifndef _DRAFTS_COM_SUN_STAR_CHART2_STACKMODE_HPP_
#include <drafts/com/sun/star/chart2/StackMode.hpp>
@ -73,7 +79,10 @@
namespace chart
{
class ScatterChartTypeTemplate : public ChartTypeTemplate
class ScatterChartTypeTemplate :
public helper::MutexContainer,
public ChartTypeTemplate,
public ::property::OPropertySet
{
public:
explicit ScatterChartTypeTemplate(
@ -84,7 +93,25 @@ public:
bool bSymbols, sal_Int32 nDim = 2 );
virtual ~ScatterChartTypeTemplate();
/// XServiceInfo declarations
APPHELPER_XSERVICEINFO_DECL()
/// merge XInterface implementations
DECLARE_XINTERFACE()
/// merge XTypeProvider implementations
DECLARE_XTYPEPROVIDER()
protected:
// ____ OPropertySet ____
virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
throw(::com::sun::star::beans::UnknownPropertyException);
virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
// ____ XPropertySet ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
getPropertySetInfo()
throw (::com::sun::star::uno::RuntimeException);
// ____ XChartTypeTemplate ____
virtual ::com::sun::star::uno::Reference< ::drafts::com::sun::star::chart2::XDiagram > SAL_CALL
createDiagram( const ::com::sun::star::uno::Sequence<