summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-03-21 14:00:56 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-03-21 14:00:56 +0100
commitd834be0dac2b455076e0c0824f8e6a6e709625ac (patch)
tree2778faecf98a70213a41818af66d397324bc539f
parent47cf5156e951a724604db1be99750bc9a722592b (diff)
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
-rw-r--r--include/svx/sdr/contact/viewcontactofopenglobj.hxx2
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx39
-rw-r--r--include/vcl/OpenGLContext.hxx2
-rw-r--r--svx/Library_svxcore.mk3
-rw-r--r--svx/source/sdr/contact/viewcontactofopenglobj.cxx6
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx47
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx4
7 files changed, 100 insertions, 3 deletions
diff --git a/include/svx/sdr/contact/viewcontactofopenglobj.hxx b/include/svx/sdr/contact/viewcontactofopenglobj.hxx
index 0ac95ce70766..6b48e665f884 100644
--- a/include/svx/sdr/contact/viewcontactofopenglobj.hxx
+++ b/include/svx/sdr/contact/viewcontactofopenglobj.hxx
@@ -24,6 +24,8 @@ public:
virtual ~ViewContactOfOpenGLObj();
protected:
+ virtual ViewObjectContact& CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact);
+
virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
};
diff --git a/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx b/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
new file mode 100644
index 000000000000..00e1dffde835
--- /dev/null
+++ b/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
@@ -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: */
diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx
index 390c3df45c27..82145b44b260 100644
--- a/include/vcl/OpenGLContext.hxx
+++ b/include/vcl/OpenGLContext.hxx
@@ -99,7 +99,7 @@ public:
OpenGLContext();
~OpenGLContext();
- bool init();
+ bool init(Window* pParent = 0);
void setWinSize(const Size& rSize);
GLWindow& getOpenGLWindow();
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 39f15b2a6146..d025cdfb940c 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -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 \
diff --git a/svx/source/sdr/contact/viewcontactofopenglobj.cxx b/svx/source/sdr/contact/viewcontactofopenglobj.cxx
index 25d5ef2b72e4..ef2c32ae6534 100644
--- a/svx/source/sdr/contact/viewcontactofopenglobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofopenglobj.cxx
@@ -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);
diff --git a/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
new file mode 100644
index 000000000000..1689468993b1
--- /dev/null
+++ b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
@@ -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: */
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 5f94c475e30a..560ff0366f9b 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -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);