[Libreoffice-commits] core.git: 8 commits - chart2/Library_chartopengl.mk chart2/Module_chart2.mk chart2/opengl chart2/Package_opengl.mk chart2/source include/oox include/sal include/vcl include/xmloff vcl/Library_vclopengl.mk vcl/Module_vcl.mk vcl/Package_opengl.mk vcl/source xmloff/inc xmloff/Library_xo.mk xmloff/source

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Mar 17 00:15:54 PDT 2014


 chart2/Library_chartopengl.mk                           |   22 
 chart2/Module_chart2.mk                                 |    1 
 chart2/Package_opengl.mk                                |   25 
 chart2/opengl/backgroundFragmentShader.glsl             |   17 
 chart2/opengl/backgroundVertexShader.glsl               |   21 
 chart2/opengl/commonFragmentShader.glsl                 |   17 
 chart2/opengl/commonVertexShader.glsl                   |   21 
 chart2/opengl/debugFragmentShader.glsl                  |   17 
 chart2/opengl/debugVertexShader.glsl                    |   19 
 chart2/opengl/symbolFragmentShader.glsl                 |  101 
 chart2/opengl/symbolVertexShader.glsl                   |   23 
 chart2/opengl/textFragmentShader.glsl                   |   17 
 chart2/opengl/textVertexShader.glsl                     |   20 
 chart2/source/controller/dialogs/DialogModel.cxx        |    5 
 chart2/source/controller/dialogs/DialogModel.hxx        |    1 
 chart2/source/controller/dialogs/tp_DataSource.cxx      |    2 
 chart2/source/view/inc/DummyXShape.hxx                  |    2 
 chart2/source/view/main/DummyXShape.cxx                 |    3 
 chart2/source/view/main/OpenGLRender.cxx                | 1487 ++++++++++++++
 chart2/source/view/main/OpenGLRender.hxx                |  210 +
 include/oox/drawingml/chart/typegroupmodel.hxx          |    6 
 include/sal/log-areas.dox                               |    1 
 include/vcl/OpenGLContext.hxx                           |   82 
 include/vcl/OpenGLRender.hxx                            |  304 --
 include/xmloff/SchXMLImportHelper.hxx                   |    2 
 include/xmloff/xmltoken.hxx                             |    1 
 vcl/Library_vclopengl.mk                                |    1 
 vcl/Module_vcl.mk                                       |    1 
 vcl/Package_opengl.mk                                   |   25 
 vcl/source/opengl/OpenGLContext.cxx                     |  234 +-
 vcl/source/opengl/OpenGLRender.cxx                      | 1687 ----------------
 vcl/source/opengl/shaders/backgroundFragmentShader.glsl |   17 
 vcl/source/opengl/shaders/backgroundVertexShader.glsl   |   21 
 vcl/source/opengl/shaders/commonFragmentShader.glsl     |   17 
 vcl/source/opengl/shaders/commonVertexShader.glsl       |   21 
 vcl/source/opengl/shaders/debugFragmentShader.glsl      |   17 
 vcl/source/opengl/shaders/debugVertexShader.glsl        |   19 
 vcl/source/opengl/shaders/symbolFragmentShader.glsl     |  101 
 vcl/source/opengl/shaders/symbolVertexShader.glsl       |   23 
 vcl/source/opengl/shaders/textFragmentShader.glsl       |   17 
 vcl/source/opengl/shaders/textVertexShader.glsl         |   20 
 xmloff/Library_xo.mk                                    |    1 
 xmloff/inc/SchXMLImport.hxx                             |    9 
 xmloff/source/chart/SchXMLExport.cxx                    |   25 
 xmloff/source/chart/SchXMLImport.cxx                    |   20 
 xmloff/source/chart/SchXMLPropertyMappingContext.cxx    |  111 +
 xmloff/source/chart/SchXMLPropertyMappingContext.hxx    |   50 
 xmloff/source/chart/SchXMLSeries2Context.cxx            |    6 
 xmloff/source/core/xmlexp.cxx                           |   26 
 xmloff/source/core/xmltoken.cxx                         |    1 
 50 files changed, 2510 insertions(+), 2387 deletions(-)

New commits:
commit 5d42bbdcf8c125c8547e197d85fae1c1825e05db
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Mar 17 08:11:38 2014 +0100

    windows fixes for opengl
    
    Change-Id: I2ee3bcf9f87b46c14af26adb82eabd43d9164adb

diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx
index 43802c9..4067feb 100644
--- a/include/vcl/OpenGLContext.hxx
+++ b/include/vcl/OpenGLContext.hxx
@@ -21,6 +21,8 @@
 #  include "postwin.h"
 #endif
 
+#include <GL/glew.h>
+
 #if defined( _WIN32 )
 #include <GL/glext.h>
 #include <GL/wglext.h>
@@ -32,8 +34,6 @@
 #include <GL/glxext.h>
 #endif
 
-#include <GL/glew.h>
-
 #include <vcl/vclopengl_dllapi.hxx>
 #include <boost/scoped_ptr.hpp>
 #include <vcl/window.hxx>
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 100484f..66e16a5 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -48,7 +48,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
     }
 }
 
-int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd)
+int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd, GLWindow glWin)
 {
     PIXELFORMATDESCRIPTOR  pfd = inPfd;
     int  pfmt;
@@ -126,11 +126,12 @@ bool WGLisExtensionSupported(const char *extension)
     }
 }
 
-bool InitMultisample(PIXELFORMATDESCRIPTOR pfd)
+bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat)
 {
     HWND hWnd = NULL;
+    GLWindow glWin;
     //create a temp windwo to check whether support multi-sample, if support, get the format
-    if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0)
+    if (InitTempWindow(&hWnd, 1, 1, pfd, glWin) < 0)
     {
         SAL_WARN("vcl.opengl", "Can't create temp window to test");
         return false;
@@ -139,7 +140,6 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd)
     // See If The String Exists In WGL!
     if (!WGLisExtensionSupported("WGL_ARB_multisample"))
     {
-        mbArbMultisampleSupported = false;
         SAL_WARN("vcl.opengl", "Device doesn't support multi sample");
         return false;
     }
@@ -147,7 +147,6 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd)
     PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
     if (!wglChoosePixelFormatARB)
     {
-        mbArbMultisampleSupported = false;
         return false;
     }
     // Get Our Current Device Context
@@ -176,38 +175,42 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd)
         WGL_SAMPLES_ARB,8,
         0,0
     };
+
+    bool bArbMultisampleSupported = true;
+
     // First We Check To See If We Can Get A Pixel Format For 4 Samples
     valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
     // If We Returned True, And Our Format Count Is Greater Than 1
     if (valid && numFormats >= 1)
     {
-        mbArbMultisampleSupported = true;
-        m_iArbMultisampleFormat = pixelFormat;
+        bArbMultisampleSupported = true;
+        rPixelFormat = pixelFormat;
         wglMakeCurrent(NULL, NULL);
         wglDeleteContext(glWin.hRC);
         ReleaseDC(hWnd, glWin.hDC);
         DestroyWindow(hWnd);
-        return mbArbMultisampleSupported;
+        return bArbMultisampleSupported;
     }
     // Our Pixel Format With 4 Samples Failed, Test For 2 Samples
     iAttributes[19] = 2;
     valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
     if (valid && numFormats >= 1)
     {
-        mbArbMultisampleSupported = true;
-        m_iArbMultisampleFormat = pixelFormat;
+        bArbMultisampleSupported = true;
+        rPixelFormat = pixelFormat;
         wglMakeCurrent(NULL, NULL);
         wglDeleteContext(glWin.hRC);
         ReleaseDC(hWnd, glWin.hDC);
         DestroyWindow(hWnd);
-        return mbArbMultisampleSupported;
+        return bArbMultisampleSupported;
     }
     // Return The Valid Format
     wglMakeCurrent(NULL, NULL);
     wglDeleteContext(glWin.hRC);
     ReleaseDC(hWnd, glWin.hDC);
     DestroyWindow(hWnd);
-    return  mbArbMultisampleSupported;
+
+    return  bArbMultisampleSupported;
 }
 #endif
 
@@ -363,10 +366,9 @@ bool OpenGLContext::init()
 
     //  we must check whether can set the MSAA
     int WindowPix;
-    rGLRender.InitMultisample(PixelFormatFront);
-    if (rGLRender.GetMSAASupport())
+    bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix);
+    if (bMultiSampleSupport)
     {
-        WindowPix = rGLRender.GetMSAAFormat();
     }
     else
     {
commit 64950157029e1b35434b634a6f275ba1ad305abe
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 17 05:22:33 2014 +0100

    no need for OpenGLRender in OpenGLContext anymore
    
    Change-Id: I8506bcea49792cd1ef6ca451ca515b4669326c29

diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index f28af5d..72c2139 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1151,6 +1151,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
     SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
     setName("com.sun.star.chart2.shapes");
     m_aGLContext.init();
+    m_GLRender.InitOpenGL(m_aGLContext.getOpenGLWindow());
 }
 
 void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition )
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 6f86dee..ede3353 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -341,6 +341,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
     glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse);
     glEnable(GL_LIGHT0);
     glEnable(GL_NORMALIZE);
