Kaydet (Commit) 374efa72 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

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
üst ca25cdcb
......@@ -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));
......
......@@ -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 \
......
/* -*- 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: */
......@@ -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
......
......@@ -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(
......
......@@ -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;
......
......@@ -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)
......
/* -*- 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: */
/* -*- 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: */
......@@ -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
......
/* -*- 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: */
......@@ -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
......
......@@ -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 \
......
/* -*- 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: */
......@@ -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;
}
}
......
......@@ -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();
......
......@@ -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 );
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment