summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-23 18:48:43 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-07-23 22:19:58 +0200
commitcc827ab81d285156fffb8920cba460703cad789d (patch)
tree531ae206c3e20e4a61b5dad53e49a21db99419dc /chart2
parentc02e393c7dd55ad6d1f94972543d3c14dd30351f (diff)
Revert "opengl charts: Move the init from sc to chart2 ...
This reverts commit 46cea34638b371570073c0e86f79969753c543ed. Conflicts: chart2/source/view/charttypes/GL3DBarChart.cxx Change-Id: Ia29ea6a95b8b9eb870d14538d0cadaa40472582f
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcontroller.mk1
-rw-r--r--chart2/source/controller/main/ChartController.cxx3
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx33
-rw-r--r--chart2/source/controller/main/ChartWindow.hxx9
-rw-r--r--chart2/source/model/main/ChartModel.cxx1
-rw-r--r--chart2/source/view/charttypes/GL3DBarChart.cxx82
-rw-r--r--chart2/source/view/inc/GL3DBarChart.hxx6
-rw-r--r--chart2/source/view/main/ChartView.cxx8
8 files changed, 47 insertions, 96 deletions
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index 96579986ffc4..b7e86bfc353e 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -43,7 +43,6 @@ $(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 d5eca79114b9..b57045d09bfe 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -726,9 +726,6 @@ 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 37335c4b87a2..917d69e8ae74 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -22,11 +22,8 @@
#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
@@ -45,11 +42,10 @@ namespace
namespace chart
{
-ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits nStyle )
+ChartWindow::ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle )
: Window(pParent, nStyle)
- , m_pWindowController( pController )
+ , m_pWindowController( pWindowController )
, m_bInPaint(false)
- , m_pOpenGLWindow(new OpenGLWindow(this))
{
this->SetHelpId( HID_SCH_WIN_DOCUMENT );
this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -59,21 +55,10 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
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()
@@ -94,18 +79,10 @@ void ChartWindow::PrePaint()
void ChartWindow::Paint( const Rectangle& rRect )
{
m_bInPaint = true;
- if (m_pOpenGLWindow && m_pOpenGLWindow->IsVisible())
- {
- m_pOpenGLWindow->Paint(rRect);
- }
- else if (m_pWindowController)
- {
- m_pWindowController->execute_Paint(rRect);
- }
+ if( m_pWindowController )
+ m_pWindowController->execute_Paint( rRect );
else
- {
Window::Paint( rRect );
- }
m_bInPaint = false;
}
@@ -147,8 +124,6 @@ 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 ee5884f013e5..ec5c05bde7c5 100644
--- a/chart2/source/controller/main/ChartWindow.hxx
+++ b/chart2/source/controller/main/ChartWindow.hxx
@@ -21,12 +21,10 @@
#include <vcl/window.hxx>
-class OpenGLWindow;
-
namespace chart
{
-class ChartController;
+class WindowController;
/** The ChartWindow collects events from the window and forwards them the to the controller
thus the controller can perform appropriate actions
@@ -35,7 +33,7 @@ thus the controller can perform appropriate actions
class ChartWindow : public Window
{
public:
- ChartWindow( ChartController* pController, Window* pParent, WinBits nStyle );
+ ChartWindow( WindowController* pWindowController, Window* pParent, WinBits nStyle );
virtual ~ChartWindow();
void clear();
@@ -65,9 +63,8 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
private:
- ChartController* m_pWindowController;
+ WindowController* 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 0fb584b1b0d3..2d2a84860145 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1412,6 +1412,7 @@ 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 0d12c4f6185f..62e5ec952ffb 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -47,8 +47,8 @@ void RenderThread::renderFrame()
if(!mpChart->mbValidContext)
return;
- mpChart->mpWindow->getContext().makeCurrent();
- Size aSize = mpChart->mpWindow->GetSizePixel();
+ mpChart->mrWindow.getContext().makeCurrent();
+ Size aSize = mpChart->mrWindow.GetSizePixel();
mpChart->mpRenderer->SetSize(aSize);
if(mpChart->mbNeedsNewRender)
{
@@ -64,7 +64,7 @@ void RenderThread::renderFrame()
}
mpChart->mpRenderer->ProcessUnrenderedShape(mpChart->mbNeedsNewRender);
mpChart->mbNeedsNewRender = false;
- mpChart->mpWindow->getContext().swapBuffers();
+ mpChart->mrWindow.getContext().swapBuffers();
}
@@ -127,10 +127,10 @@ void RenderAnimationThread::execute()
GL3DBarChart::GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow* pWindow) :
+ OpenGLWindow& rWindow) :
mxChartType(xChartType),
mpRenderer(new opengl3D::OpenGL3DRenderer()),
- mpWindow(pWindow),
+ mrWindow(rWindow),
mpCamera(NULL),
mbValidContext(true),
mpTextCache(new opengl3D::TextCache()),
@@ -142,13 +142,9 @@ GL3DBarChart::GL3DBarChart(
mbNeedsNewRender(true),
mbCameraInit(false)
{
- Size aSize;
- if (mpWindow)
- {
- mpWindow->setRenderer(this);
- aSize = mpWindow->GetSizePixel();
- }
+ Size aSize = mrWindow.GetSizePixel();
mpRenderer->SetSize(aSize);
+ mrWindow.setRenderer(this);
mpRenderer->init();
}
@@ -166,8 +162,8 @@ GL3DBarChart::~GL3DBarChart()
if(mpRenderThread.is())
mpRenderThread->join();
osl::MutexGuard aGuard(maMutex);
- if(mbValidContext && mpWindow)
- mpWindow->setRenderer(NULL);
+ if(mbValidContext)
+ mrWindow.setRenderer(NULL);
}
namespace {
@@ -222,9 +218,9 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
float nXEnd = 0.0;
float nYPos = 0.0;
- //const Color aSeriesColor[] = {
- // COL_RED, COL_GREEN, COL_YELLOW, COL_BROWN, COL_BLUE
- //};
+ const Color aSeriesColor[] = {
+ COL_RED, COL_GREEN, COL_YELLOW, COL_BROWN, COL_BLUE
+ };
maCategories.clear();
maSeriesNames.clear();
@@ -246,7 +242,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
nMaxPointCount = std::max(nMaxPointCount, nPointCount);
- //bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
+ bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
// Create series name text object.
OUString aSeriesName =
@@ -271,28 +267,28 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
p->setPosition(aTopLeft, aTopRight, aBottomRight);
}
- //sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
+ sal_Int32 nColor = aSeriesColor[nSeriesIndex % SAL_N_ELEMENTS(aSeriesColor)].GetColor();
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
{
- //if(bMappedFillProperty)
- //{
- // double nPropVal = rDataSeries.getValueByProperty(nIndex, "FillColor");
- // if(!rtl::math::isNan(nPropVal))
- // nColor = static_cast<sal_uInt32>(nPropVal);
- //}
+ if(bMappedFillProperty)
+ {
+ double nPropVal = rDataSeries.getValueByProperty(nIndex, "FillColor");
+ if(!rtl::math::isNan(nPropVal))
+ nColor = static_cast<sal_uInt32>(nPropVal);
+ }
float nVal = rDataSeries.getYValue(nIndex);
float nXPos = nIndex * (BAR_SIZE_X + BAR_DISTANCE_X) + BAR_DISTANCE_X;
- //glm::mat4 aScaleMatrix = glm::scale(glm::vec3(BAR_SIZE_X, BAR_SIZE_Y, float(nVal/nMaxVal)));
- //glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(nXPos, nYPos, 0.0f));
- //glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
+ glm::mat4 aScaleMatrix = glm::scale(glm::vec3(BAR_SIZE_X, BAR_SIZE_Y, float(nVal/nMaxVal)));
+ glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(nXPos, nYPos, 0.0f));
+ glm::mat4 aBarPosition = aTranslationMatrix * aScaleMatrix;
maBarMap.insert(std::pair<sal_uInt32, BarInformation>(nId,
BarInformation(glm::vec3(nXPos, nYPos, float(nVal/nMaxVal)),
nVal, nIndex, nSeriesIndex)));
- //maShapes.push_back(new opengl3D::Bar(mpRenderer.get(), aBarPosition, nColor, nId));
+ maShapes.push_back(new opengl3D::Bar(mpRenderer.get(), aBarPosition, nColor, nId));
nId += ID_STEP;
}
@@ -407,10 +403,10 @@ void GL3DBarChart::update()
{
if(mpRenderThread.is())
mpRenderThread->join();
- Size aSize = mpWindow->GetSizePixel();
- mpWindow->getContext().setWinSize(aSize);
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
- mpWindow->getContext().resetCurrent();
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
}
@@ -442,10 +438,10 @@ void GL3DBarChart::moveToDefault()
if(mpRenderThread.is())
mpRenderThread->join();
- Size aSize = mpWindow->GetSizePixel();
- mpWindow->getContext().setWinSize(aSize);
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
- mpWindow->getContext().resetCurrent();
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -500,10 +496,10 @@ void GL3DBarChart::clickedAt(const Point& rPos, sal_uInt16 nButtons)
glm::vec3 maTargetPosition = rBarInfo.maPos;
maTargetPosition.z += 240;
maTargetPosition.y += BAR_SIZE_Y / 2.0f;
- Size aSize = mpWindow->GetSizePixel();
- mpWindow->getContext().setWinSize(aSize);
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maTargetPosition, STEPS));
- mpWindow->getContext().resetCurrent();
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -581,11 +577,11 @@ void GL3DBarChart::moveToCorner()
if(mpRenderThread.is())
mpRenderThread->join();
- Size aSize = mpWindow->GetSizePixel();
- mpWindow->getContext().setWinSize(aSize);
+ Size aSize = mrWindow.GetSizePixel();
+ mrWindow.getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, getCornerPosition(mnCornerId),
maCameraPosition, STEPS));
- mpWindow->getContext().resetCurrent();
+ mrWindow.getContext().resetCurrent();
mpRenderThread->launch();
// TODO: moggi: add to thread
@@ -608,12 +604,6 @@ void GL3DBarChart::contextDestroyed()
mbValidContext = false;
}
-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 56bac832f060..25176277f068 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -49,7 +49,7 @@ class GL3DBarChart : public GL3DPlotterBase, public IRenderer
public:
GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow* pContext);
+ OpenGLWindow& rContext);
virtual ~GL3DBarChart();
@@ -65,8 +65,6 @@ public:
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
- void setOpenGLWindow(OpenGLWindow* pWindow);
-
private:
void moveToCorner();
@@ -77,7 +75,7 @@ private:
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
- OpenGLWindow* mpWindow;
+ OpenGLWindow& mrWindow;
opengl3D::Camera* mpCamera;
bool mbValidContext;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 8dc8046c514b..2e8dc257a4bb 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3250,13 +3250,7 @@ void ChartView::createShapes3D()
if (!m_pGL3DPlotter)
{
- m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, pWindow));
- }
- else
- {
- GL3DBarChart* pChart = dynamic_cast<GL3DBarChart*>(m_pGL3DPlotter.get());
- if (pChart)
- pChart->setOpenGLWindow(pWindow);
+ m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, *pWindow));
}
uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );