summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-03-05 09:44:18 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-03-05 10:09:26 +0100
commit9b6e7eb1bad4344be0e766f4c05f0a3f28cb737d (patch)
treef6bac427e46438f9ebc95c1c11aef0087a61e5ae
parent4ed3acc18e70a6c867e827c19f8ccf7fa925b9c5 (diff)
make ExportPICT() and WriteHex() be able to write to a stream
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx34
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx2
2 files changed, 27 insertions, 9 deletions
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ce72a1a027c3..eaf9ee313717 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3160,7 +3160,7 @@ static bool StripMetafileHeader(const sal_uInt8 *&rpGraphicAry, unsigned long &r
return false;
}
-OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, sal_uInt32 nLimit)
+OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream, sal_uInt32 nLimit)
{
OStringBuffer aRet;
@@ -3169,11 +3169,22 @@ OString RtfAttributeOutput::WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, s
{
OString sNo = OString::valueOf(sal_Int32(pData[i]), 16);
if (sNo.getLength() < 2)
- aRet.append('0');
- aRet.append(sNo);
+ {
+ if (pStream)
+ (*pStream) << '0';
+ else
+ aRet.append('0');
+ }
+ if (pStream)
+ (*pStream) << sNo.getStr();
+ else
+ aRet.append(sNo);
if (++nBreak == nLimit)
{
- aRet.append(RtfExport::sNewLine);
+ if (pStream)
+ (*pStream) << RtfExport::sNewLine;
+ else
+ aRet.append(RtfExport::sNewLine);
nBreak = 0;
}
}
@@ -3212,7 +3223,7 @@ void lcl_AppendSP( OStringBuffer& rBuffer,
static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, const Size &rRendered, const Size &rMapped,
const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry,
- unsigned long nSize, const RtfExport& rExport )
+ unsigned long nSize, const RtfExport& rExport, SvStream *pStream = 0 )
{
OStringBuffer aRet;
bool bIsWMF = std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
@@ -3274,8 +3285,15 @@ static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, con
StripMetafileHeader(pGraphicAry, nSize);
}
aRet.append(RtfExport::sNewLine);
- aRet.append(RtfAttributeOutput::WriteHex(pGraphicAry, nSize));
+ if (pStream)
+ (*pStream) << aRet.makeStringAndClear().getStr();
+ if (pStream)
+ RtfAttributeOutput::WriteHex(pGraphicAry, nSize, pStream);
+ else
+ aRet.append(RtfAttributeOutput::WriteHex(pGraphicAry, nSize));
aRet.append('}');
+ if (pStream)
+ (*pStream) << aRet.makeStringAndClear().getStr();
}
return aRet.makeStringAndClear();
}
@@ -3307,7 +3325,7 @@ void RtfAttributeOutput::FlyFrameOLEData( SwOLENode& rOLENode )
const sal_uInt8* pNativeData = (sal_uInt8*)pStream->GetData();
m_aRunText->append(WriteHex(nNativeDataSize));
m_aRunText->append(RtfExport::sNewLine);
- m_aRunText->append(RtfAttributeOutput::WriteHex(pNativeData, nNativeDataSize, 126));
+ m_aRunText->append(RtfAttributeOutput::WriteHex(pNativeData, nNativeDataSize, 0, 126));
m_aRunText->append(RtfExport::sNewLine);
delete pStream;
@@ -3319,7 +3337,7 @@ void RtfAttributeOutput::FlyFrameOLEData( SwOLENode& rOLENode )
pStream->Seek(STREAM_SEEK_TO_END);
sal_uInt32 nPresentationDataSize = pStream->Tell();
const sal_uInt8* pPresentationData = (sal_uInt8*)pStream->GetData();
- m_aRunText->append(WriteHex(pPresentationData, nPresentationDataSize, 126));
+ m_aRunText->append(WriteHex(pPresentationData, nPresentationDataSize, 0, 126));
}
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index c9303572781c..4be68dbdc8b2 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -571,7 +571,7 @@ public:
void FontPitchType( FontPitch ePitch ) const;
/// Writes binary data as a hex dump.
- static rtl::OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, sal_uInt32 nLimit = 64);
+ static rtl::OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, SvStream* pStream = 0, sal_uInt32 nLimit = 64);
static rtl::OString WriteHex(sal_Int32 nNum);
static rtl::OString WriteHex(rtl::OString sString);
};