chart2/source/view/main/OpenglShapeFactory.cxx | 2 drawinglayer/Library_drawinglayer.mk | 3 drawinglayer/source/primitive2d/openglprimitive2d.cxx | 38 ++++++++ drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 6 + drawinglayer/source/processor2d/vclprocessor2d.cxx | 10 ++ drawinglayer/source/processor2d/vclprocessor2d.hxx | 3 include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 1 include/drawinglayer/primitive2d/openglprimitive2d.hxx | 42 +++++++++ include/svx/sdr/contact/viewcontactofopengl.hxx | 35 +++++++ include/svx/svdobj.hxx | 1 include/svx/svdoopengl.hxx | 27 ++++++ include/svx/unoshape.hxx | 7 + svx/Library_svxcore.mk | 1 svx/source/sdr/contact/viewcontactofopengl.cxx | 44 ++++++++++ svx/source/svdraw/svdobj.cxx | 2 svx/source/unodraw/unomod.cxx | 4 svx/source/unodraw/unopage.cxx | 3 svx/source/unodraw/unoprov.cxx | 1 18 files changed, 227 insertions(+), 3 deletions(-)
New commits: commit 374efa7253703b054e4603c66aeba862e4e98574 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Mon Mar 17 22:03:14 2014 +0100 Skeleton of drawinglayer object called OpenGLObject - Shape name: com.sun.star.drawing.OpenGLObject - Drawinglayer object: SdrOpenGLObject - Uno object: SvxOpenGLObject - View contact: ViewContactOfOpenGL - Primitive: OpenGLPrimitive2D Change-Id: I7fc0829d58cb4a8432d0e3007c90223707e5dd84 diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx index ecc30f4..ce8db18 100644 --- a/chart2/source/view/main/OpenglShapeFactory.cxx +++ b/chart2/source/view/main/OpenglShapeFactory.cxx @@ -122,7 +122,7 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape SAL_WARN("chart2.opengl", "getOrCreateChartRootShape"); uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance( - "com.sun.star.drawing.GraphicObjectShape" ), uno::UNO_QUERY ); + "com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY ); dummy::DummyChart *pChart = new dummy::DummyChart(xTarget); SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart); pContainer->setSize(awt::Size(0,0)); diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 21242a6..a4ef767 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -38,7 +38,7 @@ $(eval $(call gb_Library_use_libraries,drawinglayer,\ tk \ tl \ vcl \ - $(gb_UWINAPI) \ + $(gb_UWINAPI) \ )) $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ @@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/primitive2d/metafileprimitive2d \ drawinglayer/source/primitive2d/modifiedcolorprimitive2d \ drawinglayer/source/primitive2d/objectinfoprimitive2d \ + drawinglayer/source/primitive2d/openglprimitive2d \ drawinglayer/source/primitive2d/pagepreviewprimitive2d \ drawinglayer/source/primitive2d/patternfillprimitive2d \ drawinglayer/source/primitive2d/pointarrayprimitive2d \ diff --git a/drawinglayer/source/primitive2d/openglprimitive2d.cxx b/drawinglayer/source/primitive2d/openglprimitive2d.cxx new file mode 100644 index 0000000..48724df --- /dev/null +++ b/drawinglayer/source/primitive2d/openglprimitive2d.cxx @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <drawinglayer/primitive2d/openglprimitive2d.hxx> +#include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> + + +namespace drawinglayer +{ + namespace primitive2d + { + + OpenGLPrimitive2D::OpenGLPrimitive2D(const Point& rPos) + : m_aPos(rPos) + { + } + + bool OpenGLPrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const OpenGLPrimitive2D& rCompare = static_cast< const OpenGLPrimitive2D& >(rPrimitive); + return m_aPos == rCompare.getPos(); + } + return false; + } + + ImplPrimitive2DIDBlock(OpenGLPrimitive2D, PRIMITIVE2D_ID_OPENGLPRIMITIVE2D) + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index c1d83b9..5cc7981 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -44,6 +44,7 @@ #include <vcl/metaact.hxx> #include <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx> #include <drawinglayer/primitive2d/textdecoratedprimitive2d.hxx> +#include <drawinglayer/primitive2d/openglprimitive2d.hxx> #include <comphelper/processfactory.hxx> #include <rtl/ustring.hxx> #include <com/sun/star/i18n/BreakIterator.hpp> @@ -2137,6 +2138,11 @@ namespace drawinglayer RenderEpsPrimitive2D(static_cast< const primitive2d::EpsPrimitive2D& >(rCandidate)); break; } + case PRIMITIVE2D_ID_OPENGLPRIMITIVE2D: + { + RenderOpenGLPrimitive2D(static_cast< const primitive2d::OpenGLPrimitive2D& >(rCandidate)); + break; + } default : { // process recursively diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 0063ad7..a0e8b40 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -66,6 +66,8 @@ #include <basegfx/polygon/b2dtrapezoid.hxx> // <- for test +#include <drawinglayer/primitive2d/openglprimitive2d.hxx> + using namespace com::sun::star; namespace @@ -1584,6 +1586,14 @@ namespace drawinglayer } } + void VclProcessor2D::RenderOpenGLPrimitive2D(const primitive2d::OpenGLPrimitive2D& rCandidate) + { + // Just draw a dummy rect to see primitive rendering is working. + mpOutputDevice->SetLineColor(COL_BLACK); + mpOutputDevice->SetFillColor(COL_RED); + mpOutputDevice->DrawRect(Rectangle(rCandidate.getPos(),Size(2000,2000))); + } + // process support VclProcessor2D::VclProcessor2D( diff --git a/drawinglayer/source/processor2d/vclprocessor2d.hxx b/drawinglayer/source/processor2d/vclprocessor2d.hxx index 38d96c8..d4535fb 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.hxx @@ -52,6 +52,7 @@ namespace drawinglayer { namespace primitive2d { class EpsPrimitive2D; class SvgLinearAtomPrimitive2D; class SvgRadialAtomPrimitive2D; + class OpenGLPrimitive2D; }} @@ -107,7 +108,7 @@ namespace drawinglayer void RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate); void RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate); void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate); - + void RenderOpenGLPrimitive2D(const primitive2d::OpenGLPrimitive2D& rCandidate); // DrawMode adaption support void adaptLineToFillDrawMode() const; diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 68357ca..088d60e 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -103,6 +103,7 @@ #define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68) #define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69) #define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70) +#define PRIMITIVE2D_ID_OPENGLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 71) diff --git a/include/drawinglayer/primitive2d/openglprimitive2d.hxx b/include/drawinglayer/primitive2d/openglprimitive2d.hxx new file mode 100644 index 0000000..c251dcb --- /dev/null +++ b/include/drawinglayer/primitive2d/openglprimitive2d.hxx @@ -0,0 +1,42 @@ +/* -*- 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_OPENGL_PRIMITIVE2D_HXX +#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_OPENGL_PRIMITIVE2D_HXX + +#include <tools/gen.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +namespace drawinglayer +{ + namespace primitive2d + { + + class DRAWINGLAYER_DLLPUBLIC OpenGLPrimitive2D : public BasePrimitive2D + { + public: + explicit OpenGLPrimitive2D(const Point& rPos); + + const Point& getPos() const { return m_aPos; } + + virtual bool operator==( const BasePrimitive2D& rPrimitive ) const; + + /// provide unique ID + DeclPrimitive2DIDBlock() + + private: + Point m_aPos; + }; + + } +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/sdr/contact/viewcontactofopengl.hxx b/include/svx/sdr/contact/viewcontactofopengl.hxx new file mode 100644 index 0000000..ad96b0c --- /dev/null +++ b/include/svx/sdr/contact/viewcontactofopengl.hxx @@ -0,0 +1,35 @@ +/* -*- 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 INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFOPENGL_HXX +#define INCLUDED_SVX_SDR_CONTACT_VIEWCONTACTOFOPENGL_HXX + +#include <svx/sdr/contact/viewcontactofsdrobj.hxx> + +class SdrOpenGLObj; + +namespace sdr +{ + namespace contact + { + class ViewContactOfOpenGL : public ViewContactOfSdrObj + { + public: + explicit ViewContactOfOpenGL(SdrOpenGLObj& rOpenGLObj); + virtual ~ViewContactOfOpenGL(); + + protected: + virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const; + }; + } +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index a6558b9..ddd6dcc 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -134,6 +134,7 @@ enum SdrObjKind {OBJ_NONE = 0, // abstract object (SdrObject) OBJ_CUSTOMSHAPE=33, // custom shape OBJ_MEDIA =34, // media shape OBJ_TABLE =35, // table + OBJ_OPENGL =36, // opengl graphic OBJ_MAXI}; enum SdrUserCallType {SDRUSERCALL_MOVEONLY, // only moved, size unchanged diff --git a/include/svx/svdoopengl.hxx b/include/svx/svdoopengl.hxx new file mode 100644 index 0000000..6a6b1d1 --- /dev/null +++ b/include/svx/svdoopengl.hxx @@ -0,0 +1,27 @@ +/* -*- 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 INCLUDED_SVX_SVDO_OPENGL_HXX +#define INCLUDED_SVX_SVDO_OPENGL_HXX + +#include <svx/svdobj.hxx> +#include <svx/sdr/contact/viewcontactofopengl.hxx> + +class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject +{ +public: + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() + { + return new sdr::contact::ViewContactOfOpenGL(*this); + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx index 1f2056c..bcf2b62 100644 --- a/include/svx/unoshape.hxx +++ b/include/svx/unoshape.hxx @@ -875,6 +875,13 @@ private: OUString referer_; }; +class SvxOpenGLObject : public SvxShape +{ +public: + SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){} + virtual ~SvxOpenGLObject() throw() {} +}; + /* * This is a really ugly hack for the chart2 OpenGL backend * SvxShapeGroup::add only accepts objects derived from SvxShape and silently drops diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 968c922..4b59047 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -159,6 +159,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/contact/viewobjectcontactofpageobj \ svx/source/sdr/contact/viewobjectcontactofe3dscene \ svx/source/sdr/contact/viewcontactofgraphic \ + svx/source/sdr/contact/viewcontactofopengl \ svx/source/sdr/contact/viewobjectcontactredirector \ svx/source/sdr/contact/viewcontactofsdrcircobj \ svx/source/sdr/contact/viewcontactofgroup \ diff --git a/svx/source/sdr/contact/viewcontactofopengl.cxx b/svx/source/sdr/contact/viewcontactofopengl.cxx new file mode 100644 index 0000000..34630ec --- /dev/null +++ b/svx/source/sdr/contact/viewcontactofopengl.cxx @@ -0,0 +1,44 @@ +/* -*- 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 <com/sun/star/drawing/XShape.hpp> +#include <svx/sdr/contact/viewcontactofopengl.hxx> +#include <drawinglayer/primitive2d/openglprimitive2d.hxx> +#include <svx/svdoopengl.hxx> +#include <tools/gen.hxx> + + +namespace sdr +{ + namespace contact + { + + ViewContactOfOpenGL::ViewContactOfOpenGL(SdrOpenGLObj& rOpenGLObj) + : ViewContactOfSdrObj(rOpenGLObj) + { + } + + ViewContactOfOpenGL::~ViewContactOfOpenGL() + { + } + + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOpenGL::createViewIndependentPrimitive2DSequence() const + { + com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape(GetSdrObject().getUnoShape(), com::sun::star::uno::UNO_QUERY); + const Point aPos(xShape->getPosition().X,xShape->getPosition().Y); + + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::OpenGLPrimitive2D(aPos)); + + return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index c368553..eaf24ac 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -126,6 +126,7 @@ #include <svx/xlnwtit.hxx> #include <svx/xpoly.hxx> #include <rtl/strbuf.hxx> +#include <svx/svdoopengl.hxx> using namespace ::com::sun::star; @@ -3395,6 +3396,7 @@ SdrObject* SdrObjFactory::MakeNewObject(sal_uInt32 nInvent, sal_uInt16 nIdent, S case sal_uInt16(OBJ_CUSTOMSHAPE ): pObj=new SdrObjCustomShape(); break; case sal_uInt16(OBJ_MEDIA ): pObj=new SdrMediaObj(); break; case sal_uInt16(OBJ_TABLE ): pObj=new ::sdr::table::SdrTableObj(pModel); break; + case sal_uInt16(OBJ_OPENGL ): pObj=new SdrOpenGLObj; break; } } diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index 9b5a3d6..6a86ce4 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -493,6 +493,10 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c { nType = OBJ_TABLE; } + else if( aTypeName.startsWith( "OpenGLObject" ) ) + { + nType = OBJ_OPENGL; + } else { throw lang::ServiceNotRegisteredException(); diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 26e0468..4352206 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -738,6 +738,9 @@ SvxShape* SvxDrawPage::CreateShapeByTypeAndInventor( sal_uInt16 nType, sal_uInt3 case OBJ_TABLE: pRet = new SvxTableShape( pObj ); break; + case OBJ_OPENGL: + pRet = new SvxOpenGLObject( pObj ); + break; default: // unbekanntes 2D-Objekt auf der Page OSL_FAIL("Nicht implementierter Starone-Shape erzeugt! [CL]"); pRet = new SvxShapeText( pObj ); diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index f7a3855..61518d2 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -843,6 +843,7 @@ namespace { { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DLatheObject"), E3D_LATHEOBJ_ID | E3D_INVENTOR_FLAG }, { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"), E3D_EXTRUDEOBJ_ID | E3D_INVENTOR_FLAG }, { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.Shape3DPolygonObject"), E3D_POLYGONOBJ_ID | E3D_INVENTOR_FLAG }, + { RTL_CONSTASCII_STRINGPARAM("com.sun.star.drawing.OpenGLObject"), OBJ_OPENGL }, }; for (sal_uInt32 i = 0; i < sizeof(aInit)/sizeof(aInit[0]); i++) aImpl[OUString( aInit[i].name, aInit[i].length, RTL_TEXTENCODING_ASCII_US ) ] = aInit[i].id;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits