[Libreoffice-commits] core.git: 44 commits - extensions/source filter/source sc/source sd/source sfx2/source sw/source vcl/source vcl/unx writerfilter/source

Caolán McNamara caolanm at redhat.com
Sun Mar 2 13:00:41 PST 2014


 extensions/source/scanner/grid.cxx                     |   42 +++----
 filter/source/msfilter/msdffimp.cxx                    |   91 ++++++++---------
 sc/source/filter/oox/excelfilter.cxx                   |    9 +
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |   17 +--
 sc/source/ui/docshell/docfunc.cxx                      |   31 +----
 sc/source/ui/docshell/externalrefmgr.cxx               |    8 +
 sc/source/ui/drawfunc/fusel.cxx                        |    6 -
 sc/source/ui/miscdlgs/crnrdlg.cxx                      |    2 
 sc/source/ui/undo/undodat.cxx                          |    4 
 sc/source/ui/vba/excelvbahelper.cxx                    |   26 ++--
 sc/source/ui/vba/vbarange.cxx                          |    5 
 sc/source/ui/view/drawvie4.cxx                         |    2 
 sc/source/ui/view/editsh.cxx                           |    3 
 sc/source/ui/view/formatsh.cxx                         |    4 
 sc/source/ui/view/gridwin.cxx                          |    6 -
 sc/source/ui/view/tabview4.cxx                         |   59 +++++------
 sc/source/ui/view/tabvwsh3.cxx                         |   29 ++---
 sc/source/ui/view/viewfun7.cxx                         |    3 
 sd/source/core/drawdoc3.cxx                            |    4 
 sd/source/core/sdpage.cxx                              |    2 
 sd/source/ui/app/sdxfer.cxx                            |   27 ++---
 sfx2/source/dialog/basedlgs.cxx                        |    6 -
 sfx2/source/dialog/dockwin.cxx                         |    4 
 sw/source/core/fields/chpfld.cxx                       |    8 +
 sw/source/filter/ww8/ww8graf.cxx                       |    8 -
 sw/source/filter/ww8/ww8scan.cxx                       |   13 ++
 sw/source/filter/xml/xmltbli.cxx                       |    4 
 sw/source/ui/shells/textsh1.cxx                        |    2 
 vcl/source/gdi/print.cxx                               |    3 
 vcl/source/glyphs/graphite_layout.cxx                  |    2 
 vcl/source/window/window.cxx                           |    4 
 vcl/unx/gtk/a11y/atktext.cxx                           |    2 
 writerfilter/source/dmapper/TablePropertiesHandler.cxx |    3 
 33 files changed, 229 insertions(+), 210 deletions(-)

New commits:
commit 15f90918242dc7ce2911607aef1ed43083a84e37
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 20:18:44 2014 +0000

    coverity#735536 Logically dead code
    
    Change-Id: I92f3abe7e6dbc45455a531c0965ce14936b4f86e

diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 4206037..14b7ffa 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -1170,10 +1170,10 @@ static OUString lcl_GenerateFldTypeName(OUString sPrefix, SwTableNode* pTableNod
     do
     {
         // this is crazy, but just in case all names are taken: exit gracefully
-        if (nCount < 0)
+        if (nCount == SAL_MAX_INT32)
             return sName;
 
-        nCount++;
+        ++nCount;
         sName = sPrefixStr;
         sName += OUString::number(nCount);
 
commit 477a294e1d331046bd0c5e82fc32b5f0b4858469
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 16:44:12 2014 +0000

    coverity#1187830 Uncaught exception
    
    Change-Id: I137af778b9b494c764071e3ae0b8010f080ef936

diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 2f3363a..a41ee46 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2238,7 +2238,13 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
 
     OUString aFilter;
     SrcShell aSrcDoc;
-    aSrcDoc.maShell = loadSrcDocument(nFileId, aFilter);
+    try
+    {
+        aSrcDoc.maShell = loadSrcDocument(nFileId, aFilter);
+    }
+    catch (const css::uno::Exception&)
+    {
+    }
     if (!aSrcDoc.maShell.Is())
     {
         // source document could not be loaded.
commit 2630874bccd77c5f9c54ca930284b8bef471814c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 16:11:03 2014 +0000

    coverity#705422 Improper use of negative value
    
    Change-Id: I28feee353b75d3810358f70dcafb8763918f86fe

diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index e7fe520..7e687e1 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -203,7 +203,13 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, sal_Bool bSrchNum)
             SwNumRule* pRule( pTxtNd->GetNumRule() );
             if ( pTxtNd->IsCountedInList() && pRule )
             {
-                const SwNumFmt& rNFmt = pRule->Get( static_cast<sal_uInt16>(pTxtNd->GetActualListLevel()) );
+                int nListLevel = pTxtNd->GetActualListLevel();
+                if (nListLevel < 0)
+                    nListLevel = 0;
+                if (nListLevel >= MAXLEVEL)
+                    nListLevel = MAXLEVEL - 1;
+
+                const SwNumFmt& rNFmt = pRule->Get(nListLevel);
                 sPost = rNFmt.GetSuffix();
                 sPre = rNFmt.GetPrefix();
             }
commit 6943c70c159279f57490744d762787cef1f0d65a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:59:49 2014 +0000

    coverity#1038300 Explicit null dereferenced
    
    Change-Id: Id16363ad334c9c5801851806984cb14a6244bf54

diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index 7cbe020..b346e88 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -177,7 +177,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
         if( FN_INSERT_HYPERLINK == nSlot )
             pDlg->SetCurPageId("hyperlink");
     }
-    if (nSlot == SID_CHAR_DLG_EFFECT)
+    if (pDlg && nSlot == SID_CHAR_DLG_EFFECT)
     {
         pDlg->SetCurPageId("fonteffect");
     }
commit 2fa807929fe6e5bfd658eb24989c314907ddb014
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:57:06 2014 +0000

    coverity#735998 Dereference after null check
    
    Change-Id: I882bcb2cdde8697ffb5272fd80e2fd602ed54743

diff --git a/vcl/unx/gtk/a11y/atktext.cxx b/vcl/unx/gtk/a11y/atktext.cxx
index a11e4ab..c90a944 100644
--- a/vcl/unx/gtk/a11y/atktext.cxx
+++ b/vcl/unx/gtk/a11y/atktext.cxx
@@ -562,7 +562,7 @@ text_wrapper_get_run_attributes( AtkText        *text,
         if( pTextMarkup )
         {
             // Get attribute run here if it hasn't been done before
-            if( !bOffsetsAreValid )
+            if (!bOffsetsAreValid && pText)
             {
                 accessibility::TextSegment aAttributeTextSegment =
                     pText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN);
commit d5ffe20b47b63cb82740598ede83a3951db1b178
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:55:07 2014 +0000

    coverity#735989 Dereference after null check
    
    Change-Id: I668c8340777e21a7b829bd4e26ba4226da98a566

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index b453696..e3a293c 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -237,7 +237,7 @@ GraphiteLayout::fillFrom(gr_segment * pSegment, ImplLayoutArgs &rArgs, float fSc
             float rightBoundary = (clusterAfter)?
                 gr_slot_origin_X(clusterAfter) : gr_seg_advance_X(pSegment);
             if (
-                lastChar < iChar &&
+                lastChar < iChar && clusterAfter &&
                  (gr_cinfo_after(gr_seg_cinfo(pSegment, iChar)) >
                  static_cast<int>(gr_slot_index(clusterAfter)))
                )
commit 89d4eb66bacaf5c0518ae45a3bb98b159bb42a7b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:53:55 2014 +0000

    coverity#735988 Dereference after null check
    
    Change-Id: I6fdf2b87447de6593216437def295dfcc939aea8

diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index d6eb52d..a50770c 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -383,6 +383,9 @@ const QueueInfo* Printer::GetQueueInfo( const OUString& rPrinterName, bool bStat
     if ( !pSVData->maGDIData.mpPrinterQueueList )
         ImplInitPrnQueueList();
 
+    if ( !pSVData->maGDIData.mpPrinterQueueList )
+        return NULL;
+
     ImplPrnQueueData* pInfo = pSVData->maGDIData.mpPrinterQueueList->Get( rPrinterName );
     if( pInfo )
     {
commit 8b76723f5880e5ae806047e3c2f33e97be44f566
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:52:55 2014 +0000

    coverity#735954 Dereference after null check
    
    Change-Id: I5f3b296b725a7a8bc342813dd2896fba861652f2

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 93a0e26..e703639 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2984,6 +2984,9 @@ void WW8PLCFx_Fc_FKP::advance()
             return;
     }
 
+    if (!pFkp)
+        return;
+
     pFkp->advance();
     if( pFkp->Where() == WW8_FC_MAX )
         NewFkp();
commit 3229dfb4ce37d5e75dbb42a889f6ce607ba13fc1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:52:15 2014 +0000

    coverity#735953 Dereference after null check
    
    Change-Id: Id69a568f404ce689f9e9accf7c9f237b51fe391d

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index ff3168b..93a0e26 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3053,6 +3053,9 @@ bool WW8PLCFx_Fc_FKP::HasSprm(sal_uInt16 nId, std::vector<const sal_uInt8 *> &rR
            return false;
     }
 
+    if (!pFkp)
+        return false;
+
     pFkp->HasSprm(nId, rResult);
 
     WW8PLCFxDesc aDesc;
commit 3f85d01f91f95f6149cf2986a5e1f2195a28858d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:51:30 2014 +0000

    coverity#735952 Dereference after null check
    
    Change-Id: Ia244c5668cd73c7d25e30c0b370cbf17bec85935

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 51a1484..ff3168b 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3021,6 +3021,9 @@ const sal_uInt8* WW8PLCFx_Fc_FKP::HasSprm( sal_uInt16 nId )
             return 0;
     }
 
+    if (!pFkp)
+        return 0;
+
     const sal_uInt8* pRes = pFkp->HasSprm( nId );
 
     if( !pRes )
commit a3a6829ee5bde31180a59f14e803c514f42e9312
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:50:00 2014 +0000

    coverity#735951 Dereference after null check
    
    Change-Id: I7a2215fd3aee26ba4b881f435ceb72b47f7e02e9

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 6a39209..51a1484 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2951,7 +2951,7 @@ WW8_FC WW8PLCFx_Fc_FKP::Where()
         if( !NewFkp() )
             return WW8_FC_MAX;
     }
-    WW8_FC nP = pFkp->Where();
+    WW8_FC nP = pFkp ? pFkp->Where() : WW8_FC_MAX;
     if( nP != WW8_FC_MAX )
         return nP;
 
commit 56304dc45ef8e5db2923323405cb380ddd384f58
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:49:09 2014 +0000

    coverity#735950 Dereference after null check
    
    Change-Id: I3417231c570333a9797fb4efe24f21292e99c6f3

diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 617f21d..6a39209 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -2970,7 +2970,7 @@ sal_uInt8* WW8PLCFx_Fc_FKP::GetSprmsAndPos(WW8_FC& rStart, WW8_FC& rEnd, sal_Int
             return 0;
     }
 
-    sal_uInt8* pPos = pFkp->Get( rStart, rEnd, rLen );
+    sal_uInt8* pPos = pFkp ? pFkp->Get( rStart, rEnd, rLen ) : NULL;
     if( rStart == WW8_FC_MAX )    //Not found
         return 0;
     return pPos;
commit 155cc83a77eba659a99c3cab7c21e3cb0b8de647
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:43:49 2014 +0000

    coverity#735948 Dereference after null check
    
    Change-Id: I71ae6e3cc9aac46a16c377f5b46e141ee638835c

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index ae10e90..84c51d1 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2110,12 +2110,12 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord,
     if (!(pRecord->pXRelTo) && pFSPA)
     {
         pRecord->pXRelTo = new sal_uInt32;
-    *(pRecord->pXRelTo) = pFSPA->nbx;
+        *(pRecord->pXRelTo) = pFSPA->nbx;
     }
     if (!(pRecord->pYRelTo) && pFSPA)
     {
         pRecord->pYRelTo = new sal_uInt32;
-    *(pRecord->pYRelTo) = pFSPA->nby;
+        *(pRecord->pYRelTo) = pFSPA->nby;
     }
 
     // nXAlign - abs. Position, Left,  Centered,  Right,  Inside, Outside
@@ -2155,8 +2155,8 @@ RndStdIds SwWW8ImplReader::ProcessEscherAlign(SvxMSDffImportRec* pRecord,
         }
     }
 
-    sal_uInt32 nXRelTo = nCntRelTo > *(pRecord->pXRelTo) ? *(pRecord->pXRelTo) : 1;
-    sal_uInt32 nYRelTo = nCntRelTo > *(pRecord->pYRelTo) ? *(pRecord->pYRelTo) : 1;
+    sal_uInt32 nXRelTo = (pRecord->pXRelTo && nCntRelTo > *(pRecord->pXRelTo)) ? *(pRecord->pXRelTo) : 1;
+    sal_uInt32 nYRelTo = (pRecord->pYRelTo && nCntRelTo > *(pRecord->pYRelTo)) ? *(pRecord->pYRelTo) : 1;
 
     RndStdIds eAnchor = IsInlineEscherHack() ? FLY_AS_CHAR : FLY_AT_CHAR; // #i43718#
 
commit b2a2404ef0dcfbda15e26d4dfd7397d96279bcde
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:40:34 2014 +0000

    coverity#735816 Dereference after null check
    
    Change-Id: Idbaa44d70e2ed297da1e54d1eb33b8d23db184e1

diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index ef2ab64..648d234 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2885,7 +2885,10 @@ ScVbaRange::PasteSpecial( const uno::Any& Paste, const uno::Any& Operation, cons
         throw uno::RuntimeException("That command cannot be used on multiple selections", uno::Reference< uno::XInterface >() );
     ScDocShell* pShell = getScDocShell();
 
-        uno::Reference< frame::XModel > xModel( ( pShell ? pShell->GetModel() : NULL ), uno::UNO_QUERY_THROW );
+    if (!pShell)
+        throw uno::RuntimeException("That command cannot be used with no ScDocShell", uno::Reference< uno::XInterface >() );
+
+    uno::Reference< frame::XModel > xModel(pShell->GetModel(), uno::UNO_QUERY_THROW);
     uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW );
     // select this range
     xSelection->select( uno::makeAny( mxRange ) );
commit 7c8d2e2b6da71ba829b3f566b764715c79f989a3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:35:15 2014 +0000

    coverity#735830 Dereference after null check
    
    Change-Id: I62342173f01a593fe245ce897f712b9011926620

diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index b57c67f..b55510a 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -956,7 +956,9 @@ sal_Bool SdDrawDocument::InsertBookmarkAsPage(
 
     if( bUndo )
         EndUndo();
-    pUndoMgr->LeaveListAction();
+
+    if (pUndoMgr)
+        pUndoMgr->LeaveListAction();
 
     return bContinue;
 }
commit 4e93f0f507bdd33160a63a2b70d8e7f6f1d92fee
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:30:43 2014 +0000

    coverity#704738 Dereference after null check
    
    Change-Id: I2fa3495a12adeb760bb9dd94fdb5859f011f11b9

diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index f2afea7..a8dd1f7 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -539,24 +539,23 @@ sal_Bool SdTransferable::GetData( const DataFlavor& rFlavor )
             {
                 nOldSwapMode = mpSdDrawDocumentIntern->GetSwapGraphicsMode();
                 mpSdDrawDocumentIntern->SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_PURGE );
-            }
 
-            if( !maDocShellRef.Is() )
-            {
-                maDocShellRef = new ::sd::DrawDocShell(
-                    mpSdDrawDocumentIntern,
-                    SFX_CREATE_MODE_EMBEDDED,
-                    sal_True,
-                    mpSdDrawDocumentIntern->GetDocumentType());
-                mbOwnDocument = sal_False;
-                maDocShellRef->DoInitNew( NULL );
-            }
+                if( !maDocShellRef.Is() )
+                {
+                    maDocShellRef = new ::sd::DrawDocShell(
+                        mpSdDrawDocumentIntern,
+                        SFX_CREATE_MODE_EMBEDDED,
+                        sal_True,
+                        mpSdDrawDocumentIntern->GetDocumentType());
+                    mbOwnDocument = sal_False;
+                    maDocShellRef->DoInitNew( NULL );
+                }
 
-            maDocShellRef->SetVisArea( maVisArea );
-            bOK = SetObject( &maDocShellRef, SDTRANSFER_OBJECTTYPE_DRAWOLE, rFlavor );
+                maDocShellRef->SetVisArea( maVisArea );
+                bOK = SetObject( &maDocShellRef, SDTRANSFER_OBJECTTYPE_DRAWOLE, rFlavor );
 
-            if( mpSdDrawDocumentIntern )
                 mpSdDrawDocumentIntern->SetSwapGraphicsMode( nOldSwapMode );
+            }
         }
     }
 
