diff options
Diffstat (limited to 'editeng/source/editeng/editview.cxx')
-rw-r--r-- | editeng/source/editeng/editview.cxx | 107 |
1 files changed, 52 insertions, 55 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 1fe7fc5c38..d9f60c5f64 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1,14 +1,11 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: editview.cxx,v $ - * $Revision: 1.52.74.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1546,53 +1543,53 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo return bRet; } -String EditView::GetSurroundingText() const
-{
- DBG_CHKTHIS( EditView, 0 );
- DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 );
-
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
-
- if( HasSelection() )
- {
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return aStr;
- else
- return String();
- }
- else
- {
- aSel.Min().SetIndex( 0 );
- aSel.Max().SetIndex( aSel.Max().GetNode()->Len() );
- return PIMPEE->GetSelected( aSel );
- }
-}
-
-Selection EditView::GetSurroundingTextSelection() const
-{
- DBG_CHKTHIS( EditView, 0 );
-
- ESelection aSelection( GetSelection() );
- aSelection.Adjust();
-
- if( HasSelection() )
- {
- EditSelection aSel( pImpEditView->GetEditSelection() );
- aSel.Adjust( PIMPEE->GetEditDoc() );
- XubString aStr = PIMPEE->GetSelected( aSel );
-
- // Stop reconversion if the selected text includes a line break.
- if ( aStr.Search( 0x0A ) == STRING_NOTFOUND )
- return Selection( 0, aSelection.nEndPos - aSelection.nStartPos );
- else
- return Selection( 0, 0 );
- }
- else
- {
- return Selection( aSelection.nStartPos, aSelection.nEndPos );
- }
-}
+String EditView::GetSurroundingText() const +{ + DBG_CHKTHIS( EditView, 0 ); + DBG_CHKOBJ( pImpEditView->pEditEngine, EditEngine, 0 ); + + EditSelection aSel( pImpEditView->GetEditSelection() ); + aSel.Adjust( PIMPEE->GetEditDoc() ); + + if( HasSelection() ) + { + XubString aStr = PIMPEE->GetSelected( aSel ); + + // Stop reconversion if the selected text includes a line break. + if ( aStr.Search( 0x0A ) == STRING_NOTFOUND ) + return aStr; + else + return String(); + } + else + { + aSel.Min().SetIndex( 0 ); + aSel.Max().SetIndex( aSel.Max().GetNode()->Len() ); + return PIMPEE->GetSelected( aSel ); + } +} + +Selection EditView::GetSurroundingTextSelection() const +{ + DBG_CHKTHIS( EditView, 0 ); + + ESelection aSelection( GetSelection() ); + aSelection.Adjust(); + + if( HasSelection() ) + { + EditSelection aSel( pImpEditView->GetEditSelection() ); + aSel.Adjust( PIMPEE->GetEditDoc() ); + XubString aStr = PIMPEE->GetSelected( aSel ); + + // Stop reconversion if the selected text includes a line break. + if ( aStr.Search( 0x0A ) == STRING_NOTFOUND ) + return Selection( 0, aSelection.nEndPos - aSelection.nStartPos ); + else + return Selection( 0, 0 ); + } + else + { + return Selection( aSelection.nStartPos, aSelection.nEndPos ); + } +} |