[Libreoffice-commits] core.git: 15 commits - cui/source framework/inc framework/source include/svx offapi/com offapi/type_reference sax/source sax/test sc/inc sc/source sd/source svx/source sw/source toolkit/source vcl/qa

Caolán McNamara caolanm at redhat.com
Fri Feb 21 07:30:58 PST 2014


 cui/source/options/optinet2.cxx                                |   24 -
 framework/inc/services/mediatypedetectionhelper.hxx            |    3 
 framework/source/services/mediatypedetectionhelper.cxx         |    5 
 include/svx/ChildrenManager.hxx                                |    4 
 offapi/com/sun/star/xml/sax/XExtendedDocumentHandler.idl       |    3 
 offapi/type_reference/offapi.idl                               |    2 
 sax/source/expatwrap/saxwriter.cxx                             |    4 
 sax/test/saxdemo.cxx                                           |    2 
 sc/inc/cellsuno.hxx                                            |    9 
 sc/source/ui/sidebar/ScPanelFactory.cxx                        |  136 +++++-----
 sc/source/ui/unoobj/cellsuno.cxx                               |    7 
 sc/source/ui/unoobj/scdetect.cxx                               |    1 
 sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx      |    2 
 sd/source/ui/inc/AccessibleDrawDocumentView.hxx                |    3 
 sd/source/ui/slidesorter/controller/SlideSorterController.cxx  |   12 
 sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx |    5 
 sd/source/ui/slidesorter/controller/SlsPageSelector.cxx        |   40 +-
 sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx        |    2 
 sd/source/ui/slidesorter/model/SlideSorterModel.cxx            |   31 +-
 sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx          |    4 
 svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx    |    3 
 svx/source/accessibility/ChildrenManager.cxx                   |    3 
 svx/source/accessibility/ChildrenManagerImpl.cxx               |    3 
 svx/source/accessibility/ChildrenManagerImpl.hxx               |    3 
 svx/source/accessibility/svxpixelctlaccessiblecontext.cxx      |    8 
 svx/source/inc/svxpixelctlaccessiblecontext.hxx                |    4 
 sw/source/core/doc/docedt.cxx                                  |    3 
 sw/source/ui/uno/swdetect.cxx                                  |    1 
 sw/source/ui/uno/unotxdoc.cxx                                  |    2 
 toolkit/source/helper/unowrapper.cxx                           |   23 -
 vcl/qa/cppunit/canvasbitmaptest.cxx                            |   14 -
 31 files changed, 214 insertions(+), 152 deletions(-)

New commits:
commit f6fef3a970eff5b81c2bc7390ddd6ac96931a92a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 15:02:34 2014 +0000

    coverity#1130457 Uncaught exception
    
    Change-Id: Ie65cdb00ec8823db329d2330ed142f4d841b095a

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 5b8e6cd..a1bfecb 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -613,8 +613,11 @@ private:
         return aRes;
     }
 
-    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB( const uno::Sequence< rendering::RGBColor >& ) throw (lang::IllegalArgumentException,
-                                                                                                                             uno::RuntimeException)
+    virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB(
+        const uno::Sequence< rendering::RGBColor >&)
+            throw (lang::IllegalArgumentException,
+                   uno::RuntimeException,
+                   std::exception)
     {
         CPPUNIT_ASSERT_MESSAGE("convertIntegerFromRGB: method not implemented", false);
         return uno::Sequence< sal_Int8 >();
commit ea89446d5d7040f008c7b6c56afca03f738f7ec0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 15:01:30 2014 +0000

    coverity#1130458 Uncaught exception
    
    Change-Id: I2fd30daef6df18d0ef25132f9c0e445f613da10f

diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index 690a822..5b8e6cd 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -572,8 +572,11 @@ private:
         return aRes;
     }
 
