ooo-build r15297 - in trunk: . patches/dev300
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15297 - in trunk: . patches/dev300
- Date: Thu, 5 Feb 2009 21:32:49 +0000 (UTC)
Author: kyoshida
Date: Thu Feb 5 21:32:49 2009
New Revision: 15297
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15297&view=rev
Log:
2009-02-05 Kohei Yoshida <kyoshida novell com>
* patches/dev300/chart-axis-multi-chart-types-xmloff.diff:
* patches/dev300/chart-axis-multi-chart-types-chart2.diff:
* patches/dev300/apply: fixed a regression where it was impossible to
create new percent-stacked charts. Note that I still need to support
saving of charts with mixed stack modes, because the current ODF format
only allows a single stack mode per diagram. Because of this, when you
import an xls chart with mixed stack modes and save it to ODF, you'll
lose that information. (n#472264)
Added:
trunk/patches/dev300/chart-axis-multi-chart-types-xmloff.diff
Modified:
trunk/ChangeLog
trunk/patches/dev300/apply
trunk/patches/dev300/chart-axis-multi-chart-types-chart2.diff
Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply (original)
+++ trunk/patches/dev300/apply Thu Feb 5 21:32:49 2009
@@ -804,6 +804,7 @@
# render charts with multiple chart types correctly for xls interop.
chart-axis-multi-chart-types-chart2.diff, n#437322, i#95934, kohei
chart-axis-multi-chart-types-sc.diff, n#437322, i#95934, kohei
+chart-axis-multi-chart-types-xmloff.diff, n#437322, i#95934, kohei
# When filtering by date, strip off the time element from each value.
calc-filter-by-date-strip-time.diff, n#414303, i#94695, kohei
Modified: trunk/patches/dev300/chart-axis-multi-chart-types-chart2.diff
==============================================================================
--- trunk/patches/dev300/chart-axis-multi-chart-types-chart2.diff (original)
+++ trunk/patches/dev300/chart-axis-multi-chart-types-chart2.diff Thu Feb 5 21:32:49 2009
@@ -1,5 +1,270 @@
+diff --git chart2/source/model/template/AreaChartType.cxx chart2/source/model/template/AreaChartType.cxx
+index db529a7..3a562f0 100644
+--- chart2/source/model/template/AreaChartType.cxx
++++ chart2/source/model/template/AreaChartType.cxx
+@@ -33,8 +33,72 @@
+ #include "AreaChartType.hxx"
+ #include "macros.hxx"
+ #include "servicenames_charttypes.hxx"
++#include "PropertyHelper.hxx"
++#include "ContainerHelper.hxx"
++
++#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+ using namespace ::com::sun::star;
++using ::com::sun::star::beans::Property;
++using ::com::sun::star::uno::Sequence;
++
++namespace
++{
++
++enum
++{
++ PROP_AREACHARTTYPE_STACKED,
++ PROP_AREACHARTTYPE_PERCENT
++};
++
++void lcl_AddPropertiesToVector(
++ ::std::vector< Property > & rOutProperties )
++{
++ rOutProperties.push_back(
++ Property( C2U( "Stacked" ),
++ PROP_AREACHARTTYPE_STACKED,
++ ::getBooleanCppuType(),
++ beans::PropertyAttribute::BOUND
++ | beans::PropertyAttribute::MAYBEDEFAULT ));
++ rOutProperties.push_back(
++ Property( C2U( "Percent" ),
++ PROP_AREACHARTTYPE_PERCENT,
++ ::getBooleanCppuType(),
++ beans::PropertyAttribute::BOUND
++ | beans::PropertyAttribute::MAYBEDEFAULT ));
++}
++
++void lcl_AddDefaultsToMap(
++ ::chart::tPropertyValueMap & rOutMap )
++{
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AREACHARTTYPE_STACKED, false );
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AREACHARTTYPE_PERCENT, false );
++}
++
++const Sequence< Property > & lcl_GetPropertySequence()
++{
++ static Sequence< Property > aPropSeq;
++
++ // /--
++ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
++ if( 0 == aPropSeq.getLength() )
++ {
++ // get properties
++ ::std::vector< ::com::sun::star::beans::Property > aProperties;
++ lcl_AddPropertiesToVector( aProperties );
++
++ // and sort them for access via bsearch
++ ::std::sort( aProperties.begin(), aProperties.end(),
++ ::chart::PropertyNameLess() );
++
++ // transfer result to static Sequence
++ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
++ }
++
++ return aPropSeq;
++}
++
++} // anonymous namespace
+
+ namespace chart
+ {
+@@ -65,6 +129,56 @@ uno::Reference< util::XCloneable > SAL_CALL AreaChartType::createClone()
+ return CHART2_SERVICE_NAME_CHARTTYPE_AREA;
+ }
+
++// ____ OPropertySet ____
++uno::Any AreaChartType::GetDefaultValue( sal_Int32 nHandle ) const
++ throw(beans::UnknownPropertyException)
++{
++ static tPropertyValueMap aStaticDefaults;
++
++ // /--
++ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
++ if( 0 == aStaticDefaults.size() )
++ {
++ // initialize defaults
++ lcl_AddDefaultsToMap( aStaticDefaults );
++ }
++
++ tPropertyValueMap::const_iterator aFound(
++ aStaticDefaults.find( nHandle ));
++
++ if( aFound == aStaticDefaults.end())
++ return uno::Any();
++
++ return (*aFound).second;
++ // \--
++}
++
++::cppu::IPropertyArrayHelper & SAL_CALL AreaChartType::getInfoHelper()
++{
++ static ::cppu::OPropertyArrayHelper aArrayHelper( lcl_GetPropertySequence(),
++ /* bSorted = */ sal_True );
++
++ return aArrayHelper;
++}
++
++// ____ XPropertySet ____
++uno::Reference< beans::XPropertySetInfo > SAL_CALL AreaChartType::getPropertySetInfo()
++ throw (uno::RuntimeException)
++{
++ static uno::Reference< beans::XPropertySetInfo > xInfo;
++
++ // /--
++ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
++ if( !xInfo.is())
++ {
++ xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo(
++ getInfoHelper());
++ }
++
++ return xInfo;
++ // \--
++}
++
+ uno::Sequence< ::rtl::OUString > AreaChartType::getSupportedServiceNames_Static()
+ {
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+diff --git chart2/source/model/template/AreaChartType.hxx chart2/source/model/template/AreaChartType.hxx
+index 6b619b2..778f936 100644
+--- chart2/source/model/template/AreaChartType.hxx
++++ chart2/source/model/template/AreaChartType.hxx
+@@ -56,6 +56,16 @@ protected:
+ virtual ::rtl::OUString SAL_CALL getChartType()
+ throw (::com::sun::star::uno::RuntimeException);
+
++ // ____ OPropertySet ____
++ virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
++ throw(::com::sun::star::beans::UnknownPropertyException);
++ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
++
++ // ____ XPropertySet ____
++ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
++ getPropertySetInfo()
++ throw (::com::sun::star::uno::RuntimeException);
++
+ // ____ XCloneable ____
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
+ throw (::com::sun::star::uno::RuntimeException);
+diff --git chart2/source/model/template/AreaChartTypeTemplate.cxx chart2/source/model/template/AreaChartTypeTemplate.cxx
+index 98874ef..f7d24a5 100644
+--- chart2/source/model/template/AreaChartTypeTemplate.cxx
++++ chart2/source/model/template/AreaChartTypeTemplate.cxx
+@@ -48,6 +48,8 @@ using ::com::sun::star::beans::Property;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Any;
++using ::com::sun::star::uno::UNO_QUERY;
++using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::osl::MutexGuard;
+
+ namespace
+@@ -275,6 +277,7 @@ Reference< chart2::XChartType > SAL_CALL AreaChartTypeTemplate::getChartTypeForN
+ {
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/BarChartTypeTemplate.cxx chart2/source/model/template/BarChartTypeTemplate.cxx
+index e6382d5..0e5904d 100644
+--- chart2/source/model/template/BarChartTypeTemplate.cxx
++++ chart2/source/model/template/BarChartTypeTemplate.cxx
+@@ -221,6 +221,7 @@ Reference< chart2::XChartType > SAL_CALL BarChartTypeTemplate::getChartTypeForNe
+ {
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/ChartTypeTemplate.cxx chart2/source/model/template/ChartTypeTemplate.cxx
+index 3e9be6e..2b7aa35 100644
+--- chart2/source/model/template/ChartTypeTemplate.cxx
++++ chart2/source/model/template/ChartTypeTemplate.cxx
+@@ -63,6 +63,7 @@ using ::rtl::OUString;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Any;
++using ::com::sun::star::uno::UNO_QUERY;
+
+ // ======================================================================
+
+@@ -968,6 +969,48 @@ void ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(
+ comphelper::copyProperties( xSource, xDestination );
+ }
+
++void ChartTypeTemplate::setStackModePropertiesToChartType(const Reference<XChartType>& xChartType)
++{
++ Reference<beans::XPropertySet> xPropSet(xChartType, UNO_QUERY);
++ if (!xPropSet.is())
++ return;
++
++ bool bStacked = false;
++ bool bPercent = false;
++ switch (getStackMode(0))
++ {
++ case StackMode_Y_STACKED:
++ bStacked = true;
++ break;
++ case StackMode_Y_STACKED_PERCENT:
++ bStacked = true;
++ bPercent = true;
++ break;
++ case StackMode_Z_STACKED:
++ break;
++ default:
++ ;
++ }
++
++ try
++ {
++ xPropSet->setPropertyValue(
++ C2U("Stacked"), uno::makeAny(static_cast<sal_Bool>(bStacked)));
++ }
++ catch (const beans::UnknownPropertyException&)
++ {
++ }
++
++ try
++ {
++ xPropSet->setPropertyValue(
++ C2U("Percent"), uno::makeAny(static_cast<sal_Bool>(bPercent)));
++ }
++ catch (const beans::UnknownPropertyException&)
++ {
++ }
++}
++
+ // ________
+
+ Sequence< OUString > ChartTypeTemplate::getSupportedServiceNames_Static()
+diff --git chart2/source/model/template/ChartTypeTemplate.hxx chart2/source/model/template/ChartTypeTemplate.hxx
+index 47633ad..57d78d4 100644
+--- chart2/source/model/template/ChartTypeTemplate.hxx
++++ chart2/source/model/template/ChartTypeTemplate.hxx
+@@ -272,6 +272,11 @@ protected:
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartType > & xNewChartType );
+
++ void setStackModePropertiesToChartType(
++ const ::com::sun::star::uno::Reference<
++ ::com::sun::star::chart2::XChartType>& xChartType );
++
++
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
diff --git chart2/source/model/template/ColumnChartType.cxx chart2/source/model/template/ColumnChartType.cxx
-index ed5aea8..8613b95 100644
+index ed5aea8..a326aa4 100644
--- chart2/source/model/template/ColumnChartType.cxx
+++ chart2/source/model/template/ColumnChartType.cxx
@@ -49,7 +49,9 @@ namespace
@@ -33,8 +298,30 @@
}
void lcl_AddDefaultsToMap(
+@@ -80,6 +95,9 @@ void lcl_AddDefaultsToMap(
+
+ aSeq[0] = aSeq[1] = 100;
+ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_GAPWIDTH_SEQUENCE, aSeq );
++
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_STACKED, false );
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_BARCHARTTYPE_PERCENT, false );
+ }
+
+ const Sequence< Property > & lcl_GetPropertySequence()
+diff --git chart2/source/model/template/ColumnLineChartTypeTemplate.cxx chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+index 54e7ea8..4d92176 100644
+--- chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
++++ chart2/source/model/template/ColumnLineChartTypeTemplate.cxx
+@@ -410,6 +410,7 @@ Reference< XChartType > SAL_CALL ColumnLineChartTypeTemplate::getChartTypeForNew
+ ASSERT_EXCEPTION( ex );
+ }
+
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
diff --git chart2/source/model/template/LineChartType.cxx chart2/source/model/template/LineChartType.cxx
-index 05f6b43..6ee1151 100644
+index 05f6b43..274abb0 100644
--- chart2/source/model/template/LineChartType.cxx
+++ chart2/source/model/template/LineChartType.cxx
@@ -54,7 +54,9 @@ enum
@@ -68,6 +355,76 @@
}
void lcl_AddDefaultsToMap(
+@@ -90,6 +105,9 @@ void lcl_AddDefaultsToMap(
+ // todo: check whether order 3 means polygons of order 3 or 2. (see
+ // http://www.people.nnov.ru/fractal/Splines/Basis.htm )
+ ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINECHARTTYPE_SPLINE_ORDER, 3 );
++
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_STACKED, false );
++ ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINECHARTTYPE_PERCENT, false );
+ }
+
+ const Sequence< Property > & lcl_GetPropertySequence()
+diff --git chart2/source/model/template/LineChartTypeTemplate.cxx chart2/source/model/template/LineChartTypeTemplate.cxx
+index 746920a..eb08a53 100644
+--- chart2/source/model/template/LineChartTypeTemplate.cxx
++++ chart2/source/model/template/LineChartTypeTemplate.cxx
+@@ -348,6 +348,7 @@ Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForN
+ ASSERT_EXCEPTION( ex );
+ }
+
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/NetChartTypeTemplate.cxx chart2/source/model/template/NetChartTypeTemplate.cxx
+index ea85c9c..f13db16 100644
+--- chart2/source/model/template/NetChartTypeTemplate.cxx
++++ chart2/source/model/template/NetChartTypeTemplate.cxx
+@@ -183,6 +183,7 @@ Reference< chart2::XChartType > SAL_CALL NetChartTypeTemplate::getChartTypeForNe
+ {
+ Reference< chart2::XChartType > xResult( getChartTypeForIndex( 0 ) );
+ ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem( aFormerlyUsedChartTypes, xResult );
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/PieChartTypeTemplate.cxx chart2/source/model/template/PieChartTypeTemplate.cxx
+index 8df8ce9..dbce73d 100644
+--- chart2/source/model/template/PieChartTypeTemplate.cxx
++++ chart2/source/model/template/PieChartTypeTemplate.cxx
+@@ -475,6 +475,7 @@ Reference< chart2::XChartType > SAL_CALL PieChartTypeTemplate::getChartTypeForNe
+ ASSERT_EXCEPTION( ex );
+ }
+
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/ScatterChartTypeTemplate.cxx chart2/source/model/template/ScatterChartTypeTemplate.cxx
+index 2b67f37..62d0a77 100644
+--- chart2/source/model/template/ScatterChartTypeTemplate.cxx
++++ chart2/source/model/template/ScatterChartTypeTemplate.cxx
+@@ -387,6 +387,7 @@ Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeF
+ ASSERT_EXCEPTION( ex );
+ }
+
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
+diff --git chart2/source/model/template/StockChartTypeTemplate.cxx chart2/source/model/template/StockChartTypeTemplate.cxx
+index 43cc054..0d090a5 100644
+--- chart2/source/model/template/StockChartTypeTemplate.cxx
++++ chart2/source/model/template/StockChartTypeTemplate.cxx
+@@ -528,6 +528,7 @@ Reference< XChartType > SAL_CALL StockChartTypeTemplate::getChartTypeForNewSerie
+ ASSERT_EXCEPTION( ex );
+ }
+
++ setStackModePropertiesToChartType(xResult);
+ return xResult;
+ }
+
diff --git chart2/source/view/axes/ScaleAutomatism.cxx chart2/source/view/axes/ScaleAutomatism.cxx
index 3e412c4..c151ce0 100644
--- chart2/source/view/axes/ScaleAutomatism.cxx
@@ -238,10 +595,10 @@
{
double fMinY, fMaxY;
diff --git chart2/source/view/main/ChartView.cxx chart2/source/view/main/ChartView.cxx
-index 0433596..1a74dbe 100644
+index 0357b26..639b4ec 100644
--- chart2/source/view/main/ChartView.cxx
+++ chart2/source/view/main/ChartView.cxx
-@@ -1723,7 +1723,15 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
+@@ -1735,7 +1735,15 @@ sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
if( nDimensionIndex == 0 )
aRoleToMatch = C2U("values-x");
Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes());
Added: trunk/patches/dev300/chart-axis-multi-chart-types-xmloff.diff
==============================================================================
--- (empty file)
+++ trunk/patches/dev300/chart-axis-multi-chart-types-xmloff.diff Thu Feb 5 21:32:49 2009
@@ -0,0 +1,83 @@
+diff --git xmloff/source/chart/SchXMLChartContext.cxx xmloff/source/chart/SchXMLChartContext.cxx
+index 510d366..3824e67 100644
+--- xmloff/source/chart/SchXMLChartContext.cxx
++++ xmloff/source/chart/SchXMLChartContext.cxx
+@@ -71,13 +71,17 @@
+ #include <com/sun/star/chart2/data/XDataSink.hpp>
+ #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+ #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
++#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+ #include <com/sun/star/chart2/XChartTypeContainer.hpp>
++#include <com/sun/star/chart2/XChartType.hpp>
+ #include <com/sun/star/chart2/XTitled.hpp>
+
+ using namespace com::sun::star;
+ using namespace ::xmloff::token;
+ using ::rtl::OUString;
+ using com::sun::star::uno::Reference;
++using ::com::sun::star::uno::Sequence;
++using ::com::sun::star::uno::UNO_QUERY;
+ using namespace ::SchXMLTools;
+
+ namespace
+@@ -706,6 +710,48 @@ void SchXMLChartContext::ChangeDiagramAccordingToTemplate(
+ xTemplate->changeDiagramData( xNewDia, xDataSource, aArgs );
+ }
+
++static void lcl_setStackTypeToAllChartTypes(
++ const Reference<chart2::XDiagram>& rDiagram, const uno::Any& rStacked, const uno::Any& rPercent)
++{
++ Reference<chart2::XCoordinateSystemContainer> xCoordContainer(rDiagram, uno::UNO_QUERY);
++ if (!xCoordContainer.is())
++ return;
++
++ Sequence< Reference<chart2::XCoordinateSystem> > xCoords = xCoordContainer->getCoordinateSystems();
++
++ sal_Int32 n = xCoords.getLength();
++ if (!n)
++ return;
++
++ for (sal_Int32 i = 0; i < n; ++i)
++ {
++ Reference<chart2::XChartTypeContainer> xChartTypeContainer(xCoords[i], UNO_QUERY);
++ if (!xChartTypeContainer.is())
++ continue;
++
++ Sequence< Reference<chart2::XChartType> > xChartTypes = xChartTypeContainer->getChartTypes();
++ sal_Int32 nChartTypeCount = xChartTypes.getLength();
++ for (sal_Int32 j = 0; j < nChartTypeCount; ++j)
++ {
++ Reference<beans::XPropertySet> xProp(xChartTypes[j], UNO_QUERY);
++ if (!xProp.is())
++ continue;
++
++ try
++ {
++ if (rStacked.hasValue())
++ xProp->setPropertyValue(OUString::createFromAscii("Stacked"), rStacked);
++ if (rPercent.hasValue())
++ xProp->setPropertyValue(OUString::createFromAscii("Percent"), rPercent);
++ }
++ catch (const beans::UnknownPropertyException&)
++ {
++ // fail silently.
++ }
++ }
++ }
++}
++
+ void SchXMLChartContext::EndElement()
+ {
+ uno::Reference< chart::XChartDocument > xDoc = mrImportHelper.GetChartDocument();
+@@ -869,6 +915,11 @@ void SchXMLChartContext::EndElement()
+ , SchXMLSeriesHelper::getDataSeriesIndexMapFromDiagram(xNewDiagram) );
+ }
+
++ // For now, set the diagram's stack-related properties to all included
++ // chart types until we support chart types of mixed stack states.
++ lcl_setStackTypeToAllChartTypes(
++ xNewDoc->getFirstDiagram(), maSeriesDefaultsAndStyles.maStackedDefault, maSeriesDefaultsAndStyles.maPercentDefault);
++
+ SchXMLSeries2Context::initSeriesPropertySets( maSeriesDefaultsAndStyles, uno::Reference< frame::XModel >(xDoc, uno::UNO_QUERY ) );
+
+ //set defaults from diagram to the new series:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]