commit 51c443028791132a11be84fd5eef999309d8776f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:27:56 2014 +0000

    coverity#704732 Dereference after null check
    
    Change-Id: Ida02c1d9f0bc35d115f3762d5c360231ab800b23

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 2fa462c..885130b 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -372,7 +372,7 @@ SdrObject* SdPage::CreatePresObj(PresObjKind eObjKind, sal_Bool bVertical, const
                 nDestPageNum -= 1;
             }
 
-            if(nDestPageNum < pModel->GetPageCount())
+            if (pModel && nDestPageNum < pModel->GetPageCount())
             {
                 pSdrObj = new SdrPageObj(pModel->GetPage(nDestPageNum));
             }
commit 4d3fc566d9b610e9cca47ba0a984c679ab6ca086
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:27:02 2014 +0000

    coverity#704724 Dereference after null check
    
    Change-Id: Icb7570225d3ae0f5a62d2e7f601c2ce729e55a1b

diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 02ec275..76b9e2b 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -670,23 +670,24 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                     }
                     if (pDlg)
                     {
-                       pDlg->SetLimits( MINZOOM, MAXZOOM );
+                        pDlg->SetLimits( MINZOOM, MAXZOOM );
 
-                       bCancel = ( RET_CANCEL == pDlg->Execute() );
-                    }
-                    // bCancel is True only if we were in the previous if block,
-                    // so no need to check again pDlg
-                    if ( !bCancel )
-                    {
-                        const SvxZoomItem&  rZoomItem = (const SvxZoomItem&)
-                                                pDlg->GetOutputItemSet()->
-                                                    Get( SID_ATTR_ZOOM );
+                        bCancel = ( RET_CANCEL == pDlg->Execute() );
 
-                        eNewZoomType = rZoomItem.GetType();
-                        nZoom     = rZoomItem.GetValue();
-                    }
+                        // bCancel is True only if we were in the previous if block,
+                        // so no need to check again pDlg
+                        if ( !bCancel )
+                        {
+                            const SvxZoomItem&  rZoomItem = (const SvxZoomItem&)
+                                                    pDlg->GetOutputItemSet()->
+                                                        Get( SID_ATTR_ZOOM );
 
-                    delete pDlg;
+                            eNewZoomType = rZoomItem.GetType();
+                            nZoom     = rZoomItem.GetValue();
+                        }
+
+                        delete pDlg;
+                    }
                 }
 
                 if ( !bCancel )
commit 61b8232219fd3e98d8f3a3894b9e97a4c1b36317
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:23:17 2014 +0000

    coverity#704723 Dereference after null check
    
    Change-Id: Iec3c87457dff3e7ee0cfe1a0acc262d38bd00033

diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 9be9950..4a18e90 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -247,40 +247,41 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ )
     }
 
     //  Tip-Hilfe fuer Auto-Fill
