[Libreoffice-commits] .: sc/source

Julien Nabet serval2412 at kemper.freedesktop.org
Sat Feb 5 15:00:31 PST 2011


 sc/source/core/data/markarr.cxx    |    7 +++----
 sc/source/core/data/patattr.cxx    |    2 +-
 sc/source/filter/xml/xmlexprt.cxx  |    5 ++++-
 sc/source/filter/xml/xmlimprt.hxx  |   24 ------------------------
 sc/source/ui/docshell/dbdocfun.cxx |    8 +++++---
 sc/source/ui/undo/undoblk2.cxx     |    6 +++---
 sc/source/ui/view/tabvwsh3.cxx     |   10 +++++++---
 7 files changed, 23 insertions(+), 39 deletions(-)

New commits:
commit 300a5352e781ed6137b37bb1b8941a004c046b22
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Feb 5 23:59:52 2011 +0100

    Some cppcheck cleaning

diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index 791af19..1b58ea8 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -77,14 +77,13 @@ void ScMarkArray::Reset( BOOL bMarked )
 
 BOOL ScMarkArray::Search( SCROW nRow, SCSIZE& nIndex ) const
 {
-    long	nLo 		= 0;
     long	nHi 		= static_cast<long>(nCount) - 1;
-    long	nStartRow	= 0;
-    long	nEndRow 	= 0;
     long	i			= 0;
     BOOL	bFound		= (nCount == 1);
     if (pData)
     {
+        long	nLo 		= 0;
+        long	nStartRow	= 0;
         while ( !bFound && nLo <= nHi )
         {
             i = (nLo + nHi) / 2;
@@ -92,7 +91,7 @@ BOOL ScMarkArray::Search( SCROW nRow, SCSIZE& nIndex ) const
                 nStartRow = (long) pData[i - 1].nRow;
             else
                 nStartRow = -1;
-            nEndRow = (long) pData[i].nRow;
+            long nEndRow = (long) pData[i].nRow;
             if (nEndRow < (long) nRow)
                 nLo = ++i;
             else
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index f0ece85..bfe48e7 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -168,12 +168,12 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, USHORT /* nVersion */ ) c
 {
     String* pStr;
     BOOL	bHasStyle;
-    short	eFamDummy;
 
     rStream >> bHasStyle;
 
     if ( bHasStyle )
     {
+        short	eFamDummy;
         pStr = new String;
         rStream.ReadByteString( *pStr, rStream.GetStreamCharSet() );
         rStream >> eFamDummy; // wg. altem Dateiformat
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 62c80b7..20022d3 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2920,8 +2920,11 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
                                 pDoc->GetValue( aCellPos ));
                     }
                     else
-                        GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
+                    {
+                        if (pDoc)
+                          GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
                             aCell.nNumberFormat, pDoc->GetValue( aCellPos ));
+                    }
                 }
                 else
                 {
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index 6a53601..b69986a 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -684,17 +684,12 @@ class ScXMLImport: public SvXMLImport
     rtl::OUString						sStandardFormat;
     rtl::OUString						sType;
 
-//	SvXMLAutoStylePoolP		*pScAutoStylePool;
     UniReference < XMLPropertyHandlerFactory >	xScPropHdlFactory;
     UniReference < XMLPropertySetMapper >		xCellStylesPropertySetMapper;
     UniReference < XMLPropertySetMapper >		xColumnStylesPropertySetMapper;
     UniReference < XMLPropertySetMapper >		xRowStylesPropertySetMapper;
     UniReference < XMLPropertySetMapper >		xTableStylesPropertySetMapper;
-//	SvXMLImportContextRef		xStyles;
-//	SvXMLImportContextRef		xAutoStyles;
 
-//	SvXMLImportItemMapper	*pParaItemMapper;// paragraph item import
-//	SvI18NMap				*pI18NMap;			// name mapping for I18N
     SvXMLTokenMap			*pDocElemTokenMap;
     SvXMLTokenMap			*pStylesElemTokenMap;
     SvXMLTokenMap			*pStylesAttrTokenMap;
@@ -823,8 +818,6 @@ public:
                                     const ::rtl::OUString& rLocalName );
     SvXMLImportContext *CreateStylesContext(const ::rtl::OUString& rLocalName,
                                      const com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList, sal_Bool bAutoStyles );
-//	SvXMLImportContext *CreateUseStylesContext(const ::rtl::OUString& rLocalName ,
-//									const ::com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList);
     SvXMLImportContext *CreateBodyContext(
                                     const ::rtl::OUString& rLocalName,
                                     const ::com::sun::star::uno::Reference<com::sun::star::xml::sax::XAttributeList>& xAttrList );
