Blob Blame History Raw
From fa8128adf0bdd7698a2806fd277da2ff61bb8dfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Tue, 28 Oct 2014 11:35:18 +0000
Subject: [PATCH] Resolves: rhbz#1215060 get LibreOffice to load specific
 Polarion .docx

coverity#1000600 Division or modulo by zero

Change-Id: I38fb8a7072eb7905f5dccc8697b3176d8b34c6c2
(cherry picked from commit 04343704ae9e5b2be4a47f7ba8ef35174db7076d)

coverity#1202781 Division or modulo by zero

(cherry picked from commit 54ba9587c0f1d3b5206742339af4907047fb4748)

Conflicts:
	filter/source/graphicfilter/epict/epict.cxx
	svtools/source/misc/imap.cxx

Change-Id: I2908c57badd079c8f19c679f40ed815ce2cba374

coverity#1000600 Division or modulo by float zero

Change-Id: If39679b54ef1bb0a7af794c2f7a6186ebd69c2e0
(cherry picked from commit 2149e924cbc32c370128c5f87a4f55c50c99e6bd)

be a little more consistent stylewise

(cherry picked from commit 2d5130ebab13fb94b07950a03b7051825b3d5b15)

Conflicts:
	vcl/source/outdev/map.cxx

Change-Id: If1d822e0e6c87e792ff4a769a525e161505325c9

Related: rhbz#1215060 pass std::exceptions through

(cherry picked from commit cb4276278962c2cbd47d0685881fb2460bf31c70)

Conflicts:
	writerfilter/source/ooxml/OOXMLFastContextHandler.hxx

Change-Id: Ifb3431a50f92b95dfc1e851f9584533271e69324
---
 filter/source/graphicfilter/epict/epict.cxx        |  2 +-
 include/o3tl/numeric.hxx                           | 28 +++++++++++++
 svtools/source/misc/imap.cxx                       |  2 +-
 sw/source/core/docnode/ndtbl.cxx                   | 22 ++++++----
 .../source/dmapper/DomainMapperTableManager.cxx    | 47 ++++++++++++++-------
 .../source/ooxml/OOXMLFastContextHandler.cxx       | 48 ++++++++++-----------
 .../source/ooxml/OOXMLFastContextHandler.hxx       | 49 +++++++++++-----------
 7 files changed, 124 insertions(+), 74 deletions(-)
 create mode 100644 include/o3tl/numeric.hxx

diff --git a/filter/source/graphicfilter/epict/epict.cxx b/filter/source/graphicfilter/epict/epict.cxx
index 1675cdc..2e037dd 100644
--- a/filter/source/graphicfilter/epict/epict.cxx
+++ b/filter/source/graphicfilter/epict/epict.cxx
@@ -34,7 +34,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/gdimtf.hxx>
 #include <tools/bigint.hxx>