-    virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB( const uno::Sequence< ::sal_Int8 >& deviceColor ) throw (lang::IllegalArgumentException,
-                                                                                                                                         uno::RuntimeException)
+    virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB(
+        const uno::Sequence< ::sal_Int8 >& deviceColor)
+            throw (lang::IllegalArgumentException,
+                   uno::RuntimeException,
+                   std::exception)
     {
         const sal_Size  nLen( deviceColor.getLength() );
         const sal_Int32 nBytesPerPixel(mnBitsPerPixel == 8 ? 1 : 4);
commit c7a6e0645acc5bf6d92fda8986410866272bbbd6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:55:05 2014 +0000

    coverity#1132721 fix exception specs
    
    Change-Id: I1c499f8b994d29e265a66f4219d4c3fddb237a89

diff --git a/include/svx/ChildrenManager.hxx b/include/svx/ChildrenManager.hxx
index 2049ab7..19ade70 100644
--- a/include/svx/ChildrenManager.hxx
+++ b/include/svx/ChildrenManager.hxx
@@ -125,7 +125,9 @@ public:
         throw (::com::sun::star::uno::RuntimeException,
                ::com::sun::star::lang::IndexOutOfBoundsException);
         ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetChild (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xShape) throw (::com::sun::star::uno::RuntimeException);
-        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> GetChildShape (long nIndex) throw (::com::sun::star::uno::RuntimeException);
+        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> GetChildShape (long nIndex)
+            throw (::com::sun::star::lang::IndexOutOfBoundsException,
+                   ::com::sun::star::uno::RuntimeException);
 
     /** Update the child manager.  Take care of a modified set of children
         and modified visible area.  This method can optimize the update
diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index 9793cce..1ba149e 100644
--- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -476,7 +476,7 @@ void SAL_CALL
 //=====  XAccessibleGroupPosition  =========================================
 uno::Sequence< sal_Int32 > SAL_CALL
     AccessibleDrawDocumentView::getGroupPosition( const uno::Any& rAny )
-    throw (uno::RuntimeException)
+    throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
     SolarMutexGuard g;
 
diff --git a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
index 3d8e72c..de4db6b 100644
--- a/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
+++ b/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
@@ -105,7 +105,8 @@ public:
     //=====  XAccessibleGroupPosition  =========================================
     virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
         getGroupPosition( const ::com::sun::star::uno::Any& rAny )
-        throw (::com::sun::star::uno::RuntimeException);
+        throw (::com::sun::star::uno::RuntimeException,
+               ::com::sun::star::lang::IndexOutOfBoundsException);
     virtual OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject )
         throw (::com::sun::star::uno::RuntimeException,
                std::exception);
diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx
index 958c08d..2a1b854 100644
--- a/svx/source/accessibility/ChildrenManager.cxx
+++ b/svx/source/accessibility/ChildrenManager.cxx
@@ -86,7 +86,8 @@ Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShap
 
 ::com::sun::star::uno::Reference<
         ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
-    throw (::com::sun::star::uno::RuntimeException)
+    throw (::com::sun::star::uno::RuntimeException,
+           ::com::sun::star::lang::IndexOutOfBoundsException)
 {
     OSL_ASSERT (mpImpl != NULL);
     return mpImpl->GetChildShape(nIndex);
diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx
index f0ad75a..89d647e 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -115,7 +115,8 @@ long ChildrenManagerImpl::GetChildCount (void) const throw ()
 
 ::com::sun::star::uno::Reference<
         ::com::sun::star::drawing::XShape> ChildrenManagerImpl::GetChildShape(long nIndex)
-    throw (::com::sun::star::uno::RuntimeException)
+    throw (::com::sun::star::uno::RuntimeException,
+           ::com::sun::star::lang::IndexOutOfBoundsException)
 {
     uno::Reference<XAccessible> xAcc = GetChild(nIndex);
     ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx
index 525f01d..865a7d5 100644
--- a/svx/source/accessibility/ChildrenManagerImpl.hxx
+++ b/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -121,7 +121,8 @@ public:
 
     ::com::sun::star::uno::Reference<
         ::com::sun::star::drawing::XShape> GetChildShape(long nIndex)
-        throw (::com::sun::star::uno::RuntimeException);
+        throw (::com::sun::star::uno::RuntimeException,
+               ::com::sun::star::lang::IndexOutOfBoundsException);
     /** Return the requested accessible child or throw and
         IndexOutOfBoundsException if the given index is invalid.
         @param nIndex
commit 59fa74396ff21c98decaa83be724054e5080a536
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:46:31 2014 +0000

    add missing modelines
    
    Change-Id: I1823890217eb11ba4206b9fd28389c633c7c4f89

diff --git a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
index 1e9d02e..e316e93 100644
--- a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
+++ b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -94,3 +95,5 @@ Sequence< OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceName
     aNames[0] = OUString( "VCLXAccessibleSvxFindReplaceDialog" );
     return aNames;
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
index 48d511c..b7db7f4 100644
--- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -1023,3 +1024,5 @@ OUString SvxPixelCtlAccessibleChild::GetName()
     str += ")";
     return str;
 }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6550fa520638a3d3b37d1810e3c24251c0a421fe
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:46:05 2014 +0000

    coverity#1132723 Uncaught exception
    
    Change-Id: I2b3e85875a0f706a1dfdf0177337aa9fe71a3540

diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
index 7f63a4c..48d511c 100644
--- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
+++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -91,7 +91,7 @@ sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount(  ) throw (uno::Runtime
 
   -----------------------------------------------------------------------*/
 uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i )
-    throw (uno::RuntimeException)
+    throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
     ::osl::MutexGuard   aGuard( m_aMutex );
     IsValid();
@@ -811,7 +811,8 @@ sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) t
     return 0;
 }
 
-uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException )
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 )
+    throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
     throw lang::IndexOutOfBoundsException();
 }
diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx
index 5601c3e..23172d1 100644
--- a/svx/source/inc/svxpixelctlaccessiblecontext.hxx
+++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx
@@ -92,7 +92,7 @@ public:
 
     //XAccessibleContext
     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
