diff options
Diffstat (limited to 'include/svx/sdr/primitive2d')
16 files changed, 1584 insertions, 0 deletions
diff --git a/include/svx/sdr/primitive2d/primitiveFactory2d.hxx b/include/svx/sdr/primitive2d/primitiveFactory2d.hxx new file mode 100644 index 000000000000..d602d28d4f5c --- /dev/null +++ b/include/svx/sdr/primitive2d/primitiveFactory2d.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX + +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <cppuhelper/compbase1.hxx> +#include <comphelper/broadcasthelper.hxx> + +#include <svx/svxdllapi.h> + +////////////////////////////////////////////////////////////////////////////// +// UNO API helper methods + +namespace drawinglayer +{ + namespace primitive2d + { + SVX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL XPrimitiveFactory2DProvider_createInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( ::com::sun::star::uno::Exception ); + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// PrimitiveFactory2D class + +namespace drawinglayer +{ + namespace primitive2d + { + // typedef for PrimitiveFactory2DImplBase + typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitiveFactory2D > PrimitiveFactory2DImplBase; + + // base class for C++ implementation of com::sun::star::graphic::XPrimitiveFactory2D + class PrimitiveFactory2D + : protected comphelper::OBaseMutex, + public PrimitiveFactory2DImplBase + { + private: + protected: + public: + // constructor + PrimitiveFactory2D(); + + // Methods from XPrimitiveFactory2D + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aParms ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > > SAL_CALL createPrimitivesFromXDrawPage( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aParms ) throw (::com::sun::star::uno::RuntimeException); + + // UNO API helpers + SVX_DLLPUBLIC static OUString getImplementationName_Static(); + SVX_DLLPUBLIC static com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(); + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_PRIMITIVEFACTORY2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrattributecreator.hxx b/include/svx/sdr/primitive2d/sdrattributecreator.hxx new file mode 100644 index 000000000000..e3e940993790 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrattributecreator.hxx @@ -0,0 +1,133 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX + +#include <sal/types.h> + +////////////////////////////////////////////////////////////////////////////// +// predefines +class SfxItemSet; +class SdrText; + +namespace drawinglayer { namespace attribute { + class SdrLineAttribute; + class SdrLineStartEndAttribute; + class SdrShadowAttribute; + class SdrFillAttribute; + class SdrTextAttribute; + class FillGradientAttribute; + class SdrFillBitmapAttribute; + class SdrShadowTextAttribute; + class SdrLineShadowTextAttribute; + class SdrLineFillShadowTextAttribute; + class SdrLineFillShadowAttribute3D; + class SdrSceneAttribute; + class SdrLightingAttribute; + class SdrFillTextAttribute; +}} + +namespace basegfx { + class B2DRange; +} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + // SdrAttribute creators + attribute::SdrLineAttribute createNewSdrLineAttribute( + const SfxItemSet& rSet); + + attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute( + const SfxItemSet& rSet, + double fWidth); + + attribute::SdrShadowAttribute createNewSdrShadowAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillAttribute createNewSdrFillAttribute( + const SfxItemSet& rSet); + + // #i101508# Support handing over given text-to-border distances + attribute::SdrTextAttribute createNewSdrTextAttribute( + const SfxItemSet& rSet, + const SdrText& rText, + const sal_Int32* pLeft = 0, + const sal_Int32* pUpper = 0, + const sal_Int32* pRight = 0, + const sal_Int32* pLower = 0); + + attribute::FillGradientAttribute createNewTransparenceGradientAttribute( + const SfxItemSet& rSet); + + attribute::SdrFillBitmapAttribute createNewSdrFillBitmapAttribute( + const SfxItemSet& rSet); + + attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bSuppressText); // #i98072# added option to suppress text on demand + + attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText); + + attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute( + const SfxItemSet& rSet, + const SdrText* pText, + bool bHasContent); // used from OLE and graphic + + attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute( + const SfxItemSet& rSet, + bool bSuppressFill); + + attribute::SdrSceneAttribute createNewSdrSceneAttribute( + const SfxItemSet& rSet); + + attribute::SdrLightingAttribute createNewSdrLightingAttribute( + const SfxItemSet& rSet); + + // #i101508# Support handing over given text-to-border distances + attribute::SdrFillTextAttribute createNewSdrFillTextAttribute( + const SfxItemSet& rSet, + const SdrText* pSdrText, + const sal_Int32* pLeft = 0, + const sal_Int32* pUpper = 0, + const sal_Int32* pRight = 0, + const sal_Int32* pLower = 0); + + // helpers + void calculateRelativeCornerRadius( + sal_Int32 nRadius, + const ::basegfx::B2DRange& rObjectRange, + double& rfCornerRadiusX, + double& rfCornerRadiusY); + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRATTRIBUTECREATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx new file mode 100644 index 000000000000..472c08861412 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx @@ -0,0 +1,79 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrCaptionPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + ::basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + ::basegfx::B2DPolygon maTail; + double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width + double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrCaptionPrimitive2D( + const ::basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, + const ::basegfx::B2DPolygon& rTail, + double fCornerRadiusX = 0.0, + double fCornerRadiusY = 0.0); + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // data access + const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + const ::basegfx::B2DPolygon& getTail() const { return maTail; } + double getCornerRadiusX() const { return mfCornerRadiusX; } + double getCornerRadiusY() const { return mfCornerRadiusY; } + bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRCAPTIONPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx new file mode 100644 index 000000000000..882c2895e0b8 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrConnectorPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; + ::basegfx::B2DPolygon maUnitPolygon; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrConnectorPrimitive2D( + const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, + const ::basegfx::B2DPolygon& rUnitPolygon); + + // data access + const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; } + const ::basegfx::B2DPolygon& getUnitPolygon() const { return maUnitPolygon; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRCONNECTORPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx new file mode 100644 index 000000000000..a43bd2df72bd --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx @@ -0,0 +1,89 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrCustomShapePrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + attribute::SdrShadowTextAttribute maSdrSTAttribute; + Primitive2DSequence maSubPrimitives; + basegfx::B2DHomMatrix maTextBox; + + // bitfield + // defines if SdrTextWordWrapItem was set at SdrObjCustomShape which means + // that the text needs to be block formatted + unsigned mbWordWrap : 1; + + // defines that the object contains/is a 3D AutoShape. Needed for + // making exceptions with shadow generation + unsigned mb3DShape : 1; + + // #SJ# Allow text clipping against TextBox in special cases (used for SC) + unsigned mbForceTextClipToTextRange : 1; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrCustomShapePrimitive2D( + const attribute::SdrShadowTextAttribute& rSdrSTAttribute, + const Primitive2DSequence& rSubPrimitives, + const basegfx::B2DHomMatrix& rTextBox, + bool bWordWrap, + bool b3DShape, + bool bForceTextClipToTextRange); + + // data access + const attribute::SdrShadowTextAttribute& getSdrSTAttribute() const { return maSdrSTAttribute; } + const Primitive2DSequence& getSubPrimitives() const { return maSubPrimitives; } + const basegfx::B2DHomMatrix& getTextBox() const { return maTextBox; } + bool getWordWrap() const { return mbWordWrap; } + bool get3DShape() const { return mb3DShape; } + bool isForceTextClipToTextRange() const { return mbForceTextClipToTextRange; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDCUSTOMSHAPEPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrdecompositiontools.hxx b/include/svx/sdr/primitive2d/sdrdecompositiontools.hxx new file mode 100644 index 000000000000..cac426980dee --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrdecompositiontools.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines +namespace basegfx { + class B2DPolygon; + class B2DPolyPolygon; + class B2DHomMatrix; +} + +namespace drawinglayer { namespace attribute { + class SdrFillAttribute; + class SdrLineAttribute; + class FillGradientAttribute; + class SdrShadowAttribute; + class SdrLineStartEndAttribute; + class SdrTextAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DReference createPolyPolygonFillPrimitive( + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, + const attribute::SdrFillAttribute& rFill, + const attribute::FillGradientAttribute& rFillGradient); + + Primitive2DReference createPolygonLinePrimitive( + const basegfx::B2DPolygon& rUnitPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, + const attribute::SdrLineAttribute& rLine, + const attribute::SdrLineStartEndAttribute& rStroke); + + Primitive2DReference createTextPrimitive( + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform, + const attribute::SdrTextAttribute& rText, + const attribute::SdrLineAttribute& rStroke, + bool bCellText, + bool bWordWrap, + bool bClipOnBounds); + + Primitive2DSequence createEmbeddedShadowPrimitive( + const Primitive2DSequence& rContent, + const attribute::SdrShadowAttribute& rShadow); + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx new file mode 100644 index 000000000000..338fc52567c3 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx @@ -0,0 +1,112 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrEllipsePrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + ::basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrEllipsePrimitive2D( + const ::basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute); + + // data access + const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrEllipseSegmentPrimitive2D : public SdrEllipsePrimitive2D + { + private: + double mfStartAngle; + double mfEndAngle; + + // bitfield + unsigned mbCloseSegment : 1; + unsigned mbCloseUsingCenter : 1; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrEllipseSegmentPrimitive2D( + const ::basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, + double fStartAngle, + double fEndAngle, + bool bCloseSegment, + bool bCloseUsingCenter); + + // data access + double getStartAngle() const { return mfStartAngle; } + double getEndAngle() const { return mfEndAngle; } + bool getCloseSegment() const { return mbCloseSegment; } + bool getCloseUsingCenter() const { return mbCloseUsingCenter; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRELLIPSEPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx new file mode 100644 index 000000000000..dfb098e9c010 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svtools/grfmgr.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrGrafPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + ::basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + GraphicObject maGraphicObject; + GraphicAttr maGraphicAttr; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrGrafPrimitive2D( + const ::basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, + const GraphicObject& rGraphicObject, + const GraphicAttr& rGraphicAttr); + + // data access + const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + const GraphicObject& getGraphicObject() const { return maGraphicObject; } + const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; } + bool isTransparent() const; + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRGRAFPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx new file mode 100644 index 000000000000..592f14afe742 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx @@ -0,0 +1,125 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace drawinglayer { namespace primitive2d { + enum MeasureTextPosition + { + MEASURETEXTPOSITION_AUTOMATIC, + MEASURETEXTPOSITION_NEGATIVE, + MEASURETEXTPOSITION_CENTERED, + MEASURETEXTPOSITION_POSITIVE + }; +}} + +namespace drawinglayer { namespace attribute { + class SdrLineAttribute; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrMeasurePrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + attribute::SdrLineShadowTextAttribute maSdrLSTAttribute; + basegfx::B2DPoint maStart; + basegfx::B2DPoint maEnd; + MeasureTextPosition meHorizontal; + MeasureTextPosition meVertical; + double mfDistance; + double mfUpper; + double mfLower; + double mfLeftDelta; + double mfRightDelta; + + // bitfield + unsigned mbBelow : 1; + unsigned mbTextRotation : 1; + unsigned mbTextAutoAngle : 1; + + // internal decomposition helper + Primitive2DReference impCreatePart( + const attribute::SdrLineAttribute& rLineAttribute, + const basegfx::B2DHomMatrix& rObjectMatrix, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, + bool bLeftActive, + bool bRightActive) const; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrMeasurePrimitive2D( + const attribute::SdrLineShadowTextAttribute& rSdrLSTAttribute, + const basegfx::B2DPoint& rStart, + const basegfx::B2DPoint& rEnd, + MeasureTextPosition eHorizontal, + MeasureTextPosition eVertical, + double fDistance, + double fUpper, + double fLower, + double fLeftDelta, + double fRightDelta, + bool bBelow, + bool bTextRotation, + bool bTextAutoAngle); + + // data access + const attribute::SdrLineShadowTextAttribute& getSdrLSTAttribute() const { return maSdrLSTAttribute; } + const basegfx::B2DPoint& getStart() const { return maStart; } + const basegfx::B2DPoint& getEnd() const { return maEnd; } + MeasureTextPosition getHorizontal() const { return meHorizontal; } + MeasureTextPosition getVertical() const { return meVertical; } + double getDistance() const { return mfDistance; } + double getUpper() const { return mfUpper; } + double getLower() const { return mfLower; } + double getLeftDelta() const { return mfLeftDelta; } + double getRightDelta() const { return mfRightDelta; } + bool getBelow() const { return mbBelow; } + bool getTextRotation() const { return mbTextRotation; } + bool getTextAutoAngle() const { return mbTextAutoAngle; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRMEASUREPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrole2primitive2d.hxx b/include/svx/sdr/primitive2d/sdrole2primitive2d.hxx new file mode 100644 index 000000000000..0ab554706493 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrole2primitive2d.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrOle2Primitive2D : public BasePrimitive2D + { + private: + Primitive2DSequence maOLEContent; + basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + + public: + SdrOle2Primitive2D( + const Primitive2DSequence& rOLEContent, + const basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute); + + // data access + const Primitive2DSequence& getOLEContent() const { return maOLEContent; } + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // local decomposition. + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDROLE2PRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx new file mode 100644 index 000000000000..2dfe0243717a --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx @@ -0,0 +1,80 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SdrOleContentPrimitive2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/svdobj.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefinitions + +class SdrOle2Obj; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrOleContentPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + SdrObjectWeakRef mpSdrOle2Obj; + basegfx::B2DHomMatrix maObjectTransform; + + // #i104867# The GraphicVersion number to identify in operator== if + // the graphic has changed, but without fetching it (which may + // be expensive, e.g. triggering chart creation) + sal_uInt32 mnGraphicVersion; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrOleContentPrimitive2D( + const SdrOle2Obj& rSdrOle2Obj, + const basegfx::B2DHomMatrix& rObjectTransform, + sal_uInt32 nGraphicVersion + ); + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // The default implementation will use getDecomposition results to create the range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // data access + const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + sal_uInt32 getGraphicVersion() const { return mnGraphicVersion; } + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDROLECONTENTPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrpathprimitive2d.hxx new file mode 100644 index 000000000000..a4047bbe3d78 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrpathprimitive2d.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrPathPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + basegfx::B2DPolyPolygon maUnitPolyPolygon; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrPathPrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon); + + // data access + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRPATHPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrprimitivetools.hxx b/include/svx/sdr/primitive2d/sdrprimitivetools.hxx new file mode 100644 index 000000000000..885b9c945da5 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrprimitivetools.hxx @@ -0,0 +1,49 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX +#define INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX + +#include <vcl/bitmapex.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +namespace basegfx { + class BColor; +} + +////////////////////////////////////////////////////////////////////////////// +// helper methods + +namespace drawinglayer +{ + namespace primitive2d + { + // create a 3x3 cross in given color as BitmapEx + BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor); + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_PRIMITIVETOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx new file mode 100644 index 000000000000..4c685497b1bc --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx @@ -0,0 +1,81 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrRectanglePrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + basegfx::B2DHomMatrix maTransform; + attribute::SdrLineFillShadowTextAttribute maSdrLFSTAttribute; + double mfCornerRadiusX; // [0.0..1.0] relative to 1/2 width + double mfCornerRadiusY; // [0.0..1.0] relative to 1/2 height + + // bitfield + // flag which decides if the HitArea should be the filled geometry + bool mbForceFillForHitTest : 1; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrRectanglePrimitive2D( + const basegfx::B2DHomMatrix& rTransform, + const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute, + double fCornerRadiusX, + double fCornerRadiusY, + bool bForceFillForHitTest); + + // data access + const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; } + double getCornerRadiusX() const { return mfCornerRadiusX; } + double getCornerRadiusY() const { return mfCornerRadiusY; } + bool isCornerRadiusUsed() const { return (0.0 != mfCornerRadiusX || 0.0 != mfCornerRadiusY); } + bool getForceFillForHitTest() const { return mbForceFillForHitTest; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRRECTANGLEPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx b/include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx new file mode 100644 index 000000000000..37264692f2d8 --- /dev/null +++ b/include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx @@ -0,0 +1,338 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX +#define INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX + +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <editeng/outlobj.hxx> +#include <tools/color.hxx> +#include <svx/sdr/attribute/sdrformtextattribute.hxx> +#include <tools/weakbase.hxx> +#include <svx/sdtaitm.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines +class SdrText; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrTextPrimitive2D : public BufferedDecompositionPrimitive2D + { + private: + // The text model data; this sould later just be the OutlinerParaObject or + // something equal + ::tools::WeakReference< SdrText > mrSdrText; + + // #i97628# + // The text content; now as local OutlinerParaObject copy (internally RefCounted and + // COW) and in exclusive, local form as needed in a primitive + const OutlinerParaObject maOutlinerParaObject; + + // remember last VisualizingPage for which a decomposition was made. If the new target + // is not given or different, the decomposition needs to be potentially removed + // for supporting e.g. page number change on MasterPage objects or the different + // field renderings in SubGeometry and MasterPage mnode + com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > mxLastVisualizingPage; + + // remember last PageNumber for which a decomposition was made. This is only used + // when mbContainsPageField is true, else it is 0 + sal_Int16 mnLastPageNumber; + + // remember last PageCount for which a decomposition was made. This is only used + // when mbContainsPageCountField is true, else it is 0 + sal_Int16 mnLastPageCount; + + // #i101443# remember last TextBackgroundColor to decide if a new decomposition is + // needed because of background color change + Color maLastTextBackgroundColor; + + // bitfield + // is there a PageNumber, Header, Footer or DateTimeField used? Evaluated at construction + unsigned mbContainsPageField : 1; + unsigned mbContainsPageCountField : 1; + unsigned mbContainsOtherFields : 1; + + protected: + // support for XTEXT_PAINTSHAPE_BEGIN/XTEXT_PAINTSHAPE_END Metafile comments + Primitive2DSequence encapsulateWithTextHierarchyBlockPrimitive2D(const Primitive2DSequence& rCandidate) const; + + public: + SdrTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr); + + // get data + const SdrText* getSdrText() const { return mrSdrText.get(); } + const OutlinerParaObject& getOutlinerParaObject() const { return maOutlinerParaObject; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // own get2DDecomposition to take aspect of decomposition with or without spell checker + // into account + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const = 0; + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrContourTextPrimitive2D : public SdrTextPrimitive2D + { + private: + // unit contour polygon (scaled to [0.0 .. 1.0]) + basegfx::B2DPolyPolygon maUnitPolyPolygon; + + // complete contour polygon transform (scale, rotate, shear, translate) + basegfx::B2DHomMatrix maObjectTransform; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrContourTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, + const basegfx::B2DPolyPolygon& rUnitPolyPolygon, + const basegfx::B2DHomMatrix& rObjectTransform); + + // get data + const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; } + const basegfx::B2DHomMatrix& getObjectTransform() const { return maObjectTransform; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrPathTextPrimitive2D : public SdrTextPrimitive2D + { + private: + // the path to use. Each paragraph will use one Polygon. + basegfx::B2DPolyPolygon maPathPolyPolygon; + + // the Fontwork parameters + attribute::SdrFormTextAttribute maSdrFormTextAttribute; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrPathTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, + const basegfx::B2DPolyPolygon& rPathPolyPolygon, + const attribute::SdrFormTextAttribute& rSdrFormTextAttribute); + + // get data + const basegfx::B2DPolyPolygon& getPathPolyPolygon() const { return maPathPolyPolygon; } + const attribute::SdrFormTextAttribute& getSdrFormTextAttribute() const { return maSdrFormTextAttribute; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrBlockTextPrimitive2D : public SdrTextPrimitive2D + { + private: + // text range transformation from unit range ([0.0 .. 1.0]) to text range + basegfx::B2DHomMatrix maTextRangeTransform; + + // text alignments + SdrTextHorzAdjust maSdrTextHorzAdjust; + SdrTextVertAdjust maSdrTextVertAdjust; + + // bitfield + unsigned mbFixedCellHeight : 1; + unsigned mbUnlimitedPage : 1; // force layout with no text break + unsigned mbCellText : 1; // this is a cell text as block text + unsigned mbWordWrap : 1; // for CustomShapes text layout + unsigned mbClipOnBounds : 1; // for CustomShapes text layout + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrBlockTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, + const basegfx::B2DHomMatrix& rTextRangeTransform, + SdrTextHorzAdjust aSdrTextHorzAdjust, + SdrTextVertAdjust aSdrTextVertAdjust, + bool bFixedCellHeight, + bool bUnlimitedPage, + bool bCellText, + bool bWordWrap, + bool bClipOnBounds); + + // get data + const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + SdrTextHorzAdjust getSdrTextHorzAdjust() const { return maSdrTextHorzAdjust; } + SdrTextVertAdjust getSdrTextVertAdjust() const { return maSdrTextVertAdjust; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + bool getUnlimitedPage() const { return mbUnlimitedPage; } + bool getCellText() const { return mbCellText; } + bool getWordWrap() const { return mbWordWrap; } + bool getClipOnBounds() const { return mbClipOnBounds; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrStretchTextPrimitive2D : public SdrTextPrimitive2D + { + private: + // text range transformation from unit range ([0.0 .. 1.0]) to text range + basegfx::B2DHomMatrix maTextRangeTransform; + + // bitfield + unsigned mbFixedCellHeight : 1; + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrStretchTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, + const basegfx::B2DHomMatrix& rTextRangeTransform, + bool bFixedCellHeight); + + // get data + const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + bool isFixedCellHeight() const { return mbFixedCellHeight; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const basegfx::B2DHomMatrix& rTransform) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + class SdrAutoFitTextPrimitive2D : public SdrTextPrimitive2D + { + private: + ::basegfx::B2DHomMatrix maTextRangeTransform; // text range transformation from unit range ([0.0 .. 1.0]) to text range + + // bitfield + unsigned mbWordWrap : 1; // for CustomShapes text layout + + protected: + // local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const; + + public: + SdrAutoFitTextPrimitive2D( + const SdrText* pSdrText, + const OutlinerParaObject& rOutlinerParaObjectPtr, + const ::basegfx::B2DHomMatrix& rTextRangeTransform, + bool bWordWrap); + + // get data + const basegfx::B2DHomMatrix& getTextRangeTransform() const { return maTextRangeTransform; } + bool getWordWrap() const { return mbWordWrap; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // transformed clone operator + virtual SdrTextPrimitive2D* createTransformedClone(const ::basegfx::B2DHomMatrix& rTransform) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_SDR_PRIMITIVE2D_SDRTEXTPRIMITIVE2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx new file mode 100644 index 000000000000..6178695bf66d --- /dev/null +++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -0,0 +1,56 @@ +/* -*- 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 . + */ + +#ifndef INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX +#define INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX + +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +#define PRIMITIVE2D_ID_SDRCAPTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 0) +#define PRIMITIVE2D_ID_SDRCONNECTORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 1) +#define PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 2) +#define PRIMITIVE2D_ID_SDRELLIPSEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 3) +#define PRIMITIVE2D_ID_SDRELLIPSESEGMENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 4) +#define PRIMITIVE2D_ID_SDRGRAFPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 5) +#define PRIMITIVE2D_ID_SDRMEASUREPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 6) +#define PRIMITIVE2D_ID_SDROLE2PRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 7) +#define PRIMITIVE2D_ID_SDRPATHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 8) +#define PRIMITIVE2D_ID_SDRRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 9) +#define PRIMITIVE2D_ID_SDRCONTOURTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 10) +#define PRIMITIVE2D_ID_SDRPATHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 11) +#define PRIMITIVE2D_ID_SDRBLOCKTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 12) +#define PRIMITIVE2D_ID_SDRSTRETCHTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 13) +#define PRIMITIVE2D_ID_SDRCELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 14) +#define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15) +#define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16) +#define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17) +#define PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) +#define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19) +#define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20) +#define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21) +#define PRIMITIVE2D_ID_SDROLECONTENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 22) +#define PRIMITIVE2D_ID_SDRAUTOFITTEXTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 23) + +////////////////////////////////////////////////////////////////////////////// + +#endif // INCLUDED_SVX_PRIMITIVE2D_PRIMITIVETYPES2D_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |