diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-14 12:20:13 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-14 14:54:08 +0100 |
commit | 8f52bb0b66020590b04bcfb5ce8ff6694f6a4112 (patch) | |
tree | e13edb4823070dea4aa7fc77f5b8e055a6eb06c5 /sw | |
parent | 0e6ea7b9fa8f3748d0ced2122fa0a7c7698c1f93 (diff) |
DOC export: write factoidTypes in SmartTagData
Change-Id: I30ba25e035fae08c06b17e2bafcb8a1147d4e12d
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 11 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 46 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8struc.hxx | 5 |
3 files changed, 61 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index c145fd655f39..c90ef7dc145a 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -395,6 +395,17 @@ void WW8_WrtFactoids::Write(WW8Export& rExport) rStream.WriteInt16(0); // cDepth, 0 as does not overlap with any other smart tag. } rExport.pFib->lcbPlcfBklFactoid = rStream.Tell() - rExport.pFib->fcPlcfBklFactoid; + + rExport.pFib->fcFactoidData = rStream.Tell(); + // Write SmartTagData. + MSOFactoidType aFactoidType; + aFactoidType.m_nId = 1; + aFactoidType.m_aUri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + aFactoidType.m_aTag = "RDF"; + WW8SmartTagData aSmartTagData; + aSmartTagData.m_aPropBagStore.m_aFactoidTypes.push_back(aFactoidType); + aSmartTagData.Write(rExport); + rExport.pFib->lcbFactoidData = rStream.Tell() - rExport.pFib->fcFactoidData; } #define ANZ_DEFAULT_STYLES 16 diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 326ae804ed58..a460eaac205d 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6253,8 +6253,10 @@ bool WW8Fib::Write(SvStream& rStrm) pData += 0x442 - 0x43A; Set_UInt32(pData, fcPlcfBklFactoid); Set_UInt32(pData, lcbPlcfBklFactoid); + Set_UInt32(pData, fcFactoidData); + Set_UInt32(pData, lcbFactoidData); - pData += 0x4DA - 0x44A; + pData += 0x4DA - 0x452; } else pData += 0x4DA - 0x422; @@ -6309,6 +6311,15 @@ OUString Read(SvStream& rStream) return aRet; } + +void Write(const OUString& rString, SvStream& rStream) +{ + sal_uInt16 nBuf = 0; + nBuf |= rString.getLength(); // cch, 0..14th bits. + nBuf |= 0x8000; // fAnsiString, 15th bit. + rStream.WriteUInt16(nBuf); + SwWW8Writer::WriteString8(rStream, rString, false, RTL_TEXTENCODING_ASCII_US); +} }; void MSOFactoidType::Read(SvStream& rStream) @@ -6321,6 +6332,20 @@ void MSOFactoidType::Read(SvStream& rStream) MSOPBString::Read(rStream); // rgbDownloadURL } +void MSOFactoidType::Write(WW8Export& rExport) +{ + SvStream& rStream = *rExport.pTableStrm; + + SvMemoryStream aStream; + aStream.WriteUInt32(m_nId); // id + MSOPBString::Write(m_aUri, aStream); + MSOPBString::Write(m_aTag, aStream); + MSOPBString::Write("", aStream); // rgbDownloadURL + rStream.WriteUInt32(aStream.Tell()); + aStream.Seek(0); + rStream.WriteStream(aStream); +} + void MSOPropertyBagStore::Read(SvStream& rStream) { sal_uInt32 cFactoidType(0); @@ -6348,6 +6373,20 @@ void MSOPropertyBagStore::Read(SvStream& rStream) } } +void MSOPropertyBagStore::Write(WW8Export& rExport) +{ + SvStream& rStream = *rExport.pTableStrm; + rStream.WriteUInt32(m_aFactoidTypes.size()); // cFactoidType + for (MSOFactoidType& rType : m_aFactoidTypes) + rType.Write(rExport); + rStream.WriteUInt16(0xc); // cbHdr + rStream.WriteUInt16(0x0100); // sVer + rStream.WriteUInt32(0); // cfactoid + rStream.WriteUInt32(m_aStringTable.size()); // cste + for (const OUString& rString : m_aStringTable) + MSOPBString::Write(rString, rStream); +} + MSOProperty::MSOProperty() : m_nKey(0) , m_nValue(0) @@ -6403,6 +6442,11 @@ void WW8SmartTagData::Read(SvStream& rStream, WW8_FC fcFactoidData, sal_uInt32 l rStream.Seek(nOldPosition); } +void WW8SmartTagData::Write(WW8Export& rExport) +{ + m_aPropBagStore.Write(rExport); +} + WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara) : rFib(rFibPara), rSt(rStream), cstd(0), cbSTDBaseInFile(0), fStdStylenamesWritten(0) , stiMaxWhenSaved(0), istdMaxFixedWhenSaved(0), nVerBuiltInNamesWhenSaved(0) diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index 5181a1b482e5..5aef92a2be1d 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -32,6 +32,8 @@ # pragma pack(push, 2) #endif +class WW8Export; + inline void Set_UInt8( sal_uInt8 *& p, sal_uInt8 n ) { *p = n; @@ -1094,6 +1096,7 @@ class MSOFactoidType public: MSOFactoidType(); void Read(SvStream& rStream); + void Write(WW8Export& rExport); sal_uInt32 m_nId; OUString m_aUri; @@ -1105,6 +1108,7 @@ class MSOPropertyBagStore { public: void Read(SvStream& rStream); + void Write(WW8Export& rExport); std::vector<MSOFactoidType> m_aFactoidTypes; std::vector<OUString> m_aStringTable; @@ -1140,6 +1144,7 @@ class WW8SmartTagData { public: void Read(SvStream& rStream, WW8_FC fcFactoidData, sal_uInt32 lcbFactoidData); + void Write(WW8Export& rExport); MSOPropertyBagStore m_aPropBagStore; std::vector<MSOPropertyBag> m_aPropBags; |