@@ -184,7 +184,7 @@ public:
 
     //XAccessibleContext
     virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
-    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
     virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
commit 09f9a79b112aae36d54520568962d84a931f6491
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:35:22 2014 +0000

    [API CHANGE] fix endCDATA to allow throwing css::xml::sax::SAXException
    
    coverity#1158397 Uncaught exception
    
    Change-Id: Iabf0b1f0500cb4218d8cb3aff372777471e8f287

diff --git a/offapi/com/sun/star/xml/sax/XExtendedDocumentHandler.idl b/offapi/com/sun/star/xml/sax/XExtendedDocumentHandler.idl
index 2529f30..23dc57c 100644
--- a/offapi/com/sun/star/xml/sax/XExtendedDocumentHandler.idl
+++ b/offapi/com/sun/star/xml/sax/XExtendedDocumentHandler.idl
@@ -49,7 +49,8 @@ published interface XExtendedDocumentHandler: com::sun::star::xml::sax::XDocumen
         <p>Note that <code>startCDATA/endCDATA</code> MUST NOT enclose any
         <code>startElement/endElement</code>-call!</p>
      */
-    void endCDATA();
+    void endCDATA()
+            raises( com::sun::star::xml::sax::SAXException );
 
     /** receives notification about a comment in the XML-source.
      */
diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl
index a474f59..b2042d6 100644
--- a/offapi/type_reference/offapi.idl
+++ b/offapi/type_reference/offapi.idl
@@ -17577,7 +17577,7 @@ module com {
      published interface XExtendedDocumentHandler {
       interface ::com::sun::star::xml::sax::XDocumentHandler;
       void startCDATA() raises (::com::sun::star::xml::sax::SAXException);
-      void endCDATA();
+      void endCDATA() raises (::com::sun::star::xml::sax::SAXException);
       void comment([in] string sComment) raises (::com::sun::star::xml::sax::SAXException);
       void allowLineBreak() raises (::com::sun::star::xml::sax::SAXException);
       void unknown([in] string sString) raises (::com::sun::star::xml::sax::SAXException);
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index c433859..d871cce 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -939,7 +939,7 @@ public: // XDocumentHandler
 
 public: // XExtendedDocumentHandler
     virtual void SAL_CALL startCDATA(void) throw(SAXException, RuntimeException);
-    virtual void SAL_CALL endCDATA(void) throw(RuntimeException);
+    virtual void SAL_CALL endCDATA(void) throw(SAXException,RuntimeException);
     virtual void SAL_CALL comment(const OUString& sComment)
         throw(SAXException, RuntimeException);
     virtual void SAL_CALL unknown(const OUString& sString)
@@ -1283,7 +1283,7 @@ void SAXWriter::startCDATA(void) throw(SAXException, RuntimeException)
     m_bIsCDATA = sal_True;
 }
 
-void SAXWriter::endCDATA(void) throw (RuntimeException)
+void SAXWriter::endCDATA(void) throw (SAXException,RuntimeException)
 {
     if( ! m_bDocStarted || ! m_bIsCDATA)
     {
diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx
index 3910bbf..4d7be76 100644
--- a/sax/test/saxdemo.cxx
+++ b/sax/test/saxdemo.cxx
@@ -225,7 +225,7 @@ public: // ExtendedDocumentHandler
     virtual void SAL_CALL startCDATA(void) throw (SAXException,RuntimeException)
     {
     }
-    virtual void SAL_CALL endCDATA(void) throw (RuntimeException)
+    virtual void SAL_CALL endCDATA(void) throw (SAXException,RuntimeException)
     {
     }
     virtual void SAL_CALL comment(const OUString& /* sComment */) throw (SAXException,RuntimeException)
commit c1587b74c15d35fd85069d3a0f1ebe4770549021
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:33:40 2014 +0000

    coverity#1158357 Uncaught exception
    
    Change-Id: I7d93f1c1a4e9c4b91c385d6f9e1aaab2fe635327

diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index 4366c2f..457071b 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -31,6 +31,7 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/window.hxx>
 #include <rtl/ref.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <comphelper/namedvaluecollection.hxx>
 
 #include <boost/bind.hpp>
@@ -92,73 +93,86 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
 {
     Reference<ui::XUIElement> xElement;
 
-    const ::comphelper::NamedValueCollection aArguments (rArguments);
-    Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
-    Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
-    const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
-    SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
-
-    ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
-    if ( ! xParentWindow.is() || pParentWindow==NULL)
-        throw RuntimeException(
-            "PanelFactory::createUIElement called without ParentWindow",
-            NULL);
-    if ( ! xFrame.is())
-        throw RuntimeException(
-            "PanelFactory::createUIElement called without Frame",
-            NULL);
-    if (pBindings == NULL)
-        throw RuntimeException(
-            "PanelFactory::createUIElement called without SfxBindings",
-            NULL);
-
-#define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
-    if (DoesResourceEndWith("/AlignmentPropertyPanel"))
+    try
     {
-        AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
-        xElement = sfx2::sidebar::SidebarPanelBase::Create(
-            rsResourceURL,
-            xFrame,
-            pPanel,
-            ui::LayoutSize(-1,-1,-1));
-    }
-    else if (DoesResourceEndWith("/CellAppearancePropertyPanel"))
-    {
-        CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
-        xElement = sfx2::sidebar::SidebarPanelBase::Create(
-            rsResourceURL,
-            xFrame,
-            pPanel,
-            ui::LayoutSize(-1,-1,-1));
-    }
-    else if (DoesResourceEndWith("/NumberFormatPropertyPanel"))
-    {
-        NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
-        xElement = sfx2::sidebar::SidebarPanelBase::Create(
-            rsResourceURL,
-            xFrame,
-            pPanel,
-            ui::LayoutSize(-1,-1,-1));
+        const ::comphelper::NamedValueCollection aArguments (rArguments);
+        Reference<frame::XFrame> xFrame (aArguments.getOrDefault("Frame", Reference<frame::XFrame>()));
+        Reference<awt::XWindow> xParentWindow (aArguments.getOrDefault("ParentWindow", Reference<awt::XWindow>()));
+        const sal_uInt64 nBindingsValue (aArguments.getOrDefault("SfxBindings", sal_uInt64(0)));
+        SfxBindings* pBindings = reinterpret_cast<SfxBindings*>(nBindingsValue);
+
+        ::Window* pParentWindow = VCLUnoHelper::GetWindow(xParentWindow);
+        if ( ! xParentWindow.is() || pParentWindow==NULL)
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without ParentWindow",
+                NULL);
+        if ( ! xFrame.is())
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without Frame",
+                NULL);
+        if (pBindings == NULL)
+            throw RuntimeException(
+                "PanelFactory::createUIElement called without SfxBindings",
+                NULL);
+
+    #define DoesResourceEndWith(s) rsResourceURL.endsWithAsciiL(s,strlen(s))
+        if (DoesResourceEndWith("/AlignmentPropertyPanel"))
+        {
+            AlignmentPropertyPanel* pPanel = AlignmentPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(-1,-1,-1));
+        }
+        else if (DoesResourceEndWith("/CellAppearancePropertyPanel"))
+        {
+            CellAppearancePropertyPanel* pPanel = CellAppearancePropertyPanel::Create( pParentWindow, xFrame, pBindings );
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(-1,-1,-1));
+        }
+        else if (DoesResourceEndWith("/NumberFormatPropertyPanel"))
+        {
+            NumberFormatPropertyPanel* pPanel = NumberFormatPropertyPanel::Create( pParentWindow, xFrame, pBindings );
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(-1,-1,-1));
+        }
+        else if (DoesResourceEndWith("/NavigatorPanel"))
+        {
+            Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(0,-1,-1));
+        }
+        else if (DoesResourceEndWith("/FunctionsPanel"))
+        {
+            Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
+            xElement = sfx2::sidebar::SidebarPanelBase::Create(
+                rsResourceURL,
+                xFrame,
+                pPanel,
+                ui::LayoutSize(0,-1,-1));
+        }
+#undef DoesResourceEndWith
     }
