diff options
author | Noel Grandin <noel@peralex.com> | 2016-10-10 13:47:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-10-10 15:44:13 +0200 |
commit | 666787c4bcee7fc9a5de459eb18a1dcc1a4e350c (patch) | |
tree | 24994fed0ff0a3e38f69576fa7962a845e13c3a3 /editeng | |
parent | 08f0a1646961361ab41d5e11d8e0763c133e281a (diff) |
reduce indentation
Change-Id: I9645e083ea61347fa323f84a271937e98d4f8eb3
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 108 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 98 |
2 files changed, 103 insertions, 103 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 3d4498084444..84491febf354 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -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 + { + SolarMutexReleaser aReleaser; + xDataObj = rxClipboard->getContents(); + } + catch( const css::uno::Exception& ) { - uno::Reference< datatransfer::XTransferable > xDataObj; + } - 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 ); + pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_PASTE ); - EditSelection aSel( GetEditSelection() ); - if ( aSel.HasRange() ) - { - DrawSelection(); - aSel = pEditEngine->DeleteSelection(aSel); - } + EditSelection aSel( GetEditSelection() ); + if ( aSel.HasRange() ) + { + DrawSelection(); + aSel = pEditEngine->DeleteSelection(aSel); + } - PasteOrDropInfos aPasteOrDropInfos; - aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); - pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos); + PasteOrDropInfos aPasteOrDropInfos; + aPasteOrDropInfos.nStartPara = pEditEngine->GetEditDoc().GetPos( aSel.Min().GetNode() ); + pEditEngine->HandleBeginPasteOrDrop(aPasteOrDropInfos); - if ( DoSingleLinePaste() ) + if ( DoSingleLinePaste() ) + { + datatransfer::DataFlavor aFlavor; + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::STRING, aFlavor ); + if ( xDataObj->isDataFlavorSupported( aFlavor ) ) + { + try { - 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... - } - } + 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); } - else + catch( ... ) { - aSel = pEditEngine->InsertText( - xDataObj, OUString(), aSel.Min(), - bUseSpecial && pEditEngine->GetInternalEditStatus().AllowPasteSpecial()); + ; // #i9286# can happen, even if isDataFlavorSupported returns true... } - - 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 ); } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 4fd52827283e..4de0042675fc 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3458,15 +3458,38 @@ EditSelection ImpEditEngine::InsertText( uno::Reference< datatransfer::XTransfer { EditSelection aNewSelection( rPaM ); - if ( rxDataObj.is() ) + if ( !rxDataObj.is() ) + return aNewSelection; + + datatransfer::DataFlavor aFlavor; + bool bDone = false; + + if ( bUseSpecial ) { - datatransfer::DataFlavor aFlavor; - bool bDone = false; + // BIN + SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aFlavor ); + if ( rxDataObj->isDataFlavorSupported( 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 ( bUseSpecial ) + if ( !bDone ) { - // BIN - SotExchange::GetFormatDataFlavor( SotClipboardFormatId::EDITENGINE, aFlavor ); + // 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... } } } |