diff options
author | Armin Le Grand <alg@apache.org> | 2014-02-18 21:18:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-19 20:29:12 +0000 |
commit | db1d2af02861b49e4f53d726d59cd71c20cee9b1 (patch) | |
tree | a4edfc1235314f5e3d03c45a52863a052ad19286 /svx/source/sdr | |
parent | 2237604b6b1d08439ac37f096a787c449a046b5f (diff) |
Resolves: #i123539# some optimizations for 3D chart...
geometry creation using UNO API
(cherry picked from commit bbe35be767d76d08891c4f3d3600d80e0e6805f2)
Change-Id: Ic9b6ab8fc31cfe585f7c75d85bafe4613910c57a
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/contact/viewcontactofsdrole2obj.cxx | 76 |
1 files changed, 52 insertions, 24 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 9aa5d07db16b..9be07d1c25f4 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -51,7 +51,8 @@ namespace sdr } ViewContactOfSdrOle2Obj::ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj) - : ViewContactOfSdrRectObj(rOle2Obj) + : ViewContactOfSdrRectObj(rOle2Obj), + mxChartContent() { } @@ -100,30 +101,45 @@ namespace sdr if(GetOle2Obj().IsChart()) { - // try to get chart primitives and chart range directly from xChartModel - basegfx::B2DRange aChartContentRange; - const drawinglayer::primitive2d::Primitive2DSequence aChartSequence( - ChartHelper::tryToGetChartContentAsPrimitive2DSequence( - 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)) + // #i123539# allow buffering and reuse of local chart data to not need to rebuild it + // on every ViewObjectContact::getPrimitive2DSequence call. TTTT: No tneeded for + // aw080, there this mechanism alraedy works differently + if(mxChartContent.is()) { - // 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); + xContent = mxChartContent; + } + else + { + // try to get chart primitives and chart range directly from xChartModel + basegfx::B2DRange aChartContentRange; + const drawinglayer::primitive2d::Primitive2DSequence aChartSequence( + ChartHelper::tryToGetChartContentAsPrimitive2DSequence( + 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 + 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 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 { return createPrimitive2DSequenceWithParameters(); |