-    else if (DoesResourceEndWith("/NavigatorPanel"))
+    catch (const uno::RuntimeException &)
     {
-        Window* pPanel = new ScNavigatorDlg(pBindings, NULL, pParentWindow, false);
-        xElement = sfx2::sidebar::SidebarPanelBase::Create(
-            rsResourceURL,
-            xFrame,
-            pPanel,
-            ui::LayoutSize(0,-1,-1));
+        throw;
     }
-    else if (DoesResourceEndWith("/FunctionsPanel"))
+    catch (const uno::Exception& e)
     {
-        Window* pPanel = new ScFunctionDockWin(pBindings, NULL, pParentWindow, ScResId(FID_FUNCTION_BOX));
-        xElement = sfx2::sidebar::SidebarPanelBase::Create(
-            rsResourceURL,
-            xFrame,
-            pPanel,
-            ui::LayoutSize(0,-1,-1));
+        throw lang::WrappedTargetRuntimeException(
+            OUString("ScPanelFactory::createUIElement exception"),
+            0, uno::makeAny(e));
     }
-#undef DoesResourceEndWith
 
     return xElement;
 }
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 7de3292..41f3623 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -34,7 +34,6 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/ucb/CommandAbortedException.hpp>
 #include <com/sun/star/ucb/InteractiveAppException.hpp>
 #include <com/sun/star/ucb/XContent.hpp>
diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx
index d62a6b0..ef54f79 100644
--- a/sw/source/ui/uno/swdetect.cxx
+++ b/sw/source/ui/uno/swdetect.cxx
@@ -28,7 +28,6 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
 #include <com/sun/star/ucb/CommandAbortedException.hpp>
 #include <com/sun/star/ucb/InteractiveAppException.hpp>
 #include <com/sun/star/ucb/XContent.hpp>