-
     if ( aViewData.GetRefType() == SC_REFTYPE_FILL && Help::IsQuickHelpEnabled() )
     {
-        OUString aHelpStr;
-        ScRange aMarkRange;
-        aViewData.GetSimpleArea( aMarkRange );
-        SCCOL nEndX = aViewData.GetRefEndX();
-        SCROW nEndY = aViewData.GetRefEndY();
-        ScRange aDelRange;
-        if ( aViewData.GetFillMode() == SC_FILL_MATRIX && !(nScFillModeMouseModifier & KEY_MOD1) )
-        {
-            aHelpStr = ScGlobal::GetRscString( STR_TIP_RESIZEMATRIX );
-            SCCOL nCols = nEndX + 1 - aViewData.GetRefStartX(); // Reihenfolge ist richtig
-            SCROW nRows = nEndY + 1 - aViewData.GetRefStartY();
-            aHelpStr = aHelpStr.replaceFirst("%1", OUString::number(nRows) );
-            aHelpStr = aHelpStr.replaceFirst("%2", OUString::number(nCols) );
-        }
-        else if ( aViewData.GetDelMark( aDelRange ) )
-            aHelpStr = ScGlobal::GetRscString( STR_QUICKHELP_DELETE );
-        else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() )
-            aHelpStr = pDoc->GetAutoFillPreview( aMarkRange, nEndX, nEndY );
-
-        //  je nach Richtung die obere oder untere Ecke:
-        SCCOL nAddX = ( nEndX >= aMarkRange.aEnd.Col() ) ? 1 : 0;
-        SCROW nAddY = ( nEndY >= aMarkRange.aEnd.Row() ) ? 1 : 0;
-        Point aPos = aViewData.GetScrPos( nEndX+nAddX, nEndY+nAddY, aViewData.GetActivePart() );
-        aPos.X() += 8;
-        aPos.Y() += 4;
         Window* pWin = GetActiveWin();
         if ( pWin )
+        {
+            OUString aHelpStr;
+            ScRange aMarkRange;
+            aViewData.GetSimpleArea( aMarkRange );
+            SCCOL nEndX = aViewData.GetRefEndX();
+            SCROW nEndY = aViewData.GetRefEndY();
+            ScRange aDelRange;
+            if ( aViewData.GetFillMode() == SC_FILL_MATRIX && !(nScFillModeMouseModifier & KEY_MOD1) )
+            {
+                aHelpStr = ScGlobal::GetRscString( STR_TIP_RESIZEMATRIX );
+                SCCOL nCols = nEndX + 1 - aViewData.GetRefStartX(); // Reihenfolge ist richtig
+                SCROW nRows = nEndY + 1 - aViewData.GetRefStartY();
+                aHelpStr = aHelpStr.replaceFirst("%1", OUString::number(nRows) );
+                aHelpStr = aHelpStr.replaceFirst("%2", OUString::number(nCols) );
+            }
+            else if ( aViewData.GetDelMark( aDelRange ) )
+                aHelpStr = ScGlobal::GetRscString( STR_QUICKHELP_DELETE );
+            else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() )
+                aHelpStr = pDoc->GetAutoFillPreview( aMarkRange, nEndX, nEndY );
+
+            //  je nach Richtung die obere oder untere Ecke:
+            SCCOL nAddX = ( nEndX >= aMarkRange.aEnd.Col() ) ? 1 : 0;
+            SCROW nAddY = ( nEndY >= aMarkRange.aEnd.Row() ) ? 1 : 0;
+            Point aPos = aViewData.GetScrPos( nEndX+nAddX, nEndY+nAddY, aViewData.GetActivePart() );
+            aPos.X() += 8;
+            aPos.Y() += 4;
             aPos = pWin->OutputToScreenPixel( aPos );
-        Rectangle aRect( aPos, aPos );
-        sal_uInt16 nAlign = QUICKHELP_LEFT|QUICKHELP_TOP;
-        Help::ShowQuickHelp(pWin, aRect, aHelpStr, nAlign);
+            Rectangle aRect( aPos, aPos );
+            sal_uInt16 nAlign = QUICKHELP_LEFT|QUICKHELP_TOP;
+            Help::ShowQuickHelp(pWin, aRect, aHelpStr, nAlign);
+        }
     }
 }
 
commit 757871e78130511f7578350fb50e0de089d32788
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:19:54 2014 +0000

    coverity#704719 Dereference after null check
    
    Change-Id: I99855ab0a79ea653177fba85089253b01b73b8c8

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index e41a07c..d05aaa0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -378,9 +378,9 @@ static sal_Bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
     return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(aPos) && aPos == rRange.aStart);
 }
 
-static void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, const Point& rPos, ScViewData* pViewData )
+static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, ScViewData* pViewData )
 {
-    if (!pView && !pPV && !pDrDoc && !pViewData)
+    if (!pView || !pViewData)
         return;
 
     ScDocument& rDoc = *pViewData->GetDocument();
@@ -3216,7 +3216,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX,
             pDrawView->UnmarkAllObj();
             // Unlock the Internal Layer in order to activate the context menu.
             // re-lock in ScDrawView::MarkListHasChanged()
-            lcl_UnLockComment( pDrawView, pDrawView->GetSdrPageView(), pDrawView->GetModel(), aLogicPos ,pViewData);
+            lcl_UnLockComment( pDrawView, aLogicPos ,pViewData);
             bHitDraw = pDrawView->MarkObj( aLogicPos );
             // draw shell is activated in MarkListHasChanged
         }
commit fb2bc8d9aa6e265c0be8f70a759be4c37e27228d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:17:39 2014 +0000

    coverity#704718 Dereference after null check
    
    Change-Id: Ide237c6192b5e678260c2c6d8207d11362007f02

diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 243c349..a8c30d9 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -197,8 +197,8 @@ void ScFormatShell::GetStyleState( SfxItemSet& rSet )
             {
                 SCTAB           nCurTab     = GetViewData()->GetTabNo();
                 OUString        aPageStyle  = pDoc->GetPageStyle( nCurTab );
-                SfxStyleSheet*  pStyleSheet = (SfxStyleSheet*)pStylePool->
-                                    Find( aPageStyle, SFX_STYLE_FAMILY_PAGE );
+                SfxStyleSheet*  pStyleSheet = pStylePool ? (SfxStyleSheet*)pStylePool->
+                                    Find( aPageStyle, SFX_STYLE_FAMILY_PAGE ) : NULL;
 
                 if ( pStyleSheet )
                     rSet.Put( SfxTemplateItem( nSlotId, aPageStyle ) );
commit 2ca6426e38799236ebe676f08e0c063f8e3fd6d6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:13:23 2014 +0000

    coverity#704716 Dereference after null check
    
    Change-Id: I407ea6b182ebcc72a4de40967b8910d4bd682974

diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index 542b359..9ddedd5 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -727,7 +727,8 @@ void ScEditShell::GetState( SfxItemSet& rSet )
                 {
                     OUString        aStatusVal;
                     LanguageType    nLang = LANGUAGE_NONE;
-                    bool bIsLookUpWord = GetStatusValueForThesaurusFromContext( aStatusVal, nLang, *pActiveView );
+                    bool bIsLookUpWord = pActiveView ?
+                        GetStatusValueForThesaurusFromContext(aStatusVal, nLang, *pActiveView) : false;
                     rSet.Put( SfxStringItem( SID_THES, aStatusVal ) );
 
                     // disable thesaurus context menu entry if there is nothing to look up
commit a3b218e021c3b2d5263a34b1386c43dca8f8eaa9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:11:48 2014 +0000

    coverity#704715 Dereference after null check
    
    Change-Id: Ifd5eb6ccc174d19eb045d5c3ca62846172b9bcc6

diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 3973d09..3dbc28d 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -543,7 +543,7 @@ void ScDrawView::SetMarkedOriginalSize()
         }
     }
 
