[Libreoffice-commits] core.git: Branch 'feature/perfwork4' - svx/source
Kohei Yoshida
kohei.yoshida at collabora.com
Sat Nov 1 09:45:38 PDT 2014
svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx | 197 +++++++--------
1 file changed, 96 insertions(+), 101 deletions(-)
New commits:
commit 80c86ba81b38fe4085f7b588a2dbf24894a7f215
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Nov 1 12:43:07 2014 -0400
Unindent.
Change-Id: I1b65915b7d864f1a69f48fcacf38e7aec23c38a4
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index ca819b5..d80b309 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -32,129 +32,124 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <svtools/embedhlp.hxx>
-
using namespace com::sun::star;
+namespace sdr { namespace contact {
+const SdrOle2Obj& ViewObjectContactOfSdrOle2Obj::getSdrOle2Object() const
+{
+ return static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).GetOle2Obj();
+}
-namespace sdr
+drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence(
+ const DisplayInfo& /*rDisplayInfo*/) const
{
- namespace contact
+ // this method is overloaded to do some things the old SdrOle2Obj::DoPaintObject did.
+ // In the future, some of these may be solved different, but ATM try to stay compatible
+ // with the old behaviour
+ drawinglayer::primitive2d::Primitive2DSequence xRetval;
+ const SdrOle2Obj& rSdrOle2 = getSdrOle2Object();
+ sal_Int32 nState(-1);
+
{
- const SdrOle2Obj& ViewObjectContactOfSdrOle2Obj::getSdrOle2Object() const
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if ( xObjRef.is() )
+ nState = xObjRef->getCurrentState();
+ }
+
+ const bool bIsOutplaceActive(nState == embed::EmbedStates::ACTIVE);
+ const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE));
+ bool bDone(false);
+
+ if(!bDone && bIsInplaceActive)
+ {
+ if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() )
{
- return static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).GetOle2Obj();
+ //no need to create a primitive sequence here as the OLE object does render itself
+ //in case of charts the superfluous creation of a metafile is strongly performance relevant!
+ bDone = true;
}
+ }
- drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfSdrOle2Obj::createPrimitive2DSequence(
- const DisplayInfo& /*rDisplayInfo*/) const
+ if( !bDone )
+ {
+ //old stuff that should be reworked
{
- // this method is overloaded to do some things the old SdrOle2Obj::DoPaintObject did.
- // In the future, some of these may be solved different, but ATM try to stay compatible
- // with the old behaviour
- drawinglayer::primitive2d::Primitive2DSequence xRetval;
- const SdrOle2Obj& rSdrOle2 = getSdrOle2Object();
- sal_Int32 nState(-1);
-
+ //if no replacement image is available load the OLE object
+// if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925#
+// {
+// // try to create embedded object
+// rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already
+// }
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if(xObjRef.is())
{
- const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
- if ( xObjRef.is() )
- nState = xObjRef->getCurrentState();
- }
-
- const bool bIsOutplaceActive(nState == embed::EmbedStates::ACTIVE);
- const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE));
- bool bDone(false);
+ const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect()));
- if(!bDone && bIsInplaceActive)
- {
- if( !GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile() )
+ // this hack (to change model data during PAINT argh(!)) should be reworked
+ if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
{
- //no need to create a primitive sequence here as the OLE object does render itself
- //in case of charts the superfluous creation of a metafile is strongly performance relevant!
- bDone = true;
+ const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true);
}
- }
- if( !bDone )
- {
- //old stuff that should be reworked
+ SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
+ xObjRef.IsGLChart()))
{
- //if no replacement image is available load the OLE object
-// if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925#
-// {
-// // try to create embedded object
-// rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already
-// }
- const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
- if(xObjRef.is())
- {
- const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect()));
-
- // this hack (to change model data during PAINT argh(!)) should be reworked
- if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
- {
- const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true);
- }
-
- SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
- if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
- xObjRef.IsGLChart()))
- {
- // connect plugin object
- pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
- }
- }
- }//end old stuff to rework
-
- // create OLE primitive stuff directly at VC with HC as parameter
- const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
- xRetval = rVC.createPrimitive2DSequenceWithParameters();
-
- if(bIsOutplaceActive)
- {
- // do not shade when printing or PDF exporting
- if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
- {
- // get object transformation
- const basegfx::B2DHomMatrix aObjectMatrix(static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).createObjectTransform());
-
- // shade the representation if the object is activated outplace
- basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon());
- aObjectOutline.transform(aObjectMatrix);
-
- // Use a FillHatchPrimitive2D with necessary attributes
- const drawinglayer::attribute::FillHatchAttribute aFillHatch(
- drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch
- 125.0, // 1.25 mm
- 45.0 * F_PI180, // 45 degree diagonal
- Color(COL_BLACK).getBColor(), // black color
- 3, // same default as VCL, a minimum of three discrete units (pixels) offset
- false); // no filling
-
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(
- basegfx::B2DPolyPolygon(aObjectOutline),
- Color(COL_BLACK).getBColor(),
- aFillHatch));
-
- drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference);
- }
+ // connect plugin object
+ pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
}
-
}
+ }//end old stuff to rework
- return xRetval;
- }
+ // create OLE primitive stuff directly at VC with HC as parameter
+ const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
+ xRetval = rVC.createPrimitive2DSequenceWithParameters();
- ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact)
- : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+ if(bIsOutplaceActive)
{
+ // do not shade when printing or PDF exporting
+ if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
+ {
+ // get object transformation
+ const basegfx::B2DHomMatrix aObjectMatrix(static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).createObjectTransform());
+
+ // shade the representation if the object is activated outplace
+ basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon());
+ aObjectOutline.transform(aObjectMatrix);
+
+ // Use a FillHatchPrimitive2D with necessary attributes
+ const drawinglayer::attribute::FillHatchAttribute aFillHatch(
+ drawinglayer::attribute::HATCHSTYLE_SINGLE, // single hatch
+ 125.0, // 1.25 mm
+ 45.0 * F_PI180, // 45 degree diagonal
+ Color(COL_BLACK).getBColor(), // black color
+ 3, // same default as VCL, a minimum of three discrete units (pixels) offset
+ false); // no filling
+
+ const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::PolyPolygonHatchPrimitive2D(
+ basegfx::B2DPolyPolygon(aObjectOutline),
+ Color(COL_BLACK).getBColor(),
+ aFillHatch));
+
+ drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReference);
+ }
}
- ViewObjectContactOfSdrOle2Obj::~ViewObjectContactOfSdrOle2Obj()
- {
- }
- } // end of namespace contact
-} // end of namespace sdr
+ }
+
+ return xRetval;
+}
+
+ViewObjectContactOfSdrOle2Obj::ViewObjectContactOfSdrOle2Obj(ObjectContact& rObjectContact, ViewContact& rViewContact)
+: ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
+{
+}
+
+ViewObjectContactOfSdrOle2Obj::~ViewObjectContactOfSdrOle2Obj()
+{
+}
+
+}}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list