commit b9cb27effd2f0d137af8e5fe59f6aaf489c10418
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 14:18:36 2014 +0000

    coverity#1158515 Unused pointer value
    
    Change-Id: I3c5be18ccd0f79079ed91f0793955b1ebab72586

diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 4e1f4e9..584b51f 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -642,7 +642,8 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
         sal_uInt16 nFndPos;
         const SwPosition* pEnd;
         SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetCntntNode(), nCnt ));
-        const SwRangeRedline* pRedl = pDest->GetRedline( aSrcPos, &nFndPos );
+        pDest->GetRedline( aSrcPos, &nFndPos );
+        const SwRangeRedline* pRedl;
         while( nFndPos--
               && *( pEnd = ( pRedl = pDest->GetRedlineTbl()[ nFndPos ] )->End() ) == aSrcPos
               && *pRedl->Start() < aSrcPos )
commit f19dd9ad207491edc9fb169676a307da237a11c6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:36:19 2014 +0000

    coverity#706146 Copy into fixed size buffer
    
    Change-Id: I1d774cff476a2ce7fe1e4b4ba1e64bc42a6ff27e

diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx
index 31c37eb..382d902 100644
--- a/cui/source/options/optinet2.cxx
+++ b/cui/source/options/optinet2.cxx
@@ -980,18 +980,16 @@ sal_Bool MozPluginTabPage::isInstalled()
 {
 #ifdef UNIX
     // get the real file referred by .so lnk file
-    char lnkFilePath[NPP_PATH_MAX] = {0};
     char lnkReferFilePath[NPP_PATH_MAX] = {0};
     char* pHome = getpwuid(getuid())->pw_dir;
-    strcat(lnkFilePath, pHome);
-    strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+    OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION));
 
     struct stat sBuf;
-    if (0 > lstat(lnkFilePath, &sBuf))
+    if (0 > lstat(lnkFilePath.getStr(), &sBuf))
         return false;
     if (!S_ISLNK(sBuf.st_mode))
         return false;
-    if (0 >= readlink(lnkFilePath, lnkReferFilePath, NPP_PATH_MAX))
+    if (0 >= readlink(lnkFilePath.getStr(), lnkReferFilePath, NPP_PATH_MAX))
         return false;
     // If the link is relative, then we regard it as non-standard
     if (lnkReferFilePath[0] != '/')
@@ -1031,17 +1029,15 @@ sal_Bool MozPluginTabPage::installPlugin()
 {
 #ifdef UNIX
     // get the real file referred by .so lnk file
-    char lnkFilePath[NPP_PATH_MAX] = {0};
     char* pHome = getpwuid(getuid())->pw_dir;
-    strcat(lnkFilePath, pHome);
-    strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
-    remove(lnkFilePath);
+    OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION));
+    remove(lnkFilePath.getStr());
 
     // create the dirs if necessary
     struct stat buf;
     char tmpDir[NPP_PATH_MAX] = {0};
     sprintf(tmpDir, "%s/.mozilla", pHome);
-    if (0 > stat(lnkFilePath, &buf))
+    if (0 > stat(lnkFilePath.getStr(), &buf))
     {
         mkdir(tmpDir, 0755);
         strcat(tmpDir, "/plugins");
@@ -1058,7 +1054,7 @@ sal_Bool MozPluginTabPage::installPlugin()
     strcat(realFilePath, "/libnpsoplugin" SAL_DLLEXTENSION);
 
     // create the link
-    if (0 != symlink(realFilePath, lnkFilePath))
+    if (0 != symlink(realFilePath, lnkFilePath.getStr()))
         return false;
     return true;
 #endif
@@ -1080,12 +1076,10 @@ sal_Bool MozPluginTabPage::uninstallPlugin()
 {
 #ifdef UNIX
     // get the real file referred by .so lnk file
-    char lnkFilePath[NPP_PATH_MAX] = {0};
     char* pHome = getpwuid(getuid())->pw_dir;
-    strcat(lnkFilePath, pHome);
-    strcat(lnkFilePath, "/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION);
+    OString lnkFilePath(OString(pHome) + OString("/.mozilla/plugins/libnpsoplugin" SAL_DLLEXTENSION));
 
-    if(0 > remove(lnkFilePath))
+    if(0 > remove(lnkFilePath.getStr()))
         return false;
     return true;
 #endif
commit 7a7ecf164aebfff10b88cd3ce327ebff8c41af89
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:30:53 2014 +0000

    coverity#705963 Dereference before null check
    
    Change-Id: I6371ef5e838d1e66ea9aeba75f554eea93426139

diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
index 9b74a3e..38b016e 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -275,23 +275,20 @@ void UnoWrapper::WindowDestroyed( Window* pWindow )
     // #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
     // are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
     // performance penalties)
-    if ( pWindow )
+    Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
+    while ( pTopWindowChild )
     {
-        Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
-        while ( pTopWindowChild )
-        {
-            OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
-                        "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
+        OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
+                    "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
 
-            Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+        Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
 
-            //the window still could be on the stack, so we have to
-            // use lazy delete ( it will automatically
-            // disconnect from the currently destroyed parent window )
-            pTopWindowChild->doLazyDelete();
+        //the window still could be on the stack, so we have to
+        // use lazy delete ( it will automatically
+        // disconnect from the currently destroyed parent window )
+        pTopWindowChild->doLazyDelete();
 
-            pTopWindowChild = pNextTopChild;
-        }
+        pTopWindowChild = pNextTopChild;
     }
 }
 
commit 0e0ac7cc65bbf48d8bbb311108b3602a030b48d6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:28:54 2014 +0000

    coverity#705038 Explicit null dereferenced
    
    Change-Id: I63f726764d68b92e2272951c9dde14ef3a60d6df

diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index cd108fe..54eed36 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -452,7 +452,7 @@ void SwXTextDocument::GetNumberFormatter()
 
             }
             OSL_ENSURE(pNumFmt, "No number formatter available");
-            if(!pNumFmt->GetNumberFormatter())
+            if (pNumFmt && !pNumFmt->GetNumberFormatter())
                 pNumFmt->SetNumberFormatter(pDocShell->GetDoc()->GetNumberFormatter( sal_True ));
         }
     }
