summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-01-03 15:21:32 +0100
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-01-03 19:59:42 +0100
commitecb0776708183e8a6dd3872b7217f74bc34ad8f0 (patch)
treefa022bcb4205cafd301280ede26da4acad54aa48 /sw/source
parent17ce7f9deab2b302e5a123805e6970ceba2110ce (diff)
cp#2013101510000026: doc export of commented text ranges
Change-Id: I2d31da5d659edcbebc682d5604d2db24b5e341fb (cherry picked from commit 5969eec0e998804eba77338b17de90737e2acb43)
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx103
-rw-r--r--sw/source/filter/ww8/wrtww8.hxx8
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx5
-rw-r--r--sw/source/filter/ww8/ww8attributeoutput.hxx2
4 files changed, 111 insertions, 7 deletions
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index d1ee7d3c8026..9d8fbe85c87d 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -2061,9 +2061,11 @@ void WW8_WrPlcFtnEdn::Append( WW8_CP nCp, const SwFmtFtn& rFtn )
aCntnt.push_back( &rFtn );
}
-WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt)
+WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd)
:
- maDateTime( DateTime::EMPTY )
+ maDateTime( DateTime::EMPTY ),
+ m_nRangeStart(nRangeStart),
+ m_nRangeEnd(nRangeEnd)
{
mpRichText = pPostIt->GetTextObject();
if (!mpRichText)
@@ -2076,17 +2078,33 @@ WW8_Annotation::WW8_Annotation(const SwPostItField* pPostIt)
WW8_Annotation::WW8_Annotation(const SwRedlineData* pRedline)
:
mpRichText(0),
- maDateTime( DateTime::EMPTY )
+ maDateTime( DateTime::EMPTY ),
+ m_nRangeStart(0),
+ m_nRangeEnd(0)
{
msSimpleText = pRedline->GetComment();
msOwner = SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor());
maDateTime = pRedline->GetTimeStamp();
}
+void WW8_WrPlcAnnotations::AddRangeStartPosition( WW8_CP nStartCp)
+{
+ m_nLastRangeStartPos = nStartCp;
+}
+
void WW8_WrPlcAnnotations::Append( WW8_CP nCp, const SwPostItField *pPostIt )
{
aCps.push_back( nCp );
- WW8_Annotation* p = new WW8_Annotation(pPostIt);
+ WW8_Annotation* p;
+ if( m_nLastRangeStartPos != -1 )
+ {
+ p = new WW8_Annotation(pPostIt, m_nLastRangeStartPos, nCp);
+ m_nLastRangeStartPos = -1;
+ }
+ else
+ {
+ p = new WW8_Annotation(pPostIt, nCp, nCp);
+ }
aCntnt.push_back( p );
}
@@ -2272,11 +2290,18 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
{
case TXT_ATN:
{
+ std::vector<WW8_CP> aRangeStartPos;
+ std::vector<WW8_CP> aRangeEndPos;
// then write first the GrpXstAtnOwners
for ( i = 0; i < nLen; ++i )
{
const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
aStrArr.push_back(std::pair<OUString,OUString>(rAtn.msOwner,rAtn.m_sInitials));
+ if( rAtn.m_nRangeStart != rAtn.m_nRangeEnd )
+ {
+ aRangeStartPos.push_back(rAtn.m_nRangeStart);
+ aRangeEndPos.push_back(rAtn.m_nRangeEnd);
+ }
}
//sort and remove duplicates
@@ -2309,6 +2334,67 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
nFcStart = rWrt.pTableStrm->Tell();
rFib.lcbGrpStAtnOwners = nFcStart - rFib.fcGrpStAtnOwners;
+ // Commented text ranges
+ if ( rWrt.bWrtWW8 )
+ {
+ if( aRangeStartPos.size() > 0 )
+ {
+ // Commented text ranges starting positions (Plcfbkf.aCP)
+ rFib.fcPlcfAtnbkf = nFcStart;
+ for ( i = 0; i < aRangeStartPos.size(); ++i )
+ {
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeStartPos[i] );
+ }
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeStartPos[i-1] + 1);
+
+ // Commented text ranges additional informations (Plcfbkf.aFBKF)
+ for ( i = 0; i < aRangeStartPos.size(); ++i )
+ {
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, i ); // FBKF.ibkl
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); // FBKF.bkc
+ }
+
+ nFcStart = rWrt.pTableStrm->Tell();
+ rFib.lcbPlcfAtnbkf = nFcStart - rFib.fcPlcfAtnbkf;
+
+ // Commented text ranges ending positions (PlcfBkl.aCP)
+ rFib.fcPlcfAtnbkl = nFcStart;
+ for ( i = 0; i < aRangeEndPos.size(); ++i )
+ {
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeEndPos[i] );
+ }
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, aRangeEndPos[i-1] + 1);
+
+ // Commented text ranges additional informations (Plcfbkl.aFBKF)
+ for ( i = 0; i < aRangeEndPos.size(); ++i )
+ {
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, i ); // FBKF.ibkl
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); // FBKF.bkc
+ }
+
+ nFcStart = rWrt.pTableStrm->Tell();
+ rFib.lcbPlcfAtnbkl = nFcStart - rFib.fcPlcfAtnbkl;
+
+ // Commented text ranges as bookmarks (SttbfAtnBkmk)
+ rFib.fcSttbfAtnbkmk = nFcStart;
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0xFFFF ); // SttbfAtnBkmk.fExtend
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, aRangeStartPos.size() ); // SttbfAtnBkmk.cData
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0xA ); // SttbfAtnBkmk.cbExtra
+
+ for ( i = 0; i < aRangeStartPos.size(); ++i )
+ {
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 ); // SttbfAtnBkmk.cchData
+ // One ATNBE structure for all text ranges
+ SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0x0100 ); // ATNBE.bmc
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, i ); // ATNBE.lTag
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 ); // ATNBE.lTagOld
+ }
+
+ nFcStart = rWrt.pTableStrm->Tell();
+ rFib.lcbSttbfAtnbkmk = nFcStart - rFib.fcSttbfAtnbkmk;
+ }
+ }
+
// Write the extended >= Word XP ATLD records
if( rWrt.bWrtWW8 )
{
@@ -2409,6 +2495,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
if ( TXT_ATN == nTTyp )
{
+ sal_uInt16 nlTag = 0;
for ( i = 0; i < nLen; ++i )
{
const WW8_Annotation& rAtn = *(const WW8_Annotation*)aCntnt[i];
@@ -2457,7 +2544,13 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp,
SwWW8Writer::WriteShort( *rWrt.pTableStrm, nFndPos );
SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
SwWW8Writer::WriteShort( *rWrt.pTableStrm, 0 );
- SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
+ if( rAtn.m_nRangeStart != rAtn.m_nRangeEnd )
+ {
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, nlTag );
+ ++nlTag;
+ }
+ else
+ SwWW8Writer::WriteLong( *rWrt.pTableStrm, -1 );
}
}
else
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index ad76945850ea..e91ddf855d70 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1195,7 +1195,8 @@ struct WW8_Annotation
OUString msOwner;
OUString m_sInitials;
DateTime maDateTime;
- WW8_Annotation(const SwPostItField* pPostIt);
+ WW8_CP m_nRangeStart, m_nRangeEnd;
+ WW8_Annotation(const SwPostItField* pPostIt, WW8_CP nRangeStart, WW8_CP nRangeEnd);
WW8_Annotation(const SwRedlineData* pRedline);
};
@@ -1206,10 +1207,13 @@ private:
WW8_WrPlcAnnotations(const WW8_WrPlcAnnotations&);
WW8_WrPlcAnnotations& operator=(WW8_WrPlcAnnotations&);
std::set<const SwRedlineData*> maProcessedRedlines;
+
+ WW8_CP m_nLastRangeStartPos;
public:
- WW8_WrPlcAnnotations() {}
+ WW8_WrPlcAnnotations(): m_nLastRangeStartPos(-1){}
~WW8_WrPlcAnnotations();
+ void AddRangeStartPosition( WW8_CP nStartCp );
void Append( WW8_CP nCp, const SwPostItField* pPostIt );
void Append( WW8_CP nCp, const SwRedlineData* pRedLine );
bool IsNewRedlineComment( const SwRedlineData* pRedLine );
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3a367823ef15..e028947a6b40 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2485,6 +2485,11 @@ void WW8AttributeOutput::PostitField( const SwField* pFld )
m_rWW8Export.WritePostItBegin( m_rWW8Export.pO );
}
+void WW8AttributeOutput::WritePostitFieldStart()
+{
+ m_rWW8Export.pAtn->AddRangeStartPosition( m_rWW8Export.Fc2Cp( m_rWW8Export.Strm().Tell() ) );
+}
+
bool WW8AttributeOutput::DropdownField( const SwField* pFld )
{
bool bExpand = true;
diff --git a/sw/source/filter/ww8/ww8attributeoutput.hxx b/sw/source/filter/ww8/ww8attributeoutput.hxx
index 1a3f14bd0b00..2c844334be4e 100644
--- a/sw/source/filter/ww8/ww8attributeoutput.hxx
+++ b/sw/source/filter/ww8/ww8attributeoutput.hxx
@@ -415,6 +415,8 @@ protected:
virtual bool DropdownField( const SwField* pFld );
virtual bool PlaceholderField( const SwField* pFld );
+ virtual void WritePostitFieldStart();
+
virtual bool AnalyzeURL( const OUString& rURL, const OUString& rTarget, OUString* pLinkURL, OUString* pMark );
/// Reference to the export, where to get the data from