[Libreoffice-commits] core.git: 26 commits - avmedia/source chart2/inc chart2/Library_chartcontroller.mk chart2/source embeddedobj/Library_embobj.mk embeddedobj/source include/svtools include/svx include/vcl offapi/com sc/source sfx2/source svtools/source svx/source sw/source vcl/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri Aug 29 08:50:49 PDT 2014


 avmedia/source/opengl/oglplayer.cxx                      |    4 
 chart2/Library_chartcontroller.mk                        |    1 
 chart2/inc/ChartModel.hxx                                |    2 
 chart2/source/controller/main/ChartController.cxx        |    3 
 chart2/source/controller/main/ChartWindow.cxx            |   55 ++++++-
 chart2/source/controller/main/ChartWindow.hxx            |    9 -
 chart2/source/model/main/ChartModel.cxx                  |    8 -
 chart2/source/view/charttypes/GL3DBarChart.cxx           |  115 ++++++++++-----
 chart2/source/view/inc/AbstractShapeFactory.hxx          |    2 
 chart2/source/view/inc/GL3DBarChart.hxx                  |   16 +-
 chart2/source/view/inc/OpenglShapeFactory.hxx            |    2 
 chart2/source/view/inc/ShapeFactory.hxx                  |    2 
 chart2/source/view/main/ChartView.cxx                    |   44 ++++-
 chart2/source/view/main/DummyXShape.hxx                  |    1 
 chart2/source/view/main/OpenGLRender.cxx                 |    4 
 chart2/source/view/main/OpenglShapeFactory.cxx           |    6 
 embeddedobj/Library_embobj.mk                            |    1 
 embeddedobj/source/general/docholder.cxx                 |    7 
 include/svtools/embedhlp.hxx                             |    4 
 include/svx/charthelper.hxx                              |   10 -
 include/vcl/opengl/OpenGLHelper.hxx                      |    8 -
 offapi/com/sun/star/chart2/XChartDocument.idl            |    4 
 sc/source/ui/drawfunc/fuins2.cxx                         |   18 --
 sc/source/ui/inc/tabvwsh.hxx                             |    3 
 sc/source/ui/view/tabvwsh4.cxx                           |   33 ----
 sc/source/ui/view/tabvwshb.cxx                           |    5 
 sfx2/source/view/ipclient.cxx                            |    6 
 sfx2/source/view/viewsh.cxx                              |    4 
 svtools/source/misc/embedhlp.cxx                         |   50 +++++-
 svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx |    3 
 svx/source/svdraw/charthelper.cxx                        |   21 --
 svx/source/svdraw/svdoole2.cxx                           |    6 
 sw/source/core/doc/notxtfrm.cxx                          |    7 
 sw/source/core/layout/paintfrm.cxx                       |    3 
 sw/source/core/unocore/unochart.cxx                      |    3 
 vcl/source/opengl/OpenGLContext.cxx                      |    5 
 vcl/source/opengl/OpenGLHelper.cxx                       |   14 -
 37 files changed, 303 insertions(+), 186 deletions(-)

New commits:
commit 89940633b43aa7ff136f73fcb3c78201d9cb4ef9
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Aug 28 21:57:44 2014 +0200

    replace sleep with two condition variables
    
    Change-Id: I7611b5be7d462646a19ebfd86b8d6612dccafc71

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 11406bf..d199b50 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -79,6 +79,27 @@ double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
     return nMax;
 }
 
+class SharedResourceAccess
+{
+private:
+    osl::Condition& mrCond1;
+    osl::Condition& mrCond2;
+
+public:
+
+    SharedResourceAccess(osl::Condition& rCond1, osl::Condition& rCond2):
+        mrCond1(rCond1),
+        mrCond2(rCond2)
+    {
+        mrCond1.set();
+    }
+
+    ~SharedResourceAccess()
+    {
+        mrCond2.set();
+    }
+};
+
 }
 
 class RenderThread : public salhelper::Thread
@@ -418,6 +439,7 @@ void RenderBenchMarkThread::execute()
     {
         {
             osl::MutexGuard aGuard(mpChart->maMutex);
+            mpChart->maCond2.reset();
             if (mpChart->mbRenderDie)
                 break;
             UpdateScreenText();
@@ -425,14 +447,11 @@ void RenderBenchMarkThread::execute()
             renderFrame();
             mpChart->miFrameCount++;
         }
-        #ifdef WNT
-            Sleep(1);
-        #else
-            TimeValue nTV;
-            nTV.Seconds = 0;
-            nTV.Nanosec = 1000000;
-            osl_waitThread(&nTV);
-        #endif
+        if (mpChart->maCond1.check())
+        {
+            mpChart->maCond1.reset();
+            mpChart->maCond2.wait();
+        }
     }
 }
 