commit 7af46fb2f080c014a5330c08a6b773dd8c757964
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:26:27 2014 +0000

    coverity#706691 Uncaught exception
    
    Change-Id: I130f80a45f3d207c34bdc2b4b3cff9536fbe185c

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 1e8eac7..a5b596b 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -768,9 +768,11 @@ public:
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSubTotalDescriptor > SAL_CALL
                             createSubTotalDescriptor( sal_Bool bEmpty )
                                 throw(::com::sun::star::uno::RuntimeException);
-    virtual void SAL_CALL   applySubTotals( const ::com::sun::star::uno::Reference<
+    virtual void SAL_CALL   applySubTotals(const ::com::sun::star::uno::Reference<
                                 ::com::sun::star::sheet::XSubTotalDescriptor >& xDescriptor,
-                                sal_Bool bReplace ) throw(::com::sun::star::uno::RuntimeException);
+                                sal_Bool bReplace)
+                                throw (::com::sun::star::uno::RuntimeException,
+                                       std::exception);
     virtual void SAL_CALL   removeSubTotals() throw(::com::sun::star::uno::RuntimeException);
 
                             // XImportable
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 9477556..9abcc28 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5835,8 +5835,9 @@ uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTot
 }
 
 void SAL_CALL ScCellRangeObj::applySubTotals(
-                const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
-                sal_Bool bReplace ) throw(uno::RuntimeException)
+    const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
+    sal_Bool bReplace)
+    throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
 
commit 121446a6ffedecf18d88421c821b3faa323e03a5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:24:09 2014 +0000

    coverity#737447 Uncaught exception
    
    Change-Id: I416d5b7d42a5ea49f40a18aaf4e1041307914c33

diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index a90e2a6..1e8eac7 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -371,7 +371,8 @@ public:
                                       std::exception);
     virtual void SAL_CALL   removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
                                     ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
-                                throw(::com::sun::star::uno::RuntimeException);
+                                throw (::com::sun::star::uno::RuntimeException,
+                                       std::exception);
     virtual double SAL_CALL getNotANumber() throw(::com::sun::star::uno::RuntimeException);
     virtual sal_Bool SAL_CALL isNotANumber( double nNumber )
                                 throw(::com::sun::star::uno::RuntimeException);
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 5887874..9477556 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3370,7 +3370,7 @@ void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Refe
 
 void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
                                     chart::XChartDataChangeEventListener >& aListener )
