[ooo-build-commit] Branch 'ooo/master' - 2 commits - sw/inc sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Jul 7 19:48:50 PDT 2009


 sw/inc/authfld.hxx                |    2 -
 sw/source/core/fields/authfld.cxx |    5 ++
 sw/source/filter/ww8/ww8atr.cxx   |   21 ++++++++--
 sw/source/filter/ww8/ww8par2.cxx  |   75 ++++++++++++++++++++++++++++++--------
 sw/source/ui/fldui/fldmgr.cxx     |   32 +++++++++++-----
 5 files changed, 104 insertions(+), 31 deletions(-)

New commits:
commit d1456637efbe1461a2d1bd0e1220b37f38f8b15a
Author: Vladimir Glazounov <vg at openoffice.org>
Date:   Tue Jul 7 08:58:17 2009 +0000

    CWS-TOOLING: integrate CWS c17v006_DEV300
    2009-05-26 14:54:33 +0200 os  r272304 : #i99069# modification of bibliography entries fixed

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 5315806..cb8ac07 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -118,7 +118,7 @@ public:
     void 				GetAllEntryIdentifiers( SvStringsDtor& rToFill )const;
     const SwAuthEntry* 	GetEntryByIdentifier(const String& rIdentifier)const;
 
-    void				ChangeEntryContent(const SwAuthEntry* pNewEntry);
+    bool                ChangeEntryContent(const SwAuthEntry* pNewEntry);
     // import interface
     USHORT				AppendField(const SwAuthEntry& rInsert);
     long				GetHandle(USHORT nPos);
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 2914f3e..281de8b 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -288,8 +288,9 @@ const SwAuthEntry* 	SwAuthorityFieldType::GetEntryByIdentifier(
 /* -----------------------------21.12.99 13:20--------------------------------
 
  ---------------------------------------------------------------------------*/
-void SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
+bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
 {
+    bool bChanged = false;
     for( USHORT j = 0; j < m_pDataArr->Count(); ++j )
     {
         SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
@@ -299,9 +300,11 @@ void SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
             for(USHORT i = 0; i < AUTH_FIELD_END; i++)
                 pTemp->SetAuthorField((ToxAuthorityField) i,
                     pNewEntry->GetAuthorField((ToxAuthorityField)i));
+            bChanged = true;
             break;
         }
     }
+    return bChanged;
 }
 /*-- 11.10.99 08:49:22---------------------------------------------------
     Description: 	appends a new entry (if new) and returns the array position
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx
index d1d260b..289b4ab 100644
--- a/sw/source/ui/fldui/fldmgr.cxx
+++ b/sw/source/ui/fldui/fldmgr.cxx
@@ -31,9 +31,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-#ifndef _CMDID_H
 #include <cmdid.h>
-#endif
 #include <hintids.hxx>
 #include <svtools/stritem.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -63,21 +61,15 @@
 #include <svtools/zforlist.hxx>
 #include <svtools/zformat.hxx>
 #include <vcl/mnemonic.hxx>
-#ifndef _VIEW_HXX
 #include <view.hxx>
-#endif
 #include <wrtsh.hxx>		// Actives Fenster
 #include <doc.hxx>		// Actives Fenster
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>		// Actives Fenster
-#endif
 #include <swmodule.hxx>
 #include <charatr.hxx>
 #include <fmtinfmt.hxx>
 #include <cellatr.hxx>
-#ifndef _DBMGR_HXX
 #include <dbmgr.hxx>
-#endif
 #include <shellres.hxx>
 #include <fldbas.hxx>
 #include <docufld.hxx>
@@ -92,9 +84,8 @@
 #include <fldmgr.hxx>
 #include <crsskip.hxx>
 #include <flddropdown.hxx>
-#ifndef _FLDUI_HRC
 #include <fldui.hrc>
-#endif
+#include <tox.hxx>
 
 using rtl::OUString;
 using namespace com::sun::star::uno;
@@ -1552,6 +1543,27 @@ void SwFldMgr::UpdateCurFld(ULONG nFormat,
             bSetPar1 = bSetPar2 = FALSE;
         }
         break;
+        case TYP_AUTHORITY :
+        {    
+            //#i99069# changes to a bibliography field should change the field type
+            SwAuthorityField* pAuthorityField = static_cast<SwAuthorityField*>(pTmpFld);
+            SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType);
+            SwAuthEntry aTempEntry;
+            for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+                aTempEntry.SetAuthorField( (ToxAuthorityField)i,
+                                rPar1.GetToken( i, TOX_STYLE_DELIMITER ));
+            if( pAuthorityType->ChangeEntryContent( &aTempEntry ) )
+            {
+                pType->UpdateFlds();
+                pSh->SetModified();
+            }
+        
+            if( aTempEntry.GetAuthorField( AUTH_FIELD_IDENTIFIER ) == 
+                pAuthorityField->GetFieldText( AUTH_FIELD_IDENTIFIER ) ) 
+                bSetPar1 = FALSE; //otherwise it's a new or changed entry, the field needs to be updated    
+            bSetPar2 = FALSE;
+        }
+        break;
     }
 
     // Format setzen
commit 666c6b8a70c8e74b0cc67d239b60538634e5e954
Author: Vladimir Glazounov <vg at openoffice.org>
Date:   Tue Jul 7 07:53:14 2009 +0000

    CWS-TOOLING: integrate CWS hb311fixes01_DEV300
    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 7997d24..fff1b6b 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 8e61825..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,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);
         }
     }


More information about the ooo-build-commit mailing list