diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-19 16:00:39 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-19 16:03:28 -0400 |
commit | 2fc4f5cd750cc3899ffc6b2f831edcb01e7773b4 (patch) | |
tree | 050d146a6cf1639453a98581d2801e132d2d4ada /sc | |
parent | 0d361388060741fe8e2f1ba059fba95707bdc233 (diff) |
Register OpenGL windows to ScGridWindow upon file load.
Change-Id: I6fdce232ef41079f20a983dc72da032196078858
Diffstat (limited to 'sc')
34 files changed, 107 insertions, 15 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index ad080ae4c8db..08f1ca448388 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -569,6 +569,9 @@ public: bool HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName ); ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const OUString& rChartName ); + std::vector<std::pair<css::uno::Reference< + css::chart2::XChartDocument>, Rectangle> > GetAllCharts(); + SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc ); void SetChartRanges( const OUString& rChartName, const ::std::vector< ScRangeList >& rRanges ); diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index ff49e24c65ba..4076b431ef7b 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -663,6 +663,38 @@ uno::Reference< embed::XEmbeddedObject > return uno::Reference< embed::XEmbeddedObject >(); } +std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > ScDocument::GetAllCharts() +{ + std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > aRet; + if (!pDrawLayer) + return aRet; + + for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++) + { + if (!maTabs[nTab]) + continue; + + SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab)); + OSL_ENSURE(pPage,"Page ?"); + + if (!pPage) + continue; + + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + + for (SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next()) + { + if ( pObject->GetObjIdentifier() != OBJ_OLE2 ) + continue; + + uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) ); + Rectangle aRect = pObject->GetLastBoundRect(); + aRet.push_back(std::pair<uno::Reference<chart2::XChartDocument>, Rectangle>(xChartDoc, aRect)); + } + } + return aRet; +} + void ScDocument::UpdateChartListenerCollection() { OSL_ASSERT(pChartListenerCollection); @@ -702,8 +734,6 @@ void ScDocument::UpdateChartListenerCollection() } else { - bool bIsChart = false; - uno::Reference< embed::XEmbeddedObject > xIPObj = ((SdrOle2Obj*)pObject)->GetObjRef(); OSL_ENSURE( xIPObj.is(), "No embedded object is given!"); uno::Reference< ::com::sun::star::chart2::data::XDataReceiver > xReceiver; @@ -728,15 +758,12 @@ void ScDocument::UpdateChartListenerCollection() // => we have to do this stuff here, BEFORE the chart is actually loaded } - if (!bIsChart) - { - // put into list of other ole objects, so the object doesn't have to - // be swapped in the next time UpdateChartListenerCollection is called - //! remove names when objects are no longer there? - // (object names aren't used again before reloading the document) + // put into list of other ole objects, so the object doesn't have to + // be swapped in the next time UpdateChartListenerCollection is called + //! remove names when objects are no longer there? + // (object names aren't used again before reloading the document) - rNonOleObjects.insert(aObjName); - } + rNonOleObjects.insert(aObjName); } } } diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index bdc9b1dbf1e5..6d2609353c7a 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -26,6 +26,7 @@ #include "hints.hxx" #include "scmod.hxx" #include "markdata.hxx" +#include <gridwin.hxx> #include <unotools/accessiblestatesethelper.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index e130446f0168..089790d626e2 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -35,6 +35,7 @@ #include "client.hxx" #include "tabvwsh.hxx" #include "docsh.hxx" +#include <gridwin.hxx> using namespace com::sun::star; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 8b8d0510c9b5..d354cba31f5b 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -78,6 +78,7 @@ #include "funcdesc.hxx" #include "markdata.hxx" #include "tokenarray.hxx" +#include <gridwin.hxx> // Maximum Ranges in RangeFinder #define RANGEFIND_MAX 32 diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index eec781a3ad43..a538cd30afed 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -62,6 +62,7 @@ #include "cellsuno.hxx" #include "stringutil.hxx" #include "formulaiter.hxx" +#include <gridwin.hxx> using namespace com::sun::star; diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index a7552d36257d..3cc796f5e057 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -47,6 +47,7 @@ #include <svx/drawitem.hxx> #include <svx/xtable.hxx> #include "tabvwsh.hxx" +#include <gridwin.hxx> #include <sfx2/bindings.hxx> #define ScDrawShell diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index f436fe2cc717..afc1ecde5308 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -45,6 +45,7 @@ #include "document.hxx" #include "drwlayer.hxx" #include "userdat.hxx" +#include <gridwin.hxx> #include <svx/svdoole2.hxx> #include <svx/svdocapt.hxx> diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index f0ed72efa5fb..ba9f349f18f3 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -72,6 +72,7 @@ #include "viewutil.hxx" #include "scresid.hxx" #include "tabvwsh.hxx" +#include <gridwin.hxx> #define ScDrawTextObjectBar #include "scslots.hxx" diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx index 5cb6368aa9b8..a437078f74f8 100644 --- a/sc/source/ui/drawfunc/drtxtob1.cxx +++ b/sc/source/ui/drawfunc/drtxtob1.cxx @@ -36,6 +36,7 @@ #include "drawview.hxx" #include "viewdata.hxx" #include "scresid.hxx" +#include <gridwin.hxx> #include "scabstdlg.hxx" #include <boost/scoped_ptr.hpp> diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 34a107b9dded..dfb8e8be5568 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -324,7 +324,7 @@ public: void StopMarking(); void FakeButtonUp( ScSplitPos eWhich ); - Window* GetActiveWin(); + ScGridWindow* GetActiveWin(); Window* GetWindowByPos( ScSplitPos ePos ); ScSplitPos FindWindow( Window* pWindow ) const; diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 691dfa5e809d..9eeb6f825dfe 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -191,6 +191,8 @@ private: void DoReadUserDataSequence( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rSettings ); + void AddOpenGLChartWindows(); + DECL_LINK( SimpleRefClose, void* ); DECL_LINK( SimpleRefDone, OUString* ); DECL_LINK( SimpleRefAborted, OUString* ); @@ -331,7 +333,7 @@ public: ObjectSelectionType GetCurObjectSelectionType(); virtual ErrCode DoVerb(long nVerb) SAL_OVERRIDE; - + virtual void Initialize() SAL_OVERRIDE; void StopEditShell(); bool IsDrawTextShell() const; diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index c36aba93cf57..6a86e46720e3 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -101,6 +101,7 @@ class ScPatternAttr; class ScExtDocOptions; class ScViewData; class ScMarkData; +class ScGridWindow; class ScViewDataTable // per-sheet data { @@ -240,7 +241,7 @@ public: const ScMarkData& GetMarkData() const; Window* GetDialogParent(); // forwarded from tabvwsh - Window* GetActiveWin(); // from View + ScGridWindow* GetActiveWin(); // from View ScDrawView* GetScDrawView(); // from View bool IsMinimized(); // from View diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index dd0577e77305..0c5c495cdec2 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -51,6 +51,7 @@ #include <refhint.hxx> #include <refupdatecontext.hxx> #include <validat.hxx> +#include <gridwin.hxx> #include <set> #include <boost/scoped_ptr.hpp> diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 3b654bf7c46e..d57988c5f92c 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -28,6 +28,7 @@ #include "transobj.hxx" #include "scmod.hxx" #include "cellsuno.hxx" +#include <gridwin.hxx> #include <com/sun/star/script/vba/VBAEventId.hpp> #include <com/sun/star/script/vba/XVBACompatibility.hpp> diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 2a5aa5b17230..eca9ed891a6d 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -56,6 +56,7 @@ #include "cliputil.hxx" #include "clipparam.hxx" #include "markdata.hxx" +#include <gridwin.hxx> #define ScCellShell #define CellMovement diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 3cccca4debf1..8781fb7909e0 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -83,6 +83,7 @@ #include <cellvalue.hxx> #include <tokenarray.hxx> #include <formulacell.hxx> +#include <gridwin.hxx> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> #include <com/sun/star/lang/XInitialization.hpp> diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx index 239c8094fbd5..7c37d61416eb 100644 --- a/sc/source/ui/view/cliputil.cxx +++ b/sc/source/ui/view/cliputil.cxx @@ -18,6 +18,7 @@ #include "rangelst.hxx" #include "viewutil.hxx" #include "markdata.hxx" +#include <gridwin.hxx> #include <vcl/waitobj.hxx> diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index ad38c2cbaebc..d5e280d66a1c 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -39,6 +39,7 @@ #include "scmod.hxx" #include "globstr.hrc" #include "chartarr.hxx" +#include <gridwin.hxx> #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <com/sun/star/embed/Aspects.hpp> diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 7cb29367aa52..fed79b5a8d8a 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -69,6 +69,7 @@ #include "tabvwsh.hxx" #include "editutil.hxx" #include "globstr.hrc" +#include <gridwin.hxx> #define ScEditShell #include "scslots.hxx" diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 52d19072bde7..378e469b8bc5 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -30,6 +30,7 @@ #include "docsh.hxx" #include "tabprotection.hxx" #include "markdata.hxx" +#include <gridwin.hxx> #if defined WNT #define SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN 65 diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index ae2849a254c2..03e407373f4e 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -34,6 +34,7 @@ #include "scmod.hxx" #include "editable.hxx" #include "undoblk.hxx" +#include <gridwin.hxx> #include <refupdatecontext.hxx> SFX_IMPL_CHILDWINDOW_WITHID( ScSpellDialogChildWindow, SID_SPELL_DIALOG ) diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index c6c41c029226..e6092771e0f2 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -33,6 +33,7 @@ #include "clipparam.hxx" #include "dragdata.hxx" #include "markdata.hxx" +#include <gridwin.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 0541d05e46e0..286f1c1fef12 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -863,7 +863,7 @@ double ScTabView::GetPendingRelTabBarWidth() const return mfPendingTabBarWidth; } -Window* ScTabView::GetActiveWin() +ScGridWindow* ScTabView::GetActiveWin() { ScSplitPos ePos = aViewData.GetActivePart(); OSL_ENSURE(pGridWin[ePos],"kein aktives Fenster"); diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx index 1542a0045e21..a2810c1b942a 100644 --- a/sc/source/ui/view/tabvwsh2.cxx +++ b/sc/source/ui/view/tabvwsh2.cxx @@ -41,6 +41,7 @@ #include "sc.hrc" #include "scmod.hxx" #include "appoptio.hxx" +#include <gridwin.hxx> // Create default drawing objects via keyboard #include <svx/svdpagv.hxx> diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 955d9bffe080..01c171df774d 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -39,6 +39,7 @@ #include <unotools/moduleoptions.hxx> #include <tools/urlobj.hxx> #include <sfx2/docfile.hxx> +#include <vcl/openglwin.hxx> #include "tabvwsh.hxx" #include "sc.hrc" @@ -88,8 +89,10 @@ #include "preview.hxx" #include "docoptio.hxx" #include <documentlinkmgr.hxx> +#include <gridwin.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/chart2/X3DChartWindowProvider.hpp> extern SfxViewShell* pScActiveViewShell; // global.cxx @@ -529,6 +532,30 @@ void ScTabViewShell::DoReadUserDataSequence( const uno::Sequence < beans::Proper //! if ViewData has more tables than document, remove tables in ViewData } +void ScTabViewShell::AddOpenGLChartWindows() +{ + ScDocument* pDoc = GetViewData()->GetDocument(); + ScGridWindow* pParentWindow = GetActiveWin(); + + std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > aCharts = pDoc->GetAllCharts(); + + for(std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> >::iterator itr = aCharts.begin(), + itrEnd = aCharts.end(); itr != itrEnd; ++itr) + { + OpenGLWindow* pOpenGLWindow = new OpenGLWindow(pParentWindow); + pOpenGLWindow->Show(false); + Size aSize = itr->second.GetSize(); + + pOpenGLWindow->SetSizePixel(aSize); + Point aPos = itr->second.TopLeft(); + pOpenGLWindow->SetPosPixel(aPos); + pParentWindow->AddChildWindow(pOpenGLWindow); + uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( itr->first, uno::UNO_QUERY_THROW ); + sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pOpenGLWindow); + x3DWindowProvider->setWindow(nWindowPtr); + } +} + // DoReadUserData is also called from ctor when switching from print preview void ScTabViewShell::DoReadUserData( const OUString& rData ) diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 7d7011490571..3871bc8dce35 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -58,6 +58,7 @@ #include "chartarr.hxx" #include "drawview.hxx" #include "ChartRangeSelectionListener.hxx" +#include <gridwin.hxx> #include <tools/urlobj.hxx> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> @@ -243,6 +244,11 @@ ErrCode ScTabViewShell::DoVerb(long nVerb) return nErr; } +void ScTabViewShell::Initialize() +{ + AddOpenGLChartWindows(); +} + void ScTabViewShell::DeactivateOle() { // deactivate inplace editing if currently active diff --git a/sc/source/ui/view/tabvwshd.cxx b/sc/source/ui/view/tabvwshd.cxx index eac3ea425d6a..f3431d332125 100644 --- a/sc/source/ui/view/tabvwshd.cxx +++ b/sc/source/ui/view/tabvwshd.cxx @@ -28,6 +28,7 @@ #include "scmod.hxx" #include "docsh.hxx" #include "sc.hrc" +#include <gridwin.hxx> // STATIC DATA ----------------------------------------------------------- diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 545db9f8d965..2629d49c5eae 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -40,6 +40,7 @@ #include "inputhdl.hxx" #include <svx/srchdlg.hxx> #include "document.hxx" +#include <gridwin.hxx> OUString ScTabViewShell::GetSelectionText( bool bWholeWord ) { diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index 53ede02ca239..a2457bd312b8 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -34,6 +34,7 @@ using namespace com::sun::star; #include "document.hxx" #include "drawview.hxx" #include "globstr.hrc" +#include <gridwin.hxx> #include <avmedia/mediawindow.hxx> void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rURL, diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 50e7b12d6087..90f1377fdf0c 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -58,6 +58,7 @@ #include "markdata.hxx" #include "stlalgorithm.hxx" #include "ViewSettingsSequenceDefines.hxx" +#include <gridwin.hxx> #include <rtl/ustrbuf.hxx> #include <boost/checked_delete.hpp> #include <comphelper/processfactory.hxx> @@ -2115,7 +2116,7 @@ Window* ScViewData::GetDialogParent() return pViewShell->GetDialogParent(); } -Window* ScViewData::GetActiveWin() +ScGridWindow* ScViewData::GetActiveWin() { OSL_ENSURE( pView, "GetActiveWin() ohne View" ); return pView->GetActiveWin(); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 2f7375e3919e..d82e72558612 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -65,6 +65,7 @@ #include "undodat.hxx" #include "drawview.hxx" #include "cliputil.hxx" +#include <gridwin.hxx> #include <boost/scoped_ptr.hpp> using namespace com::sun::star; diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index 2e0575941e42..73432c6c9f3b 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -67,6 +67,7 @@ #include "compiler.hxx" #include "tokenarray.hxx" #include <refupdatecontext.hxx> +#include <gridwin.hxx> #include <boost/scoped_ptr.hpp> diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index ba35fe6c0612..4cf39cf8a205 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -46,6 +46,7 @@ #include "docsh.hxx" #include "convuno.hxx" #include "dragdata.hxx" +#include <gridwin.hxx> extern Point aDragStartDiff; |