summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Rumianowski <maciej.rumianowski@gmail.com>2011-10-05 09:35:03 +0200
committerJan Holesovsky <kendy@suse.cz>2011-10-07 00:21:07 +0200
commitbcf7d383578a00b961a0484534d810202cf57852 (patch)
treedb55a36e4ca80868dfff16c28a276be0f0ca7598
parent37836e3ba37c1ff7c303047a418dcbc3ef390afe (diff)
2nd part of Replace WW8Bytes with ww::bytes
Use prefered methods from SwWW8Writer
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx6
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx28
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx50
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx11
-rw-r--r--sw/source/filter/ww8/wrtww8gr.cxx10
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx18
7 files changed, 37 insertions, 92 deletions
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 68874efe4c54..5c1d220ade60 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1403,13 +1403,13 @@ sal_Int32 SwBasicEscherEx::WriteGrfFlyFrame(const SwFrmFmt& rFmt, sal_uInt32 nSh
String sURL;
pGrfNd->GetFileFilterNms( &sURL, 0 );
- WW8Bytes aBuf;
+ ww::bytes aBuf;
SwWW8Writer::InsAsString16( aBuf, sURL );
SwWW8Writer::InsUInt16( aBuf, 0 );
- sal_uInt16 nArrLen = aBuf.Count();
+ sal_uInt16 nArrLen = aBuf.size();
sal_uInt8* pArr = new sal_uInt8[ nArrLen ];
- memcpy( pArr, aBuf.GetData(), nArrLen );
+ std::copy( aBuf.begin(), aBuf.end(), pArr);
aPropOpt.AddOpt(ESCHER_Prop_pibName, true, nArrLen, pArr, nArrLen);
nFlags = ESCHER_BlipFlagLinkToFile | ESCHER_BlipFlagURL |
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 7d64e842892e..e7088a4da9d5 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -627,11 +627,9 @@ const SfxPoolItem* SwWW8AttrIter::HasTextItem( sal_uInt16 nWhich ) const
return pRet;
}
-void WW8Export::GetCurrentItems(WW8Bytes& rItems) const
+void WW8Export::GetCurrentItems(ww::bytes &rItems) const
{
- sal_uInt16 nEnd = pO ? pO->size() : 0;
- for (sal_uInt16 nI = 0; nI < nEnd; ++nI)
- rItems.Insert((*pO)[nI], rItems.Count());
+ rItems.insert(rItems.end(), pO->begin(), pO->end());
}
const SfxPoolItem& SwWW8AttrIter::GetItem(sal_uInt16 nWhich) const
@@ -1047,35 +1045,35 @@ void SwWW8AttrIter::OutSwFmtRefMark(const SwFmtRefMark& rAttr, bool)
void WW8AttributeOutput::FieldVanish( const String& rTxt, ww::eField /*eType*/ )
{
- WW8Bytes aItems;
+ ww::bytes aItems;
m_rWW8Export.GetCurrentItems( aItems );
// sprmCFFldVanish
if ( m_rWW8Export.bWrtWW8 )
SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFFldVanish );
else
- aItems.Insert( 67, aItems.Count() );
- aItems.Insert( 1, aItems.Count() );
+ aItems.push_back( 67 );
+ aItems.push_back( 1 );
- sal_uInt16 nStt_sprmCFSpec = aItems.Count();
+ sal_uInt16 nStt_sprmCFSpec = aItems.size();
// sprmCFSpec -- fSpec-Attribut true
if ( m_rWW8Export.bWrtWW8 )
SwWW8Writer::InsUInt16( aItems, 0x855 );
else
- aItems.Insert( 117, aItems.Count() );
- aItems.Insert( 1, aItems.Count() );
+ aItems.push_back( 117 );
+ aItems.push_back( 1 );
m_rWW8Export.WriteChar( '\x13' );
- m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.Count(),
- aItems.GetData() );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.size(),
+ aItems.data() );
m_rWW8Export.OutSwString( rTxt, 0, rTxt.Len(), m_rWW8Export.IsUnicode(),
RTL_TEXTENCODING_MS_1252 );
m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), nStt_sprmCFSpec,
- aItems.GetData() );
+ aItems.data() );
m_rWW8Export.WriteChar( '\x15' );
- m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.Count(),
- aItems.GetData() );
+ m_rWW8Export.pChpPlc->AppendFkpEntry( m_rWW8Export.Strm().Tell(), aItems.size(),
+ aItems.data() );
}
void AttributeOutputBase::TOXMark( const SwTxtNode& rNode, const SwTOXMark& rAttr )
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 0fad84404c4b..6dc8b3701b2a 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -745,14 +745,14 @@ static void SwWw8_InsertAnlText( const String& rStr, sal_uInt8*& rpCh,
sal_uInt16& rCharLen, SVBT8& r8Len )
{
sal_uInt8 nb = 0;
- WW8Bytes aO;
+ ww::bytes aO;
SwWW8Writer::InsAsString8( aO, rStr, RTL_TEXTENCODING_MS_1252 );
- sal_uInt16 nCnt = aO.Count();
+ sal_uInt16 nCnt = aO.size();
if( nCnt && nCnt < rCharLen )
{
nb = (sal_uInt8)nCnt;
- memcpy( rpCh, aO.GetData(), nCnt );
+ std::copy( aO.begin(), aO.end(), rpCh );
rpCh += nCnt;
rCharLen = rCharLen - nCnt;
}
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index f21a3aba49d5..edd0b77d2b30 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1555,48 +1555,6 @@ void SwWW8Writer::InsAsString8(ww::bytes &rO, const String& rStr,
std::copy(pStart, pEnd, std::inserter(rO, rO.end()));
}
-#ifdef __WW8_NEEDS_COPY
-
-void SwWW8Writer::InsUInt16( WW8Bytes& rO, sal_uInt16 n )
-{
- SVBT16 nL;
- ShortToSVBT16( n, nL );
- rO.Insert( nL, 2, rO.Count() );
-}
-void SwWW8Writer::InsUInt32( WW8Bytes& rO, sal_uInt32 n )
-{
- SVBT32 nL;
- UInt32ToSVBT32( n, nL );
- rO.Insert( nL, 4, rO.Count() );
-}
-
-#else
-
-void SwWW8Writer::InsUInt16( WW8Bytes& rO, sal_uInt16 n )
-{
- rO.Insert( (sal_uInt8*)&n, 2, rO.Count() );
-}
-void SwWW8Writer::InsUInt32( WW8Bytes& rO, sal_uInt32 n )
-{
- rO.Insert( (sal_uInt8*)&n, 4, rO.Count() );
-}
-
-#endif // defined __WW8_NEEDS_COPY
-
-void SwWW8Writer::InsAsString16( WW8Bytes& rO, const String& rStr )
-{
- const sal_Unicode* pStr = rStr.GetBuffer();
- for( xub_StrLen n = 0, nLen = rStr.Len(); n < nLen; ++n, ++pStr )
- SwWW8Writer::InsUInt16( rO, *pStr );
-}
-
-void SwWW8Writer::InsAsString8( WW8Bytes& rO, const String& rStr,
- rtl_TextEncoding eCodeSet )
-{
- rtl::OString sTmp(rtl::OUStringToOString(rStr, eCodeSet));
- rO.Insert((sal_uInt8*)sTmp.getStr(), sTmp.getLength(), rO.Count());
-}
-
void SwWW8Writer::WriteString16(SvStream& rStrm, const String& rStr,
bool bAddZero)
{
@@ -1640,7 +1598,7 @@ void WW8Export::WriteStringAsPara( const String& rTxt, sal_uInt16 nStyleId )
OutSwString( rTxt, 0, rTxt.Len(), IsUnicode(), RTL_TEXTENCODING_MS_1252 );
WriteCR(); // CR danach
- WW8Bytes aArr( 10, 10 );
+ ww::bytes aArr;
SwWW8Writer::InsUInt16( aArr, nStyleId );
if( bOutTable )
{ // Tab-Attr
@@ -1648,12 +1606,12 @@ void WW8Export::WriteStringAsPara( const String& rTxt, sal_uInt16 nStyleId )
if( bWrtWW8 )
SwWW8Writer::InsUInt16( aArr, NS_sprm::LN_PFInTable );
else
- aArr.Insert( 24, aArr.Count() );
- aArr.Insert( 1, aArr.Count() );
+ aArr.push_back( 24 );
+ aArr.push_back( 1 );
}
sal_uLong nPos = Strm().Tell();
- pPapPlc->AppendFkpEntry( nPos, aArr.Count(), aArr.GetData() );
+ pPapPlc->AppendFkpEntry( nPos, aArr.size(), aArr.data() );
pChpPlc->AppendFkpEntry( nPos );
}
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 691c9126dbc4..2b8438d4d6db 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -863,20 +863,11 @@ public:
using Writer::getIDocumentSettingAccess;
public:
-#if 1
- /// Prefer ww::bytes to WW8Bytes, migrate away from the other ones.
static void InsUInt16(ww::bytes &rO, sal_uInt16 n);
static void InsUInt32(ww::bytes &rO, sal_uInt32 n);
static void InsAsString16(ww::bytes &rO, const String& rStr);
static void InsAsString8(ww::bytes & O, const String& rStr,
rtl_TextEncoding eCodeSet);
-#endif
-
- static void InsUInt16( WW8Bytes& rO, sal_uInt16 );
- static void InsUInt32( WW8Bytes& rO, sal_uInt32 );
- static void InsAsString16( WW8Bytes& rO, const String& );
- static void InsAsString8( WW8Bytes& rO, const String& rStr,
- rtl_TextEncoding eCodeSet );
static sal_uLong FillUntil( SvStream& rStrm, sal_uLong nEndPos = 0 );
static void FillCount( SvStream& rStrm, sal_uLong nCount );
@@ -1098,7 +1089,7 @@ public:
virtual void DoFormText(const SwInputField * pFld);
- void GetCurrentItems(WW8Bytes &rItems) const;
+ void GetCurrentItems(ww::bytes &rItems) const;
/// Write the data of the form field
virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark );
diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index ff2c8d2cd0fb..3310e6f1bde6 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -379,20 +379,20 @@ void WW8Export::OutputLinkedOLE( const rtl::OUString& rOleId )
xOleDst->Commit();
// Ouput the cPicLocation attribute
- WW8Bytes* pBuf = new WW8Bytes( 128, 128 );
+ ww::bytes* pBuf = new ww::bytes();
GetWriter().InsUInt16( *pBuf, NS_sprm::LN_CPicLocation );
GetWriter().InsUInt32( *pBuf, rOleId.copy( 1 ).toInt32() );
GetWriter().InsUInt16( *pBuf, NS_sprm::LN_CFOle2 );
- pBuf->Insert( 1, pBuf->Count() );
+ pBuf->push_back( 1 );
GetWriter().InsUInt16( *pBuf, NS_sprm::LN_CFSpec );
- pBuf->Insert( 1, pBuf->Count() );
+ pBuf->push_back( 1 );
GetWriter().InsUInt16( *pBuf, NS_sprm::LN_CFObj );
- pBuf->Insert( 1, pBuf->Count() );
+ pBuf->push_back( 1 );
- pChpPlc->AppendFkpEntry( Strm().Tell(), pBuf->Count(), pBuf->GetData() );
+ pChpPlc->AppendFkpEntry( Strm().Tell(), pBuf->size(), pBuf->data() );
delete pBuf;
}
}
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 1d236cb87418..aaf478e431f6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -1658,14 +1658,13 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c,
String* pLinkStr = 0L,
bool bIncludeEmptyPicLocation = false )
{
- WW8Bytes aItems;
+ ww::bytes aItems;
rWrt.GetCurrentItems(aItems);
if (c == 0x13)
rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell());
else
- rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell(), aItems.Count(),
- aItems.GetData());
+ rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell(), aItems.size(), aItems.data());
rWrt.WriteChar(c);
@@ -1715,11 +1714,11 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c,
// write attributes of hyperlink character 0x01
SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFFldVanish );
- aItems.Insert( (sal_uInt8)0x81, aItems.Count() );
+ aItems.push_back( (sal_uInt8)0x81 );
SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CPicLocation );
SwWW8Writer::InsUInt32( aItems, nLinkPosInDataStrm );
SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFData );
- aItems.Insert( (sal_uInt8)0x01, aItems.Count() );
+ aItems.push_back( (sal_uInt8)0x01 );
}
//Technically we should probably Remove all attribs
@@ -1730,16 +1729,15 @@ static void InsertSpecialChar( WW8Export& rWrt, sal_uInt8 c,
if( rWrt.bWrtWW8 )
{
SwWW8Writer::InsUInt16( aItems, NS_sprm::LN_CFSpec );
- aItems.Insert( 1, aItems.Count() );
+ aItems.push_back( 1 );
}
else
{
- aItems.Insert( 117, aItems.Count() ); //sprmCFSpec
- aItems.Insert( 1, aItems.Count() );
+ aItems.push_back( 117 ); //sprmCFSpec
+ aItems.push_back( 1 );
}
- rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell(), aItems.Count(),
- aItems.GetData());
+ rWrt.pChpPlc->AppendFkpEntry(rWrt.Strm().Tell(), aItems.size(), aItems.data());
}
String lcl_GetExpandedField(const SwField &rFld)