-    if (nDone)
+    if (nDone && pViewData)
     {
         pUndoGroup->SetComment(ScGlobal::GetRscString( STR_UNDO_ORIGINALSIZE ));
         ScDocShell* pDocSh = pViewData->GetDocShell();
commit bf83deaeca09d72837debc745460c406a7fff782
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:10:20 2014 +0000

    coverity#704711 Dereference after null check
    
    Change-Id: I30e56ab58101a27acc9380031aabbac68fc74487

diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index 051b07c..bebe48c 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -667,7 +667,7 @@ void ScUndoSubTotals::Undo()
     pDoc->SetOutlineTable( nTab, pUndoTable );
 
     // Original column/row status
-    if (pUndoDoc && pUndoTable)
+    if (pUndoTable)
     {
         SCCOLROW nStartCol;
         SCCOLROW nStartRow;
commit 08c8ea386f71588795eb0498811e33bcf2d6f1ef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:09:26 2014 +0000

    coverity#704710 Dereference after null check
    
    Change-Id: I52ba4aed1dac93e3dbaa06cf70e690deac081b6e

diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index d8ff8df..051b07c 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1469,7 +1469,7 @@ void ScUndoRepeatDB::Undo()
     pDoc->SetOutlineTable( nTab, pUndoTable );
 
     // Original column/row status
-    if (pUndoDoc && pUndoTable)
+    if (pUndoTable)
     {
         SCCOLROW nStartCol;
         SCCOLROW nStartRow;
commit 1849f54b456f6131a0aa3bf1d20c93cb5a14d225
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:02:57 2014 +0000

    coverity#704707 Dereference after null check
    
    Change-Id: I28bf5dfb37b1283e6f04b44841395f49542a0f47

diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx
index 8d7eecb..951d8cf 100644
--- a/sc/source/ui/miscdlgs/crnrdlg.cxx
+++ b/sc/source/ui/miscdlgs/crnrdlg.cxx
@@ -981,7 +981,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl)
 {
     OUString aNewArea( pEdAssign->GetText() );
     sal_Bool bValid = false;
-    if ( !aNewArea.isEmpty() )
+    if (!aNewArea.isEmpty() && pDoc)
     {
         ScRange aRange;
         if ( (aRange.ParseAny( aNewArea, pDoc, pDoc->GetAddressConvention() ) & SCA_VALID) == SCA_VALID )
commit 8b2d02ac14d17fbe56ddbefaa486f9a2141c85ba
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 15:01:07 2014 +0000

    coverity#704705 Dereference after null check
    
    Change-Id: I7571b8d05f96ce8a3bf8532d4def647b6815854a

diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx
index 0fbd80f..2e6cd64 100644
--- a/sfx2/source/dialog/basedlgs.cxx
+++ b/sfx2/source/dialog/basedlgs.cxx
@@ -252,7 +252,8 @@ void SfxModelessDialog::Initialize(SfxChildWinInfo *pInfo)
 */
 
 {
-    pImp->aWinState = pInfo->aWinState;
+    if (pInfo)
+        pImp->aWinState = pInfo->aWinState;
 }
 
 void SfxModelessDialog::Resize()
@@ -606,7 +607,8 @@ void SfxFloatingWindow::Initialize(SfxChildWinInfo *pInfo)
     SfxChildWindows.
 */
 {
-    pImp->aWinState = pInfo->aWinState;
+    if (pInfo)
+        pImp->aWinState = pInfo->aWinState;
 }
 
 
commit 237a58a02876dbd69c1474f3a808aa0939dc394d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 14:59:42 2014 +0000

    coverity#704703 Dereference after null check
    
    Change-Id: I272a37a9935785d86ad76db3978cb658573e998c

diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 78c1195..1224014 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -966,7 +966,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo)
         return;
     }
 
-    if ( pInfo->nFlags & SFX_CHILDWIN_FORCEDOCK )
+    if (pInfo && (pInfo->nFlags & SFX_CHILDWIN_FORCEDOCK))
         pImp->bDockingPrevented = sal_True;
 
     pImp->aSplitSize = GetOutputSizePixel();
@@ -981,7 +981,7 @@ void SfxDockingWindow::Initialize(SfxChildWinInfo *pInfo)
     }
 
     sal_Bool bVertHorzRead( sal_False );
-    if ( !pInfo->aExtraString.isEmpty() )
+    if (pInfo && !pInfo->aExtraString.isEmpty())
     {
         // get information about alignment, split size and position in SplitWindow
         OUString aStr;
commit 280d7e50741e515e7f1566df200188a5c4639911
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 14:56:56 2014 +0000

    coverity#704702 Dereference after null check
    
    Change-Id: I5ebb06aa9a478ec31b5ea8a9177ad32b41e0060a

diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index b8b0050..57f16e9 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -492,7 +492,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     /**************************************************************************
     * Ggf. OLE-Objekt beruecksichtigen
     **************************************************************************/
-    SfxInPlaceClient* pIPClient = pViewShell->GetIPClient();
+    SfxInPlaceClient* pIPClient = pViewShell ? pViewShell->GetIPClient() : NULL;
 
     if (pIPClient)
     {
commit 67a308c80cf50b72ec9593be7a00789b55da72de
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 14:55:17 2014 +0000

    coverity#704701 Dereference after null check
    
    Change-Id: I0d9a66d4a609e6df80c3c79b08eee1fb0f95b0eb

diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index bbd7453..b8b0050 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -399,7 +399,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     ::std::vector< OUString > aExcludedChartNames;
     ScRangeListVector aProtectedChartRangesVector;
 
-    if ( rMEvt.IsLeft() )
+    if (pView && rMEvt.IsLeft())
     {
         if ( pView->IsDragObj() )
         {
@@ -504,7 +504,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     }
 
     sal_uInt16 nClicks = rMEvt.GetClicks();
-    if ( nClicks == 2 && rMEvt.IsLeft() )
+    if (pView && nClicks == 2 && rMEvt.IsLeft())
     {
         if ( pView->AreObjectsMarked() )
         {
commit cc157126cc028dd5de19921d6e3b0eca6060e892
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 12:17:05 2014 +0000

    coverity#704682 Dereference after null check
    
    Change-Id: I3bae98670034e12efa6760e5d817e43aabfc1d18

diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 4b34f7c..b613788 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -504,8 +504,12 @@ ScChangeAction* ScXMLChangeTrackingImportHelper::CreateRejectionAction(ScMyRejAc
 ScChangeAction* ScXMLChangeTrackingImportHelper::CreateContentAction(ScMyContentAction* pAction)
 {
     ScCellValue aCell;
+    OUString sInputString;
     if (pAction->pCellInfo)
-         aCell = pAction->pCellInfo->CreateCell(pDoc);
+    {
+        aCell = pAction->pCellInfo->CreateCell(pDoc);
+        sInputString = pAction->pCellInfo->sInputString;
+    }
 
     DateTime aDateTime( Date(0), Time(0) );
     OUString aUser;
@@ -514,7 +518,7 @@ ScChangeAction* ScXMLChangeTrackingImportHelper::CreateContentAction(ScMyContent
     OUString sComment (pAction->aInfo.sComment);
 
     ScChangeAction* pNewAction = new ScChangeActionContent(pAction->nActionNumber, pAction->nActionState, pAction->nRejectingNumber,
-        pAction->aBigRange, aUser, aDateTime, sComment, aCell, pDoc, pAction->pCellInfo->sInputString);
+        pAction->aBigRange, aUser, aDateTime, sComment, aCell, pDoc, sInputString);
     return pNewAction;
 }
 
commit 280f27dc618cda01a7ba0e60b6613a3d5c678925
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 12:14:45 2014 +0000

    unnecessary check before delete
    
    Change-Id: Ia3100e98ed0819e06d759b41f3c02dd145fe0f00

diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index 9f51bcd..4b34f7c 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -84,8 +84,7 @@ ScMyDeleted::ScMyDeleted()
 
 ScMyDeleted::~ScMyDeleted()
 {
-    if (pCellInfo)
-        delete pCellInfo;
+    delete pCellInfo;
 }
 
 ScMyGenerated::ScMyGenerated(ScMyCellInfo* pTempCellInfo, const ScBigRange& aTempBigRange)
@@ -97,8 +96,7 @@ ScMyGenerated::ScMyGenerated(ScMyCellInfo* pTempCellInfo, const ScBigRange& aTem
 
 ScMyGenerated::~ScMyGenerated()
 {
-    if (pCellInfo)
-        delete pCellInfo;
+    delete pCellInfo;
 }
 
 ScMyBaseAction::ScMyBaseAction(const ScChangeActionType nTempActionType)
@@ -162,8 +160,7 @@ ScMyContentAction::ScMyContentAction()
 
 ScMyContentAction::~ScMyContentAction()
 {
-    if (pCellInfo)
-        delete pCellInfo;
+    delete pCellInfo;
 }
 
 ScMyRejAction::ScMyRejAction()
commit 7edf847bf77ce9f6300063168cc9aea316393480
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 12:11:15 2014 +0000

    coverity#704638 Dereference after null check
    
    Change-Id: Ib5e8996d8eb9e487b1c961aa2137b859c887eb6a

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index f87c8e3..679388c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -507,62 +507,65 @@ void SvxMSDffManager::SolveSolver( const SvxMSDffSolverContainer& rSolver )
                             case OBJ_PATHPOLY :
                             case OBJ_PATHPLIN :
                             {
-                                if ( pList && ( pList->GetCount() > nC ) )
+                                if (pList)
                                 {
-                                    bValidGluePoint = sal_True;
-                                    nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
-                                }
-                                else
-                                {
-                                    sal_Bool bNotFound = sal_True;
-
-                                    PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) );
-                                    sal_uInt16 k, j, nPolySize = aPolyPoly.Count();
-                                    if ( nPolySize )
+                                    if (pList->GetCount() > nC )
+                                    {
+                                        bValidGluePoint = sal_True;
+                                        nId = (sal_Int32)((*pList)[ (sal_uInt16)nC].GetId() + 3 );
+                                    }
+                                    else
                                     {
-                                        Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
-                                        if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() )
+                                        sal_Bool bNotFound = sal_True;
+
+                                        PolyPolygon aPolyPoly( EscherPropertyContainer::GetPolyPolygon( aXShape ) );
+                                        sal_uInt16 k, j, nPolySize = aPolyPoly.Count();
+                                        if ( nPolySize )
                                         {
-                                            sal_uInt32  nPointCount = 0;
-                                            for ( k = 0; bNotFound && ( k < nPolySize ); k++ )
+                                            Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
+                                            if ( aBoundRect.GetWidth() && aBoundRect.GetHeight() )
                                             {
-                                                const Polygon& rPolygon = aPolyPoly.GetObject( k );
-                                                for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ )
+                                                sal_uInt32  nPointCount = 0;
+                                                for ( k = 0; bNotFound && ( k < nPolySize ); k++ )
                                                 {
-                                                    PolyFlags eFlags = rPolygon.GetFlags( j );
-                                                    if ( eFlags == POLY_NORMAL )
+                                                    const Polygon& rPolygon = aPolyPoly.GetObject( k );
+                                                    for ( j = 0; bNotFound && ( j < rPolygon.GetSize() ); j++ )
                                                     {
-                                                        if ( nC == nPointCount )
+                                                        PolyFlags eFlags = rPolygon.GetFlags( j );
+                                                        if ( eFlags == POLY_NORMAL )
                                                         {
-                                                            const Point& rPoint = rPolygon.GetPoint( j );
-                                                            double fXRel = rPoint.X() - aBoundRect.Left();
-                                                            double fYRel = rPoint.Y() - aBoundRect.Top();
-                                                            sal_Int32 nWidth = aBoundRect.GetWidth();
-                                                            if ( !nWidth )
-                                                                nWidth = 1;
-                                                            sal_Int32 nHeight= aBoundRect.GetHeight();
-                                                            if ( !nHeight )
-                                                                nHeight = 1;
-                                                            fXRel /= (double)nWidth;
-                                                            fXRel *= 10000;
-                                                            fYRel /= (double)nHeight;
-                                                            fYRel *= 10000;
-                                                            aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) );
-                                                            aGluePoint.SetPercent( true );
-                                                            aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
-                                                            aGluePoint.SetEscDir( SDRESC_SMART );
-                                                            nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 );
-                                                            bNotFound = sal_False;
+                                                            if ( nC == nPointCount )
+                                                            {
+                                                                const Point& rPoint = rPolygon.GetPoint( j );
+                                                                double fXRel = rPoint.X() - aBoundRect.Left();
+                                                                double fYRel = rPoint.Y() - aBoundRect.Top();
+                                                                sal_Int32 nWidth = aBoundRect.GetWidth();
+                                                                if ( !nWidth )
+                                                                    nWidth = 1;
+                                                                sal_Int32 nHeight= aBoundRect.GetHeight();
+                                                                if ( !nHeight )
+                                                                    nHeight = 1;
+                                                                fXRel /= (double)nWidth;
+                                                                fXRel *= 10000;
+                                                                fYRel /= (double)nHeight;
+                                                                fYRel *= 10000;
+                                                                aGluePoint.SetPos( Point( (sal_Int32)fXRel, (sal_Int32)fYRel ) );
+                                                                aGluePoint.SetPercent( true );
+                                                                aGluePoint.SetAlign( SDRVERTALIGN_TOP | SDRHORZALIGN_LEFT );
+                                                                aGluePoint.SetEscDir( SDRESC_SMART );
+                                                                nId = (sal_Int32)((*pList)[ pList->Insert( aGluePoint ) ].GetId() + 3 );
+                                                                bNotFound = sal_False;
+                                                            }
+                                                            nPointCount++;
                                                         }
-                                                        nPointCount++;
                                                     }
                                                 }
                                             }
                                         }
-                                    }
-                                    if ( !bNotFound )
-                                    {
-                                        bValidGluePoint = sal_True;
+                                        if ( !bNotFound )
+                                        {
+                                            bValidGluePoint = sal_True;
+                                        }
                                     }
                                 }
                             }
commit 0f48aba07adee6253c4abd31329f11d485e38139
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 11:54:26 2014 +0000

    coverity#704634 Dereference after null check
    
    Change-Id: Id6e4e71a9d261734d01de72f81e2df0f7fbad475

diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 3bcabb5..5762bb5 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -563,27 +563,30 @@ IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton )
                 break;
         }
 
