[ooo-build-commit] Branch 'ooo/OOO310' - sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Thu Jul 2 19:50:32 PDT 2009


 sw/source/filter/ww8/ww8atr.cxx  |   21 +++++++++--
 sw/source/filter/ww8/ww8par2.cxx |   73 ++++++++++++++++++++++++++++++++-------
 2 files changed, 77 insertions(+), 17 deletions(-)

New commits:
commit 0d217d39dcc1db15ad6437610b0a5eab1759253d
Author: Kurt Zenker <kz at openoffice.org>
Date:   Thu Jul 2 10:41:45 2009 +0000

    CWS-TOOLING: integrate CWS hb311fixes01
    2009-06-30 14:00:11 +0200 hbrinkm  r273504 : CWS-TOOLING: rebase CWS hb311fixes01 to branches/OOO310 at 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

diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 580ec2a..b1a748f 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 7763281..0a45f90 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);
         }
     }


More information about the ooo-build-commit mailing list