+
     return 0;
 }
 
diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx
index 4073334..43802c9 100644
--- a/include/vcl/OpenGLContext.hxx
+++ b/include/vcl/OpenGLContext.hxx
@@ -99,6 +99,7 @@ public:
 
     bool init();
     void setWinSize(const Size& rSize);
+    GLWindow& getOpenGLWindow();
 
 private:
     SAL_DLLPRIVATE bool initWindow();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 767a0e7..100484f 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -437,29 +437,6 @@ bool OpenGLContext::init()
 
 #endif
 
-    glEnable(GL_TEXTURE_2D);
-    glEnable(GL_CULL_FACE);
-    glCullFace(GL_BACK);
-    // Enable depth test
-    glEnable(GL_DEPTH_TEST);
-    // Accept fragment if it closer to the camera than the former one
-    glDepthFunc(GL_LESS);
-
-#if defined( WNT )
-    SwapBuffers(m_aGLWin.hDC);
-    glFlush();
-#elif defined( MACOSX )
-
-#elif defined( UNX )
-    glXSwapBuffers(m_aGLWin.dpy, m_aGLWin.win);
-#endif
-    glEnable(GL_LIGHTING);
-    GLfloat light_direction[] = { 0.0 , 0.0 , 1.0 };
-    GLfloat materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0};
-    glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction);
-    glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse);
-    glEnable(GL_LIGHT0);
-    glEnable(GL_NORMALIZE);
     SAL_INFO("vcl.opengl", "OpenGLContext::init----end");
     return true;
 }
@@ -470,6 +447,11 @@ void OpenGLContext::setWinSize(const Size& rSize)
     m_pChildWindow->SetSizePixel(rSize);
 }
 
+GLWindow& OpenGLContext::getOpenGLWindow()
+{
+    return m_aGLWin;
+}
+
 #if defined( WNT )
 
 bool OpenGLContext::initWindow()
commit 3aa298e010ebee976a889a0094f14f09a7151c3a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 17 05:13:12 2014 +0100

    move the windows multisample code to OpenGLContext
    
    Change-Id: I531d058ff00b3b6eaf2bf7c889589058b1be7bd0

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index f97f506..6f86dee 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -771,207 +771,6 @@ void OpenGLRender::SetLine2DWidth(int width)
     m_fLineWidth = std::max((float)width / OPENGL_SCALE_VALUE, 0.001f);
 }
 
-#if defined( _WIN32 )
-static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
-    switch (message)
-    {
-    case WM_CREATE:
-        return 0;
-    case WM_CLOSE:
-        PostQuitMessage(0);
-        return 0;
-    case WM_DESTROY:
-        return 0;
-    case WM_KEYDOWN:
-        switch(wParam)
-        {
-        case VK_ESCAPE:
-            PostQuitMessage(0);
-            return 0;
-
-        case VK_SPACE:
-            break;
-        }
-    default:
-        return DefWindowProc(hwnd, message, wParam, lParam);
-    }
-}
-
-bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
-{
-    HWND hWnd = NULL;
-    //create a temp windwo to check whether support multi-sample, if support, get the format
-    if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0)
-    {
-        SAL_WARN("chart2.opengl", "Can't create temp window to test");
-        return false;
-    }
-
-    // See If The String Exists In WGL!
-    if (!WGLisExtensionSupported("WGL_ARB_multisample"))
-    {
-        mbArbMultisampleSupported = false;
-        SAL_WARN("chart2.opengl", "Device doesn't support multi sample");
-        return false;
-    }
-    // Get Our Pixel Format
-    PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
-    if (!wglChoosePixelFormatARB)
-    {
-        mbArbMultisampleSupported = false;
-        return false;
-    }
-    // Get Our Current Device Context
-    HDC hDC = GetDC(hWnd);
-
-    int pixelFormat;
-    int valid;
-    UINT    numFormats;
-    float   fAttributes[] = {0,0};
-    // These Attributes Are The Bits We Want To Test For In Our Sample
-    // Everything Is Pretty Standard, The Only One We Want To
-    // Really Focus On Is The SAMPLE BUFFERS ARB And WGL SAMPLES
-    // These Two Are Going To Do The Main Testing For Whether Or Not
-    // We Support Multisampling On This Hardware.
-    int iAttributes[] =
-    {
-        WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
-        WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
-        WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
-        WGL_COLOR_BITS_ARB,24,
-        WGL_ALPHA_BITS_ARB,8,
-        WGL_DEPTH_BITS_ARB,16,
-        WGL_STENCIL_BITS_ARB,0,
-        WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
-        WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
-        WGL_SAMPLES_ARB,8,
-        0,0
-    };
-    // First We Check To See If We Can Get A Pixel Format For 4 Samples
-    valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
-    // If We Returned True, And Our Format Count Is Greater Than 1
-    if (valid && numFormats >= 1)
-    {
-        mbArbMultisampleSupported = true;
-        m_iArbMultisampleFormat = pixelFormat;
-        wglMakeCurrent(NULL, NULL);
-        wglDeleteContext(glWin.hRC);
-        ReleaseDC(hWnd, glWin.hDC);
-        DestroyWindow(hWnd);
-        return mbArbMultisampleSupported;
-    }
-    // Our Pixel Format With 4 Samples Failed, Test For 2 Samples
-    iAttributes[19] = 2;
-    valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
-    if (valid && numFormats >= 1)
-    {
-        mbArbMultisampleSupported = true;
-        m_iArbMultisampleFormat = pixelFormat;
-        wglMakeCurrent(NULL, NULL);
-        wglDeleteContext(glWin.hRC);
-        ReleaseDC(hWnd, glWin.hDC);
-        DestroyWindow(hWnd);
-        return mbArbMultisampleSupported;
-    }
-    // Return The Valid Format
-    wglMakeCurrent(NULL, NULL);
-    wglDeleteContext(glWin.hRC);
-    ReleaseDC(hWnd, glWin.hDC);
-    DestroyWindow(hWnd);
-    return  mbArbMultisampleSupported;
-}
-
-bool OpenGLRender::GetMSAASupport()
-{
-    return mbArbMultisampleSupported;
-}
-
-int OpenGLRender::GetMSAAFormat()
-{
-    return m_iArbMultisampleFormat;
-}
-
-//TODO: moggi: why the hell do we need another implementation here?
-int OpenGLRender::InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd)
-{
-    PIXELFORMATDESCRIPTOR  pfd = inPfd;
-    int  pfmt;
-    int ret;
-    WNDCLASS wc;
-    wc.style = 0;
-    wc.lpfnWndProc = WndProc;
-    wc.cbClsExtra = wc.cbWndExtra = 0;
-    wc.hInstance = NULL;
-    wc.hIcon = NULL;
-    wc.hCursor = NULL;
-    wc.hbrBackground = NULL;
-    wc.lpszMenuName = NULL;
-    wc.lpszClassName = (LPCSTR)"GLRenderer";
-    RegisterClass(&wc);
-    *hwnd = CreateWindow(wc.lpszClassName, NULL, WS_DISABLED, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL);
-    glWin.hDC = GetDC(*hwnd);
-    pfmt = ChoosePixelFormat(glWin.hDC, &pfd);
-    if (!pfmt)
-    {
-        return -1;
-    }
-    ret = SetPixelFormat(glWin.hDC, pfmt, &pfd);
-    if(!ret)
-    {
-        return -1;
-    }
-    glWin.hRC = wglCreateContext(glWin.hDC);
-    if(!(glWin.hRC))
-    {
-        return -1;
-    }
-    ret = wglMakeCurrent(glWin.hDC, glWin.hRC);
-    if(!ret)
-    {
-        return -1;
-    }
-    return 0;
-}
-
-bool OpenGLRender::WGLisExtensionSupported(const char *extension)
-{
-    const size_t extlen = strlen(extension);
-    const char *supported = NULL;
-
-    // Try To Use wglGetExtensionStringARB On Current DC, If Possible
-    PROC wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB");
-
-    if (wglGetExtString)
-        supported = ((char*(__stdcall*)(HDC))wglGetExtString)(wglGetCurrentDC());
-    // If That Failed, Try Standard Opengl Extensions String
-    if (supported == NULL)
-        supported = (char*)glGetString(GL_EXTENSIONS);
-    // If That Failed Too, Must Be No Extensions Supported
-    if (supported == NULL)
-        return 0;
-
-    // Begin Examination At Start Of String, Increment By 1 On False Match
-    for (const char* p = supported; ; p++)
-    {
-        // Advance p Up To The Next Possible Match
-        p = strstr(p, extension);
-
-        if (p == NULL)
-            return 0; // No Match
-
-        // Make Sure That Match Is At The Start Of The String Or That
-        // The Previous Char Is A Space, Or Else We Could Accidentally
-        // Match "wglFunkywglExtension" With "wglExtension"
-
-        // Also, Make Sure That The Following Character Is Space Or NULL
-        // Or Else "wglExtensionTwo" Might Match "wglExtension"
-        if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' '))
-            return 1; // Match
-    }
-}
-#endif
-
 void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha)
 {
     sal_uInt8 r = (color & 0x00FF0000) >> 16;
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 8140bf9..725e32e 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -79,11 +79,6 @@ public:
     void SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha);
     void SetLine2DWidth(int width);
     BitmapEx GetAsBitmap();
