diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-07-07 07:53:14 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-07-07 07:53:14 +0000 |
commit | 74a8cb347b093dc7314046c719ef571b0b8274f6 (patch) | |
tree | a96722ee626ed5da363e43b5c12be88737a7350b /sw/source | |
parent | ba52555270c494c1de67ec2765ddb09c56c4a6c2 (diff) |
CWS-TOOLING: integrate CWS hb311fixes01_DEV300
2009-06-30 14:00:11 +0200 hbrinkm r273504 : CWS-TOOLING: rebase CWS hb311fixes01 to branches/OOO310@273447 (milestone: OOO310:m14)
2009-06-12 10:23:10 +0200 hbrinkm r272904 : #159836# added static_int_casts to prevent warning on wntmsci12
2009-06-11 17:13:51 +0200 hbrinkm r272891 : #i101454# also regard new document option 'tab relative to indent' on export
2009-06-10 16:12:17 +0200 hbrinkm r272825 : #i101451# rephrasing ternary expression solves the problem
2009-05-20 11:56:02 +0200 hbrinkm r272113 : #159836# reverted old patch, applied new patch
2009-05-18 18:02:31 +0200 hbrinkm r272042 : #159836# applied patch
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 21 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 75 |
2 files changed, 77 insertions, 19 deletions
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 19158b981a4e..b3e13520a14d 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4959,8 +4959,16 @@ static Writer& OutWW8_SwTabStop(Writer& rWrt, const SfxPoolItem& rHt) { SwWW8Writer& rWW8Wrt = (SwWW8Writer&)rWrt; const SvxTabStopItem & rTStops = (const SvxTabStopItem&)rHt; - const SfxPoolItem* pLR = rWW8Wrt.HasItem( RES_LR_SPACE ); - long nCurrentLeft = pLR ? ((const SvxLRSpaceItem*)pLR)->GetTxtLeft() : 0; + bool bTabsRelativeToIndex = rWW8Wrt.pCurPam->GetDoc()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT); + long nCurrentLeft = 0; + + if (bTabsRelativeToIndex) + { + const SfxPoolItem* pLR = rWW8Wrt.HasItem( RES_LR_SPACE ); + + if (pLR != NULL) + nCurrentLeft = ((const SvxLRSpaceItem*)pLR)->GetTxtLeft(); + } // --> FLR 2009-03-17 #i100264# @@ -4994,9 +5002,14 @@ static Writer& OutWW8_SwTabStop(Writer& rWrt, const SfxPoolItem& rHt) OutWW8_SwTabStopAdd(rWW8Wrt, rTStops, nCurrentLeft); else { - const SvxLRSpaceItem &rStyleLR = + long nStyleLeft = 0; + + if (bTabsRelativeToIndex) + { + const SvxLRSpaceItem &rStyleLR = ItemGet<SvxLRSpaceItem>(*rWW8Wrt.pStyAttr, RES_LR_SPACE); - long nStyleLeft = rStyleLR.GetTxtLeft(); + nStyleLeft = rStyleLR.GetTxtLeft(); + } OutWW8_SwTabStopDelAdd(rWW8Wrt, *pStyleTabs, nStyleLeft, rTStops, nCurrentLeft); diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e636a47a66f0..8463145d1990 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -81,6 +81,8 @@ #include <frmatr.hxx> +#include <iostream> + #define MAX_COL 64 // WW6-Beschreibung: 32, WW6-UI: 31 & WW8-UI: 63! using namespace ::com::sun::star; @@ -1399,14 +1401,34 @@ void WW8TabBandDesc::ProcessSprmTInsert(const BYTE* pParamsTInsert) if( nWwCols && pParamsTInsert ) // set one or more cell length(s) { BYTE nitcInsert = pParamsTInsert[0]; // position at which to insert + if (nitcInsert >= MAX_COL) // cannot insert into cell outside max possible index + return; BYTE nctc = pParamsTInsert[1]; // number of cells USHORT ndxaCol = SVBT16ToShort( pParamsTInsert+2 ); short nNewWwCols; if (nitcInsert > nWwCols) + { nNewWwCols = nitcInsert+nctc; + //if new count would be outside max possible count, clip it, and calc a new replacement + //legal nctc + if (nNewWwCols > MAX_COL) + { + nNewWwCols = MAX_COL; + nctc = ::sal::static_int_cast<BYTE>(nNewWwCols-nitcInsert); + } + } else + { nNewWwCols = nWwCols+nctc; + //if new count would be outside max possible count, clip it, and calc a new replacement + //legal nctc + if (nNewWwCols > MAX_COL) + { + nNewWwCols = MAX_COL; + nctc = ::sal::static_int_cast<BYTE>(nNewWwCols-nWwCols); + } + } WW8_TCell *pTC2s = new WW8_TCell[nNewWwCols]; setcelldefaults(pTC2s, nNewWwCols); @@ -1542,25 +1564,42 @@ void WW8TabBandDesc::ProcessSprmTDelete(const BYTE* pParamsTDelete) if( nWwCols && pParamsTDelete ) // set one or more cell length(s) { BYTE nitcFirst= pParamsTDelete[0]; // first col to be deleted + if (nitcFirst >= nWwCols) // first index to delete from doesn't exist + return; BYTE nitcLim = pParamsTDelete[1]; // (last col to be deleted)+1 + if (nitcLim <= nitcFirst) // second index to delete to is not greater than first index + return; - BYTE nShlCnt = static_cast< BYTE >(nWwCols - nitcLim); // count of cells to be shifted - + /* + * sprmTDelete causes any rgdxaCenter and rgtc entries whose index is + * greater than or equal to itcLim to be moved + */ + int nShlCnt = nWwCols - nitcLim; // count of cells to be shifted - WW8_TCell* pAktTC = pTCs + nitcFirst; - int i = 0; - for( ; i < nShlCnt; i++, ++pAktTC ) + if (nShlCnt >= 0) //There exist entries whose index is greater than or equal to itcLim { - // adjust the left x-position - nCenter[nitcFirst + i] = nCenter[nitcLim + i]; + WW8_TCell* pAktTC = pTCs + nitcFirst; + int i = 0; + while( i < nShlCnt ) + { + // adjust the left x-position + nCenter[nitcFirst + i] = nCenter[nitcLim + i]; - // adjust the cell's borders - *pAktTC = pTCs[ nitcLim + i]; + // adjust the cell's borders + *pAktTC = pTCs[ nitcLim + i]; + + ++i; + ++pAktTC; + } + // adjust the left x-position of the dummy at the very end + nCenter[nitcFirst + i] = nCenter[nitcLim + i]; } - // adjust the left x-position of the dummy at the very end - nCenter[nitcFirst + i] = nCenter[nitcLim + i]; - nWwCols -= (nitcLim - nitcFirst); + short nCellsDeleted = nitcLim - nitcFirst; + //clip delete request to available number of cells + if (nCellsDeleted > nWwCols) + nCellsDeleted = nWwCols; + nWwCols -= nCellsDeleted; } } @@ -2509,9 +2548,15 @@ void WW8TabDesc::CreateSwTable() //ability to set the margin. SvxLRSpaceItem aL( RES_LR_SPACE ); // set right to original DxaLeft (i28656) - aL.SetLeft( !bIsBiDi ? - static_cast<long>(GetMinLeft()) : - static_cast<long>(pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft) ); + + long nLeft = 0; + if (!bIsBiDi) + nLeft = GetMinLeft(); + else + nLeft = pIo->maSectionManager.GetTextAreaWidth() - nPreferredWidth - nOrgDxaLeft; + + aL.SetLeft(nLeft); + aItemSet.Put(aL); } } |