summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2003-04-23 16:08:48 +0000
committerRüdiger Timm <rt@openoffice.org>2003-04-23 16:08:48 +0000
commit7d4ec83bb709f3da7a4973adcf6ce898d155e798 (patch)
tree7bc244a8057736731fbfff5867d3c20febee3a4a
parentd0aee4749831b25c697d1be1115ea416d6f83b01 (diff)
INTEGRATION: CWS uno2 (1.66.2.8.56); FILE MERGED
2003/04/14 13:27:51 kso 1.66.2.8.56.2: RESYNC: (1.66.2.8-1.69); FILE MERGED 2003/04/11 14:25:22 ab 1.66.2.8.56.1: #108672# Basic Modules > 64K
-rw-r--r--sfx2/source/view/viewfrm.cxx57
1 files changed, 33 insertions, 24 deletions
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 8c1ca6552a8a..ae46252d5fe8 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfrm.cxx,v $
*
- * $Revision: 1.69 $
+ * $Revision: 1.70 $
*
- * last change: $Author: hr $ $Date: 2003-04-04 19:26:25 $
+ * last change: $Author: rt $ $Date: 2003-04-23 17:08:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -3150,43 +3150,50 @@ void SfxViewFrame::Resize()
#define LINE_SEP 0x0A
-void CutLines( String& rStr, USHORT nStartLine, USHORT nLines, BOOL bEraseTrailingEmptyLines )
+void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, BOOL bEraseTrailingEmptyLines )
{
- rStr.ConvertLineEnd( LINEEND_LF );
-
- USHORT nStartPos = 0;
- USHORT nEndPos = 0;
- USHORT nLine = 0;
+ sal_Int32 nStartPos = 0;
+ sal_Int32 nEndPos = 0;
+ sal_Int32 nLine = 0;
while ( nLine < nStartLine )
{
- nStartPos = rStr.Search( LINE_SEP, nStartPos );
+ nStartPos = rStr.indexOf( LINE_SEP, nStartPos );
+ if( nStartPos == -1 )
+ break;
nStartPos++; // nicht das \n.
nLine++;
}
DBG_ASSERTWARNING( nStartPos != STRING_NOTFOUND, "CutLines: Startzeile nicht gefunden!" );
- if ( nStartPos != STRING_NOTFOUND )
+ if ( nStartPos != -1 )
{
nEndPos = nStartPos;
- for ( USHORT i = 0; i < nLines; i++ )
- nEndPos = rStr.Search( LINE_SEP, nEndPos+1 );
+ for ( sal_Int32 i = 0; i < nLines; i++ )
+ nEndPos = rStr.indexOf( LINE_SEP, nEndPos+1 );
- if ( nEndPos != STRING_NOTFOUND ) // kann bei letzter Zeile passieren
+ if ( nEndPos == -1 ) // kann bei letzter Zeile passieren
+ nEndPos = rStr.getLength();
+ else
nEndPos++;
- if ( nEndPos > rStr.Len() )
- nEndPos = rStr.Len();
- rStr.Erase( nStartPos, nEndPos-nStartPos );
+ ::rtl::OUString aEndStr = rStr.copy( nEndPos );
+ rStr = rStr.copy( 0, nStartPos );
+ rStr += aEndStr;
}
if ( bEraseTrailingEmptyLines )
{
- USHORT n = nStartPos;
- while ( ( n < rStr.Len() ) && ( rStr.GetChar( n ) == LINE_SEP ) )
+ sal_Int32 n = nStartPos;
+ sal_Int32 nLen = rStr.getLength();
+ while ( ( n < nLen ) && ( rStr.getStr()[ n ] == LINE_SEP ) )
n++;
if ( n > nStartPos )
- rStr.Erase( nStartPos, n-nStartPos );
+ {
+ ::rtl::OUString aEndStr = rStr.copy( n );
+ rStr = rStr.copy( 0, nStartPos );
+ rStr += aEndStr;
+ }
}
}
@@ -3262,7 +3269,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro )
pBasMgr = GetObjectShell()->GetBasicManager();
}
- String aSource;
+ ::rtl::OUString aOUSource;
if ( pBasMgr)
{
StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
@@ -3272,10 +3279,12 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro )
if ( pModule )
{
SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD );
- aSource = pModule->GetSource();
+ aOUSource = pModule->GetSource32();
USHORT nStart, nEnd;
pMethod->GetLineRange( nStart, nEnd );
- CutLines( aSource, nStart-1, nEnd-nStart+1, TRUE );
+ ULONG nlStart = nStart;
+ ULONG nlEnd = nEnd;
+ CutLines( aOUSource, nlStart-1, nlEnd-nlStart+1, TRUE );
}
}
}
@@ -3329,9 +3338,9 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const ::rtl::OUString& sMacro )
::rtl::OUString sModule( aModuleName );
if(xLib->hasByName(sModule))
{
- if ( aSource.Len() )
+ if ( aOUSource.getLength() )
{
- sRoutine.append( aSource );
+ sRoutine.append( aOUSource );
}
else
{