summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-03-10 20:54:06 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-03-12 11:43:50 +0000
commit4be58b0b9d2817be716a0271320c70064d2b3d88 (patch)
tree3b9486cad547e2b607dd4bac8b8c301cd67836f4 /sw
parenta43bd907062a3925c12b3ba3909bf974e9f2914b (diff)
this massive rigmarole is just to map a msword author id to a writer author id
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/inc/msfilter.hxx26
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx41
-rw-r--r--sw/source/filter/rtf/swparrtf.hxx2
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par4.cxx27
7 files changed, 18 insertions, 84 deletions
diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx
index e24dab43bd52..3958f7407efb 100644
--- a/sw/source/filter/inc/msfilter.hxx
+++ b/sw/source/filter/inc/msfilter.hxx
@@ -141,30 +141,8 @@ namespace sw
namespace util
{
- struct AuthorInfo;
- typedef AuthorInfo* AuthorInfo_Ptr;
-
- /// Redlining Authors
- struct AuthorInfo
- {
- sal_uInt16 nWWAuthorId;
- sal_uInt16 nOurId;
-
- AuthorInfo(sal_uInt16 nWWAuthorId_, sal_uInt16 nOurId_ = 0):
- nWWAuthorId( nWWAuthorId_ ),
- nOurId( nOurId_ )
- {}
- bool operator==(const AuthorInfo& rEntry) const
- {
- return (nWWAuthorId == rEntry.nWWAuthorId);
- }
- bool operator<(const AuthorInfo& rEntry) const
- {
- return (nWWAuthorId < rEntry.nWWAuthorId);
- }
- };
-
- SV_DECL_PTRARR_SORT_DEL(AuthorInfos, AuthorInfo_Ptr,16)
+ /// Redlining Authors, map word author key to writer author value
+ typedef std::map<sal_uInt16, sal_uInt16> AuthorInfos;
/** Clips a value to MAX/MIN 16bit value to make it safe for use
as a position value to give to writer. i.e. +-57.8cm. Sometimes
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index 2f6ee4d47e64..8367a4ad9bbc 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -235,7 +235,6 @@ SwRTFParser::SwRTFParser(SwDoc* pD,
aTblFmts(0),
mpBookmarkStart(0),
mpRedlineStack(0),
- pAuthorInfos(0),
pGrfAttrSet(0),
pTableNode(0),
pOldTblNd(0),
@@ -1151,8 +1150,6 @@ SwRTFParser::~SwRTFParser()
if (pGrfAttrSet)
DELETEZ( pGrfAttrSet );
-
- DELETEZ( pAuthorInfos );
}
//i19718
@@ -1591,11 +1588,7 @@ sal_uInt16 SwRTFParser::ReadRevTbl()
sal_uInt16 nSWId = pDoc->InsertRedlineAuthor(aToken);
// Store matchpair
- if( !pAuthorInfos )
- pAuthorInfos = new sw::util::AuthorInfos;
- sw::util::AuthorInfo* pAutorInfo = new sw::util::AuthorInfo( nAuthorTableIndex, nSWId );
- if( 0 == pAuthorInfos->Insert( pAutorInfo ) )
- delete pAutorInfo;
+ m_aAuthorInfos[nAuthorTableIndex] = nSWId;
aRevTbl.push_back(aToken);
nAuthorTableIndex++;
@@ -1840,38 +1833,18 @@ void SwRTFParser::NextToken( int nToken )
break;
case RTF_REVAUTH:
+ if (pRedlineInsert)
{
- sw::util::AuthorInfo aEntry( static_cast< sal_uInt16 >(nTokenValue) );
- sal_uInt16 nPos;
-
- if(pRedlineInsert)
- {
- if (pAuthorInfos && pAuthorInfos->Seek_Entry(&aEntry, &nPos))
- {
- if (const sw::util::AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
- {
- pRedlineInsert->nAutorNo = pAuthor->nOurId;
- }
- }
- }
+ sal_uInt16 nRevAuth = static_cast<sal_uInt16>(nTokenValue);
+ pRedlineInsert->nAutorNo = m_aAuthorInfos[nRevAuth];
}
break;
case RTF_REVAUTHDEL:
+ if(pRedlineDelete)
{
- sw::util::AuthorInfo aEntry( static_cast< short >(nTokenValue) );
- sal_uInt16 nPos;
-
- if(pRedlineDelete)
- {
- if (pAuthorInfos && pAuthorInfos->Seek_Entry(&aEntry, &nPos))
- {
- if (const sw::util::AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
- {
- pRedlineDelete->nAutorNo = pAuthor->nOurId;
- }
- }
- }
+ sal_uInt16 nRevAuthDel = static_cast<sal_uInt16>(nTokenValue);
+ pRedlineDelete->nAutorNo = m_aAuthorInfos[nRevAuthDel];
}
break;
diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx
index 31c2bae865b7..feab4083ab7e 100644
--- a/sw/source/filter/rtf/swparrtf.hxx
+++ b/sw/source/filter/rtf/swparrtf.hxx
@@ -294,7 +294,7 @@ class SwRTFParser : public SvxRTFParser
SvPtrarr aRubyCharFmts;
BookmarkPosition* mpBookmarkStart;
sw::util::RedlineStack *mpRedlineStack;
- sw::util::AuthorInfos* pAuthorInfos;
+ sw::util::AuthorInfos m_aAuthorInfos;
SfxItemSet* pGrfAttrSet;
SwTableNode* pTableNode, *pOldTblNd; // fuers Lesen von Tabellen: akt. Tab
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index 2442722b29b4..e96dfaafbe6d 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -324,8 +324,6 @@ namespace sw
namespace util
{
- SV_IMPL_OP_PTRARR_SORT(AuthorInfos, AuthorInfo_Ptr)
-
SwTwips MakeSafePositioningValue(SwTwips nIn)
{
if (nIn > SHRT_MAX)
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 9b79d2356e20..99db4daeb858 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -3623,7 +3623,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SvStorage* pStorage,
maTxtNodesHavingLeftIndentSet(), // #i105414#
pMSDffManager(0),
mpAtnNames(0),
- pAuthorInfos(0),
sBaseURL(rBaseURL),
m_bRegardHindiDigits( false ),
mbNewDoc(bNewDoc),
@@ -4721,7 +4720,6 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
delete pWDop;
DELETEZ( pFonts );
delete mpAtnNames;
- DELETEZ( pAuthorInfos );
delete mpSprmParser;
::EndProgress(mpDocShell);
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 32cfe035919d..cdc495d23a58 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1113,7 +1113,7 @@ private:
std::vector<String>* mpAtnNames;
- sw::util::AuthorInfos* pAuthorInfos;
+ sw::util::AuthorInfos m_aAuthorInfos;
String sBaseURL;
// Ini-Flags:
diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx
index 6b44d824c560..083fbd276456 100644
--- a/sw/source/filter/ww8/ww8par4.cxx
+++ b/sw/source/filter/ww8/ww8par4.cxx
@@ -466,11 +466,7 @@ void SwWW8ImplReader::ReadRevMarkAuthorStrTabl( SvStream& rStrm,
// Store author in doc
sal_uInt16 nSWId = rDocOut.InsertRedlineAuthor(aAuthorNames[nAuthor]);
// Store matchpair
- if( !pAuthorInfos )
- pAuthorInfos = new sw::util::AuthorInfos;
- sw::util::AuthorInfo* pAutorInfo = new sw::util::AuthorInfo( nAuthor, nSWId );
- if( 0 == pAuthorInfos->Insert( pAutorInfo ) )
- delete pAutorInfo;
+ m_aAuthorInfos[nAuthor] = nSWId;
}
}
@@ -524,21 +520,12 @@ void SwWW8ImplReader::Read_CRevisionMark(RedlineType_t eType,
else
{
// start of new revision mark, if not there default to first entry
- sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToShort( pSprmCIbstRMark ) : 0;
- sw::util::AuthorInfo aEntry(nWWAutNo);
- sal_uInt16 nPos;
- if (pAuthorInfos && pAuthorInfos->Seek_Entry(&aEntry, &nPos))
- {
- if (const sw::util::AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
- {
- sal_uInt32 nWWDate = pSprmCDttmRMark ? SVBT32ToUInt32(pSprmCDttmRMark): 0;
- DateTime aStamp(sw::ms::DTTM2DateTime(nWWDate));
- sal_uInt16 nAutorNo = pAuthor->nOurId;
- SwFltRedline aNewAttr(eType, nAutorNo, aStamp);
-
- NewAttr(aNewAttr);
- }
- }
+ sal_uInt16 nWWAutNo = pSprmCIbstRMark ? SVBT16ToShort(pSprmCIbstRMark) : 0;
+ sal_uInt32 nWWDate = pSprmCDttmRMark ? SVBT32ToUInt32(pSprmCDttmRMark): 0;
+ DateTime aStamp(sw::ms::DTTM2DateTime(nWWDate));
+ sal_uInt16 nAuthorNo = m_aAuthorInfos[nWWAutNo];
+ SwFltRedline aNewAttr(eType, nAuthorNo, aStamp);
+ NewAttr(aNewAttr);
}
}