-        for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
+        if (m_pNewYValues)
         {
-            // find nearest xvalue
-            double x, y;
-            transform( m_aHandles[i].maPos, x, y );
-            int nIndex = 0;
-            double delta = std::fabs( x-m_pXValues[0] );
-            for( int n = 1; n < m_nValues; n++ )
+            for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
             {
-                if( delta > std::fabs( x - m_pXValues[ n ] ) )
+                // find nearest xvalue
+                double x, y;
+                transform( m_aHandles[i].maPos, x, y );
+                int nIndex = 0;
+                double delta = std::fabs( x-m_pXValues[0] );
+                for( int n = 1; n < m_nValues; n++ )
                 {
-                    delta = std::fabs( x - m_pXValues[ n ] );
-                    nIndex = n;
+                    if( delta > std::fabs( x - m_pXValues[ n ] ) )
+                    {
+                        delta = std::fabs( x - m_pXValues[ n ] );
+                        nIndex = n;
+                    }
                 }
+                if( 0 == i )
+                    m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] );
+                else if( m_aHandles.size() - 1L == i )
+                    m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] );
+                else
+                    m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] );
             }
-            if( 0 == i )
-                m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] );
-            else if( m_aHandles.size() - 1L == i )
-                m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] );
-            else
-                m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] );
         }
 
         Invalidate( m_aGridArea );
