From 20b1e3a3858913b6f63773ff5a42a972c415134d Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Wed, 4 Aug 2010 10:48:35 +0200 Subject: #i113603# only change layout shape size on init or of user call is set --- sd/source/core/sdpage.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 82a841a199c8..971bb2340069 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; -- cgit From b78085151418f4cf0a643cce26701a728b2a00f0 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 5 Aug 2010 10:53:45 +0200 Subject: impress197: #i112420# Create accessibility object of ToolPanelViewShell in constructor. --- sd/source/ui/toolpanel/ToolPanelViewShell.cxx | 17 +++++++++++++++-- sd/source/ui/view/sdwindow.cxx | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sd/source/ui/toolpanel/ToolPanelViewShell.cxx b/sd/source/ui/toolpanel/ToolPanelViewShell.cxx index c62faf29ca50..f193b2ece851 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(); } // --------------------------------------------------------------------------------------------------------------------- diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 28873b3946a3..ed5dda39037c 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 (); } } -- cgit From f56e0994b98659de89b632ec04dfc2f8ff6b3e31 Mon Sep 17 00:00:00 2001 From: sj Date: Mon, 9 Aug 2010 14:11:58 +0200 Subject: impress197: #163250# fixed string handling, improved polygon splitting --- sd/source/filter/ppt/propread.cxx | 128 ++++++++++++++++++++++++-------------- 1 file changed, 83 insertions(+), 45 deletions(-) mode change 100644 => 100755 sd/source/filter/ppt/propread.cxx diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx old mode 100644 new mode 100755 index 54acab192cb5..ff1250bdf090 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -29,6 +29,7 @@ #include "precompiled_sd.hxx" #include #include +#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 ); -- cgit