[Libreoffice-commits] core.git: 3 commits - sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Dec 14 05:54:42 PST 2015
sw/source/filter/ww8/wrtww8.cxx | 45 ++++++++++++++++++++++++--
sw/source/filter/ww8/ww8scan.cxx | 64 +++++++++++++++++++++++++++++++++++++-
sw/source/filter/ww8/ww8struc.hxx | 7 ++++
3 files changed, 112 insertions(+), 4 deletions(-)
New commits:
commit fed39aeae06cbd38be1a57e68eb8859df7a9b3f2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Dec 14 14:37:50 2015 +0100
DOC export: write propBags in SmartTagData
Change-Id: I1d1f8aa28438209fbe3258b4b4418fcdfaabf78c
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index f75560b..8a30c1b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -418,6 +418,19 @@ void WW8_WrtFactoids::Write(WW8Export& rExport)
}
}
aSmartTagData.m_aPropBagStore.m_aStringTable.assign(aSet.begin(), aSet.end());
+ for (const std::map<OUString, OUString>& rStatements : m_aStatements)
+ {
+ MSOPropertyBag aPropertyBag;
+ aPropertyBag.m_nId = 1;
+ for (const std::pair<OUString, OUString>& rPair : rStatements)
+ {
+ MSOProperty aProperty;
+ aProperty.m_nKey = std::distance(aSet.begin(), aSet.find(rPair.first));
+ aProperty.m_nValue = std::distance(aSet.begin(), aSet.find(rPair.second));
+ aPropertyBag.m_aProperties.push_back(aProperty);
+ }
+ aSmartTagData.m_aPropBags.push_back(aPropertyBag);
+ }
aSmartTagData.Write(rExport);
rExport.pFib->lcbFactoidData = rStream.Tell() - rExport.pFib->fcFactoidData;
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index a460eaa..98b4a5a 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -6399,6 +6399,12 @@ void MSOProperty::Read(SvStream& rStream)
rStream.ReadUInt32(m_nValue);
}
+void MSOProperty::Write(SvStream& rStream)
+{
+ rStream.WriteUInt32(m_nKey);
+ rStream.WriteUInt32(m_nValue);
+}
+
MSOPropertyBag::MSOPropertyBag()
: m_nId(0)
{
@@ -6425,6 +6431,16 @@ void MSOPropertyBag::Read(SvStream& rStream)
}
}
+void MSOPropertyBag::Write(WW8Export& rExport)
+{
+ SvStream& rStream = *rExport.pTableStrm;
+ rStream.WriteUInt16(m_nId);
+ rStream.WriteUInt16(m_aProperties.size());
+ rStream.WriteUInt16(0); // cbUnknown
+ for (MSOProperty& rProperty : m_aProperties)
+ rProperty.Write(rStream);
+}
+
void WW8SmartTagData::Read(SvStream& rStream, WW8_FC fcFactoidData, sal_uInt32 lcbFactoidData)
{
sal_uInt64 nOldPosition = rStream.Tell();
@@ -6445,6 +6461,8 @@ void WW8SmartTagData::Read(SvStream& rStream, WW8_FC fcFactoidData, sal_uInt32 l
void WW8SmartTagData::Write(WW8Export& rExport)
{
m_aPropBagStore.Write(rExport);
+ for (MSOPropertyBag& rPropertyBag : m_aPropBags)
+ rPropertyBag.Write(rExport);
}
WW8Style::WW8Style(SvStream& rStream, WW8Fib& rFibPara)
diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx
index 5aef92a..fc97b2d 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -1120,6 +1120,7 @@ class MSOProperty
public:
MSOProperty();
void Read(SvStream& rStream);
+ void Write(SvStream& rStream);
/// Index into MSOPropertyBagStore::m_aStringTable.
sal_uInt32 m_nKey;
@@ -1133,6 +1134,7 @@ class MSOPropertyBag
public:
MSOPropertyBag();
void Read(SvStream& rStream);
+ void Write(WW8Export& rExport);
/// Matches MSOFactoidType::m_nId in MSOPropertyBagStore::m_aFactoidTypes.
sal_uInt16 m_nId;
commit 520bb76859d912bfc7a5f60d7dbbbd2e460b4ff7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Dec 14 13:57:14 2015 +0100
DOC export: write stringTable in SmartTagData
Change-Id: I05eda6067308119a388238eed356531851000691
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index c90ef7d..f75560b 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -319,11 +319,12 @@ class WW8_WrtFactoids: private boost::noncopyable
{
std::vector<WW8_CP> m_aStartCPs;
std::vector<WW8_CP> m_aEndCPs;
+ std::vector< std::map<OUString, OUString> > m_aStatements;
public:
WW8_WrtFactoids();
~WW8_WrtFactoids();
- void Append(WW8_CP nStartCp, WW8_CP nEndCp);
+ void Append(WW8_CP nStartCp, WW8_CP nEndCp, const std::map<OUString, OUString>& rStatements);
void Write(WW8Export& rWrt);
}
;
@@ -335,10 +336,11 @@ WW8_WrtFactoids::~WW8_WrtFactoids()
{
}
-void WW8_WrtFactoids::Append(WW8_CP nStartCp, WW8_CP nEndCp)
+void WW8_WrtFactoids::Append(WW8_CP nStartCp, WW8_CP nEndCp, const std::map<OUString, OUString>& rStatements)
{
m_aStartCPs.push_back(nStartCp);
m_aEndCPs.push_back(nEndCp);
+ m_aStatements.push_back(rStatements);
}
void WW8_WrtFactoids::Write(WW8Export& rExport)
@@ -404,6 +406,19 @@ void WW8_WrtFactoids::Write(WW8Export& rExport)
aFactoidType.m_aTag = "RDF";
WW8SmartTagData aSmartTagData;
aSmartTagData.m_aPropBagStore.m_aFactoidTypes.push_back(aFactoidType);
+
+ std::set<OUString> aSet;
+ for (const std::map<OUString, OUString>& rStatements : m_aStatements)
+ {
+ // Statements for a single text node.
+ for (const std::pair<OUString, OUString>& rPair : rStatements)
+ {
+ aSet.insert(rPair.first);
+ aSet.insert(rPair.second);
+ }
+ }
+ aSmartTagData.m_aPropBagStore.m_aStringTable.assign(aSet.begin(), aSet.end());
+
aSmartTagData.Write(rExport);
rExport.pFib->lcbFactoidData = rStream.Tell() - rExport.pFib->fcFactoidData;
}
@@ -1477,7 +1492,7 @@ void WW8Export::AppendSmartTags(const SwTextNode& rTextNode)
if (!aStatements.empty())
{
WW8_CP nCP = Fc2Cp(Strm().Tell());
- m_pFactoids->Append(nCP, nCP);
+ m_pFactoids->Append(nCP, nCP, aStatements);
}
}
commit 8f52bb0b66020590b04bcfb5ce8ff6694f6a4112
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Dec 14 12:20:13 2015 +0100
DOC export: write factoidTypes in SmartTagData
Change-Id: I30ba25e035fae08c06b17e2bafcb8a1147d4e12d
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index c145fd6..c90ef7d 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 326ae80..a460eaa 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 5181a1b..5aef92a 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;
More information about the Libreoffice-commits
mailing list