-#if defined( _WIN32 )
-    bool InitMultisample(PIXELFORMATDESCRIPTOR pfd);
-    bool GetMSAASupport();
-    int GetMSAAFormat();
-#endif
     void SetColor(sal_uInt32 color, sal_uInt8 nAlpha);
     int Bubble2DShapePoint(float x, float y, float directionX, float directionY);
     int RenderBubble2FBO(int wholeFlag);
@@ -117,10 +112,6 @@ private:
     int CreateTextureObj(int width, int height);
     int CreateRenderObj(int width, int height);
     int CreateFrameBufferObj();
-#if defined( _WIN32 )
-    int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd);
-    bool WGLisExtensionSupported(const char *extension);
-#endif
     int CreateMultiSampleFrameBufObj();
     int Create2DCircle(int detail);
 
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index a41a058..767a0e7 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -21,6 +21,196 @@ OpenGLContext::~OpenGLContext()
 {
 }
 
+#if defined( _WIN32 )
+static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    switch (message)
+    {
+    case WM_CREATE:
+        return 0;
+    case WM_CLOSE:
+        PostQuitMessage(0);
+        return 0;
+    case WM_DESTROY:
+        return 0;
+    case WM_KEYDOWN:
+        switch(wParam)
+        {
+        case VK_ESCAPE:
+            PostQuitMessage(0);
+            return 0;
+
+        case VK_SPACE:
+            break;
+        }
+    default:
+        return DefWindowProc(hwnd, message, wParam, lParam);
+    }
+}
+
+int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd)
+{
+    PIXELFORMATDESCRIPTOR  pfd = inPfd;
+    int  pfmt;
+    int ret;
+    WNDCLASS wc;
+    wc.style = 0;
+    wc.lpfnWndProc = WndProc;
+    wc.cbClsExtra = wc.cbWndExtra = 0;
+    wc.hInstance = NULL;
+    wc.hIcon = NULL;
+    wc.hCursor = NULL;
+    wc.hbrBackground = NULL;
+    wc.lpszMenuName = NULL;
+    wc.lpszClassName = (LPCSTR)"GLRenderer";
+    RegisterClass(&wc);
+    *hwnd = CreateWindow(wc.lpszClassName, NULL, WS_DISABLED, 0, 0, width, height, NULL, NULL, wc.hInstance, NULL);
+    glWin.hDC = GetDC(*hwnd);
+    pfmt = ChoosePixelFormat(glWin.hDC, &pfd);
+    if (!pfmt)
+    {
+        return -1;
+    }
+    ret = SetPixelFormat(glWin.hDC, pfmt, &pfd);
+    if(!ret)
+    {
+        return -1;
+    }
+    glWin.hRC = wglCreateContext(glWin.hDC);
+    if(!(glWin.hRC))
+    {
+        return -1;
+    }
+    ret = wglMakeCurrent(glWin.hDC, glWin.hRC);
+    if(!ret)
+    {
+        return -1;
+    }
+    return 0;
+}
+
+bool WGLisExtensionSupported(const char *extension)
+{
+    const size_t extlen = strlen(extension);
+    const char *supported = NULL;
+
+    // Try To Use wglGetExtensionStringARB On Current DC, If Possible
+    PROC wglGetExtString = wglGetProcAddress("wglGetExtensionsStringARB");
+
+    if (wglGetExtString)
+        supported = ((char*(__stdcall*)(HDC))wglGetExtString)(wglGetCurrentDC());
+    // If That Failed, Try Standard Opengl Extensions String
+    if (supported == NULL)
+        supported = (char*)glGetString(GL_EXTENSIONS);
+    // If That Failed Too, Must Be No Extensions Supported
+    if (supported == NULL)
+        return 0;
+
+    // Begin Examination At Start Of String, Increment By 1 On False Match
+    for (const char* p = supported; ; p++)
+    {
+        // Advance p Up To The Next Possible Match
+        p = strstr(p, extension);
+
+        if (p == NULL)
+            return 0; // No Match
+
+        // Make Sure That Match Is At The Start Of The String Or That
+        // The Previous Char Is A Space, Or Else We Could Accidentally
+        // Match "wglFunkywglExtension" With "wglExtension"
+
+        // Also, Make Sure That The Following Character Is Space Or NULL
+        // Or Else "wglExtensionTwo" Might Match "wglExtension"
+        if ((p==supported || p[-1]==' ') && (p[extlen]=='\0' || p[extlen]==' '))
+            return 1; // Match
+    }
+}
+
+bool InitMultisample(PIXELFORMATDESCRIPTOR pfd)
+{
+    HWND hWnd = NULL;
+    //create a temp windwo to check whether support multi-sample, if support, get the format
+    if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0)
+    {
+        SAL_WARN("vcl.opengl", "Can't create temp window to test");
+        return false;
+    }
+
+    // See If The String Exists In WGL!
+    if (!WGLisExtensionSupported("WGL_ARB_multisample"))
+    {
+        mbArbMultisampleSupported = false;
+        SAL_WARN("vcl.opengl", "Device doesn't support multi sample");
+        return false;
+    }
+    // Get Our Pixel Format
+    PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
+    if (!wglChoosePixelFormatARB)
+    {
+        mbArbMultisampleSupported = false;
+        return false;
+    }
+    // Get Our Current Device Context
+    HDC hDC = GetDC(hWnd);
+
+    int pixelFormat;
+    int valid;
+    UINT    numFormats;
+    float   fAttributes[] = {0,0};
+    // These Attributes Are The Bits We Want To Test For In Our Sample
+    // Everything Is Pretty Standard, The Only One We Want To
+    // Really Focus On Is The SAMPLE BUFFERS ARB And WGL SAMPLES
+    // These Two Are Going To Do The Main Testing For Whether Or Not
+    // We Support Multisampling On This Hardware.
+    int iAttributes[] =
+    {
+        WGL_DRAW_TO_WINDOW_ARB,GL_TRUE,
+        WGL_SUPPORT_OPENGL_ARB,GL_TRUE,
+        WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
+        WGL_COLOR_BITS_ARB,24,
+        WGL_ALPHA_BITS_ARB,8,
+        WGL_DEPTH_BITS_ARB,16,
+        WGL_STENCIL_BITS_ARB,0,
+        WGL_DOUBLE_BUFFER_ARB,GL_TRUE,
+        WGL_SAMPLE_BUFFERS_ARB,GL_TRUE,
+        WGL_SAMPLES_ARB,8,
+        0,0
+    };
+    // First We Check To See If We Can Get A Pixel Format For 4 Samples
+    valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
+    // If We Returned True, And Our Format Count Is Greater Than 1
+    if (valid && numFormats >= 1)
+    {
+        mbArbMultisampleSupported = true;
+        m_iArbMultisampleFormat = pixelFormat;
+        wglMakeCurrent(NULL, NULL);
+        wglDeleteContext(glWin.hRC);
+        ReleaseDC(hWnd, glWin.hDC);
+        DestroyWindow(hWnd);
+        return mbArbMultisampleSupported;
+    }
+    // Our Pixel Format With 4 Samples Failed, Test For 2 Samples
+    iAttributes[19] = 2;
+    valid = wglChoosePixelFormatARB(hDC, iAttributes, fAttributes, 1, &pixelFormat, &numFormats);
+    if (valid && numFormats >= 1)
+    {
+        mbArbMultisampleSupported = true;
+        m_iArbMultisampleFormat = pixelFormat;
+        wglMakeCurrent(NULL, NULL);
+        wglDeleteContext(glWin.hRC);
+        ReleaseDC(hWnd, glWin.hDC);
+        DestroyWindow(hWnd);
+        return mbArbMultisampleSupported;
+    }
+    // Return The Valid Format
+    wglMakeCurrent(NULL, NULL);
+    wglDeleteContext(glWin.hRC);
+    ReleaseDC(hWnd, glWin.hDC);
+    DestroyWindow(hWnd);
+    return  mbArbMultisampleSupported;
+}
+#endif
+
 #ifdef DBG_UTIL
 
 namespace {
commit 40ea5e9dd0eff66728d1d2d7aac41349a14de594
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon Mar 17 05:06:00 2014 +0100

    Revert "Move OpenGLRender to vcl"
    
    This reverts commit 04b70c682e2cdc52b144961a83d05fd203de6884.
    
    The OpenGLRender is not abstract enough for vcl. Leave it in chart2.
    
    Conflicts:
    	chart2/source/view/inc/DummyXShape.hxx
    	chart2/source/view/main/OpenGLRender.hxx
    	vcl/Library_vclopengl.mk
    
    Change-Id: I5392c8ee34462ff49059126ca2284d8ebe1eb379

diff --git a/chart2/Library_chartopengl.mk b/chart2/Library_chartopengl.mk
index 5ca68bd..7587196 100644
--- a/chart2/Library_chartopengl.mk
+++ b/chart2/Library_chartopengl.mk
@@ -54,6 +54,26 @@ $(eval $(call gb_Library_use_libraries,chartopengl,\
 $(eval $(call gb_Library_add_exception_objects,chartopengl,\
     chart2/source/view/main/OpenglShapeFactory \
     chart2/source/view/main/DummyXShape \
+    chart2/source/view/main/OpenGLRender \
 ))
-
+ 
+ifeq ($(strip $(OS)),WNT)
+$(eval $(call gb_Library_use_system_win32_libs,chartopengl,\
+	opengl32 \
+	gdi32 \
+	glu32 \
+))
+else ifeq ($(OS),MACOSX)
+$(eval $(call gb_Library_use_system_darwin_frameworks,chartopengl,\
+	OpenGL \
+))
+else ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_libs,chartopengl,\
+	-ldl \
+	-lGL \
+	-lGLU \
+	-lX11 \
+))
+endif
+ 
 # vim: set noet sw=4 ts=4:
diff --git a/chart2/Module_chart2.mk b/chart2/Module_chart2.mk
index 6c4d193..611e699 100644
--- a/chart2/Module_chart2.mk
+++ b/chart2/Module_chart2.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_Module_add_targets,chart2,\
     Library_chartcore \
 	$(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \
 		Library_chartopengl \
+		Package_opengl \
 	) \
 ))
 
