update dev300-m57
[ooovba.git] / applied_patches / 0305-sc-export-shape-hlink-bindings.diff
blob317f5158139844e71c95df5a024219eafbf9764a
1 diff --git sc/source/filter/excel/xecontent.cxx sc/source/filter/excel/xecontent.cxx
2 index 083cf7a..f9588b6 100644
3 --- sc/source/filter/excel/xecontent.cxx
4 +++ sc/source/filter/excel/xecontent.cxx
5 @@ -461,12 +461,17 @@ void XclExpHyperlink::WriteBody( XclExpStream& rStrm )
7 sal_uInt16 nXclCol = static_cast< sal_uInt16 >( maScPos.Col() );
8 sal_uInt16 nXclRow = static_cast< sal_uInt16 >( maScPos.Row() );
9 - mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
10 + rStrm << nXclRow << nXclRow << nXclCol << nXclCol;
11 + WriteEmbeddedData( rStrm );
14 - rStrm << nXclRow << nXclRow << nXclCol << nXclCol
15 - << XclTools::maGuidStdLink
16 +void XclExpHyperlink::WriteEmbeddedData( XclExpStream& rStrm )
18 + rStrm << XclTools::maGuidStdLink
19 << sal_uInt32( 2 )
20 << mnFlags;
22 + mxVarData->Seek( STREAM_SEEK_TO_BEGIN );
23 rStrm.CopyFromStream( *mxVarData );
26 diff --git sc/source/filter/inc/xcl97esc.hxx sc/source/filter/inc/xcl97esc.hxx
27 index efb9076..3703827 100644
28 --- sc/source/filter/inc/xcl97esc.hxx
29 +++ sc/source/filter/inc/xcl97esc.hxx
30 @@ -55,12 +55,13 @@ class XclExpOcxControlObj;
31 class XclExpTbxControlObj;
32 #endif
33 class XclExpShapeObj;
35 +class EscherExHostAppData;
36 class ShapeInteractionHelper
38 public:
39 static XclExpShapeObj* CreateShapeObj(const XclExpRoot& rRoot, const ::com::sun::star::uno::Reference<
40 ::com::sun::star::drawing::XShape >& xShape );
41 + static void PopulateShapeInteractionInfo( const XclExpRoot& rRoot, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, EscherExHostAppData& rHostAppData );
44 class XclEscherEx : public EscherEx, protected XclExpRoot
45 diff --git sc/source/filter/xcl97/xcl97esc.cxx sc/source/filter/xcl97/xcl97esc.cxx
46 diff --git sc/source/filter/inc/xecontent.hxx sc/source/filter/inc/xecontent.hxx
47 index 729d653..aeb6c13 100644
48 --- sc/source/filter/inc/xecontent.hxx
49 +++ sc/source/filter/inc/xecontent.hxx
50 @@ -116,6 +116,8 @@ public:
51 inline const String* GetRepr() const { return mxRepr.get(); }
53 virtual void SaveXml( XclExpXmlStream& rStrm );
55 + virtual void WriteEmbeddedData( XclExpStream& rStrm );
56 private:
57 /** Builds file name from the passed file URL. Tries to convert to relative file name.
58 @param rnLevel (out-param) The parent directory level.
59 index aaa0316..cf9da11 100644
60 --- sc/source/filter/xcl97/xcl97esc.cxx
61 +++ sc/source/filter/xcl97/xcl97esc.cxx
62 @@ -58,6 +58,9 @@
63 #include "global.hxx"
64 #include "document.hxx"
65 #include "drwlayer.hxx"
66 +#include "xecontent.hxx"
67 +#include <svx/flditem.hxx>
68 +#include "userdat.hxx"
69 #include "xcl97rec.hxx"
70 #include "xehelper.hxx"
71 #include "xechart.hxx"
72 @@ -233,6 +236,7 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen
73 // #107540# ignore permanent note shapes
74 // #i12190# do not ignore callouts (do not filter by object type ID)
75 pCurrXclObj = ShapeInteractionHelper::CreateShapeObj( GetRoot(), rShape );
76 + ShapeInteractionHelper::PopulateShapeInteractionInfo( GetRoot(), rShape, *pCurrAppData );
79 if ( pCurrXclObj )
80 @@ -345,6 +349,7 @@ void XclEscherEx::DeleteCurrAppData()
81 delete pCurrAppData->GetClientAnchor();
82 // delete pCurrAppData->GetClientData();
83 delete pCurrAppData->GetClientTextbox();
84 + delete pCurrAppData->GetInteractionInfo();
85 delete pCurrAppData;
88 @@ -581,3 +586,35 @@ ShapeInteractionHelper::CreateShapeObj(const XclExpRoot& rRoot, const Reference<
90 return new XclExpShapeObj( rRoot, xShape );
93 +void
94 +ShapeInteractionHelper::PopulateShapeInteractionInfo(const XclExpRoot& rRoot, const Reference< XShape >& xShape, EscherExHostAppData& rHostAppData )
96 + try
97 + {
98 + SvMemoryStream* pMemStrm = NULL;
99 + rtl::OUString sHyperLink;
100 + rtl::OUString sMacro;
101 + if ( ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( ::GetSdrObjectFromXShape( xShape ) ) )
103 + sHyperLink = pInfo->GetHlink();
104 + sMacro = pInfo->GetMacro();
106 + if ( sHyperLink.getLength() > 0 )
108 + pMemStrm = new SvMemoryStream();
109 + XclExpStream tmpStream( *pMemStrm, rRoot );
110 + ScAddress dummyAddress;
111 + SvxURLField aUrlField;
112 + aUrlField.SetURL( sHyperLink );
113 + XclExpHyperlink hExpHlink( rRoot, aUrlField, dummyAddress );
114 + hExpHlink.WriteEmbeddedData( tmpStream );
116 + if ( ( sHyperLink.getLength() > 0 ) || ( sMacro.getLength() > 0 ) )
117 + rHostAppData.SetInteractionInfo( new InteractionInfo( pMemStrm, true ) );
119 + catch( Exception& )
124 diff --git svx/inc/svx/escherex.hxx svx/inc/svx/escherex.hxx
125 index ad20c74..d7b7184 100644
126 --- svx/inc/svx/escherex.hxx
127 +++ svx/inc/svx/escherex.hxx
128 @@ -47,6 +47,7 @@
129 #include <com/sun/star/drawing/Hatch.hpp>
130 #include <svx/msdffdef.hxx>
131 #include "svx/svxdllapi.h"
132 +#include <memory>
134 /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
135 // In der Mickysoft-Doku heissen die msofbt... statt ESCHER_...
136 @@ -1256,6 +1257,19 @@ public:
137 const Rectangle& rRect ) = 0;
140 +class InteractionInfo
142 + bool mbHasInteraction;
143 + std::auto_ptr<SvMemoryStream> mpHyperlinkRecord;
144 + InteractionInfo();
145 +public:
146 + InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
148 + mpHyperlinkRecord.reset( pStream );
150 + bool hasInteraction() { return mbHasInteraction; }
151 + const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
154 class EscherExHostAppData
156 @@ -1263,14 +1277,17 @@ private:
157 EscherExClientAnchor_Base* pClientAnchor;
158 EscherExClientRecord_Base* pClientData;
159 EscherExClientRecord_Base* pClientTextbox;
160 + InteractionInfo* pInteractionInfo;
161 // ignore single shape if entire pages are written
162 BOOL bDontWriteShape;
164 public:
165 EscherExHostAppData() : pClientAnchor(0), pClientData(0),
166 - pClientTextbox(0), bDontWriteShape(FALSE)
167 + pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(FALSE)
170 + void SetInteractionInfo( InteractionInfo* p )
171 + { pInteractionInfo = p; }
172 void SetClientAnchor( EscherExClientAnchor_Base* p )
173 { pClientAnchor = p; }
174 void SetClientData( EscherExClientRecord_Base* p )
175 @@ -1279,6 +1296,8 @@ public:
176 { pClientTextbox = p; }
177 void SetDontWriteShape( BOOL b )
178 { bDontWriteShape = b; }
179 + InteractionInfo* GetInteractionInfo() const
180 + { return pInteractionInfo; }
181 EscherExClientAnchor_Base* GetClientAnchor() const
182 { return pClientAnchor; }
183 EscherExClientRecord_Base* GetClientData() const
184 diff --git svx/source/msfilter/eschesdo.cxx svx/source/msfilter/eschesdo.cxx
185 index e93661a..243c236 100644
186 --- svx/source/msfilter/eschesdo.cxx
187 +++ svx/source/msfilter/eschesdo.cxx
188 @@ -251,6 +251,19 @@ UINT32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
189 // #i51348# shape name
190 if( aShapeName.Len() > 0 )
191 aPropOpt.AddOpt( ESCHER_Prop_wzName, aShapeName );
192 + if ( InteractionInfo* pInteraction = mpHostAppData->GetInteractionInfo() )
194 + const std::auto_ptr< SvMemoryStream >& pMemStrm = pInteraction->getHyperlinkRecord();
195 + if ( pMemStrm.get() )
197 + pMemStrm->ObjectOwnsMemory( FALSE );
198 + sal_uInt8* pBuf = (sal_uInt8*) pMemStrm->GetData();
199 + sal_uInt32 nSize = pMemStrm->Seek( STREAM_SEEK_TO_END );
200 + aPropOpt.AddOpt( ESCHER_Prop_pihlShape, sal_False, nSize, pBuf, nSize );;
202 + if ( pInteraction->hasInteraction() )
203 + aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x00080008 );
206 if ( rObj.GetType().EqualsAscii( "drawing.Custom" ) )