-
+#include <o3tl/numeric.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <boost/scoped_array.hpp>
diff --git a/include/o3tl/numeric.hxx b/include/o3tl/numeric.hxx
new file mode 100644
index 0000000..09f67f5
--- /dev/null
+++ b/include/o3tl/numeric.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_NUMERIC_HXX
+#define INCLUDED_O3TL_NUMERIC_HXX
+
+#include <stdexcept>
+
+namespace o3tl
+{
+    struct divide_by_zero : public std::runtime_error
+    {
+        explicit divide_by_zero()
+            : std::runtime_error("divide by zero")
+        {
+        }
+    };
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index df2fddc..887d0ce 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -22,7 +22,7 @@
 #include <vcl/svapp.hxx>
 #include <vcl/mapmod.hxx>
 #include <vcl/window.hxx>
-
+#include <o3tl/numeric.hxx>
 #include <svl/urihelper.hxx>
 #include <svtools/imap.hxx>
 #include <svtools/imapobj.hxx>
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index c10acd5..c6a9a07 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -85,6 +85,7 @@
 #include <rootfrm.hxx>
 #include <fldupde.hxx>
 #include <switerator.hxx>
+#include <o3tl/numeric.hxx>
 #include <boost/foreach.hpp>
 
 #ifdef DBG_UTIL
@@ -2950,7 +2951,7 @@ const SwTableBox* SwCollectTblLineBoxes::GetBoxOfPos( const SwTableBox& rBox )
 
 bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
 {
-    sal_uInt16 n;
+    size_t n;
 
     if( !aPosArr.empty() )
     {
@@ -2969,13 +2970,20 @@ bool SwCollectTblLineBoxes::Resize( sal_uInt16 nOffset, sal_uInt16 nOldWidth )
         aPosArr.erase( aPosArr.begin(), aPosArr.begin() + n );
         m_Boxes.erase(m_Boxes.begin(), m_Boxes.begin() + n);
 
-        // Adapt the positions to the new Size
-        for( n = 0; n < aPosArr.size(); ++n )
+        size_t nSize = aPosArr.size();
+        if (nSize)
         {
-            sal_uLong nSize = nWidth;
-            nSize *= ( aPosArr[ n ] - nOffset );
-            nSize /= nOldWidth;
-            aPosArr[ n ] = sal_uInt16( nSize );
+            if (nOldWidth == 0)
+                throw o3tl::divide_by_zero();
+
+            // Adapt the positions to the new Size
+            for( n = 0; n < nSize; ++n )
+            {
+                sal_uLong nSize = nWidth;
+                nSize *= ( aPosArr[ n ] - nOffset );
+                nSize /= nOldWidth;
+                aPosArr[ n ] = sal_uInt16( nSize );
+            }
         }
     }
     return !aPosArr.empty();
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 22c7a62..c4ba571 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -30,6 +30,7 @@
 #include <com/sun/star/text/TableColumnSeparator.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
+#include <o3tl/numeric.hxx>
 #include <ooxml/resourceids.hxx>
 #include <dmapperLoggers.hxx>
 
@@ -697,20 +698,27 @@ void DomainMapperTableManager::endOfRowAction()
         sal_Int16 nLastRelPos = 0;
         sal_uInt32 nBorderGridIndex = m_nGridBefore;
 
-        ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
-        for( sal_uInt32 nBorder = 0; nBorder < m_nCell.back( ) - 1; ++nBorder )
+        size_t nWidthsBound =  m_nCell.back( ) - 1;
+        if (nWidthsBound)
         {
-            double fGridWidth = 0.;
-            for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount )
-                fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
+            if (nFullWidthRelative == 0)
+                throw o3tl::divide_by_zero();
 
-            sal_Int16 nRelPos =
-                sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative);
+            ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
+            for( sal_uInt32 nBorder = 0; nBorder < nWidthsBound; ++nBorder )
+            {
+                double fGridWidth = 0.;
+                for ( sal_Int32 nGridCount = *aSpansIter; nGridCount > 0; --nGridCount )
+                    fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
+
+                sal_Int16 nRelPos =
+                    sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative);
 
-            pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
-            pSeparators[nBorder].IsVisible = sal_True;
-            nLastRelPos = nLastRelPos + nRelPos;
-            ++aSpansIter;
+                pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
+                pSeparators[nBorder].IsVisible = sal_True;
+                nLastRelPos = nLastRelPos + nRelPos;
+                ++aSpansIter;
+            }
         }
         TablePropertyMapPtr pPropMap( new TablePropertyMap );
         pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, uno::makeAny( aSeparators ) );
@@ -744,12 +752,19 @@ void DomainMapperTableManager::endOfRowAction()
             for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i)
                 nFullWidthRelative += (*pCellWidths.get())[i];
 
-        for (sal_uInt32 i = 0; i < pCellWidths->size() - 1; ++i)
+        size_t nWidthsBound = pCellWidths->size() - 1;
+        if (nWidthsBound)
         {
-            nSum += (*pCellWidths.get())[i];
-            pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
-            pSeparators[nPos].IsVisible = sal_True;
-            nPos++;
+            if (nFullWidthRelative == 0)
+                throw o3tl::divide_by_zero();
+
+            for (sal_uInt32 i = 0; i < nWidthsBound; ++i)
+            {
+                nSum += (*pCellWidths.get())[i];
+                pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
+                pSeparators[nPos].IsVisible = sal_True;
+                nPos++;
+            }
         }
 
         TablePropertyMapPtr pPropMap( new TablePropertyMap );
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 5104574..4fd6a63 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -289,7 +289,7 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 void OOXMLFastContextHandler::lcl_startFastElement
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     OOXMLFactory::getInstance()->startAction(this, Element);
     if( Element == (NS_wordprocessingDrawing|OOXML_positionV) )
@@ -301,7 +301,7 @@ void OOXMLFastContextHandler::lcl_startFastElement
 
 void OOXMLFastContextHandler::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     OOXMLFactory::getInstance()->endAction(this, Element);
 }
@@ -346,7 +346,7 @@ uno::Reference< xml::sax::XFastContextHandler >
  OOXMLFastContextHandler::lcl_createFastChildContext
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     return OOXMLFactory::getInstance()->createFastChildContext(this, Element);
 }
@@ -381,7 +381,7 @@ void SAL_CALL OOXMLFastContextHandler::characters
 
 void OOXMLFastContextHandler::lcl_characters
 (const OUString & rString)