-                                throw(uno::RuntimeException)
+    throw (uno::RuntimeException, std::exception)
 {
     SolarMutexGuard aGuard;
     if ( pDocShell && !aRanges.empty() )
commit 4712767c1901efef268c1ae5f5e3a47ddf363811
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 21 13:21:56 2014 +0000

    coverity#983681 Uncaught exception
    
    Change-Id: I13b97703f6f9c3411e6da8ec3c71f6e51c8bfc13

diff --git a/framework/inc/services/mediatypedetectionhelper.hxx b/framework/inc/services/mediatypedetectionhelper.hxx
index 1dbed47..dbb2819 100644
--- a/framework/inc/services/mediatypedetectionhelper.hxx
+++ b/framework/inc/services/mediatypedetectionhelper.hxx
@@ -110,7 +110,8 @@ class MediaTypeDetectionHelper  :   public ::cppu::WeakImplHelper2< ::com::sun::
             @onerror    -
         *//*-*****************************************************************************************************/
 
-        virtual sal_Bool SAL_CALL mapStrings( css::uno::Sequence< OUString >& seqParameter ) throw( css::uno::RuntimeException );
+        virtual sal_Bool SAL_CALL mapStrings(css::uno::Sequence< OUString >& seqParameter)
+            throw (css::uno::RuntimeException, std::exception);
 
     //-------------------------------------------------------------------------------------------------------------
     //  variables
diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx
index 2bf7912..cbbeb85 100644
--- a/framework/source/services/mediatypedetectionhelper.cxx
+++ b/framework/source/services/mediatypedetectionhelper.cxx
@@ -57,9 +57,8 @@ DEFINE_INIT_SERVICE                 (   MediaTypeDetectionHelper,
 //   XStringMapping
 //*****************************************************************************************************************
 
-sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(
-        uno::Sequence< OUString >& rSeq )
-        throw(uno::RuntimeException)
+sal_Bool SAL_CALL MediaTypeDetectionHelper::mapStrings(uno::Sequence< OUString >& rSeq)
+    throw (uno::RuntimeException, std::exception)
 {
     sal_Bool bModified = sal_False;
     for( sal_Int32 i = rSeq.getLength(); i--; )
commit ad0c4bf5790546242884da0c2ec281f2db9e14a0
Author: Andre Fischer <af at apache.org>
Date:   Fri Feb 21 11:55:33 2014 +0000

    Related: #i123197# Fixed selection problems when switching...
    
    between normal and master mode.
    
    (cherry picked from commit 163d414311b0c8bcb1b0ad7c7cbf364e0ad4e4c4)
    
    Change-Id: Ibabee4c67367c367a9ce1c5afffa76efa3f66bd7

diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 8f1542a..6a613d8 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -934,6 +934,8 @@ void SlideSorterController::FinishEditModeChange (void)
 {
     if (mrModel.GetEditMode() == EM_MASTERPAGE)
     {
+        mpPageSelector->DeselectAllPages();
+
         // Search for the master page that was determined in
         // PrepareEditModeChange() and make it the current page.
         PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
@@ -943,16 +945,20 @@ void SlideSorterController::FinishEditModeChange (void)
             if (pDescriptor->GetPage() == mpEditModeChangeMasterPage)
             {
                 GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+                mpPageSelector->SelectPage(pDescriptor);
                 break;
             }
         }
     }
     else
     {
+        PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector);
+
         SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(mnCurrentPageBeforeSwitch));
         GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
 
         // Restore the selection.
+        mpPageSelector->DeselectAllPages();
         ::std::vector<SdPage*>::iterator iPage;
         for (iPage=maSelectionBeforeSwitch.begin();
              iPage!=maSelectionBeforeSwitch.end();
@@ -1025,12 +1031,6 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex
         PreModelChange();
 
         mrModel.SetDocumentSlides(rxSlides);
-        mrView.Layout();
-
-        // Select just the current slide.
-        PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector);
-        mpPageSelector->DeselectAllPages();
-        mpPageSelector->SelectPage(mpCurrentSlideManager->GetCurrentSlide());
     }
 }
 
diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
index 8518279..512dbab 100644
--- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx
@@ -81,11 +81,14 @@ void CurrentSlideManager::NotifyCurrentSlideChange (const sal_Int32 nSlideIndex)
 {
     if (mnCurrentSlideIndex != nSlideIndex)
     {
+        PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter.GetController().GetPageSelector());
+
+        mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+
         ReleaseCurrentSlide();
         AcquireCurrentSlide(nSlideIndex);
 
         // Update the selection.
-        mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
         if (mpCurrentSlide)
         {
             mrSlideSorter.GetController().GetPageSelector().SelectPage(mpCurrentSlide);
diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
index 4121add..1484159 100644
--- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
@@ -60,7 +60,7 @@ PageSelector::PageSelector (SlideSorter& rSlideSorter)
       mpSelectionAnchor(),
       mpCurrentPage(),
       mnUpdateLockCount(0),
-      mbIsUpdateCurrentPagePending(false)
+      mbIsUpdateCurrentPagePending(true)
 {
     CountSelectedPages ();
 }
@@ -375,27 +375,39 @@ void PageSelector::UpdateCurrentPage (const bool bUpdateOnlyWhenPending)
     mbIsUpdateCurrentPagePending = false;
 
     // Make the first selected page the current page.
+    SharedPageDescriptor pCurrentPageDescriptor;
     const sal_Int32 nPageCount (GetPageCount());
     for (sal_Int32 nIndex=0; nIndex<nPageCount; ++nIndex)
     {
         SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex));
-        if (pDescriptor && pDescriptor->HasState(PageDescriptor::ST_Selected))
+        if ( ! pDescriptor)
+            continue;
+        if (pDescriptor->HasState(PageDescriptor::ST_Selected))
         {
-            // Switching the current slide normally sets also the selection
-            // to just the new current slide.  To prevent that, we store
-            // (and at the end of this scope restore) the current selection.
-            ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection());
-
-            mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
-
-            // Restore the selection and prevent a recursive call to
-            // UpdateCurrentPage().
-            SetPageSelection(pSelection, false);
-            return;
+            pCurrentPageDescriptor = pDescriptor;
+            break;
         }
     }
