[Libreoffice-commits] .: 2 commits - sfx2/source sw/source writerfilter/source

Caolán McNamara caolan at kemper.freedesktop.org
Sat Apr 14 04:48:33 PDT 2012


 sfx2/source/doc/objstor.cxx                              |    2 
 sw/source/core/docnode/ndtbl.cxx                         |   10 ++++
 sw/source/core/unocore/unotext.cxx                       |    4 +
 sw/source/core/view/viewsh.cxx                           |   32 ++++++++-------
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    2 
 writerfilter/source/rtftok/rtftokenizer.cxx              |   10 ++++
 6 files changed, 43 insertions(+), 17 deletions(-)

New commits:
commit 234f150f30d881b2691288c5f5581306bd4d3d18
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 14 12:45:38 2012 +0100

    Resolves: fdo#48640 handle various busted rtf docs without hanging

diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index e42df41..d8406dc 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2236,7 +2236,7 @@ sal_Bool SfxObjectShell::ImportFrom( SfxMedium& rMedium, bool bInsert )
         }
 
         return xLoader->filter( aArgs );
-        }catch(const uno::Exception&)
+        }catch(...)
         {}
     }
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 0817150..7be23f3 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1078,8 +1078,16 @@ SwTableNode* SwNodes::TextToTable( const SwNodeRange& rRange, sal_Unicode cCh,
 
 const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >& rTableNodes )
 {
+    if (rTableNodes.empty())
+        return NULL;
+
+    std::vector<SwNodeRange> rFirstRange = *rTableNodes.begin();
+
+    if (rFirstRange.empty())
+        return NULL;
+
     /* Save first node in the selection if it is a content node. */
-    SwCntntNode * pSttCntntNd = rTableNodes.begin()->begin()->aStart.GetNode().GetCntntNode();
+    SwCntntNode * pSttCntntNd = rFirstRange.begin()->aStart.GetNode().GetCntntNode();
 
     /**debug**/
 #if OSL_DEBUG_LEVEL > 1
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 08e6ce5..2334391 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2230,6 +2230,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
     std::vector<VerticallyMergedCell> aMergedCells;
 
     SwTable const*const pTable = m_pImpl->m_pDoc->TextToTable( aTableNodes );
+
+    if (!pTable)
+        return uno::Reference< text::XTextTable >();
+
     SwXTextTable *const pTextTable = new SwXTextTable( *pTable->GetFrmFmt() );
     const uno::Reference< text::XTextTable > xRet = pTextTable;
     const uno::Reference< beans::XPropertySet > xPrSet = pTextTable;
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 17b48da..89a71f1 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -442,7 +442,7 @@ void DomainMapperTableManager::endOfRowAction()
     double nFullWidth = m_nTableWidth;
     //the positions have to be distibuted in a range of 10000
     const double nFullWidthRelative = 10000.;
-    if( pTableGrid->size() == nGrids )
+    if( pTableGrid->size() == nGrids && m_nCell > 0 )
     {
         uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
         text::TableColumnSeparator* pSeparators = aSeparators.getArray();
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index d6dc3ca..125319e 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -213,6 +213,11 @@ int RTFTokenizer::resolveKeyword()
     {
         aBuf.append(ch);
         Strm() >> ch;
+        if (Strm().IsEof())
+        {
+            ch = ' ';
+            break;
+        }
     }
     if (aBuf.getLength() > 32)
         // See RTF spec v1.9.1, page 7
@@ -237,6 +242,11 @@ int RTFTokenizer::resolveKeyword()
         {
             aParameter.append(ch);
             Strm() >> ch;
+            if (Strm().IsEof())
+            {
+                ch = ' ';
+                break;
+            }
         }
         nParam = aParameter.makeStringAndClear().toInt32();
         if (bNeg)
commit 1856186951a70a0bcac4e0c3632ca4afe68c05e3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Apr 14 07:56:45 2012 +0100

    optimize: traverse children with WINDOW_FIRSTCHILD/WINDOW_NEXT

diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 774000c..04717dd 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -370,25 +370,29 @@ void ViewShell::ImplEndAction( const sal_Bool bIdleEnd )
                     if ( GetWin() )
                     {
                         Window& rWindow = *(GetWin());
-                        if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount())
+                        if (rWindow.IsChildTransparentModeEnabled())
                         {
-                            const Rectangle aRectanglePixel(rWindow.LogicToPixel(aRect.SVRect()));
-
-                            for ( sal_uInt16 a(0); a < rWindow.GetChildCount(); a++ )
+                            Window* pCandidate = rWindow.GetWindow( WINDOW_FIRSTCHILD );
+                            if (pCandidate)
                             {
-                                Window* pCandidate = rWindow.GetChild(a);
+                                const Rectangle aRectanglePixel(rWindow.LogicToPixel(aRect.SVRect()));
 
-                                if ( pCandidate && pCandidate->IsPaintTransparent() )
+                                while (pCandidate)
                                 {
-                                    const Rectangle aCandidatePosSizePixel(
-                                                    pCandidate->GetPosPixel(),
-                                                    pCandidate->GetSizePixel());
-
-                                    if ( aCandidatePosSizePixel.IsOver(aRectanglePixel) )
+                                    if ( pCandidate->IsPaintTransparent() )
                                     {
-                                        pCandidate->Invalidate( INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN );
-                                        pCandidate->Update();
-                }
+                                        const Rectangle aCandidatePosSizePixel(
+                                                        pCandidate->GetPosPixel(),
+                                                        pCandidate->GetSizePixel());
+
+                                        if ( aCandidatePosSizePixel.IsOver(aRectanglePixel) )
+                                        {
+                                            pCandidate->Invalidate( INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN );
+                                            pCandidate->Update();
+                                        }
+                                    }
+
+                                    pCandidate = pCandidate->GetWindow( WINDOW_NEXT );
                                 }
                             }
                         }


More information about the Libreoffice-commits mailing list