[Libreoffice-commits] core.git: 3 commits - sw/source

Miklos Vajna vmiklos at collabora.co.uk
Mon May 5 12:12:33 PDT 2014


 sw/source/core/crsr/crsrsh.cxx           |    2 -
 sw/source/core/crsr/viscrs.cxx           |    3 +
 sw/source/filter/ww8/rtfexportfilter.cxx |   51 +++++++++++++++----------------
 sw/source/filter/ww8/rtfexportfilter.hxx |   32 +++++++------------
 4 files changed, 41 insertions(+), 47 deletions(-)

New commits:
commit 25195658ab405cfc288950e15529e97ceb72575d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 5 20:49:39 2014 +0200

    sw: fix indentation in rtfexportfilter
    
    Change-Id: I3055df538fc4dfa625aa942ad0d0e6b6299c53b3

diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx
index 01aaefc..eb324c2 100644
--- a/sw/source/filter/ww8/rtfexportfilter.cxx
+++ b/sw/source/filter/ww8/rtfexportfilter.cxx
@@ -29,7 +29,7 @@
 
 using namespace ::com::sun::star;
 
-RtfExportFilter::RtfExportFilter( const uno::Reference< uno::XComponentContext >& xCtx)
+RtfExportFilter::RtfExportFilter(const uno::Reference< uno::XComponentContext >& xCtx)
     : m_xCtx(xCtx)
 {
 }
@@ -38,26 +38,26 @@ RtfExportFilter::~RtfExportFilter()
 {
 }
 
-sal_Bool RtfExportFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor )
-    throw (uno::RuntimeException, std::exception)
+sal_Bool RtfExportFilter::filter(const uno::Sequence< beans::PropertyValue >& aDescriptor) throw(uno::RuntimeException, std::exception)
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC);
 
     utl::MediaDescriptor aMediaDesc = aDescriptor;
-    ::uno::Reference< io::XStream > xStream =
-          aMediaDesc.getUnpackedValueOrDefault( utl::MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference< io::XStream >() );
-    SvStream* pStream = utl::UcbStreamHelper::CreateStream( xStream, true );
+    uno::Reference<io::XStream> xStream = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference< io::XStream >());
+    SvStream* pStream = utl::UcbStreamHelper::CreateStream(xStream, true);
     m_aWriter.SetStream(pStream);
 
     // get SwDoc*
