summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <cmc@openoffice.org>2010-01-04 12:57:09 +0000
committerCaolán McNamara <cmc@openoffice.org>2010-01-04 12:57:09 +0000
commitd8b779f2d3b99a845a391a25d43ccfa48c53b4f5 (patch)
treeb8ccfb6635651ddc7a901ea58d864c87f8cf2910 /sw
parent3439c301e10bf14bdc7d1494ea0a4b5f170627bb (diff)
exchgcmtdoc2: #i98634#: export writer change-comment as normal msword comment
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx63
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx6
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx28
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx22
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx3
-rw-r--r--sw/source/filter/ww8/ww8par.cxx5
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx11
7 files changed, 103 insertions, 35 deletions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index 70756840603c..8e6b0c77b878 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -72,6 +72,7 @@
#include <fmtline.hxx>
#include <swtable.hxx>
#include <msfilter.hxx>
+#include <swmodule.hxx>
#include <writerfilter/doctok/sprmids.hxx>
@@ -1856,13 +1857,48 @@ void WW8_WrPlcFtnEdn::Append( WW8_CP nCp, const SwFmtFtn& rFtn )
aCntnt.Insert( p, aCntnt.Count() );
}
-void WW8_WrPlcPostIt::Append( WW8_CP nCp, const SwPostItField& rPostIt )
+WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt)
+{
+ mpRichText = pPostIt->GetTextObject();
+ if (!mpRichText)
+ msSimpleText = pPostIt->GetTxt();
+ msOwner = pPostIt->GetPar1();
+ maDateTime = DateTime(pPostIt->GetDate(), pPostIt->GetTime());
+}
+
+WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline) : mpRichText(0)
+{
+ msSimpleText = pRedline->GetComment();
+ msOwner = SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor());
+ maDateTime = pRedline->GetTimeStamp();
+}
+
+void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt )
{
aCps.Insert( nCp, aCps.Count() );
- void* p = (void*)&rPostIt;
+ WW8_Annotation* p = new WW8_Annotation(pPostIt);
aCntnt.Insert( p, aCntnt.Count() );
}
+void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwRedlineData *pRedline )
+{
+ maProcessedRedlines.insert(pRedline);
+ aCps.Insert( nCp, aCps.Count() );
+ WW8_Annotation* p = new WW8_Annotation(pRedline);
+ aCntnt.Insert( p, aCntnt.Count() );
+}
+
+bool WW8_WrPlcAnnotations::IsNewRedlineComment( const SwRedlineData *pRedline )
+{
+ return maProcessedRedlines.find(pRedline) == maProcessedRedlines.end();
+}
+
+WW8_WrPlcAnnotations::~WW8_WrPlcAnnotations()
+{
+ for( USHORT n=0; n < aCntnt.Count(); n++ )
+ delete (WW8_Annotation*)aCntnt[n];
+}
+
bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp,
WW8_CP& rCount )
{
@@ -1882,13 +1918,13 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( WW8Export& rWrt, BYTE nTTyp,
// Anfaenge fuer PlcfAtnTxt
pTxtPos->Append( rWrt.Fc2Cp( rWrt.Strm().Tell() ));
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
rWrt.WritePostItBegin();
- if (const OutlinerParaObject* pOutliner = rPFld.GetTextObject())
- rWrt.WriteOutliner(*pOutliner, nTTyp);
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
+ if (rAtn.mpRichText)
+ rWrt.WriteOutliner(*rAtn.mpRichText, nTTyp);
else
{
- String sTxt(rPFld.GetTxt());
+ String sTxt(rAtn.msSimpleText);
sTxt.SearchAndReplaceAll(0x0A, 0x0B);
rWrt.WriteStringAsPara( sTxt );
}
@@ -2015,8 +2051,8 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
// then write first the GrpXstAtnOwners
for ( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
- aStrArr.push_back(rPFld.GetPar1());
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
+ aStrArr.push_back(rAtn.msOwner);
}
//sort and remove duplicates
@@ -2054,10 +2090,9 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
{
for( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
- sal_uInt32 nDTTM =
- sw::ms::DateTime2DTTM(DateTime(rPFld.GetDate(),rPFld.GetTime()));
+ sal_uInt32 nDTTM = sw::ms::DateTime2DTTM(rAtn.maDateTime);
SwWW8Writer::WriteLong( *rWrt.pTableStrm, nDTTM );
SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
@@ -2137,12 +2172,12 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, BYTE nTTyp,
{
for ( i = 0; i < nLen; ++i )
{
- const SwPostItField& rPFld = *(SwPostItField*)aCntnt[ i ];
+ const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
//aStrArr is sorted
myiter aIter = ::std::lower_bound(aStrArr.begin(),
- aStrArr.end(), rPFld.GetPar1());
- ASSERT(aIter != aStrArr.end() && *aIter == rPFld.GetPar1(),
+ aStrArr.end(), rAtn.msOwner);
+ ASSERT(aIter != aStrArr.end() && *aIter == rAtn.msOwner,
"Impossible");
sal_uInt16 nFndPos = static_cast< sal_uInt16 >(aIter - aStrArr.begin());
String sAuthor(*aIter);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index fb121eb322f7..fb5ce68ec654 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3039,7 +3039,7 @@ void WW8Export::ExportDocument_Impl()
pFtn = new WW8_WrPlcFtnEdn( TXT_FTN ); // Footnotes
pEdn = new WW8_WrPlcFtnEdn( TXT_EDN ); // Endnotes
- pAtn = new WW8_WrPlcPostIt; // PostIts
+ pAtn = new WW8_WrPlcAnnotations; // PostIts
pTxtBxs = new WW8_WrPlcTxtBoxes( TXT_TXTBOX );
pHFTxtBxs = new WW8_WrPlcTxtBoxes( TXT_HFTXTBOX );
@@ -3448,7 +3448,7 @@ void WW8_WrPlcFtnEdn::WritePlc( WW8Export& rWrt ) const
}
-bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt )
+bool WW8_WrPlcAnnotations::WriteTxt( WW8Export& rWrt )
{
bool bRet = WriteGenericTxt( rWrt, TXT_ATN, rWrt.pFib->ccpAtn );
rWrt.pFldAtn->Finish( rWrt.Fc2Cp( rWrt.Strm().Tell() ),
@@ -3457,7 +3457,7 @@ bool WW8_WrPlcPostIt::WriteTxt( WW8Export& rWrt )
return bRet;
}
-void WW8_WrPlcPostIt::WritePlc( WW8Export& rWrt ) const
+void WW8_WrPlcAnnotations::WritePlc( WW8Export& rWrt ) const
{
WriteGenericPlc( rWrt, TXT_ATN, rWrt.pFib->fcPlcfandTxt,
rWrt.pFib->lcbPlcfandTxt, rWrt.pFib->fcPlcfandRef,
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 2e0b4ab7d778..83b3b7b265ed 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -109,7 +109,7 @@ class WW8_WrPlcFld;
class WW8_WrMagicTable;
class WW8_WrPlcFtnEdn;
class WW8_WrPlcPn;
-class WW8_WrPlcPostIt;
+class WW8_WrPlcAnnotations;
class MSWordSections;
class WW8_WrPlcTxtBoxes;
class WW8_WrPct; // Verwaltung
@@ -488,7 +488,7 @@ public:
WW8_WrPlcPn* pChpPlc;
MSWordAttrIter* pChpIter;
MSWordStyles* pStyles;
- WW8_WrPlcPostIt* pAtn;
+ WW8_WrPlcAnnotations* pAtn;
WW8_WrPlcTxtBoxes *pTxtBxs, *pHFTxtBxs;
const sw::Frame *mpParentFrame; //If set we are exporting content inside
@@ -1149,16 +1149,30 @@ public:
void Append( WW8_CP nCp, const SwFmtFtn& rFtn );
};
-class WW8_WrPlcPostIt : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts
+struct WW8_Annotation
+{
+ const OutlinerParaObject* mpRichText;
+ String msSimpleText;
+ String msOwner;
+ DateTime maDateTime;
+ WW8_Annotation(const SwPostItField* pPostIt);
+ WW8_Annotation(const SwRedlineData* pRedline);
+};
+
+class WW8_WrPlcAnnotations : public WW8_WrPlcSubDoc // Doppel-Plc fuer PostIts
{
private:
//No copying
- WW8_WrPlcPostIt(const WW8_WrPlcPostIt&);
- WW8_WrPlcPostIt& operator=(WW8_WrPlcPostIt&);
+ WW8_WrPlcAnnotations(const WW8_WrPlcAnnotations&);
+ WW8_WrPlcAnnotations& operator=(WW8_WrPlcAnnotations&);
+ std::set<const SwRedlineData*> maProcessedRedlines;
public:
- WW8_WrPlcPostIt() {}
+ WW8_WrPlcAnnotations() {}
+ ~WW8_WrPlcAnnotations();
- void Append( WW8_CP nCp, const SwPostItField& rPostIt );
+ void Append( WW8_CP nCp, const SwPostItField* pPostIt );
+ void Append( WW8_CP nCp, const SwRedlineData* pRedLine );
+ bool IsNewRedlineComment( const SwRedlineData* pRedLine );
bool WriteTxt( WW8Export& rWrt );
void WritePlc( WW8Export& rWrt ) const;
};
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 54ebd5c5a9ba..b20df77e79a1 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -982,6 +982,24 @@ void WW8AttributeOutput::StartRunProperties()
m_nFieldResults = pCurrentFields ? pCurrentFields->ResultCount() : 0;
}
+
+void WW8AttributeOutput::StartRun( const SwRedlineData* pRedlineData )
+{
+ if (pRedlineData)
+ {
+ const String &rComment = pRedlineData->GetComment();
+ //Only possible to export to main text
+ if (rComment.Len() && (m_rWW8Export.nTxtTyp == TXT_MAINTEXT))
+ {
+ if (m_rWW8Export.pAtn->IsNewRedlineComment(pRedlineData))
+ {
+ m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pRedlineData );
+ m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
+ }
+ }
+ }
+}
+
void WW8AttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
{
Redline( pRedlineData );
@@ -2555,8 +2573,8 @@ void WW8AttributeOutput::SetField( const SwField& rFld, ww::eField eType, const
void WW8AttributeOutput::PostitField( const SwField* pFld )
{
- const SwPostItField& rPFld = *(SwPostItField*)pFld;
- m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), rPFld );
+ const SwPostItField *pPFld = (const SwPostItField*)pFld;
+ m_rWW8Export.pAtn->Append( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ), pPFld );
m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
}
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 4968d88887dc..8d8516433432 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -57,8 +57,7 @@ public:
/// Start of the text run.
///
- /// No-op for binary filters.
- virtual void StartRun( const SwRedlineData* /*pRedlineData*/ ) {}
+ virtual void StartRun( const SwRedlineData* pRedlineData );
/// End of the text run.
///
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index b92f80c85290..cf6c4ebb008e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -57,9 +57,8 @@
#include <svx/lrspitem.hxx> // SvxLRSpaceItem
#include <svx/ulspitem.hxx>
#include <svx/langitem.hxx>
-// --> OD 2005-02-28 #i43427#
#include <svx/opaqitem.hxx>
-// <--
+#include <svx/charhiddenitem.hxx>
#include <filter/msfilter/svxmsbas.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdoole2.hxx>
@@ -1630,7 +1629,9 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
sTxt, aDate );
aPostIt.SetTextObject(pOutliner);
+ pCtrlStck->NewAttr(*pPaM->GetPoint(), SvxCharHiddenItem(false, RES_CHRATR_HIDDEN));
rDoc.InsertPoolItem(*pPaM, SwFmtFld(aPostIt), 0);
+ pCtrlStck->SetAttr(*pPaM->GetPoint(), RES_CHRATR_HIDDEN);
return 0;
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f20c13889f27..726e48c314bc 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -4390,15 +4390,16 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
pBkm = &aD[1];
pEdn = &aD[2];
pFtn = &aD[3];
+ pAnd = &aD[4];
-
- pPcd = ( pBase->pPLCFx_PCD ) ? &aD[4] : 0;
+ pPcd = ( pBase->pPLCFx_PCD ) ? &aD[5] : 0;
//pPcdA index == pPcd index + 1
- pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[5] : 0;
- pChp = &aD[6];
- pAnd = &aD[7];
+ pPcdA = ( pBase->pPLCFx_PCDAttrs ) ? &aD[6] : 0;
+
+ pChp = &aD[7];
pPap = &aD[8];
pSep = &aD[9];
+
pSep->pPLCFx = pBase->pSepPLCF;
pFtn->pPLCFx = pBase->pFtnPLCF;
pEdn->pPLCFx = pBase->pEdnPLCF;