commit e6ba4db7f0fd02cf875e7e9cfcf3bbfe05676b9b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 11:52:32 2014 +0000

    unnecessary check before delete
    
    Change-Id: I62b42aa20395ff2f6b3dd2b7ab6460be2ce943b8

diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 02f709c..3bcabb5 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -96,16 +96,11 @@ GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window*
     FreeResource();
 }
 
-
-
 GridWindow::~GridWindow()
 {
-    if( m_pNewYValues )
-        delete [] m_pNewYValues;
+    delete [] m_pNewYValues;
 }
 
-
-
 double GridWindow::findMinX()
 {
     if( ! m_pXValues )
commit c7a782b74f290ec0202851f9318d5898edc65077
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 11:50:24 2014 +0000

    coverity#704615 Dereference after null check
    
    Change-Id: I6d19c827ca512822ec8c9f8a56e098fd6315a572

diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 722da94..20518ca 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -6868,9 +6868,9 @@ void Window::SetZOrder( Window* pRefWindow, sal_uInt16 nFlags )
         nFlags |= WINDOW_ZORDER_BEHIND;
     }
 
-    while ( pRefWindow->mpWindowImpl->mpBorderWindow )
+    while ( pRefWindow && pRefWindow->mpWindowImpl->mpBorderWindow )
         pRefWindow = pRefWindow->mpWindowImpl->mpBorderWindow;
-    if ( (pRefWindow == this) || mpWindowImpl->mbFrame )
+    if (!pRefWindow || pRefWindow == this || mpWindowImpl->mbFrame)
         return;
 
     DBG_ASSERT( pRefWindow->mpWindowImpl->mpParent == mpWindowImpl->mpParent, "Window::SetZOrder() - pRefWindow has other parent" );
commit e2a235f17d787650dc5f77eb4f1304cb94ca342e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:47:34 2014 +0000

    coverity#1187654 Logically dead code
    
    Change-Id: I48f35e89112c869131106cd30d0e2456b3ede021

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 91d08cc..c1deef0 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1420,11 +1420,8 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
 
     pDoc->ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
 
-    sal_uInt16 nExtFlags = 0;
     if (!AdjustRowHeight( aMultiRange ))
-        rDocShell.PostPaint( aMultiRange, PAINT_GRID, nExtFlags );
-    else if (nExtFlags & SC_PF_LINES)
-        lcl_PaintAbove( rDocShell, aMultiRange );   // fuer Linien ueber dem Bereich
+        rDocShell.PostPaint( aMultiRange, PAINT_GRID, 0 );
 
     aModificator.SetDocumentModified();
 
commit 38f6bd69c556eadbf1c7d2cf2dc7c8b9560e7099
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:44:51 2014 +0000

    missing vim modelines
    
    Change-Id: I51a2e95ef0a8c8e17bc996ae0c3639717f36de3f

diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 0782b9c..b18bcab 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -382,3 +382,5 @@ ScVbaCellRangeAccess::GetDataSet( ScCellRangesBase* pRangeObj )
 } // namespace excel
 } // namespace vba
 } // namespace ooo
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit fa8dc4f9c8f0ea1acc95fff19ab812b76790019d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:44:04 2014 +0000

    fix coverity#1187656
    
    Change-Id: Ida09e0efd48477b8811cbc4302c57f06a9b1a432

diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 89f32eb..0782b9c 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -192,7 +192,6 @@ implnCut( const uno::Reference< frame::XModel>& xModel )
 void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmpty, bool bTranspose)
 {
     PasteCellsWarningReseter resetWarningBox;
-    sal_Bool bOtherDoc(false);
     InsCellCmd eMoveMode = INS_NONE;
 
     ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
commit 24e7d0390f08c79cfb7b9f71c7cd674594fe2b7f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:43:20 2014 +0000

    coverity#1187655 Logically dead code
    
    Change-Id: I3f490ca9d93849b021bf5804079fd215f077ad49

diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 4df2b5f..91d08cc 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -591,24 +591,17 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
     }
 
     ScRange aMarkRange;