-    uno::Reference< uno::XInterface > xIfc( m_xSrcDoc, uno::UNO_QUERY );
-    SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() );
-    if ( !pTxtDoc ) {
+    uno::Reference< uno::XInterface > xIfc(m_xSrcDoc, uno::UNO_QUERY);
+    SwXTextDocument* pTxtDoc = dynamic_cast< SwXTextDocument* >(xIfc.get());
+    if (!pTxtDoc)
+    {
         return sal_False;
     }
 
-    SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc();
-    if ( !pDoc ) {
+    SwDoc* pDoc = pTxtDoc->GetDocShell()->GetDoc();
+    if (!pDoc)
+    {
         return sal_False;
     }
 
@@ -69,23 +69,23 @@ sal_Bool RtfExportFilter::filter( const uno::Sequence< beans::PropertyValue >& a
 
     // get SwPaM*
     // we get SwPaM for the entire document; copy&paste is handled internally, not via UNO
-    SwPaM aPam( pDoc->GetNodes().GetEndOfContent() );
+    SwPaM aPam(pDoc->GetNodes().GetEndOfContent());
     aPam.SetMark();
-    aPam.Move( fnMoveBackward, fnGoDoc );
+    aPam.Move(fnMoveBackward, fnGoDoc);
 
-    SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() );
+    SwPaM* pCurPam = new SwPaM(*aPam.End(), *aPam.Start());
 
     // export the document
     // (in a separate block so that it's destructed before the commit)
     {
-        RtfExport aExport( this, pDoc, pCurPam, &aPam, NULL );
-        aExport.ExportDocument( true );
+        RtfExport aExport(this, pDoc, pCurPam, &aPam, NULL);
+        aExport.ExportDocument(true);
     }
 
     // delete the pCurPam
-    if ( pCurPam )
+    if (pCurPam)
     {
-        while ( pCurPam->GetNext() != pCurPam )
+        while (pCurPam->GetNext() != pCurPam)
             delete pCurPam->GetNext();
         delete pCurPam;
     }
@@ -94,12 +94,11 @@ sal_Bool RtfExportFilter::filter( const uno::Sequence< beans::PropertyValue >& a
     return sal_True;
 }
 
-void RtfExportFilter::cancel(  ) throw (uno::RuntimeException, std::exception)
+void RtfExportFilter::cancel() throw(uno::RuntimeException, std::exception)
 {
 }
 
-void RtfExportFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
-    throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
+void RtfExportFilter::setSourceDocument(const uno::Reference< lang::XComponent >& xDoc) throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
 {
     m_xSrcDoc = xDoc;
 }
@@ -108,19 +107,19 @@ void RtfExportFilter::setSourceDocument( const uno::Reference< lang::XComponent
 
 OUString RtfExport_getImplementationName()
 {
-    return OUString( IMPL_NAME_RTFEXPORT );
+    return OUString(IMPL_NAME_RTFEXPORT);
 }
 
 uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames() throw()
 {
-    const OUString aServiceName( "com.sun.star.document.ExportFilter" );
-    const uno::Sequence< OUString > aSeq( &aServiceName, 1 );
+    const OUString aServiceName("com.sun.star.document.ExportFilter");
+    const uno::Sequence< OUString > aSeq(&aServiceName, 1);
     return aSeq;
 }
 
-uno::Reference< uno::XInterface > SAL_CALL RtfExport_createInstance(const uno::Reference< uno::XComponentContext > & xCtx ) throw( uno::Exception )
+uno::Reference< uno::XInterface > SAL_CALL RtfExport_createInstance(const uno::Reference< uno::XComponentContext >& xCtx) throw(uno::Exception)
 {
-    return (cppu::OWeakObject*) new RtfExportFilter( xCtx );
+    return (cppu::OWeakObject*) new RtfExportFilter(xCtx);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexportfilter.hxx b/sw/source/filter/ww8/rtfexportfilter.hxx
index e275e58..dcccec0 100644
--- a/sw/source/filter/ww8/rtfexportfilter.hxx
+++ b/sw/source/filter/ww8/rtfexportfilter.hxx
@@ -35,38 +35,32 @@ protected:
 
 /// The physical access to the RTF document (for writing).
 class RtfExportFilter : public cppu::WeakImplHelper2
-<
-    com::sun::star::document::XFilter,
-    com::sun::star::document::XExporter
->
+    <
+    css::document::XFilter,
+    css::document::XExporter
+    >
 {
 protected:
-    ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx;
-    ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSrcDoc;
+    css::uno::Reference<css::uno::XComponentContext> m_xCtx;
+    css::uno::Reference<css::lang::XComponent> m_xSrcDoc;
 public:
-    RtfExportFilter( const ::com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xCtx );
+    RtfExportFilter(const css::uno::Reference<css::uno::XComponentContext>& xCtx);
     virtual ~RtfExportFilter();
 
     // XFilter
-    virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-    virtual void SAL_CALL cancel(  )
-        throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual sal_Bool SAL_CALL filter(const css::uno::Sequence<css::beans::PropertyValue>& aDescriptor) throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual void SAL_CALL cancel() throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     // XExporter
-    virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
-        throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+    virtual void SAL_CALL setSourceDocument(const css::uno::Reference<css::lang::XComponent>& xDoc)
+    throw(css::lang::IllegalArgumentException, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
     RtfWriter m_aWriter;
 };
 
 OUString RtfExport_getImplementationName();
-::com::sun::star::uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames()
-    throw();
-::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfExport_createInstance(
-                                                                        const ::com::sun::star::uno::Reference<
-                                                                        com::sun::star::uno::XComponentContext > &xCtx)
-    throw( ::com::sun::star::uno::Exception );
+css::uno::Sequence<OUString> SAL_CALL RtfExport_getSupportedServiceNames() throw();
+css::uno::Reference<css::uno::XInterface> SAL_CALL RtfExport_createInstance(const css::uno::Reference<css::uno::XComponentContext>& xCtx) throw(css::uno::Exception);
 
 #define IMPL_NAME_RTFEXPORT "com.sun.star.comp.Writer.RtfExport"
 
commit ea7a9c06d220d111cb1c7142092be56c0608c080
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 5 20:42:10 2014 +0200

    coverity#704854 Unchecked dynamic_cast
    
    Change-Id: I6d7f6e035bb0dcc86f8aebfdfa4b7f9521bc8820

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 2d16947..64ad0fc 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -573,7 +573,8 @@ void SwShellCrsr::Hide()
 {
     SwShellCrsr * pTmp = this;
     do {
-        pTmp->SwSelPaintRects::Hide();
+        if (pTmp)
+            pTmp->SwSelPaintRects::Hide();
     } while( this != ( pTmp = dynamic_cast<SwShellCrsr*>(pTmp->GetNext()) ) );
 }
 
commit 4a9b8cf5f45db0b57d6bdacf58abadd1249a0129
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 5 20:08:31 2014 +0200

    coverity#704849 Unchecked dynamic_cast
    
    Change-Id: If22324ea65a45ac93f6c4b9cbaf9cfb11ef91195

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 62c11d0..5680343 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -970,7 +970,7 @@ bool SwCrsrShell::ChgCurrPam(
     // search in all selections for this position
     SwShellCrsr* pCmp = (SwShellCrsr*)m_pCurCrsr; // keep the pointer on cursor
     do {
-        if( pCmp->HasMark() &&
+        if( pCmp && pCmp->HasMark() &&
             *pCmp->Start() <= aPtPos && *pCmp->End() > aPtPos )
         {
             if( bTstOnly || m_pCurCrsr == pCmp ) // is the current


More information about the Libreoffice-commits mailing list