summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChen ZuoJun <zjchen@apache.org>2012-10-09 02:26:08 +0000
committerChen ZuoJun <zjchen@apache.org>2012-10-09 02:26:08 +0000
commit723bb36255f525000d8a3f7911f57c1bcfd6f7ba (patch)
tree65e2145795af846c2e3cc6645d8e527eb961a8ba
parentfbbef010986ea359b5209e6d3884bdf4e4ac86a6 (diff)
#i119587# For doc file loaded by AOO, correct table position when table across pages with the Around wrap attribute.
Reported by: Yan Ji Patch by: Lei De Bin Review by: Chen Zuo Jun
Notes
Notes: reject: messy hack
-rw-r--r--sw/source/filter/ww8/ww8par.cxx25
-rw-r--r--sw/source/filter/ww8/ww8par.hxx6
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx10
3 files changed, 32 insertions, 9 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 2d474abbf3d5..0d5d763ca111 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2099,12 +2099,15 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
WW8_TablePos *pTabPos=0;
WW8_TablePos aTabPos;
+ WW8PLCFx_Cp_FKP* pPap = 0;
+ bool bTableHasPositionInfo = false;
+
if (nCellLevel && !bVer67)
{
WW8PLCFxSave1 aSave;
pPlcxMan->GetPap()->Save( aSave );
rbReSync = true;
- WW8PLCFx_Cp_FKP* pPap = pPlcxMan->GetPapPLCF();
+ pPap = pPlcxMan->GetPapPLCF();
WW8_CP nMyStartCp=nStartCp;
if (const sal_uInt8 *pLevel = pPlcxMan->HasParaSprm(0x6649))
@@ -2116,15 +2119,29 @@ bool SwWW8ImplReader::ProcessSpecial(bool &rbReSync, WW8_CP nStartCp)
if (!bHasRowEnd)
nCellLevel = static_cast< sal_uInt8 >(nInTable);
- if (bHasRowEnd && ParseTabPos(&aTabPos,pPap))
- pTabPos = &aTabPos;
+ sal_uLong idstart = rDoc.GetNodes().GetEndOfContent().StartOfSectionIndex(); // get the node index
+ sal_uLong idcur = 0;
+ if ( pPaM && pPaM->GetPoint() )
+ idcur = pPaM->GetPoint()->nNode.GetIndex();
+
+ // Memory first table postion info
+ if ( !pFirstTablePap && idstart + 1 == idcur )
+ pFirstTablePap = pPap;
+
+ if ( bHasRowEnd && ParseTabPos(&aTabPos,pPap) )
+ {
+ // If table front don't have some content and it is doc first table, ignore table text wrapping property
+ bTableHasPositionInfo = true;
+ if ( pFirstTablePap != pPap )
+ pTabPos = &aTabPos;
+ }
pPlcxMan->GetPap()->Restore( aSave );
}
// then look if we are in an Apo
- ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos);
+ ApoTestResults aApo = TestApo(nCellLevel, bTableRowEnd, pTabPos, !(pFirstTablePap == pPap && bTableHasPositionInfo));
//look to see if we are in a Table, but Table in foot/end note not allowed
bool bStartTab = (nInTable < nCellLevel) && !bFtnEdn;
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index d94e094d5e5b..6551a8c4877a 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1103,6 +1103,8 @@ private:
bool bBidi;
bool bReadTable;
boost::shared_ptr<SwPaM> mpTableEndPaM;
+ WW8PLCFx_Cp_FKP* pFirstTablePap;
+
// Indicate that currently on loading a TOC, managed by Read_F_TOX() and End_Field()
bool mbLoadingTOCCache;
// Indicate that current on loading a hyperlink, which is inside a TOC; Managed by Read_F_Hyperlink() and End_Field()
@@ -1239,8 +1241,8 @@ private:
bool StartApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
void StopApo();
bool TestSameApo(const ApoTestResults &rApo, const WW8_TablePos *pTabPos);
- ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd,
- const WW8_TablePos *pTabPos);
+ ApoTestResults TestApo(int nCellLevel, bool bTableRowEnd, const WW8_TablePos *pTabPos,
+ bool bReadTablePos = true);
void EndSpecial();
bool ProcessSpecial(bool &rbReSync, WW8_CP nStartCp);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 7b4c1da99030..c25ec260c2a3 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -528,7 +528,7 @@ bool SwWW8ImplReader::SearchRowEnd(WW8PLCFx_Cp_FKP* pPap, WW8_CP &rStartCp,
}
ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
- const WW8_TablePos *pTabPos)
+ const WW8_TablePos *pTabPos, bool bReadTablePos)
{
const WW8_TablePos *pTopLevelTable = nCellLevel <= 1 ? pTabPos : 0;
ApoTestResults aRet;
@@ -556,9 +556,13 @@ ApoTestResults SwWW8ImplReader::TestApo(int nCellLevel, bool bTableRowEnd,
If we are already a table in a frame then we must grab the para properties
to see if we are still in that frame.
*/
+ // If table front don't have some content and it is doc first table, ignore table text wrapping property
+ if ( bReadTablePos )
+ {
+ aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
+ aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
+ }
- aRet.mpSprm37 = pPlcxMan->HasParaSprm( bVer67 ? 37 : 0x2423 );
- aRet.mpSprm29 = pPlcxMan->HasParaSprm( bVer67 ? 29 : 0x261B );
// Is there some frame data here
bool bNowApo = aRet.HasFrame() || pTopLevelTable;