summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2009-07-02 10:41:45 +0000
committerKurt Zenker <kz@openoffice.org>2009-07-02 10:41:45 +0000
commit0d217d39dcc1db15ad6437610b0a5eab1759253d (patch)
tree4e6169d7f59a89e5a3be0814d810c71350845adb
parent7dac09d20b62e44ae7d90b16291dad3cf3072c99 (diff)
CWS-TOOLING: integrate CWS hb311fixes01
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
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx21
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx73
2 files changed, 77 insertions, 17 deletions
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 580ec2a4be..b1a748f813 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4957,8 +4957,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();
+ }
// StyleDef -> "einfach" eintragen || keine Style-Attrs -> dito
const SvxTabStopItem* pStyleTabs = 0;
@@ -4972,9 +4980,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 7763281667..0a45f90728 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,7 +2548,15 @@ void WW8TabDesc::CreateSwTable()
//ability to set the margin.
SvxLRSpaceItem aL( RES_LR_SPACE );
// set right to original DxaLeft (i28656)
- aL.SetLeft( !bIsBiDi ? GetMinLeft() : 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);
}
}