diff --git a/vcl/Package_opengl.mk b/chart2/Package_opengl.mk
similarity index 78%
rename from vcl/Package_opengl.mk
rename to chart2/Package_opengl.mk
index 6eb2463..ef33ebb 100644
--- a/vcl/Package_opengl.mk
+++ b/chart2/Package_opengl.mk
@@ -7,9 +7,9 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Package_Package,vcl_opengl_shader,$(SRCDIR)/vcl/source/opengl/shaders))
+$(eval $(call gb_Package_Package,chart2_opengl_shader,$(SRCDIR)/chart2/opengl))
 
-$(eval $(call gb_Package_add_files,vcl_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\
+$(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_BIN_FOLDER)/opengl,\
 	backgroundFragmentShader.glsl \
 	backgroundVertexShader.glsl \
 	commonFragmentShader.glsl \
diff --git a/vcl/source/opengl/shaders/backgroundFragmentShader.glsl b/chart2/opengl/backgroundFragmentShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/backgroundFragmentShader.glsl
rename to chart2/opengl/backgroundFragmentShader.glsl
diff --git a/vcl/source/opengl/shaders/backgroundVertexShader.glsl b/chart2/opengl/backgroundVertexShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/backgroundVertexShader.glsl
rename to chart2/opengl/backgroundVertexShader.glsl
diff --git a/vcl/source/opengl/shaders/commonFragmentShader.glsl b/chart2/opengl/commonFragmentShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/commonFragmentShader.glsl
rename to chart2/opengl/commonFragmentShader.glsl
diff --git a/vcl/source/opengl/shaders/commonVertexShader.glsl b/chart2/opengl/commonVertexShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/commonVertexShader.glsl
rename to chart2/opengl/commonVertexShader.glsl
diff --git a/vcl/source/opengl/shaders/debugFragmentShader.glsl b/chart2/opengl/debugFragmentShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/debugFragmentShader.glsl
rename to chart2/opengl/debugFragmentShader.glsl
diff --git a/vcl/source/opengl/shaders/debugVertexShader.glsl b/chart2/opengl/debugVertexShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/debugVertexShader.glsl
rename to chart2/opengl/debugVertexShader.glsl
diff --git a/vcl/source/opengl/shaders/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/symbolFragmentShader.glsl
rename to chart2/opengl/symbolFragmentShader.glsl
diff --git a/vcl/source/opengl/shaders/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/symbolVertexShader.glsl
rename to chart2/opengl/symbolVertexShader.glsl
diff --git a/vcl/source/opengl/shaders/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/textFragmentShader.glsl
rename to chart2/opengl/textFragmentShader.glsl
diff --git a/vcl/source/opengl/shaders/textVertexShader.glsl b/chart2/opengl/textVertexShader.glsl
similarity index 100%
rename from vcl/source/opengl/shaders/textVertexShader.glsl
rename to chart2/opengl/textVertexShader.glsl
diff --git a/chart2/source/view/inc/DummyXShape.hxx b/chart2/source/view/inc/DummyXShape.hxx
index d7e137d..032651f 100644
--- a/chart2/source/view/inc/DummyXShape.hxx
+++ b/chart2/source/view/inc/DummyXShape.hxx
@@ -12,8 +12,8 @@
 
 #include <cppuhelper/implbase6.hxx>
 
-#include <vcl/OpenGLRender.hxx>
 #include <vcl/OpenGLContext.hxx>
+#include "OpenGLRender.hxx"
 
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/drawing/XShapes.hpp>
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 0416ea9..f28af5d 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1150,7 +1150,7 @@ DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
 {
     SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
     setName("com.sun.star.chart2.shapes");
-    m_aGLContext.init(m_GLRender);
+    m_aGLContext.init();
 }
 
 void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition )
diff --git a/vcl/source/opengl/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
similarity index 96%
rename from vcl/source/opengl/OpenGLRender.cxx
rename to chart2/source/view/main/OpenGLRender.cxx
index 5a88e7a..f97f506 100755
--- a/vcl/source/opengl/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -9,7 +9,7 @@
 
 #include <GL/glew.h>
 #include <vector>
-#include <vcl/OpenGLRender.hxx>
+#include "OpenGLRender.hxx"
 #include <vcl/bmpacc.hxx>
 #include <vcl/graph.hxx>
 #include <com/sun/star/awt/XBitmap.hpp>
@@ -73,9 +73,9 @@ int static checkGLError(const char *file, int line)
         const GLubyte* sError = gluErrorString(glErr);
 
         if (sError)
-            SAL_WARN("vcl.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line);
+            SAL_WARN("chart2.opengl", "GL Error #" << glErr << "(" << gluErrorString(glErr) << ") " << " in File " << file << " at line: " << line);
         else
-            SAL_WARN("vcl.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line);
+            SAL_WARN("chart2.opengl", "GL Error #" << glErr << " (no message available)" << " in File " << file << " at line: " << line);
 
         retCode = -1;
         return retCode;
@@ -90,7 +90,7 @@ static bool bGlewInit = false;
 #define CHECK_GL_FRAME_BUFFER_STATUS() \
     status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\
     if( status != GL_FRAMEBUFFER_COMPLETE ) {\
-        SAL_WARN("vcl.opengl", "OpenGL error: " << status );\
+        SAL_WARN("chart2.opengl", "OpenGL error: " << status );\
         return -1;\
     }
 
@@ -125,7 +125,7 @@ OString loadShader(const OUString& rFilename)
     }
     else
     {
-        SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL);
+        SAL_WARN("chart2.opengl", "could not load the file: " << aFileURL);
     }
 
     return OString();
@@ -158,10 +158,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
             std::vector<char> VertexShaderErrorMessage(InfoLogLength+1);
             glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
             VertexShaderErrorMessage.push_back('\0');
-            SAL_WARN("vcl.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]);
+            SAL_WARN("chart2.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]);
         }
         else
-            SAL_WARN("vcl.opengl", "vertex shader compile failed without error log");
+            SAL_WARN("chart2.opengl", "vertex shader compile failed without error log");
 
         return 0;
     }
@@ -182,10 +182,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
             std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1);
             glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
             FragmentShaderErrorMessage.push_back('\0');