@@ -517,6 +536,7 @@ GL3DBarChart::~GL3DBarChart()
 {
     if (mbBenchMarkMode)
     {
+        SharedResourceAccess(maCond1, maCond2);
         osl::MutexGuard aGuard(maMutex);
         mbRenderDie = true;
     }
@@ -531,6 +551,7 @@ GL3DBarChart::~GL3DBarChart()
 void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
         ExplicitCategoriesProvider& rCatProvider)
 {
+    SharedResourceAccess(maCond1, maCond2);
     osl::MutexGuard aGuard(maMutex);
     mpRenderer->ReleaseShapes();
     // Each series of data flows from left to right, and multiple series are
@@ -803,6 +824,7 @@ void GL3DBarChart::moveToDefault()
             return;
 
         {
+            SharedResourceAccess(maCond1, maCond2);
             osl::MutexGuard aGuard(maMutex);
             maRenderEvent = EVENT_MOVE_TO_DEFAULT;
         }
@@ -845,6 +867,7 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
             return;
 
         {
+            SharedResourceAccess(maCond1, maCond2);
             osl::MutexGuard aGuard(maMutex);
             maClickPos = rPos;
             mnPreSelectBarId = mnSelectBarId;
@@ -913,6 +936,7 @@ void GL3DBarChart::render()
 void GL3DBarChart::mouseDragMove(const Point& rStartPos, const Point& rEndPos, sal_uInt16 )
 {
     long nDirection = rEndPos.X() - rStartPos.X();
+    SharedResourceAccess(maCond1, maCond2);
     osl::MutexGuard aGuard(maMutex);
     if ((maRenderEvent == EVENT_NONE) || (maRenderEvent == EVENT_SHOW_SCROLL) ||
         (maRenderEvent == EVENT_AUTO_FLY) || (maRenderEvent == EVENT_SHOW_SELECT))
@@ -989,6 +1013,7 @@ void GL3DBarChart::moveToCorner()
 void GL3DBarChart::scroll(long nDelta)
 {
     {
+        SharedResourceAccess(maCond1, maCond2);
         osl::MutexGuard aGuard(maMutex);
         if ((maRenderEvent != EVENT_NONE) && (maRenderEvent != EVENT_SHOW_SCROLL) &&
             (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent == EVENT_SHOW_SELECT))
@@ -1009,6 +1034,7 @@ void GL3DBarChart::scroll(long nDelta)
 
 void GL3DBarChart::contextDestroyed()
 {
+    SharedResourceAccess(maCond1, maCond2);
     osl::MutexGuard aGuard(maMutex);
     mbValidContext = false;
 }
@@ -1055,6 +1081,7 @@ int GL3DBarChart::calcTimeInterval(TimeValue &startTime, TimeValue &endTime)
 
 void GL3DBarChart::updateScreenText()
 {
+    SharedResourceAccess(maCond1, maCond2);
     osl::MutexGuard aGuard(maMutex);
     maScreenTextShapes.clear();
     mpRenderer->ReleaseScreenTextShapes();
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 007b8ad..11d7eeb 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -181,6 +181,16 @@ private:
     int mnColorRate;
     bool mbBenchMarkMode;
     sal_uInt32 maHistoryCounter;
+
+
+    // these form a pair:
+    // main thread sets condition 1 and waits until it can take the mutex
+    // render thread checks condition 1 before taking the mutex and waits in case it
+    // is set until condition 2 is set
+    //
+    // only necessary for the benchmark mode
+    osl::Condition maCond1;
+    osl::Condition maCond2;
 };
 
 }
commit 01a4949dac2eb8c61a588d7dc40e2297b6077733
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Aug 28 21:00:42 2014 +0200

    ignore aggressive Nvidia GLSL compiler error messages
    
    Change-Id: Ifc83bd3fb1d0fcbc8056c72b2545a8a3aed00a64

diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 25db6d5..98042db 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -333,6 +333,11 @@ APIENTRY
 debug_callback(GLenum source, GLenum type, GLuint id,
         GLenum severity, GLsizei , const GLchar* message, GLvoid* )
 {
+    // ignore Nvidia's : "Program/shader state performance warning: Fragment Shader is going to be recompiled because the shader key based on GL state mismatches."
+    // the GLSL compiler is a bit too aggressive in optimizing the state based on the current OpenGL state
+    if (id == 131218)
+        return;
+
     SAL_WARN("vcl.opengl", "OpenGL debug message: source: " << getSourceString(source) << ", type: "
             << getTypeString(type) << ", id: " << id << ", severity: " << getSeverityString(severity) << " with message: " << message);
 }
commit f61e453f8463fcc02629b1e8cdfeb73a3a932307
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 21:47:34 2014 +0200

    the DUMMY_CHART_FACTORY variable is not the only indicator for OpenGl charts
    
    Change-Id: Idab33c8611526dc4749b4dbe4fe84e68138b4f73

diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index 5ec13f1..79a1746 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -438,6 +438,8 @@ public:
 
     virtual void SAL_CALL createDefaultChart() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
+    virtual sal_Bool SAL_CALL isOpenGLChart() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
     // ____ XDataReceiver (public API) ____
     virtual void SAL_CALL
         attachDataProvider( const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index ed0d24e..a3d97c2 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -32,6 +32,7 @@
 #include "NameContainer.hxx"
 #include "UndoManager.hxx"
 #include "ChartView.hxx"
+#include "GL3DHelper.hxx"
 
 #include <vcl/openglwin.hxx>
 
@@ -964,6 +965,12 @@ void SAL_CALL ChartModel::createDefaultChart()
     insertDefaultChart();
 }
 
+sal_Bool SAL_CALL ChartModel::isOpenGLChart()
+    throw (css::uno::RuntimeException, std::exception)
+{
+    return GL3DHelper::isGL3DDiagram(m_xDiagram);
+}
+
 // ____ XTitled ____
 uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
     throw (uno::RuntimeException, std::exception)
diff --git a/offapi/com/sun/star/chart2/XChartDocument.idl b/offapi/com/sun/star/chart2/XChartDocument.idl
index 0055cbb..57bcfc9 100644
--- a/offapi/com/sun/star/chart2/XChartDocument.idl
+++ b/offapi/com/sun/star/chart2/XChartDocument.idl
@@ -127,6 +127,10 @@ interface XChartDocument : ::com::sun::star::frame::XModel
     /** Creates a default chart type for a brand-new chart object.
      */
     void createDefaultChart();
+
+    /** Returns true if the chart is based on OpenGL
+     */
+    boolean isOpenGLChart();
 };
 
 } ; // chart2
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index d320b30..b8d5883 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -804,7 +804,18 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::
 bool EmbeddedObjectRef::IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
 {
     static const char* env = getenv("CHART_DUMMY_FACTORY");
-    return IsChart(xObj) && env;
+    if (IsChart(xObj))
+    {
+        if (env)
+            return true;
+
+        uno::Reference< chart2::XChartDocument > xChartDoc(xObj->getComponent(), uno::UNO_QUERY);
+        if (!xChartDoc.is())
+            return false;
+
+        return xChartDoc->isOpenGLChart();
+    }
+    return false;
 }
 
 void EmbeddedObjectRef::UpdateReplacement()
commit 5d622c55ef776f31ec8a0a5dfcbbadd03c35e5a1
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 19:09:39 2014 +0200

    cache the call to getenv
    
    Change-Id: I13095b13694aa092e3d5f542b5be12e703eb4590

diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index e4218fc..d320b30 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -803,7 +803,8 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::
 
 bool EmbeddedObjectRef::IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
 {
-    return IsChart(xObj) && getenv("CHART_DUMMY_FACTORY");
+    static const char* env = getenv("CHART_DUMMY_FACTORY");
+    return IsChart(xObj) && env;
 }
 
 void EmbeddedObjectRef::UpdateReplacement()
commit 0c092af2eb5f07fa18ea53b5dbe344fccda4389b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 25 19:55:03 2014 +0200

    Don't render with mp2DRenderer when we have 3D charts
    
    Change-Id: Icb224f2d3dd55580532b1c4c43781ad444e51a43

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 7ceccc0..d2dfbf5 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2708,15 +2708,18 @@ void ChartView::createShapes()
 
 void ChartView::render()
 {
-    AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
-    OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
-    if(pWindow)
-        pWindow->setRenderer(mp2DRenderer.get());
-    bool bRender = pShapeFactory->preRender(pWindow);
-    if(bRender)
+    if(!isReal3DChart())
     {
-        pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
-        pShapeFactory->postRender(pWindow);
+        AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory);
+        OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
+        if(pWindow)
+            pWindow->setRenderer(mp2DRenderer.get());
+        bool bRender = pShapeFactory->preRender(pWindow);
+        if(bRender)
+        {
+            pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
+            pShapeFactory->postRender(pWindow);
+        }
     }
 }
 
commit fe20f974cada3e1637e9f40508b6cfda1bc5b7d2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 25 19:42:55 2014 +0200

    mpRenderer->init() needs a context
    
    Change-Id: I9f6ce17fcc590597f357bf3ded5fe3eb41fb3810

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index e540dbd..11406bf 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -499,7 +499,9 @@ GL3DBarChart::GL3DBarChart(
     }
     mpRenderer->SetSize(aSize);
     mpWindow->setRenderer(this);
+    mpWindow->getContext().makeCurrent();
     mpRenderer->init();
+    mpWindow->getContext().resetCurrent();
 }
 
 GL3DBarChart::BarInformation::BarInformation(const glm::vec3& rPos, float nVal,
@@ -1318,7 +1320,9 @@ void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
         Size aSize = mpWindow->GetSizePixel();
         mpRenderer->SetSize(aSize);
         mpWindow->setRenderer(this);
+        mpWindow->getContext().makeCurrent();
         mpRenderer->init();
+        mpWindow->getContext().resetCurrent();
         mbValidContext = true;
     }
 }
commit 18ccf4035916b18cdb8145f06c69a04cd7269c43
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 25 19:21:54 2014 +0200

    Oops, static was forgotten.
    
    Change-Id: I0c316581ab8bfb0a49420006a0801d13021bd1ca

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index c830785..7ceccc0 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2447,7 +2447,7 @@ bool ChartView::isReal3DChart()
     return GL3DHelper::isGL3DDiagram(xDiagram);
 }
 
-const char* envChartDummyFactory = getenv("CHART_DUMMY_FACTORY");
+static const char* envChartDummyFactory = getenv("CHART_DUMMY_FACTORY");
 
 void ChartView::createShapes()
 {
commit aa40e8604953dd1f71197c9f45d6b489fccfd1ea
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 25 19:17:03 2014 +0200

    Store env variable in a static variable instead
    
    Change-Id: I5d6067806645722faac3fe90cbec01b6963f7283

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 910757d..c830785 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2447,6 +2447,8 @@ bool ChartView::isReal3DChart()
     return GL3DHelper::isGL3DDiagram(xDiagram);
 }
 
+const char* envChartDummyFactory = getenv("CHART_DUMMY_FACTORY");
+
 void ChartView::createShapes()
 {
     osl::ResettableMutexGuard aTimedGuard(maTimeMutex);
@@ -2500,7 +2502,7 @@ void ChartView::createShapes()
 
         // hide OpenGL window for now in normal charts
         OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
-        if(pWindow && !getenv("CHART_DUMMY_FACTORY"))
+        if(pWindow && !envChartDummyFactory)
             pWindow->Show(false);
     }
 #endif