+    if ( ! pCurrentPageDescriptor && nPageCount>0)
+    {
+        // No page is selected.  Make the first slide the current page.
+        pCurrentPageDescriptor = mrModel.GetPageDescriptor(0);
+    }
 
-    // No page is selected.  Do not change the current slide.
+    if (pCurrentPageDescriptor)
+    {
+        // Switching the current slide normally sets also the
+        // selection to just the new current slide.  To prevent that,
+        // we store (and at the end of this scope restore) the current
+        // selection.
+        ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection());
+
+        mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pCurrentPageDescriptor);
+
+        // Restore the selection and prevent a recursive call to
+        // UpdateCurrentPage().
+        SetPageSelection(pSelection, false);
+    }
 }
 
 
diff --git a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
index efcbcda..09fc74c 100644
--- a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
@@ -43,7 +43,7 @@ class SlideSorter;
 namespace sd { namespace slidesorter { namespace model {
 
 inline sal_Int32 FromCoreIndex (const sal_uInt16 nCoreIndex) { return (nCoreIndex-1)/2; }
-inline sal_uInt16 ToCoreIndex (const sal_Int32 nIndex) { return nIndex*2+1; }
+inline sal_uInt16 ToCoreIndex (const sal_Int32 nIndex) { return static_cast<sal_uInt16>(nIndex*2+1); }
 
 /** The model of the slide sorter gives access to the slides that are to be
     displayed in the slide sorter view.  Via the SetDocumentSlides() method
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index 46eb6bd..1c21d0e 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -158,7 +158,6 @@ bool SlideSorterModel::SetEditMode (EditMode eEditMode)
     {
         meEditMode = eEditMode;
         UpdatePageList();
-        ClearDescriptorList();
         bEditModeChanged = true;
     }
     return bEditModeChanged;
@@ -409,7 +408,8 @@ void SlideSorterModel::SynchronizeDocumentSelection (void)
     while (aAllPages.HasMoreElements())
     {
         SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
-        pDescriptor->GetPage()->SetSelected(pDescriptor->HasState(PageDescriptor::ST_Selected));
+        const bool bIsSelected (pDescriptor->HasState(PageDescriptor::ST_Selected));
+        pDescriptor->GetPage()->SetSelected(bIsSelected);
     }
 }
 
@@ -424,7 +424,8 @@ void SlideSorterModel::SynchronizeModelSelection (void)
     while (aAllPages.HasMoreElements())
     {
         SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
-        pDescriptor->SetState(PageDescriptor::ST_Selected, pDescriptor->GetPage()->IsSelected());
+        const bool bIsSelected (pDescriptor->GetPage()->IsSelected());
+        pDescriptor->SetState(PageDescriptor::ST_Selected, bIsSelected);
     }
 }
 
@@ -444,11 +445,29 @@ void SlideSorterModel::SetDocumentSlides (
 {
     ::osl::MutexGuard aGuard (maMutex);
 
-    // Reset the current page so to cause everbody to release references to it.
+    // Make the current selection persistent and then release the
+    // current set of pages.
+    SynchronizeDocumentSelection();
+    mxSlides = NULL;
+    ClearDescriptorList ();
+
+    // Reset the current page to cause everbody to release references to it.
     mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(-1);
 
+    // Set the new set of pages.
     mxSlides = rxSlides;
-    Resync();
+    AdaptSize();
+    SynchronizeModelSelection();
+    mrSlideSorter.GetController().GetPageSelector().CountSelectedPages();
+
+    model::PageEnumeration aSelectedPages (
+        model::PageEnumerationProvider::CreateSelectedPagesEnumeration(*this));
+    if (aSelectedPages.HasMoreElements())
+    {
+        SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+        mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(
+            pDescriptor->GetPage());
+    }
 
     ViewShell* pViewShell = mrSlideSorter.GetViewShell();
     if (pViewShell != NULL)
@@ -652,7 +671,6 @@ void SlideSorterModel::InsertSlide (SdPage* pPage)
 
     // Update page indices.
     UpdateIndices(nIndex+1);
-    OSL_TRACE("page inserted");
 }
 
 
@@ -690,7 +708,6 @@ void SlideSorterModel::DeleteSlide (const SdPage* pPage)
         maPageDescriptors.erase(maPageDescriptors.begin()+nIndex);
         UpdateIndices(nIndex);
     }
-    OSL_TRACE("page removed");
 }
 
 
diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
index d3f0c68..144e714 100644
--- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
+++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx
@@ -65,7 +65,9 @@ void ViewCacheContext::NotifyPreviewCreation (
     }
     else
     {
-        OSL_ASSERT(pDescriptor);
+        // It is OK when a preview was created for a page that is not
+        // currently displayed because both normal and master pages are
+        // kept in the same cache.
     }
 }
 


More information about the Libreoffice-commits mailing list