-            SAL_WARN("vcl.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]);
+            SAL_WARN("chart2.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]);
         }
         else
-            SAL_WARN("vcl.opengl", "fragment shader compile failed without error log");
+            SAL_WARN("chart2.opengl", "fragment shader compile failed without error log");
 
 
         return 0;
@@ -207,10 +207,10 @@ GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString
             std::vector<char> ProgramErrorMessage(InfoLogLength+1);
             glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
             ProgramErrorMessage.push_back('\0');
-            SAL_WARN("vcl.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]);
+            SAL_WARN("chart2.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]);
         }
         else
-            SAL_WARN("vcl.opengl", "shader program link failed without error log");
+            SAL_WARN("chart2.opengl", "shader program link failed without error log");
 
         return 0;
     }
@@ -240,7 +240,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
         glewExperimental = GL_TRUE;
         if (glewInit() != GLEW_OK)
         {
-            SAL_WARN("vcl.opengl", "Failed to initialize GLEW");
+            SAL_WARN("chart2.opengl", "Failed to initialize GLEW");
             return -1;
         }
         else
@@ -250,7 +250,7 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
     // These guys don't just check support but setup the vtables.
     if (glewIsSupported("framebuffer_object") != GLEW_OK)
     {
-        SAL_WARN("vcl.opengl", "GL stack has no framebuffer support");
+        SAL_WARN("chart2.opengl", "GL stack has no framebuffer support");
         return -1;
     }
 
@@ -384,7 +384,7 @@ BitmapEx OpenGLRender::GetAsBitmap()
         aWriter.Write( sOutput );
         sOutput.Close();
     } catch (...) {
-        SAL_WARN("vcl.opengl", "Error writing png to " << aName);
+        SAL_WARN("chart2.opengl", "Error writing png to " << aName);
     }
 #endif
 
@@ -534,13 +534,13 @@ void OpenGLRender::renderToBitmap()
         status = glCheckFramebufferStatus(GL_READ_FRAMEBUFFER);
         if (status != GL_FRAMEBUFFER_COMPLETE)
         {
-            SAL_INFO("vcl.opengl", "The frame buffer status is not complete!");
+            SAL_INFO("chart2.opengl", "The frame buffer status is not complete!");
         }
         glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FboID);
         status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
         if (status != GL_FRAMEBUFFER_COMPLETE)
         {
-            SAL_INFO("vcl.opengl", "The frame buffer status is not complete!");
+            SAL_INFO("chart2.opengl", "The frame buffer status is not complete!");
         }
         glBlitFramebuffer(0, 0 ,m_iWidth, m_iHeight, 0, 0,m_iWidth ,m_iHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR);
         glBindFramebuffer(GL_READ_FRAMEBUFFER,0);
@@ -658,7 +658,7 @@ void OpenGLRender::Release()
 
     glXMakeCurrent(glWin.dpy, None, NULL);
     if( glGetError() != GL_NO_ERROR ) {
-        SAL_INFO("vcl.opengl", "glError: " << (char *)gluErrorString(glGetError()));
+        SAL_INFO("chart2.opengl", "glError: " << (char *)gluErrorString(glGetError()));
     }
     glXDestroyContext(glWin.dpy, glWin.ctx);
     glWin.ctx = NULL;
@@ -804,7 +804,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
     //create a temp windwo to check whether support multi-sample, if support, get the format
     if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0)
     {
-        SAL_WARN("vcl.opengl", "Can't create temp window to test");
+        SAL_WARN("chart2.opengl", "Can't create temp window to test");
         return false;
     }
 
@@ -812,7 +812,7 @@ bool OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd)
     if (!WGLisExtensionSupported("WGL_ARB_multisample"))
     {
         mbArbMultisampleSupported = false;
-        SAL_WARN("vcl.opengl", "Device doesn't support multi sample");
+        SAL_WARN("chart2.opengl", "Device doesn't support multi sample");
         return false;
     }
     // Get Our Pixel Format
@@ -1111,7 +1111,7 @@ int OpenGLRender::RenderBubble2FBO(int)
     GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
     if( fbResult != GL_FRAMEBUFFER_COMPLETE )
     {
-        SAL_WARN("vcl.opengl", "error");
+        SAL_WARN("chart2.opengl", "error");
         return -1;
     }
     CHECK_GL_ERROR();
@@ -1269,7 +1269,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, const awt::Point&
         aWriter.Write( sOutput );
         sOutput.Close();
     } catch (...) {
-        SAL_WARN("vcl.opengl", "Error writing png to " << aName);
+        SAL_WARN("chart2.opengl", "Error writing png to " << aName);
     }
 #endif
 
@@ -1532,7 +1532,7 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_
     m_BackgroundColor[13] = (float)g / 255.0f;
     m_BackgroundColor[14] = (float)b / 255.0f;
     m_BackgroundColor[15] = nAlpha / 255.0f;
-    SAL_INFO("vcl.opengl", "color1 = " << color1 << ", color2 = " << color2);
+    SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2);
 
 }
 
diff --git a/include/vcl/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
similarity index 67%
rename from include/vcl/OpenGLRender.hxx
rename to chart2/source/view/main/OpenGLRender.hxx
index 4fabae9..8140bf9 100755
--- a/include/vcl/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -7,43 +7,11 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-#ifndef VCL_OPENGL_RENDER_HXX
-#define VCL_OPENGL_RENDER_HXX
-
-#if defined( MACOSX )
-#elif defined( UNX )
-#  include <prex.h>
-#  include "GL/glxew.h"
-#  include <postx.h>
-#elif defined( _WIN32 )
-#  include "prewin.h"
-#  include "windows.h"
-#  include "postwin.h"
-#endif
-
-#include <GL/glew.h>
-
-#include <vcl/window.hxx>
-#include <vcl/syschild.hxx>
-#include <vcl/sysdata.hxx>
 #include <vcl/bitmapex.hxx>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <vcl/font.hxx>
-#include <vcl/vclopengl_dllapi.hxx>
-
-
-#if defined( _WIN32 )
-#include <GL/glext.h>
-#include <GL/wglext.h>
-#elif defined( MACOSX )
-#elif defined( UNX )
-#include <GL/glext.h>
-#define GLX_GLXEXT_PROTOTYPES 1
-#include <GL/glx.h>
-#include <GL/glxext.h>
-
-#endif
+#include <vcl/OpenGLContext.hxx>
 
 // Include GLM
 #include <list>
@@ -93,58 +61,7 @@ typedef std::vector<GLfloat> Area2DPointList;
 typedef std::vector<GLfloat> PieSegment2DPointList;
 typedef std::vector<GLfloat> PointList;
 
