summaryrefslogtreecommitdiff
path: root/svx/source/svdraw
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-05-15 10:16:23 +0000
committerArmin Le Grand <alg@apache.org>2012-05-15 10:16:23 +0000
commit977a0eff5415a2a4716e02bfab8e69ffb64ad7ce (patch)
tree4017aa9746a9642c0aa7f73a49d246225910fe3f /svx/source/svdraw
parent328998206948c32dd45875e4c42e39def1a18371 (diff)
#118780# Moved ObjectInfoPrimitive2D extractor to drawinglayer, changed name to be the filename only, added code to SW to set Title and Desc
Notes
Diffstat (limited to 'svx/source/svdraw')
-rw-r--r--svx/source/svdraw/svdograf.cxx59
1 files changed, 59 insertions, 0 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index b3ec806cdfb5..18edd53c0662 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -67,6 +67,8 @@
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <osl/thread.hxx>
#include <vos/mutex.hxx>
+#include <drawinglayer/processor2d/objectinfoextractor2d.hxx>
+#include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::io;
@@ -309,6 +311,58 @@ sdr::contact::ViewContact* SdrGrafObj::CreateObjectSpecificViewContact()
}
//////////////////////////////////////////////////////////////////////////////
+// check if SVG and if try to get ObjectInfoPrimitive2D and extract info
+
+void SdrGrafObj::onGraphicChanged()
+{
+ String aName;
+ String aTitle;
+ String aDesc;
+
+ if(pGraphic)
+ {
+ const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData();
+
+ if(rSvgDataPtr.get())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(rSvgDataPtr->getPrimitive2DSequence());
+
+ if(aSequence.hasElements())
+ {
+ drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+ drawinglayer::processor2d::ObjectInfoPrimitiveExtractor2D aProcessor(aViewInformation2D);
+
+ aProcessor.process(aSequence);
+
+ const drawinglayer::primitive2d::ObjectInfoPrimitive2D* pResult = aProcessor.getResult();
+
+ if(pResult)
+ {
+ aName = pResult->getName();
+ aTitle = pResult->getTitle();
+ aDesc = pResult->getDesc();
+ }
+ }
+ }
+ }
+
+ if(aName.Len())
+ {
+ SetName(aName);
+ }
+
+ if(aTitle.Len())
+ {
+ SetTitle(aTitle);
+ }
+
+ if(aDesc.Len())
+ {
+ SetDescription(aDesc);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
TYPEINIT1(SdrGrafObj,SdrRectObj);
@@ -322,6 +376,7 @@ SdrGrafObj::SdrGrafObj()
pGraphic = new GraphicObject;
mpReplacementGraphic = 0;
pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ onGraphicChanged();
// #i118485# Shear allowed and possible now
bNoShear = false;
@@ -348,6 +403,7 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect)
pGraphic = new GraphicObject( rGrf );
mpReplacementGraphic = 0;
pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ onGraphicChanged();
// #i118485# Shear allowed and possible now
bNoShear = false;
@@ -374,6 +430,7 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf )
pGraphic = new GraphicObject( rGrf );
mpReplacementGraphic = 0;
pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT );
+ onGraphicChanged();
// #i118485# Shear allowed and possible now
bNoShear = false;
@@ -411,6 +468,7 @@ void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
mbIsPreview = sal_False;
SetChanged();
BroadcastObjectChange();
+ onGraphicChanged();
}
// -----------------------------------------------------------------------------
@@ -449,6 +507,7 @@ void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
mpReplacementGraphic = 0;
pGraphic->SetUserData();
mbIsPreview = sal_False;
+ onGraphicChanged();
}
void SdrGrafObj::SetGraphic( const Graphic& rGrf )