Kaydet (Commit) db1d2af0 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Caolán McNamara

Resolves: #i123539# some optimizations for 3D chart...

geometry creation using UNO API

(cherry picked from commit bbe35be7)

Change-Id: Ic9b6ab8fc31cfe585f7c75d85bafe4613910c57a
üst 2237604b
...@@ -37,6 +37,10 @@ namespace sdr ...@@ -37,6 +37,10 @@ namespace sdr
{ {
class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj class ViewContactOfSdrOle2Obj : public ViewContactOfSdrRectObj
{ {
private:
// #i123539# allow local buffering of chart data (if chart)
drawinglayer::primitive2d::Primitive2DReference mxChartContent;
protected: protected:
// Create a Object-Specific ViewObjectContact, set ViewContact and // Create a Object-Specific ViewObjectContact, set ViewContact and
// ObjectContact. Always needs to return something. // ObjectContact. Always needs to return something.
...@@ -62,6 +66,9 @@ namespace sdr ...@@ -62,6 +66,9 @@ namespace sdr
// from the VOC which knows that // from the VOC which knows that
drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters() const; drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceWithParameters() const;
// #i123539# get rid of buffered chart content (if there) on change
virtual void ActionChanged();
protected: protected:
// This method is responsible for creating the graphical visualisation data // This method is responsible for creating the graphical visualisation data
// ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false) // ONLY based on model data, just wraps to call createPrimitive2DSequenceWithParameters(false)
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <drawinglayer/geometry/viewinformation3d.hxx> #include <drawinglayer/geometry/viewinformation3d.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/e3dsceneupdater.hxx> #include <svx/e3dsceneupdater.hxx>
#include <svx/svdmodel.hxx>
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -379,7 +380,14 @@ void E3dScene::NewObjectInserted(const E3dObject* p3DObj) ...@@ -379,7 +380,14 @@ void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
void E3dScene::StructureChanged() void E3dScene::StructureChanged()
{ {
E3dObject::StructureChanged(); E3dObject::StructureChanged();
SetRectsDirty();
if(!GetModel() || !GetModel()->isLocked())
{
// #i123539# optimization for 3D chart object generation: do not reset
// already calculated scene projection data every time an object gets
// initialized
SetRectsDirty();
}
ImpCleanup3DDepthMapper(); ImpCleanup3DDepthMapper();
} }
......
...@@ -51,7 +51,8 @@ namespace sdr ...@@ -51,7 +51,8 @@ namespace sdr
} }
ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj) ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj)
: ViewContactOfSdrRectObj(rOle2Obj) : ViewContactOfSdrRectObj(rOle2Obj),
mxChartContent()
{ {
} }
...@@ -100,30 +101,45 @@ namespace sdr ...@@ -100,30 +101,45 @@ namespace sdr
if(GetOle2Obj().IsChart()) if(GetOle2Obj().IsChart())
{ {
// try to get chart primitives and chart range directly from xChartModel // #i123539# allow buffering and reuse of local chart data to not need to rebuild it
basegfx::B2DRange aChartContentRange; // on every ViewObjectContact::getPrimitive2DSequence call. TTTT: No tneeded for
const drawinglayer::primitive2d::Primitive2DSequence aChartSequence( // aw080, there this mechanism alraedy works differently
ChartHelper::tryToGetChartContentAsPrimitive2DSequence( if(mxChartContent.is())
GetOle2Obj().getXModel(),
aChartContentRange));
const double fWidth(aChartContentRange.getWidth());
const double fHeight(aChartContentRange.getHeight());
if(aChartSequence.hasElements()
&& basegfx::fTools::more(fWidth, 0.0)
&& basegfx::fTools::more(fHeight, 0.0))
{ {
// create embedding transformation xContent = mxChartContent;
basegfx::B2DHomMatrix aEmbed( }
basegfx::tools::createTranslateB2DHomMatrix( else
-aChartContentRange.getMinX(), {
-aChartContentRange.getMinY())); // try to get chart primitives and chart range directly from xChartModel
basegfx::B2DRange aChartContentRange;
aEmbed.scale(1.0 / fWidth, 1.0 / fHeight); const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
aEmbed = aObjectMatrix * aEmbed; ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
xContent = new drawinglayer::primitive2d::TransformPrimitive2D( GetOle2Obj().getXModel(),
aEmbed, aChartContentRange));
aChartSequence); const double fWidth(aChartContentRange.getWidth());
const double fHeight(aChartContentRange.getHeight());
if(aChartSequence.hasElements()
&& basegfx::fTools::more(fWidth, 0.0)
&& basegfx::fTools::more(fHeight, 0.0))
{
// create embedding transformation
basegfx::B2DHomMatrix aEmbed(
basegfx::tools::createTranslateB2DHomMatrix(
-aChartContentRange.getMinX(),
-aChartContentRange.getMinY()));
aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
aEmbed = aObjectMatrix * aEmbed;
xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
aEmbed,
aChartSequence);
}
if(xContent.is())
{
const_cast< ViewContactOfSdrOle2Obj* >(this)->mxChartContent = xContent;
}
} }
} }
...@@ -154,6 +170,18 @@ namespace sdr ...@@ -154,6 +170,18 @@ namespace sdr
return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); return drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
} }
void ViewContactOfSdrOle2Obj::ActionChanged()
{
// call parent
ViewContactOfSdrRectObj::ActionChanged();
// #i123539# if we have buffered chart data, reset it
if(mxChartContent.is())
{
mxChartContent.clear();
}
}
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createViewIndependentPrimitive2DSequence() const
{ {
return createPrimitive2DSequenceWithParameters(); return createPrimitive2DSequenceWithParameters();
......
...@@ -1253,7 +1253,15 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize ) ...@@ -1253,7 +1253,15 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
if( mpObj.is() && mpModel) if( mpObj.is() && mpModel)
{ {
Rectangle aRect( svx_getLogicRectHack(mpObj.get()) ); // #i123539# optimization for 3D chart object generation: do not use UNO
// API commmands to get the range, this is too expensive since for 3D
// scenes it may recalculate the whole scene since in AOO this depends
// on the contained geometry (layouted to show all content)
const bool b3DConstruction(dynamic_cast< E3dObject* >(mpObj.get()) && mpModel->isLocked());
Rectangle aRect(
b3DConstruction ?
Rectangle(maPosition.X, maPosition.Y, maSize.Width, maSize.Height) :
svx_getLogicRectHack(mpObj.get()) );
Size aLocalSize( rSize.Width, rSize.Height ); Size aLocalSize( rSize.Width, rSize.Height );
ForceMetricToItemPoolMetric(aLocalSize); ForceMetricToItemPoolMetric(aLocalSize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment