summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx19
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx4
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.cxx4
-rw-r--r--chart2/source/controller/dialogs/ChangingResource.hxx1
-rw-r--r--chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx1
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx8
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx33
-rw-r--r--chart2/source/inc/AxisHelper.hxx3
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx2
-rw-r--r--chart2/source/inc/DiagramHelper.hxx3
-rw-r--r--chart2/source/model/main/Axis.cxx2
-rw-r--r--[-rwxr-xr-x]chart2/source/model/main/ChartModel.cxx3
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--chart2/source/model/main/DataSeries.cxx2
-rw-r--r--chart2/source/model/main/Legend.cxx2
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx40
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx29
-rw-r--r--chart2/source/model/template/BubbleChartTypeTemplate.cxx1
-rw-r--r--chart2/source/model/template/ColumnLineChartTypeTemplate.cxx7
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx12
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx2
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx11
-rw-r--r--chart2/source/tools/AxisHelper.cxx20
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx7
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx41
-rw-r--r--chart2/source/tools/DataSeriesHelper.cxx2
-rw-r--r--chart2/source/tools/DiagramHelper.cxx8
-rw-r--r--chart2/source/tools/LineProperties.cxx2
-rw-r--r--chart2/source/tools/WrappedIgnoreProperty.cxx2
-rw-r--r--chart2/source/view/axes/VAxisProperties.cxx5
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx2
-rwxr-xr-x[-rw-r--r--]chart2/source/view/charttypes/BarChart.cxx22
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx8
-rw-r--r--chart2/source/view/diagram/VDiagram.cxx83
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx11
-rw-r--r--chart2/source/view/inc/Stripe.hxx14
-rw-r--r--chart2/source/view/inc/ViewDefines.hxx1
-rw-r--r--chart2/source/view/main/ChartView.cxx81
-rw-r--r--chart2/source/view/main/PropertyMapper.cxx2
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx425
-rw-r--r--chart2/source/view/main/Stripe.cxx161
-rw-r--r--chart2/source/view/main/VDataSeries.cxx4
-rw-r--r--chart2/source/view/main/VLegend.cxx108
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx14
-rw-r--r--chart2/source/view/main/VTitle.cxx15
45 files changed, 844 insertions, 385 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 67f537c49b98..14a20e133ff1 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -45,6 +45,8 @@
#include "DataSourceHelper.hxx"
#include "ChartModelHelper.hxx"
#include "ContainerHelper.hxx"
+#include "AxisHelper.hxx"
+#include "ThreeDHelper.hxx"
#include "TitleWrapper.hxx"
#include "ChartDataWrapper.hxx"
@@ -64,6 +66,8 @@
#include <svx/unoshcol.hxx>
// header for define DBG_ASSERT
#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
@@ -1308,8 +1312,19 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
if( xDia.is())
{
// /-- locked controllers
- ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
- xTemplate->changeDiagram( xDia );
+ Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY );
+ ControllerLockGuard aCtrlLockGuard( xModel );
+ Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
+ ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
+ Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateWithService(
+ DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
+ if( aTemplateWithService.first.is())
+ aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
+ xTemplate->changeDiagram( xDiagram );
+ if( Application::GetSettings().GetLayoutRTL() )
+ AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
+ ThreeDHelper::setScheme( xDiagram, e3DScheme );
// \-- locked controllers
}
else
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
index f099eaa8499a..d69212512ebe 100644
--- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -285,7 +285,7 @@ void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, cons
{
Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
if( xDiagram.is() )
- ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext );
+ ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext, false );
}
}
@@ -746,7 +746,7 @@ const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedPrope
aWrappedProperties.push_back( new WrappedProperty( C2U( "FillStyle" ), C2U( "FillStyle" ) ) );
aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparence" ), C2U( "Transparency" ) ) );
- aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_NONE ) ) );
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) );
aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparenceGradientName" ), C2U( "TransparencyGradientName" ) ) );
aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientName" ), C2U( "GradientName" ) ) );
aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientStepCount" ), C2U( "GradientStepCount" ) ) );
diff --git a/chart2/source/controller/dialogs/ChangingResource.cxx b/chart2/source/controller/dialogs/ChangingResource.cxx
index e7461325e3be..22886c9b6108 100644
--- a/chart2/source/controller/dialogs/ChangingResource.cxx
+++ b/chart2/source/controller/dialogs/ChangingResource.cxx
@@ -35,6 +35,10 @@ namespace chart
{
//.............................................................................
+ResourceChangeListener::~ResourceChangeListener()
+{
+}
+
ChangingResource::ChangingResource()
: m_pChangeListener(0)
{
diff --git a/chart2/source/controller/dialogs/ChangingResource.hxx b/chart2/source/controller/dialogs/ChangingResource.hxx
index df69358b00b7..ed6be33b912e 100644
--- a/chart2/source/controller/dialogs/ChangingResource.hxx
+++ b/chart2/source/controller/dialogs/ChangingResource.hxx
@@ -42,6 +42,7 @@ class ResourceChangeListener
{
public:
virtual void stateChanged( ChangingResource* pResource ) = 0;
+ virtual ~ResourceChangeListener();
};
class ChangingResource
diff --git a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
index 6462d4897945..b2790a1678bb 100644
--- a/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeTemplateProvider.hxx
@@ -44,6 +44,7 @@ class ChartTypeTemplateProvider
public:
virtual ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XChartTypeTemplate > getCurrentTemplate() const =0;
+ virtual ~ChartTypeTemplateProvider() {}
};
//.............................................................................
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index f4b314de8a40..244d23ed8eff 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -987,8 +987,8 @@ IMPL_LINK( ChartTypeTabPage, SelectMainTypeHdl, void *, EMPTYARG )
commitToModel( aParameter );
//detect the new ThreeDLookScheme
aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple;
+ if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
+ aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
this->fillAllControls( aParameter );
@@ -1109,8 +1109,8 @@ void ChartTypeTabPage::initializePage()
//set ThreeDLookScheme
aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Simple )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Simple;
+ if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
+ aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
aParameter.bSortByXValues = lcl_getSortByXValues( m_xChartModel );
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 352a7e1279cc..ff567636ba0e 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -49,6 +49,7 @@
#include "AxisHelper.hxx"
#include "RegressionCurveHelper.hxx"
#include "ShapeController.hxx"
+#include "DiagramHelper.hxx"
#include <com/sun/star/chart2/DataPointLabel.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
@@ -115,7 +116,14 @@ bool lcl_deleteDataSeries(
ActionDescriptionProvider::createDescription(
ActionDescriptionProvider::DELETE, ::rtl::OUString( String( ::chart::SchResId( STR_OBJECT_DATASERIES )))),
xUndoManager, xModel );
+
+ Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( xModel ) );
+ uno::Reference< chart2::XAxis > xAxis( ::chart::DiagramHelper::getAttachedAxis( xSeries, xDiagram ) );
+
::chart::DataSeriesHelper::deleteSeries( xSeries, xChartType );
+
+ ::chart::AxisHelper::hideAxisIfNoDataIsAttached( xAxis, xDiagram );
+
bResult = true;
aUndoGuard.commitAction();
}
@@ -575,8 +583,7 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection )
{
OUString aSelObjCID( aSelOID.getObjectCID() );
ObjectType aObjectType(ObjectIdentifier::getObjectType( aSelObjCID ));
- if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType)
- || (OBJECTTYPE_DATA_SERIES == aObjectType) )
+ if( (OBJECTTYPE_TITLE == aObjectType) || (OBJECTTYPE_LEGEND == aObjectType) )
return true;
if( (OBJECTTYPE_DATA_SERIES == aObjectType) || (OBJECTTYPE_LEGEND_ENTRY == aObjectType) )
return true;
@@ -585,6 +592,8 @@ bool ChartController::isObjectDeleteable( const uno::Any& rSelection )
return true;
if( (OBJECTTYPE_DATA_LABELS == aObjectType) || (OBJECTTYPE_DATA_LABEL == aObjectType) )
return true;
+ if( (OBJECTTYPE_AXIS == aObjectType) || (OBJECTTYPE_GRID == aObjectType) || (OBJECTTYPE_SUBGRID == aObjectType) )
+ return true;
}
else if ( aSelOID.isAdditionalShape() )
{
@@ -628,8 +637,6 @@ bool ChartController::executeDispatch_Delete()
return false;
//remove chart object
- impl_ClearSelection();
-
uno::Reference< chart2::XChartDocument > xChartDoc( m_aModel->getModel(), uno::UNO_QUERY );
if( !xChartDoc.is() )
return false;
@@ -786,6 +793,24 @@ bool ChartController::executeDispatch_Delete()
}
break;
}
+ case OBJECTTYPE_AXIS:
+ {
+ executeDispatch_DeleteAxis();
+ bReturn = true;
+ break;
+ }
+ case OBJECTTYPE_GRID:
+ {
+ executeDispatch_DeleteMajorGrid();
+ bReturn = true;
+ break;
+ }
+ case OBJECTTYPE_SUBGRID:
+ {
+ executeDispatch_DeleteMinorGrid();
+ bReturn = true;
+ break;
+ }
default:
{
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx
index be2a60bb63f7..75e69436a784 100644
--- a/chart2/source/inc/AxisHelper.hxx
+++ b/chart2/source/inc/AxisHelper.hxx
@@ -101,6 +101,9 @@ public:
static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
+ static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram);
+
SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties );
static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties );
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index 7cd205b83fb5..fb087abf15fd 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -89,6 +89,8 @@ public:
, const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDataSeries >& xGivenDataSeries );
+ static ::com::sun::star::awt::Size getDefaultPageSize();
+
static ::com::sun::star::awt::Size getPageSize(
const ::com::sun::star::uno::Reference<
::com::sun::star::frame::XModel >& xModel );
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index c685b99b974f..14113e7396ca 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -172,7 +172,8 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XDiagram >& xDiagram,
const ::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > & xContext );
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ bool bAdaptAxes=true );
static ::com::sun::star::uno::Reference<
::com::sun::star::chart2::XAxis > getAttachedAxis(
diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx
index 17d8fe9f3989..cab49e8d0149 100644
--- a/chart2/source/model/main/Axis.cxx
+++ b/chart2/source/model/main/Axis.cxx
@@ -207,7 +207,7 @@ void lcl_AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_STACKED, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_TEXT_ARRANGE_ORDER, ::com::sun::star::chart::ChartAxisArrangeOrderType_AUTO );
- float fDefaultCharHeight = 8.0;
+ float fDefaultCharHeight = 10.0;
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index 77533ec1306b..dc0931f41fc4 100755..100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -106,8 +106,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
, m_aControllers( m_aModelMutex )
, m_nControllerLockCount(0)
, m_xContext( xContext )
- // default visual area is 8 x 7 cm
- , m_aVisualAreaSize( 8000, 7000 )
+ , m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() )
, m_xDataProvider( 0 )
, m_xInternalDataProvider( 0 )
, m_xPageBackground( new PageBackground( m_xContext ) )
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index b7b8f380ceea..4f864ae0fd1c 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -464,7 +464,7 @@ void SAL_CALL ChartModel::initNew()
{
xDiagramProperties->setPropertyValue( C2U("RightAngledAxes"), uno::makeAny( sal_True ));
xDiagramProperties->setPropertyValue( C2U("D3DScenePerspective"), uno::makeAny( drawing::ProjectionMode_PARALLEL ));
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
}
//set some new 'defaults' for wall and floor
diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx
index 2ef6be657f8c..4faca33e936c 100644
--- a/chart2/source/model/main/DataSeries.cxx
+++ b/chart2/source/model/main/DataSeries.cxx
@@ -265,7 +265,7 @@ uno::Any DataSeries::GetDefaultValue( sal_Int32 nHandle ) const
DataSeriesProperties::AddDefaultsToMap( aStaticDefaults );
CharacterProperties::AddDefaultsToMap( aStaticDefaults );
- float fDefaultCharHeight = 6.0;
+ float fDefaultCharHeight = 10.0;
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( aStaticDefaults, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx
index e3d8a3107d4c..c1143ecdf77a 100644
--- a/chart2/source/model/main/Legend.cxx
+++ b/chart2/source/model/main/Legend.cxx
@@ -114,7 +114,7 @@ void lcl_AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_PREFERRED_EXPANSION, chart2::LegendExpansion_HIGH );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true );
- float fDefaultCharHeight = 8.0;
+ float fDefaultCharHeight = 10.0;
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_ASIAN_CHAR_HEIGHT, fDefaultCharHeight );
::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_COMPLEX_CHAR_HEIGHT, fDefaultCharHeight );
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 072b16a07d26..5fe21cfb25e0 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -31,6 +31,7 @@
#include "macros.hxx"
#include "servicenames_charttypes.hxx"
#include "DiagramHelper.hxx"
+#include "DataSeriesHelper.hxx"
#include "ContainerHelper.hxx"
#include "PropertyHelper.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -208,41 +209,26 @@ void SAL_CALL AreaChartTypeTemplate::applyStyle(
throw (uno::RuntimeException)
{
ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
- if( getDimension() == 3 )
- {
- try
- {
- uno::Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY_THROW );
- xProp->setPropertyValue( C2U("BorderStyle"),
- uno::makeAny( drawing::LineStyle_NONE ));
- }
- catch( uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- }
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
}
void SAL_CALL AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiagram >& xDiagram )
throw (uno::RuntimeException)
{
ChartTypeTemplate::resetStyles( xDiagram );
- if( getDimension() == 3 )
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
{
- ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
- for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xState.is() &&
+ xProp.is() &&
+ xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
{
- Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
- if( xState.is() &&
- xProp.is() &&
- xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
- {
- xState->setPropertyToDefault( C2U("BorderStyle"));
- }
+ xState->setPropertyToDefault( C2U("BorderStyle"));
}
}
}
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index 81f1337ccb29..01dc4c253d2b 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -279,6 +279,7 @@ void SAL_CALL BarChartTypeTemplate::applyStyle(
throw (uno::RuntimeException)
{
ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
if( getDimension() == 3 )
{
try
@@ -300,24 +301,22 @@ void SAL_CALL BarChartTypeTemplate::resetStyles(
throw (uno::RuntimeException)
{
ChartTypeTemplate::resetStyles( xDiagram );
- if( getDimension() == 3 )
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
+ for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
+ aIt != aSeriesVec.end(); ++aIt )
{
- ::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
- DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
- for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ if( xState.is())
{
- Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
- if( xState.is())
- {
+ if( getDimension() == 3 )
xState->setPropertyToDefault( C2U("Geometry3D"));
- Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
- if( xProp.is() &&
- xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
- {
- xState->setPropertyToDefault( C2U("BorderStyle"));
- }
+ Reference< beans::XPropertySet > xProp( xState, uno::UNO_QUERY );
+ if( xProp.is() &&
+ xProp->getPropertyValue( C2U("BorderStyle")) == aLineStyleAny )
+ {
+ xState->setPropertyToDefault( C2U("BorderStyle"));
}
}
}
diff --git a/chart2/source/model/template/BubbleChartTypeTemplate.cxx b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
index 3f297d1e2e27..59b552cc8995 100644
--- a/chart2/source/model/template/BubbleChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BubbleChartTypeTemplate.cxx
@@ -186,6 +186,7 @@ void SAL_CALL BubbleChartTypeTemplate::applyStyle(
throw (uno::RuntimeException)
{
ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
try
{
diff --git a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
index 70a0a633836a..663cad4c2fe4 100644
--- a/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
#include <algorithm>
@@ -270,7 +271,11 @@ void SAL_CALL ColumnLineChartTypeTemplate::applyStyle(
{
ChartTypeTemplate::applyStyle( xSeries, nChartTypeIndex, nSeriesIndex, nSeriesCount );
- if( nChartTypeIndex==1 ) // lines
+ if( nChartTypeIndex==0 ) // columns
+ {
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ else if( nChartTypeIndex==1 ) // lines
{
Reference< beans::XPropertySet > xProp( xSeries, uno::UNO_QUERY );
if( xProp.is() )
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index a8f2fc12720a..c16682846d53 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -554,12 +554,7 @@ void SAL_CALL PieChartTypeTemplate::applyStyle(
}
// line style
- drawing::LineStyle eStyle = (getDimension() == 2)
- ? drawing::LineStyle_SOLID
- : drawing::LineStyle_NONE;
-
- xProp->setPropertyValue( C2U("BorderStyle"),
- uno::makeAny( eStyle ));
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
// vary colors by point
xProp->setPropertyValue( C2U("VaryColorsByPoint"), uno::makeAny( true ));
@@ -616,10 +611,7 @@ void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagr
// line style
::std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- drawing::LineStyle eStyle = (getDimension() == 2)
- ? drawing::LineStyle_SOLID
- : drawing::LineStyle_NONE;
- uno::Any aLineStyleAny( uno::makeAny( eStyle ));
+ uno::Any aLineStyleAny( uno::makeAny( drawing::LineStyle_NONE ));
for( ::std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
aIt != aSeriesVec.end(); ++aIt )
{
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index f952abaa3611..a83d9a8a4ea3 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -235,6 +235,8 @@ void SAL_CALL ScatterChartTypeTemplate::applyStyle(
DataSeriesHelper::switchSymbolsOnOrOff( xProp, m_bHasSymbols, nSeriesIndex );
DataSeriesHelper::switchLinesOnOrOff( xProp, m_bHasLines );
DataSeriesHelper::makeLinesThickOrThin( xProp, m_nDim==2 );
+ if( m_nDim==3 )
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index 90a313b78c8a..00ace6c330ad 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -265,10 +265,14 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
if( xProp.is() )
xProp->setPropertyValue( C2U("AttachedAxisIndex"), uno::makeAny( nNewAxisIndex ) );
-
- //ensure that lines are on
- if( !bHasVolume || nChartTypeIndex==0 )
+ if( bHasVolume && nChartTypeIndex==0 )
{
+ //switch lines off for volume bars
+ DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, C2U( "BorderStyle" ), uno::makeAny( drawing::LineStyle_NONE ) );
+ }
+ else
+ {
+ //ensure that lines are on
if( xProp.is() )
{
drawing::LineStyle eStyle = drawing::LineStyle_NONE;
@@ -277,6 +281,7 @@ void SAL_CALL StockChartTypeTemplate::applyStyle(
xProp->setPropertyValue( C2U("LineStyle"), uno::makeAny( drawing::LineStyle_SOLID ));
}
}
+
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index b2f7fb24e6f2..8cdd24e4dc05 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -284,6 +284,26 @@ void AxisHelper::makeAxisInvisible( const Reference< XAxis >& xAxis )
}
}
+//static
+void AxisHelper::hideAxisIfNoDataIsAttached( const Reference< XAxis >& xAxis, const Reference< XDiagram >& xDiagram )
+{
+ //axis is hidden if no data is attached anymore but data is available
+ bool bOtherSeriesAttachedToThisAxis = false;
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt = aSeriesVector.begin();
+ for( ; aIt != aSeriesVector.end(); ++aIt)
+ {
+ uno::Reference< chart2::XAxis > xCurrentAxis( DiagramHelper::getAttachedAxis( *aIt, xDiagram ), uno::UNO_QUERY );
+ if( xCurrentAxis==xAxis )
+ {
+ bOtherSeriesAttachedToThisAxis = true;
+ break;
+ }
+ }
+ if(!bOtherSeriesAttachedToThisAxis && !aSeriesVector.empty() )
+ AxisHelper::makeAxisInvisible( xAxis );
+}
+
void AxisHelper::hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid
, const Reference< XDiagram >& xDiagram )
{
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index ed8c36e08c8d..a49b2abeac98 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -134,9 +134,14 @@ uno::Reference< XChartType > ChartModelHelper::getChartTypeOfSeries(
return DiagramHelper::getChartTypeOfSeries( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries );
}
+awt::Size ChartModelHelper::getDefaultPageSize()
+{
+ return awt::Size( 16000, 9000 );
+}
+
awt::Size ChartModelHelper::getPageSize( const uno::Reference< frame::XModel >& xModel )
{
- awt::Size aPageSize( 8000, 7000 );
+ awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() );
uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY);
DBG_ASSERT(xVisualObject.is(),"need xVisualObject for page size");
if( xVisualObject.is() )
diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx
index 9e0b22ba75ac..b851a3864b97 100644
--- a/chart2/source/tools/ChartTypeHelper.cxx
+++ b/chart2/source/tools/ChartTypeHelper.cxx
@@ -441,44 +441,45 @@ bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XC
//static
sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
{
- if( bSimple )
+ sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey
+ if( xChartType .is() )
{
- sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
- if( xChartType .is() )
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
{
- rtl::OUString aChartType = xChartType->getChartType();
- if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ if( bSimple )
nRet = static_cast< sal_Int32 >( 0x333333 ); // grey80
- else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
- || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
- nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
+ else
+ nRet = static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30
}
- return nRet;
+ else if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_LINE)
+ || aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
}
- return static_cast< sal_Int32 >( 0xb3b3b3 ); // grey30
+ return nRet;
}
//static
sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType )
{
- if( bSimple )
+ sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
+ if( xChartType .is() )
{
- sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40
- if( xChartType .is() )
+ rtl::OUString aChartType = xChartType->getChartType();
+ if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
{
- rtl::OUString aChartType = xChartType->getChartType();
- if( aChartType.equals(CHART2_SERVICE_NAME_CHARTTYPE_PIE) )
+ if( bSimple )
nRet = static_cast< sal_Int32 >( 0xcccccc ); // grey20
+ else
+ nRet = static_cast< sal_Int32 >( 0x666666 ); // grey60
}
- return nRet;
}
- return static_cast< sal_Int32 >( 0x666666 ); // grey60
+ return nRet;
}
drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
{
- //drawing::Direction3D aRet(0.0, 0.0, 1.0);
- drawing::Direction3D aRet(-0.2, 0.7, 0.6);
+ drawing::Direction3D aRet(0.0, 0.0, 1.0);
if( xChartType .is() )
{
rtl::OUString aChartType = xChartType->getChartType();
@@ -493,7 +494,7 @@ drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno:
drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference< chart2::XChartType >& xChartType )
{
- drawing::Direction3D aRet(-0.1, 0.6, 0.8);
+ drawing::Direction3D aRet(0.0, 0.0, 1.0);
if( xChartType .is() )
{
rtl::OUString aChartType = xChartType->getChartType();
diff --git a/chart2/source/tools/DataSeriesHelper.cxx b/chart2/source/tools/DataSeriesHelper.cxx
index 538f2966105f..acff332d4229 100644
--- a/chart2/source/tools/DataSeriesHelper.cxx
+++ b/chart2/source/tools/DataSeriesHelper.cxx
@@ -595,7 +595,7 @@ void makeLinesThickOrThin( const Reference< beans::XPropertySet > & xSeriesPrope
if( !xSeriesProperties.is() )
return;
- sal_Int32 nNewValue = bThick ? 88 : 0;
+ sal_Int32 nNewValue = bThick ? 80 : 0;
sal_Int32 nOldValue = 0;
if( (xSeriesProperties->getPropertyValue( C2U( "LineWidth" )) >>= nOldValue ) &&
nOldValue != nNewValue )
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index a8da65e5133d..b95e7522943e 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -599,7 +599,7 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis
, const uno::Reference< chart2::XDataSeries >& xDataSeries
, const uno::Reference< chart2::XDiagram >& xDiagram
, const uno::Reference< uno::XComponentContext > & xContext
- )
+ , bool bAdaptAxes )
{
bool bChanged = false;
@@ -610,6 +610,7 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis
sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
+ uno::Reference< chart2::XAxis > xOldAxis( DiagramHelper::getAttachedAxis( xDataSeries, xDiagram ) );
if( nOldAxisIndex != nNewAxisIndex )
{
@@ -629,6 +630,11 @@ bool DiagramHelper::attachSeriesToAxis( bool bAttachToMainAxis
uno::Reference< XAxis > xAxis( AxisHelper::getAxis( 1, bAttachToMainAxis, xDiagram ) );
if(!xAxis.is()) //create an axis if necessary
xAxis = AxisHelper::createAxis( 1, bAttachToMainAxis, xDiagram, xContext );
+ if( bAdaptAxes )
+ {
+ AxisHelper::makeAxisVisible( xAxis );
+ AxisHelper::hideAxisIfNoDataIsAttached( xOldAxis, xDiagram );
+ }
}
return bChanged;
diff --git a/chart2/source/tools/LineProperties.cxx b/chart2/source/tools/LineProperties.cxx
index cb72d4336faa..95cf95e21a86 100644
--- a/chart2/source/tools/LineProperties.cxx
+++ b/chart2/source/tools/LineProperties.cxx
@@ -105,7 +105,7 @@ void LineProperties::AddDefaultsToMap(
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_WIDTH, 0 );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_COLOR, 0x000000 ); // black
::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_LINE_TRANSPARENCE, 0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_NONE );
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND );
}
//static
diff --git a/chart2/source/tools/WrappedIgnoreProperty.cxx b/chart2/source/tools/WrappedIgnoreProperty.cxx
index bebbf77ceeef..aaa6c545a799 100644
--- a/chart2/source/tools/WrappedIgnoreProperty.cxx
+++ b/chart2/source/tools/WrappedIgnoreProperty.cxx
@@ -101,7 +101,7 @@ void WrappedIgnoreProperties::addIgnoreLineProperties( std::vector< WrappedPrope
rList.push_back( new WrappedIgnoreProperty( C2U( "LineColor" ), uno::makeAny( sal_Int32(0) ) ) );
rList.push_back( new WrappedIgnoreProperty( C2U( "LineTransparence" ), uno::makeAny( sal_Int16(0) ) ) );
rList.push_back( new WrappedIgnoreProperty( C2U( "LineWidth" ), uno::makeAny( sal_Int32(0) ) ) );
- rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_NONE ) ) );
+ rList.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_ROUND ) ) );
}
//static
diff --git a/chart2/source/view/axes/VAxisProperties.cxx b/chart2/source/view/axes/VAxisProperties.cxx
index 436541ef27ee..1e3e62894741 100644
--- a/chart2/source/view/axes/VAxisProperties.cxx
+++ b/chart2/source/view/axes/VAxisProperties.cxx
@@ -33,6 +33,7 @@
#include "CommonConverters.hxx"
#include "AxisHelper.hxx"
#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
#include <tools/color.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -390,8 +391,8 @@ void AxisProperties::init( bool bCartesian )
//-----------------------------------------------------------------------------
AxisLabelProperties::AxisLabelProperties()
- : m_aFontReferenceSize( 8000, 7000 )
- , m_aMaximumSpaceForLabels( 0 , 0, 8000, 7000 )
+ : m_aFontReferenceSize( ChartModelHelper::getDefaultPageSize() )
+ , m_aMaximumSpaceForLabels( 0 , 0, m_aFontReferenceSize.Width, m_aFontReferenceSize.Height )
, nNumberFormatKey(0)
, eStaggering( SIDE_BY_SIDE )
, bLineBreakAllowed( false )
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 67914f47bac0..fd1aaa81c3a0 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -403,7 +403,7 @@ bool AreaChart::impl_createLine( VDataSeries* pSeries
m_pShapeFactory->createStripe(xSeriesGroupShape_Shapes
, Stripe( aPoint1, aPoint2, fDepth )
- , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true );
+ , pSeries->getPropertiesOfSeries(), PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), true, 1 );
}
}
}
diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx
index 470796f8fc1e..0d7ef403f87d 100644..100755
--- a/chart2/source/view/charttypes/BarChart.cxx
+++ b/chart2/source/view/charttypes/BarChart.cxx
@@ -110,9 +110,16 @@ drawing::Direction3D BarChart::getPreferredDiagramAspectRatio() const
if( m_nDimension == 3 )
{
aRet = drawing::Direction3D(1.0,-1.0,1.0);
- drawing::Direction3D aScale( this->getPlottingPositionHelper(MAIN_AXIS_INDEX).getScaledLogicWidth() );
+ BarPositionHelper* pPosHelper = dynamic_cast<BarPositionHelper*>(&( this->getPlottingPositionHelper( MAIN_AXIS_INDEX) ) );
+ drawing::Direction3D aScale( pPosHelper->getScaledLogicWidth() );
if(aScale.DirectionX!=0.0)
- aRet.DirectionZ = aScale.DirectionZ/aScale.DirectionX;
+ {
+ double fXSlotCount = 1.0;
+ if(!m_aZSlots.empty())
+ fXSlotCount = m_aZSlots.begin()->size();
+
+ aRet.DirectionZ = aScale.DirectionZ/(aScale.DirectionX + aScale.DirectionX*(fXSlotCount-1.0)*pPosHelper->getSlotWidth());
+ }
else
return VSeriesPlotter::getPreferredDiagramAspectRatio();
if(aRet.DirectionZ<0.05)
@@ -357,7 +364,8 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
xShape = m_pShapeFactory->createCone( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
break;
case DataPointGeometry3D::PYRAMID:
- xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
+ xShape = m_pShapeFactory->createPyramid( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree>0
+ , xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
break;
case DataPointGeometry3D::CUBOID:
default:
@@ -366,7 +374,8 @@ uno::Reference< drawing::XShape > BarChart::createDataPoint3D_Bar(
, PropertyMapper::getPropertyNameMapForFilledSeriesProperties(), bRoundedEdges );
return xShape;
}
- this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
+ if( nGeometry3D != DataPointGeometry3D::PYRAMID )
+ this->setMappedProperties( xShape, xObjectProperties, PropertyMapper::getPropertyNameMapForFilledSeriesProperties() );
return xShape;
}
@@ -734,6 +743,7 @@ void BarChart::createShapes()
double fMiddleHeight = fUpperYValue-fLowerYValue;
if(!bPositive)
fMiddleHeight*=-1.0;
+ double fLogicBarDepth = 0.5;
if(m_nDimension==3)
{
if( lcl_hasGeometry3DVariableWidth(nGeometry3D) && fCompleteHeight!=0.0 )
@@ -744,9 +754,11 @@ void BarChart::createShapes()
fLogicBarWidth = fLogicBaseWidth*fHeight/(fCompleteHeight);
if(fLogicBarWidth<=0.0)
fLogicBarWidth=fLogicBaseWidth;
+ fLogicBarDepth = fLogicBarDepth*fHeight/(fCompleteHeight);
+ if(fLogicBarDepth<=0.0)
+ fLogicBarDepth*=-1.0;
}
}
- double fLogicBarDepth = fLogicBarWidth;
//better performance for big data
FormerBarPoint aFormerPoint( aSeriesFormerPointMap[pSeries] );
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index ccba1fdc4106..37888c8f0a9b 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -560,11 +560,17 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
sal_Int32 nYDiff = aTextSize.Height/nLineCountForSymbolsize;
sal_Int32 nXDiff = aSymbolSize.Width * nYDiff/aSymbolSize.Height;
+ // #i109336# Improve auto positioning in chart
+ nXDiff = nXDiff * 80 / 100;
+ nYDiff = nYDiff * 80 / 100;
+
aSymbolSize.Width = nXDiff * 75/100;
aSymbolSize.Height = nYDiff * 75/100;
awt::Point aSymbolPosition( aUnrotatedTextPos );
- aSymbolPosition.Y += (nYDiff * 25/200);
+
+ // #i109336# Improve auto positioning in chart
+ aSymbolPosition.Y += ( nYDiff / 4 );
if(LABEL_ALIGN_LEFT==eAlignment
|| LABEL_ALIGN_LEFT_TOP==eAlignment
diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx
index 51775cdde85b..5ffec22969a0 100644
--- a/chart2/source/view/diagram/VDiagram.cxx
+++ b/chart2/source/view/diagram/VDiagram.cxx
@@ -534,6 +534,9 @@ void VDiagram::createShapes_3d()
bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram );
+ const bool bDoubleSided = false;
+ const bool bFlatNormals = true;
+
//add walls
{
uno::Reference< beans::XPropertySet > xWallProp( NULL );
@@ -544,19 +547,31 @@ void VDiagram::createShapes_3d()
if( !bAddFloorAndWall )
aWallCID = rtl::OUString();
uno::Reference< drawing::XShapes > xWallGroup_Shapes( m_pShapeFactory->createGroup3D( xOuterGroup_Shapes, aWallCID ) );
+
+ CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
+ CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
+
//add left wall
{
+ short nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 3 : 1;
double xPos = 0.0;
- CuboidPlanePosition eLeftWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeftWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
if( CuboidPlanePosition_Right==eLeftWallPos )
xPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
Stripe aStripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
- , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
- , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) );
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
+ if( CuboidPlanePosition_Right==eLeftWallPos )
+ {
+ nRotatedTexture = ( CuboidPlanePosition_Front==eBackWallPos ) ? 2 : 0;
+ aStripe = Stripe( drawing::Position3D(xPos,FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME) );
+ }
+ aStripe.InvertNormal(true);
uno::Reference< drawing::XShape > xShape =
m_pShapeFactory->createStripe( xWallGroup_Shapes, aStripe
- , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true, true );
+ , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals );
if( !bAddFloorAndWall )
{
//we always need this object as dummy object for correct scene dimensions
@@ -566,17 +581,25 @@ void VDiagram::createShapes_3d()
}
//add back wall
{
+ short nRotatedTexture = 0;
double zPos = 0.0;
- CuboidPlanePosition eBackWallPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBackWall( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
if( CuboidPlanePosition_Front==eBackWallPos )
zPos = FIXED_SIZE_FOR_3D_CHART_VOLUME;
Stripe aStripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos)
+ , drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0)
+ , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
+ if( CuboidPlanePosition_Front==eBackWallPos )
+ {
+ aStripe = Stripe( drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,zPos)
, drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0)
, drawing::Direction3D(0,-FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
+ nRotatedTexture = 3;
+ }
+ aStripe.InvertNormal(true);
uno::Reference< drawing::XShape > xShape =
m_pShapeFactory->createStripe(xWallGroup_Shapes, aStripe
- , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), true );
+ , xWallProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, nRotatedTexture, bFlatNormals );
if( !bAddFloorAndWall )
{
//we always need this object as dummy object for correct scene dimensions
@@ -643,44 +666,14 @@ void VDiagram::createShapes_3d()
if( m_xDiagram.is() )
xFloorProp=uno::Reference< beans::XPropertySet >( m_xDiagram->getFloor());
- uno::Reference< drawing::XShape > xShape(
- m_xShapeFactory->createInstance( C2U(
- "com.sun.star.drawing.Shape3DExtrudeObject") ), uno::UNO_QUERY );
- xOuterGroup_Shapes->add(xShape);
- uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- if( xShapeProp.is())
- {
- //depth
- xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_EXTRUDE_DEPTH )
- , uno::makeAny((sal_Int32)FLOOR_THICKNESS) );
- //PercentDiagonal
- xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_PERCENT_DIAGONAL )
- , uno::makeAny( sal_Int32(0) ) );
-
- drawing::Direction3D aSize(FIXED_SIZE_FOR_3D_CHART_VOLUME,FIXED_SIZE_FOR_3D_CHART_VOLUME,FLOOR_THICKNESS);
-
- //Polygon
- drawing::PolyPolygonShape3D aPoly;
- AddPointToPoly( aPoly, drawing::Position3D(0,0,0) );
- AddPointToPoly( aPoly, drawing::Position3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
- AddPointToPoly( aPoly, drawing::Position3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
- AddPointToPoly( aPoly, drawing::Position3D(0,FIXED_SIZE_FOR_3D_CHART_VOLUME,0) );
- AddPointToPoly( aPoly, drawing::Position3D(0,0,0) );
- xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D ), uno::makeAny( aPoly ) );
-
- //Matrix for position
- {
- ::basegfx::B3DHomMatrix aM;
- aM.rotate(F_PI/2.0,0.0,0.0);
- aM.translate(0.0,FLOOR_THICKNESS, 0.0);
- drawing::HomogenMatrix aHM = B3DHomMatrixToHomogenMatrix(aM);
- E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
- xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
- , uno::makeAny(aHM) );
- }
+ Stripe aStripe( drawing::Position3D(0,0,0)
+ , drawing::Direction3D(0,0,FIXED_SIZE_FOR_3D_CHART_VOLUME)
+ , drawing::Direction3D(FIXED_SIZE_FOR_3D_CHART_VOLUME,0,0) );
+ aStripe.InvertNormal(true);
- PropertyMapper::setMappedProperties( xShapeProp, xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties() );
- }
+ uno::Reference< drawing::XShape > xShape =
+ m_pShapeFactory->createStripe(xOuterGroup_Shapes, aStripe
+ , xFloorProp, PropertyMapper::getPropertyNameMapForFillAndLineProperties(), bDoubleSided, 0, bFlatNormals );
CuboidPlanePosition eBottomPos( ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBottom( uno::Reference< beans::XPropertySet >( m_xDiagram, uno::UNO_QUERY ) ) );
if( !bAddFloorAndWall || (CuboidPlanePosition_Bottom!=eBottomPos) )
@@ -709,11 +702,11 @@ void VDiagram::createShapes_3d()
try
{
double fXScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
- double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -FLOOR_THICKNESS-GRID_TO_WALL_DISTANCE ) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
+ double fYScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
double fZScale = (FIXED_SIZE_FOR_3D_CHART_VOLUME -GRID_TO_WALL_DISTANCE) /FIXED_SIZE_FOR_3D_CHART_VOLUME;
::basegfx::B3DHomMatrix aM;
- aM.translate(GRID_TO_WALL_DISTANCE/fXScale, (FLOOR_THICKNESS+GRID_TO_WALL_DISTANCE)/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
+ aM.translate(GRID_TO_WALL_DISTANCE/fXScale, GRID_TO_WALL_DISTANCE/fYScale, GRID_TO_WALL_DISTANCE/fZScale);
aM.scale( fXScale, fYScale, fZScale );
E3DModifySceneSnapRectUpdater aUpdater(lcl_getE3dScene( m_xOuterGroupShape ));
xShapeProp->setPropertyValue( C2U( UNO_NAME_3D_TRANSFORM_MATRIX )
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index e16310a71ce7..ef75f3a323af 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -90,7 +90,11 @@ public:
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPosition
, const ::com::sun::star::drawing::Direction3D& rSize
- , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
+ , double fTopHeight
+ , bool bRotateZ
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap);
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createCone( const ::com::sun::star::uno::Reference<
@@ -119,7 +123,9 @@ public:
, const Stripe& rStripe
, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
- , sal_Bool bDoubleSided = true, bool bRotatedTexture=false );
+ , sal_Bool bDoubleSided = true
+ , short nRotatedTexture = 0 //0 to 7 are the different possibilities
+ , bool bFlatNormals=true );
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
@@ -235,7 +241,6 @@ private:
, const ::com::sun::star::drawing::Position3D& rPosition
, const ::com::sun::star::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
- , sal_Int32 nSegments
, bool bCylinder = false);
//member:
diff --git a/chart2/source/view/inc/Stripe.hxx b/chart2/source/view/inc/Stripe.hxx
index b176685aefb5..ca1aaf155d1e 100644
--- a/chart2/source/view/inc/Stripe.hxx
+++ b/chart2/source/view/inc/Stripe.hxx
@@ -53,16 +53,19 @@ public:
, const ::com::sun::star::drawing::Position3D& rPoint2
, double fDepth );
-/*
Stripe( const ::com::sun::star::drawing::Position3D& rPoint1
, const ::com::sun::star::drawing::Position3D& rPoint2
, const ::com::sun::star::drawing::Position3D& rPoint3
- , const ::com::sun::star::drawing::Position3D& rPoint4 );*/
+ , const ::com::sun::star::drawing::Position3D& rPoint4 );
+ void SetManualNormal( const ::com::sun::star::drawing::Direction3D& rNormal );
+ ::com::sun::star::drawing::Direction3D getNormal() const;
+
+ void InvertNormal( bool bInvertNormal );
::com::sun::star::uno::Any getPolyPolygonShape3D() const;
::com::sun::star::uno::Any getNormalsPolygon() const;
- ::com::sun::star::uno::Any getTexturePolygon( bool bRotatedTexture ) const;
+ ::com::sun::star::uno::Any getTexturePolygon( short nRotatedTexture ) const; //0 to 7 are the different possibilities
::com::sun::star::drawing::Position3D GetPosition1() const { return m_aPoint1; }
::com::sun::star::drawing::Position3D GetPosition2() const { return m_aPoint2; }
@@ -75,8 +78,9 @@ private:
::com::sun::star::drawing::Position3D m_aPoint3;
::com::sun::star::drawing::Position3D m_aPoint4;
- ::com::sun::star::drawing::Direction3D
- getNormal() const;
+ bool m_bInvertNormal;
+ bool m_bManualNormalSet;
+ ::com::sun::star::drawing::Direction3D m_aManualNormal;
};
//.............................................................................
diff --git a/chart2/source/view/inc/ViewDefines.hxx b/chart2/source/view/inc/ViewDefines.hxx
index e520522e2389..623e46e64fb7 100644
--- a/chart2/source/view/inc/ViewDefines.hxx
+++ b/chart2/source/view/inc/ViewDefines.hxx
@@ -37,7 +37,6 @@ namespace chart
#define FIXED_SIZE_FOR_3D_CHART_VOLUME (10000.0)
//There needs to be a little distance betweengrid lines and walls in 3D, otherwise the lines are partly hidden by the walls
#define GRID_TO_WALL_DISTANCE (1.0)
-#define FLOOR_THICKNESS (100.0)
const double ZDIRECTION = 1.0;
const sal_Int32 AXIS2D_TICKLENGTH = 150;//value like in old chart
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index da8798fe31b6..549ef0273595 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -218,13 +218,15 @@ ChartView::~ChartView()
void ChartView::impl_deleteCoordinateSystems()
{
//delete all coordinate systems
- ::std::vector< VCoordinateSystem* >::const_iterator aIter = m_aVCooSysList.begin();
- const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = m_aVCooSysList.end();
+ ::std::vector< VCoordinateSystem* > aVectorToDeleteObjects;
+ ::std::swap( aVectorToDeleteObjects, m_aVCooSysList );//#i109770#
+ ::std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin();
+ const ::std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end();
for( ; aIter != aEnd; aIter++ )
{
delete *aIter;
}
- m_aVCooSysList.clear();
+ aVectorToDeleteObjects.clear();
}
@@ -2155,7 +2157,7 @@ void changePositionOfAxisTitle( VTitle* pVTitle, TitleAlignment eAlignment
pVTitle->changePosition( aNewPosition );
}
-std::auto_ptr<VTitle> lcl_createTitle( const uno::Reference< XTitle >& xTitle
+std::auto_ptr<VTitle> lcl_createTitle( TitleHelper::eTitleType eType
, const uno::Reference< drawing::XShapes>& xPageShapes
, const uno::Reference< lang::XMultiServiceFactory>& xShapeFactory
, const uno::Reference< frame::XModel >& xChartModel
@@ -2165,10 +2167,32 @@ std::auto_ptr<VTitle> lcl_createTitle( const uno::Reference< XTitle >& xTitle
, bool& rbAutoPosition )
{
std::auto_ptr<VTitle> apVTitle;
+
+ // #i109336# Improve auto positioning in chart
+ double fPercentage = lcl_getPageLayoutDistancePercentage();
+ sal_Int32 nXDistance = static_cast< sal_Int32 >( rPageSize.Width * fPercentage );
+ sal_Int32 nYDistance = static_cast< sal_Int32 >( rPageSize.Height * fPercentage );
+ if ( eType == TitleHelper::MAIN_TITLE )
+ {
+ sal_Int32 nYOffset = 135; // 1/100 mm
+ nYDistance += nYOffset;
+ }
+ else if ( eType == TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION )
+ {
+ sal_Int32 nYOffset = 420; // 1/100 mm
+ nYDistance = nYOffset;
+ }
+ else if ( eType == TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION )
+ {
+ sal_Int32 nXOffset = 450; // 1/100 mm
+ nXDistance = nXOffset;
+ }
+
+ uno::Reference< XTitle > xTitle( TitleHelper::getTitle( eType, xChartModel ) );
if(xTitle.is())
{
rtl::OUString aCompleteString( TitleHelper::getCompleteString( xTitle ) );
- if( aCompleteString.getLength()==0 )
+ if ( aCompleteString.getLength() == 0 )
return apVTitle;//don't create empty titles as the resulting diagram position is wrong then
//create title
@@ -2182,8 +2206,6 @@ std::auto_ptr<VTitle> lcl_createTitle( const uno::Reference< XTitle >& xTitle
//position
rbAutoPosition=true;
awt::Point aNewPosition(0,0);
- sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
- sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
chart2::RelativePosition aRelativePosition;
uno::Reference< beans::XPropertySet > xProp(xTitle, uno::UNO_QUERY);
if( xProp.is() && (xProp->getPropertyValue( C2U( "RelativePosition" ) )>>=aRelativePosition) )
@@ -2247,6 +2269,37 @@ std::auto_ptr<VTitle> lcl_createTitle( const uno::Reference< XTitle >& xTitle
break;
}
}
+ else
+ {
+ // #i109336# Improve auto positioning in chart
+ switch ( eAlignment )
+ {
+ case ALIGN_TOP:
+ {
+ rRemainingSpace.Y += nYDistance;
+ rRemainingSpace.Height -= nYDistance;
+ }
+ break;
+ case ALIGN_BOTTOM:
+ {
+ rRemainingSpace.Height -= nYDistance;
+ }
+ break;
+ case ALIGN_LEFT:
+ {
+ rRemainingSpace.X += nXDistance;
+ rRemainingSpace.Width -= nXDistance;
+ }
+ break;
+ case ALIGN_RIGHT:
+ {
+ rRemainingSpace.Width -= nXDistance;
+ }
+ break;
+ default:
+ break;
+ }
+ }
return apVTitle;
}
@@ -2476,13 +2529,13 @@ void ChartView::createShapes()
bool bAutoPositionDummy = true;
//------------ create main title shape
- lcl_createTitle( TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ lcl_createTitle( TitleHelper::MAIN_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
//------------ create sub title shape
- lcl_createTitle( TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ lcl_createTitle( TitleHelper::SUB_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, ALIGN_TOP, bAutoPositionDummy );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2506,7 +2559,7 @@ void ChartView::createShapes()
bool bAutoPosition_XTitle = true;
std::auto_ptr<VTitle> apVTitle_X;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 0 ) )
- apVTitle_X = lcl_createTitle( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_X = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_X_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, ALIGN_BOTTOM, bAutoPosition_XTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2515,7 +2568,7 @@ void ChartView::createShapes()
bool bAutoPosition_YTitle = true;
std::auto_ptr<VTitle> apVTitle_Y;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 1 ) )
- apVTitle_Y = lcl_createTitle( TitleHelper::getTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_Y = lcl_createTitle( TitleHelper::TITLE_AT_STANDARD_Y_AXIS_POSITION, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, ALIGN_LEFT, bAutoPosition_YTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2524,7 +2577,7 @@ void ChartView::createShapes()
bool bAutoPosition_ZTitle = true;
std::auto_ptr<VTitle> apVTitle_Z;
if( ChartTypeHelper::isSupportingMainAxis( xChartType, nDimension, 2 ) )
- apVTitle_Z = lcl_createTitle( TitleHelper::getTitle( TitleHelper::Z_AXIS_TITLE, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_Z = lcl_createTitle( TitleHelper::Z_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, ALIGN_RIGHT, bAutoPosition_ZTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2536,7 +2589,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondXTitle = true;
std::auto_ptr<VTitle> apVTitle_SecondX;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 0 ) )
- apVTitle_SecondX = lcl_createTitle( TitleHelper::getTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_SecondX = lcl_createTitle( TitleHelper::SECONDARY_X_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_RIGHT : ALIGN_TOP, bAutoPosition_SecondXTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
@@ -2545,7 +2598,7 @@ void ChartView::createShapes()
bool bAutoPosition_SecondYTitle = true;
std::auto_ptr<VTitle> apVTitle_SecondY;
if( ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimension, 1 ) )
- apVTitle_SecondY = lcl_createTitle( TitleHelper::getTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_xChartModel ), xPageShapes, m_xShapeFactory, m_xChartModel
+ apVTitle_SecondY = lcl_createTitle( TitleHelper::SECONDARY_Y_AXIS_TITLE, xPageShapes, m_xShapeFactory, m_xChartModel
, aRemainingSpace, aPageSize, bIsVertical? ALIGN_TOP : ALIGN_RIGHT, bAutoPosition_SecondYTitle );
if(aRemainingSpace.Width<=0||aRemainingSpace.Height<=0)
return;
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 6e53ce22aff7..1979582763fa 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -529,7 +529,7 @@ void PropertyMapper::getPreparedTextShapePropertyLists(
// use a line-joint showing the border of thick lines like two rectangles
// filled in between.
- aValueMap[C2U("LineJoint")] <<= drawing::LineJoint_MITER;
+ aValueMap[C2U("LineJoint")] <<= drawing::LineJoint_ROUND;
PropertyMapper::getMultiPropertyListsFromValueMap( rPropNames, rPropValues, aValueMap );
}
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 0be0c04c18d9..721cabd15d83 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -67,6 +67,7 @@
#include <algorithm>
using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
//.............................................................................
namespace chart
@@ -268,110 +269,99 @@ uno::Any createPolyPolygon_Cube(
uno::Any createPolyPolygon_Cylinder(
double fHeight
, double fRadius
- , double fRoundedEdge
, sal_Int32& nVerticalSegmentCount )
{
- //@todo consider offset if Height is negative
-
-// DBG_ASSERT(fHeight>0, "The height of a cylinder needs to be > 0");
+ //fHeight may be negative
DBG_ASSERT(fRadius>0, "The radius of a cylinder needs to be > 0");
- DBG_ASSERT(fRoundedEdge>=0, "fRoundedEdge needs to be >= 0");
-
- // always use extra points, so set percent diagonal to 0.4 which is 0% in the UI (old Chart comment)
- if( fRoundedEdge == 0.0 )
- fRoundedEdge = 0.4 / 200.0;
-
-// const double fWidth = fRadius;
-
- fRoundedEdge = 0.0;
- const double fOffset = (fRadius * 2.0 * fRoundedEdge) * 1.05; // increase by 5% for safety
- const bool bRoundEdges = fRoundedEdge && fOffset < fRadius && 2.0 * fOffset < fHeight;
- const sal_Int32 nPointCount = bRoundEdges ? 8 : 4;
- nVerticalSegmentCount = nPointCount-1;
//--------------------------------------
drawing::PolyPolygonShape3D aPP;
- aPP.SequenceX.realloc(1);
- aPP.SequenceY.realloc(1);
- aPP.SequenceZ.realloc(1);
+ nVerticalSegmentCount=1;
+
+ aPP.SequenceX.realloc(3);
+ aPP.SequenceY.realloc(3);
+ aPP.SequenceZ.realloc(3);
drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
- pOuterSequenceX->realloc(nPointCount);
- pOuterSequenceY->realloc(nPointCount);
- pOuterSequenceZ->realloc(nPointCount);
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
double* pInnerSequenceX = pOuterSequenceX->getArray();
double* pInnerSequenceY = pOuterSequenceY->getArray();
double* pInnerSequenceZ = pOuterSequenceZ->getArray();
- for(sal_Int32 nN = nPointCount; nN--;)
+ double fY1 = 0.0;
+ double fY2 = fHeight;
+
+ if( fHeight<0.0 )
+ ::std::swap(fY1,fY2);
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
*pInnerSequenceZ++ = 0.0;
- if(nPointCount == 4)
- {
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceY++ = fHeight;
- *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = fY1;
- *pInnerSequenceX++ = 0.0;
- *pInnerSequenceX++ = fRadius;
- *pInnerSequenceX++ = fRadius;
- *pInnerSequenceX++ = 0.0;
- }
- else
- {
- *pInnerSequenceY++ = 0.0; //1.
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceY++ = 0.0;
- *pInnerSequenceY++ = fOffset;
- *pInnerSequenceY++ = fHeight - fOffset;
- *pInnerSequenceY++ = fHeight; //6.
- *pInnerSequenceY++ = fHeight;
- *pInnerSequenceY++ = fHeight;
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY1;
+ //----------------------------
+
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY1;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY2;
+ //----------------------------
+
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
+
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
+
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = fRadius;
+ *pInnerSequenceY++ = fY2;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = fY2;
+ //----------------------------
- *pInnerSequenceX++ = 0.0; //1.
- *pInnerSequenceX++ = fRadius - fOffset;
- *pInnerSequenceX++ = fRadius;
- *pInnerSequenceX++ = fRadius;
- *pInnerSequenceX++ = fRadius;
- *pInnerSequenceX++ = fRadius; //6.
- *pInnerSequenceX++ = fRadius - fOffset;
- *pInnerSequenceX++ = 0.0;
- }
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
}
-uno::Any createPolyPolygon_Cone(
- double fHeight
- , double fRadius
- , double fTopHeight
- , double fRoundedEdge
+uno::Any createPolyPolygon_Cone( double fHeight, double fRadius, double fTopHeight
, sal_Int32& nVerticalSegmentCount )
{
- //@todo consider offset if Height is negative
-/*
- DBG_ASSERT(fHeight>0, "The height of a cone needs to be > 0");
- DBG_ASSERT(fTopHeight>=0, "The height of the cutted top of a cone needs to be >= 0");
-*/
-
DBG_ASSERT(fRadius>0, "The radius of a cone needs to be > 0");
- DBG_ASSERT(fRoundedEdge>=0, "fRoundedEdge needs to be >= 0");
//for stacked charts we need cones without top -> fTopHeight != 0 resp. bTopless == true
//fTopHeight indicates the high of the cutted top only (not the full height)
-
- // always use extra points, so set percent diagonal to 0.4 which is 0% in the UI (old Chart comment)
- if( fRoundedEdge == 0.0 )
- fRoundedEdge = 0.4 / 200.0;
-
- fRoundedEdge = 0.0;
-
- // ::rtl::math::approxEqual cannot compare to 0.0
bool bTopless = !::rtl::math::approxEqual( fHeight, fHeight + fTopHeight );
double r1= 0.0, r2 = fRadius;
@@ -379,82 +369,69 @@ uno::Any createPolyPolygon_Cone(
// #i63212# fHeight may be negative, fTopHeight is always positive -> use fabs(fHeight)
r1 = fRadius * (fTopHeight)/(fabs(fHeight)+fTopHeight);
- const double fMinimumDimension = ::std::min(r2*2.0,fHeight);
- const double fOffset = (fMinimumDimension * fRoundedEdge) * 1.05; // increase by 5% for safety
- const bool bRoundEdges = fRoundedEdge && fOffset < r2 && 2.0 * fOffset < fHeight
- && ( bTopless ? fOffset < r1 : true );
- sal_Int32 nPointCount = 8;
- if(bTopless)
- {
- if(!bRoundEdges)
- nPointCount = 4;
- }
- else
- {
- if(bRoundEdges)
- nPointCount = 6;
- else
- nPointCount = 3;
- }
- nVerticalSegmentCount = nPointCount-1;
-
- //--------------------------------------
+ nVerticalSegmentCount=1;
drawing::PolyPolygonShape3D aPP;
- aPP.SequenceX.realloc(1);
- aPP.SequenceY.realloc(1);
- aPP.SequenceZ.realloc(1);
+ aPP.SequenceX.realloc(2);
+ aPP.SequenceY.realloc(2);
+ aPP.SequenceZ.realloc(2);
drawing::DoubleSequence* pOuterSequenceX = aPP.SequenceX.getArray();
drawing::DoubleSequence* pOuterSequenceY = aPP.SequenceY.getArray();
drawing::DoubleSequence* pOuterSequenceZ = aPP.SequenceZ.getArray();
- pOuterSequenceX->realloc(nPointCount);
- pOuterSequenceY->realloc(nPointCount);
- pOuterSequenceZ->realloc(nPointCount);
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
double* pInnerSequenceX = pOuterSequenceX->getArray();
double* pInnerSequenceY = pOuterSequenceY->getArray();
double* pInnerSequenceZ = pOuterSequenceZ->getArray();
- for(sal_Int32 nN = nPointCount; nN--;)
- *pInnerSequenceZ++ = 0.0;
+ double fX1 = 0.0;
+ double fX2 = r2;
+ double fX3 = r1;
- if(bTopless)
- {
- *pInnerSequenceY++ = fHeight; //1.
- *pInnerSequenceX++ = 0.0; //1.
+ double fY1 = 0.0;
+ double fY2 = 0.0;
+ double fY3 = fHeight;
- if(bRoundEdges)
- {
- *pInnerSequenceY++ = fHeight; //2.
- *pInnerSequenceX++ = r1 - fOffset; //2.
- }
+ if( fHeight<0.0 )
+ {
+ ::std::swap(fX1,fX3);
+ ::std::swap(fY1,fY3);
}
- *pInnerSequenceY++ = fHeight; //3.
- *pInnerSequenceX++ = r1; //3.
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
- if(bRoundEdges)
- {
- *pInnerSequenceY++ = fHeight - fOffset; //4.
- *pInnerSequenceX++ = r1 + fOffset; //4.
+ *pInnerSequenceY++ = fY1;
+ *pInnerSequenceX++ = fX1;
- *pInnerSequenceY++ = fOffset; //5.
- *pInnerSequenceX++ = r2 - fOffset; //5.
- }
+ *pInnerSequenceY++ = fY2;
+ *pInnerSequenceX++ = fX2;
+ //----------------------------
- *pInnerSequenceY++ = 0.0; //6.
- *pInnerSequenceX++ = r2; //6.
+ pOuterSequenceX++;pOuterSequenceY++;pOuterSequenceZ++;
+ pOuterSequenceX->realloc(2);
+ pOuterSequenceY->realloc(2);
+ pOuterSequenceZ->realloc(2);
- if(bRoundEdges)
- {
- *pInnerSequenceY++ = 0.0; //7.
- *pInnerSequenceX++ = r2 - fOffset; //7.
- }
+ pInnerSequenceX = pOuterSequenceX->getArray();
+ pInnerSequenceY = pOuterSequenceY->getArray();
+ pInnerSequenceZ = pOuterSequenceZ->getArray();
- *pInnerSequenceY++ = 0.0; //8.
- *pInnerSequenceX++ = 0.0; //8.
+ //----------------------------
+ for(sal_Int32 nN = 2; nN--;)
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceY++ = fY2;
+ *pInnerSequenceX++ = fX2;
+
+ *pInnerSequenceY++ = fY3;
+ *pInnerSequenceX++ = fX3;
+ //----------------------------
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
}
@@ -567,16 +544,167 @@ uno::Reference<drawing::XShape>
, sal_Int32 nRotateZAngleHundredthDegree )
{
return impl_createConeOrCylinder(
- xTarget, rPosition, rSize, 0.0, nRotateZAngleHundredthDegree, CHART_3DOBJECT_SEGMENTCOUNT, true );
+ xTarget, rPosition, rSize, 0.0, nRotateZAngleHundredthDegree, true );
}
uno::Reference<drawing::XShape>
ShapeFactory::createPyramid(
const uno::Reference<drawing::XShapes>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
- , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree )
+ , double fTopHeight, bool bRotateZ
+ , const uno::Reference< beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap )
{
- return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree, 4 );
+ if( !xTarget.is() )
+ return 0;
+
+ Reference< drawing::XShapes > xGroup( ShapeFactory::createGroup3D( xTarget, rtl::OUString() ) );
+
+ sal_Bool bDoubleSided = false;
+ short nRotatedTexture = 0;
+
+ const double fWidth = rSize.DirectionX;
+ const double fDepth = rSize.DirectionZ;
+ const double fHeight = rSize.DirectionY;
+
+ drawing::Position3D aBottomP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth/2.0 );
+ if(bRotateZ)
+ aBottomP1.PositionY -= fWidth/2.0;
+ else
+ aBottomP1.PositionX -= fWidth/2.0;
+ drawing::Position3D aBottomP2( aBottomP1 );
+ if(bRotateZ)
+ aBottomP2.PositionY += fWidth;
+ else
+ aBottomP2.PositionX += fWidth;
+ drawing::Position3D aBottomP3( aBottomP2 );
+ drawing::Position3D aBottomP4( aBottomP1 );
+ aBottomP3.PositionZ += fDepth;
+ aBottomP4.PositionZ += fDepth;
+
+ const double fTopFactor = (fTopHeight)/(fabs(fHeight)+fTopHeight);
+ drawing::Position3D aTopP1( rPosition.PositionX, rPosition.PositionY, rPosition.PositionZ - fDepth*fTopFactor/2.0 );
+ if(bRotateZ)
+ {
+ aTopP1.PositionY -= fWidth*fTopFactor/2.0;
+ aTopP1.PositionX += fHeight;
+ }
+ else
+ {
+ aTopP1.PositionX -= fWidth*fTopFactor/2.0;
+ aTopP1.PositionY += fHeight;
+ }
+ drawing::Position3D aTopP2( aTopP1 );
+ if(bRotateZ)
+ aTopP2.PositionY += fWidth*fTopFactor;
+ else
+ aTopP2.PositionX += fWidth*fTopFactor;
+ drawing::Position3D aTopP3( aTopP2 );
+ drawing::Position3D aTopP4( aTopP1 );
+ aTopP3.PositionZ += fDepth*fTopFactor;
+ aTopP4.PositionZ += fDepth*fTopFactor;
+
+ Stripe aStripeBottom( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
+
+ drawing::Position3D aNormalsBottomP1( aBottomP1 );
+ drawing::Position3D aNormalsBottomP2( aBottomP2 );
+ drawing::Position3D aNormalsBottomP3( aBottomP3 );
+ drawing::Position3D aNormalsBottomP4( aBottomP4 );
+ drawing::Position3D aNormalsTopP1( aBottomP1 );
+ drawing::Position3D aNormalsTopP2( aBottomP2 );
+ drawing::Position3D aNormalsTopP3( aBottomP3 );
+ drawing::Position3D aNormalsTopP4( aBottomP4 );
+ if( bRotateZ )
+ {
+ aNormalsTopP1.PositionX += fHeight;
+ aNormalsTopP2.PositionX += fHeight;
+ aNormalsTopP3.PositionX += fHeight;
+ aNormalsTopP4.PositionX += fHeight;
+ }
+ else
+ {
+ aNormalsTopP1.PositionY += fHeight;
+ aNormalsTopP2.PositionY += fHeight;
+ aNormalsTopP3.PositionY += fHeight;
+ aNormalsTopP4.PositionY += fHeight;
+ }
+
+ bool bInvertPolygon = false;
+ bool bInvertNormals = false;
+
+ if(bRotateZ)
+ {
+ //bars
+ if(fHeight>=0.0)
+ {
+ nRotatedTexture = 2;
+ bInvertNormals = true;
+ aStripeBottom = Stripe( aBottomP1, aBottomP4, aBottomP3, aBottomP2 );
+ }
+ else
+ {
+ bInvertPolygon = true;
+ nRotatedTexture = 1;
+ aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
+ }
+ }
+ else
+ {
+ //columns
+ if(fHeight>=0.0)
+ {
+ bInvertPolygon = true;
+ nRotatedTexture = 2;
+ aStripeBottom = Stripe( aBottomP2, aBottomP3, aBottomP4, aBottomP1 );
+ }
+ else
+ {
+ nRotatedTexture = 3;
+ bInvertNormals = true;
+ aStripeBottom = Stripe( aBottomP4, aBottomP3, aBottomP2, aBottomP1 );
+ }
+ }
+ aStripeBottom.InvertNormal(true);
+
+ Stripe aStripe1( aTopP2, aTopP1, aBottomP1, aBottomP2 );
+ Stripe aStripe2( aTopP3, aTopP2, aBottomP2, aBottomP3 );
+ Stripe aStripe3( aTopP4, aTopP3, aBottomP3, aBottomP4 );
+ Stripe aStripe4( aTopP1, aTopP4, aBottomP4, aBottomP1 );
+
+ if( bInvertPolygon )
+ {
+ aStripe1 = Stripe( aBottomP1, aTopP1, aTopP2, aBottomP2 );
+ aStripe2 = Stripe( aBottomP2, aTopP2, aTopP3, aBottomP3 );
+ aStripe3 = Stripe( aBottomP3, aTopP3, aTopP4, aBottomP4 );
+ aStripe4 = Stripe( aBottomP4, aTopP4, aTopP1, aBottomP1 );
+ }
+
+ Stripe aNormalsStripe1( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP2, aNormalsTopP2 );
+ Stripe aNormalsStripe2( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP3, aNormalsTopP3 );
+ Stripe aNormalsStripe3( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP4, aNormalsTopP4 );
+ Stripe aNormalsStripe4( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP1, aNormalsTopP1 );
+
+ if( bInvertNormals )
+ {
+ aNormalsStripe1 = Stripe( aNormalsTopP2, aNormalsBottomP2, aNormalsBottomP1, aNormalsTopP1 );
+ aNormalsStripe2 = Stripe( aNormalsTopP3, aNormalsBottomP3, aNormalsBottomP2, aNormalsTopP2 );
+ aNormalsStripe3 = Stripe( aNormalsTopP4, aNormalsBottomP4, aNormalsBottomP3, aNormalsTopP3 );
+ aNormalsStripe4 = Stripe( aNormalsTopP1, aNormalsBottomP1, aNormalsBottomP4, aNormalsTopP4 );
+ }
+
+ aStripe1.SetManualNormal( aNormalsStripe1.getNormal() );
+ aStripe2.SetManualNormal( aNormalsStripe2.getNormal() );
+ aStripe3.SetManualNormal( aNormalsStripe3.getNormal() );
+ aStripe4.SetManualNormal( aNormalsStripe4.getNormal() );
+
+ const bool bFlatNormals = false;
+ ShapeFactory::createStripe( xGroup, aStripe1, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripe2, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripe3, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripe4, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+ ShapeFactory::createStripe( xGroup, aStripeBottom, xSourceProp, rPropertyNameMap, bDoubleSided, nRotatedTexture, bFlatNormals );
+
+ return Reference< drawing::XShape >( xGroup, uno::UNO_QUERY );
}
uno::Reference<drawing::XShape>
@@ -585,7 +713,7 @@ uno::Reference<drawing::XShape>
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree )
{
- return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree, CHART_3DOBJECT_SEGMENTCOUNT );
+ return impl_createConeOrCylinder( xTarget, rPosition, rSize, fTopHeight, nRotateZAngleHundredthDegree );
}
uno::Reference<drawing::XShape>
@@ -593,7 +721,6 @@ uno::Reference<drawing::XShape>
const uno::Reference<drawing::XShapes>& xTarget
, const drawing::Position3D& rPosition, const drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree
- , sal_Int32 nSegments
, bool bCylinder )
{
if( !xTarget.is() )
@@ -605,19 +732,8 @@ uno::Reference<drawing::XShape>
"com.sun.star.drawing.Shape3DLatheObject") ), uno::UNO_QUERY );
xTarget->add(xShape);
-
- double fYRotateAnglePi = -ZDIRECTION*(F_PI/2.0 - F_PI/(double)nSegments); // alwayas rotate edge to front (important for pyramids)
- //or: ZDIRECTION*(F_PI/2.0 - F_PI/(double)nSegments); // rotate edge to front for even segment count otherwise rotate corner to front
- double fAngle = fYRotateAnglePi;
- {
- while(fAngle<0.0)
- fAngle+=F_PI/2.0;
- while(fAngle>F_PI/2.0)
- fAngle-=F_PI/2.0;
- }
double fWidth = rSize.DirectionX/2.0; //The depth will be corrrected within Matrix
double fRadius = fWidth; //!!!!!!!! problem in drawing layer: rotation object calculates wrong needed size -> wrong camera (it's a problem with bounding boxes)
-// double fRadius = fWidth/cos(fAngle); llllllllllllllllllll
double fHeight = rSize.DirectionY;
//set properties
@@ -635,15 +751,14 @@ uno::Reference<drawing::XShape>
//Polygon
sal_Int32 nVerticalSegmentCount = 0;
uno::Any aPPolygon = bCylinder ? createPolyPolygon_Cylinder(
- fHeight, fRadius, double(nPercentDiagonal)/200.0, nVerticalSegmentCount)
+ fHeight, fRadius, nVerticalSegmentCount)
: createPolyPolygon_Cone(
- fHeight, fRadius, fTopHeight, double(nPercentDiagonal)/200.0, nVerticalSegmentCount);
+ fHeight, fRadius, fTopHeight, nVerticalSegmentCount);
xProp->setPropertyValue( C2U( UNO_NAME_3D_POLYPOLYGON3D ), aPPolygon );
//Matrix for position
{
::basegfx::B3DHomMatrix aM;
- //aM.RotateY( fYRotateAnglePi );
if(nRotateZAngleHundredthDegree!=0)
aM.rotate(0.0,0.0,-nRotateZAngleHundredthDegree/18000.00*F_PI);
//stretch the symmetric objects to given depth
@@ -656,7 +771,7 @@ uno::Reference<drawing::XShape>
//Segments
xProp->setPropertyValue( C2U( UNO_NAME_3D_HORZ_SEGS )
- , uno::makeAny(nSegments) );
+ , uno::makeAny(CHART_3DOBJECT_SEGMENTCOUNT) );
xProp->setPropertyValue( C2U( UNO_NAME_3D_VERT_SEGS )
, uno::makeAny((sal_Int32)nVerticalSegmentCount) );//depends on point count of the used polygon
@@ -1021,7 +1136,8 @@ uno::Reference< drawing::XShape >
, const uno::Reference< beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap
, sal_Bool bDoubleSided
- , bool bRotatedTexture )
+ , short nRotatedTexture
+ , bool bFlatNormals )
{
if( !xTarget.is() )
return 0;
@@ -1045,16 +1161,15 @@ uno::Reference< drawing::XShape >
//TexturePolygon
xProp->setPropertyValue( C2U( UNO_NAME_3D_TEXTUREPOLYGON3D )
- , rStripe.getTexturePolygon( bRotatedTexture ) );
-
+ , rStripe.getTexturePolygon( nRotatedTexture ) );
//Normals Polygon
xProp->setPropertyValue( C2U( UNO_NAME_3D_NORMALSPOLYGON3D )
, rStripe.getNormalsPolygon() );
-
//NormalsKind
- xProp->setPropertyValue( C2U( UNO_NAME_3D_NORMALS_KIND )
- , uno::makeAny( drawing::NormalsKind_FLAT ) );
+ if(bFlatNormals)
+ xProp->setPropertyValue( C2U( UNO_NAME_3D_NORMALS_KIND )
+ , uno::makeAny( drawing::NormalsKind_FLAT ) );
//LineOnly
xProp->setPropertyValue( C2U( UNO_NAME_3D_LINEONLY )
diff --git a/chart2/source/view/main/Stripe.cxx b/chart2/source/view/main/Stripe.cxx
index 7f282e3d5559..2df78e2a8e91 100644
--- a/chart2/source/view/main/Stripe.cxx
+++ b/chart2/source/view/main/Stripe.cxx
@@ -48,8 +48,9 @@ Stripe::Stripe( const drawing::Position3D& rPoint1
, m_aPoint2(rPoint1+rDirectionToPoint2)
, m_aPoint3(m_aPoint2+rDirectionToPoint4)
, m_aPoint4(rPoint1+rDirectionToPoint4)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
{
-
}
Stripe::Stripe( const drawing::Position3D& rPoint1
@@ -59,12 +60,13 @@ Stripe::Stripe( const drawing::Position3D& rPoint1
, m_aPoint2(rPoint2)
, m_aPoint3(rPoint2)
, m_aPoint4(rPoint1)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
{
m_aPoint3.PositionZ += fDepth;
m_aPoint4.PositionZ += fDepth;
}
-/*
Stripe::Stripe( const drawing::Position3D& rPoint1
, const drawing::Position3D& rPoint2
, const drawing::Position3D& rPoint3
@@ -73,10 +75,21 @@ Stripe::Stripe( const drawing::Position3D& rPoint1
, m_aPoint2(rPoint2)
, m_aPoint3(rPoint3)
, m_aPoint4(rPoint4)
+ , m_bInvertNormal(false)
+ , m_bManualNormalSet(false)
+{
+}
+
+void Stripe::SetManualNormal( const drawing::Direction3D& rNormal )
{
+ m_aManualNormal = rNormal;
+ m_bManualNormalSet = true;
+}
+void Stripe::InvertNormal( bool bInvertNormal )
+{
+ m_bInvertNormal = bInvertNormal;
}
-*/
uno::Any Stripe::getPolyPolygonShape3D() const
{
@@ -119,12 +132,28 @@ uno::Any Stripe::getPolyPolygonShape3D() const
drawing::Direction3D Stripe::getNormal() const
{
- ::basegfx::B3DPolygon aPolygon3D;
- aPolygon3D.append(Position3DToB3DPoint( m_aPoint1 ));
- aPolygon3D.append(Position3DToB3DPoint( m_aPoint2 ));
- aPolygon3D.append(Position3DToB3DPoint( m_aPoint3 ));
- ::basegfx::B3DVector aNormal(::basegfx::tools::getNormal(aPolygon3D));
- return B3DVectorToDirection3D(aNormal);
+ drawing::Direction3D aRet(1.0,0.0,0.0);
+
+ if( m_bManualNormalSet )
+ aRet = m_aManualNormal;
+ else
+ {
+ ::basegfx::B3DPolygon aPolygon3D;
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint1 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint2 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint3 ));
+ aPolygon3D.append(Position3DToB3DPoint( m_aPoint4 ));
+ ::basegfx::B3DVector aNormal(::basegfx::tools::getNormal(aPolygon3D));
+ aRet = B3DVectorToDirection3D(aNormal);
+ }
+
+ if( m_bInvertNormal )
+ {
+ aRet.DirectionX *= -1.0;
+ aRet.DirectionY *= -1.0;
+ aRet.DirectionZ *= -1.0;
+ }
+ return aRet;
}
uno::Any Stripe::getNormalsPolygon() const
@@ -158,7 +187,7 @@ uno::Any Stripe::getNormalsPolygon() const
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
}
-uno::Any Stripe::getTexturePolygon( bool bRotatedTexture ) const
+uno::Any Stripe::getTexturePolygon( short nRotatedTexture ) const
{
drawing::PolyPolygonShape3D aPP;
@@ -178,26 +207,124 @@ uno::Any Stripe::getTexturePolygon( bool bRotatedTexture ) const
double* pInnerSequenceY = pOuterSequenceY->getArray();
double* pInnerSequenceZ = pOuterSequenceZ->getArray();
- if( !bRotatedTexture )
+ if( nRotatedTexture==0 )
{
*pInnerSequenceX++ = 0.0;
*pInnerSequenceY++ = 0.0;
*pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==1 )
+ {
*pInnerSequenceX++ = 1.0;
*pInnerSequenceY++ = 0.0;
*pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==2 )
+ {
*pInnerSequenceX++ = 1.0;
*pInnerSequenceY++ = 1.0;
*pInnerSequenceZ++ = 0.0;
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
*pInnerSequenceX++ = 0.0;
*pInnerSequenceY++ = 1.0;
*pInnerSequenceZ++ = 0.0;
}
- else
+ else if( nRotatedTexture==3 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==4 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==5 )
+ {
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==6 )
{
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 0.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
+
*pInnerSequenceX++ = 1.0;
*pInnerSequenceY++ = 0.0;
*pInnerSequenceZ++ = 0.0;
@@ -205,6 +332,12 @@ uno::Any Stripe::getTexturePolygon( bool bRotatedTexture ) const
*pInnerSequenceX++ = 1.0;
*pInnerSequenceY++ = 1.0;
*pInnerSequenceZ++ = 0.0;
+ }
+ else if( nRotatedTexture==7 )
+ {
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 1.0;
+ *pInnerSequenceZ++ = 0.0;
*pInnerSequenceX++ = 0.0;
*pInnerSequenceY++ = 1.0;
@@ -213,6 +346,10 @@ uno::Any Stripe::getTexturePolygon( bool bRotatedTexture ) const
*pInnerSequenceX++ = 0.0;
*pInnerSequenceY++ = 0.0;
*pInnerSequenceZ++ = 0.0;
+
+ *pInnerSequenceX++ = 1.0;
+ *pInnerSequenceY++ = 0.0;
+ *pInnerSequenceZ++ = 0.0;
}
return uno::Any( &aPP, ::getCppuType((const drawing::PolyPolygonShape3D*)0) );
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index c94193c5a7c8..8bb6a11b4baf 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -734,10 +734,10 @@ double VDataSeries::getYMeanValue() const
{
if( xProp->getPropertyValue( C2U( "Symbol" ) ) >>= *apSymbolProps )
{
- // border of symbols always black
- apSymbolProps->BorderColor = 0x000000;
//use main color to fill symbols
xProp->getPropertyValue( C2U( "Color" ) ) >>= apSymbolProps->FillColor;
+ // border of symbols always same as fill color
+ apSymbolProps->BorderColor = apSymbolProps->FillColor;
}
else
apSymbolProps.reset();
diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx
index 1b6abd9bb812..f0bcc12c0440 100644
--- a/chart2/source/view/main/VLegend.cxx
+++ b/chart2/source/view/main/VLegend.cxx
@@ -258,10 +258,11 @@ void lcl_placeLegendEntries(
double fViewFontSize = lcl_CalcViewFontSize( xProperties, rPageSize );
// padding as percentage of the font height
- double fXPadding = (1.0 / 5.0);
- double fYPadding = (1.0 / 3.0);
- double fXOffset = (1.0 / 5.0);
- double fYOffset = (1.0 / 5.0);
+ // #i109336# Improve auto positioning in chart
+ double fXPadding = 0.1;
+ double fYPadding = 0.2;
+ double fXOffset = 0.15;
+ double fYOffset = 0.15;
const sal_Int32 nXPadding = static_cast< sal_Int32 >( fViewFontSize * fXPadding );
const sal_Int32 nYPadding = static_cast< sal_Int32 >( fViewFontSize * fYPadding );
@@ -273,8 +274,11 @@ void lcl_placeLegendEntries(
rEntries, xShapeFactory, xTarget, aTextShapes, rTextProperties );
OSL_ASSERT( aTextShapes.size() == rEntries.size());
- awt::Size aMaxSymbolExtent( static_cast< sal_Int32 >( fViewFontSize * 3.0 / 2.0 ),
- static_cast< sal_Int32 >( fViewFontSize ));
+ // #i109336# Improve auto positioning in chart
+ double fSymbolSizeFraction = 0.8;
+ awt::Size aMaxSymbolExtent( static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction * 3.0 / 2.0 ),
+ static_cast< sal_Int32 >( fViewFontSize * fSymbolSizeFraction ) );
+
sal_Int32 nCurrentXPos = nXPadding;
sal_Int32 nCurrentYPos = nYPadding;
sal_Int32 nMaxEntryWidth = 2 * nXOffset + aMaxSymbolExtent.Width + aMaxEntryExtent.Width;
@@ -391,8 +395,13 @@ void lcl_placeLegendEntries(
sal_Int32 nSymbolXPos = nCurrentXPos + ((aMaxSymbolExtent.Width - aSymbolSize.Width) / 2);
if( !bSymbolsLeftSide )
nSymbolXPos = nSymbolXPos - aMaxSymbolExtent.Width;
- xSymbol->setPosition( awt::Point( nSymbolXPos,
- nCurrentYPos + ((aMaxSymbolExtent.Height - aSymbolSize.Height) / 2)));
+
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nTextHeight = nMaxHeights[ nRow ] - nYOffset;
+ sal_Int32 nFontSize = static_cast< sal_Int32 >( fViewFontSize );
+ sal_Int32 nMaxRowHeight = ( ( ( nTextHeight / nFontSize ) <= 1 ) ? nTextHeight : nFontSize );
+ sal_Int32 nSymbolYPos = nCurrentYPos + ( ( nMaxRowHeight - aSymbolSize.Height ) / 2 );
+ xSymbol->setPosition( awt::Point( nSymbolXPos, nSymbolYPos ) );
}
// position text shape
@@ -435,37 +444,60 @@ void lcl_placeLegendEntries(
rOutLegendSize.Height = nMaxYPos + nYPadding;
}
-double lcl_getPageLayoutDistancePercentage()
+// #i109336# Improve auto positioning in chart
+sal_Int32 lcl_getLegendLeftRightMargin()
{
- return 0.02;
+ return 210; // 1/100 mm
+}
+
+// #i109336# Improve auto positioning in chart
+sal_Int32 lcl_getLegendTopBottomMargin()
+{
+ return 185; // 1/100 mm
}
chart2::RelativePosition lcl_getDefaultPosition( LegendPosition ePos, const awt::Rectangle& rOutAvailableSpace, const awt::Size & rPageSize )
{
- // shift legend about 2% of page size into the primary direction by default
- const double fDefaultDistance = lcl_getPageLayoutDistancePercentage();
chart2::RelativePosition aResult;
switch( ePos )
{
case LegendPosition_LINE_START:
- aResult = chart2::RelativePosition(
- fDefaultDistance, 0.5, drawing::Alignment_LEFT );
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendLeftRightMargin() ) /
+ static_cast< double >( rPageSize.Width ) );
+ aResult = chart2::RelativePosition(
+ fDefaultDistance, 0.5, drawing::Alignment_LEFT );
+ }
break;
case LegendPosition_LINE_END:
- aResult = chart2::RelativePosition(
- 1.0 - fDefaultDistance, 0.5, drawing::Alignment_RIGHT );
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendLeftRightMargin() ) /
+ static_cast< double >( rPageSize.Width ) );
+ aResult = chart2::RelativePosition(
+ 1.0 - fDefaultDistance, 0.5, drawing::Alignment_RIGHT );
+ }
break;
case LegendPosition_PAGE_START:
{
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendTopBottomMargin() ) /
+ static_cast< double >( rPageSize.Height ) );
double fDistance = (static_cast<double>(rOutAvailableSpace.Y)/static_cast<double>(rPageSize.Height)) + fDefaultDistance;
aResult = chart2::RelativePosition(
0.5, fDistance, drawing::Alignment_TOP );
}
break;
case LegendPosition_PAGE_END:
- aResult = chart2::RelativePosition(
- 0.5, 1.0 - fDefaultDistance, drawing::Alignment_BOTTOM );
+ {
+ // #i109336# Improve auto positioning in chart
+ const double fDefaultDistance = ( static_cast< double >( lcl_getLegendTopBottomMargin() ) /
+ static_cast< double >( rPageSize.Height ) );
+ aResult = chart2::RelativePosition(
+ 0.5, 1.0 - fDefaultDistance, drawing::Alignment_BOTTOM );
+ }
break;
case LegendPosition_CUSTOM:
@@ -498,31 +530,34 @@ awt::Point lcl_calculatePositionAndRemainingSpace(
aResult, aLegendSize, aRelPos.Anchor );
// adapt rRemainingSpace if LegendPosition is not CUSTOM
- sal_Int32 nYDistance = static_cast<sal_Int32>(rPageSize.Height*lcl_getPageLayoutDistancePercentage());
- sal_Int32 nXDistance = static_cast<sal_Int32>(rPageSize.Width*lcl_getPageLayoutDistancePercentage());
- rRemainingSpace.Width-=nXDistance;
- rRemainingSpace.Height-=nYDistance;
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nXDistance = lcl_getLegendLeftRightMargin();
+ sal_Int32 nYDistance = lcl_getLegendTopBottomMargin();
switch( ePos )
{
case LegendPosition_LINE_START:
- {
- sal_Int32 nExtent = aLegendSize.Width;
- rRemainingSpace.Width -= nExtent;
- rRemainingSpace.X += ( nExtent + nXDistance );
- }
+ {
+ sal_Int32 nExtent = aLegendSize.Width;
+ rRemainingSpace.Width -= ( nExtent + nXDistance );
+ rRemainingSpace.X += ( nExtent + nXDistance );
+ }
break;
case LegendPosition_LINE_END:
- rRemainingSpace.Width -= ( aLegendSize.Width );
+ {
+ rRemainingSpace.Width -= ( aLegendSize.Width + nXDistance );
+ }
break;
case LegendPosition_PAGE_START:
- {
- sal_Int32 nExtent = aLegendSize.Height;
- rRemainingSpace.Height -= nExtent;
- rRemainingSpace.Y += ( nExtent + nYDistance );
- }
+ {
+ sal_Int32 nExtent = aLegendSize.Height;
+ rRemainingSpace.Height -= ( nExtent + nYDistance );
+ rRemainingSpace.Y += ( nExtent + nYDistance );
+ }
break;
case LegendPosition_PAGE_END:
- rRemainingSpace.Height -= ( aLegendSize.Height );
+ {
+ rRemainingSpace.Height -= ( aLegendSize.Height + nYDistance );
+ }
break;
default:
@@ -672,8 +707,9 @@ void VLegend::createShapes(
tPropertyValues aLineFillProperties;
tPropertyValues aTextProperties;
- // limit the width of texts to 20% of the total available width
- sal_Int32 nMaxLabelWidth = rAvailableSpace.Width / 5;
+ // limit the width of texts to 30% of the total available width
+ // #i109336# Improve auto positioning in chart
+ sal_Int32 nMaxLabelWidth = rAvailableSpace.Width * 3 / 10;
Reference< beans::XPropertySet > xLegendProp( m_xLegend, uno::UNO_QUERY );
LegendExpansion eExpansion = LegendExpansion_HIGH;
if( xLegendProp.is())
diff --git a/chart2/source/view/main/VLegendSymbolFactory.cxx b/chart2/source/view/main/VLegendSymbolFactory.cxx
index 682ff7fb7a5b..958a8defe0b6 100644
--- a/chart2/source/view/main/VLegendSymbolFactory.cxx
+++ b/chart2/source/view/main/VLegendSymbolFactory.cxx
@@ -85,6 +85,16 @@ void lcl_setPropetiesToShape(
::chart::tNameSequence aPropNames;
::chart::tAnySequence aPropValues;
::chart::PropertyMapper::getMultiPropertyListsFromValueMap( aPropNames, aPropValues, aValueMap );
+
+ uno::Any* pLineWidthAny = ::chart::PropertyMapper::getValuePointer(aPropValues,aPropNames,C2U("LineWidth"));
+ sal_Int32 nLineWidth = 0;
+ if( pLineWidthAny && (*pLineWidthAny>>=nLineWidth) )
+ {
+ const sal_Int32 nMaxLineWidthForLegend = 50;/*1/100 mm*///todo: make this dependent from legend entry height
+ if( nLineWidth>nMaxLineWidthForLegend )
+ *pLineWidthAny = uno::makeAny( nMaxLineWidthForLegend );
+ }
+
::chart::PropertyMapper::setMultiProperties( aPropNames, aPropValues, xShapeProp );
}
}
@@ -316,10 +326,10 @@ Reference< drawing::XShape > VLegendSymbolFactory::createSymbol(
ShapeFactory aFactory( xShapeFactory );
if( aSymbol.Style == chart2::SymbolStyle_STANDARD )
{
- // border of symbols always black
- aSymbol.BorderColor = 0x000000;
// take series color as fill color
xLegendEntryProperties->getPropertyValue( C2U("Color")) >>= aSymbol.FillColor;
+ // border of symbols always same as fill color
+ aSymbol.BorderColor = aSymbol.FillColor;
xSymbol.set( aFactory.createSymbol2D(
xResultGroup,
diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx
index f804a505219f..f62142735b7c 100644
--- a/chart2/source/view/main/VTitle.cxx
+++ b/chart2/source/view/main/VTitle.cxx
@@ -253,6 +253,21 @@ void VTitle::createShapes(
}
}
+ // #i109336# Improve auto positioning in chart
+ float fFontHeight = 0.0;
+ if ( xShapeProp.is() && ( xShapeProp->getPropertyValue( C2U( "CharHeight" ) ) >>= fFontHeight ) )
+ {
+ fFontHeight *= ( 2540. / 72. ); // pt -> 1/100 mm
+ float fXFraction = 0.18;
+ sal_Int32 nXDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fXFraction ) );
+ float fYFraction = 0.30;
+ sal_Int32 nYDistance = static_cast< sal_Int32 >( ::rtl::math::round( fFontHeight * fYFraction ) );
+ xShapeProp->setPropertyValue( C2U( "TextLeftDistance" ), uno::makeAny( nXDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextRightDistance" ), uno::makeAny( nXDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextUpperDistance" ), uno::makeAny( nYDistance ) );
+ xShapeProp->setPropertyValue( C2U( "TextLowerDistance" ), uno::makeAny( nYDistance ) );
+ }
+
try
{
double fAngleDegree = 0;