summaryrefslogtreecommitdiff
path: root/chart2/source/controller/main/ChartWindow.cxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2014-05-17 04:32:58 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-07-20 09:54:05 +0200
commit46cea34638b371570073c0e86f79969753c543ed (patch)
tree12d6fc8ca85b21a41d683ed039feacf811f79fb6 /chart2/source/controller/main/ChartWindow.cxx
parentdf5202ff193fb832d621cab3c942c5dce4e6c6b8 (diff)
opengl charts: Move the init from sc to chart2, to have the right parent.
Change-Id: I1e23329345e00e7d8e1f269c832e84d015824c0a
Diffstat (limited to 'chart2/source/controller/main/ChartWindow.cxx')
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx33
1 files changed, 29 insertions, 4 deletions
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 917d69e8ae74..37335c4b87a2 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()