-/// Holds the information of our new child window
-struct GLWindow
-{
-#if defined( _WIN32 )
-    HWND                    hWnd;
-    HDC                     hDC;
-    HGLRC                   hRC;
-#elif defined( MACOSX )
-#elif defined( UNX )
-    Display*           dpy;
-    int                     screen;
-    XLIB_Window             win;
-#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
-    GLXFBConfig        fbc;
-#endif
-    XVisualInfo*       vi;
-    GLXContext         ctx;
-
-    bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); }
-    const char*             GLXExtensions;
-#endif
-    unsigned int            bpp;
-    unsigned int            Width;
-    unsigned int            Height;
-    const GLubyte*          GLExtensions;
-
-    bool HasGLExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, GLExtensions ); }
-
-    GLWindow()
-        :
-#if defined( _WIN32 )
-#elif defined( MACOSX )
-#elif defined( UNX )
-        dpy(NULL),
-        screen(0),
-        win(0),
-#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
-        fbc(0),
-#endif
-        vi(NULL),
-        ctx(0),
-        GLXExtensions(NULL),
-#endif
-        bpp(0),
-        Width(0),
-        Height(0),
-        GLExtensions(NULL)
-    {
-    }
-};
-
-class VCLOPENGL_DLLPUBLIC OpenGLRender
+class OpenGLRender
 {
 public:
     OpenGLRender(com::sun::star::uno::Reference<
@@ -196,16 +113,16 @@ public:
 
     void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
 private:
-    SAL_DLLPRIVATE GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
-    SAL_DLLPRIVATE int CreateTextureObj(int width, int height);
-    SAL_DLLPRIVATE int CreateRenderObj(int width, int height);
-    SAL_DLLPRIVATE int CreateFrameBufferObj();
+    GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
+    int CreateTextureObj(int width, int height);
+    int CreateRenderObj(int width, int height);
+    int CreateFrameBufferObj();
 #if defined( _WIN32 )
-    SAL_DLLPRIVATE int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd);
-    SAL_DLLPRIVATE bool WGLisExtensionSupported(const char *extension);
+    int InitTempWindow(HWND *hwnd, int width, int height, PIXELFORMATDESCRIPTOR inPfd);
+    bool WGLisExtensionSupported(const char *extension);
 #endif
-    SAL_DLLPRIVATE int CreateMultiSampleFrameBufObj();
-    SAL_DLLPRIVATE int Create2DCircle(int detail);
+    int CreateMultiSampleFrameBufObj();
+    int Create2DCircle(int detail);
 
 private:
     // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units
@@ -299,6 +216,4 @@ private:
 #endif
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 018e4c6..41ef580 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -362,7 +362,6 @@ certain functionality.
 @li @c vcl.kde - KDE
 @li @c vcl.kde4 - KDE4
 @li @c vcl.layout - Widget layout
- at li @c vcl.opengl - OpenGL rendering
 @li @c vcl.plugadapt - the Unix/X11 backend plugin mechanism
 @li @c vcl.osx
 @li @c vcl.osx.print
diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx
index 60bcfcc..4073334 100644
--- a/include/vcl/OpenGLContext.hxx
+++ b/include/vcl/OpenGLContext.hxx
@@ -10,9 +10,86 @@
 #ifndef VCL_OPENGL_CONTEXT_HXX
 #define VCL_OPENGL_CONTEXT_HXX
 
+#if defined( MACOSX )
+#elif defined( UNX )
+#  include <prex.h>
+#  include "GL/glxew.h"
+#  include <postx.h>
+#elif defined( _WIN32 )
+#  include "prewin.h"
+#  include "windows.h"
+#  include "postwin.h"
+#endif
+
+#if defined( _WIN32 )
+#include <GL/glext.h>
+#include <GL/wglext.h>
+#elif defined( MACOSX )
+#elif defined( UNX )
+#include <GL/glext.h>
+#define GLX_GLXEXT_PROTOTYPES 1
+#include <GL/glx.h>
+#include <GL/glxext.h>
+#endif
+
+#include <GL/glew.h>
+
 #include <vcl/vclopengl_dllapi.hxx>
-#include <vcl/OpenGLRender.hxx>
 #include <boost/scoped_ptr.hpp>
+#include <vcl/window.hxx>
+#include <tools/gen.hxx>
+#include <vcl/syschild.hxx>
+
+/// Holds the information of our new child window
+struct GLWindow
+{
+#if defined( _WIN32 )
+    HWND                    hWnd;
+    HDC                     hDC;
+    HGLRC                   hRC;
+#elif defined( MACOSX )
+#elif defined( UNX )
+    Display*           dpy;
+    int                     screen;
+    XLIB_Window             win;
+#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
+    GLXFBConfig        fbc;
+#endif
+    XVisualInfo*       vi;
+    GLXContext         ctx;
+
+    bool HasGLXExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, (const GLubyte*) GLXExtensions ); }
+    const char*             GLXExtensions;
+#endif
+    unsigned int            bpp;
+    unsigned int            Width;
+    unsigned int            Height;
+    const GLubyte*          GLExtensions;
+
+    bool HasGLExtension( const char* name ) { return gluCheckExtension( (const GLubyte*) name, GLExtensions ); }
+
+    GLWindow()
+        :
+#if defined( _WIN32 )
+#elif defined( MACOSX )
+#elif defined( UNX )
+        dpy(NULL),
+        screen(0),
+        win(0),
+#if defined( GLX_VERSION_1_3 ) && defined( GLX_EXT_texture_from_pixmap )
+        fbc(0),
+#endif
+        vi(NULL),
+        ctx(0),
+        GLXExtensions(NULL),
+#endif
+        bpp(0),
+        Width(0),
+        Height(0),
+        GLExtensions(NULL)
+    {
+    }
+};
 
 class VCLOPENGL_DLLPUBLIC OpenGLContext
 {
@@ -20,7 +97,7 @@ public:
     OpenGLContext();
     ~OpenGLContext();
 
-    bool init(OpenGLRender& rGLRender);
+    bool init();
     void setWinSize(const Size& rSize);
 
 private:
diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk
index 270cbd6..59cf958 100644
--- a/vcl/Library_vclopengl.mk
+++ b/vcl/Library_vclopengl.mk
@@ -33,7 +33,6 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\
 ))
 
 $(eval $(call gb_Library_add_exception_objects,vclopengl,\
-    vcl/source/opengl/OpenGLRender \
     vcl/source/opengl/OpenGLContext \
 ))
 
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 50d847c..bb2ad3b 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -27,7 +27,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
 		Executable_ui-previewer) \
 	$(if $(filter FREEBSD LINUX MACOSX WNT,$(OS)), \
 		Library_vclopengl \
-		Package_opengl \
 	) \
 ))
 
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index e17a7b8..a41a058 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -8,7 +8,8 @@
  */
 
 #include <vcl/OpenGLContext.hxx>
-
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
 
 using namespace com::sun::star;
 
@@ -119,9 +120,10 @@ int oglErrorHandler( Display* /*dpy*/, XErrorEvent* /*evnt*/ )
 }
 
 }
+
 #endif
 