@@ -844,21 +837,10 @@ public:
 
     sal_Int16 GetCellType(const ::rtl::OUString& rStrValue) const;
 
-//	SvI18NMap& GetI18NMap() { return *pI18NMap; }
-
-//	inline const SvXMLImportItemMapper& GetParaItemMapper() const;
-//	SvXMLImportContext *CreateParaItemImportContext( USHORT nPrefix,
-//								  const ::rtl::OUString& rLocalName,
-//								  const ::com::sun::star::uno::Reference<
-//									::com::sun::star::xml::sax::XAttributeList& xAttrList,
-//								  SfxItemSet& rItemSet );
-
     UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() const { return xCellStylesPropertySetMapper; }
     UniReference < XMLPropertySetMapper > GetColumnStylesPropertySetMapper() const { return xColumnStylesPropertySetMapper; }
     UniReference < XMLPropertySetMapper > GetRowStylesPropertySetMapper() const { return xRowStylesPropertySetMapper; }
     UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() const { return xTableStylesPropertySetMapper; }
-//	SvXMLImportContextRef			GetAutoStyles() const { return xAutoStyles; }
-//	SvXMLImportContextRef			GetStyles() const { return xStyles; }
 
     const SvXMLTokenMap& GetDocElemTokenMap();
     const SvXMLTokenMap& GetBodyElemTokenMap();
@@ -924,11 +906,6 @@ public:
     const SvXMLTokenMap& GetDataPilotMembersElemTokenMap();
     const SvXMLTokenMap& GetDataPilotMemberAttrTokenMap();
     const SvXMLTokenMap& GetConsolidationAttrTokenMap();
-//	const SvXMLTokenMap& GetTextPElemTokenMap();
-//	const SvXMLTokenMap& GetTextPAttrTokenMap();
-//	const SvXMLTokenMap& GetStyleStylesElemTokenMap();
-//	const SvXMLTokenMap& GetTextListBlockAttrTokenMap();
-//	const SvXMLTokenMap& GetTextListBlockElemTokenMap();
 
     void	AddNamedExpression(const ScMyNamedExpression* pMyNamedExpression) {
         if (!pMyNamedExpressions)
@@ -996,7 +973,6 @@ public:
     // XServiceInfo
     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
 
-    // ::com::sun::star::xml::sax::XDocumentHandler
     virtual void SAL_CALL startDocument(void)
         throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
     virtual void SAL_CALL endDocument(void)
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index a37a48c..4a6e335 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -885,12 +885,14 @@ BOOL ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
                                                     nCol, nAttrRow, nDestTab );
                 DBG_ASSERT(pSrcPattern,"Pattern ist 0");
                 if (pSrcPattern)
+                {
                     pDoc->ApplyPatternAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
                                                     nDestTab, *pSrcPattern );
-                const ScStyleSheet* pStyle = pSrcPattern->GetStyleSheet();
-                if (pStyle)
-                    pDoc->ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
+                    const ScStyleSheet* pStyle = pSrcPattern->GetStyleSheet();
+                    if (pStyle)
+                        pDoc->ApplyStyleAreaTab( nCol, nAttrRow, nCol, aLocalParam.nRow2,
                                                     nDestTab, *pStyle );
+                }
             }
 
             delete pAttribDoc;
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index a393f63..7970f9f 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -190,10 +190,10 @@ void ScUndoWidthOrHeight::Redo()
         SCTAB nTab = pViewShell->GetViewData()->GetTabNo();
         if ( nTab < nStartTab || nTab > nEndTab )
             pViewShell->SetTabNo( nStartTab );
-    }
 
-    // SetWidthOrHeight aendert aktuelle Tabelle !
-    pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
+        // SetWidthOrHeight aendert aktuelle Tabelle !
+        pViewShell->SetWidthOrHeight( bWidth, nRangeCnt, pRanges, eMode, nNewSize, FALSE, TRUE, &aMarkData );
+    }
 
     // paint grid if selection was changed directly at the MarkData
     if (bPaintAll)
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 09d89f1..3e855a9 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -694,10 +694,14 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
                         pDlg = pFact->CreateSvxZoomDialog(GetDialogParent(), aSet );
                         DBG_ASSERT(pDlg, "Dialogdiet fail!");
                     }
-                    pDlg->SetLimits( MINZOOM, MAXZOOM );
-
-                    bCancel = ( RET_CANCEL == pDlg->Execute() );
+                    if (pDlg)
+                    {
+                       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&)


More information about the Libreoffice-commits mailing list