commit 72d8f483b387b53426551a83851503011bf8bb30
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 25 19:03:27 2014 +0200

    Revert "Stop flickering in rendering of charts in Writer"
    
    Hide when it's actually a normal chart.
    
    This reverts commit b79b862927d937d695b31df4bdb85d1fc8774f39.
    
    Change-Id: Ib7aee142cea979293864f3916eb0580a82605b2b

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index a6d8a5a..910757d 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2497,6 +2497,11 @@ void ChartView::createShapes()
     else
     {
         m_pGL3DPlotter.reset();
+
+        // hide OpenGL window for now in normal charts
+        OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
+        if(pWindow && !getenv("CHART_DUMMY_FACTORY"))
+            pWindow->Show(false);
     }
 #endif
 
commit 1f0a1a308bea3f4ea3452ac2385f35bc2b36d274
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Aug 25 18:43:06 2014 +0200

    CHART_DUMMY_FACTORY should not control the OpenGL window
    
    Change-Id: Ic6c640f7d37606b357672f2b73f95d51d1daba67

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index fc0aab9..4b7ea3a 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -49,7 +49,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
         : Window(pParent, nStyle)
         , m_pWindowController( pController )
         , m_bInPaint(false)
-        , m_pOpenGLWindow(getenv("CHART_DUMMY_FACTORY") ? new OpenGLWindow(this) : 0)
+        , m_pOpenGLWindow(new OpenGLWindow(this))
 {
     this->SetHelpId( HID_SCH_WIN_DOCUMENT );
     this->SetMapMode( MapMode(MAP_100TH_MM) );
commit 0bbb6f08122ba9d8a58b9cb25667d0a1f899ebd0
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Aug 22 18:31:31 2014 +0200

    Call resetCurrent as soon as possible to avoid conflict with other thread
    
    Change-Id: Ie3edc252135301ba5b85b80edcdbe75537d0da16

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index ed5cb2f..e540dbd 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -122,7 +122,7 @@ void RenderThread::renderFrame()
     mpChart->mpRenderer->ProcessUnrenderedShape(mpChart->mbNeedsNewRender);
     mpChart->mbNeedsNewRender = false;
     mpChart->mpWindow->getContext().swapBuffers();
-
+    mpChart->mpWindow->getContext().resetCurrent();
 }
 
 class RenderOneFrameThread : public RenderThread
commit 8e37097d52e8a52ee4a9ea7c87d9fac4b3feef8b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Aug 22 10:08:07 2014 +0200

    Update chart when chart type is changed in edit mode
    
    Regression to master.
    In long term it would be better to define ChartWindow as an
    OpenGL window and not creating a new window inside the chart
    window, becasue otherwise all events which was handled well
    by the chart window will be broken (catched by the OpenGL
    window so no effect on ChartWindow (defining the behavior of
    charts in general) or catched by the ChartWindow and so no
    effect on the OpenGLWindow (like invalidating in this case).
    
    Change-Id: I234f469f70914e01f030c8edae9cb5aacea112bf

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index dde5006..fc0aab9 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -265,24 +265,40 @@ void ChartWindow::adjustHighContrastMode()
 void ChartWindow::ForceInvalidate()
 {
     ::Window::Invalidate();
+    if(m_pOpenGLWindow)
+    {
+        m_pOpenGLWindow->Invalidate();
+    }
 }
 void ChartWindow::Invalidate( sal_uInt16 nFlags )
 {
     if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
         return;
     ::Window::Invalidate( nFlags );
+    if(m_pOpenGLWindow)
+    {
+        m_pOpenGLWindow->Invalidate( nFlags );
+    }
 }
 void ChartWindow::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags )
 {
     if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
         return;
     ::Window::Invalidate( rRect, nFlags );
+    if(m_pOpenGLWindow)
+    {
+        m_pOpenGLWindow->Invalidate( rRect, nFlags );
+    }
 }
 void ChartWindow::Invalidate( const Region& rRegion, sal_uInt16 nFlags )
 {
     if( m_bInPaint ) // #i101928# superfluous paint calls while entering and editing charts"
         return;
     ::Window::Invalidate( rRegion, nFlags );
+    if(m_pOpenGLWindow)
+    {
+        m_pOpenGLWindow->Invalidate( rRegion, nFlags );
+    }
 }
 
 } //namespace chart
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 39f9be8..a6d8a5a 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -165,6 +165,7 @@ GL2DRenderer::~GL2DRenderer()
 
 void GL2DRenderer::update()
 {
+    mpView->update();
     mpView->render();
 }
 
commit a933a955c6278ecfbc7f14280b5b1090dee581e5
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 21 17:02:32 2014 +0200

    Reinitialize GL3D renderer when OpenGL window is changed
    
    Without it when we switch sheets in Calc or slides in Impress
    and go back to that page where the GL3DBar chart is then the
    renderer does not work.
    
    Change-Id: I9aa6203ed5aa7f94627d886b2f2e5ad34d493843

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 52a6bc7..ed5cb2f 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1313,7 +1313,14 @@ IMPL_LINK_NOARG(GL3DBarChart, updateTimer)
 void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
 {
     if (mpWindow != pWindow)
+    {
         mpWindow = pWindow;
+        Size aSize = mpWindow->GetSizePixel();
+        mpRenderer->SetSize(aSize);
+        mpWindow->setRenderer(this);
+        mpRenderer->init();
+        mbValidContext = true;
+    }
 }
 
 }
commit 2414270c396929490fe2b1b2afecd25075b21117
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 21 16:00:14 2014 +0200

    Don't create an OpenGL window in case of normal charts.
    
    Change-Id: Idb4506712d3902c12aa881a85ddf69a281edff82

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 40e6933..dde5006 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -49,7 +49,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
         : Window(pParent, nStyle)
         , m_pWindowController( pController )
         , m_bInPaint(false)
-        , m_pOpenGLWindow(new OpenGLWindow(this))
+        , m_pOpenGLWindow(getenv("CHART_DUMMY_FACTORY") ? new OpenGLWindow(this) : 0)
 {
     this->SetHelpId( HID_SCH_WIN_DOCUMENT );
     this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -60,11 +60,14 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
     if( pParent )
         pParent->EnableRTL( false );// #i96215# necessary for a correct position of the context menu in rtl mode
 
-    m_pOpenGLWindow->Show();
-    uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
-    sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
-    x3DWindowProvider->setWindow(nWindowPtr);
-    x3DWindowProvider->update();
+    if( m_pOpenGLWindow )
+    {
+        m_pOpenGLWindow->Show();
+        uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
+        sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
+        x3DWindowProvider->setWindow(nWindowPtr);
+        x3DWindowProvider->update();
+    }
 }
 
 ChartWindow::~ChartWindow()
@@ -150,7 +153,8 @@ void ChartWindow::Resize()
     else
         Window::Resize();
 
-    m_pOpenGLWindow->SetSizePixel(GetSizePixel());
+    if( m_pOpenGLWindow )
+        m_pOpenGLWindow->SetSizePixel(GetSizePixel());
 }
 
 void ChartWindow::Activate()
commit 19cf361efa9dbe636135434b6839d889b66a29dc
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 21 10:47:31 2014 +0200

    Fix rendering of GL3DBarCharts after ODF import
    
    OpenGL window need to have a valid size before
    rendering.
    
    Change-Id: I3ce3dbf653f0dc101de3acc4d634d7fe6c3be9ad

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index cc69206..39f9be8 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3161,6 +3161,12 @@ void ChartView::createShapes3D()
     if(!pWindow)
         return;
 
+    if( pWindow->GetSizePixel().Width() == 0 || pWindow->GetSizePixel().Height() == 0 )
+    {
+        awt::Size aPageSize = mrChartModel.getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+        Size aSize = pWindow->LogicToPixel( Size(aPageSize.Width,aPageSize.Height), MapUnit(MAP_100TH_MM) );
+        pWindow->SetSizePixel(aSize);
+    }
     pWindow->Show();
     uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
     uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