-throw (uno::RuntimeException, xml::sax::SAXException)
+throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (!m_bDiscardChildren)
         OOXMLFactory::getInstance()->characters(this, rString);
@@ -1401,7 +1401,7 @@ OOXMLFastContextHandlerProperties::~OOXMLFastContextHandlerProperties()
 
 void OOXMLFastContextHandlerProperties::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     endAction(Element);
 
@@ -1599,7 +1599,7 @@ OOXMLFastContextHandlerPropertyTable::~OOXMLFastContextHandlerPropertyTable()
 
 void OOXMLFastContextHandlerPropertyTable::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     OOXMLPropertySet::Pointer_t pPropSet(mpPropertySet->clone());
     OOXMLTableImpl::ValuePointer_t pTmpVal
@@ -1655,7 +1655,7 @@ OOXMLValue::Pointer_t OOXMLFastContextHandlerValue::getValue() const
 
 void OOXMLFastContextHandlerValue::lcl_endFastElement
 (Token_t Element)
-throw (uno::RuntimeException, xml::sax::SAXException)
+throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     sendPropertyToParent();
 
@@ -1743,7 +1743,7 @@ OOXMLFastContextHandlerTable::createFastChildContext
 
 void OOXMLFastContextHandlerTable::lcl_endFastElement
 (Token_t /*Element*/)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     addCurrentChild();
 
@@ -1802,7 +1802,7 @@ OOXMLFastContextHandlerXNote::~OOXMLFastContextHandlerXNote()
 void OOXMLFastContextHandlerXNote::lcl_startFastElement
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     mbForwardEventsSaved = isForwardEvents();
 
@@ -1817,7 +1817,7 @@ void OOXMLFastContextHandlerXNote::lcl_startFastElement
 
 void OOXMLFastContextHandlerXNote::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     endAction(Element);
 
@@ -2066,7 +2066,7 @@ OOXMLFastContextHandlerTextTable::~OOXMLFastContextHandlerTextTable()
 void OOXMLFastContextHandlerTextTable::lcl_startFastElement
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & /*Attribs*/)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     mpParserState->startTable();
     mnTableDepth++;
@@ -2086,7 +2086,7 @@ void OOXMLFastContextHandlerTextTable::lcl_startFastElement
 
 void OOXMLFastContextHandlerTextTable::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     endAction(Element);
 
@@ -2142,7 +2142,7 @@ OOXMLFastContextHandlerShape::~OOXMLFastContextHandlerShape()
 void OOXMLFastContextHandlerShape::lcl_startFastElement
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     startAction(Element);
 
@@ -2198,7 +2198,7 @@ void OOXMLFastContextHandlerShape::sendShape( Token_t Element )
 
 void OOXMLFastContextHandlerShape::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (mrShapeContext.is())
     {
@@ -2227,7 +2227,7 @@ uno::Reference< xml::sax::XFastContextHandler >
 OOXMLFastContextHandlerShape::lcl_createFastChildContext
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
 
@@ -2300,7 +2300,7 @@ OOXMLFastContextHandlerShape::createUnknownChildContext
 
 void OOXMLFastContextHandlerShape::lcl_characters
 (const OUString & aChars)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (mrShapeContext.is())
         mrShapeContext->characters(aChars);
@@ -2392,7 +2392,7 @@ void OOXMLFastContextHandlerWrapper::addToken( Token_t Token )
 void OOXMLFastContextHandlerWrapper::lcl_startFastElement
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (mxContext.is())
         mxContext->startFastElement(Element, Attribs);
@@ -2400,7 +2400,7 @@ void OOXMLFastContextHandlerWrapper::lcl_startFastElement
 
 void OOXMLFastContextHandlerWrapper::lcl_endFastElement
 (Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (mxContext.is())
         mxContext->endFastElement(Element);
@@ -2410,7 +2410,7 @@ uno::Reference< xml::sax::XFastContextHandler >
 OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
 (Token_t Element,
  const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     uno::Reference< xml::sax::XFastContextHandler > xResult;
 
@@ -2464,7 +2464,7 @@ OOXMLFastContextHandlerWrapper::lcl_createFastChildContext
 
 void OOXMLFastContextHandlerWrapper::lcl_characters
 (const OUString & aChars)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     if (mxContext.is())
         mxContext->characters(aChars);
@@ -2599,14 +2599,14 @@ OOXMLFastContextHandlerLinear::OOXMLFastContextHandlerLinear(OOXMLFastContextHan
 
 void OOXMLFastContextHandlerLinear::lcl_startFastElement(Token_t Element,
     const uno::Reference< xml::sax::XFastAttributeList >& Attribs)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     buffer.appendOpeningTag( Element, Attribs );
     ++depthCount;
 }
 
 void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     buffer.appendClosingTag( Element );
     if( --depthCount == 0 )
@@ -2616,7 +2616,7 @@ void OOXMLFastContextHandlerLinear::lcl_endFastElement(Token_t Element)
 uno::Reference< xml::sax::XFastContextHandler >
 OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t,
     const uno::Reference< xml::sax::XFastAttributeList >&)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
     xContextHandler.set( this );
@@ -2624,7 +2624,7 @@ OOXMLFastContextHandlerLinear::lcl_createFastChildContext(Token_t,
 }
 
 void OOXMLFastContextHandlerLinear::lcl_characters(const OUString& aChars)
-    throw (uno::RuntimeException, xml::sax::SAXException)
+    throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
 {
     buffer.appendCharacters( aChars );
 }
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index f56f5e9..6a40c25 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -263,20 +263,19 @@ protected:
     virtual void lcl_startFastElement
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException);
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception);
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException);
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception);
 
     virtual uno::Reference< xml::sax::XFastContextHandler >
     lcl_createFastChildContext
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException);
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception);
 
     virtual void lcl_characters(const OUString & aChars)
