diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-05-17 04:32:58 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-07-20 09:54:05 +0200 |
commit | 46cea34638b371570073c0e86f79969753c543ed (patch) | |
tree | 12d6fc8ca85b21a41d683ed039feacf811f79fb6 /chart2/source/controller | |
parent | df5202ff193fb832d621cab3c942c5dce4e6c6b8 (diff) |
opengl charts: Move the init from sc to chart2, to have the right parent.
Change-Id: I1e23329345e00e7d8e1f269c832e84d015824c0a
Diffstat (limited to 'chart2/source/controller')
-rw-r--r-- | chart2/source/controller/main/ChartController.cxx | 3 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartWindow.cxx | 33 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartWindow.hxx | 9 |
3 files changed, 38 insertions, 7 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index b57045d09bfe..d5eca79114b9 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 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() diff --git a/chart2/source/controller/main/ChartWindow.hxx b/chart2/source/controller/main/ChartWindow.hxx index ec5c05bde7c5..ee5884f013e5 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(); }; |