Init an opengl context bounded to an existent window.
Via ViewObjectContact can we query a window. It seems this window is the same which is used by chart edit mode. Change-Id: Ib6df4d58730774f3d86b453b8174a78bb2c8a45b
This commit is contained in:
@@ -24,6 +24,8 @@ public:
|
||||
virtual ~ViewContactOfOpenGLObj();
|
||||
|
||||
protected:
|
||||
virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
|
||||
|
||||
virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
|
||||
};
|
||||
|
||||
|
39
include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
Normal file
39
include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
Normal file
@@ -0,0 +1,39 @@
|
||||
/* -*- 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_VIEWOBJECTCONTACTOFOPENGL_HXX
|
||||
#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFOPENGL_HXX
|
||||
|
||||
#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
|
||||
#include <vcl/OpenGLContext.hxx>
|
||||
|
||||
class Window;
|
||||
|
||||
namespace sdr {
|
||||
namespace contact {
|
||||
|
||||
class ViewObjectContactOfOpenGLObj : public ViewObjectContactOfSdrObj
|
||||
{
|
||||
public:
|
||||
ViewObjectContactOfOpenGLObj(ObjectContact& rObjectContact, ViewContact& rViewContact);
|
||||
virtual ~ViewObjectContactOfOpenGLObj();
|
||||
|
||||
protected:
|
||||
Window* getWindow() const;
|
||||
|
||||
private:
|
||||
OpenGLContext m_aOpenGLContext;
|
||||
};
|
||||
|
||||
} // namespace sdr
|
||||
} // namespace contact
|
||||
|
||||
#endif
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -99,7 +99,7 @@ public:
|
||||
OpenGLContext();
|
||||
~OpenGLContext();
|
||||
|
||||
bool init();
|
||||
bool init(Window* pParent = 0);
|
||||
void setWinSize(const Size& rSize);
|
||||
GLWindow& getOpenGLWindow();
|
||||
|
||||
|
@@ -75,6 +75,7 @@ $(eval $(call gb_Library_use_libraries,svxcore,\
|
||||
utl \
|
||||
vcl \
|
||||
xo \
|
||||
vclopengl \
|
||||
$(gb_UWINAPI) \
|
||||
))
|
||||
|
||||
@@ -82,6 +83,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\
|
||||
boost_headers \
|
||||
icuuc \
|
||||
icu_headers \
|
||||
glew \
|
||||
))
|
||||
|
||||
$(eval $(call gb_Library_add_exception_objects,svxcore,\
|
||||
@@ -194,6 +196,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
|
||||
svx/source/sdr/contact/viewcontactofsdrmeasureobj \
|
||||
svx/source/sdr/contact/objectcontactofobjlistpainter \
|
||||
svx/source/sdr/contact/viewobjectcontactofe3d \
|
||||
svx/source/sdr/contact/viewobjectcontactofopenglobj \
|
||||
svx/source/sdr/event/eventhandler \
|
||||
svx/source/sdr/overlay/overlayline \
|
||||
svx/source/sdr/overlay/overlaycrosshair \
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <com/sun/star/drawing/XShape.hpp>
|
||||
#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
|
||||
#include <svx/sdr/contact/viewobjectcontactofopenglobj.hxx>
|
||||
#include <drawinglayer/primitive2d/openglprimitive2d.hxx>
|
||||
#include <svx/svdoopengl.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
@@ -24,6 +25,11 @@ ViewContactOfOpenGLObj::~ViewContactOfOpenGLObj()
|
||||
{
|
||||
}
|
||||
|
||||
ViewObjectContact& ViewContactOfOpenGLObj::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
|
||||
{
|
||||
return *( new ViewObjectContactOfOpenGLObj( rObjectContact, *this ) );
|
||||
}
|
||||
|
||||
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfOpenGLObj::createViewIndependentPrimitive2DSequence() const
|
||||
{
|
||||
com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape(GetSdrObject().getUnoShape(), com::sun::star::uno::UNO_QUERY);
|
||||
|
47
svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
Normal file
47
svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
Normal file
@@ -0,0 +1,47 @@
|
||||
/* -*- 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 <svx/sdr/contact/viewobjectcontactofopenglobj.hxx>
|
||||
#include <vcl/outdev.hxx>
|
||||
#include <vcl/window.hxx>
|
||||
|
||||
using namespace sdr::contact;
|
||||
|
||||
|
||||
ViewObjectContactOfOpenGLObj::ViewObjectContactOfOpenGLObj(
|
||||
ObjectContact& rObjectContact, ViewContact& rViewContact )
|
||||
: ViewObjectContactOfSdrObj( rObjectContact, rViewContact )
|
||||
{
|
||||
m_aOpenGLContext.init(getWindow());
|
||||
// Set a dummy size to make the window visible
|
||||
m_aOpenGLContext.setWinSize(Size(200,200));
|
||||
}
|
||||
|
||||
ViewObjectContactOfOpenGLObj::~ViewObjectContactOfOpenGLObj()
|
||||
{
|
||||
}
|
||||
|
||||
Window* ViewObjectContactOfOpenGLObj::getWindow() const
|
||||
{
|
||||
Window* pRetval = 0;
|
||||
|
||||
boost::optional<const OutputDevice&> oPageOutputDev = getPageViewOutputDevice();
|
||||
if( oPageOutputDev )
|
||||
{
|
||||
if(OUTDEV_WINDOW == oPageOutputDev->GetOutDevType())
|
||||
{
|
||||
pRetval = static_cast< Window* >(&const_cast<OutputDevice&>(oPageOutputDev.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return pRetval;
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -316,9 +316,9 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ )
|
||||
|
||||
#endif
|
||||
|
||||
bool OpenGLContext::init()
|
||||
bool OpenGLContext::init( Window* pParent )
|
||||
{
|
||||
m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL));
|
||||
m_pWindow.reset(pParent ? pParent : new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL));
|
||||
SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start");
|
||||
initWindow();
|
||||
m_pWindow->setPosSizePixel(0,0,0,0);
|
||||
|
Reference in New Issue
Block a user