commit ed23d7e6d3ef9e09664502e1230dbf492050ff59
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 18 15:16:46 2014 +0200

    Stop flickering in rendering of charts in Writer
    
    Change-Id: I52efa9cd7851f480ee2abcaa1646735c6f518f3a

diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index aecb50d..cc69206 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2496,11 +2496,6 @@ void ChartView::createShapes()
     else
     {
         m_pGL3DPlotter.reset();
-
-        // hide OpenGL window for now in normal charts
-        OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
-        if(pWindow)
-            pWindow->Show(false);
     }
 #endif
 
commit f4528a1ba6a95dabc00901bfbe99f4e1bd094256
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 11 17:53:31 2014 +0200

    Add a border to opengl chart to make it easier to handle.
    
    Change-Id: I74bc636dc0a37d70f45fe2eac0b8b60e3f6318bb

diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index 783c99b..9bb8581 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -73,8 +73,7 @@
 #include "commonembobj.hxx"
 #include "intercept.hxx"
 
-#define HATCH_BORDER_WIDTH ((((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || \
-                            (svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj)) ) && \
+#define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \
                             m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
 
 using namespace ::com::sun::star;
commit 8d509d69b434bd70b61cb6eed8b8dc21707726a3
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 11 14:27:16 2014 +0200

    This OpenGL window is useless
    
    Change-Id: Ied9914c9a317dc3945c29b984d2a68957275fc52

diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index d29222f..b20b829 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -189,8 +189,6 @@ private:
     void          DoReadUserDataSequence( const ::com::sun::star::uno::Sequence<
                                      ::com::sun::star::beans::PropertyValue >& rSettings );
 
-    void AddOpenGLChartWindows();
-
     DECL_LINK( SimpleRefClose, void* );
     DECL_LINK( SimpleRefDone, OUString* );
     DECL_LINK( SimpleRefAborted, OUString* );
@@ -327,7 +325,6 @@ public:
     ObjectSelectionType GetCurObjectSelectionType() { return eCurOST; }
 
     virtual ErrCode DoVerb(long nVerb) SAL_OVERRIDE;
-    virtual void Initialize() SAL_OVERRIDE;
 
     void            StopEditShell();
     bool            IsDrawTextShell() const;
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 2fc3849..bcc679e 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -571,39 +571,6 @@ bool isGL3DDiagram( const css::uno::Reference<css::chart2::XDiagram>& xDiagram )
 
 }
 
-void ScTabViewShell::AddOpenGLChartWindows()
-{
-    ScDocument* pDoc = GetViewData().GetDocument();
-    ScGridWindow* pParentWindow = GetActiveWin();
-
-    std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > aCharts = pDoc->GetAllCharts();
-
-    for(std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> >::iterator itr = aCharts.begin(),
-            itrEnd = aCharts.end(); itr != itrEnd; ++itr)
-    {
-        if(!itr->first.is())
-            return;
-        OpenGLWindow* pOpenGLWindow = new OpenGLWindow(pParentWindow);
-
-        pOpenGLWindow->Show(false);
-        Size aSize = itr->second.GetSize();
-        Size aWindowSize = pOpenGLWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
-
-        pOpenGLWindow->SetSizePixel(aWindowSize);
-        Point aPos = itr->second.TopLeft();
-        pOpenGLWindow->SetPosPixel(pOpenGLWindow->LogicToPixel(aPos, MapMode(MAP_100TH_MM)));
-        pParentWindow->AddChildWindow(pOpenGLWindow);
-        uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( itr->first, uno::UNO_QUERY_THROW );
-        sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pOpenGLWindow);
-        x3DWindowProvider->setWindow(nWindowPtr);
-
-        if(isGL3DDiagram(itr->first->getFirstDiagram()))
-        {
-            x3DWindowProvider->update();
-        }
-    }
-}
-
 // DoReadUserData is also called from ctor when switching from print preview
 
 void ScTabViewShell::DoReadUserData( const OUString& rData )
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 858bfa7..e42950b 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -244,11 +244,6 @@ ErrCode ScTabViewShell::DoVerb(long nVerb)
     return nErr;
 }
 
-void ScTabViewShell::Initialize()
-{
-    AddOpenGLChartWindows();
-}
-
 void ScTabViewShell::DeactivateOle()
 {
     // deactivate inplace editing if currently active
commit 4e96f7ffdb5d7b84ea70888626523dcdc5dfe0ac
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 11 14:56:50 2014 +0200

    Fix regression in rendering of GL3DBarChart
    
    Change-Id: Ibf8f4a57cbc85f77a73054873030fcef321f5518

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index e5cfb2c..52a6bc7 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -495,8 +495,7 @@ GL3DBarChart::GL3DBarChart(
     Size aSize;
     if (mpWindow)
     {
-        mpWindow->setRenderer(this);
-        Size aSize = mpWindow->GetSizePixel();
+        aSize = mpWindow->GetSizePixel();
     }
     mpRenderer->SetSize(aSize);
     mpWindow->setRenderer(this);
commit cde22222cff549c63045eec968c80c9db0c523f2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 11 10:18:04 2014 +0200

    Mirror vertically the texture bitmaps for OpenGL
    
    In case of glTF models it saves a Mirror() call.
    In case of OpenGL charts it avoid flipped texts.
    
    Change-Id: I1ac980e16bcb5ba6a9a025b638aaac3b08b4aab3

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 917ab2d..a21d5db 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -102,9 +102,8 @@ bool OGLPlayer::create( const OUString& rURL )
                     return false;
                 }
                 BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
-                aBitmapEx.Mirror(BMP_MIRROR_VERT);
                 rFile.buffer = new char[4 * aBitmapEx.GetSizePixel().Width() * aBitmapEx.GetSizePixel().Height()];
-                OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx, reinterpret_cast<sal_uInt8*>(rFile.buffer));
+                OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(aBitmapEx, reinterpret_cast<sal_uInt8*>(rFile.buffer));
                 rFile.imagewidth = aBitmapEx.GetSizePixel().Width();
                 rFile.imageheight = aBitmapEx.GetSizePixel().Height();
             }
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 42b21cf..1075b86 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -699,7 +699,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
 
     boost::shared_array<sal_uInt8> bitmapBuf(new sal_uInt8[4 * rBitmapEx.GetSizePixel().Width() * rBitmapEx.GetSizePixel().Height()]);
 
-    OpenGLHelper::ConvertBitmapExToRGBABuffer(rBitmapEx, bitmapBuf.get());
+    OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(rBitmapEx, bitmapBuf.get());
 
     return CreateTextTexture(bitmapBuf, rBitmapEx.GetSizePixel(),
                              awt::Point(), aSize, rotation, rTrans);
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index aa9448c..8b18964 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -22,10 +22,12 @@ public:
     static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
 
     /**
-     * Note: The caller is responsible for allocate the memory for the RGBA buffer, before call
-     * this method. RGBA buffer size is assumed to be 4*width*height
+     * The caller is responsible for allocate the memory for the RGBA buffer, before call
+     * this method. RGBA buffer size is assumed to be 4*width*height.
+     * Since OpenGL uses textures flipped relative to BitmapEx storage this method
+     * also mirrors the bitmap vertically.
     **/
-    static void ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer);
+    static void ConvertBitmapExToRGBATextureBuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer);
     static BitmapEx ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight);
     static void renderToFile(long nWidth, long nHeight, const OUString& rFileName);
 
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index c028246..16dd5b7 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -146,7 +146,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,const OUString
     return ProgramID;
 }
 
