Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2086

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/86/2086/1

--amend

Change-Id: Ib32b63039b225236d2a6fe55c0b90fdae9bc8fa6
---
M filter/source/msfilter/svdfppt.cxx
M sd/source/filter/ppt/pptin.cxx
M sd/source/filter/ppt/propread.cxx
M sd/source/filter/ppt/propread.hxx
4 files changed, 125 insertions(+), 29 deletions(-)



diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 537e5f2..4b202fb 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5048,7 +5048,7 @@
             }
         }
         if ( i )
-            aString = OUString( pBuf );
+            aString = OUString(pBuf, i);
         delete[] pBuf;
     }
     else if( aTextHd.nRecType == PPT_PST_TextBytesAtom )
@@ -5101,7 +5101,7 @@
         }
     }
 
-    if ( aString.getLength() )
+    if ( !aString.isEmpty() )
     {
         sal_uInt32  nCharCount;
         sal_Bool    bTextPropAtom = sal_False;
@@ -5123,7 +5123,7 @@
             PPTCharPropSet aCharPropSet( nCurrentPara );
             if ( bTextPropAtom )
             {
-                if( nCharAnzRead == ( nStringLen - 1 ) && aString == "\r" )
+                if( nCharAnzRead == ( nStringLen - 1 ) && aString[nCharAnzRead] == '\r' )
                 {
                     /* n#782833: Seems like the new line character at end of the para
                      * has two char properties and we would need to use the next one.
@@ -5165,7 +5165,7 @@
                     {
                         nLen = ( nCurrentSpecMarker & 0xffff ) - nCharAnzRead;
                         if ( nLen )
-                            aCharPropSet.maString = aString;
+                            aCharPropSet.maString = aString.copy( nCharAnzRead, nLen );
                         else if ( bEmptyParaPossible )
                             aCharPropSet.maString = OUString();
                         if ( nLen || bEmptyParaPossible )
@@ -5181,7 +5181,7 @@
                         if ( ( nCurrentSpecMarker & 0xffff ) != nCharAnzRead )
                         {
                             nLen = ( nCurrentSpecMarker & 0xffff ) - nCharAnzRead;
-                            aCharPropSet.maString = aString;
+                            aCharPropSet.maString = aString.copy(nCharAnzRead, nLen);
                             aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, 
nCurrentPara ) );
                             nCharCount -= nLen;
                             nCharAnzRead += nLen;
@@ -5199,7 +5199,7 @@
                 }
                 else
                 {
-                    aCharPropSet.maString = aString;
+                    aCharPropSet.maString = aString.copy(nCharAnzRead, nLen);
                     aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
                     nCharAnzRead += nCharCount;
                     bEmptyParaPossible = sal_False;
@@ -6506,8 +6506,8 @@
                                                     {
                                                         OUString aString( pSet->maString );
                                                         PPTCharPropSet* pNew = new PPTCharPropSet( 
*pSet );
-                                                        pSet->maString = aString;
-                                                        pNew->maString = aString;
+                                                        pSet->maString = aString.copy( 0, nOldLen);
+                                                        pNew->maString = aString.copy( nOldLen, 
nNewLen);
                                                         pNew->mnOriginalTextPos += nOldLen;
                                                         aStyleTextPropReader.aCharPropList.insert( 
aStyleTextPropReader.aCharPropList.begin() + nI + 1, pNew );
                                                     }
@@ -6744,14 +6744,14 @@
 
                                         if ( (*FE)->nPos == nPos )
                                         {
-                                            if ( aString[(sal_uInt16)nCount] == 0x2a )
+                                            if ( aString[nCount] == 0x2a )
                                             {
                                                 sal_uInt32 nBehind = aString.getLength() - ( 
nCount + 1 );
                                                 pSet->maString = OUString();
                                                 if ( nBehind )
                                                 {
                                                     PPTCharPropSet* pNewCPS = new PPTCharPropSet( 
*pSet );
-                                                    pNewCPS->maString = aString;
+                                                    pNewCPS->maString = aString.copy( nCount + 1, 
nBehind );
                                                     aCharPropList.insert( aCharPropList.begin() + 
n + 1, pNewCPS );
                                                 }
                                                 if ( (*FE)->pField2 )
@@ -6767,7 +6767,7 @@
                                                 if ( nCount )
                                                 {
                                                     PPTCharPropSet* pNewCPS = new PPTCharPropSet( 
*pSet );
-                                                    pNewCPS->maString = aString;
+                                                    pNewCPS->maString = aString.copy( 0, nCount );
                                                     aCharPropList.insert( aCharPropList.begin() + 
n++, pNewCPS );
                                                 }
                                                 if ( (*FE)->pField1 )
@@ -6788,7 +6788,7 @@
                                                         if ( nCount )
                                                         {
                                                             pBefCPS = new PPTCharPropSet( *pSet );
-                                                            pSet->maString = pSet->maString;
+                                                            pSet->maString = 
pSet->maString.copy(nCount, pSet->maString.getLength() - nCount);
                                                         }
                                                         sal_uInt32  nIdx = n;
                                                         sal_Int32   nHyperLenLeft = nHyperLen;
@@ -6836,9 +6836,9 @@
                                                                 else
                                                                 {
                                                                     PPTCharPropSet* pNewCPS = new 
PPTCharPropSet( *pCurrent );
-                                                                    pNewCPS->maString = 
pCurrent->maString;
+                                                                    pNewCPS->maString = 
pCurrent->maString.copy( nHyperLenLeft,( nNextStringLen - nHyperLenLeft ) );
                                                                     aCharPropList.insert( 
aCharPropList.begin() + nIdx + 1, pNewCPS );
-                                                                    OUString aRepresentation( 
pCurrent->maString );
+                                                                    OUString aRepresentation = 
pCurrent->maString.copy( 0, nHyperLenLeft );
                                                                     pCurrent->mpFieldItem = new 
SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD 
);
                                                                     nHyperLenLeft = 0;
                                                                 }
@@ -6851,7 +6851,7 @@
 
                                                         if ( pBefCPS )
                                                         {
-                                                            pBefCPS->maString = aString;
+                                                            pBefCPS->maString = aString.copy( 0, 
nCount );
                                                             aCharPropList.insert( 
aCharPropList.begin() + n, pBefCPS );
                                                             n++;
                                                         }
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index ac3f1a5..7360f66 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -409,7 +409,7 @@
                                             break;
                                         pHyperlink->nStartPos = pHyperlink->nEndPos = -1;
 
-                                        if ( pHyperlink->aSubAdress.Len() ) // get the converted 
subadress
+                                        if ( pHyperlink->aSubAdress.getLength() ) // get the 
converted subadress
                                         {
                                             sal_uInt32 nPageNumber = 0;
                                             String aString( pHyperlink->aSubAdress );
@@ -480,11 +480,11 @@
                                             {
                                                 if ( nPageNumber < maSlideNameList.size() )
                                                     pHyperlink->aConvSubString = maSlideNameList[ 
nPageNumber ];
-                                                if ( !pHyperlink->aConvSubString.Len() )
+                                                if ( !pHyperlink->aConvSubString.getLength() )
                                                 {
-                                                    pHyperlink->aConvSubString = String( SdResId( 
STR_PAGE ) );
-                                                    pHyperlink->aConvSubString.Append( 
sal_Unicode( ' ' ) );
-                                                    pHyperlink->aConvSubString.Append( 
mpDoc->CreatePageNumValue( (sal_uInt16)nPageNumber + 1 ) );
+                                                    pHyperlink->aConvSubString = OUString( 
SdResId( STR_PAGE ) );
+                                                    pHyperlink->aConvSubString += " ";
+                                                    pHyperlink->aConvSubString += ( 
mpDoc->CreatePageNumValue( (sal_uInt16)nPageNumber + 1 ) );
                                                 }
                                             }
                                         }
@@ -646,9 +646,9 @@
 
                         for ( nLevel = 0; nLevel < 9; nLevel++ )
                         {
-                            String aName( pPage->GetLayoutName() );
-                            aName.Append( (sal_Unicode)( ' ' ) );
-                            aName.Append( String::CreateFromInt32( nLevel + 1 ) );
+                            OUString aName( pPage->GetLayoutName() );
+                            aName += " ";
+                            aName += OUString::number( nLevel + 1 );
                             SfxStyleSheet* pOutlineSheet = 
(SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, SD_STYLE_FAMILY_MASTERPAGE );
                             DBG_ASSERT( pOutlineSheet, "Vorlage fuer Gliederungsobjekt nicht 
gefunden" );
                             if ( pOutlineSheet )
@@ -2087,7 +2087,7 @@
                     case 9:
                     case 8:                                         // hyperlink : URL
                     {
-                        if ( pPtr->aTarget.Len() )
+                        if ( pPtr->aTarget.getLength() )
                         {
                             ::sd::DrawDocShell* pDocShell = mpDoc->GetDocSh();
                             if ( pDocShell )
@@ -2111,7 +2111,7 @@
 
                     case 7:                                         // hyperlink auf eine Seite
                     {
-                        if ( pPtr->aConvSubString.Len() )
+                        if ( pPtr->aConvSubString.getLength() )
                         {
                             pInfo->meClickAction = 
::com::sun::star::presentation::ClickAction_BOOKMARK;
                             pInfo->SetBookmark( pPtr->aConvSubString );
@@ -2203,9 +2203,9 @@
         {
             for ( sal_uInt16 nLevel = 9; nLevel; nLevel-- )
             {
-                String aName( pPage->GetLayoutName() );
-                aName.Append( (sal_Unicode)( ' ' ) );
-                aName.Append( String::CreateFromInt32( nLevel ) );
+                OUString aName( pPage->GetLayoutName() );
+                aName += " ";
+                aName += OUString::number( nLevel );
                 pSheet = (SfxStyleSheet*)mpDoc->GetStyleSheetPool()->Find( aName, 
SD_STYLE_FAMILY_MASTERPAGE );
                 if ( pSheet )
                     pText->StartListening( *pSheet );
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 1e698db..57c5613 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -169,6 +169,101 @@
     return bRetValue;
 }
 
+sal_Bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, sal_Bool bAlign )
+{
+    sal_uInt32  i, nItemSize, nType, nItemPos;
+    sal_Bool    bRetValue = sal_False;
+
+    nItemPos = Tell();
+
+    if ( nStringType == VT_EMPTY )
+        *this >> nType;
+    else
+        nType = nStringType & VT_TYPEMASK;
+
+    *this >> nItemSize;
+
+    switch( nType )
+    {
+        case VT_LPSTR :
+        {
+            if ( nItemSize )
+            {
+                try
+                {
+                    sal_Char* pString = new sal_Char[ nItemSize ];
+                    if ( mnTextEnc == RTL_TEXTENCODING_UCS2 )
+                    {
+                        nItemSize >>= 1;
+                        if ( nItemSize > 1 )
+                        {
+                            sal_Unicode* pWString = (sal_Unicode*)pString;
+                            for ( i = 0; i < nItemSize; i++ )
+                                *this >> pWString[ i ];
+                            rString = OUString(pWString, lcl_getMaxSafeStrLen(nItemSize));
+                        }
+                        else
+                            rString = OUString();
+                        bRetValue = sal_True;
+                    }
+                    else
+                    {
+                        SvMemoryStream::Read( pString, nItemSize );
+                        if ( pString[ nItemSize - 1 ] == 0 )
+                        {
+                            if ( nItemSize > 1 )
+                                rString = OUString(pString, rtl_str_getLength(pString), mnTextEnc);
+                            else
+                                rString = OUString();
+                            bRetValue = sal_True;
+                        }
+                    }
+                    delete[] pString;
+                }
+                catch( const std::bad_alloc& )
+                {
+                    OSL_FAIL( "sd PropItem::Read bad alloc" );
+                }
+            }
+            if ( bAlign )
+                SeekRel( ( 4 - ( nItemSize & 3 ) ) & 3 );       // dword align
+        }
+        break;
+
+        case VT_LPWSTR :
+        {
+            if ( nItemSize )
+            {
+                try
+                {
+                    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 = OUString(pString, lcl_getMaxSafeStrLen(nItemSize));
+                        else
+                            rString = OUString();
+                        bRetValue = sal_True;
+                    }
+                    delete[] pString;
+                }
+                catch( const std::bad_alloc& )
+                {
+                    OSL_FAIL( "sd PropItem::Read bad alloc" );
+                }
+            }
+            if ( bAlign && ( nItemSize & 1 ) )
+                SeekRel( 2 );                           // dword align
+        }
+        break;
+    }
+    if ( !bRetValue )
+        Seek( nItemPos );
+    return bRetValue;
+}
+
 //  -----------------------------------------------------------------------
 
 PropItem& PropItem::operator=( PropItem& rPropItem )
diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx
index b05b977..083c7f2 100644
--- a/sd/source/filter/ppt/propread.hxx
+++ b/sd/source/filter/ppt/propread.hxx
@@ -125,7 +125,8 @@
         void            Clear();
 
         void            SetTextEncoding( sal_uInt16 nTextEnc ){ mnTextEnc = nTextEnc; };
-        sal_Bool        Read( String& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign = 
sal_True );
+        sal_Bool        Read(   String& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign 
= sal_True );
+        sal_Bool        Read( OUString& rString, sal_uInt32 nType = VT_EMPTY, sal_Bool bDwordAlign 
= sal_True );
         PropItem&       operator=( PropItem& rPropItem );
 
     using SvStream::Read;

-- 
To view, visit https://gerrit.libreoffice.org/2086
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib32b63039b225236d2a6fe55c0b90fdae9bc8fa6
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Ricardo Montania <ricardo@linuxafundo.com.br>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.