summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-05-15 10:16:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-03-16 10:18:02 +0000
commitbd55f05b332c1573bd410fd9e21ea7fcf977e1b0 (patch)
tree08f503f79525d95d88b36a9546b1e41cc00b1cfb /svx
parent409ba4cc0b55e3dc1d3a08c2fb543bc59c4c0da9 (diff)
Resolves: #i118780# Moved ObjectInfoPrimitive2D extractor to drawinglayer...
changed name to be the filename only, added code to SW to set Title and Desc Conflicts: drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk svx/source/svdraw/svdograf.cxx sw/inc/ndgrf.hxx sw/source/core/doc/doc.cxx sw/source/core/doc/notxtfrm.cxx sw/source/core/docnode/swbaslnk.cxx sw/source/core/graphic/ndgrf.cxx sw/source/filter/rtf/rtffly.cxx Change-Id: Id433031958529498441574dafe2fbd5261371efc
Notes
Notes: merged as: 977a0eff5415a2a4716e02bfab8e69ffb64ad7ce
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/svdograf.hxx1
-rw-r--r--svx/source/svdraw/svdograf.cxx59
2 files changed, 60 insertions, 0 deletions
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index ba50873914ae..1399ca9f629a 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -116,6 +116,7 @@ private:
bool ImpUpdateGraphicLink( bool bAsynchron = true ) const;
void ImpSetLinkedGraphic( const Graphic& rGraphic );
DECL_LINK( ImpSwapHdl, GraphicObject* );
+ void onGraphicChanged();
public:
TYPEINFO();
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index dfdc9adfe6c8..c9622d1ca5e2 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -58,6 +58,8 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <osl/thread.hxx>
+#include <drawinglayer/processor2d/objectinfoextractor2d.hxx>
+#include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -302,6 +304,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);
@@ -315,6 +369,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;
@@ -340,6 +395,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;
@@ -365,6 +421,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;
@@ -401,6 +458,7 @@ void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj )
mbIsPreview = false;
SetChanged();
BroadcastObjectChange();
+ onGraphicChanged();
}
// -----------------------------------------------------------------------------
@@ -439,6 +497,7 @@ void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf )
mpReplacementGraphic = 0;
pGraphic->SetUserData();
mbIsPreview = false;
+ onGraphicChanged();
}
void SdrGrafObj::SetGraphic( const Graphic& rGrf )