-void OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer)
+void OpenGLHelper::ConvertBitmapExToRGBATextureBuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer)
 {
     long nBmpWidth = rBitmapEx.GetSizePixel().Width();
     long nBmpHeight = rBitmapEx.GetSizePixel().Height();
@@ -156,7 +156,7 @@ void OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uI
     Bitmap::ScopedReadAccess pReadAccces( aBitmap );
     AlphaMask::ScopedReadAccess pAlphaReadAccess( aAlpha );
     size_t i = 0;
-    for (long ny = 0; ny < nBmpHeight; ny++)
+    for (long ny = nBmpHeight - 1; ny >= 0; ny--)
     {
         Scanline pAScan = pAlphaReadAccess ? pAlphaReadAccess->GetScanline(ny) : 0;
         for(long nx = 0; nx < nBmpWidth; nx++)
commit f71aae75017308545d0f835de6a5e39603d17002
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 4 12:04:10 2014 +0200

    It seems better if the caller allocates the memory for the RGBA buffer.
    
    For example it allows to use std::vector<> and call the method
    
    Change-Id: Id4b8e33838d358dd242d0176e42558505fa8d4a3

diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 0b7e242..917ab2d 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -103,7 +103,8 @@ bool OGLPlayer::create( const OUString& rURL )
                 }
                 BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
                 aBitmapEx.Mirror(BMP_MIRROR_VERT);
-                rFile.buffer = (char*)OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx);
+                rFile.buffer = new char[4 * aBitmapEx.GetSizePixel().Width() * aBitmapEx.GetSizePixel().Height()];
+                OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx, reinterpret_cast<sal_uInt8*>(rFile.buffer));
                 rFile.imagewidth = aBitmapEx.GetSizePixel().Width();
                 rFile.imageheight = aBitmapEx.GetSizePixel().Height();
             }
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 2c93d36..42b21cf 100644
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -697,7 +697,9 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
     }
 #endif
 
-    boost::shared_array<sal_uInt8> bitmapBuf(OpenGLHelper::ConvertBitmapExToRGBABuffer(rBitmapEx));
+    boost::shared_array<sal_uInt8> bitmapBuf(new sal_uInt8[4 * rBitmapEx.GetSizePixel().Width() * rBitmapEx.GetSizePixel().Height()]);
+
+    OpenGLHelper::ConvertBitmapExToRGBABuffer(rBitmapEx, bitmapBuf.get());
 
     return CreateTextTexture(bitmapBuf, rBitmapEx.GetSizePixel(),
                              awt::Point(), aSize, rotation, rTrans);
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 52093c2..aa9448c 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -21,7 +21,11 @@ class VCLOPENGL_DLLPUBLIC OpenGLHelper
 public:
     static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
 
-    static sal_uInt8* ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx);
+    /**
+     * Note: The caller is responsible for allocate the memory for the RGBA buffer, before call
+     * this method. RGBA buffer size is assumed to be 4*width*height
+    **/
+    static void ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer);
     static BitmapEx ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffer, long nWidth, long nHeight);
     static void renderToFile(long nWidth, long nHeight, const OUString& rFileName);
 
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index ab10a25..c028246 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -146,14 +146,13 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,const OUString
     return ProgramID;
 }
 
-sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
+void OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx, sal_uInt8* o_pRGBABuffer)
 {
     long nBmpWidth = rBitmapEx.GetSizePixel().Width();
     long nBmpHeight = rBitmapEx.GetSizePixel().Height();
 
     Bitmap aBitmap (rBitmapEx.GetBitmap());
     AlphaMask aAlpha (rBitmapEx.GetAlpha());
-    sal_uInt8* pBitmapBuf(new sal_uInt8[4* nBmpWidth * nBmpHeight ]);
     Bitmap::ScopedReadAccess pReadAccces( aBitmap );
     AlphaMask::ScopedReadAccess pAlphaReadAccess( aAlpha );
     size_t i = 0;
@@ -163,13 +162,12 @@ sal_uInt8* OpenGLHelper::ConvertBitmapExToRGBABuffer(const BitmapEx& rBitmapEx)
         for(long nx = 0; nx < nBmpWidth; nx++)
         {
             BitmapColor aCol = pReadAccces->GetColor( ny, nx );
-            pBitmapBuf[i++] = aCol.GetRed();
-            pBitmapBuf[i++] = aCol.GetGreen();
-            pBitmapBuf[i++] = aCol.GetBlue();
-            pBitmapBuf[i++] = pAScan ? 255 - *pAScan++ : 255;
+            o_pRGBABuffer[i++] = aCol.GetRed();
+            o_pRGBABuffer[i++] = aCol.GetGreen();
+            o_pRGBABuffer[i++] = aCol.GetBlue();
+            o_pRGBABuffer[i++] = pAScan ? 255 - *pAScan++ : 255;
         }
     }
-    return pBitmapBuf;
 }
 
 void OpenGLHelper::renderToFile(long nWidth, long nHeight, const OUString& rFileName)
commit 9991b50ccc6ef3d26c28859b4a31504bd5001368
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Mon Aug 11 09:54:20 2014 +0200

    Make opengl chart window always active
    
    Fortunately there is a special ole object group with
    the MS_EMBED_ACTIVATEWHENVISIBLE flag which define this
    behaviour.
    Problem is that both Aspect and EmbedMisc are MS specific
    enums so we can't use them directly for non-MS objects. But we
    can handle opengl charts the same as this ole object group.
    
    Change-Id: I49abeffce319cbb775709a72ba198a1f76b65374

diff --git a/embeddedobj/Library_embobj.mk b/embeddedobj/Library_embobj.mk
index f2a971b..7de4e48 100644
--- a/embeddedobj/Library_embobj.mk
+++ b/embeddedobj/Library_embobj.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_Library_use_libraries,embobj,\
 	cppu \
 	cppuhelper \
 	sal \
+	svt \
 	vcl \
 	tl \
 	$(gb_UWINAPI) \
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index bd0494f..783c99b 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -64,6 +64,7 @@
 #include <osl/diagnose.h>
 #include <rtl/process.h>
 #include <vcl/svapp.hxx>
+#include <svtools/embedhlp.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
@@ -72,9 +73,9 @@
 #include "commonembobj.hxx"
 #include "intercept.hxx"
 
-
-#define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \
-                             m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
+#define HATCH_BORDER_WIDTH ((((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || \
+                            (svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj)) ) && \
+                            m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
 
 using namespace ::com::sun::star;
 
