summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-05 00:57:25 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-19 13:47:33 +0100
commit5c0a5503b692fa29b167e1b9a317fc77ef1baaf0 (patch)
tree7340abe4534e38801fd5b2a46fd196bea6caaad0
parente8af05851ab0abf0837feffea58987c4721afb5b (diff)
create an AbstractFactory and add a DummyShapeFactory for testing
-rw-r--r--chart2/Library_chartcore.mk3
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx2
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx8
-rw-r--r--chart2/source/view/inc/AbstractShapeFactory.hxx233
-rw-r--r--chart2/source/view/inc/DummyShapeFactory.hxx156
-rw-r--r--chart2/source/view/inc/DummyXShape.hxx114
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx96
-rw-r--r--chart2/source/view/main/AbstractShapeFactory.cxx287
-rw-r--r--chart2/source/view/main/DummyShapeFactory.cxx242
-rw-r--r--chart2/source/view/main/DummyXShape.cxx221
-rw-r--r--chart2/source/view/main/ShapeFactory.cxx260
11 files changed, 1281 insertions, 341 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index c54e441fa89c..8e6d796e4706 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -91,6 +91,8 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/view/main/Clipping \
chart2/source/view/main/DataPointSymbolSupplier \
chart2/source/view/main/DrawModelWrapper \
+ chart2/source/view/main/DummyShapeFactory \
+ chart2/source/view/main/DummyXShape \
chart2/source/view/main/LabelPositionHelper \
chart2/source/view/main/Linear3DTransformation \
chart2/source/view/main/PlotterBase \
@@ -99,6 +101,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\
chart2/source/view/main/PropertyMapper \
chart2/source/view/main/_serviceregistration_view \
chart2/source/view/main/ShapeFactory \
+ chart2/source/view/main/AbstractShapeFactory \
chart2/source/view/main/Stripe \
chart2/source/view/main/VDataSeries \
chart2/source/view/main/VLegend \
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 01b8e4e61362..1fc5ab19726c 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -57,7 +57,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, bool bConnectLastToFirstPoint
, bool bExpandIfValuesCloseToBorder
, sal_Int32 nKeepAspectRatio
- , const drawing::Direction3D& rAspectRatio
)
: VSeriesPlotter( xChartTypeModel, nDimensionCount, bCategoryXAxis )
, m_pMainPosHelper(pPlottingPositionHelper)
@@ -68,7 +67,6 @@ AreaChart::AreaChart( const uno::Reference<XChartType>& xChartTypeModel
, m_bConnectLastToFirstPoint( bConnectLastToFirstPoint )
, m_bExpandIfValuesCloseToBorder( bExpandIfValuesCloseToBorder )
, m_nKeepAspectRatio(nKeepAspectRatio)
- , m_aGivenAspectRatio(rAspectRatio)
, m_eCurveStyle(CurveStyle_LINES)
, m_nCurveResolution(20)
, m_nSplineOrder(3)
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index fbd81cb88f1b..4c61887591ea 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -187,7 +187,7 @@ struct FormerPoint
void BubbleChart::createShapes()
{
- if( m_aZSlots.begin() == m_aZSlots.end() ) //no series
+ if( m_aZSlots.empty() ) //no series
return;
OSL_ENSURE(m_pShapeFactory&&m_xLogicTarget.is()&&m_xFinalTarget.is(),"BubbleChart is not proper initialized");
@@ -202,7 +202,7 @@ void BubbleChart::createShapes()
m_pShapeFactory->createGroup2D( m_xFinalTarget,OUString() ));
//update/create information for current group
- double fLogicZ = 1.0;//as defined
+ double fLogicZ = 1.0;//as defined
sal_Int32 nStartIndex = 0; // inclusive ;..todo get somehow from x scale
sal_Int32 nEndIndex = VSeriesPlotter::getPointCount();
@@ -224,8 +224,8 @@ void BubbleChart::createShapes()
//iterate through all x values per indices
for( sal_Int32 nIndex = nStartIndex; nIndex < nEndIndex; nIndex++ )
{
- ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
- const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
+ ::std::vector< ::std::vector< VDataSeriesGroup > >::iterator aZSlotIter = m_aZSlots.begin();
+ const ::std::vector< ::std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
for( sal_Int32 nZ=1; aZSlotIter != aZSlotEnd; ++aZSlotIter, nZ++ )
{
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
new file mode 100644
index 000000000000..b4a3b75e6c9a
--- /dev/null
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -0,0 +1,233 @@
+/* -*- 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_ABSTRACT_SHAPE_FACTORY
+#define CHART2_ABSTRACT_SHAPE_FACTORY
+
+#include "PropertyMapper.hxx"
+#include "VLineProperties.hxx"
+#include "BaseGFXHelper.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <com/sun/star/drawing/HomogenMatrix.hpp>
+#include <com/sun/star/drawing/PointSequenceSequence.hpp>
+#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
+#include <com/sun/star/drawing/Position3D.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+namespace chart {
+
+
+// Be careful here not to clash with the SYMBOL_FOO #defines in
+// <rsc/rsc-vcl-shared-types.hxx>
+enum SymbolEnum { Symbol_Square=0
+ , Symbol_Diamond
+ , Symbol_DownArrow
+ , Symbol_UpArrow
+ , Symbol_RightArrow
+ , Symbol_LeftArrow
+ , Symbol_Bowtie
+ , Symbol_Sandglass
+ , Symbol_Circle
+ , Symbol_Star
+ , Symbol_X
+ , Symbol_Plus
+ , Symbol_Asterisk
+ , Symbol_HorizontalBar
+ , Symbol_VerticalBar
+ , Symbol_COUNT
+};
+
+class Stripe;
+
+class AbstractShapeFactory
+{
+public:
+
+ virtual ~AbstractShapeFactory() {};
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup2D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , OUString aName = OUString() ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup3D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , OUString aName = OUString() ) = 0;
+
+ //------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCube( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , bool bRounded = false) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCylinder( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPyramid( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight
+ , bool bRotateZ
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCone( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
+ , double fDepth ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const Stripe& rStripe
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , sal_Bool bDoubleSided = true
+ , short nRotatedTexture = 0 //0 to 7 are the different possibilities
+ , bool bFlatNormals=true ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
+ , double fDepth) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon) = 0;
+
+ static sal_Int32 getSymbolCount();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nStandardSymbol
+ , sal_Int32 nBorderColor=0
+ , sal_Int32 nFillColor=0 ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , const VLineProperties* pLineProperties = NULL ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
+ , const VLineProperties& rLineProperties ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
+ , const OUString& rText
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ , const ::com::sun::star::uno::Any& rATransformation
+ ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createInvisibleRectangle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::awt::Size& rSize ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage ) = 0;
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage );
+
+ //------
+ static void makeShapeInvisible( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ static void setShapeName( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape
+ , const OUString& rName );
+
+ static OUString getShapeName( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ static ::com::sun::star::uno::Any makeTransformation( const ::com::sun::star::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
+
+ static OUString getStackedString( const OUString& rString, bool bStacked=true );
+
+ static bool hasPolygonAnyLines( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+ static bool isPolygonEmptyOrSinglePoint( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+ static void closePolygon( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
+
+ static ::com::sun::star::awt::Size calculateNewSizeRespectingAspectRatio(
+ const ::com::sun::star::awt::Size& rTargetSize
+ , const ::com::sun::star::awt::Size& rSourceSizeWithCorrectAspectRatio );
+
+ static ::com::sun::star::awt::Point calculateTopLeftPositionToCenterObject(
+ const ::com::sun::star::awt::Point& rTargetAreaPosition
+ , const ::com::sun::star::awt::Size& rTargetAreaSize
+ , const ::com::sun::star::awt::Size& rObjectSize );
+
+ static ::basegfx::B2IRectangle getRectangleOfShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
+
+ static ::com::sun::star::awt::Size getSizeAfterRotation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, double fRotationAngleDegree );
+
+ static void removeSubShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes );
+
+};
+
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/DummyShapeFactory.hxx b/chart2/source/view/inc/DummyShapeFactory.hxx
new file mode 100644
index 000000000000..57ab726f188a
--- /dev/null
+++ b/chart2/source/view/inc/DummyShapeFactory.hxx
@@ -0,0 +1,156 @@
+/* -*- 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_DUMMY_SHAPE_FACTORY
+#define CHART2_DUMMY_SHAPE_FACTORY
+
+#include "AbstractShapeFactory.hxx"
+
+namespace chart {
+
+namespace dummy {
+
+class DummyShapeFactory : public chart::AbstractShapeFactory
+{
+public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup2D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , OUString aName = OUString() );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ createGroup3D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , OUString aName = OUString() );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCube( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , bool bRounded = false);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCylinder( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nRotateZAngleHundredthDegree );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPyramid( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight
+ , bool bRotateZ
+ , const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCone( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPosition
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
+ , double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
+ , const ::com::sun::star::drawing::Direction3D& rOffset
+ , const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
+ , double fDepth );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const Stripe& rStripe
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
+ , const tPropertyNameMap& rPropertyNameMap
+ , sal_Bool bDoubleSided = true
+ , short nRotatedTexture = 0 //0 to 7 are the different possibilities
+ , bool bFlatNormals=true );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
+ , double fDepth);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , sal_Int32 nStandardSymbol
+ , sal_Int32 nBorderColor=0
+ , sal_Int32 nFillColor=0 );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize
+ , const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PointSequenceSequence& rPoints
+ , const VLineProperties* pLineProperties = NULL );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
+ , const VLineProperties& rLineProperties );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::drawing::Position3D& rPos
+ , const ::com::sun::star::drawing::Direction3D& rSize );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
+ , const OUString& rText
+ , const tNameSequence& rPropNames
+ , const tAnySequence& rPropValues
+ , const ::com::sun::star::uno::Any& rATransformation
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createInvisibleRectangle(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShapes >& xTarget
+ , const ::com::sun::star::awt::Size& rSize );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XDrawPage>& xPage );
+};
+
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
new file mode 100644
index 000000000000..93b1936f395d
--- /dev/null
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -0,0 +1,114 @@
+/* -*- 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_DUMMY_XSHAPE_HXX
+#define CHART2_DUMMY_XSHAPE_HXX
+
+#include <cppuhelper/implbase5.hxx>
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/uno/Type.h>
+#include <com/sun/star/uno/Any.h>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <vector>
+
+namespace chart {
+
+namespace dummy {
+
+class DummyXShape : public cppu::WeakImplHelper5<
+ ::com::sun::star::drawing::XShape,
+ com::sun::star::beans::XPropertySet,
+ com::sun::star::container::XNamed,
+ com::sun::star::container::XChild,
+ com::sun::star::lang::XServiceInfo >
+{
+public:
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XShape
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+ // XShapeDescriptor
+ virtual OUString SAL_CALL getShapeType() throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XChild
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ OUString maName;
+ com::sun::star::awt::Point maPosition;
+ com::sun::star::awt::Size maSize;
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxParent;
+
+};
+
+class DummyXShapes : public DummyXShape, public com::sun::star::drawing::XShapes
+{
+public:
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XShapes
+ virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException) ;
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ std::vector<com::sun::star::uno::Reference< com::sun::star::drawing::XShape > > maShapes;
+};
+
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 79718a1d0b50..6d14c4851509 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -19,37 +19,25 @@
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_INC_SHAPEFACTORY_HXX
-#include "PropertyMapper.hxx"
-#include "VLineProperties.hxx"
-#include "BaseGFXHelper.hxx"
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/drawing/Direction3D.hpp>
-#include <com/sun/star/drawing/HomogenMatrix.hpp>
-#include <com/sun/star/drawing/PointSequenceSequence.hpp>
-#include <com/sun/star/drawing/PolyPolygonShape3D.hpp>
-#include <com/sun/star/drawing/Position3D.hpp>
-#include <com/sun/star/drawing/XDrawPage.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
+#include "AbstractShapeFactory.hxx"
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
namespace chart
{
-class Stripe;
-class ShapeFactory
+class ShapeFactory : public AbstractShapeFactory
{
public:
ShapeFactory(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> xFactory)
{m_xShapeFactory = xFactory;}
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
createGroup2D(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, OUString aName = OUString() );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
createGroup3D(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
@@ -57,7 +45,7 @@ public:
//------
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createCube( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPosition
@@ -67,14 +55,14 @@ public:
, const tPropertyNameMap& rPropertyNameMap
, bool bRounded = false);
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createCylinder( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPosition
, const ::com::sun::star::drawing::Direction3D& rSize
, sal_Int32 nRotateZAngleHundredthDegree );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createPyramid( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPosition
@@ -85,21 +73,21 @@ public:
::com::sun::star::beans::XPropertySet >& xSourceProp
, const tPropertyNameMap& rPropertyNameMap);
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createCone( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPosition
, const ::com::sun::star::drawing::Direction3D& rSize
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createPieSegment2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
, const ::com::sun::star::drawing::Direction3D& rOffset
, const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createPieSegment( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
@@ -107,7 +95,7 @@ public:
, const ::com::sun::star::drawing::HomogenMatrix& rUnitCircleToScene
, double fDepth );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createStripe( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const Stripe& rStripe
, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSourceProp
@@ -116,18 +104,16 @@ public:
, short nRotatedTexture = 0 //0 to 7 are the different possibilities
, bool bFlatNormals=true );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createArea3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon
, double fDepth);
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createArea2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon);
- static sal_Int32 getSymbolCount();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createSymbol2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPos
, const ::com::sun::star::drawing::Direction3D& rSize
@@ -135,28 +121,28 @@ public:
, sal_Int32 nBorderColor=0
, sal_Int32 nFillColor=0 );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createGraphic2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPos
, const ::com::sun::star::drawing::Direction3D& rSize
, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createLine2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::PointSequenceSequence& rPoints
, const VLineProperties* pLineProperties = NULL );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createLine3D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::PolyPolygonShape3D& rPoints
, const VLineProperties& rLineProperties );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createCircle2D( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::drawing::Position3D& rPos
, const ::com::sun::star::drawing::Direction3D& rSize );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createText( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xTarget2D
, const OUString& rText
, const tNameSequence& rPropNames
@@ -164,56 +150,16 @@ public:
, const ::com::sun::star::uno::Any& rATransformation
);
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
createInvisibleRectangle(
const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XShapes >& xTarget
, const ::com::sun::star::awt::Size& rSize );
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
getOrCreateChartRootShape( const ::com::sun::star::uno::Reference<
::com::sun::star::drawing::XDrawPage>& xPage );
- static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
- getChartRootShape( const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XDrawPage>& xPage );
-
- //------
- static void makeShapeInvisible( const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShape >& xShape );
-
- static void setShapeName( const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShape >& xShape
- , const OUString& rName );
-
- static OUString getShapeName( const ::com::sun::star::uno::Reference<
- ::com::sun::star::drawing::XShape >& xShape );
-
- static ::com::sun::star::uno::Any makeTransformation( const ::com::sun::star::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
-
- static OUString getStackedString( const OUString& rString, bool bStacked=true );
-
- static bool hasPolygonAnyLines( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
- static bool isPolygonEmptyOrSinglePoint( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
- static void closePolygon( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly );
-
- static ::com::sun::star::awt::Size calculateNewSizeRespectingAspectRatio(
- const ::com::sun::star::awt::Size& rTargetSize
- , const ::com::sun::star::awt::Size& rSourceSizeWithCorrectAspectRatio );
-
- static ::com::sun::star::awt::Point calculateTopLeftPositionToCenterObject(
- const ::com::sun::star::awt::Point& rTargetAreaPosition
- , const ::com::sun::star::awt::Size& rTargetAreaSize
- , const ::com::sun::star::awt::Size& rObjectSize );
-
- static ::basegfx::B2IRectangle getRectangleOfShape(
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
-
- static ::com::sun::star::awt::Size getSizeAfterRotation(
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, double fRotationAngleDegree );
-
- static void removeSubShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes );
-
private:
ShapeFactory();
diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx
new file mode 100644
index 000000000000..6a8f7a88421a
--- /dev/null
+++ b/chart2/source/view/main/AbstractShapeFactory.cxx
@@ -0,0 +1,287 @@
+/* -*- 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 "macros.hxx"
+#include "PropertyMapper.hxx"
+#include "CommonConverters.hxx"
+
+#include "AbstractShapeFactory.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <editeng/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+using namespace com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace chart {
+
+sal_Int32 AbstractShapeFactory::getSymbolCount()
+{
+ return Symbol_COUNT;
+}
+
+uno::Reference< drawing::XShapes > AbstractShapeFactory::getChartRootShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
+{
+ uno::Reference< drawing::XShapes > xRet;
+ uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
+ if( xShapes.is() )
+ {
+ sal_Int32 nCount = xShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nN = nCount; nN--; )
+ {
+ if( xShapes->getByIndex( nN ) >>= xShape )
+ {
+ if( AbstractShapeFactory::getShapeName( xShape ).equals("com.sun.star.chart2.shapes") )
+ {
+ xRet = uno::Reference< drawing::XShapes >( xShape, uno::UNO_QUERY );
+ break;
+ }
+ }
+ }
+ }
+ return xRet;
+}
+
+void AbstractShapeFactory::makeShapeInvisible( const uno::Reference< drawing::XShape >& xShape )
+{
+ uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
+ OSL_ENSURE(xShapeProp.is(), "created shape offers no XPropertySet");
+ if( xShapeProp.is())
+ {
+ try
+ {
+ xShapeProp->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_NONE ));
+ xShapeProp->setPropertyValue( "FillStyle", uno::makeAny( drawing::FillStyle_NONE ));
+ }
+ catch( const uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+// set a name/CID at a shape (is used for selection handling)
+
+void AbstractShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape
+ , const OUString& rName )
+{
+ if(!xShape.is())
+ return;
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
+ , uno::makeAny( rName ) );
+ }
+ catch( const uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+}
+
+OUString AbstractShapeFactory::getShapeName( const uno::Reference< drawing::XShape >& xShape )
+{
+ OUString aRet;
+
+ uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
+ OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
+ if( xProp.is())
+ {
+ try
+ {
+ xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
+ }
+ catch( const uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+ }
+
+ return aRet;
+}
+
+uno::Any AbstractShapeFactory::makeTransformation( const awt::Point& rScreenPosition2D, double fRotationAnglePi )
+{
+ ::basegfx::B2DHomMatrix aM;
+ //As autogrow is active the rectangle is automatically expanded to that side
+ //to which the text is not adjusted.
+ // aM.scale( 1, 1 ); Oops? A scale with this parameters is neutral, line commented out
+ aM.rotate( fRotationAnglePi );
+ aM.translate( rScreenPosition2D.X, rScreenPosition2D.Y );
+ uno::Any aATransformation = uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) );
+ return aATransformation;
+}
+
+OUString AbstractShapeFactory::getStackedString( const OUString& rString, bool bStacked )
+{
+ sal_Int32 nLen = rString.getLength();
+ if(!bStacked || !nLen)
+ return rString;
+
+ OUStringBuffer aStackStr;
+
+ //add a newline after each letter
+ //as we do not no letters here add a newline after each char
+ for( sal_Int32 nPosSrc=0; nPosSrc < nLen; nPosSrc++ )
+ {
+ if( nPosSrc )
+ aStackStr.append( sal_Unicode('\r') );
+ aStackStr.append(rString[nPosSrc]);
+ }
+ return aStackStr.makeStringAndClear();
+}
+
+bool AbstractShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly)
+{
+ // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true
+ for( sal_Int32 nIdx = 0, nCount = rPoly.SequenceX.getLength(); nIdx < nCount; ++nIdx )
+ if( rPoly.SequenceX[ nIdx ].getLength() > 1 )
+ return true;
+ return false;
+}
+
+bool AbstractShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPoly)
+{
+ // true, if empty polypolygon or one polygon with one point
+ return (rPoly.SequenceX.getLength() == 0) ||
+ ((rPoly.SequenceX.getLength() == 1) && (rPoly.SequenceX[0].getLength() <= 1));
+}
+
+void AbstractShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly)
+{
+ OSL_ENSURE( rPoly.SequenceX.getLength() <= 1, "AbstractShapeFactory::closePolygon - single polygon expected" );
+ //add a last point == first point
+ if(isPolygonEmptyOrSinglePoint(rPoly))
+ return;
+ drawing::Position3D aFirst(rPoly.SequenceX[0][0],rPoly.SequenceY[0][0],rPoly.SequenceZ[0][0]);
+ AddPointToPoly( rPoly, aFirst );
+}
+
+awt::Size AbstractShapeFactory::calculateNewSizeRespectingAspectRatio(
+ const awt::Size& rTargetSize
+ , const awt::Size& rSourceSizeWithCorrectAspectRatio )
+{
+ awt::Size aNewSize;
+
+ double fFactorWidth = double(rTargetSize.Width)/double(rSourceSizeWithCorrectAspectRatio.Width);
+ double fFactorHeight = double(rTargetSize.Height)/double(rSourceSizeWithCorrectAspectRatio.Height);
+ double fFactor = std::min(fFactorWidth,fFactorHeight);
+ aNewSize.Width=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Width);
+ aNewSize.Height=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Height);
+
+ return aNewSize;
+}
+
+awt::Point AbstractShapeFactory::calculateTopLeftPositionToCenterObject(
+ const awt::Point& rTargetAreaPosition
+ , const awt::Size& rTargetAreaSize
+ , const awt::Size& rObjectSize )
+{
+ awt::Point aNewPosition(rTargetAreaPosition);
+ aNewPosition.X += static_cast<sal_Int32>(double(rTargetAreaSize.Width-rObjectSize.Width)/2.0);
+ aNewPosition.Y += static_cast<sal_Int32>(double(rTargetAreaSize.Height-rObjectSize.Height)/2.0);
+ return aNewPosition;
+}
+
+::basegfx::B2IRectangle AbstractShapeFactory::getRectangleOfShape(
+ const uno::Reference< drawing::XShape >& xShape )
+{
+ ::basegfx::B2IRectangle aRet;
+
+ if( xShape.is() )
+ {
+ awt::Point aPos = xShape->getPosition();
+ awt::Size aSize = xShape->getSize();
+ aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
+ }
+ return aRet;
+
+}
+
+awt::Size AbstractShapeFactory::getSizeAfterRotation(
+ const uno::Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
+{
+ awt::Size aRet(0,0);
+ if(xShape.is())
+ {
+ const awt::Size aSize( xShape->getSize() );
+
+ if( ::rtl::math::approxEqual( fRotationAngleDegree, 0.0 ) )
+ aRet = aSize;
+ else
+ {
+ while(fRotationAngleDegree>=360.0)
+ fRotationAngleDegree-=360.0;
+ while(fRotationAngleDegree<0.0)
+ fRotationAngleDegree+=360.0;
+ if(fRotationAngleDegree>270.0)
+ fRotationAngleDegree=360.0-fRotationAngleDegree;
+ else if(fRotationAngleDegree>180.0)
+ fRotationAngleDegree=fRotationAngleDegree-180.0;
+ else if(fRotationAngleDegree>90.0)
+ fRotationAngleDegree=180.0-fRotationAngleDegree;
+
+ const double fAnglePi = fRotationAngleDegree*F_PI/180.0;
+
+ aRet.Height = static_cast<sal_Int32>(
+ aSize.Width*rtl::math::sin( fAnglePi )
+ + aSize.Height*rtl::math::cos( fAnglePi ));
+ aRet.Width = static_cast<sal_Int32>(
+ aSize.Width*rtl::math::cos( fAnglePi )
+ + aSize.Height*rtl::math::sin( fAnglePi ));
+ }
+ }
+ return aRet;
+}
+
+void AbstractShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xShapes )
+{
+ if( xShapes.is() )
+ {
+ sal_Int32 nSubCount = xShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nS = nSubCount; nS--; )
+ {
+ if( xShapes->getByIndex( nS ) >>= xShape )
+ xShapes->remove( xShape );
+ }
+ }
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/DummyShapeFactory.cxx b/chart2/source/view/main/DummyShapeFactory.cxx
new file mode 100644
index 000000000000..19f903099c11
--- /dev/null
+++ b/chart2/source/view/main/DummyShapeFactory.cxx
@@ -0,0 +1,242 @@
+/* -*- 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/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "DummyShapeFactory.hxx"
+#include "DummyXShape.hxx"
+#include "ViewDefines.hxx"
+#include "Stripe.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "PropertyMapper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/drawing/CircleKind.hpp>
+#include <com/sun/star/drawing/DoubleSequence.hpp>
+#include <com/sun/star/drawing/FlagSequence.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/PointSequence.hpp>
+#include <com/sun/star/drawing/PolygonKind.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/uno/Any.hxx>
+
+#include <editeng/unoprnms.hxx>
+#include <rtl/math.hxx>
+#include <svx/svdocirc.hxx>
+#include <svx/svdopath.hxx>
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+
+namespace chart
+{
+
+namespace dummy {
+
+uno::Reference< drawing::XShapes > DummyShapeFactory::getOrCreateChartRootShape(
+ const uno::Reference< drawing::XDrawPage>& )
+{
+ return new DummyXShapes();
+}
+
+// methods for 3D shape creation
+
+uno::Reference<drawing::XShape>
+ DummyShapeFactory::createCube(
+ const uno::Reference<drawing::XShapes>&
+ , const drawing::Position3D& , const drawing::Direction3D&
+ , sal_Int32
+ , const uno::Reference< beans::XPropertySet >&
+ , const tPropertyNameMap&
+ , bool )
+{
+ return new DummyXShape();
+}
+
+uno::Reference<drawing::XShape>
+ DummyShapeFactory::createCylinder(
+ const uno::Reference<drawing::XShapes>&
+ , const drawing::Position3D& , const drawing::Direction3D&
+ , sal_Int32 )
+{
+}
+
+uno::Reference<drawing::XShape>
+ DummyShapeFactory::createPyramid(
+ const uno::Reference<drawing::XShapes>&
+ , const drawing::Position3D& , const drawing::Direction3D&
+ , double , bool
+ , const uno::Reference< beans::XPropertySet >&
+ , const tPropertyNameMap& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference<drawing::XShape>
+ DummyShapeFactory::createCone(
+ const uno::Reference<drawing::XShapes>&
+ , const drawing::Position3D& , const drawing::Direction3D&
+ , double , sal_Int32 )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createPieSegment2D(
+ const uno::Reference< drawing::XShapes >&
+ , double , double
+ , double , double
+ , const drawing::Direction3D&
+ , const drawing::HomogenMatrix& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createPieSegment(
+ const uno::Reference< drawing::XShapes >&
+ , double , double
+ , double , double
+ , const drawing::Direction3D&
+ , const drawing::HomogenMatrix&
+ , double )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createStripe( const uno::Reference< drawing::XShapes >&
+ , const Stripe&
+ , const uno::Reference< beans::XPropertySet >&
+ , const tPropertyNameMap&
+ , sal_Bool
+ , short
+ , bool )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createArea3D( const uno::Reference< drawing::XShapes >&
+ , const drawing::PolyPolygonShape3D&
+ , double )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createArea2D( const uno::Reference< drawing::XShapes >&
+ , const drawing::PolyPolygonShape3D& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createSymbol2D(
+ const uno::Reference< drawing::XShapes >&
+ , const drawing::Position3D&
+ , const drawing::Direction3D&
+ , sal_Int32
+ , sal_Int32
+ , sal_Int32 )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createGraphic2D(
+ const uno::Reference< drawing::XShapes >&
+ , const drawing::Position3D&
+ , const drawing::Direction3D&
+ , const uno::Reference< graphic::XGraphic >& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShapes >
+ DummyShapeFactory::createGroup2D( const uno::Reference< drawing::XShapes >&
+ , OUString )
+{
+ return new DummyXShapes();
+}
+
+uno::Reference< drawing::XShapes >
+ DummyShapeFactory::createGroup3D( const uno::Reference< drawing::XShapes >&
+ , OUString )
+{
+ return new DummyXShapes();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createCircle2D( const uno::Reference< drawing::XShapes >&
+ , const drawing::Position3D&
+ , const drawing::Direction3D& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createLine3D( const uno::Reference< drawing::XShapes >&
+ , const drawing::PolyPolygonShape3D&
+ , const VLineProperties& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createLine2D( const uno::Reference< drawing::XShapes >&
+ , const drawing::PointSequenceSequence&
+ , const VLineProperties* )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape > DummyShapeFactory::createInvisibleRectangle(
+ const uno::Reference< drawing::XShapes >&
+ , const awt::Size& )
+{
+ return new DummyXShape();
+}
+
+uno::Reference< drawing::XShape >
+ DummyShapeFactory::createText( const uno::Reference< drawing::XShapes >&
+ , const OUString&
+ , const tNameSequence&
+ , const tAnySequence&
+ , const uno::Any& )
+{
+ return new DummyXShape();
+}
+
+} //namespace dummy
+
+} //namespace chart
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
new file mode 100644
index 000000000000..39bac9ed3147
--- /dev/null
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -0,0 +1,221 @@
+/* -*- 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 "DummyXShape.hxx"
+#include <rtl/ustring.hxx>
+
+#include <algorithm>
+
+using namespace com::sun::star;
+
+namespace chart {
+
+namespace dummy {
+
+OUString DummyXShape::getName()
+ throw(uno::RuntimeException)
+{
+ return maName;
+}
+
+void DummyXShape::setName( const OUString& rName )
+ throw(uno::RuntimeException)
+{
+ maName = rName;
+}
+
+awt::Point DummyXShape::getPosition()
+ throw(uno::RuntimeException)
+{
+ return maPosition;
+}
+
+void DummyXShape::setPosition( const awt::Point& rPoint )
+ throw(uno::RuntimeException)
+{
+ maPosition = rPoint;
+}
+
+awt::Size DummyXShape::getSize()
+ throw(uno::RuntimeException)
+{
+ return maSize;
+}
+
+void DummyXShape::setSize( const awt::Size& rSize )
+ throw(beans::PropertyVetoException, uno::RuntimeException)
+{
+ maSize = rSize;
+}
+
+OUString DummyXShape::getShapeType()
+ throw(uno::RuntimeException)
+{
+ return OUString("dummy shape");
+}
+uno::Reference< beans::XPropertySetInfo > DummyXShape::getPropertySetInfo()
+ throw(uno::RuntimeException)
+{
+ return uno::Reference< beans::XPropertySetInfo >();
+}
+
+void DummyXShape::setPropertyValue( const OUString& rName, const uno::Any& )
+ throw(beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ SAL_DEBUG("DummyXShape::setProperty: " << rName << " " << "Any");
+}
+
+uno::Any DummyXShape::getPropertyValue( const OUString& rName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ SAL_DEBUG("DummyXShape::getPropertyValue: " << rName);
+ return uno::Any();
+}
+
+void DummyXShape::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+void DummyXShape::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+void DummyXShape::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+void DummyXShape::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+
+OUString DummyXShape::getImplementationName()
+ throw(uno::RuntimeException)
+{
+ return OUString("DummyXShape");
+}
+
+namespace {
+
+uno::Sequence< OUString > listSupportedServices()
+{
+ static uno::Sequence< OUString > aSupportedServices;
+ if(aSupportedServices.getLength() == 0)
+ {
+ aSupportedServices.realloc(3);
+ aSupportedServices[0] = "com.sun.star.drawing.Shape";
+ aSupportedServices[1] = "com.sun.star.container.Named";
+ aSupportedServices[2] = "com.sun.star.beans.PropertySet";
+ }
+
+ return aSupportedServices;
+}
+
+}
+
+uno::Sequence< OUString > DummyXShape::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ return listSupportedServices();
+}
+
+sal_Bool DummyXShape::supportsService( const OUString& rServiceName )
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< OUString > aSupportedServices = listSupportedServices();
+ for(sal_Int32 i = 0; i < aSupportedServices.getLength(); ++i)
+ {
+ if(aSupportedServices[i] == rServiceName)
+ return true;
+ }
+
+ return false;
+}
+
+uno::Reference< uno::XInterface > DummyXShape::getParent()
+ throw(uno::RuntimeException)
+{
+ return mxParent;
+}
+
+void DummyXShape::setParent( const uno::Reference< uno::XInterface >& xParent )
+ throw(lang::NoSupportException, uno::RuntimeException)
+{
+ mxParent = xParent;
+}
+
+uno::Any DummyXShapes::queryInterface( const uno::Type& rType )
+ throw(uno::RuntimeException)
+{
+ return DummyXShape::queryInterface(rType);
+}
+
+void DummyXShapes::acquire()
+ throw()
+{
+ DummyXShape::acquire();
+}
+
+void DummyXShapes::release()
+ throw()
+{
+ DummyXShape::release();
+}
+
+void DummyXShapes::add( const uno::Reference< drawing::XShape>& xShape )
+ throw(uno::RuntimeException)
+{
+ maShapes.push_back(xShape);
+}
+
+void DummyXShapes::remove( const uno::Reference< drawing::XShape>& xShape )
+ throw(uno::RuntimeException)
+{
+ std::vector< uno::Reference<drawing::XShape> >::iterator itr = std::find(maShapes.begin(), maShapes.end(), xShape);
+ if(itr != maShapes.end())
+ maShapes.erase(itr);
+}
+
+uno::Type DummyXShapes::getElementType()
+ throw(uno::RuntimeException)
+{
+ return ::getCppuType(( const uno::Reference< drawing::XShape >*)0);
+}
+
+sal_Bool DummyXShapes::hasElements()
+ throw(uno::RuntimeException)
+{
+ return !maShapes.empty();
+}
+
+sal_Int32 DummyXShapes::getCount()
+ throw(uno::RuntimeException)
+{
+ return maShapes.size();
+}
+
+uno::Any DummyXShapes::getByIndex(sal_Int32 nIndex)
+ throw(lang::IndexOutOfBoundsException, lang::WrappedTargetException,
+ uno::RuntimeException)
+{
+ uno::Any aShape;
+ aShape <<= maShapes[nIndex];
+ return aShape;
+}
+
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index 92cb7de36f22..bf8b360b7728 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -57,74 +57,6 @@ using ::com::sun::star::uno::Reference;
namespace chart
{
-// set a name/CID at a shape (is used for selection handling)
-
-void ShapeFactory::setShapeName( const uno::Reference< drawing::XShape >& xShape
- , const OUString& rName )
-{
- if(!xShape.is())
- return;
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
- if( xProp.is())
- {
- try
- {
- xProp->setPropertyValue( UNO_NAME_MISC_OBJ_NAME
- , uno::makeAny( rName ) );
- }
- catch( const uno::Exception& e )
- {
- ASSERT_EXCEPTION( e );
- }
- }
-}
-
-OUString ShapeFactory::getShapeName( const uno::Reference< drawing::XShape >& xShape )
-{
- OUString aRet;
-
- uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xProp.is(), "shape offers no XPropertySet");
- if( xProp.is())
- {
- try
- {
- xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
- }
- catch( const uno::Exception& e )
- {
- ASSERT_EXCEPTION( e );
- }
- }
-
- return aRet;
-}
-
-uno::Reference< drawing::XShapes > ShapeFactory::getChartRootShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
-{
- uno::Reference< drawing::XShapes > xRet;
- uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
- if( xShapes.is() )
- {
- sal_Int32 nCount = xShapes->getCount();
- uno::Reference< drawing::XShape > xShape;
- for( sal_Int32 nN = nCount; nN--; )
- {
- if( xShapes->getByIndex( nN ) >>= xShape )
- {
- if( ShapeFactory::getShapeName( xShape ).equals("com.sun.star.chart2.shapes") )
- {
- xRet = uno::Reference< drawing::XShapes >( xShape, uno::UNO_QUERY );
- break;
- }
- }
- }
- }
- return xRet;
-}
-
uno::Reference< drawing::XShapes > ShapeFactory::getOrCreateChartRootShape(
const uno::Reference< drawing::XDrawPage>& xDrawPage )
{
@@ -1193,32 +1125,6 @@ uno::Reference< drawing::XShape >
return xShape;
}
-// Be careful here not to clash with the SYMBOL_FOO #defines in
-// <rsc/rsc-vcl-shared-types.hxx>
-
-enum SymbolEnum { Symbol_Square=0
- , Symbol_Diamond
- , Symbol_DownArrow
- , Symbol_UpArrow
- , Symbol_RightArrow
- , Symbol_LeftArrow
- , Symbol_Bowtie
- , Symbol_Sandglass
- , Symbol_Circle
- , Symbol_Star
- , Symbol_X
- , Symbol_Plus
- , Symbol_Asterisk
- , Symbol_HorizontalBar
- , Symbol_VerticalBar
- , Symbol_COUNT
- };
-
-sal_Int32 ShapeFactory::getSymbolCount()
-{
- return Symbol_COUNT;
-}
-
drawing::PolyPolygonShape3D createPolyPolygon_Symbol( const drawing::Position3D& rPos
, const drawing::Direction3D& rSize
, sal_Int32 nStandardSymbol )
@@ -2077,36 +1983,6 @@ uno::Reference< drawing::XShape >
return xShape;
}
-uno::Any ShapeFactory::makeTransformation( const awt::Point& rScreenPosition2D, double fRotationAnglePi )
-{
- ::basegfx::B2DHomMatrix aM;
- //As autogrow is active the rectangle is automatically expanded to that side
- //to which the text is not adjusted.
- // aM.scale( 1, 1 ); Oops? A scale with this parameters is neutral, line commented out
- aM.rotate( fRotationAnglePi );
- aM.translate( rScreenPosition2D.X, rScreenPosition2D.Y );
- uno::Any aATransformation = uno::makeAny( B2DHomMatrixToHomogenMatrix3(aM) );
- return aATransformation;
-}
-
-void ShapeFactory::makeShapeInvisible( const uno::Reference< drawing::XShape >& xShape )
-{
- uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY );
- OSL_ENSURE(xShapeProp.is(), "created shape offers no XPropertySet");
- if( xShapeProp.is())
- {
- try
- {
- xShapeProp->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_NONE ));
- xShapeProp->setPropertyValue( "FillStyle", uno::makeAny( drawing::FillStyle_NONE ));
- }
- catch( const uno::Exception& e )
- {
- ASSERT_EXCEPTION( e );
- }
- }
-}
-
uno::Reference< drawing::XShape > ShapeFactory::createInvisibleRectangle(
const uno::Reference< drawing::XShapes >& xTarget
, const awt::Size& rSize )
@@ -2177,142 +2053,6 @@ uno::Reference< drawing::XShape >
return xShape;
}
-OUString ShapeFactory::getStackedString( const OUString& rString, bool bStacked )
-{
- sal_Int32 nLen = rString.getLength();
- if(!bStacked || !nLen)
- return rString;
-
- OUStringBuffer aStackStr;
-
- //add a newline after each letter
- //as we do not no letters here add a newline after each char
- for( sal_Int32 nPosSrc=0; nPosSrc < nLen; nPosSrc++ )
- {
- if( nPosSrc )
- aStackStr.append( '\r' );
- aStackStr.append(rString[nPosSrc]);
- }
- return aStackStr.makeStringAndClear();
-}
-
-bool ShapeFactory::hasPolygonAnyLines( drawing::PolyPolygonShape3D& rPoly)
-{
- // #i67757# check all contained polygons, if at least one polygon contains 2 or more points, return true
- for( sal_Int32 nIdx = 0, nCount = rPoly.SequenceX.getLength(); nIdx < nCount; ++nIdx )
- if( rPoly.SequenceX[ nIdx ].getLength() > 1 )
- return true;
- return false;
-}
-
-bool ShapeFactory::isPolygonEmptyOrSinglePoint( drawing::PolyPolygonShape3D& rPoly)
-{
- // true, if empty polypolygon or one polygon with one point
- return (rPoly.SequenceX.getLength() == 0) ||
- ((rPoly.SequenceX.getLength() == 1) && (rPoly.SequenceX[0].getLength() <= 1));
-}
-
-void ShapeFactory::closePolygon( drawing::PolyPolygonShape3D& rPoly)
-{
- OSL_ENSURE( rPoly.SequenceX.getLength() <= 1, "ShapeFactory::closePolygon - single polygon expected" );
- //add a last point == first point
- if(isPolygonEmptyOrSinglePoint(rPoly))
- return;
- drawing::Position3D aFirst(rPoly.SequenceX[0][0],rPoly.SequenceY[0][0],rPoly.SequenceZ[0][0]);
- AddPointToPoly( rPoly, aFirst );
-}
-
-awt::Size ShapeFactory::calculateNewSizeRespectingAspectRatio(
- const awt::Size& rTargetSize
- , const awt::Size& rSourceSizeWithCorrectAspectRatio )
-{
- awt::Size aNewSize;
-
- double fFactorWidth = double(rTargetSize.Width)/double(rSourceSizeWithCorrectAspectRatio.Width);
- double fFactorHeight = double(rTargetSize.Height)/double(rSourceSizeWithCorrectAspectRatio.Height);
- double fFactor = std::min(fFactorWidth,fFactorHeight);
- aNewSize.Width=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Width);
- aNewSize.Height=static_cast<sal_Int32>(fFactor*rSourceSizeWithCorrectAspectRatio.Height);
-
- return aNewSize;
-}
-
-awt::Point ShapeFactory::calculateTopLeftPositionToCenterObject(
- const awt::Point& rTargetAreaPosition
- , const awt::Size& rTargetAreaSize
- , const awt::Size& rObjectSize )
-{
- awt::Point aNewPosition(rTargetAreaPosition);
- aNewPosition.X += static_cast<sal_Int32>(double(rTargetAreaSize.Width-rObjectSize.Width)/2.0);
- aNewPosition.Y += static_cast<sal_Int32>(double(rTargetAreaSize.Height-rObjectSize.Height)/2.0);
- return aNewPosition;
-}
-
-::basegfx::B2IRectangle ShapeFactory::getRectangleOfShape(
- const uno::Reference< drawing::XShape >& xShape )
-{
- ::basegfx::B2IRectangle aRet;
-
- if( xShape.is() )
- {
- awt::Point aPos = xShape->getPosition();
- awt::Size aSize = xShape->getSize();
- aRet = BaseGFXHelper::makeRectangle(aPos,aSize);
- }
- return aRet;
-
-}
-
-awt::Size ShapeFactory::getSizeAfterRotation(
- const uno::Reference< drawing::XShape >& xShape, double fRotationAngleDegree )
-{
- awt::Size aRet(0,0);
- if(xShape.is())
- {
- const awt::Size aSize( xShape->getSize() );
-
- if( ::rtl::math::approxEqual( fRotationAngleDegree, 0.0 ) )
- aRet = aSize;
- else
- {
- while(fRotationAngleDegree>=360.0)
- fRotationAngleDegree-=360.0;
- while(fRotationAngleDegree<0.0)
- fRotationAngleDegree+=360.0;
- if(fRotationAngleDegree>270.0)
- fRotationAngleDegree=360.0-fRotationAngleDegree;
- else if(fRotationAngleDegree>180.0)
- fRotationAngleDegree=fRotationAngleDegree-180.0;
- else if(fRotationAngleDegree>90.0)
- fRotationAngleDegree=180.0-fRotationAngleDegree;
-
- const double fAnglePi = fRotationAngleDegree*F_PI/180.0;
-
- aRet.Height = static_cast<sal_Int32>(
- aSize.Width*rtl::math::sin( fAnglePi )
- + aSize.Height*rtl::math::cos( fAnglePi ));
- aRet.Width = static_cast<sal_Int32>(
- aSize.Width*rtl::math::cos( fAnglePi )
- + aSize.Height*rtl::math::sin( fAnglePi ));
- }
- }
- return aRet;
-}
-
-void ShapeFactory::removeSubShapes( const uno::Reference< drawing::XShapes >& xShapes )
-{
- if( xShapes.is() )
- {
- sal_Int32 nSubCount = xShapes->getCount();
- uno::Reference< drawing::XShape > xShape;
- for( sal_Int32 nS = nSubCount; nS--; )
- {
- if( xShapes->getByIndex( nS ) >>= xShape )
- xShapes->remove( xShape );
- }
- }
-}
-
} //namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */