[ooo-build-commit] .: 6 commits - sd/source

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Sep 8 08:35:56 PDT 2010


 sd/source/core/sdpage.cxx                     |    2 
 sd/source/filter/ppt/propread.cxx             |  128 ++++++++++++++++----------
 sd/source/ui/toolpanel/ToolPanelViewShell.cxx |   17 +++
 sd/source/ui/view/sdwindow.cxx                |    4 
 4 files changed, 101 insertions(+), 50 deletions(-)

New commits:
commit e31a45314a5a2f1e7e2bbea4a2bb6eca7beb7962
Merge: 7234327... 29a7259...
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Wed Sep 8 11:34:03 2010 +0200

    Merge commit 'ooo/OOO330_m7'

commit 29a72592b0046498a30e87a7beedae4d29161f9b
Merge: 10146e0... 6b04480...
Author: Kurt Zenker <kz at openoffice.org>
Date:   Tue Aug 31 15:10:03 2010 +0200

    CWS-TOOLING: integrate CWS impress197

commit 6b04480dd88a5bd048d12874dc8c07630670c239
Author: sj <sj at openoffice.org>
Date:   Mon Aug 9 14:11:58 2010 +0200

    impress197: #163250# fixed string handling, improved polygon splitting

diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
old mode 100644
new mode 100755
index ae64ac4..873d4ab
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -29,6 +29,7 @@
 #include "precompiled_sd.hxx"
 #include <propread.hxx>
 #include <tools/bigint.hxx>
+#include "tools/debug.hxx"
 #include "rtl/tencinfo.h"
 #include "rtl/textenc.h"
 
@@ -90,6 +91,17 @@ void PropItem::Clear()
 
 //	-----------------------------------------------------------------------
 
+static xub_StrLen lcl_getMaxSafeStrLen(sal_uInt32 nSize)
+{
+    nSize -= 1; //Drop NULL terminator
+
+    //If it won't fit in a string, clip it to the max size that does
+    if (nSize > STRING_MAXLEN)
+        nSize = STRING_MAXLEN;
+
+    return nSize;
+}
+
 BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
 {
     sal_uInt32	i, nItemSize, nType, nItemPos;
@@ -108,36 +120,43 @@ BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
     {
         case VT_LPSTR :
         {
-            if ( (sal_uInt16)nItemSize )
+            if ( nItemSize )
             {
-                sal_Char* pString = new sal_Char[ (sal_uInt16)nItemSize ];
-                if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+                try
                 {
-                    nItemSize >>= 1;
-                    if ( (sal_uInt16)nItemSize > 1 )
+                    sal_Char* pString = new sal_Char[ nItemSize ];
+                    if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
                     {
-                        sal_Unicode* pWString = (sal_Unicode*)pString;
-                        for ( i = 0; i < (sal_uInt16)nItemSize; i++ )
-                            *this >> pWString[ i ];
-                        rString = String( pWString, (sal_uInt16)nItemSize - 1 );
-                    }
-                    else
-                        rString = String();
-                    bRetValue = sal_True;
-                }
-                else
-                {
-                    SvMemoryStream::Read( pString, (sal_uInt16)nItemSize );
-                    if ( pString[ (sal_uInt16)nItemSize - 1 ] == 0 )
-                    {
-                        if ( (sal_uInt16)nItemSize > 1 )
-                            rString = String( ByteString( pString ), mnTextEnc );
+                        nItemSize >>= 1;
+                        if ( nItemSize > 1 )
+                        {
+                            sal_Unicode* pWString = (sal_Unicode*)pString;
+                            for ( i = 0; i < nItemSize; i++ )
+                                *this >> pWString[ i ];
+                            rString = String( pWString, lcl_getMaxSafeStrLen(nItemSize) );
+                        }
                         else
                             rString = String();
                         bRetValue = sal_True;
                     }
+                    else
+                    {
+                        SvMemoryStream::Read( pString, nItemSize );
+                        if ( pString[ nItemSize - 1 ] == 0 )
+                        {
+                            if ( nItemSize > 1 )
+                                rString = String( ByteString( pString ), mnTextEnc );
+                            else
+                                rString = String();
+                            bRetValue = sal_True;
+                        }
+                    }
+                    delete[] pString;
+                }
+                catch( const std::bad_alloc& )
+                {
+                    DBG_ERROR( "sd PropItem::Read bad alloc" );
                 }
-                delete[] pString;
             }
             if ( bAlign )
                 SeekRel( ( 4 - ( nItemSize & 3 ) ) & 3 );		// dword align
@@ -148,18 +167,25 @@ BOOL PropItem::Read( String& rString, sal_uInt32 nStringType, sal_Bool bAlign )
         {
             if ( nItemSize )
             {
-                sal_Unicode* pString = new sal_Unicode[ (sal_uInt16)nItemSize ];
-                for ( i = 0; i < (sal_uInt16)nItemSize; i++ )
-                    *this >> pString[ i ];
-                if ( pString[ i - 1 ] == 0 )
+                try
                 {
-                    if ( (sal_uInt16)nItemSize > 1 )
-                        rString = String( pString, (sal_uInt16)nItemSize - 1 );
-                    else
-                        rString = String();
-                    bRetValue = sal_True;
+                    sal_Unicode* pString = new sal_Unicode[ nItemSize ];
+                    for ( i = 0; i < nItemSize; i++ )
+                        *this >> pString[ i ];
+                    if ( pString[ i - 1 ] == 0 )
+                    {
+                        if ( (sal_uInt16)nItemSize > 1 )
+                            rString = String( pString, lcl_getMaxSafeStrLen(nItemSize) );
+                        else
+                            rString = String();
+                        bRetValue = sal_True;
+                    }
+                    delete[] pString;
+                }
+                catch( const std::bad_alloc& )
+                {
+                    DBG_ERROR( "sd PropItem::Read bad alloc" );
                 }
-                delete[] pString;
             }
             if ( bAlign && ( nItemSize & 1 ) )
                 SeekRel( 2 );							// dword align
@@ -349,24 +375,31 @@ sal_Bool Section::GetDictionary( Dictionary& rDict )
         for ( sal_uInt32 i = 0; i < nDictCount; i++ )
         {
             aStream >> nId >> nSize;
-            if ( (sal_uInt16)nSize )
+            if ( nSize )
             {
                 String aString;
                 nPos = aStream.Tell();
-                sal_Char* pString = new sal_Char[ (sal_uInt16)nSize ];
-                aStream.Read( pString, (sal_uInt16)nSize );
-                if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+                try
                 {
-                    nSize >>= 1;
-                    aStream.Seek( nPos );
-                    sal_Unicode* pWString = (sal_Unicode*)pString;
-                    for ( i = 0; i < (sal_uInt16)nSize; i++ )
-                        aStream >> pWString[ i ];
-                    aString = String( pWString, (sal_uInt16)nSize - 1 );
+                    sal_Char* pString = new sal_Char[ nSize ];
+                    aStream.Read( pString, nSize );
+                    if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+                    {
+                        nSize >>= 1;
+                        aStream.Seek( nPos );
+                        sal_Unicode* pWString = (sal_Unicode*)pString;
+                        for ( i = 0; i < nSize; i++ )
+                            aStream >> pWString[ i ];
+                        aString = String( pWString, lcl_getMaxSafeStrLen(nSize) );
+                    }
+                    else
+                        aString = String( ByteString( pString, lcl_getMaxSafeStrLen(nSize) ), mnTextEnc );
+                    delete[] pString;
+                }
+                catch( const std::bad_alloc& )
+                {
+                    DBG_ERROR( "sd Section::GetDictionary bad alloc" );
                 }
-                else
-                    aString = String( ByteString( pString, (sal_uInt16)nSize - 1 ), mnTextEnc );
-                delete[] pString;
                 if ( !aString.Len() )
                     break;
                 aDict.AddProperty( nId, aString );
@@ -500,6 +533,11 @@ void Section::Read( SvStorageStream *pStrm )
             }
             if ( nPropSize )
             {
+                if ( nPropSize > nStrmSize )
+                {
+                    nPropCount = 0;
+                    break;
+                }
                 pStrm->Seek( nPropOfs + nSecOfs );
                 sal_uInt8* pBuf = new sal_uInt8[ nPropSize ];
                 pStrm->Read( pBuf, nPropSize );
commit a37d85f979d1616b158c918762821ed82b1e0691
Merge: 1380a03... d766efe...
Author: Christian Lippka <christian.lippka at sun.com>
Date:   Fri Aug 6 14:53:07 2010 +0200

    merge

commit 1380a03aaf7464643eb99de1488ab5b372663ccd
Author: Christian Lippka <christian.lippka at sun.com>
Date:   Wed Aug 4 10:48:35 2010 +0200

    #i113603# only change layout shape size on init or of user call is set

diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 6e0da07..9eeb12c 100755
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2355,7 +2355,7 @@ SdrObject* SdPage::InsertAutoLayoutShape( SdrObject* pObj, PresObjKind eObjKind,
         }
     }
 
-    if ( pObj && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
+    if ( pObj && (pObj->GetUserCall() || bInit) && ( pObj->IsEmptyPresObj() || !pObj->ISA(SdrGrafObj) ) )
         pObj->AdjustToMaxRect( aRect );
 
     return pObj;
commit d766efe9f601a65cd22b46e0f4131d9acd74b1a8
Author: Andre Fischer<andre.f.fischer <Andre Fischer<andre.f.fischer at oracle.com>
Date:   Thu Jan 1 00:00:00 1970 +0000

    impress197: #i112420# Create accessibility object of ToolPanelViewShell in constructor.

diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
index e8cdd06..4e7e55e 100755
--- a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
+++ b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx
@@ -512,12 +512,20 @@ ToolPanelViewShell::ToolPanelViewShell( SfxViewFrame* pFrame, ViewShellBase& rVi
 
     SetName( String( RTL_CONSTASCII_USTRINGPARAM( "ToolPanelViewShell" ) ) );
 
+    // Some recent changes to the toolpanel make it necessary to create the
+    // accessibility object now.  Creating it on demand would lead to a
+    // pointer cycle in the tree of accessibility objects and would lead
+    // e.g. the accerciser AT tool into an infinite loop.
+    // It would be nice to get rid of this workaround in the future.
+    if (mpContentWindow.get())
+        mpContentWindow->SetAccessible(mpImpl->CreateAccessible(*mpContentWindow));
+
     // For accessibility we have to shortly hide the content window.  This
     // triggers the construction of a new accessibility object for the new
     // view shell.  (One is created earlier while the construtor of the base
     // class is executed.  At that time the correct accessibility object can
     // not be constructed.)
-    if ( mpContentWindow.get() )
+    if (mpContentWindow.get())
     {
         mpContentWindow->Hide();
         mpContentWindow->Show();
@@ -633,7 +641,12 @@ DockingWindow* ToolPanelViewShell::GetDockingWindow()
 Reference< XAccessible > ToolPanelViewShell::CreateAccessibleDocumentView( ::sd::Window* i_pWindow )
 {
     ENSURE_OR_RETURN( i_pWindow, "ToolPanelViewShell::CreateAccessibleDocumentView: illegal window!", NULL );
-    return mpImpl->CreateAccessible( *i_pWindow );
+    // As said above, we have to create the accessibility object
+    // (unconditionally) in the constructor, not here on demand, or
+    // otherwise we would create a cycle in the tree of accessible objects
+    // which could lead to infinite loops in AT tools.
+    // return mpImpl->CreateAccessible( *i_pWindow );
+    return Reference<XAccessible>();
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 4f8dfe9..9290bc6 100755
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -1165,11 +1165,11 @@ void Window::DropScroll(const Point& rMousePos)
     Window::CreateAccessible (void)
 {
     if (mpViewShell != NULL)
-    return mpViewShell->CreateAccessibleDocumentView (this);
+        return mpViewShell->CreateAccessibleDocumentView (this);
     else
     {
         OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
-    return ::Window::CreateAccessible ();
+        return ::Window::CreateAccessible ();
     }
 }
 


More information about the ooo-build-commit mailing list