@@ -1256,7 +1257,8 @@ awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectan
 
 void SAL_CALL DocumentHolder::activated(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
 {
-    if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) )
+    if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+        svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj) )
     {
         if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE &&
         !(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 30d690c..f157ce6 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -68,6 +68,7 @@ public:
                             throw();
 
     static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
+    static bool IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
 
     const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
     const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
@@ -109,6 +110,7 @@ public:
 
     bool IsLocked() const;
     bool IsChart() const;
+    bool IsGLChart() const;
 
     OUString GetChartType();
 
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index da40379..6700ec9 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -1048,7 +1048,8 @@ void SfxInPlaceClient::DeactivateObject()
 
             m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true);
 
-            if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+            if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+                 svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
             {
                 m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
                 if (bHasFocus)
@@ -1081,7 +1082,8 @@ void SfxInPlaceClient::ResetObject()
         try
         {
             m_pImp->m_bUIActive = false;
-            if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+            if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+                svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
                 m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
             else
             {
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 4d1b807..e02c25f 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -44,6 +44,7 @@
 #include <unotools/pathoptions.hxx>
 #include <svtools/miscopt.hxx>
 #include <svtools/soerr.hxx>
+#include <svtools/embedhlp.hxx>
 
 #include <basic/basmgr.hxx>
 #include <basic/sbuno.hxx>
@@ -1735,7 +1736,8 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
     bool bAlwaysActive =
         ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
     bool bActiveWhenVisible =
-        ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 );
+        ( (( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ) ||
+         svt::EmbeddedObjectRef::IsGLChart(pIPClient->GetObject()));
 
     // this method is called when either a client is created or the "Edit/Plugins" checkbox is checked
     if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive )
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 365c316..e4218fc 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -801,6 +801,11 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::
     return false;
 }
 
+bool EmbeddedObjectRef::IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
+{
+    return IsChart(xObj) && getenv("CHART_DUMMY_FACTORY");
+}
+
 void EmbeddedObjectRef::UpdateReplacement()
 {
     GetReplacement( true );
@@ -834,6 +839,14 @@ bool EmbeddedObjectRef::IsChart() const
     return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
 }
 
+bool EmbeddedObjectRef::IsGLChart() const
+{
+    if (!mpImpl->mxObj.is())
+        return false;
+
+    return EmbeddedObjectRef::IsGLChart(mpImpl->mxObj);
+}
+
 // MT: Only used for getting accessible attributes, which are not localized
 OUString EmbeddedObjectRef::GetChartType()
 {
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 10f6490..ca819b5 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -98,7 +98,8 @@ namespace sdr
                         }
 
                         SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
-                        if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
+                        if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+                            xObjRef.IsGLChart()))
                         {
                             // connect plugin object
                             pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 42482ff..d25480c 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -396,7 +396,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
                 uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
                 try
                 {
-                    if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+                    if ( (xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+                         svt::EmbeddedObjectRef::IsGLChart(xObject) )
                         xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
                     else
                     {
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 36d04c1..87d6351 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1055,8 +1055,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
                 ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
 
             sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
-            if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
-                    nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+            if ( !bPrn && pShell->ISA( SwCrsrShell ) && (
+                    (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+                    pOLENd->GetOLEObj().GetObject().IsGLChart()))
             {
                 const SwFlyFrm *pFly = FindFlyFrm();
                 assert( pFly != NULL );
commit bd9a4e19227834381dd776d8fc13e5f1ecdf92b3
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Aug 10 17:18:16 2014 +0200

    ChartHelper::IsChart is useless
    
    EmbeddedObjectRef has an own IsChart method with the same
    behavior.
    
    Change-Id: Ib06699186466bf3da2bd67d7c631a5216463fb14

diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx
index 296fccc..bfa1bf78 100644
--- a/include/svx/charthelper.hxx
+++ b/include/svx/charthelper.hxx
@@ -27,19 +27,9 @@
 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
 
-
-// predeclarations
-
-namespace svt { class EmbeddedObjectRef; }
-
-
-
 class SVX_DLLPUBLIC ChartHelper
 {
 public:
-    // test if given reference is a chart
-    static bool IsChart(const svt::EmbeddedObjectRef& xObjRef);
-
     // try to access rXModel in case of a chart to to get the chart content
     // as sequence of primitives. Return range of primitives (chart size) in rRange;
     // it will be used to embed the chart to the SdrObject transformation. This
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
index 6273aa8..86c0a84 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -18,7 +18,6 @@
  */
 
 #include <svx/charthelper.hxx>
-#include <svtools/embedhlp.hxx>
 #include <tools/globname.hxx>
 #include <comphelper/classids.hxx>
 #include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -35,26 +34,6 @@
 
 using namespace ::com::sun::star;
 
-bool ChartHelper::IsChart(const svt::EmbeddedObjectRef& xObjRef)
-{
-    if(!xObjRef.is())
-    {
-        return false;
-    }
-
-    const SvGlobalName aObjClsId(xObjRef->getClassID());
-
-    if(SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
-    {
-        return true;
-    }
-
-    return false;
-}
-
 drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
     const uno::Reference< ::frame::XModel >& rXModel,
     basegfx::B2DRange& rRange)
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index d1348c6..42482ff 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -72,7 +72,6 @@
 #include <svx/svdetc.hxx>
 #include <svx/svdview.hxx>
 #include "unomlstr.hxx"
-#include <svx/charthelper.hxx>
 #include <sdr/contact/viewcontactofsdrole2obj.hxx>
 #include <svx/svdograf.hxx>
 #include <sdr/properties/oleproperties.hxx>
@@ -2148,7 +2147,7 @@ bool SdrOle2Obj::IsChart() const
 {
     if (!mpImpl->mbTypeAsked)
     {
-        mpImpl->mbIsChart = ChartHelper::IsChart(mpImpl->mxObjRef);
+        mpImpl->mbIsChart = mpImpl->mxObjRef.IsChart();
         mpImpl->mbTypeAsked = true;
     }
     return mpImpl->mbIsChart;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 9baf0ce..36d04c1 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -845,7 +845,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
     const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
                           pOut->GetConnectMetaFile();
 
-    const bool bIsChart = pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() );
+    const bool bIsChart = pOLENd && pOLENd->GetOLEObj().GetObject().IsChart();
 
     // calculate aligned rectangle from parameter <rGrfArea>.
     //     Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 971b97f..9537d2b 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -74,7 +74,6 @@
 #include <IDocumentDrawModelAccess.hxx>
 
 #include <ndole.hxx>
-#include <svx/charthelper.hxx>
 #include <PostItMgr.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
@@ -4102,7 +4101,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
         if( pNoTNd )
         {
             SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
-            if( pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() ) )
+            if( pOLENd && pOLENd->GetOLEObj().GetObject().IsChart() )
                 bIsChart = true;
         }
     }
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index d4ab877..1dea221 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -26,7 +26,6 @@
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <svl/zforlist.hxx>
-#include <svx/charthelper.hxx>
 
 #include <XMLRangeHelper.hxx>
 #include <unochart.hxx>
@@ -64,7 +63,7 @@ void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc )
     {
         ++aIdx;
         if (0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
-            ChartHelper::IsChart( pONd->GetOLEObj().GetObject() ) )
+            pONd->GetOLEObj().GetObject().IsChart() )
         {
             // Load the object and set modified
 
commit 6e4f6ec445198f6252fdfed627a1c6d07557190a
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Sun Aug 10 16:47:39 2014 +0200

    Add a method to check whether an XEmbeddedObject is a chart
    
    Change-Id: I6f860b9f1bce200c5366df0a32650705cf429a80

diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 49763a2..30d690c 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -67,6 +67,8 @@ public:
                                         OUString* pMediaType )
                             throw();
 
+    static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
+
     const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
     const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
 
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 238ea03..365c316 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -786,6 +786,21 @@ uno::Reference< io::XInputStream > EmbeddedObjectRef::GetGraphicReplacementStrea
     return ::comphelper::EmbeddedObjectContainer::GetGraphicReplacementStream(nViewAspect,xObj,pMediaType);
 }
 
+bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
+{
+    SvGlobalName aObjClsId(xObj->getClassID());
+    if(
+        SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
+        || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
+        || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
+        || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
+    {
+        return true;
+    }
+
+    return false;
+}
+
 void EmbeddedObjectRef::UpdateReplacement()
 {
     GetReplacement( true );
@@ -816,17 +831,7 @@ bool EmbeddedObjectRef::IsChart() const
     if (!mpImpl->mxObj.is())
         return false;
 
-    SvGlobalName aObjClsId(mpImpl->mxObj->getClassID());
-    if(
-        SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
-        || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
-    {
-        return true;
-    }
-
-    return false;
+    return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
 }
 
 // MT: Only used for getting accessible attributes, which are not localized
commit 7daba09d025a2ade10cecb33cd1d613f16b78fe4
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Fri Aug 8 13:44:42 2014 +0200

    Fix OpenGL chart reinitialiation
    
    Problem after ChartWindow was disabled and enabled
    again, OpenGL content was lost.
    
    Two things:
    -After setting a new OpenGLWindow the corresponding
    IRenderer must be set (x3DWindowProvider->update)
    -InitOpenGL() call should not depend on DummyChart, but on
    OpenGLWindow (OpenGLContext).
    
    Change-Id: If74e1945de9973d3921ceea1ca6fef39311add7a

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 37335c4..40e6933 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -64,6 +64,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
     uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
     sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
     x3DWindowProvider->setWindow(nWindowPtr);
+    x3DWindowProvider->update();
 }
 
 ChartWindow::~ChartWindow()
@@ -72,6 +73,7 @@ ChartWindow::~ChartWindow()
     {
         uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
         x3DWindowProvider->setWindow(0);
+        x3DWindowProvider->update();
     }
     delete m_pOpenGLWindow;
 }
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 9cb3e47..3e55165 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -238,7 +238,7 @@ public:
     /**
      * Only necessary for stateless implementations
      */
-    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape, bool bInitOpenGL = true) = 0;
 
     virtual bool preRender(OpenGLWindow* pWindow) = 0;
     virtual void postRender(OpenGLWindow* pWindow) = 0;
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index 896249e..7907d0d 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -184,7 +184,7 @@ public:
 
     virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize ) SAL_OVERRIDE;
 
-    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xDrawPage) SAL_OVERRIDE;
+    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xDrawPage, bool bInitOpenGL = true) SAL_OVERRIDE;
 
     virtual bool preRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
     virtual void postRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 171daad..480c1b1 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -197,7 +197,7 @@ public:
     /**
      * not necessary right now
      */
