2013-10-05 00:57:25 +02:00
|
|
|
/* -*- 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/.
|
|
|
|
*/
|
|
|
|
|
2014-06-03 11:20:22 +02:00
|
|
|
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_ABSTRACTSHAPEFACTORY_HXX
|
|
|
|
#define INCLUDED_CHART2_SOURCE_VIEW_INC_ABSTRACTSHAPEFACTORY_HXX
|
2013-10-05 00:57:25 +02:00
|
|
|
|
|
|
|
#include "PropertyMapper.hxx"
|
|
|
|
#include "VLineProperties.hxx"
|
|
|
|
#include "BaseGFXHelper.hxx"
|
2013-10-08 02:10:04 +02:00
|
|
|
#include <com/sun/star/awt/Size.hpp>
|
|
|
|
#include <com/sun/star/awt/Point.hpp>
|
2013-10-05 00:57:25 +02:00
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
2013-10-08 02:10:04 +02:00
|
|
|
#include <com/sun/star/chart2/XFormattedString.hpp>
|
2013-10-05 00:57:25 +02:00
|
|
|
#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>
|
2014-01-10 11:30:59 -05:00
|
|
|
#include <com/sun/star/drawing/XShapes2.hpp>
|
2013-10-05 00:57:25 +02:00
|
|
|
#include <com/sun/star/graphic/XGraphic.hpp>
|
2013-10-05 01:50:11 +02:00
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2013-10-08 02:10:04 +02:00
|
|
|
#include <rtl/ustring.hxx>
|
|
|
|
|
2014-06-01 01:28:06 +02:00
|
|
|
class OpenGLWindow;
|
|
|
|
|
2013-10-05 00:57:25 +02:00
|
|
|
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
|
|
|
|
{
|
2013-12-09 07:40:23 +01:00
|
|
|
protected:
|
2016-10-18 11:55:32 +02:00
|
|
|
css::uno::Reference< css::lang::XMultiServiceFactory> m_xShapeFactory;
|
2013-12-09 07:40:23 +01:00
|
|
|
|
2013-10-05 00:57:25 +02:00
|
|
|
public:
|
|
|
|
|
2014-01-10 11:30:59 -05:00
|
|
|
enum StackPosition { Top, Bottom };
|
|
|
|
|
2016-04-12 10:50:29 +02:00
|
|
|
static AbstractShapeFactory* getOrCreateShapeFactory(const css::uno::Reference< css::lang::XMultiServiceFactory>& xFactory);
|
2013-10-05 01:50:11 +02:00
|
|
|
|
2013-10-05 00:57:25 +02:00
|
|
|
virtual ~AbstractShapeFactory() {};
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShapes >
|
2013-10-05 00:57:25 +02:00
|
|
|
createGroup2D(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const OUString& aName = OUString() ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShapes >
|
2013-10-05 00:57:25 +02:00
|
|
|
createGroup3D(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const OUString& aName = OUString() ) = 0;
|
|
|
|
|
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createCube( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPosition
|
|
|
|
, const css::drawing::Direction3D& rSize
|
2013-10-05 00:57:25 +02:00
|
|
|
, sal_Int32 nRotateZAngleHundredthDegree
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
|
2013-10-05 00:57:25 +02:00
|
|
|
, const tPropertyNameMap& rPropertyNameMap
|
|
|
|
, bool bRounded = false) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createCylinder( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPosition
|
|
|
|
, const css::drawing::Direction3D& rSize
|
2013-10-05 00:57:25 +02:00
|
|
|
, sal_Int32 nRotateZAngleHundredthDegree ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createPyramid( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPosition
|
|
|
|
, const css::drawing::Direction3D& rSize
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fTopHeight
|
|
|
|
, bool bRotateZ
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::uno::Reference<
|
|
|
|
css::beans::XPropertySet >& xSourceProp
|
2013-10-05 00:57:25 +02:00
|
|
|
, const tPropertyNameMap& rPropertyNameMap) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createCone( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPosition
|
|
|
|
, const css::drawing::Direction3D& rSize
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fTopHeight, sal_Int32 nRotateZAngleHundredthDegree ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createPieSegment2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
|
|
|
|
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::drawing::Direction3D& rOffset
|
|
|
|
, const css::drawing::HomogenMatrix& rUnitCircleToScene ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createPieSegment( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fUnitCircleStartAngleDegree, double fUnitCircleWidthAngleDegree
|
|
|
|
, double fUnitCircleInnerRadius, double fUnitCircleOuterRadius
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::drawing::Direction3D& rOffset
|
|
|
|
, const css::drawing::HomogenMatrix& rUnitCircleToScene
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fDepth ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createStripe( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
2013-10-05 00:57:25 +02:00
|
|
|
, const Stripe& rStripe
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::uno::Reference< css::beans::XPropertySet >& xSourceProp
|
2013-10-05 00:57:25 +02:00
|
|
|
, const tPropertyNameMap& rPropertyNameMap
|
2016-08-04 11:35:36 +02:00
|
|
|
, bool bDoubleSided
|
2013-10-05 00:57:25 +02:00
|
|
|
, short nRotatedTexture = 0 //0 to 7 are the different possibilities
|
|
|
|
, bool bFlatNormals=true ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createArea3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::PolyPolygonShape3D& rPolyPolygon
|
2013-10-05 00:57:25 +02:00
|
|
|
, double fDepth) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createArea2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::PolyPolygonShape3D& rPolyPolygon) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-03-19 16:02:29 +02:00
|
|
|
static sal_Int32 getSymbolCount() { return Symbol_COUNT; }
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createSymbol2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPos
|
|
|
|
, const css::drawing::Direction3D& rSize
|
2013-10-05 00:57:25 +02:00
|
|
|
, sal_Int32 nStandardSymbol
|
2016-08-04 11:35:36 +02:00
|
|
|
, sal_Int32 nBorderColor
|
|
|
|
, sal_Int32 nFillColor ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createGraphic2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPos
|
|
|
|
, const css::drawing::Direction3D& rSize
|
|
|
|
, const css::uno::Reference< css::graphic::XGraphic >& xGraphic ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createLine2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::PointSequenceSequence& rPoints
|
2015-11-10 10:11:17 +01:00
|
|
|
, const VLineProperties* pLineProperties = nullptr ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createLine ( const css::uno::Reference< css::drawing::XShapes >& xTarget,
|
|
|
|
const css::awt::Size& rSize, const css::awt::Point& rPosition ) = 0;
|
2013-10-06 02:57:26 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createLine3D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::PolyPolygonShape3D& rPoints
|
2013-10-05 00:57:25 +02:00
|
|
|
, const VLineProperties& rLineProperties ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createCircle2D( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::drawing::Position3D& rPos
|
|
|
|
, const css::drawing::Direction3D& rSize ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createCircle( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::awt::Size& rSize
|
|
|
|
, const css::awt::Point& rPosition ) = 0;
|
2013-10-06 02:57:26 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D
|
2013-10-05 00:57:25 +02:00
|
|
|
, const OUString& rText
|
|
|
|
, const tNameSequence& rPropNames
|
|
|
|
, const tAnySequence& rPropValues
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::uno::Any& rATransformation
|
2013-10-05 00:57:25 +02:00
|
|
|
) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::uno::Sequence< OUString >& rTextParagraphs
|
|
|
|
, const css::uno::Sequence< tNameSequence >& rParaPropNames
|
|
|
|
, const css::uno::Sequence< tAnySequence >& rParaPropValues
|
2015-07-19 18:18:00 +02:00
|
|
|
, const tNameSequence& rPropNames
|
|
|
|
, const tAnySequence& rPropValues
|
2015-11-27 11:14:38 +02:00
|
|
|
, const css::uno::Any& rATransformation ) = 0;
|
|
|
|
|
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
|
|
|
createText( const css::uno::Reference< css::drawing::XShapes >& xTarget2D,
|
|
|
|
const css::awt::Size& rSize,
|
|
|
|
const css::awt::Point& rPosition,
|
|
|
|
css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& xFormattedString,
|
|
|
|
const css::uno::Reference< css::beans::XPropertySet > & xTextProperties,
|
2013-10-08 02:10:04 +02:00
|
|
|
double nRotation, const OUString& aName ) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
2013-10-05 00:57:25 +02:00
|
|
|
createInvisibleRectangle(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShapes >& xTarget
|
|
|
|
, const css::awt::Size& rSize ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
2013-10-06 02:57:26 +02:00
|
|
|
createRectangle(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShapes >& xTarget,
|
|
|
|
const css::awt::Size& rSize,
|
|
|
|
const css::awt::Point& rPosition,
|
2014-01-10 11:30:59 -05:00
|
|
|
const tNameSequence& rPropNames,
|
|
|
|
const tAnySequence& rPropValues,
|
|
|
|
StackPosition ePos = Top ) = 0;
|
2013-10-06 02:57:26 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShape >
|
2013-10-07 01:43:11 +02:00
|
|
|
createRectangle(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShapes >& xTarget ) = 0;
|
2013-10-07 01:43:11 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual css::uno::Reference< css::drawing::XShapes >
|
|
|
|
getOrCreateChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage ) = 0;
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual void setPageSize( css::uno::Reference < css::drawing::XShapes > xChartShapes, const css::awt::Size& rSize ) = 0;
|
2013-10-22 13:49:15 +02:00
|
|
|
|
2013-12-28 07:21:34 +01:00
|
|
|
/**
|
|
|
|
* Only necessary for stateless implementations
|
|
|
|
*/
|
2016-08-04 11:35:36 +02:00
|
|
|
virtual void render(css::uno::Reference< css::drawing::XShapes > xRootShape, bool bInitOpenGL) = 0;
|
2013-12-28 07:21:34 +01:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual bool preRender(css::uno::Reference< css::drawing::XShapes > xRootShape, OpenGLWindow* pWindow) = 0;
|
2014-06-01 01:28:06 +02:00
|
|
|
virtual void postRender(OpenGLWindow* pWindow) = 0;
|
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
virtual void clearPage(css::uno::Reference< css::drawing::XShapes > xRootShape) = 0;
|
2014-01-12 22:53:19 +01:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static css::uno::Reference< css::drawing::XShapes >
|
|
|
|
getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static void makeShapeInvisible( const css::uno::Reference< css::drawing::XShape >& xShape );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static void setShapeName( const css::uno::Reference< css::drawing::XShape >& xShape
|
2014-01-05 08:36:59 +01:00
|
|
|
, const OUString& rName );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static OUString getShapeName( const css::uno::Reference< css::drawing::XShape >& xShape );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static css::uno::Any makeTransformation( const css::awt::Point& rScreenPosition2D, double fRotationAnglePi=0.0 );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2016-08-04 11:35:36 +02:00
|
|
|
static OUString getStackedString( const OUString& rString, bool bStacked );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static bool hasPolygonAnyLines( css::drawing::PolyPolygonShape3D& rPoly );
|
|
|
|
static bool isPolygonEmptyOrSinglePoint( css::drawing::PolyPolygonShape3D& rPoly );
|
|
|
|
static void closePolygon( css::drawing::PolyPolygonShape3D& rPoly );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static css::awt::Size calculateNewSizeRespectingAspectRatio(
|
|
|
|
const css::awt::Size& rTargetSize
|
|
|
|
, const css::awt::Size& rSourceSizeWithCorrectAspectRatio );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static css::awt::Point calculateTopLeftPositionToCenterObject(
|
|
|
|
const css::awt::Point& rTargetAreaPosition
|
|
|
|
, const css::awt::Size& rTargetAreaSize
|
|
|
|
, const css::awt::Size& rObjectSize );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2014-01-05 08:36:59 +01:00
|
|
|
static ::basegfx::B2IRectangle getRectangleOfShape(
|
2015-11-27 11:14:38 +02:00
|
|
|
const css::uno::Reference< css::drawing::XShape >& xShape );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static css::awt::Size getSizeAfterRotation(
|
|
|
|
const css::uno::Reference< css::drawing::XShape >& xShape, double fRotationAngleDegree );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
2015-11-27 11:14:38 +02:00
|
|
|
static void removeSubShapes( const css::uno::Reference< css::drawing::XShapes >& xShapes );
|
2013-10-05 00:57:25 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2014-06-01 01:28:06 +02:00
|
|
|
|
2013-10-05 00:57:25 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|