-        throw (uno::RuntimeException, xml::sax::SAXException);
-
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception);
     void startAction(Token_t Element);
     virtual void lcl_startAction(Token_t Element);
     void endAction(Token_t Element);
@@ -361,7 +360,7 @@ protected:
     OOXMLPropertySet::Pointer_t mpPropertySet;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
     virtual void setParent(OOXMLFastContextHandler * pParent) SAL_OVERRIDE;
 
 private:
@@ -380,7 +379,7 @@ protected:
     OOXMLTableImpl mTable;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
  };
 
 class OOXMLFastContextHandlerValue :
@@ -395,7 +394,7 @@ public:
     virtual OOXMLValue::Pointer_t getValue() const SAL_OVERRIDE;
 
     virtual void lcl_endFastElement(Token_t Element)
-    throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual string getType() const SAL_OVERRIDE { return "Value"; }
 
@@ -427,7 +426,7 @@ protected:
     RefAndPointer_t mCurrentChild;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual ResourceEnum_t getResource() const SAL_OVERRIDE { return TABLE; }
 
@@ -456,10 +455,10 @@ private:
     virtual void lcl_startFastElement
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual ResourceEnum_t getResource() const SAL_OVERRIDE { return STREAM; }
 };
@@ -507,10 +506,10 @@ protected:
     virtual void lcl_startFastElement
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 };
 
 class OOXMLFastContextHandlerShape: public OOXMLFastContextHandlerProperties
@@ -559,19 +558,19 @@ protected:
     virtual void lcl_startFastElement
     (Token_t Element,
      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
-        throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE;
+        throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE;
+        throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual uno::Reference< xml::sax::XFastContextHandler >
     lcl_createFastChildContext
     (Token_t Element,
      const css::uno::Reference< css::xml::sax::XFastAttributeList > & Attribs)
-        throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE;
+        throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_characters(const OUString & aChars)
-                throw (css::uno::RuntimeException, css::xml::sax::SAXException) SAL_OVERRIDE;
+                throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
 };
 
@@ -628,19 +627,19 @@ protected:
     virtual void lcl_startFastElement
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_endFastElement(Token_t Element)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual uno::Reference< xml::sax::XFastContextHandler >
     lcl_createFastChildContext
     (Token_t Element,
      const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void lcl_characters(const OUString & aChars)
-                throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+                throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual void setId(Id nId) SAL_OVERRIDE;
     virtual Id getId() const SAL_OVERRIDE;
@@ -690,15 +689,15 @@ protected:
     virtual void process() = 0;
 
     virtual void lcl_startFastElement(Token_t Element, const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
-    virtual void lcl_endFastElement(Token_t Element) throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+    virtual void lcl_endFastElement(Token_t Element) throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     virtual uno::Reference< xml::sax::XFastContextHandler > lcl_createFastChildContext(Token_t Element,
         const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
-        throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+        throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
-    virtual void lcl_characters(const OUString & aChars) throw (uno::RuntimeException, xml::sax::SAXException) SAL_OVERRIDE;
+    virtual void lcl_characters(const OUString & aChars) throw (uno::RuntimeException, xml::sax::SAXException, std::exception) SAL_OVERRIDE;
 
     // should be private, but not much point in making deep copies of it
     oox::formulaimport::XmlStreamBuilder buffer;
-- 
2.1.0