-    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+    virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >, bool ) SAL_OVERRIDE {}
 
     virtual bool preRender(OpenGLWindow*) SAL_OVERRIDE { return true; }
     virtual void postRender(OpenGLWindow*) SAL_OVERRIDE {}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index dff0e12..aecb50d 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -142,6 +142,7 @@ public:
     virtual void scroll(long nDelta) SAL_OVERRIDE;
     virtual void contextDestroyed() SAL_OVERRIDE;
 
+    const OpenGLWindow* getOpenGLWindow() const;
     void updateOpenGLWindow();
 private:
     ChartView* mpView;
@@ -184,6 +185,11 @@ void GL2DRenderer::contextDestroyed()
     mbContextDestroyed = true;
 }
 
+const OpenGLWindow* GL2DRenderer::getOpenGLWindow() const
+{
+    return mpWindow;
+}
+
 void GL2DRenderer::updateOpenGLWindow()
 {
     if(mbContextDestroyed)
@@ -2706,7 +2712,7 @@ void ChartView::render()
     bool bRender = pShapeFactory->preRender(pWindow);
     if(bRender)
     {
-        pShapeFactory->render(mxRootShape);
+        pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
         pShapeFactory->postRender(pWindow);
     }
 }
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index ee9e1af..54f5df4 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -395,6 +395,7 @@ public:
     virtual void render() SAL_OVERRIDE;
 
     void clear();
+    void invalidateInit() { mbNotInit = true; }
     TextCache& getTextCache() { return maTextCache;}
 
 private:
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index c486f01..a26024e 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -446,9 +446,13 @@ uno::Reference< drawing::XShape >
     return pText;
 }
 
-void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
+void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape, bool bInitOpenGL)
 {
     dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
+    if(bInitOpenGL)
+    {
+        rChart.invalidateInit();
+    }
     rChart.render();
 }
 
commit 43d23a24fde16addb37376a92d36dba78263614a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sat May 17 04:32:58 2014 +0200

    opengl charts: Move the init from sc to chart2, to have the right parent.
    
    Conflicts:
    	chart2/source/view/charttypes/GL3DBarChart.cxx
    
    Change-Id: I1e23329345e00e7d8e1f269c832e84d015824c0a

diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index f77ef70..b147fc1 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Library_use_libraries,chartcontroller,\
     ucbhelper \
     utl \
     vcl \
+    vclopengl \
 	$(gb_UWINAPI) \
 ))
 
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index b57045d..d5eca79 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -726,6 +726,9 @@ void SAL_CALL ChartController::dispose()
 
         //--release all resources and references
         {
+            uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(getModel(), uno::UNO_QUERY_THROW);
+            x3DWindowProvider->setWindow(0);
+
             uno::Reference< util::XModeChangeBroadcaster > xViewBroadcaster( m_xChartView, uno::UNO_QUERY );
             if( xViewBroadcaster.is() )
                 xViewBroadcaster->removeModeChangeListener(this);
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 917d69e..37335c4 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -22,8 +22,11 @@
 #include "HelpIds.hrc"
 
 #include <vcl/help.hxx>
+#include <vcl/openglwin.hxx>
 #include <vcl/settings.hxx>
 
+#include <com/sun/star/chart2/X3DChartWindowProvider.hpp>
+
 using namespace ::com::sun::star;
 
 namespace
@@ -42,10 +45,11 @@ namespace
 namespace chart
 {
 
-ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle )
+ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits nStyle )
         : Window(pParent, nStyle)
-        , m_pWindowController( pWindowController )
+        , m_pWindowController( pController )
         , m_bInPaint(false)
+        , m_pOpenGLWindow(new OpenGLWindow(this))
 {
     this->SetHelpId( HID_SCH_WIN_DOCUMENT );
     this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -55,10 +59,21 @@ ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent,
     EnableRTL( false );
     if( pParent )
         pParent->EnableRTL( false );// #i96215# necessary for a correct position of the context menu in rtl mode
+
+    m_pOpenGLWindow->Show();
+    uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
+    sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
+    x3DWindowProvider->setWindow(nWindowPtr);
 }
 
 ChartWindow::~ChartWindow()
 {
+    if (m_pWindowController && m_pWindowController->getModel().is())
+    {
+        uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
+        x3DWindowProvider->setWindow(0);
+    }
+    delete m_pOpenGLWindow;
 }
 
 void ChartWindow::clear()
@@ -79,10 +94,18 @@ void ChartWindow::PrePaint()
 void ChartWindow::Paint( const Rectangle& rRect )
 {
     m_bInPaint = true;
-    if( m_pWindowController )
-        m_pWindowController->execute_Paint( rRect );
+    if (m_pOpenGLWindow && m_pOpenGLWindow->IsVisible())
+    {
+        m_pOpenGLWindow->Paint(rRect);
+    }
+    else if (m_pWindowController)
+    {
+        m_pWindowController->execute_Paint(rRect);
+    }
     else
+    {
         Window::Paint( rRect );
+    }
     m_bInPaint = false;
 }
 
@@ -124,6 +147,8 @@ void ChartWindow::Resize()
         m_pWindowController->execute_Resize();
     else
         Window::Resize();
+
+    m_pOpenGLWindow->SetSizePixel(GetSizePixel());
 }
 
 void ChartWindow::Activate()
diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx
index ec5c05b..ee5884f 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -21,10 +21,12 @@
 
 #include <vcl/window.hxx>
 
