[Libreoffice-commits] core.git: Branch 'private/kohei/new-chart-type-skeleton' - 198 commits - android/abs-lib android/Bootstrap android/experimental avmedia/inc avmedia/Library_avmediaogl.mk avmedia/Library_avmediavlc.mk avmedia/Module_avmedia.mk avmedia/source basctl/source basegfx/Library_basegfx.mk basegfx/source basic/inc basic/source canvas/source chart2/inc chart2/Library_chartcontroller.mk chart2/qa chart2/source comphelper/source compilerplugins/clang connectivity/source cui/source cui/uiconfig dbaccess/qa dbaccess/source desktop/inc desktop/source drawinglayer/source editeng/source extensions/source filter/source forms/source formula/source fpicker/source framework/source i18npool/source include/avmedia include/basegfx include/basic include/comphelper include/connectivity include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/framework include/oox include/sal include/sfx2 include/sot include/svl include/svx include/tools include/u notools include/vbahelper include/vcl include/xmloff include/xmlscript ios/Module_ios.mk linguistic/source lotuswordpro/source officecfg/registry oox/source postprocess/Rdb_services.mk reportdesign/inc reportdesign/source Repository.mk sal/rtl scaddins/source sc/inc sc/qa scripting/source sc/source sd/inc sd/qa sd/sdi sd/source sd/uiconfig sfx2/inc sfx2/qa sfx2/sdi sfx2/source shell/source slideshow/source solenv/bin sot/source starmath/inc starmath/qa starmath/source store/workben svgio/source svl/CppunitTest_svl_inetcontenttype.mk svl/Module_svl.mk svl/qa svl/source svtools/source svx/inc svx/source sw/inc sw/Library_sw.mk sw/qa sw/sdi sw/source sw/uiconfig test/source toolkit/source tools/source unotools/source unusedcode.easy vbahelper/source vcl/generic vcl/inc vcl/Library_vclplug_gtk3.mk vcl/source vcl/unx vcl/win writerfilter/inc writerfilter/qa writerfilter/source writerperfect/source xmloff/source xmlscript/source xmlsecurity/inc xmlsecurity/source
Kohei Yoshida
kohei.yoshida at collabora.com
Fri Mar 28 21:49:30 PDT 2014
Rebased ref, commits from common ancestor:
commit fbf0c095648f37705e440ee66fe13395a07e2f2d
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Wed Mar 26 11:11:49 2014 -0400
Re-enable the new chart type.
Change-Id: If060d101c4a8f2486d3532f4048f9042df0cd204
diff --git a/chart2/source/inc/macros.hxx b/chart2/source/inc/macros.hxx
index 21e5911..2319afe 100644
--- a/chart2/source/inc/macros.hxx
+++ b/chart2/source/inc/macros.hxx
@@ -30,7 +30,7 @@
typeid( ex ).name() << ", Message: " << \
ex.Message )
-#define ENABLE_GL3D_BARCHART 0
+#define ENABLE_GL3D_BARCHART 1
#endif
commit ffaf640b734885d2844a99cc1fd61c8a6a1d663b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Mar 28 12:29:13 2014 -0400
Add API wrapper to handle properties of new GL3D chart type.
Now the new proprety gets properly imported and exported to and from ODF.
Also, more on replacing string literals with define macro constants.
Change-Id: I4b773d68610a8aeaeb239901dac166e4dc2dd80d
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 86c2a04..b32d840 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -75,6 +75,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcontroller,\
chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty \
chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties \
chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty \
+ chart2/source/controller/chartapiwrapper/WrappedGL3DProperties \
chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty \
chart2/source/controller/chartapiwrapper/WrappedScaleProperty \
chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties \
diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index a02ba61..9f9d1cb 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -15,6 +15,8 @@
#define CHART_UNONAME_SPLINE_TYPE "SplineType"
#define CHART_UNONAME_SPLINE_ORDER "SplineOrder"
#define CHART_UNONAME_SPLINE_RESOLUTION "SplineResolution"
+#define CHART_UNONAME_CURVE_STYLE "CurveStyle"
+#define CHART_UNONAME_CURVE_RESOLUTION "CurveResolution"
#endif
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 984a2ef..cb95fd6 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -39,6 +39,7 @@
#include "WrappedSplineProperties.hxx"
#include "WrappedStockProperties.hxx"
#include "WrappedSceneProperty.hxx"
+#include "WrappedGL3DProperties.hxx"
#include "RelativePositionHelper.hxx"
#include "ContainerHelper.hxx"
#include "ControllerLockGuard.hxx"
@@ -471,6 +472,7 @@ private:
WrappedSplineProperties::addProperties( aProperties );
WrappedStockProperties::addProperties( aProperties );
WrappedAutomaticPositionProperties::addProperties( aProperties );
+ WrappedGL3DProperties::addProperties(aProperties);
::std::sort( aProperties.begin(), aProperties.end(),
::chart::PropertyNameLess() );
@@ -2045,6 +2047,7 @@ const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+ WrappedGL3DProperties::addWrappedProperties(aWrappedProperties, m_spChart2ModelContact);
aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) );
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx
new file mode 100644
index 0000000..a4beaf5
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.cxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "WrappedGL3DProperties.hxx"
+#include "Chart2ModelContact.hxx"
+#include <unonames.hxx>
+#include <WrappedProperty.hxx>
+#include <DiagramHelper.hxx>
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+using namespace com::sun::star;
+
+namespace chart { namespace wrapper {
+
+namespace {
+
+enum
+{
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE
+};
+
+class WrappedGL3DProperty : public WrappedProperty
+{
+ uno::Any maDefault;
+ boost::shared_ptr<Chart2ModelContact> mpModelContact;
+
+private:
+ uno::Reference<chart2::XChartType> getChartType() const
+ {
+ uno::Reference<chart2::XDiagram> xDiagram = mpModelContact->getChart2Diagram();
+ uno::Sequence<uno::Reference<chart2::XChartType> > aCTs =
+ DiagramHelper::getChartTypesFromDiagram(xDiagram);
+
+ for (sal_Int32 i = 0; i < aCTs.getLength(); ++i)
+ {
+ uno::Reference<chart2::XChartType> xThisCT = aCTs[i];
+ if (xThisCT->getChartType() == "com.sun.star.chart2.GL3DBarChartType")
+ // Found the right chart type.
+ return xThisCT;
+ }
+
+ return uno::Reference<chart2::XChartType>();
+ }
+
+public:
+ WrappedGL3DProperty( const OUString& rInName, const OUString& rOutName, const uno::Any& rDefault, const boost::shared_ptr<Chart2ModelContact>& pContact ) :
+ WrappedProperty(rInName, rOutName), maDefault(rDefault), mpModelContact(pContact) {}
+
+ virtual ~WrappedGL3DProperty() {}
+
+ virtual uno::Any getPropertyValue( const uno::Reference<beans::XPropertySet>& /*xInnerPS*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ uno::Reference<chart2::XChartType> xCT = getChartType();
+ if (!xCT.is())
+ return uno::Any();
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
+ return xPS->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE);
+ }
+ catch ( const uno::Exception& ) {}
+
+ return uno::Any();
+ };
+
+ virtual void setPropertyValue(
+ const uno::Any& rOutValue, const uno::Reference<beans::XPropertySet>& /*xInnerPS*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+ {
+ uno::Reference<chart2::XChartType> xCT = getChartType();
+ if (!xCT.is())
+ return;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
+ return xPS->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, rOutValue);
+ }
+ catch ( const uno::Exception& ) {}
+ }
+
+ virtual void setPropertyToDefault( const uno::Reference<beans::XPropertyState>& /*xInnerPropState*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+ {
+ uno::Reference<chart2::XChartType> xCT = getChartType();
+ if (!xCT.is())
+ return;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPS(xCT, uno::UNO_QUERY_THROW);
+ return xPS->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, maDefault);
+ }
+ catch ( const uno::Exception& ) {}
+ }
+
+ virtual uno::Any getPropertyDefault( const uno::Reference<beans::XPropertyState>& /*xInnerPS*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+ {
+ return maDefault;
+ }
+
+ virtual beans::PropertyState getPropertyState( const uno::Reference<beans::XPropertyState>& /*xInnerPS*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+ {
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+};
+
+}
+
+void WrappedGL3DProperties::addProperties( std::vector<css::beans::Property> & rOutProps )
+{
+ rOutProps.push_back(
+ beans::Property(
+ CHART_UNONAME_ROUNDED_EDGE,
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT
+ )
+ );
+}
+
+void WrappedGL3DProperties::addWrappedProperties(
+ std::vector<WrappedProperty*>& rList, const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact )
+{
+ rList.push_back(
+ new WrappedGL3DProperty(
+ CHART_UNONAME_ROUNDED_EDGE, CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(false), pChart2ModelContact));
+}
+
+}}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx
new file mode 100644
index 0000000..90034a0
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGL3DProperties.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CHART2_WRAPPEDGL3DPROPERTIES_HXX
+#define CHART2_WRAPPEDGL3DPROPERTIES_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+#include <com/sun/star/beans/Property.hpp>
+
+namespace chart {
+
+class WrappedProperty;
+
+namespace wrapper {
+
+class Chart2ModelContact;
+
+class WrappedGL3DProperties
+{
+public:
+ static void addProperties( std::vector<css::beans::Property> & rOutProps );
+ static void addWrappedProperties(
+ std::vector<WrappedProperty*>& rList, const boost::shared_ptr<Chart2ModelContact>& pChart2ModelContact );
+};
+
+}}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index 4adf8ea..13cb3cf 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -212,16 +212,16 @@ void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty
rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) );
rList.push_back(
new WrappedSplineProperty<sal_Int32>(
- CHART_UNONAME_SPLINE_ORDER, "SplineOrder", // same name ?
+ CHART_UNONAME_SPLINE_ORDER, CHART_UNONAME_SPLINE_ORDER,
uno::makeAny(sal_Int32(3)), spChart2ModelContact));
rList.push_back(
new WrappedSplineProperty<sal_Int32>(
- CHART_UNONAME_SPLINE_RESOLUTION, "CurveResolution",
+ CHART_UNONAME_SPLINE_RESOLUTION, CHART_UNONAME_CURVE_RESOLUTION,
uno::makeAny(sal_Int32(20)), spChart2ModelContact));
}
WrappedSplineTypeProperty::WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
- : WrappedSplineProperty<sal_Int32>(CHART_UNONAME_SPLINE_TYPE, "CurveStyle", uno::makeAny(sal_Int32(0)), spChart2ModelContact )
+ : WrappedSplineProperty<sal_Int32>(CHART_UNONAME_SPLINE_TYPE, CHART_UNONAME_CURVE_STYLE, uno::makeAny(sal_Int32(0)), spChart2ModelContact )
{
}
WrappedSplineTypeProperty::~WrappedSplineTypeProperty()
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index c31ffc8..ee1d899 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -146,9 +146,9 @@ ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
{
try
{
- xTemplateProps->getPropertyValue( "CurveStyle" ) >>= aRet.eCurveStyle;
- xTemplateProps->getPropertyValue( "CurveResolution" ) >>= aRet.nCurveResolution;
- xTemplateProps->getPropertyValue( "SplineOrder" ) >>= aRet.nSplineOrder;
+ xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_STYLE ) >>= aRet.eCurveStyle;
+ xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_RESOLUTION ) >>= aRet.nCurveResolution;
+ xTemplateProps->getPropertyValue( CHART_UNONAME_SPLINE_ORDER ) >>= aRet.nSplineOrder;
}
catch( uno::Exception & ex )
{
@@ -291,9 +291,9 @@ uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTempla
{
try
{
- xTemplateProps->setPropertyValue( "CurveStyle" , uno::makeAny(rParameter.eCurveStyle) );
- xTemplateProps->setPropertyValue( "CurveResolution" , uno::makeAny(rParameter.nCurveResolution) );
- xTemplateProps->setPropertyValue( "SplineOrder" , uno::makeAny(rParameter.nSplineOrder) );
+ xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_STYLE , uno::makeAny(rParameter.eCurveStyle) );
+ xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_RESOLUTION , uno::makeAny(rParameter.nCurveResolution) );
+ xTemplateProps->setPropertyValue( CHART_UNONAME_SPLINE_ORDER , uno::makeAny(rParameter.nSplineOrder) );
}
catch( uno::Exception & ex )
{
diff --git a/chart2/source/model/template/LineChartType.cxx b/chart2/source/model/template/LineChartType.cxx
index 7733ed5..d1b9185 100644
--- a/chart2/source/model/template/LineChartType.cxx
+++ b/chart2/source/model/template/LineChartType.cxx
@@ -22,6 +22,8 @@
#include "macros.hxx"
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
+#include <unonames.hxx>
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
@@ -47,20 +49,20 @@ void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
- Property( "CurveStyle",
+ Property( CHART_UNONAME_CURVE_STYLE,
PROP_LINECHARTTYPE_CURVE_STYLE,
::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "CurveResolution",
+ Property( CHART_UNONAME_CURVE_RESOLUTION,
PROP_LINECHARTTYPE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "SplineOrder",
+ Property( CHART_UNONAME_SPLINE_ORDER,
PROP_LINECHARTTYPE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 14ba91c..591f259 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -23,10 +23,12 @@
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <unonames.hxx>
+
#include <com/sun/star/chart2/SymbolStyle.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include "PropertyHelper.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <algorithm>
@@ -54,19 +56,19 @@ void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
- Property( "CurveStyle",
+ Property( CHART_UNONAME_CURVE_STYLE,
PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE,
::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "CurveResolution",
+ Property( CHART_UNONAME_CURVE_RESOLUTION,
PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "SplineOrder",
+ Property( CHART_UNONAME_SPLINE_ORDER,
PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
@@ -273,9 +275,9 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
uno::Reference< beans::XPropertySet > xChartTypeProp(
DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
uno::UNO_QUERY_THROW );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue("CurveStyle") );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue("CurveResolution") );
- setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue("SplineOrder") );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
+ setFastPropertyValue_NoBroadcast( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
}
catch( const uno::Exception & ex )
{
@@ -301,11 +303,11 @@ Reference< chart2::XChartType > LineChartTypeTemplate::getChartTypeForIndex( sal
if( xCTProp.is())
{
xCTProp->setPropertyValue(
- "CurveStyle", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
xCTProp->setPropertyValue(
- "CurveResolution", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
xCTProp->setPropertyValue(
- "SplineOrder", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
}
catch( const uno::Exception & ex )
@@ -335,11 +337,11 @@ Reference< chart2::XChartType > SAL_CALL LineChartTypeTemplate::getChartTypeForN
if( xCTProp.is())
{
xCTProp->setPropertyValue(
- "CurveStyle", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_STYLE ));
xCTProp->setPropertyValue(
- "CurveResolution", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
xCTProp->setPropertyValue(
- "SplineOrder", getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_LINECHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
}
catch( const uno::Exception & ex )
diff --git a/chart2/source/model/template/ScatterChartType.cxx b/chart2/source/model/template/ScatterChartType.cxx
index 9f33147..7d83da3 100644
--- a/chart2/source/model/template/ScatterChartType.cxx
+++ b/chart2/source/model/template/ScatterChartType.cxx
@@ -25,6 +25,8 @@
#include "CartesianCoordinateSystem.hxx"
#include "AxisHelper.hxx"
#include "AxisIndexDefines.hxx"
+#include <unonames.hxx>
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/AxisType.hpp>
#include <com/sun/star/chart2/CurveStyle.hpp>
@@ -51,20 +53,20 @@ void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
- Property( "CurveStyle",
+ Property( CHART_UNONAME_CURVE_STYLE,
PROP_SCATTERCHARTTYPE_CURVE_STYLE,
::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "CurveResolution",
+ Property( CHART_UNONAME_CURVE_RESOLUTION,
PROP_SCATTERCHARTTYPE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "SplineOrder",
+ Property( CHART_UNONAME_SPLINE_ORDER,
PROP_SCATTERCHARTTYPE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index c1f8682..371e2a4 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -25,10 +25,12 @@
#include "servicenames_charttypes.hxx"
#include "ContainerHelper.hxx"
#include "DataSeriesHelper.hxx"
+#include "PropertyHelper.hxx"
+#include <unonames.hxx>
+
#include <com/sun/star/chart2/SymbolStyle.hpp>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/drawing/LineStyle.hpp>
-#include "PropertyHelper.hxx"
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <algorithm>
@@ -56,19 +58,19 @@ void lcl_AddPropertiesToVector(
::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
- Property( "CurveStyle",
+ Property( CHART_UNONAME_CURVE_STYLE,
PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE,
::getCppuType( reinterpret_cast< const chart2::CurveStyle * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "CurveResolution",
+ Property( CHART_UNONAME_CURVE_RESOLUTION,
PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "SplineOrder",
+ Property( CHART_UNONAME_SPLINE_ORDER,
PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER,
::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
@@ -307,9 +309,9 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
uno::Reference< beans::XPropertySet > xChartTypeProp(
DiagramHelper::getChartTypeByIndex( xDiagram, 0 ),
uno::UNO_QUERY_THROW );
- setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue("CurveStyle") );
- setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue("CurveResolution") );
- setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue("SplineOrder") );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_STYLE) );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION, xChartTypeProp->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) );
+ setFastPropertyValue_NoBroadcast( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER, xChartTypeProp->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) );
}
catch( const uno::Exception & ex )
{
@@ -335,11 +337,11 @@ Reference< chart2::XChartType > ScatterChartTypeTemplate::getChartTypeForIndex(
if( xCTProp.is())
{
xCTProp->setPropertyValue(
- "CurveStyle", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
xCTProp->setPropertyValue(
- "CurveResolution", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
xCTProp->setPropertyValue(
- "SplineOrder", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
}
catch( const uno::Exception & ex )
@@ -369,11 +371,11 @@ Reference< chart2::XChartType > SAL_CALL ScatterChartTypeTemplate::getChartTypeF
if( xCTProp.is())
{
xCTProp->setPropertyValue(
- "CurveStyle", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
+ CHART_UNONAME_CURVE_STYLE, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_STYLE ));
xCTProp->setPropertyValue(
- "CurveResolution", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
+ CHART_UNONAME_CURVE_RESOLUTION, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_CURVE_RESOLUTION ));
xCTProp->setPropertyValue(
- "SplineOrder", getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
+ CHART_UNONAME_SPLINE_ORDER, getFastPropertyValue( PROP_SCATTERCHARTTYPE_TEMPLATE_SPLINE_ORDER ));
}
}
catch( const uno::Exception & ex )
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 2cc53b6..ce557ad 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -30,6 +30,7 @@
#include "Clipping.hxx"
#include "Stripe.hxx"
#include "DateHelper.hxx"
+#include <unonames.hxx>
#include <com/sun/star/chart2/Symbol.hpp>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -76,9 +77,9 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
{
if( m_xChartTypeModelProps.is() )
{
- m_xChartTypeModelProps->getPropertyValue("CurveStyle") >>= m_eCurveStyle;
- m_xChartTypeModelProps->getPropertyValue("CurveResolution") >>= m_nCurveResolution;
- m_xChartTypeModelProps->getPropertyValue("SplineOrder") >>= m_nSplineOrder;
+ m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_STYLE) >>= m_eCurveStyle;
+ m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_CURVE_RESOLUTION) >>= m_nCurveResolution;
+ m_xChartTypeModelProps->getPropertyValue(CHART_UNONAME_SPLINE_ORDER) >>= m_nSplineOrder;
}
}
catch( uno::Exception& e )
commit de7c0f31b5773296c8af6692e7155119209d07ef
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Mar 28 12:11:43 2014 -0400
Let's use define constants here rather than string values....
Easier to keep track of their call sites.
Change-Id: I5f874194425ae8f5043bef45cce63a5e1d51a400
diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
index 6f800f8..a02ba61 100644
--- a/chart2/inc/unonames.hxx
+++ b/chart2/inc/unonames.hxx
@@ -10,8 +10,11 @@
#ifndef CHART2_UNONAMES_HXX
#define CHART2_UNONAMES_HXX
-#define CHART_UNONAME_SORT_BY_XVALUES "SortByXValues"
-#define CHART_UNONAME_ROUNDED_EDGE "RoundedEdge"
+#define CHART_UNONAME_SORT_BY_XVALUES "SortByXValues"
+#define CHART_UNONAME_ROUNDED_EDGE "RoundedEdge"
+#define CHART_UNONAME_SPLINE_TYPE "SplineType"
+#define CHART_UNONAME_SPLINE_ORDER "SplineOrder"
+#define CHART_UNONAME_SPLINE_RESOLUTION "SplineResolution"
#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
index 3edef79..4adf8ea 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -21,6 +21,8 @@
#include "macros.hxx"
#include "FastPropertyIdRanges.hxx"
#include "DiagramHelper.hxx"
+#include <unonames.hxx>
+
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -182,21 +184,21 @@ enum
void WrappedSplineProperties::addProperties( ::std::vector< Property > & rOutProperties )
{
rOutProperties.push_back(
- Property( "SplineType",
+ Property( CHART_UNONAME_SPLINE_TYPE,
PROP_CHART_SPLINE_TYPE,
::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT
| beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
- Property( "SplineOrder",
+ Property( CHART_UNONAME_SPLINE_ORDER,
PROP_CHART_SPLINE_ORDER,
::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEDEFAULT
| beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
- Property( "SplineResolution",
+ Property( CHART_UNONAME_SPLINE_RESOLUTION,
PROP_CHART_SPLINE_RESOLUTION,
::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
beans::PropertyAttribute::BOUND
@@ -208,12 +210,18 @@ void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty
, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
{
rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) );
- rList.push_back( new WrappedSplineProperty<sal_Int32>( "SplineOrder", "SplineOrder", uno::makeAny(sal_Int32(3)), spChart2ModelContact ) );
- rList.push_back( new WrappedSplineProperty<sal_Int32>( "SplineResolution", "CurveResolution", uno::makeAny(sal_Int32(20)), spChart2ModelContact ) );
+ rList.push_back(
+ new WrappedSplineProperty<sal_Int32>(
+ CHART_UNONAME_SPLINE_ORDER, "SplineOrder", // same name ?
+ uno::makeAny(sal_Int32(3)), spChart2ModelContact));
+ rList.push_back(
+ new WrappedSplineProperty<sal_Int32>(
+ CHART_UNONAME_SPLINE_RESOLUTION, "CurveResolution",
+ uno::makeAny(sal_Int32(20)), spChart2ModelContact));
}
WrappedSplineTypeProperty::WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
- : WrappedSplineProperty<sal_Int32>( "SplineType", "CurveStyle", uno::makeAny(sal_Int32(0)), spChart2ModelContact )
+ : WrappedSplineProperty<sal_Int32>(CHART_UNONAME_SPLINE_TYPE, "CurveStyle", uno::makeAny(sal_Int32(0)), spChart2ModelContact )
{
}
WrappedSplineTypeProperty::~WrappedSplineTypeProperty()
commit 0be6a5ef376e1841bf60658b41d0f56d07caf2a3
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Mar 28 09:10:55 2014 -0400
Transfer back properties from the chart type object to template object.
Change-Id: I3484a2ae0141087835e34e4e174bdc24b3357854
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
index 163423a..2239997 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -125,6 +125,27 @@ uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForInde
return xResult;
}
+sal_Bool SAL_CALL GL3DBarChartTypeTemplate::matchesTemplate(
+ const css::uno::Reference<css::chart2::XDiagram>& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (css::uno::RuntimeException, std::exception)
+{
+ bool bResult = ChartTypeTemplate::matchesTemplate(xDiagram, bAdaptProperties);
+
+ if (bResult && bAdaptProperties)
+ {
+ uno::Reference<chart2::XChartType> xChartType = DiagramHelper::getChartTypeByIndex(xDiagram, 0);
+ uno::Reference<beans::XPropertySet> xPS(xChartType, uno::UNO_QUERY);
+ if (xPS.is())
+ {
+ setFastPropertyValue_NoBroadcast(
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE, xPS->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE));
+ }
+ }
+
+ return bResult;
+}
+
uno::Reference<chart2::XChartType>
GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& /*xOldChartTypes*/ )
throw (::css::uno::RuntimeException, ::std::exception)
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
index ba4943a..1651dec 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
@@ -38,6 +38,11 @@ public:
// XChartTypeTemplate
+ virtual sal_Bool SAL_CALL matchesTemplate(
+ const css::uno::Reference<css::chart2::XDiagram>& xDiagram,
+ sal_Bool bAdaptProperties )
+ throw (css::uno::RuntimeException, std::exception);
+
virtual css::uno::Reference<css::chart2::XChartType> SAL_CALL
getChartTypeForNewSeries( const css::uno::Sequence<css::uno::Reference<css::chart2::XChartType> >& xOldChartTypes )
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
commit cd1e89728218eeb1e6d478d9bd925e207cb83f0b
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Fri Mar 28 09:10:22 2014 -0400
Too long a line.
Change-Id: I0b8f1b3b55cf0374ce1ff81d7798ea60848208d4
diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx
index ea9a496..657225f 100644
--- a/chart2/source/controller/dialogs/dlg_ChartType.cxx
+++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx
@@ -43,7 +43,13 @@ ChartTypeDialog::ChartTypeDialog( Window* pParent
, m_xChartModel(xChartModel)
, m_xCC( xContext )
{
- m_pChartTypeTabPage = new ChartTypeTabPage(get_content_area(),uno::Reference< XChartDocument >::query(m_xChartModel),m_xCC,true/*live update*/,true/*hide title description*/);
+ m_pChartTypeTabPage = new ChartTypeTabPage(
+ get_content_area(),
+ uno::Reference<XChartDocument>::query(m_xChartModel),
+ m_xCC,
+ true/*live update*/,
+ true/*hide title description*/);
+
m_pChartTypeTabPage->initializePage();
m_pChartTypeTabPage->Show();
}
commit ef15c946998af91a88896d29903cb997a5e78ede
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Mar 27 22:04:28 2014 -0400
Trying to move this RoundedEdge property from Diagram to GL3DBarChartType.
Then things stop working. Go figure.
Change-Id: I38893b20104537a64d279063c7b7dd708efb0d2f
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 3160e3e..984a2ef 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -446,13 +446,6 @@ void lcl_AddPropertiesToVector(
::getCppuType( reinterpret_cast< const OUString * >(0)),
beans::PropertyAttribute::BOUND
| beans::PropertyAttribute::MAYBEVOID ));
-
- rOutProperties.push_back(
- Property( CHART_UNONAME_ROUNDED_EDGE,
- PROP_DIAGRAM_ROUNDED_EDGE,
- ::getCppuBooleanType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEVOID));
}
struct StaticDiagramWrapperPropertyArray_Initializer
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 031c468..c31ffc8 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -162,9 +162,15 @@ ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
}
catch( uno::Exception& ex )
{
- //not all templates need to support CGeometry3D
+ //not all templates need to support Geometry3D
ex.Context.is();//to have debug information without compilation warnings
}
+
+ try
+ {
+ xTemplateProps->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aRet.mbRoundedEdge;
+ }
+ catch ( const uno::Exception& ) {}
}
return aRet;
}
@@ -303,6 +309,15 @@ uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTempla
//not all templates need to support Geometry3D
ex.Context.is();//to have debug information without compilation warnings
}
+
+ try
+ {
+ xTemplateProps->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(rParameter.mbRoundedEdge));
+ }
+ catch ( const uno::Exception& )
+ {
+ }
+
try
{
this->setTemplateProperties( xTemplateProps );
@@ -343,7 +358,6 @@ bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame
if (xDiaProp.is())
{
xDiaProp->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::makeAny(rParameter.bSortByXValues));
- xDiaProp->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(rParameter.mbRoundedEdge));
}
}
return false;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 5e111b8..0e313b6 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -834,7 +834,6 @@ void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch ( const uno::Exception& ex )
{
@@ -901,7 +900,6 @@ void ChartTypeTabPage::selectMainType()
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch ( const uno::Exception& ex )
{
@@ -986,7 +984,6 @@ void ChartTypeTabPage::initializePage()
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch (const uno::Exception& ex)
{
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 6c75a3f..f6beaa4 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -77,8 +77,7 @@ enum
PROP_DIAGRAM_DATATABLEHBORDER,
PROP_DIAGRAM_DATATABLEVBORDER,
PROP_DIAGRAM_DATATABLEOUTLINE,
- PROP_DIAGRAM_EXTERNALDATA,
- PROP_DIAGRAM_ROUNDED_EDGE
+ PROP_DIAGRAM_EXTERNALDATA
};
void lcl_AddPropertiesToVector(
@@ -199,12 +198,6 @@ void lcl_AddPropertiesToVector(
PROP_DIAGRAM_EXTERNALDATA,
::getCppuType( reinterpret_cast< const OUString * >(0)),
beans::PropertyAttribute::MAYBEVOID ));
-
- rOutProperties.push_back(
- Property( CHART_UNONAME_ROUNDED_EDGE,
- PROP_DIAGRAM_ROUNDED_EDGE,
- ::getCppuBooleanType(),
- beans::PropertyAttribute::MAYBEVOID));
}
struct StaticDiagramDefaults_Initializer
@@ -227,7 +220,6 @@ private:
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEHBORDER, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEVBORDER, false );
::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_DATATABLEOUTLINE, false );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_DIAGRAM_ROUNDED_EDGE, false );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_STARTING_ANGLE, 90 );
::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_DIAGRAM_3DRELATIVEHEIGHT, 100 );
::chart::SceneProperties::AddDefaultsToMap( rOutMap );
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
index 7f07028..163423a 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.cxx
@@ -11,14 +11,90 @@
#include "GL3DBarChartType.hxx"
#include <servicenames_charttypes.hxx>
+#include <PropertyHelper.hxx>
+#include <DiagramHelper.hxx>
+#include <unonames.hxx>
#include <macros.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
using namespace com::sun::star;
namespace chart {
+namespace {
+
+enum
+{
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE
+};
+
+struct DefaultsInitializer
+{
+ tPropertyValueMap* operator()()
+ {
+ static tPropertyValueMap aStaticDefaults;
+
+ if (aStaticDefaults.empty())
+ addDefaults(aStaticDefaults);
+
+ return &aStaticDefaults;
+ }
+private:
+
+ void addDefaults( tPropertyValueMap & rOutMap )
+ {
+ PropertyHelper::setPropertyValueDefault(rOutMap, PROP_GL3DCHARTTYPE_ROUNDED_EDGE, false);
+ }
+};
+
+struct Defaults : public rtl::StaticAggregate<tPropertyValueMap, DefaultsInitializer> {};
+
+struct InfoHelperInitializer
+{
+ cppu::OPropertyArrayHelper* operator()()
+ {
+ static cppu::OPropertyArrayHelper aHelper(getProperties());
+ return &aHelper;
+ }
+
+ uno::Sequence<beans::Property> getProperties()
+ {
+ uno::Sequence<beans::Property> aRet(1);
+
+ aRet[0] = beans::Property(
+ CHART_UNONAME_ROUNDED_EDGE,
+ PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
+ ::getCppuBooleanType(),
+ beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
+
+ return aRet;
+ }
+};
+
+struct InfoHelper : public rtl::StaticAggregate<cppu::OPropertyArrayHelper, InfoHelperInitializer> {};
+
+struct ChartTypeInfoInitializer
+{
+ uno::Reference<beans::XPropertySetInfo>* operator()()
+ {
+ static uno::Reference<beans::XPropertySetInfo> xPropertySetInfo;
+
+ if (!xPropertySetInfo.is())
+ xPropertySetInfo = cppu::OPropertySetHelper::createPropertySetInfo(*InfoHelper::get());
+
+ return &xPropertySetInfo;
+ }
+};
+
+struct ChartTypeInfo : public rtl::StaticAggregate<uno::Reference<beans::XPropertySetInfo>, ChartTypeInfoInitializer> {};
+
+}
+
GL3DBarChartTypeTemplate::GL3DBarChartTypeTemplate(
const uno::Reference<uno::XComponentContext>& xContext, const OUString& rServiceName ) :
+ property::OPropertySet(m_aMutex),
ChartTypeTemplate(xContext, rServiceName) {}
GL3DBarChartTypeTemplate::~GL3DBarChartTypeTemplate() {}
@@ -33,6 +109,13 @@ uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForInde
GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
+
+ uno::Reference<beans::XPropertySet> xCTProp(xResult, uno::UNO_QUERY);
+ if (xCTProp.is())
+ {
+ xCTProp->setPropertyValue(
+ CHART_UNONAME_ROUNDED_EDGE, getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE));
+ }
}
catch (const uno::Exception & ex)
{
@@ -43,24 +126,29 @@ uno::Reference<chart2::XChartType> GL3DBarChartTypeTemplate::getChartTypeForInde
}
uno::Reference<chart2::XChartType>
-GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& xOldChartTypes )
+GL3DBarChartTypeTemplate::getChartTypeForNewSeries( const uno::Sequence<uno::Reference<chart2::XChartType> >& /*xOldChartTypes*/ )
throw (::css::uno::RuntimeException, ::std::exception)
{
uno::Reference<chart2::XChartType> xResult;
try
{
- uno::Reference<lang::XMultiServiceFactory> xFact(
- GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
-
#if 1
// I gave up trying to use UNO just to instantiate this little thing...
xResult.set(new GL3DBarChartType(GetComponentContext()));
+ uno::Reference<beans::XPropertySet> xCTProp(xResult, uno::UNO_QUERY);
+ if (xCTProp.is())
+ {
+ bool bVal = false;
+ getFastPropertyValue(PROP_GL3DCHARTTYPE_ROUNDED_EDGE) >>= bVal;
+ xCTProp->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(bVal));
+ }
#else
// This never works for me.
+ uno::Reference<lang::XMultiServiceFactory> xFact(
+ GetComponentContext()->getServiceManager(), uno::UNO_QUERY_THROW);
xResult.set(xFact->createInstance(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR), uno::UNO_QUERY_THROW);
#endif
- ChartTypeTemplate::copyPropertiesFromOldToNewCoordianteSystem(xOldChartTypes, xResult);
}
catch (const uno::Exception & ex)
{
@@ -76,6 +164,27 @@ sal_Bool GL3DBarChartTypeTemplate::supportsCategories()
return false;
}
+css::uno::Any GL3DBarChartTypeTemplate::GetDefaultValue( sal_Int32 nHandle ) const
+ throw (css::beans::UnknownPropertyException)
+{
+ const tPropertyValueMap& rDefaults = *Defaults::get();
+ tPropertyValueMap::const_iterator it = rDefaults.find(nHandle);
+ return it == rDefaults.end() ? uno::Any() : it->second;
+}
+
+cppu::IPropertyArrayHelper& GL3DBarChartTypeTemplate::getInfoHelper()
+{
+ return *InfoHelper::get();
+}
+
+css::uno::Reference<css::beans::XPropertySetInfo> GL3DBarChartTypeTemplate::getPropertySetInfo()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return *ChartTypeInfo::get();
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(GL3DBarChartTypeTemplate, ChartTypeTemplate, OPropertySet)
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
index 78e7a74..ba4943a 100644
--- a/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
+++ b/chart2/source/model/template/GL3DBarChartTypeTemplate.hxx
@@ -13,13 +13,20 @@
#include <MutexContainer.hxx>
#include <ChartTypeTemplate.hxx>
#include <OPropertySet.hxx>
+#include <MutexContainer.hxx>
#include <ServiceMacros.hxx>
+#include <comphelper/uno3.hxx>
+
namespace chart {
-class GL3DBarChartTypeTemplate : public ChartTypeTemplate
+class GL3DBarChartTypeTemplate :
+ public MutexContainer, public property::OPropertySet, public ChartTypeTemplate
{
public:
+
+ DECLARE_XINTERFACE()
+
GL3DBarChartTypeTemplate(
const css::uno::Reference<
css::uno::XComponentContext>& xContext,
@@ -37,6 +44,17 @@ public:
virtual sal_Bool SAL_CALL supportsCategories()
throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
+ // OPropertySet
+ virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
+ throw (css::beans::UnknownPropertyException);
+
+ virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // XPropertySet
+ virtual css::uno::Reference<css::beans::XPropertySetInfo> SAL_CALL
+ getPropertySetInfo()
+ throw (css::uno::RuntimeException, std::exception);
};
}
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 7b02bcc..62f189a 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -8,6 +8,7 @@
*/
#include "GL3DBarChart.hxx"
+#include <unonames.hxx>
#include <com/sun/star/chart2/data/XDataSequence.hpp>
#include <com/sun/star/chart2/data/LabelOrigin.hpp>
@@ -27,6 +28,18 @@ GL3DBarChart::~GL3DBarChart()
void GL3DBarChart::createShapes()
{
+ fprintf(stdout, "GL3DBarChart::createShapes: type = '%s'\n",
+ rtl::OUStringToOString(m_xChartTypeModel->getChartType(), RTL_TEXTENCODING_UTF8).getStr());
+
+ uno::Reference<beans::XPropertySet> xPropSet(m_xChartTypeModel, uno::UNO_QUERY);
+ if (xPropSet.is())
+ {
+ bool bRoundedEdge = false;
+ if (xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= bRoundedEdge)
+ fprintf(stdout, "GL3DBarChart::createShapes: rounded edge = %d (%p)\n", bRoundedEdge, m_xChartTypeModel.get());
+ }
+
+#if 0
if (m_pExplicitCategoriesProvider)
{
uno::Reference<chart2::data::XDataSequence> xCats = m_pExplicitCategoriesProvider->getOriginalCategories();
@@ -56,13 +69,11 @@ void GL3DBarChart::createShapes()
rtl::OUStringToOString(pSeries->getSeriesParticle(), RTL_TEXTENCODING_UTF8).getStr());
uno::Sequence<double> aXValues = pSeries->getAllX();
- for (size_t j = 0; j < aXValues.getLength(); ++j)
- fprintf(stdout, "GL3DBarChart::createShapes: x = %g\n", aXValues[j]);
-
uno::Sequence<double> aYValues = pSeries->getAllY();
- for (size_t j = 0; j < aYValues.getLength(); ++j)
- fprintf(stdout, "GL3DBarChart::createShapes: y = %g\n", aYValues[j]);
+ for (size_t j = 0; j < aXValues.getLength(); ++j)
+ fprintf(stdout, "GL3DBarChart::createShapes: (x=%g,y=%g)\n", aXValues[j], aYValues[j]);
}
+#endif
}
}
commit 91e1497abc4fd2817b56eb1e77ddd8fd2691a199
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Mar 27 15:34:27 2014 -0400
Some debugging output of GL chart.
Change-Id: Ia216358085378b449626f9c9f36e63a65b7a2669
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index bd0250b..7b02bcc 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -9,6 +9,11 @@
#include "GL3DBarChart.hxx"
+#include <com/sun/star/chart2/data/XDataSequence.hpp>
+#include <com/sun/star/chart2/data/LabelOrigin.hpp>
+
+using namespace com::sun::star;
+
namespace chart {
GL3DBarChart::GL3DBarChart( const css::uno::Reference<css::chart2::XChartType>& xChartTypeModel ) :
@@ -22,6 +27,42 @@ GL3DBarChart::~GL3DBarChart()
void GL3DBarChart::createShapes()
{
+ if (m_pExplicitCategoriesProvider)
+ {
+ uno::Reference<chart2::data::XDataSequence> xCats = m_pExplicitCategoriesProvider->getOriginalCategories();
+
+ OUString aSrcRange = xCats->getSourceRangeRepresentation();
+
+ fprintf(stdout, "GL3DBarChart::createShapes: source range = '%s'\n", rtl::OUStringToOString(aSrcRange, RTL_TEXTENCODING_UTF8).getStr());
+
+ uno::Sequence<OUString> aCats = m_pExplicitCategoriesProvider->getSimpleCategories();
+ for (sal_Int32 i = 0; i < aCats.getLength(); ++i)
+ fprintf(stdout, "GL3DBarChart::createShapes: category = '%s'\n", rtl::OUStringToOString(aCats[i], RTL_TEXTENCODING_UTF8).getStr());
+ }
+
+ uno::Sequence<OUString> aSeriesNames = getSeriesNames();
+ fprintf(stdout, "GL3DBarChart::createShapes: series name count = %d\n", aSeriesNames.getLength());
+ for (sal_Int32 i = 0; i < aSeriesNames.getLength(); ++i)
+ fprintf(stdout, "GL3DBarChart::createShapes: name = '%s'\n", rtl::OUStringToOString(aSeriesNames[i], RTL_TEXTENCODING_UTF8).getStr());
+
+ std::vector<VDataSeries*> aAllSeries = getAllSeries();
+ fprintf(stdout, "GL3DBarChart::createShapes: series count = %d\n", aAllSeries.size());
+ for (size_t i = 0, n = aAllSeries.size(); i < n; ++i)
+ {
+ const VDataSeries* pSeries = aAllSeries[i];
+ fprintf(stdout, "GL3DBarChart::createShapes: series %d: cid = '%s' particle = '%s'\n",
+ i,
+ rtl::OUStringToOString(pSeries->getCID(), RTL_TEXTENCODING_UTF8).getStr(),
+ rtl::OUStringToOString(pSeries->getSeriesParticle(), RTL_TEXTENCODING_UTF8).getStr());
+
+ uno::Sequence<double> aXValues = pSeries->getAllX();
+ for (size_t j = 0; j < aXValues.getLength(); ++j)
+ fprintf(stdout, "GL3DBarChart::createShapes: x = %g\n", aXValues[j]);
+
+ uno::Sequence<double> aYValues = pSeries->getAllY();
+ for (size_t j = 0; j < aYValues.getLength(); ++j)
+ fprintf(stdout, "GL3DBarChart::createShapes: y = %g\n", aYValues[j]);
+ }
}
}
commit 68e20faf3f05038301269870f61205785227450a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Mar 27 13:47:15 2014 -0400
Start using common symbols for textural UNO property names.
This will make it easier to track all uses of a UNO property name using
symbol database lookup, which is much faster and more accurate than grepping.
Change-Id: I8c2857504c29bcce01eb8c1f406dcbfb24331510
diff --git a/chart2/inc/unonames.hxx b/chart2/inc/unonames.hxx
new file mode 100644
index 0000000..6f800f8
--- /dev/null
+++ b/chart2/inc/unonames.hxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CHART2_UNONAMES_HXX
+#define CHART2_UNONAMES_HXX
+
+#define CHART_UNONAME_SORT_BY_XVALUES "SortByXValues"
+#define CHART_UNONAME_ROUNDED_EDGE "RoundedEdge"
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
index 5ea89aa..3160e3e 100644
--- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -47,6 +47,7 @@
#include <comphelper/InlineContainer.hxx>
#include "WrappedAutomaticPositionProperties.hxx"
#include "CommonConverters.hxx"
+#include <unonames.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
@@ -230,7 +231,7 @@ void lcl_AddPropertiesToVector(
//new for XY charts
rOutProperties.push_back(
- Property( "SortByXValues",
+ Property( CHART_UNONAME_SORT_BY_XVALUES,
PROP_DIAGRAM_SORT_BY_X_VALUES,
::getBooleanCppuType(),
beans::PropertyAttribute::BOUND
@@ -447,7 +448,7 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
- Property( "RoundedEdge",
+ Property( CHART_UNONAME_ROUNDED_EDGE,
PROP_DIAGRAM_ROUNDED_EDGE,
::getCppuBooleanType(),
beans::PropertyAttribute::BOUND
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 4ade1fd..031c468 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -27,6 +27,7 @@
#include "DiagramHelper.hxx"
#include "ControllerLockGuard.hxx"
#include "AxisHelper.hxx"
+#include <unonames.hxx>
#include <com/sun/star/chart2/DataPointGeometry3D.hpp>
#include <com/sun/star/chart2/PieChartOffsetMode.hpp>
@@ -341,8 +342,8 @@ bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame
uno::Reference<beans::XPropertySet> xDiaProp(xDiagram, uno::UNO_QUERY);
if (xDiaProp.is())
{
- xDiaProp->setPropertyValue("SortByXValues" , uno::makeAny(rParameter.bSortByXValues));
- xDiaProp->setPropertyValue("RoundedEdge", uno::makeAny(rParameter.mbRoundedEdge));
+ xDiaProp->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::makeAny(rParameter.bSortByXValues));
+ xDiaProp->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(rParameter.mbRoundedEdge));
}
}
return false;
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 104fe0e..5e111b8 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -26,6 +26,7 @@
#include "ControllerLockGuard.hxx"
#include "macros.hxx"
#include "GL3DBarChartDialogController.hxx"
+#include <unonames.hxx>
#include <svtools/controldims.hrc>
@@ -832,8 +833,8 @@ void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
try
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue("SortByXValues") >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue("RoundedEdge") >>= aParameter.mbRoundedEdge;
+ xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch ( const uno::Exception& ex )
{
@@ -899,8 +900,8 @@ void ChartTypeTabPage::selectMainType()
try
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue("SortByXValues") >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue("RoundedEdge") >>= aParameter.mbRoundedEdge;
+ xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch ( const uno::Exception& ex )
{
@@ -984,8 +985,8 @@ void ChartTypeTabPage::initializePage()
try
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
- xPropSet->getPropertyValue("SortByXValues") >>= aParameter.bSortByXValues;
- xPropSet->getPropertyValue("RoundedEdge") >>= aParameter.mbRoundedEdge;
+ xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
+ xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aParameter.mbRoundedEdge;
}
catch (const uno::Exception& ex)
{
diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx
index 157df26..6c75a3f 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -31,6 +31,8 @@
#include "SceneProperties.hxx"
#include "DisposeHelper.hxx"
#include "BaseGFXHelper.hxx"
+#include <unonames.hxx>
+
#include <basegfx/numeric/ftools.hxx>
#include <rtl/instance.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -104,7 +106,7 @@ void lcl_AddPropertiesToVector(
| beans::PropertyAttribute::MAYBEDEFAULT ));
rOutProperties.push_back(
- Property( "SortByXValues",
+ Property( CHART_UNONAME_SORT_BY_XVALUES,
PROP_DIAGRAM_SORT_BY_X_VALUES,
::getBooleanCppuType(),
beans::PropertyAttribute::BOUND
@@ -199,7 +201,7 @@ void lcl_AddPropertiesToVector(
beans::PropertyAttribute::MAYBEVOID ));
rOutProperties.push_back(
- Property( "RoundedEdge",
+ Property( CHART_UNONAME_ROUNDED_EDGE,
PROP_DIAGRAM_ROUNDED_EDGE,
::getCppuBooleanType(),
beans::PropertyAttribute::MAYBEVOID));
diff --git a/chart2/source/model/template/GL3DBarChartType.cxx b/chart2/source/model/template/GL3DBarChartType.cxx
index 4dc4e46..4e8868c 100644
--- a/chart2/source/model/template/GL3DBarChartType.cxx
+++ b/chart2/source/model/template/GL3DBarChartType.cxx
@@ -10,6 +10,7 @@
#include "GL3DBarChartType.hxx"
#include <servicenames_charttypes.hxx>
#include <PropertyHelper.hxx>
+#include <unonames.hxx>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -59,7 +60,7 @@ struct InfoHelperInitializer
uno::Sequence<beans::Property> aRet(1);
aRet[0] = beans::Property(
- "RoundedEdge",
+ CHART_UNONAME_ROUNDED_EDGE,
PROP_GL3DCHARTTYPE_ROUNDED_EDGE,
::getCppuBooleanType(),
beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT);
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 0490567..ae0929d 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -47,6 +47,7 @@
#include "DataSeriesHelper.hxx"
#include "DateHelper.hxx"
#include "defines.hxx"
+#include <unonames.hxx>
#include <rtl/uuid.h>
#include <comphelper/scopeguard.hxx>
@@ -141,7 +142,7 @@ void debugGL3DOutput( ChartModel& rModel )
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
bool bRoundedEdge = false;
- xPropSet->getPropertyValue("RoundedEdge") >>= bRoundedEdge;
+ xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= bRoundedEdge;
fprintf(stdout, "GL3D: rounded edge = %d\n", bRoundedEdge);
}
@@ -628,7 +629,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
try
{
uno::Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY_THROW );
- xDiaProp->getPropertyValue( "SortByXValues" ) >>= bSortByXValues;
+ xDiaProp->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= bSortByXValues;
xDiaProp->getPropertyValue( "ConnectBars" ) >>= bConnectBars;
xDiaProp->getPropertyValue( "GroupBarsPerAxis" ) >>= bGroupBarsPerAxis;
xDiaProp->getPropertyValue( "IncludeHiddenCells" ) >>= bIncludeHiddenCells;
commit 801e399f95a4da6101c8570455860fd537a90b95
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Thu Mar 27 10:35:15 2014 -0400
Add a means to debug the internal state of the diagram object.
Until we can render this new GL chart for real.
Change-Id: Iaf1a5fb903572c33d512705c9073b3795187f89b
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 67404e0..0490567 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -121,9 +121,34 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any;
-namespace
+namespace {
+
+class theExplicitValueProviderUnoTunnelId : public rtl::Static<UnoTunnelIdInit, theExplicitValueProviderUnoTunnelId> {};
+
+#if ENABLE_GL3D_BARCHART
+
+/**
+ * Only used for initial debugging of the new GL chart (until we can
+ * visualize it).
+ */
+void debugGL3DOutput( ChartModel& rModel )
{
- class theExplicitValueProviderUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theExplicitValueProviderUnoTunnelId > {};
+ uno::Reference<XDiagram> xDiagram = rModel.getFirstDiagram();
+ if (!xDiagram.is())
+ return;
+
+ try
+ {
+ uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
+ bool bRoundedEdge = false;
+ xPropSet->getPropertyValue("RoundedEdge") >>= bRoundedEdge;
+
+ fprintf(stdout, "GL3D: rounded edge = %d\n", bRoundedEdge);
+ }
+ catch (...) {}
+}
+
+#endif
}
@@ -2381,6 +2406,10 @@ void ChartView::createShapes()
maTimeBased.bTimeBased = true;
}
+#if ENABLE_GL3D_BARCHART
+ debugGL3DOutput(mrChartModel);
+#endif
+
//make sure add-in is refreshed after creating the shapes
const ::comphelper::ScopeGuard aGuard( boost::bind( &ChartView::impl_refreshAddIn, this ) );
if( impl_AddInDrawsAllByItself() )
commit 9153a36b59f2efc2bfb2c9256c39eb5687808deb
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Fri Mar 28 23:30:02 2014 +1100
fdo#74702 Refactor OutputDevice::DrawTransparent()
I have refactored OutputDevice::DrawTransparent() - functionality
is now in the functions DrawInvisiblePolygon(),
DrawTransparentNatively() and EmulateDrawTransparent().
DrawTransparentNatively() will return true if it is successful,
otherwise it will return false if it isn't possible to draw the
transparency natively. This allows us to fall back to a VCL based
emulation.
The function EmulateDrawTransparent() is virtual because Printer
handles transparencies differently to pixel based devices.
Change-Id: I300850ccea03c17673666dadd287bcddd40ec5ef
Reviewed-on: https://gerrit.libreoffice.org/8779
Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79 at gmail.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 35c48fa..8f5fd38 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -805,6 +805,7 @@ protected:
const Point& rSrcPtPixel, const Size& rSrcSizePixel );
virtual long ImplGetGradientStepCount( long nMinRect );
+
/** Transform and draw a bitmap directly
@param aFullTransform The B2DHomMatrix used for the transformation
@@ -839,6 +840,8 @@ protected:
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
BitmapEx& rBitmapEx );
+ virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
+ void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
private:
typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
@@ -852,7 +855,9 @@ private:
SAL_DLLPRIVATE long ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf );
// not implemented; to detect misuses of DrawOutDev(...OutputDevice&);
- void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&);
+ void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&);
+
+ bool DrawTransparentNatively( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
public:
virtual ~OutputDevice();
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index c475aec..0271f0b 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -286,6 +286,7 @@ protected:
virtual void ImplPrintMask ( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel ) SAL_OVERRIDE;
+
bool DrawTransformBitmapExDirect(
const basegfx::B2DHomMatrix& aFullTransform,
const BitmapEx& rBitmapEx) SAL_OVERRIDE;
@@ -300,6 +301,8 @@ protected:
const Point& rSrcPtPixel, const Size& rSrcSizePixel,
BitmapEx& rBitmapEx ) SAL_OVERRIDE;
+ virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) SAL_OVERRIDE;
+
public:
Printer();
Printer( const JobSetup& rJobSetup );
diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx
index 395c4f7..0234df3 100644
--- a/vcl/source/gdi/outdev6.cxx
+++ b/vcl/source/gdi/outdev6.cxx
@@ -183,7 +183,6 @@ void OutputDevice::DrawGrid( const Rectangle& rRect, const Size& rDist, sal_uLon
void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly, double fTransparency)
{
-
// AW: Do NOT paint empty PolyPolygons
if(!rB2DPolyPoly.count())
return;
@@ -241,51 +240,27 @@ void OutputDevice::DrawTransparent( const basegfx::B2DPolyPolygon& rB2DPolyPoly,
DrawTransparent(toPolyPolygon(rB2DPolyPoly), static_cast<sal_uInt16>(fTransparency * 100.0));
}
-
-
-void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
- sal_uInt16 nTransparencePercent )
+void OutputDevice::DrawInvisiblePolygon( const PolyPolygon& rPolyPoly )
{
-
- // short circuit for drawing an opaque polygon
- if( (nTransparencePercent < 1) || ((mnDrawMode & DRAWMODE_NOTRANSPARENCY) != 0) )
- {
- DrawPolyPolygon( rPolyPoly );
+ // short circuit if the polygon border is invisible too
+ if( !mbLineColor )
return;
- }
- // short circuit for drawing an invisible polygon
- if( !mbFillColor || (nTransparencePercent >= 100) )
- {
- // short circuit if the polygon border is invisible too
- if( !mbLineColor )
- return;
-
- // DrawTransparent() assumes that the border is NOT to be drawn transparently???
- Push( PUSH_FILLCOLOR );
- SetFillColor();
- DrawPolyPolygon( rPolyPoly );
- Pop();
- return;
- }
-
- // handle metafile recording
- if( mpMetaFile )
- mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
-
- bool bDrawn = !IsDeviceOutputNecessary() || ImplIsRecordLayout();
- if( bDrawn )
- return;
+ // we assume that the border is NOT to be drawn transparently???
+ Push( PUSH_FILLCOLOR );
+ SetFillColor();
+ DrawPolyPolygon( rPolyPoly );
+ Pop();
+}
- // get the device graphics as drawing target
- if( !mpGraphics )
- if( !ImplGetGraphics() )
- return;
+bool OutputDevice::DrawTransparentNatively ( const PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent )
+{
+ bool bDrawn = false;
// debug helper:
static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
- // try hard to draw it directly, because the emulation layers are slower
if( !pDisableNative
&& mpGraphics->supportsOperation( OutDevSupport_B2DDraw )
// Should iOS be included? Android? Or does this code even get invoked
@@ -303,7 +278,7 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
if( mbInitClipRegion )
ImplInitClipRegion();
if( mbOutputClipped )
- return;
+ return false;
if( mbInitLineColor )
ImplInitLineColor();
if( mbInitFillColor )
@@ -345,12 +320,18 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
}
}
- if( bDrawn )
- return;
+ return bDrawn;
+}
- VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
+void OutputDevice::EmulateDrawTransparent ( const PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent )
+{
+ // debug helper:
+ static const char* pDisableNative = getenv( "SAL_DISABLE_NATIVE_ALPHA");
// #110958# Disable alpha VDev, we perform the necessary
+ VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
+
// operation explicitly further below.
if( mpAlphaVDev )
mpAlphaVDev = NULL;
@@ -358,262 +339,206 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
GDIMetaFile* pOldMetaFile = mpMetaFile;
mpMetaFile = NULL;
- if( OUTDEV_PRINTER == meOutDevType )
- {
- Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
- const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) );
- const long nBaseExtent = std::max( FRound( aDPISize.Width() / 300. ), 1L );
- long nMove;
- const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
- ( nTransparencePercent < 38 ) ? 25 :
- ( nTransparencePercent < 63 ) ? 50 :
- ( nTransparencePercent < 88 ) ? 75 : 100;
-
- switch( nTrans )
- {
- case( 25 ): nMove = nBaseExtent * 3; break;
- case( 50 ): nMove = nBaseExtent * 4; break;
- case( 75 ): nMove = nBaseExtent * 6; break;
-
- // #i112959# very transparent (88 < nTransparencePercent <= 99)
- case( 100 ): nMove = nBaseExtent * 8; break;
+ PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
+ Rectangle aPolyRect( aPolyPoly.GetBoundRect() );
+ Point aPoint;
+ Rectangle aDstRect( aPoint, GetOutputSizePixel() );
- // #i112959# not transparent (nTransparencePercent < 13)
- default: nMove = 0; break;
- }
+ aDstRect.Intersection( aPolyRect );
- Push( PUSH_CLIPREGION | PUSH_LINECOLOR );
- IntersectClipRegion(Region(rPolyPoly));
- SetLineColor( GetFillColor() );
- const bool bOldMap = mbMap;
- EnableMapMode( false );
-
- if(nMove)
- {
- Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
- while( aRect.Top() <= aPolyRect.Bottom() )
- {
- DrawRect( aRect );
- aRect.Move( 0, nMove );
- }
-
- aRect = Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
- while( aRect.Left() <= aPolyRect.Right() )
- {
- DrawRect( aRect );
- aRect.Move( nMove, 0 );
- }
- }
- else
- {
- // #i112959# if not transparent, draw full rectangle in clip region
- DrawRect( aPolyRect );
- }
+ if( OUTDEV_WINDOW == meOutDevType )
+ {
+ const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
- EnableMapMode( bOldMap );
- Pop();
+ if( !aPaintRgn.IsNull() )
+ aDstRect.Intersection( LogicToPixel( aPaintRgn ).GetBoundRect() );
}
- else
- {
- PolyPolygon aPolyPoly( LogicToPixel( rPolyPoly ) );
- Rectangle aPolyRect( aPolyPoly.GetBoundRect() );
- Point aPoint;
- Rectangle aDstRect( aPoint, GetOutputSizePixel() );
- aDstRect.Intersection( aPolyRect );
+ if( !aDstRect.IsEmpty() )
+ {
+ bool bDrawn = false;
- if( OUTDEV_WINDOW == meOutDevType )
+ // #i66849# Added fast path for exactly rectangular
+ // polygons
+ // #i83087# Naturally, system alpha blending cannot
+ // work with separate alpha VDev
+ if( !mpAlphaVDev && !pDisableNative && aPolyPoly.IsRect() )
{
- const Region aPaintRgn( ( (Window*) this )->GetPaintRegion() );
+ // setup Graphics only here (other cases delegate
+ // to basic OutDev methods)
+ if ( mbInitClipRegion )
+ ImplInitClipRegion();
+ if ( mbInitLineColor )
+ ImplInitLineColor();
+ if ( mbInitFillColor )
+ ImplInitFillColor();
- if( !aPaintRgn.IsNull() )
- aDstRect.Intersection( LogicToPixel( aPaintRgn ).GetBoundRect() );
- }
+ Rectangle aLogicPolyRect( rPolyPoly.GetBoundRect() );
+ Rectangle aPixelRect( ImplLogicToDevicePixel( aLogicPolyRect ) );
- if( !aDstRect.IsEmpty() )
- {
- // #i66849# Added fast path for exactly rectangular
- // polygons
- // #i83087# Naturally, system alpha blending cannot
- // work with separate alpha VDev
- if( !mpAlphaVDev && !pDisableNative && aPolyPoly.IsRect() )
+ if( !mbOutputClipped )
{
- // setup Graphics only here (other cases delegate
- // to basic OutDev methods)
- if ( mbInitClipRegion )
- ImplInitClipRegion();
- if ( mbInitLineColor )
- ImplInitLineColor();
- if ( mbInitFillColor )
- ImplInitFillColor();
-
- Rectangle aLogicPolyRect( rPolyPoly.GetBoundRect() );
- Rectangle aPixelRect( ImplLogicToDevicePixel( aLogicPolyRect ) );
-
- if( !mbOutputClipped )
- {
- bDrawn = mpGraphics->DrawAlphaRect(
- aPixelRect.Left(), aPixelRect.Top(),
- // #i98405# use methods with small g, else one pixel too much will be painted.
- // This is because the source is a polygon which when painted would not paint
- // the rightmost and lowest pixel line(s), so use one pixel less for the
- // rectangle, too.
- aPixelRect.getWidth(), aPixelRect.getHeight(),
- sal::static_int_cast<sal_uInt8>(nTransparencePercent),
- this );
- }
- else
- bDrawn = true;
+ bDrawn = mpGraphics->DrawAlphaRect(
+ aPixelRect.Left(), aPixelRect.Top(),
+ // #i98405# use methods with small g, else one pixel too much will be painted.
+ // This is because the source is a polygon which when painted would not paint
+ // the rightmost and lowest pixel line(s), so use one pixel less for the
+ // rectangle, too.
+ aPixelRect.getWidth(), aPixelRect.getHeight(),
+ sal::static_int_cast<sal_uInt8>(nTransparencePercent),
+ this );
}
+ else
+ bDrawn = true;
+ }
- if( !bDrawn )
- {
+ if( !bDrawn )
+ {
#ifdef IOS
- VirtualDevice aVDev( *this, 8 );
+ VirtualDevice aVDev( *this, 8 );
#else
- VirtualDevice aVDev( *this, 1 );
+ VirtualDevice aVDev( *this, 1 );
#endif
- const Size aDstSz( aDstRect.GetSize() );
- const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );
+ const Size aDstSz( aDstRect.GetSize() );
+ const sal_uInt8 cTrans = (sal_uInt8) MinMax( FRound( nTransparencePercent * 2.55 ), 0, 255 );
- if( aDstRect.Left() || aDstRect.Top() )
- aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
+ if( aDstRect.Left() || aDstRect.Top() )
+ aPolyPoly.Move( -aDstRect.Left(), -aDstRect.Top() );
- if( aVDev.SetOutputSizePixel( aDstSz ) )
- {
- const bool bOldMap = mbMap;
+ if( aVDev.SetOutputSizePixel( aDstSz ) )
+ {
+ const bool bOldMap = mbMap;
- EnableMapMode( false );
+ EnableMapMode( false );
- aVDev.SetLineColor( COL_BLACK );
- aVDev.SetFillColor( COL_BLACK );
- aVDev.DrawPolyPolygon( aPolyPoly );
+ aVDev.SetLineColor( COL_BLACK );
+ aVDev.SetFillColor( COL_BLACK );
+ aVDev.DrawPolyPolygon( aPolyPoly );
- Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
- Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
+ Bitmap aPaint( GetBitmap( aDstRect.TopLeft(), aDstSz ) );
+ Bitmap aPolyMask( aVDev.GetBitmap( Point(), aDstSz ) );
- // #107766# check for non-empty bitmaps before accessing them
- if( !!aPaint && !!aPolyMask )
- {
- BitmapWriteAccess* pW = aPaint.AcquireWriteAccess();
- BitmapReadAccess* pR = aPolyMask.AcquireReadAccess();
+ // #107766# check for non-empty bitmaps before accessing them
+ if( !!aPaint && !!aPolyMask )
+ {
+ BitmapWriteAccess* pW = aPaint.AcquireWriteAccess();
+ BitmapReadAccess* pR = aPolyMask.AcquireReadAccess();
- if( pW && pR )
+ if( pW && pR )
+ {
+ BitmapColor aPixCol;
+ const BitmapColor aFillCol( GetFillColor() );
+ const BitmapColor aWhite( pR->GetBestMatchingColor( Color( COL_WHITE ) ) );
+ const BitmapColor aBlack( pR->GetBestMatchingColor( Color( COL_BLACK ) ) );
+ const long nWidth = pW->Width(), nHeight = pW->Height();
+ const long nR = aFillCol.GetRed(), nG = aFillCol.GetGreen(), nB = aFillCol.GetBlue();
+ long nX, nY;
+
+ if( aPaint.GetBitCount() <= 8 )
{
- BitmapColor aPixCol;
- const BitmapColor aFillCol( GetFillColor() );
- const BitmapColor aWhite( pR->GetBestMatchingColor( Color( COL_WHITE ) ) );
- const BitmapColor aBlack( pR->GetBestMatchingColor( Color( COL_BLACK ) ) );
- const long nWidth = pW->Width(), nHeight = pW->Height();
- const long nR = aFillCol.GetRed(), nG = aFillCol.GetGreen(), nB = aFillCol.GetBlue();
- long nX, nY;
-
- if( aPaint.GetBitCount() <= 8 )
+ const BitmapPalette& rPal = pW->GetPalette();
+ const sal_uInt16 nCount = rPal.GetEntryCount();
+ BitmapColor* pMap = (BitmapColor*) new sal_uInt8[ nCount * sizeof( BitmapColor ) ];
+
+ for( sal_uInt16 i = 0; i < nCount; i++ )
{
- const BitmapPalette& rPal = pW->GetPalette();
- const sal_uInt16 nCount = rPal.GetEntryCount();
- BitmapColor* pMap = (BitmapColor*) new sal_uInt8[ nCount * sizeof( BitmapColor ) ];
+ BitmapColor aCol( rPal[ i ] );
+ pMap[ i ] = BitmapColor( (sal_uInt8) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) );
+ }
- for( sal_uInt16 i = 0; i < nCount; i++ )
- {
- BitmapColor aCol( rPal[ i ] );
- pMap[ i ] = BitmapColor( (sal_uInt8) rPal.GetBestIndex( aCol.Merge( aFillCol, cTrans ) ) );
- }
+ if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ {
+ const sal_uInt8 cBlack = aBlack.GetIndex();
- if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
- pW->GetScanlineFormat() == BMP_FORMAT_8BIT_PAL )
+ for( nY = 0; nY < nHeight; nY++ )
{
- const sal_uInt8 cBlack = aBlack.GetIndex();
+ Scanline pWScan = pW->GetScanline( nY );
+ Scanline pRScan = pR->GetScanline( nY );
+ sal_uInt8 cBit = 128;
- for( nY = 0; nY < nHeight; nY++ )
+ for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ )
{
- Scanline pWScan = pW->GetScanline( nY );
- Scanline pRScan = pR->GetScanline( nY );
- sal_uInt8 cBit = 128;
+ if( !cBit )
+ cBit = 128, pRScan++;
- for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan++ )
- {
- if( !cBit )
- cBit = 128, pRScan++;
-
- if( ( *pRScan & cBit ) == cBlack )
- *pWScan = (sal_uInt8) pMap[ *pWScan ].GetIndex();
- }
+ if( ( *pRScan & cBit ) == cBlack )
+ *pWScan = (sal_uInt8) pMap[ *pWScan ].GetIndex();
}
}
- else
- {
- for( nY = 0; nY < nHeight; nY++ )
- for( nX = 0; nX < nWidth; nX++ )
- if( pR->GetPixel( nY, nX ) == aBlack )
- pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
- }
-
- delete[] (sal_uInt8*) pMap;
}
else
{
- if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
- pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
+ for( nY = 0; nY < nHeight; nY++ )
+ for( nX = 0; nX < nWidth; nX++ )
+ if( pR->GetPixel( nY, nX ) == aBlack )
+ pW->SetPixel( nY, nX, pMap[ pW->GetPixel( nY, nX ).GetIndex() ] );
+ }
+
+ delete[] (sal_uInt8*) pMap;
+ }
+ else
+ {
+ if( pR->GetScanlineFormat() == BMP_FORMAT_1BIT_MSB_PAL &&
+ pW->GetScanlineFormat() == BMP_FORMAT_24BIT_TC_BGR )
+ {
+ const sal_uInt8 cBlack = aBlack.GetIndex();
+
+ for( nY = 0; nY < nHeight; nY++ )
{
- const sal_uInt8 cBlack = aBlack.GetIndex();
+ Scanline pWScan = pW->GetScanline( nY );
+ Scanline pRScan = pR->GetScanline( nY );
+ sal_uInt8 cBit = 128;
- for( nY = 0; nY < nHeight; nY++ )
+ for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
{
- Scanline pWScan = pW->GetScanline( nY );
- Scanline pRScan = pR->GetScanline( nY );
- sal_uInt8 cBit = 128;
+ if( !cBit )
+ cBit = 128, pRScan++;
- for( nX = 0; nX < nWidth; nX++, cBit >>= 1, pWScan += 3 )
+ if( ( *pRScan & cBit ) == cBlack )
{
- if( !cBit )
- cBit = 128, pRScan++;
-
- if( ( *pRScan & cBit ) == cBlack )
- {
- pWScan[ 0 ] = COLOR_CHANNEL_MERGE( pWScan[ 0 ], nB, cTrans );
- pWScan[ 1 ] = COLOR_CHANNEL_MERGE( pWScan[ 1 ], nG, cTrans );
- pWScan[ 2 ] = COLOR_CHANNEL_MERGE( pWScan[ 2 ], nR, cTrans );
- }
+ pWScan[ 0 ] = COLOR_CHANNEL_MERGE( pWScan[ 0 ], nB, cTrans );
+ pWScan[ 1 ] = COLOR_CHANNEL_MERGE( pWScan[ 1 ], nG, cTrans );
+ pWScan[ 2 ] = COLOR_CHANNEL_MERGE( pWScan[ 2 ], nR, cTrans );
}
}
}
- else
+ }
+ else
+ {
+ for( nY = 0; nY < nHeight; nY++ )
{
- for( nY = 0; nY < nHeight; nY++ )
+ for( nX = 0; nX < nWidth; nX++ )
{
- for( nX = 0; nX < nWidth; nX++ )
+ if( pR->GetPixel( nY, nX ) == aBlack )
{
- if( pR->GetPixel( nY, nX ) == aBlack )
- {
- aPixCol = pW->GetColor( nY, nX );
- pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
- }
+ aPixCol = pW->GetColor( nY, nX );
+ pW->SetPixel( nY, nX, aPixCol.Merge( aFillCol, cTrans ) );
}
}
}
}
}
+ }
- aPolyMask.ReleaseAccess( pR );
- aPaint.ReleaseAccess( pW );
+ aPolyMask.ReleaseAccess( pR );
+ aPaint.ReleaseAccess( pW );
- DrawBitmap( aDstRect.TopLeft(), aPaint );
+ DrawBitmap( aDstRect.TopLeft(), aPaint );
- EnableMapMode( bOldMap );
+ EnableMapMode( bOldMap );
- if( mbLineColor )
- {
- Push( PUSH_FILLCOLOR );
- SetFillColor();
- DrawPolyPolygon( rPolyPoly );
- Pop();
- }
+ if( mbLineColor )
+ {
+ Push( PUSH_FILLCOLOR );
+ SetFillColor();
+ DrawPolyPolygon( rPolyPoly );
+ Pop();
}
}
- else
- DrawPolyPolygon( rPolyPoly );
}
+ else
+ DrawPolyPolygon( rPolyPoly );
}
}
@@ -621,6 +546,43 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
// #110958# Restore disabled alpha VDev
mpAlphaVDev = pOldAlphaVDev;
+}
+
+void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent )
+{
+ // short circuit for drawing an opaque polygon
+ if( (nTransparencePercent < 1) || ((mnDrawMode & DRAWMODE_NOTRANSPARENCY) != 0) )
+ {
+ DrawPolyPolygon( rPolyPoly );
+ return;
+ }
+
+ // short circuit for drawing an invisible polygon
+ if( !mbFillColor || (nTransparencePercent >= 100) )
+ {
+ DrawInvisiblePolygon( rPolyPoly );
+ }
+
+ // handle metafile recording
+ if( mpMetaFile )
+ mpMetaFile->AddAction( new MetaTransparentAction( rPolyPoly, nTransparencePercent ) );
+
+ bool bDrawn = !IsDeviceOutputNecessary() || ImplIsRecordLayout();
+ if( bDrawn )
+ return;
+
+ // get the device graphics as drawing target
+ if( !mpGraphics )
+ if( !ImplGetGraphics() )
+ return;
+
+ // try hard to draw it directly, because the emulation layers are slower
+ bDrawn = DrawTransparentNatively( rPolyPoly, nTransparencePercent );
+ if( bDrawn )
+ return;
+
+ EmulateDrawTransparent( rPolyPoly, nTransparencePercent );
// #110958# Apply alpha value also to VDev alpha channel
if( mpAlphaVDev )
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index a65524b..c83757b 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -250,6 +250,85 @@ void Printer::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
}
}
+
+void Printer::EmulateDrawTransparent ( const PolyPolygon& rPolyPoly,
+ sal_uInt16 nTransparencePercent )
+{
+ // #110958# Disable alpha VDev, we perform the necessary
+ VirtualDevice* pOldAlphaVDev = mpAlphaVDev;
+
+ // operation explicitly further below.
+ if( mpAlphaVDev )
+ mpAlphaVDev = NULL;
+
+ GDIMetaFile* pOldMetaFile = mpMetaFile;
+ mpMetaFile = NULL;
+
+ mpMetaFile = pOldMetaFile;
+
+ // #110958# Restore disabled alpha VDev
+ mpAlphaVDev = pOldAlphaVDev;
+
+ Rectangle aPolyRect( LogicToPixel( rPolyPoly ).GetBoundRect() );
+ const Size aDPISize( LogicToPixel( Size( 1, 1 ), MAP_INCH ) );
+ const long nBaseExtent = std::max( FRound( aDPISize.Width() / 300. ), 1L );
+ long nMove;
+ const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
+ ( nTransparencePercent < 38 ) ? 25 :
+ ( nTransparencePercent < 63 ) ? 50 :
+ ( nTransparencePercent < 88 ) ? 75 : 100;
+
+ switch( nTrans )
+ {
+ case( 25 ): nMove = nBaseExtent * 3; break;
+ case( 50 ): nMove = nBaseExtent * 4; break;
+ case( 75 ): nMove = nBaseExtent * 6; break;
+
+ // #i112959# very transparent (88 < nTransparencePercent <= 99)
+ case( 100 ): nMove = nBaseExtent * 8; break;
+
+ // #i112959# not transparent (nTransparencePercent < 13)
+ default: nMove = 0; break;
+ }
+
+ Push( PUSH_CLIPREGION | PUSH_LINECOLOR );
+ IntersectClipRegion(Region(rPolyPoly));
+ SetLineColor( GetFillColor() );
+ const bool bOldMap = mbMap;
+ EnableMapMode( false );
+
+ if(nMove)
+ {
+ Rectangle aRect( aPolyRect.TopLeft(), Size( aPolyRect.GetWidth(), nBaseExtent ) );
+ while( aRect.Top() <= aPolyRect.Bottom() )
+ {
+ DrawRect( aRect );
+ aRect.Move( 0, nMove );
+ }
+
+ aRect = Rectangle( aPolyRect.TopLeft(), Size( nBaseExtent, aPolyRect.GetHeight() ) );
+ while( aRect.Left() <= aPolyRect.Right() )
+ {
+ DrawRect( aRect );
+ aRect.Move( nMove, 0 );
+ }
+ }
+ else
+ {
+ // #i112959# if not transparent, draw full rectangle in clip region
+ DrawRect( aPolyRect );
+ }
+
+ EnableMapMode( bOldMap );
+ Pop();
+
+ mpMetaFile = pOldMetaFile;
+
+ // #110958# Restore disabled alpha VDev
+ mpAlphaVDev = pOldAlphaVDev;
+}
+
+
void Printer::DrawOutDev( const Point& /*rDestPt*/, const Size& /*rDestSize*/,
const Point& /*rSrcPt*/, const Size& /*rSrcSize*/ )
{
commit bb20d37025318d5a2fb35689c26c3600a625ed68
Author: Michael Stahl <mstahl at redhat.com>
Date: Sat Mar 29 02:09:34 2014 +0100
tools: try to fix std::min ambiguity for MSVC
Change-Id: Id81ad8702d513c5bb3f4f8de2f9d7c75c7852d4d
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 086f797..48cae55 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -265,7 +265,8 @@ ErrCode SvAsyncLockBytes::ReadAt(sal_uInt64 const nPos, void * pBuffer, sal_Size
return SvOpenLockBytes::ReadAt(nPos, pBuffer, nCount, pRead);
else
{
- sal_Size nTheCount = std::min(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
+ sal_Size nTheCount =
+ std::min<sal_Size>(nPos < m_nSize ? m_nSize - nPos : 0, nCount);
ErrCode nError = SvOpenLockBytes::ReadAt(nPos, pBuffer, nTheCount,
pRead);
return !nCount || nTheCount == nCount || nError ? nError :
@@ -281,7 +282,8 @@ ErrCode SvAsyncLockBytes::WriteAt(sal_uInt64 const nPos, const void * pBuffer,
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list