-    bool bSimple = false;
 
     ScMarkData aMultiMark = rMark;
     aMultiMark.SetMarking(false);       // fuer MarkToMulti
 
     ScDocument* pUndoDoc = NULL;
-    bool bMulti = !bSimple && aMultiMark.IsMultiMarked();
-    if (!bSimple)
-    {
-        aMultiMark.MarkToMulti();
-        aMultiMark.GetMultiMarkArea( aMarkRange );
-    }
+    bool bMulti = aMultiMark.IsMultiMarked();
+    aMultiMark.MarkToMulti();
+    aMultiMark.GetMultiMarkArea( aMarkRange );
     ScRange aExtendedRange(aMarkRange);
-    if (!bSimple)
-    {
-        if ( pDoc->ExtendMerge( aExtendedRange, true ) )
-            bMulti = false;
-    }
+    if ( pDoc->ExtendMerge( aExtendedRange, true ) )
+        bMulti = false;
 
     // keine Objekte auf geschuetzten Tabellen
     bool bObjects = false;
@@ -666,14 +659,7 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags,
     }
 
 //! HideAllCursors();   // falls Zusammenfassung aufgehoben wird
-    if (bSimple)
-        pDoc->DeleteArea( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
-                          aMarkRange.aEnd.Col(),   aMarkRange.aEnd.Row(),
-                          aMultiMark, nFlags );
-    else
-    {
-        pDoc->DeleteSelection( nFlags, aMultiMark );
-    }
+    pDoc->DeleteSelection( nFlags, aMultiMark );
 
     // add undo action after drawing undo is complete (objects and note captions)
     if( bRecord )
commit a2bdb9ab23e3f229f669d6c4f7c0ce9853a97ed1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:41:35 2014 +0000

    coverity#1187656 Logically dead code
    
    Change-Id: Id82a05b5de843d4695b0b3ef66fa103153b24d3a

diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx
index 7fa1863..89f32eb 100644
--- a/sc/source/ui/vba/excelvbahelper.cxx
+++ b/sc/source/ui/vba/excelvbahelper.cxx
@@ -192,7 +192,7 @@ implnCut( const uno::Reference< frame::XModel>& xModel )
 void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, sal_uInt16 nFlags, sal_uInt16 nFunction, bool bSkipEmpty, bool bTranspose)
 {
     PasteCellsWarningReseter resetWarningBox;
-    sal_Bool bAsLink(false), bOtherDoc(false);
+    sal_Bool bOtherDoc(false);
     InsCellCmd eMoveMode = INS_NONE;
 
     ScTabViewShell* pTabViewShell = getBestViewShell( xModel );
@@ -200,21 +200,16 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, sal_uInt16
     {
         ScViewData* pView = pTabViewShell->GetViewData();
         Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
-        if ( pView && pWin )
+        if (pWin)
         {
-            if ( bAsLink && bOtherDoc )
-                pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
-            else
-            {
-                ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
-                ScDocument* pDoc = NULL;
-                if ( pOwnClip )
-                    pDoc = pOwnClip->GetDocument();
-                pTabViewShell->PasteFromClip( nFlags, pDoc,
-                    nFunction, bSkipEmpty, bTranspose, bAsLink,
-                    eMoveMode, IDF_NONE, true );
-                pTabViewShell->CellContentChanged();
-            }
+            ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
+            ScDocument* pDoc = NULL;
+            if ( pOwnClip )
+                pDoc = pOwnClip->GetDocument();
+            pTabViewShell->PasteFromClip( nFlags, pDoc,
+                nFunction, bSkipEmpty, bTranspose, false,
+                eMoveMode, IDF_NONE, true );
+            pTabViewShell->CellContentChanged();
         }
     }
 
commit 0e6f3126597ed69ccf01eb472084ccc6a93dc4fe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:38:43 2014 +0000

    coverity#1187657 Dead default in switch
    
    Change-Id: Iaac2a9ac2d779dde0db091b05075c8ecefe5c4cf

diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index 323f288..3824d3b 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -122,9 +122,6 @@ namespace dmapper {
                         case NS_ooxml::LN_CT_TrPr_del:
                             nToken = OOXML_tableRowDelete;
                             break;
-                        default:
-                            throw ::com::sun::star::lang::IllegalArgumentException("illegal redline token type", NULL, 0);
-                            break;
                     };
                     TrackChangesHandlerPtr pTrackChangesHandler( new TrackChangesHandler( nToken ) );
                     pProperties->resolve(*pTrackChangesHandler);
commit 1c5bebefb02b3bdcbd6c56ca3f7d6073ce7eca99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 2 09:36:46 2014 +0000

    coverity#1187664 Dereference after null check
    
    Change-Id: I3e8d8540b055fdcad0379e9bd7a78b3dafed435d

diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 4748211..ba35fe6 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -165,7 +165,8 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
 
                     if (nDiffX!=0 || nDiffY!=0)
                         pNeuObj->NbcMove(Size(nDiffX,nDiffY));
-                    pDestPage->InsertObject( pNeuObj );
+                    if (pDestPage)
+                        pDestPage->InsertObject( pNeuObj );
                     pScDrawView->AddUndo(new SdrUndoInsertObj( *pNeuObj ));
 
                     if (ScDrawLayer::IsCellAnchored(*pNeuObj))
commit a3a2ccc5f5787fb96ecf2f3ccb8b0e7f7ae4eda8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Mar 1 21:21:39 2014 +0000

    coverity#1187821 Uncaught exception
    
    Change-Id: Ida238b29fb94c87b2bd6c45b761f40d4e2313bb5

diff --git a/sc/source/filter/oox/excelfilter.cxx b/sc/source/filter/oox/excelfilter.cxx
index 063d5f1..af44c32 100644
--- a/sc/source/filter/oox/excelfilter.cxx
+++ b/sc/source/filter/oox/excelfilter.cxx
@@ -108,7 +108,14 @@ bool ExcelFilter::importDocument() throw()
     /*  Construct the WorkbookGlobals object referred to by every instance of
         the class WorkbookHelper, and execute the import filter by constructing
         an instance of WorkbookFragment and loading the file. */
-    WorkbookGlobalsRef xBookGlob = WorkbookHelper::constructGlobals( *this );
+    WorkbookGlobalsRef xBookGlob;
+    try
+    {
+        xBookGlob = WorkbookHelper::constructGlobals( *this );
+    }
+    catch (...)
+    {
+    }
     if ( xBookGlob.get() && importFragment( new WorkbookFragment( *xBookGlob, aWorkbookPath ) ) )
     {
         try


More information about the Libreoffice-commits mailing list