diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-05-06 06:16:56 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-05-07 21:22:28 +0200 |
commit | a28bcb6e57aef0a05e04195c9bdc52a4bc39bba1 (patch) | |
tree | e015cd138ac869c678f4b8c72b5fac6363e93f69 /sc | |
parent | 42a47cd66eb6d277e5560efa341efa423f9e8fff (diff) |
provide the OpenGL window
This approach looks much better. We get size and position correct
without much work and can easily plug the window into the sc window
hierarchy.
We still have a crash on exit as the ScGridWindow goes out of scope and
the SystemChildWindow is still alive. We need to fix it and bind the
lifecycle of the SystemChildWindow to ScGridWindow.
Another open item is the OpenGL context work. Right now it looks like
the best way forward is to create a subclass of SystemChildWindow that
contains the OpenGLContext.
Change-Id: Ie0a74531e1b818cea92912345464c8fa219bbae2
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/drawfunc/fuins2.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 183740dc03d2..dde50891601d 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -31,6 +31,8 @@ #include <svx/pfiledlg.hxx> #include <tools/urlobj.hxx> #include <vcl/msgbox.hxx> +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> #include <svl/urihelper.hxx> #include <unotools/moduleoptions.hxx> #include <svtools/insdlg.hxx> @@ -53,6 +55,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/chart2/data/XDataProvider.hpp> #include <com/sun/star/chart2/data/XDataReceiver.hpp> +#include <com/sun/star/chart2/X3DChartWindowProvider.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/lang/XInitialization.hpp> @@ -541,6 +544,17 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* ScDocument* pScDoc = pScDocSh->GetDocument(); bool bUndo (pScDoc->IsUndoEnabled()); + SystemChildWindow* pChildWindow = new SystemChildWindow(pData->GetActiveWin(), 0); + Size aWindowSize = pChildWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) ); + pChildWindow->SetSizePixel(aWindowSize); + Wallpaper aBackground = pChildWindow->GetBackground(); + aBackground.SetColor(COL_RED); + pChildWindow->SetBackground(aBackground); + pChildWindow->Show(); + uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( xChartModel, uno::UNO_QUERY_THROW ); + sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pChildWindow); + x3DWindowProvider->setWindow(nWindowPtr); + if( pReqArgs ) { const SfxPoolItem* pItem; @@ -615,6 +629,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* // get chart position (from window size and data range) aStart = pViewSh->GetChartInsertPos( aSize, aPositionRange ); } + pChildWindow->SetPosPixel(pChildWindow->LogicToPixel(aStart, MapMode(MAP_100TH_MM))); Rectangle aRect (aStart, aSize); SdrOle2Obj* pObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect); @@ -709,6 +724,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* sal_Int16 nDialogRet = xDialog->execute(); if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL ) { + delete pWindow; // leave OLE inplace mode and unmark OSL_ASSERT( pViewShell ); OSL_ASSERT( pView ); |