-bool OpenGLContext::init(OpenGLRender& rGLRender)
+bool OpenGLContext::init()
 {
     m_pWindow.reset(new Window(0, WB_NOBORDER|WB_NODIALOGCONTROL));
     SAL_INFO("vcl.opengl", "OpenGLContext::OpenGLContext----start");
@@ -233,7 +235,7 @@ bool OpenGLContext::init(OpenGLRender& rGLRender)
 
 #endif
 
-    rGLRender.InitOpenGL(m_aGLWin);
+    //rGLRender.InitOpenGL(m_aGLWin);
 
 #ifdef DBG_UTIL
     // only enable debug output in dbgutil build
commit bd78139dcbf804e6e0b8be5409436991ac08b36c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Mar 14 02:49:19 2014 +0100

    remove element that was only written for binary formats
    
    Change-Id: Ic930fc6e12912ead8d6b1daa79894c968d99d988

diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 83d766d..6e3ae7f 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -1788,7 +1788,6 @@ namespace xmloff { namespace token {
         XML_TABLE_INDEX_ENTRY_TEMPLATE,
         XML_TABLE_INDEX_SOURCE,
         XML_TABLE_NAME,
-        XML_TABLE_NUMBER_LIST,
         XML_TABLE_OF_CONTENT,
         XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE,
         XML_TABLE_OF_CONTENT_SOURCE,
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 6c369ac..500a80e 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -1927,31 +1927,6 @@ void SchXMLExportHelper_Impl::exportPlotArea(
             }
         }
 
-        // #i72973#, #144135# only export table-number-list in OOo format (also for binary)
-        Reference< beans::XPropertySet > xExportInfo( mrExport.getExportInfo());
-        if( !msTableNumberList.isEmpty() && xExportInfo.is())
-        {
-            try
-            {
-                OUString sExportTableNumListPropName( "ExportTableNumberList");
-                Reference< beans::XPropertySetInfo > xInfo( xExportInfo->getPropertySetInfo());
-                bool bExportTableNumberList = false;
-                if( xInfo.is() && xInfo->hasPropertyByName( sExportTableNumListPropName ) &&
-                    (xExportInfo->getPropertyValue( sExportTableNumListPropName ) >>= bExportTableNumberList) &&
-                    bExportTableNumberList )
-                {
-                    // this attribute is for charts embedded in calc documents only.
-                    // With this you are able to store a file again in 5.0 binary format
-                    mrExport.AddAttribute( XML_NAMESPACE_CHART, XML_TABLE_NUMBER_LIST, msTableNumberList );
-                }
-            }
-            catch( const uno::Exception & rEx )
-            {
-                OString aBStr(OUStringToOString(rEx.Message, RTL_TEXTENCODING_ASCII_US));
-                SAL_INFO("xmloff.chart", "chart:TableNumberList property caught: " << aBStr );
-            }
-        }
-
         // attributes
         Reference< drawing::XShape > xShape ( xDiagram, uno::UNO_QUERY );
         if( xShape.is())
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 01887b5..9557863 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -2118,7 +2118,6 @@ sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& r
 sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
 {
     OUString sFilterService;
-    bool bIsChart = false;
 
     Reference < lang::XServiceInfo > xServiceInfo( rComp, UNO_QUERY );
     if( xServiceInfo.is() )
@@ -2134,7 +2133,6 @@ sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
                 sFilterService = OUString( pEntry->sFilterService,
                                            pEntry->nFilterServiceLen,
                                               RTL_TEXTENCODING_ASCII_US );
-                bIsChart = sModelService == XML_MODEL_SERVICE_CHART;
                 break;
             }
             pEntry++;
@@ -2150,30 +2148,6 @@ sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
         new XMLEmbeddedObjectExportFilter( mxHandler );
 
     Sequence < Any > aArgs( 1 );
-    // #144135# the filters for embedded objects in flat format are always
-    // instantiated as Oasis filters and transformed afterwards. Therefore, all
-    // special handling that is done if the exportFlags do not contain
-    // EXPORT_OASIS must be changed to properties being passed in the info
-    // propertyset
-
-    if( ! (getExportFlags() & EXPORT_OASIS) &&
-        bIsChart )
-    {
-        static ::comphelper::PropertyMapEntry const aInfoMap[] =
-        {
-            { OUString("ExportTableNumberList"), 0, ::getBooleanCppuType(), PropertyAttribute::MAYBEVOID, 0},
-            { OUString(), 0, css::uno::Type(), 0, 0 }
-        };
-        Reference< XPropertySet > xInfoProp(
-            ::comphelper::GenericPropertySet_CreateInstance(
-                new ::comphelper::PropertySetInfo( aInfoMap )));
-
-        if( bIsChart )
-            xInfoProp->setPropertyValue("ExportTableNumberList", makeAny( true ));
-
-        aArgs.realloc( 2 );
-        aArgs[1] <<= xInfoProp;
-    }
     aArgs[0] <<= xHdl;
 
     Reference< document::XExporter > xExporter(
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 47c871a..c3559d3 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -1793,7 +1793,6 @@ namespace xmloff { namespace token {
         TOKEN( "table-index-entry-template",      XML_TABLE_INDEX_ENTRY_TEMPLATE ),
         TOKEN( "table-index-source",              XML_TABLE_INDEX_SOURCE ),
         TOKEN( "table-name",                      XML_TABLE_NAME ),
-        TOKEN( "table-number-list",               XML_TABLE_NUMBER_LIST ),
         TOKEN( "table-of-content",                XML_TABLE_OF_CONTENT ),
         TOKEN( "table-of-content-entry-template",     XML_TABLE_OF_CONTENT_ENTRY_TEMPLATE ),
         TOKEN( "table-of-content-source",         XML_TABLE_OF_CONTENT_SOURCE ),
commit cc2bfd18fdf3ffd640d9284f23b5054535211b07
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Mar 12 02:45:00 2014 +0100

    remove whitespace
    
    Change-Id: I131de4b10674dceee821e2ab580b32d107134335

diff --git a/include/oox/drawingml/chart/typegroupmodel.hxx b/include/oox/drawingml/chart/typegroupmodel.hxx
index 695634c..91570e3 100644
--- a/include/oox/drawingml/chart/typegroupmodel.hxx
+++ b/include/oox/drawingml/chart/typegroupmodel.hxx
@@ -26,8 +26,6 @@ namespace oox {
 namespace drawingml {
 namespace chart {
 
-
-
 struct UpDownBarsModel
 {
     typedef ModelRef< Shape > ShapeRef;
@@ -40,8 +38,6 @@ struct UpDownBarsModel
                         ~UpDownBarsModel();
 };
 
-
-
 struct TypeGroupModel
 {
     typedef ModelVector< SeriesModel >  SeriesVector;
@@ -85,8 +81,6 @@ struct TypeGroupModel
                         ~TypeGroupModel();
 };
 
-
-
 } // namespace chart
 } // namespace drawingml
 } // namespace oox
commit cd99c5c0dda08470f165c9a25bca2cb6ab6887c3
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue Mar 11 12:38:06 2014 +0100

    property mapping import
    
    Change-Id: I0859699b3639b6f7d5d15865e6ec1591b3d36f06

diff --git a/include/xmloff/SchXMLImportHelper.hxx b/include/xmloff/SchXMLImportHelper.hxx
index 713174b..fe20e8e 100644
--- a/include/xmloff/SchXMLImportHelper.hxx
+++ b/include/xmloff/SchXMLImportHelper.hxx
@@ -78,6 +78,7 @@ private:
     SvXMLTokenMap* mpAutoStyleAttrTokenMap;
     SvXMLTokenMap* mpCellAttrTokenMap;
     SvXMLTokenMap* mpSeriesAttrTokenMap;
+    SvXMLTokenMap* mpPropMappingAttrTokenMap;
     SvXMLTokenMap* mpRegEquationAttrTokenMap;
 
 public:
@@ -112,6 +113,7 @@ public:
     const SvXMLTokenMap& GetChartElemTokenMap();
     const SvXMLTokenMap& GetPlotAreaElemTokenMap();
     const SvXMLTokenMap& GetSeriesElemTokenMap();
+    const SvXMLTokenMap& GetPropMappingAttrTokenMap();
 
     const SvXMLTokenMap& GetChartAttrTokenMap();
     const SvXMLTokenMap& GetPlotAreaAttrTokenMap();
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index 46ae11f..553fcc1 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -69,6 +69,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\
     xmloff/source/chart/SchXMLLegendContext \
     xmloff/source/chart/SchXMLParagraphContext \
     xmloff/source/chart/SchXMLPlotAreaContext \
+    xmloff/source/chart/SchXMLPropertyMappingContext \
     xmloff/source/chart/SchXMLRegressionCurveObjectContext \
     xmloff/source/chart/SchXMLSeries2Context \
     xmloff/source/chart/SchXMLSeriesHelper \
diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx
index 3d96d52..16fa7f3 100644
--- a/xmloff/inc/SchXMLImport.hxx
+++ b/xmloff/inc/SchXMLImport.hxx
@@ -79,7 +79,14 @@ enum SchXMLSeriesElemTokenMap
     XML_TOK_SERIES_DOMAIN,
     XML_TOK_SERIES_MEAN_VALUE_LINE,
     XML_TOK_SERIES_REGRESSION_CURVE,
-    XML_TOK_SERIES_ERROR_INDICATOR
+    XML_TOK_SERIES_ERROR_INDICATOR,
+    XML_TOK_SERIES_PROPERTY_MAPPING
+};
+
+enum SchXMLPropertyMappingAttrTokenMap
+{
+    XML_TOK_PROPERTY_MAPPING_PROPERTY,
+    XML_TOK_PROPERTY_MAPPING_RANGE
 };
 
 enum SchXMLChartAttrMap
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index 5ca496f..3a3dc51 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -96,6 +96,7 @@ SchXMLImportHelper::SchXMLImportHelper() :
         mpAutoStyleAttrTokenMap( 0 ),
         mpCellAttrTokenMap( 0 ),
         mpSeriesAttrTokenMap( 0 ),
+        mpPropMappingAttrTokenMap( 0 ),
         mpRegEquationAttrTokenMap( 0 )
 {
 }
@@ -124,6 +125,7 @@ SchXMLImportHelper::~SchXMLImportHelper()
         delete mpCellAttrTokenMap;
     if( mpSeriesAttrTokenMap )
         delete mpSeriesAttrTokenMap;
+    delete mpPropMappingAttrTokenMap;
 }
 
 SvXMLImportContext* SchXMLImportHelper::CreateChartContext(
@@ -247,6 +249,7 @@ const SvXMLTokenMap& SchXMLImportHelper::GetSeriesElemTokenMap()
     { XML_NAMESPACE_CHART,  XML_MEAN_VALUE,       XML_TOK_SERIES_MEAN_VALUE_LINE  },
     { XML_NAMESPACE_CHART,  XML_REGRESSION_CURVE, XML_TOK_SERIES_REGRESSION_CURVE },
     { XML_NAMESPACE_CHART,  XML_ERROR_INDICATOR,  XML_TOK_SERIES_ERROR_INDICATOR  },
+    { XML_NAMESPACE_LO_EXT, XML_PROPERTY_MAPPING, XML_TOK_SERIES_PROPERTY_MAPPING },
     XML_TOKEN_MAP_END
 };
 
@@ -348,6 +351,23 @@ const SvXMLTokenMap& SchXMLImportHelper::GetSeriesAttrTokenMap()
     return *mpSeriesAttrTokenMap;
 }
 
+const SvXMLTokenMap& SchXMLImportHelper::GetPropMappingAttrTokenMap()
+{
+    if( !mpPropMappingAttrTokenMap )
+    {
+        static const SvXMLTokenMapEntry aPropMappingAttrTokenMap[] =
+        {
+            { XML_NAMESPACE_LO_EXT, XML_PROPERTY, XML_TOK_PROPERTY_MAPPING_PROPERTY },
+            { XML_NAMESPACE_LO_EXT, XML_CELL_RANGE_ADDRESS, XML_TOK_PROPERTY_MAPPING_RANGE },
+            XML_TOKEN_MAP_END
+        };
+
+        mpPropMappingAttrTokenMap = new SvXMLTokenMap( aPropMappingAttrTokenMap );
+    }
+
+    return *mpPropMappingAttrTokenMap;
+}
+
 const SvXMLTokenMap& SchXMLImportHelper::GetRegEquationAttrTokenMap()
 {
     if( ! mpRegEquationAttrTokenMap )
diff --git a/xmloff/source/chart/SchXMLPropertyMappingContext.cxx b/xmloff/source/chart/SchXMLPropertyMappingContext.cxx
new file mode 100644
index 0000000..affe3aa
--- /dev/null
+++ b/xmloff/source/chart/SchXMLPropertyMappingContext.cxx
@@ -0,0 +1,111 @@
+/* -*- 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 "SchXMLPropertyMappingContext.hxx"
+#include "PropertyMap.hxx"
+#include "SchXMLTools.hxx"
+#include <xmloff/xmlnmspe.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <xmloff/SchXMLSeriesHelper.hxx>
+#include "SchXMLImport.hxx"
+
+#include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/data/XDataSink.hpp>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace {
+
+Reference< chart2::data::XLabeledDataSequence2 > createAndAddSequenceToSeries( const OUString& rRole
+        , const OUString& rRange
+        , const Reference< chart2::XChartDocument >& xChartDoc
+        , const Reference< chart2::XDataSeries >& xSeries )
+{
+    Reference< chart2::data::XLabeledDataSequence2 > xLabeledSeq;
+
+    Reference< chart2::data::XDataSource > xSeriesSource( xSeries,uno::UNO_QUERY );
+
+    if( !(!rRange.isEmpty() && xChartDoc.is() && xSeriesSource.is()) )
+        return xLabeledSeq;
+
+    // create a new sequence
+    xLabeledSeq = SchXMLTools::GetNewLabeledDataSequence();
+
+    // set values at the new sequence
+    Reference< chart2::data::XDataSequence > xSeq = SchXMLTools::CreateDataSequence( rRange, xChartDoc );
+    Reference< beans::XPropertySet > xSeqProp( xSeq, uno::UNO_QUERY );
+    if( xSeqProp.is())
+        xSeqProp->setPropertyValue("Role", uno::makeAny( rRole));
+    xLabeledSeq->setValues( xSeq );
+
+    return xLabeledSeq;
+}
+
+}
+
+SchXMLPropertyMappingContext::SchXMLPropertyMappingContext( SchXMLImportHelper& rImpHelper,
+        SvXMLImport& rImport, const OUString& rLocalName,
+        tSchXMLLSequencesPerIndex & rLSequencesPerIndex,
+        uno::Reference<
+        chart2::XDataSeries > xSeries ):
+    SvXMLImportContext( rImport, XML_NAMESPACE_LO_EXT, rLocalName ),
+    mrImportHelper( rImpHelper ),
+    mxDataSeries(xSeries),
+    mrLSequencesPerIndex(rLSequencesPerIndex)
+{
+
+}
+
+SchXMLPropertyMappingContext::~SchXMLPropertyMappingContext()
+{
+}
+
+void SchXMLPropertyMappingContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList )
+{
+    OUString aRange;
+    OUString aRole;
+    // parse attributes
+    sal_Int16 nAttrCount = xAttrList.is()? xAttrList->getLength(): 0;
+    const SvXMLTokenMap& rAttrTokenMap = mrImportHelper.GetPropMappingAttrTokenMap();
+
+    for( sal_Int16 i = 0; i < nAttrCount; i++ )
+    {
+        OUString sAttrName = xAttrList->getNameByIndex( i );
+        OUString aLocalName;
+        OUString aValue = xAttrList->getValueByIndex( i );
+        sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+        switch( rAttrTokenMap.Get( nPrefix, aLocalName ))
+        {
+            case XML_TOK_PROPERTY_MAPPING_PROPERTY:
+                aRole = aValue;
+                break;
+            case XML_TOK_PROPERTY_MAPPING_RANGE:
+                aRange = aValue;
+                break;
+        }
+    }
+
+    if( !aRange.isEmpty() && !aRole.isEmpty() )
+    {
+        Reference< chart2::XChartDocument > xChartDoc( GetImport().GetModel(), uno::UNO_QUERY );
+        Reference< chart2::data::XLabeledDataSequence2 > xSeq =
+            createAndAddSequenceToSeries(aRole, aRange, xChartDoc, mxDataSeries);
+        mrLSequencesPerIndex.insert(
+                tSchXMLLSequencesPerIndex::value_type(
+                    tSchXMLIndexWithPart( 0, SCH_XML_PART_VALUES),
+                    Reference< chart2::data::XLabeledDataSequence >( xSeq, UNO_QUERY )));
+    }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLPropertyMappingContext.hxx b/xmloff/source/chart/SchXMLPropertyMappingContext.hxx
new file mode 100644
index 0000000..b42bba2
--- /dev/null
+++ b/xmloff/source/chart/SchXMLPropertyMappingContext.hxx
@@ -0,0 +1,50 @@
+/* -*- 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_XMLOFF_SOURCE_CHART_SCHXMLPROPERTYMAPPINGCONTEXt_HXX
+#define INCLUDED_XMLOFF_SOURCE_CHART_SCHXMLPROPERTYMAPPINGCONTEXt_HXX
+
+#include "transporttypes.hxx"
+#include "SchXMLChartContext.hxx"
+#include <xmloff/xmlictxt.hxx>
+#include <xmloff/SchXMLImportHelper.hxx>
+
+namespace com { namespace sun { namespace star {
+    namespace chart2 {
+        class XChartDocument;
+        class XDataSeries;
+    }
+}}}
+
+class SchXMLPropertyMappingContext : public SvXMLImportContext
+{
+public:
+
+    SchXMLPropertyMappingContext( SchXMLImportHelper& rImpHelper,
+                          SvXMLImport& rImport, const OUString& rLocalName,
+                          tSchXMLLSequencesPerIndex& rLSequencesPerIndex,
+                              com::sun::star::uno::Reference<
+                              com::sun::star::chart2::XDataSeries > xSeries );
+
+    virtual ~SchXMLPropertyMappingContext();
+
+    virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList );
+private:
+
+    com::sun::star::uno::Reference< com::sun::star::chart2::XChartDocument > mxChartDocument;
+    SchXMLImportHelper& mrImportHelper;
+    com::sun::star::uno::Reference< com::sun::star::chart2::XDataSeries > mxDataSeries;
+
+    tSchXMLLSequencesPerIndex& mrLSequencesPerIndex;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 0ac5159..a243744 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -20,6 +20,7 @@
 #include "SchXMLSeries2Context.hxx"
 #include "SchXMLPlotAreaContext.hxx"
 #include "SchXMLRegressionCurveObjectContext.hxx"
+#include "SchXMLPropertyMappingContext.hxx"
 #include "SchXMLTools.hxx"
 #include "PropertyMap.hxx"
 
@@ -674,6 +675,11 @@ SvXMLImportContext* SchXMLSeries2Context::CreateChildContext(
             pContext = new SchXMLDataPointContext( GetImport(), rLocalName,
                                                    mrStyleList, m_xSeries, mnDataPointIndex, mbSymbolSizeIsMissingInFile );
             break;
+        case XML_TOK_SERIES_PROPERTY_MAPPING:
+            pContext = new SchXMLPropertyMappingContext( mrImportHelper,
+                    GetImport(), rLocalName,
+                    mrLSequencesPerIndex, m_xSeries );
+            break;
 
         default:
             pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
commit 0e894caf47a7969b1ec65665340e1b5522ef7b93
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Mar 9 21:28:53 2014 +0100

    we also need to translate from ui to internal roles
    
    Change-Id: Id66f2f015d1eabe469a944f2bbafe2afbb360464

diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx
index 45f57c9..bc4e110 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -742,6 +742,11 @@ OUString DialogModel::ConvertRoleFromInternalToUI( const OUString & rRoleString
     return lcl_ConvertRole( rRoleString, true );
 }
 
+OUString DialogModel::ConvertRoleFromUIToInternal( const OUString & rRoleString )
+{
+    return lcl_ConvertRole( rRoleString, false );
+}
+
 OUString DialogModel::GetRoleDataLabel()
 {
     return ::chart::SchResId(STR_OBJECT_DATALABELS).toString();
diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx
index 99a92b8..7e5e830 100644
--- a/chart2/source/controller/dialogs/DialogModel.hxx
+++ b/chart2/source/controller/dialogs/DialogModel.hxx
@@ -158,6 +158,7 @@ public:
     void startControllerLockTimer();
 
     static OUString ConvertRoleFromInternalToUI( const OUString & rRoleString );
+    static OUString ConvertRoleFromUIToInternal( const OUString& rRoleString );
     static OUString GetRoleDataLabel();
 
     // pass a role string (not translated) and get an index that serves for
diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx
index 11b0b7c..9e2a453 100644
--- a/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -775,7 +775,7 @@ IMPL_LINK_NOARG( DataSourceTabPage, AddMappingHdl )
     short aRet = aDlg.Execute();
     if(aRet == RET_OK)
     {
-        OUString aNewMappingName = aDlg.getSelectedEntry();
+        OUString aNewMappingName = DialogModel::ConvertRoleFromUIToInternal(aDlg.getSelectedEntry());
         if(!aNewMappingName.isEmpty())
             m_pLB_ROLE->InsertEntry( lcl_GetRoleLBEntry( aNewMappingName, OUString()));
     }


More information about the Libreoffice-commits mailing list