+class OpenGLWindow;
+
 namespace chart
 {
 
-class WindowController;
+class ChartController;
 
 /** The ChartWindow collects events from the window and forwards them the to the controller
 thus the controller can perform appropriate actions
@@ -33,7 +35,7 @@ thus the controller can perform appropriate actions
 class ChartWindow : public Window
 {
 public:
-    ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle );
+    ChartWindow( ChartController* pController, Window* pParent, WinBits nStyle );
     virtual ~ChartWindow();
 
     void clear();
@@ -63,8 +65,9 @@ public:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
 
 private:
-    WindowController*    m_pWindowController;
+    ChartController* m_pWindowController;
     bool m_bInPaint;
+    OpenGLWindow* m_pOpenGLWindow;
 
     void adjustHighContrastMode();
 };
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index f65f540..ed0d24e 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1412,7 +1412,6 @@ void ChartModel::setWindow( const sal_uInt64 nWindowPtr )
 {
     void* pPtr = (void*)nWindowPtr;
     OpenGLWindow* pWindow = reinterpret_cast<OpenGLWindow*>(pPtr);
-    assert(pWindow);
     mpOpenGLWindow = pWindow;
 }
 
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index e43f90e..e5cfb2c 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -103,8 +103,8 @@ void RenderThread::renderFrame()
     if(!mpChart->mbValidContext)
         return;
 
-    mpChart->mrWindow.getContext().makeCurrent();
-    Size aSize = mpChart->mrWindow.GetSizePixel();
+    mpChart->mpWindow->getContext().makeCurrent();
+    Size aSize = mpChart->mpWindow->GetSizePixel();
     mpChart->mpRenderer->SetSize(aSize);
     if(mpChart->mbNeedsNewRender)
     {
@@ -121,7 +121,7 @@ void RenderThread::renderFrame()
     }
     mpChart->mpRenderer->ProcessUnrenderedShape(mpChart->mbNeedsNewRender);
     mpChart->mbNeedsNewRender = false;
-    mpChart->mrWindow.getContext().swapBuffers();
+    mpChart->mpWindow->getContext().swapBuffers();
 
 }
 
@@ -438,10 +438,10 @@ void RenderBenchMarkThread::execute()
 
 GL3DBarChart::GL3DBarChart(
     const css::uno::Reference<css::chart2::XChartType>& xChartType,
-    OpenGLWindow& rWindow) :
+    OpenGLWindow* pWindow) :
     mxChartType(xChartType),
     mpRenderer(new opengl3D::OpenGL3DRenderer()),
-    mrWindow(rWindow),
+    mpWindow(pWindow),
     mpCamera(NULL),
     mbValidContext(true),
     mpTextCache(new opengl3D::TextCache()),
@@ -492,9 +492,14 @@ GL3DBarChart::GL3DBarChart(
         osl_getSystemTime(&maDataUpdateStartTime);
         osl_getSystemTime(&maDataUpdateEndTime);
     }
-    Size aSize = mrWindow.GetSizePixel();
+    Size aSize;
+    if (mpWindow)
+    {
+        mpWindow->setRenderer(this);
+        Size aSize = mpWindow->GetSizePixel();
+    }
     mpRenderer->SetSize(aSize);
-    mrWindow.setRenderer(this);
+    mpWindow->setRenderer(this);
     mpRenderer->init();
 }
 
@@ -518,8 +523,8 @@ GL3DBarChart::~GL3DBarChart()
     if(mpRenderThread.is())
         mpRenderThread->join();
 
-    if(mbValidContext)
-        mrWindow.setRenderer(NULL);
+    if(mbValidContext && mpWindow)
+        mpWindow->setRenderer(NULL);
 }
 
 void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
@@ -741,10 +746,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
             mpRenderer->SetScrollSpeed((float)(BAR_SIZE_X + BAR_DISTANCE_X) / (float)miScrollRate);
             mpRenderer->SetScrollDistance((float)(BAR_SIZE_X + BAR_DISTANCE_X));
         }
-        Size aSize = mrWindow.GetSizePixel();
-        mrWindow.getContext().setWinSize(aSize);
+        Size aSize = mpWindow->GetSizePixel();
+        mpWindow->getContext().setWinSize(aSize);
         mpRenderThread = rtl::Reference<RenderThread>(new RenderBenchMarkThread(this));
-        mrWindow.getContext().resetCurrent();
+        mpWindow->getContext().resetCurrent();
         mpRenderThread->launch();
     }
     miDataUpdateCounter++;
@@ -758,10 +763,10 @@ void GL3DBarChart::update()
         return;
     if(mpRenderThread.is())
         mpRenderThread->join();
-    Size aSize = mrWindow.GetSizePixel();
-    mrWindow.getContext().setWinSize(aSize);
+    Size aSize = mpWindow->GetSizePixel();
+    mpWindow->getContext().setWinSize(aSize);
     mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
-    mrWindow.getContext().resetCurrent();
+    mpWindow->getContext().resetCurrent();
     mpRenderThread->launch();
 }
 
@@ -807,10 +812,10 @@ void GL3DBarChart::moveToDefault()
         mpRenderThread->join();
 
     osl::MutexGuard aGuard(maMutex);
-    Size aSize = mrWindow.GetSizePixel();
-    mrWindow.getContext().setWinSize(aSize);
+    Size aSize = mpWindow->GetSizePixel();
+    mpWindow->getContext().setWinSize(aSize);
     mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
-    mrWindow.getContext().resetCurrent();
+    mpWindow->getContext().resetCurrent();
     mpRenderThread->launch();
 
     /*
@@ -879,10 +884,10 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
     glm::vec3 aTargetPosition = rBarInfo.maPos;
     aTargetPosition.z += 240;
     aTargetPosition.y += BAR_SIZE_Y / 2.0f;
-    Size aSize = mrWindow.GetSizePixel();
-    mrWindow.getContext().setWinSize(aSize);
+    Size aSize = mpWindow->GetSizePixel();
+    mpWindow->getContext().setWinSize(aSize);
     mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, aTargetPosition, STEPS));
-    mrWindow.getContext().resetCurrent();
+    mpWindow->getContext().resetCurrent();
     mpRenderThread->launch();
 
     /*
@@ -969,11 +974,11 @@ void GL3DBarChart::moveToCorner()
 
     osl::MutexGuard aGuard(maMutex);
 
-    Size aSize = mrWindow.GetSizePixel();
-    mrWindow.getContext().setWinSize(aSize);
+    Size aSize = mpWindow->GetSizePixel();
+    mpWindow->getContext().setWinSize(aSize);
     mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition,
                 getCornerPosition(mnCornerId), STEPS));
-    mrWindow.getContext().resetCurrent();
+    mpWindow->getContext().resetCurrent();
     mpRenderThread->launch();
 
     // TODO: moggi: add to thread
@@ -1305,6 +1310,13 @@ IMPL_LINK_NOARG(GL3DBarChart, updateTimer)
     maTimer.Start();
     return 0;
 }
+
+void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
+{
+    if (mpWindow != pWindow)
+        mpWindow = pWindow;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index d256ac4..007b8ad 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -65,7 +65,7 @@ class GL3DBarChart : public GL3DPlotterBase, public IRenderer
 public:
     GL3DBarChart(
         const css::uno::Reference<css::chart2::XChartType>& xChartType,
-        OpenGLWindow& rContext);
+        OpenGLWindow* pContext);
 
     virtual ~GL3DBarChart();
 
@@ -81,6 +81,8 @@ public:
     virtual void scroll(long nDelta) SAL_OVERRIDE;
     virtual void contextDestroyed() SAL_OVERRIDE;
 
+    void setOpenGLWindow(OpenGLWindow* pWindow);
+
 private:
 
     void moveToCorner();
@@ -110,7 +112,7 @@ private:
     boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
 
     boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
-    OpenGLWindow& mrWindow;
+    OpenGLWindow* mpWindow;
 
     opengl3D::Camera* mpCamera;
     bool mbValidContext;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 7f583f7..dff0e12 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3191,7 +3191,13 @@ void ChartView::createShapes3D()
 
     if (!m_pGL3DPlotter)
     {
-        m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, *pWindow));
+        m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, pWindow));
+    }
+    else
+    {
+        GL3DBarChart* pChart = dynamic_cast<GL3DBarChart*>(m_pGL3DPlotter.get());
+        if (pChart)
+            pChart->setOpenGLWindow(pWindow);
     }
 
     uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index fa9dbfd..0a7703d7 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -544,22 +544,6 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
     ScDocument& rScDoc   = pScDocSh->GetDocument();
     bool bUndo (rScDoc.IsUndoEnabled());
 
-    Window* pParentWindow = rData.GetActiveWin();
-    OpenGLWindow* pChildWindow = new OpenGLWindow(pParentWindow);
-    Size aWindowSize = pChildWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
-    pChildWindow->SetSizePixel(aWindowSize);
-    pChildWindow->Show();
-    uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( xChartModel, uno::UNO_QUERY_THROW );
-    sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pChildWindow);
-    x3DWindowProvider->setWindow(nWindowPtr);
-    ScGridWindow* pGridWindow = dynamic_cast<ScGridWindow*>(pParentWindow);
-    if(pGridWindow)
-    {
-        pGridWindow->AddChildWindow(pChildWindow);
-    }
-    else
-        SAL_WARN("sc", "not a grid window. You are in serious trouble");
-
     if( pReqArgs )
     {
         const SfxPoolItem* pItem;
@@ -634,7 +618,6 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
         // get chart position (from window size and data range)
         aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange );
     }
-    pChildWindow->SetPosPixel(pChildWindow->LogicToPixel(aStart, MapMode(MAP_100TH_MM)));
 
     Rectangle aRect (aStart, aSize);
     SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect);
@@ -729,7 +712,6 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
                     sal_Int16 nDialogRet = xDialog->execute();
                     if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL )
                     {
-                        pGridWindow->DeleteChildWindow(pChildWindow);
                         // leave OLE inplace mode and unmark
                         OSL_ASSERT( pViewShell );
                         OSL_ASSERT( pView );


More information about the Libreoffice-commits mailing list