[Libreoffice-commits] core.git: Branch 'feature/chart_opengl_window' - 5 commits - chart2/Library_chartcontroller.mk chart2/source embeddedobj/Library_embobj.mk embeddedobj/source include/svtools include/svx sc/source sfx2/source svtools/source svx/source sw/source
Zolnai Tamás
tamas.zolnai at collabora.com
Mon Aug 11 00:57:58 PDT 2014
chart2/Library_chartcontroller.mk | 1
chart2/source/controller/main/ChartController.cxx | 3
chart2/source/controller/main/ChartWindow.cxx | 35 +++++++-
chart2/source/controller/main/ChartWindow.hxx | 9 +-
chart2/source/model/main/ChartModel.cxx | 1
chart2/source/view/charttypes/GL3DBarChart.cxx | 61 ++++++++-------
chart2/source/view/inc/AbstractShapeFactory.hxx | 2
chart2/source/view/inc/GL3DBarChart.hxx | 6 -
chart2/source/view/inc/OpenglShapeFactory.hxx | 2
chart2/source/view/inc/ShapeFactory.hxx | 2
chart2/source/view/main/ChartView.cxx | 16 +++
chart2/source/view/main/DummyXShape.hxx | 1
chart2/source/view/main/OpenglShapeFactory.cxx | 6 +
embeddedobj/Library_embobj.mk | 1
embeddedobj/source/general/docholder.cxx | 10 +-
include/svtools/embedhlp.hxx | 4
include/svx/charthelper.hxx | 10 --
sc/source/ui/drawfunc/fuins2.cxx | 18 ----
sfx2/source/view/ipclient.cxx | 6 -
sfx2/source/view/viewsh.cxx | 4
svtools/source/misc/embedhlp.cxx | 38 ++++++---
svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx | 3
svx/source/svdraw/charthelper.cxx | 21 -----
svx/source/svdraw/svdoole2.cxx | 6 -
sw/source/core/doc/notxtfrm.cxx | 7 -
sw/source/core/layout/paintfrm.cxx | 3
sw/source/core/unocore/unochart.cxx | 3
27 files changed, 161 insertions(+), 118 deletions(-)
New commits:
commit ce7bde55ffcef92a7cbb2fea4ebc7bc9a55a96f6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Mon Aug 11 09:54:20 2014 +0200
Make opengl chart window always active
Fortunately there is a special ole object group with
the MS_EMBED_ACTIVATEWHENVISIBLE flag which define this
behaviour.
Problem is that both Aspect and EmbedMisc are MS specific
enums so we can't use them directly for non-MS objects. But we
can handle opengl charts the same as this ole object group.
Change-Id: I49abeffce319cbb775709a72ba198a1f76b65374
diff --git a/embeddedobj/Library_embobj.mk b/embeddedobj/Library_embobj.mk
index f2a971b..7de4e48 100644
--- a/embeddedobj/Library_embobj.mk
+++ b/embeddedobj/Library_embobj.mk
@@ -26,6 +26,7 @@ $(eval $(call gb_Library_use_libraries,embobj,\
cppu \
cppuhelper \
sal \
+ svt \
vcl \
tl \
$(gb_UWINAPI) \
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index bd0494f..783c99b 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -64,6 +64,7 @@
#include <osl/diagnose.h>
#include <rtl/process.h>
#include <vcl/svapp.hxx>
+#include <svtools/embedhlp.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -72,9 +73,9 @@
#include "commonembobj.hxx"
#include "intercept.hxx"
-
-#define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \
- m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
+#define HATCH_BORDER_WIDTH ((((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || \
+ (svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj)) ) && \
+ m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
using namespace ::com::sun::star;
@@ -1256,7 +1257,8 @@ awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectan
void SAL_CALL DocumentHolder::activated( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{
- if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) )
+ if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj) )
{
if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE &&
!(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 30d690c..f157ce6 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -68,6 +68,7 @@ public:
throw();
static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
+ static bool IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
@@ -109,6 +110,7 @@ public:
bool IsLocked() const;
bool IsChart() const;
+ bool IsGLChart() const;
OUString GetChartType();
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index da40379..6700ec9 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -1048,7 +1048,8 @@ void SfxInPlaceClient::DeactivateObject()
m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true);
- if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
{
m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
if (bHasFocus)
@@ -1081,7 +1082,8 @@ void SfxInPlaceClient::ResetObject()
try
{
m_pImp->m_bUIActive = false;
- if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
{
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index c4cd7c2..2f2da57 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -43,6 +43,7 @@
#include <unotools/pathoptions.hxx>
#include <svtools/miscopt.hxx>
#include <svtools/soerr.hxx>
+#include <svtools/embedhlp.hxx>
#include <basic/basmgr.hxx>
#include <basic/sbuno.hxx>
@@ -1734,7 +1735,8 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
bool bAlwaysActive =
( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
bool bActiveWhenVisible =
- ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 );
+ ( (( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ) ||
+ svt::EmbeddedObjectRef::IsGLChart(pIPClient->GetObject()));
// this method is called when either a client is created or the "Edit/Plugins" checkbox is checked
if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive )
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 03f18df..4e96ff3 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -790,6 +790,11 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::
return false;
}
+bool EmbeddedObjectRef::IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
+{
+ return IsChart(xObj) && getenv("CHART_DUMMY_FACTORY");
+}
+
void EmbeddedObjectRef::UpdateReplacement()
{
GetReplacement( true );
@@ -823,6 +828,14 @@ bool EmbeddedObjectRef::IsChart() const
return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
}
+bool EmbeddedObjectRef::IsGLChart() const
+{
+ if (!mpImpl->mxObj.is())
+ return false;
+
+ return EmbeddedObjectRef::IsGLChart(mpImpl->mxObj);
+}
+
// MT: Only used for getting accessible attributes, which are not localized
OUString EmbeddedObjectRef::GetChartType()
{
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index 10f6490..ca819b5 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -98,7 +98,8 @@ namespace sdr
}
SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
- if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
+ if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ xObjRef.IsGLChart()))
{
// connect plugin object
pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 42482ff..d25480c 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -396,7 +396,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
try
{
- if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ if ( (xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ svt::EmbeddedObjectRef::IsGLChart(xObject) )
xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else
{
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index bc67153..6618930 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1055,8 +1055,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
- if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
- nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ if ( !bPrn && pShell->ISA( SwCrsrShell ) && (
+ (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ pOLENd->GetOLEObj().GetObject().IsGLChart()))
{
const SwFlyFrm *pFly = FindFlyFrm();
assert( pFly != NULL );
commit 4b6e12b2b6f0022ce24e56fef26ca36030374165
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sun Aug 10 17:18:16 2014 +0200
ChartHelper::IsChart is useless
EmbeddedObjectRef has an own IsChart method with the same
behavior.
Change-Id: Ib06699186466bf3da2bd67d7c631a5216463fb14
diff --git a/include/svx/charthelper.hxx b/include/svx/charthelper.hxx
index 296fccc..bfa1bf78 100644
--- a/include/svx/charthelper.hxx
+++ b/include/svx/charthelper.hxx
@@ -27,19 +27,9 @@
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
-
-// predeclarations
-
-namespace svt { class EmbeddedObjectRef; }
-
-
-
class SVX_DLLPUBLIC ChartHelper
{
public:
- // test if given reference is a chart
- static bool IsChart(const svt::EmbeddedObjectRef& xObjRef);
-
// try to access rXModel in case of a chart to to get the chart content
// as sequence of primitives. Return range of primitives (chart size) in rRange;
// it will be used to embed the chart to the SdrObject transformation. This
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
index 6273aa8..86c0a84 100644
--- a/svx/source/svdraw/charthelper.cxx
+++ b/svx/source/svdraw/charthelper.cxx
@@ -18,7 +18,6 @@
*/
#include <svx/charthelper.hxx>
-#include <svtools/embedhlp.hxx>
#include <tools/globname.hxx>
#include <comphelper/classids.hxx>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
@@ -35,26 +34,6 @@
using namespace ::com::sun::star;
-bool ChartHelper::IsChart(const svt::EmbeddedObjectRef& xObjRef)
-{
- if(!xObjRef.is())
- {
- return false;
- }
-
- const SvGlobalName aObjClsId(xObjRef->getClassID());
-
- if(SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
- {
- return true;
- }
-
- return false;
-}
-
drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
const uno::Reference< ::frame::XModel >& rXModel,
basegfx::B2DRange& rRange)
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index d1348c6..42482ff 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -72,7 +72,6 @@
#include <svx/svdetc.hxx>
#include <svx/svdview.hxx>
#include "unomlstr.hxx"
-#include <svx/charthelper.hxx>
#include <sdr/contact/viewcontactofsdrole2obj.hxx>
#include <svx/svdograf.hxx>
#include <sdr/properties/oleproperties.hxx>
@@ -2148,7 +2147,7 @@ bool SdrOle2Obj::IsChart() const
{
if (!mpImpl->mbTypeAsked)
{
- mpImpl->mbIsChart = ChartHelper::IsChart(mpImpl->mxObjRef);
+ mpImpl->mbIsChart = mpImpl->mxObjRef.IsChart();
mpImpl->mbTypeAsked = true;
}
return mpImpl->mbIsChart;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index c6bae4a..bc67153 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -845,7 +845,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
pOut->GetConnectMetaFile();
- const bool bIsChart = pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() );
+ const bool bIsChart = pOLENd && pOLENd->GetOLEObj().GetObject().IsChart();
// calculate aligned rectangle from parameter <rGrfArea>.
// Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6c7631c..baa7b76 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -74,7 +74,6 @@
#include <IDocumentDrawModelAccess.hxx>
#include <ndole.hxx>
-#include <svx/charthelper.hxx>
#include <PostItMgr.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -4102,7 +4101,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
if( pNoTNd )
{
SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
- if( pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() ) )
+ if( pOLENd && pOLENd->GetOLEObj().GetObject().IsChart() )
bIsChart = true;
}
}
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index d4ab877..1dea221 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -26,7 +26,6 @@
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svl/zforlist.hxx>
-#include <svx/charthelper.hxx>
#include <XMLRangeHelper.hxx>
#include <unochart.hxx>
@@ -64,7 +63,7 @@ void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc )
{
++aIdx;
if (0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
- ChartHelper::IsChart( pONd->GetOLEObj().GetObject() ) )
+ pONd->GetOLEObj().GetObject().IsChart() )
{
// Load the object and set modified
commit 5bbf26c82455b062b961eefa7d9b7761db830563
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sun Aug 10 16:47:39 2014 +0200
Add a method to check whether an XEmbeddedObject is a chart
Change-Id: I6f860b9f1bce200c5366df0a32650705cf429a80
diff --git a/include/svtools/embedhlp.hxx b/include/svtools/embedhlp.hxx
index 49763a2..30d690c 100644
--- a/include/svtools/embedhlp.hxx
+++ b/include/svtools/embedhlp.hxx
@@ -67,6 +67,8 @@ public:
OUString* pMediaType )
throw();
+ static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
+
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index c1c3462..03f18df 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -775,6 +775,21 @@ uno::Reference< io::XInputStream > EmbeddedObjectRef::GetGraphicReplacementStrea
return ::comphelper::EmbeddedObjectContainer::GetGraphicReplacementStream(nViewAspect,xObj,pMediaType);
}
+bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
+{
+ SvGlobalName aObjClsId(xObj->getClassID());
+ if(
+ SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
+ || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
+ || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
+ || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
+ {
+ return true;
+ }
+
+ return false;
+}
+
void EmbeddedObjectRef::UpdateReplacement()
{
GetReplacement( true );
@@ -805,17 +820,7 @@ bool EmbeddedObjectRef::IsChart() const
if (!mpImpl->mxObj.is())
return false;
- SvGlobalName aObjClsId(mpImpl->mxObj->getClassID());
- if(
- SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId
- || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId)
- {
- return true;
- }
-
- return false;
+ return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
}
// MT: Only used for getting accessible attributes, which are not localized
commit c501ebefe816ddb07e85882831032e23fb8ee4b2
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Fri Aug 8 13:44:42 2014 +0200
Fix OpenGL chart reinitialiation
Problem after ChartWindow was disabled and enabled
again, OpenGL content was lost.
Two things:
-After setting a new OpenGLWindow the corresponding
IRenderer must be set (x3DWindowProvider->update)
-InitOpenGL() call should not depend on DummyChart, but on
OpenGLWindow (OpenGLContext).
Change-Id: If74e1945de9973d3921ceea1ca6fef39311add7a
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 37335c4..40e6933 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -64,6 +64,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
x3DWindowProvider->setWindow(nWindowPtr);
+ x3DWindowProvider->update();
}
ChartWindow::~ChartWindow()
@@ -72,6 +73,7 @@ ChartWindow::~ChartWindow()
{
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
x3DWindowProvider->setWindow(0);
+ x3DWindowProvider->update();
}
delete m_pOpenGLWindow;
}
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 9cb3e47..3e55165 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -238,7 +238,7 @@ public:
/**
* Only necessary for stateless implementations
*/
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape, bool bInitOpenGL = true) = 0;
virtual bool preRender(OpenGLWindow* pWindow) = 0;
virtual void postRender(OpenGLWindow* pWindow) = 0;
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index 896249e..7907d0d 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -184,7 +184,7 @@ public:
virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize ) SAL_OVERRIDE;
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xDrawPage) SAL_OVERRIDE;
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xDrawPage, bool bInitOpenGL = true) SAL_OVERRIDE;
virtual bool preRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
virtual void postRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 171daad..480c1b1 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -197,7 +197,7 @@ public:
/**
* not necessary right now
*/
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >, bool ) SAL_OVERRIDE {}
virtual bool preRender(OpenGLWindow*) SAL_OVERRIDE { return true; }
virtual void postRender(OpenGLWindow*) SAL_OVERRIDE {}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 7378c79..c857299 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -141,6 +141,7 @@ public:
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
+ const OpenGLWindow* getOpenGLWindow() const;
void updateOpenGLWindow();
private:
ChartView* mpView;
@@ -183,6 +184,11 @@ void GL2DRenderer::contextDestroyed()
mbContextDestroyed = true;
}
+const OpenGLWindow* GL2DRenderer::getOpenGLWindow() const
+{
+ return mpWindow;
+}
+
void GL2DRenderer::updateOpenGLWindow()
{
if(mbContextDestroyed)
@@ -2705,7 +2711,7 @@ void ChartView::render()
bool bRender = pShapeFactory->preRender(pWindow);
if(bRender)
{
- pShapeFactory->render(mxRootShape);
+ pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
pShapeFactory->postRender(pWindow);
}
}
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index ee9e1af..54f5df4 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -395,6 +395,7 @@ public:
virtual void render() SAL_OVERRIDE;
void clear();
+ void invalidateInit() { mbNotInit = true; }
TextCache& getTextCache() { return maTextCache;}
private:
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index c486f01..a26024e 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -446,9 +446,13 @@ uno::Reference< drawing::XShape >
return pText;
}
-void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
+void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape, bool bInitOpenGL)
{
dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
+ if(bInitOpenGL)
+ {
+ rChart.invalidateInit();
+ }
rChart.render();
}
commit d48fb0afc3d3165a93904f5a1ba66b1f200d4f37
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sat May 17 04:32:58 2014 +0200
opengl charts: Move the init from sc to chart2, to have the right parent.
Conflicts:
chart2/source/view/charttypes/GL3DBarChart.cxx
Change-Id: I1e23329345e00e7d8e1f269c832e84d015824c0a
diff --git a/chart2/Library_chartcontroller.mk b/chart2/Library_chartcontroller.mk
index f77ef70..b147fc1 100644
--- a/chart2/Library_chartcontroller.mk
+++ b/chart2/Library_chartcontroller.mk
@@ -43,6 +43,7 @@ $(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 b57045d..d5eca79 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 917d69e..37335c4 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 ec5c05b..ee5884f 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();
};
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index f65f540..ed0d24e 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -1412,7 +1412,6 @@ 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 2baecf7..ae91356 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -94,8 +94,8 @@ void RenderThread::renderFrame()
if(!mpChart->mbValidContext)
return;
- mpChart->mrWindow.getContext().makeCurrent();
- Size aSize = mpChart->mrWindow.GetSizePixel();
+ mpChart->mpWindow->getContext().makeCurrent();
+ Size aSize = mpChart->mpWindow->GetSizePixel();
mpChart->mpRenderer->SetSize(aSize);
if(mpChart->mbNeedsNewRender)
{
@@ -112,7 +112,7 @@ void RenderThread::renderFrame()
}
mpChart->mpRenderer->ProcessUnrenderedShape(mpChart->mbNeedsNewRender);
mpChart->mbNeedsNewRender = false;
- mpChart->mrWindow.getContext().swapBuffers();
+ mpChart->mpWindow->getContext().swapBuffers();
}
@@ -417,10 +417,10 @@ void RenderBenchMarkThread::execute()
GL3DBarChart::GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow& rWindow) :
+ OpenGLWindow* pWindow) :
mxChartType(xChartType),
mpRenderer(new opengl3D::OpenGL3DRenderer()),
- mrWindow(rWindow),
+ mpWindow(pWindow),
mpCamera(NULL),
mbValidContext(true),
mpTextCache(new opengl3D::TextCache()),
@@ -448,9 +448,14 @@ GL3DBarChart::GL3DBarChart(
}
}
}
- Size aSize = mrWindow.GetSizePixel();
+ Size aSize;
+ if (mpWindow)
+ {
+ mpWindow->setRenderer(this);
+ Size aSize = mpWindow->GetSizePixel();
+ }
mpRenderer->SetSize(aSize);
- mrWindow.setRenderer(this);
+ mpWindow->setRenderer(this);
mpRenderer->init();
}
@@ -474,8 +479,8 @@ GL3DBarChart::~GL3DBarChart()
if(mpRenderThread.is())
mpRenderThread->join();
- if(mbValidContext)
- mrWindow.setRenderer(NULL);
+ if(mbValidContext && mpWindow)
+ mpWindow->setRenderer(NULL);
}
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
@@ -560,7 +565,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
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;
}
@@ -681,10 +686,10 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
mpRenderer->SetScrollSpeed((float)(BAR_SIZE_X + BAR_DISTANCE_X) / (float)miScrollRate);
mpRenderer->SetScrollDistance((float)(BAR_SIZE_X + BAR_DISTANCE_X));
}
- Size aSize = mrWindow.GetSizePixel();
- mrWindow.getContext().setWinSize(aSize);
+ Size aSize = mpWindow->GetSizePixel();
+ mpWindow->getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderBenchMarkThread(this));
- mrWindow.getContext().resetCurrent();
+ mpWindow->getContext().resetCurrent();
mpRenderThread->launch();
}
mbNeedsNewRender = true;
@@ -696,10 +701,10 @@ void GL3DBarChart::update()
return;
if(mpRenderThread.is())
mpRenderThread->join();
- Size aSize = mrWindow.GetSizePixel();
- mrWindow.getContext().setWinSize(aSize);
+ Size aSize = mpWindow->GetSizePixel();
+ mpWindow->getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderOneFrameThread(this));
- mrWindow.getContext().resetCurrent();
+ mpWindow->getContext().resetCurrent();
mpRenderThread->launch();
}
@@ -745,10 +750,10 @@ void GL3DBarChart::moveToDefault()
mpRenderThread->join();
osl::MutexGuard aGuard(maMutex);
- Size aSize = mrWindow.GetSizePixel();
- mrWindow.getContext().setWinSize(aSize);
+ Size aSize = mpWindow->GetSizePixel();
+ mpWindow->getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maDefaultCameraPosition, STEPS));
- mrWindow.getContext().resetCurrent();
+ mpWindow->getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -812,10 +817,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 = mrWindow.GetSizePixel();
- mrWindow.getContext().setWinSize(aSize);
+ Size aSize = mpWindow->GetSizePixel();
+ mpWindow->getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition, maTargetPosition, STEPS));
- mrWindow.getContext().resetCurrent();
+ mpWindow->getContext().resetCurrent();
mpRenderThread->launch();
/*
@@ -901,11 +906,11 @@ void GL3DBarChart::moveToCorner()
osl::MutexGuard aGuard(maMutex);
- Size aSize = mrWindow.GetSizePixel();
- mrWindow.getContext().setWinSize(aSize);
+ Size aSize = mpWindow->GetSizePixel();
+ mpWindow->getContext().setWinSize(aSize);
mpRenderThread = rtl::Reference<RenderThread>(new RenderAnimationThread(this, maCameraPosition,
getCornerPosition(mnCornerId), STEPS));
- mrWindow.getContext().resetCurrent();
+ mpWindow->getContext().resetCurrent();
mpRenderThread->launch();
// TODO: moggi: add to thread
@@ -932,6 +937,12 @@ 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 7b1e7b6..a6a7bfa 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -64,7 +64,7 @@ class GL3DBarChart : public GL3DPlotterBase, public IRenderer
public:
GL3DBarChart(
const css::uno::Reference<css::chart2::XChartType>& xChartType,
- OpenGLWindow& rContext);
+ OpenGLWindow* pContext);
virtual ~GL3DBarChart();
@@ -80,6 +80,8 @@ public:
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
+ void setOpenGLWindow(OpenGLWindow* pWindow);
+
private:
void moveToCorner();
@@ -90,7 +92,7 @@ private:
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
- OpenGLWindow& mrWindow;
+ OpenGLWindow* mpWindow;
opengl3D::Camera* mpCamera;
bool mbValidContext;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 902705b..7378c79 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3190,7 +3190,13 @@ void ChartView::createShapes3D()
if (!m_pGL3DPlotter)
{
- m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, *pWindow));
+ m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, pWindow));
+ }
+ else
+ {
+ GL3DBarChart* pChart = dynamic_cast<GL3DBarChart*>(m_pGL3DPlotter.get());
+ if (pChart)
+ pChart->setOpenGLWindow(pWindow);
}
uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx
index fa9dbfd..0a7703d7 100644
--- a/sc/source/ui/drawfunc/fuins2.cxx
+++ b/sc/source/ui/drawfunc/fuins2.cxx
@@ -544,22 +544,6 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
ScDocument& rScDoc = pScDocSh->GetDocument();
bool bUndo (rScDoc.IsUndoEnabled());
- Window* pParentWindow = rData.GetActiveWin();
- OpenGLWindow* pChildWindow = new OpenGLWindow(pParentWindow);
- Size aWindowSize = pChildWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
- pChildWindow->SetSizePixel(aWindowSize);
- pChildWindow->Show();
- uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider( xChartModel, uno::UNO_QUERY_THROW );
- sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(pChildWindow);
- x3DWindowProvider->setWindow(nWindowPtr);
- ScGridWindow* pGridWindow = dynamic_cast<ScGridWindow*>(pParentWindow);
- if(pGridWindow)
- {
- pGridWindow->AddChildWindow(pChildWindow);
- }
- else
- SAL_WARN("sc", "not a grid window. You are in serious trouble");
-
if( pReqArgs )
{
const SfxPoolItem* pItem;
@@ -634,7 +618,6 @@ 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);
@@ -729,7 +712,6 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, Window* pWin, ScDrawView*
sal_Int16 nDialogRet = xDialog->execute();
if( nDialogRet == ui::dialogs::ExecutableDialogResults::CANCEL )
{
- pGridWindow->DeleteChildWindow(pChildWindow);
// leave OLE inplace mode and unmark
OSL_ASSERT( pViewShell );
OSL_ASSERT( pView );
More information about the Libreoffice-commits
mailing list