From 24a660684e3e41f9fa9440b57f66668dc053f8ff Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Fri, 17 Sep 2010 10:05:44 +0200 Subject: Don't loose the DDE links in word files. * patches/dev300/dummy-fields-ole-links.diff: Fix for n#628098 --- patches/dev300/dummy-fields-ole-links.diff | 78 ++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 patches/dev300/dummy-fields-ole-links.diff diff --git a/patches/dev300/dummy-fields-ole-links.diff b/patches/dev300/dummy-fields-ole-links.diff new file mode 100644 index 000000000..ac8554ddb --- /dev/null +++ b/patches/dev300/dummy-fields-ole-links.diff @@ -0,0 +1,78 @@ +Don't create an OLE obect inside OLE Links + +From: Cédric Bosdonnat + + +--- + + sw/source/filter/ww8/ww8par.hxx | 1 + + sw/source/filter/ww8/ww8par5.cxx | 8 ++++---- + sw/source/filter/ww8/ww8par6.cxx | 9 ++++++++- + 3 files changed, 13 insertions(+), 5 deletions(-) + + +diff --git sw/source/filter/ww8/ww8par.hxx sw/source/filter/ww8/ww8par.hxx +index cb96374..f038bb6 100644 +--- sw/source/filter/ww8/ww8par.hxx ++++ sw/source/filter/ww8/ww8par.hxx +@@ -381,6 +381,7 @@ private: + public: + sw::hack::Position maStartPos; + sal_uInt16 mnFieldId; ++ ULONG mnObjLocFc; + FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw(); + FieldEntry(const FieldEntry &rOther) throw(); + FieldEntry &operator=(const FieldEntry &rOther) throw(); +diff --git sw/source/filter/ww8/ww8par5.cxx sw/source/filter/ww8/ww8par5.cxx +index f22d1b5..5034625 100644 +--- sw/source/filter/ww8/ww8par5.cxx ++++ sw/source/filter/ww8/ww8par5.cxx +@@ -761,11 +761,11 @@ sal_uInt16 SwWW8ImplReader::End_Field() + rtl::OUString::createFromAscii( FIELD_CODE_PARAM ), + aCode ); + +- if ( nObjLocFc > 0 ) ++ if ( maFieldStack.back().mnObjLocFc > 0 ) + { + // Store the OLE object as an internal link + String sOleId = '_'; +- sOleId += String::CreateFromInt32( nObjLocFc ); ++ sOleId += String::CreateFromInt32( maFieldStack.back().mnObjLocFc ); + + SvStorageRef xSrc0 = pStg->OpenSotStorage(CREATE_CONST_ASC(SL::aObjectPool)); + SvStorageRef xSrc1 = xSrc0->OpenSotStorage( sOleId, STREAM_READ ); +@@ -828,12 +828,12 @@ bool AcceptableNestedField(sal_uInt16 nFieldCode) + } + + FieldEntry::FieldEntry(SwPosition &rPos, sal_uInt16 nFieldId) throw() +- : maStartPos(rPos), mnFieldId(nFieldId) ++ : maStartPos(rPos), mnFieldId(nFieldId), mnObjLocFc(0) + { + } + + FieldEntry::FieldEntry(const FieldEntry &rOther) throw() +- : maStartPos(rOther.maStartPos), mnFieldId(rOther.mnFieldId) ++ : maStartPos(rOther.maStartPos), mnFieldId(rOther.mnFieldId), mnObjLocFc(rOther.mnObjLocFc) + { + } + +diff --git sw/source/filter/ww8/ww8par6.cxx sw/source/filter/ww8/ww8par6.cxx +index 98c5ee9..9ff32af 100644 +--- sw/source/filter/ww8/ww8par6.cxx ++++ sw/source/filter/ww8/ww8par6.cxx +@@ -2820,7 +2820,14 @@ void SwWW8ImplReader::Read_Obj(USHORT , const BYTE* pData, short nLen) + bObj = 0 != *pData; + + if( bObj && nPicLocFc && bEmbeddObj ) +- nObjLocFc = nPicLocFc; ++ { ++ if ( maFieldStack.back().mnFieldId == 56 ) { ++ // For LINK fields, store the nObjLocFc value in the field entry ++ maFieldStack.back().mnObjLocFc = nPicLocFc; ++ } else { ++ nObjLocFc = nPicLocFc; ++ } ++ } + } + } + -- cgit v1.2.3