reduce indentation

Change-Id: I9645e083ea61347fa323f84a271937e98d4f8eb3
This commit is contained in:
Noel Grandin
2016-10-10 13:47:21 +02:00
parent 08f0a16469
commit 666787c4bc
2 changed files with 106 additions and 106 deletions

View File

@@ -1466,72 +1466,72 @@ void ImpEditView::CutCopy( css::uno::Reference< css::datatransfer::clipboard::XC
void ImpEditView::Paste( css::uno::Reference< css::datatransfer::clipboard::XClipboard >& rxClipboard, bool bUseSpecial )
{
if ( rxClipboard.is() )
if ( !rxClipboard.is() )
return;
uno::Reference< datatransfer::XTransferable > xDataObj;
try
{
uno::Reference< datatransfer::XTransferable > xDataObj;
SolarMutexReleaser aReleaser;
xDataObj = rxClipboard->getContents();
}
catch( const css::uno::Exception& )
{
}
try
{
SolarMutexReleaser aReleaser;
xDataObj = rxClipboard->getContents();
}
catch( const css::uno::Exception& )
{
}
if ( !xDataObj.is() || !EditEngine::HasValidData( xDataObj ) )
return;
if ( xDataObj.is() && EditEngine::HasValidData( xDataObj ) )
pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
EditSelection aSel( GetEditSelection() );
if ( aSel.HasRange() )
{
DrawSelection();
aSel = pEditEngine->DeleteSelection(aSel);
}
PasteOrDropInfos aPasteOrDropInfos;
aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
if ( DoSingleLinePaste() )
{
datatransfer::DataFlavor aFlavor;
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor );
if ( xDataObj->isDataFlavorSupported( aFlavor ) )
{
pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE );
EditSelection aSel( GetEditSelection() );
if ( aSel.HasRange() )
try
{
DrawSelection();
aSel = pEditEngine->DeleteSelection(aSel);
uno::Any aData = xDataObj->getTransferData( aFlavor );
OUString aTmpText;
aData >>= aTmpText;
OUString aText(convertLineEnd(aTmpText, LINEEND_LF));
aText = aText.replaceAll( OUStringLiteral1(LINE_SEP), " " );
aSel = pEditEngine->InsertText(aSel, aText);
}
PasteOrDropInfos aPasteOrDropInfos;
aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() );
pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos);
if ( DoSingleLinePaste() )
catch( ... )
{
datatransfer::DataFlavor aFlavor;
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor );
if ( xDataObj->isDataFlavorSupported( aFlavor ) )
{
try
{
uno::Any aData = xDataObj->getTransferData( aFlavor );
OUString aTmpText;
aData >>= aTmpText;
OUString aText(convertLineEnd(aTmpText, LINEEND_LF));
aText = aText.replaceAll( OUStringLiteral1(LINE_SEP), " " );
aSel = pEditEngine->InsertText(aSel, aText);
}
catch( ... )
{
; // #i9286# can happen, even if isDataFlavorSupported returns true...
}
}
; // #i9286# can happen, even if isDataFlavorSupported returns true...
}
else
{
aSel = pEditEngine->InsertText(
xDataObj, OUString(), aSel.Min(),
bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
}
aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE );
SetEditSelection( aSel );
pEditEngine->pImpEditEngine->UpdateSelections();
pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() );
ShowCursor( DoAutoScroll(), true );
}
}
else
{
aSel = pEditEngine->InsertText(
xDataObj, OUString(), aSel.Min(),
bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial());
}
aPasteOrDropInfos.nEndPara = pEditEngine->GetEditDoc().GetPos( aSel.Max().GetNode() );
pEditEngine->HandleEndPasteOrDrop(aPasteOrDropInfos);
pEditEngine->pImpEditEngine->UndoActionEnd( EDITUNDO_PASTE );
SetEditSelection( aSel );
pEditEngine->pImpEditEngine->UpdateSelections();
pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() );
ShowCursor( DoAutoScroll(), true );
}

View File

@@ -3458,15 +3458,38 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer
{
EditSelection aNewSelection( rPaM );
if ( rxDataObj.is() )
{
datatransfer::DataFlavor aFlavor;
bool bDone = false;
if ( !rxDataObj.is() )
return aNewSelection;
if ( bUseSpecial )
datatransfer::DataFlavor aFlavor;
bool bDone = false;
if ( bUseSpecial )
{
// BIN
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aFlavor );
if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
{
// BIN
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aFlavor );
try
{
uno::Any aData = rxDataObj->getTransferData( aFlavor );
uno::Sequence< sal_Int8 > aSeq;
aData >>= aSeq;
{
SvMemoryStream aBinStream( aSeq.getArray(), aSeq.getLength(), StreamMode::READ );
aNewSelection = Read( aBinStream, rBaseURL, EE_FORMAT_BIN, rPaM );
}
bDone = true;
}
catch( const css::uno::Exception& )
{
}
}
if ( !bDone )
{
// RTF
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aFlavor );
if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
{
try
@@ -3475,8 +3498,8 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer
uno::Sequence< sal_Int8 > aSeq;
aData >>= aSeq;
{
SvMemoryStream aBinStream( aSeq.getArray(), aSeq.getLength(), StreamMode::READ );
aNewSelection = Read( aBinStream, rBaseURL, EE_FORMAT_BIN, rPaM );
SvMemoryStream aRTFStream( aSeq.getArray(), aSeq.getLength(), StreamMode::READ );
aNewSelection = Read( aRTFStream, rBaseURL, EE_FORMAT_RTF, rPaM );
}
bDone = true;
}
@@ -3484,51 +3507,28 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer
{
}
}
if ( !bDone )
{
// RTF
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::RTF, aFlavor );
if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
{
try
{
uno::Any aData = rxDataObj->getTransferData( aFlavor );
uno::Sequence< sal_Int8 > aSeq;
aData >>= aSeq;
{
SvMemoryStream aRTFStream( aSeq.getArray(), aSeq.getLength(), StreamMode::READ );
aNewSelection = Read( aRTFStream, rBaseURL, EE_FORMAT_RTF, rPaM );
}
bDone = true;
}
catch( const css::uno::Exception& )
{
}
}
}
if ( !bDone )
{
// XML ?
// Currently, there is nothing like "The" XML format, StarOffice doesn't offer plain XML in Clipboard...
}
}
if ( !bDone )
{
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor );
if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
// XML ?
// Currently, there is nothing like "The" XML format, StarOffice doesn't offer plain XML in Clipboard...
}
}
if ( !bDone )
{
SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor );
if ( rxDataObj->isDataFlavorSupported( aFlavor ) )
{
try
{
try
{
uno::Any aData = rxDataObj->getTransferData( aFlavor );
OUString aText;
aData >>= aText;
aNewSelection = ImpInsertText( rPaM, aText );
}
catch( ... )
{
; // #i9286# can happen, even if isDataFlavorSupported returns true...
}
uno::Any aData = rxDataObj->getTransferData( aFlavor );
OUString aText;
aData >>= aText;
aNewSelection = ImpInsertText( rPaM, aText );
}
catch( ... )
{
; // #i9286# can happen, even if isDataFlavorSupported returns true...
}
}
}