move template down and tweak

This commit is contained in:
Caolán McNamara 2011-09-04 23:17:13 +01:00
parent b96c999d7a
commit 65a62a24c7
2 changed files with 30 additions and 35 deletions

View file

@ -77,8 +77,18 @@ namespace SL
IMPLCONSTSTRINGARRAY(MSMacroCmds);
}
template<class C> bool wwString<C>::TestBeltAndBraces(SvStream& rStrm)
namespace
{
/**
winword strings are typically Belt and Braces strings preceeded with a
pascal style count, and ending with a c style 0 terminator. 16bit chars
and count for ww8+ and 8bit chars and count for ww7-. The count and 0
can be checked for integrity to catch errors (e.g. lotus created
documents) where in error 8bit strings are used instead of 16bits
strings for style names.
*/
template<typename C> bool TestBeltAndBraces(SvStream& rStrm)
{
bool bRet = false;
sal_uInt32 nOldPos = rStrm.Tell();
C nBelt(0);
@ -97,6 +107,7 @@ template<class C> bool wwString<C>::TestBeltAndBraces(SvStream& rStrm)
}
rStrm.Seek(nOldPos);
return bRet;
}
}
inline bool operator==(const SprmInfo &rFirst, const SprmInfo &rSecond)
@ -6146,7 +6157,7 @@ WW8_STD* WW8Style::Read1Style( short& rSkip, String* pString, short* pcbStd )
case 8:
// handle Unicode-String with leading length short and
// trailing zero
if (ww8String::TestBeltAndBraces(rSt))
if (TestBeltAndBraces<sal_Unicode>(rSt))
{
*pString = read_LEuInt16_BeltAndBracesString(rSt);
rSkip -= (pString->Len() + 2) * 2;

View file

@ -72,22 +72,6 @@ namespace SL
DEFCONSTSTRINGARRAY(MSMacroCmds);
}
/**
winword strings are typically Belt and Braces strings preceeded with a
pascal style count, and ending with a c style 0 terminator. 16bit chars
and count for ww8+ and 8bit chars and count for ww7-. The count and 0
can be checked for integrity to catch errors (e.g. lotus created documents)
where in error 8bit strings are used instead of 16bits strings for style
names.
*/
template<class C> class wwString
{
public:
static bool TestBeltAndBraces(SvStream& rStrm);
};
typedef wwString<sal_Unicode> ww8String;
struct SprmInfo
{
sal_uInt16 nId; ///< A ww8 sprm is hardcoded as 16bits