You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by le...@apache.org on 2012/08/06 08:07:20 UTC
svn commit: r1369728 - in /incubator/ooo/trunk/main/sw/source/filter/ww8:
wrtw8esh.cxx wrtw8sty.cxx wrtww8.hxx
Author: leidb
Date: Mon Aug 6 06:07:20 2012
New Revision: 1369728
URL: http://svn.apache.org/viewvc?rev=1369728&view=rev
Log:
#119470# fix page number in header lost when we save the .doc file as another in web layout
Reported by: luo qing le
Patch by: Lei De Bin
Review by: Chen Zuo Jun
Modified:
incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx
incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8sty.cxx
incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.hxx
Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx?rev=1369728&r1=1369727&r2=1369728&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8esh.cxx Mon Aug 6 06:07:20 2012
@@ -734,6 +734,16 @@ void WW8_WrPlcTxtBoxes::Append( const Sd
void* p = (void*)&rObj;
aCntnt.Insert( p, aCntnt.Count() );
aShapeIds.Insert( nShapeId, aShapeIds.Count() );
+ //save NULL, if we have an actual SdrObject
+ aSpareFmts.Insert( (void*)NULL, aSpareFmts.Count() );
+}
+
+void WW8_WrPlcTxtBoxes::Append( const SwFrmFmt* pFmt, sal_uInt32 nShapeId )
+{
+ //no sdr object, we insert a NULL in the aCntnt and save the real fmt in aSpareFmts.
+ aCntnt.Insert( (void*)NULL, aCntnt.Count() );
+ aShapeIds.Insert( nShapeId, aShapeIds.Count() );
+ aSpareFmts.Insert( (void*)pFmt, aSpareFmts.Count() );
}
const SvULongs* WW8_WrPlcTxtBoxes::GetShapeIdArr() const
@@ -2569,6 +2579,24 @@ sal_Int32 SwEscherEx::WriteFlyFrm(const
nBorderThick = WriteTxtFlyFrame(rObj, rShapeId, nTxtId, rPVec);
}
+
+ //In browse mode the sdr object doesn't always exist. For example, the
+ //object is in the hidden header/footer. We save the fmt directly
+ //in such cases; we copy most of the logic from the block above
+ const bool bBrowseMode = (rFmt.getIDocumentSettingAccess())->get(IDocumentSettingAccess::BROWSE_MODE);
+ if( bBrowseMode && rFmt.GetDoc())
+ {
+ if( !rFmt.GetChain().GetPrev() )//obj in header/footer?
+ {
+ rShapeId = GetFlyShapeId(rFmt, rObj.mnHdFtIndex, rPVec);
+ pTxtBxs->Append( &rFmt, rShapeId );
+ sal_uInt32 nTxtId = pTxtBxs->Count();
+
+ nTxtId *= 0x10000;
+ nBorderThick = WriteTxtFlyFrame(rObj, rShapeId, nTxtId, rPVec);
+ }
+ }
+
}
}
return nBorderThick;
Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8sty.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8sty.cxx?rev=1369728&r1=1369727&r2=1369728&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8sty.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/wrtw8sty.cxx Mon Aug 6 06:07:20 2012
@@ -1994,6 +1994,8 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( W
aCps.Insert( nCP, i );
pTxtPos->Append( nCP );
+ if( aCntnt[ i ] != NULL )
+ {
// is it an writer or sdr - textbox?
const SdrObject& rObj = *(SdrObject*)aCntnt[ i ];
if (rObj.GetObjInventor() == FmFormInventor)
@@ -2042,7 +2044,17 @@ bool WW8_WrPlcSubDoc::WriteGenericTxt( W
}
// <--
}
-
+ }
+ else if( i < aSpareFmts.Count() )
+ {
+ if( const SwFrmFmt* pFmt = (const SwFrmFmt*)aSpareFmts[ i ] )
+ {
+ const SwNodeIndex* pNdIdx = pFmt->GetCntnt().GetCntntIdx();
+ rWrt.WriteSpecialText( pNdIdx->GetIndex() + 1,
+ pNdIdx->GetNode().EndOfSectionIndex(), nTTyp );
+ }
+ }
+
// CR at end of one textbox text ( otherwise WW gpft :-( )
rWrt.WriteStringAsPara( aEmptyStr );
}
@@ -2177,7 +2189,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( W
// is it an writer or sdr - textbox?
const SdrObject* pObj = (SdrObject*)aCntnt[ i ];
sal_Int32 nCnt = 1;
- if ( !pObj->ISA( SdrTextObj ) )
+ if (pObj && !pObj->ISA( SdrTextObj ) )
{
// find the "highest" SdrObject of this
const SwFrmFmt& rFmt = *::FindFrmFmt( pObj );
@@ -2191,6 +2203,22 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( W
pChn = &pChn->GetNext()->GetChain();
}
}
+ if( NULL == pObj )
+ {
+ if( i < aSpareFmts.Count() && aSpareFmts[ i ] )
+ {
+ const SwFrmFmt& rFmt = *(const SwFrmFmt*)aSpareFmts[ i ];
+
+ const SwFmtChain* pChn = &rFmt.GetChain();
+ while( pChn->GetNext() )
+ {
+ // has a chain?
+ // then calc the cur pos in the chain
+ ++nCnt;
+ pChn = &pChn->GetNext()->GetChain();
+ }
+ }
+ }
// long cTxbx / iNextReuse
SwWW8Writer::WriteLong( *rWrt.pTableStrm, nCnt );
// long cReusable
Modified: incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.hxx?rev=1369728&r1=1369727&r2=1369728&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.hxx (original)
+++ incubator/ooo/trunk/main/sw/source/filter/ww8/wrtww8.hxx Mon Aug 6 06:07:20 2012
@@ -1162,6 +1162,7 @@ protected:
SvULongs aCps; // PTRARR CP-Pos der Verweise
SvPtrarr aCntnt; // PTRARR von SwFmtFtn/PostIts/..
WW8_WrPlc0* pTxtPos; // Pos der einzelnen Texte
+ SvPtrarr aSpareFmts; //a backup for aCntnt: if there's no SdrObject, stores the fmt directly here
WW8_WrPlcSubDoc();
virtual ~WW8_WrPlcSubDoc();
@@ -1235,6 +1236,7 @@ public:
bool WriteTxt( WW8Export& rWrt );
void WritePlc( WW8Export& rWrt ) const;
void Append( const SdrObject& rObj, sal_uInt32 nShapeId );
+ void Append( const SwFrmFmt* pFmt, sal_uInt32 nShapeId );
sal_uInt16 Count() const { return aCntnt.Count(); }
sal_uInt16 GetPos( const VoidPtr& p ) const { return aCntnt.GetPos( p ); }
};