diff options
Diffstat (limited to 'chart2/source/controller/main/ChartTransferable.cxx')
-rw-r--r-- | chart2/source/controller/main/ChartTransferable.cxx | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx index 322e73be3aa8..7c8eb12041f6 100644 --- a/chart2/source/controller/main/ChartTransferable.cxx +++ b/chart2/source/controller/main/ChartTransferable.cxx @@ -49,20 +49,19 @@ ChartTransferable::ChartTransferable( SdrModel& rSdrModel, SdrObject* pSelectedObj, bool bDrawing) -: m_pMarkedObjModel( nullptr ) - ,m_bDrawing( bDrawing ) + : m_bDrawing(bDrawing) { - std::unique_ptr<SdrExchangeView> pExchgView(std::make_unique<SdrView>( rSdrModel )); - SdrPageView* pPv = pExchgView->ShowSdrPage( rSdrModel.GetPage( 0 )); + SdrView aExchgView( rSdrModel ); + SdrPageView* pPv = aExchgView.ShowSdrPage( rSdrModel.GetPage( 0 )); if( pSelectedObj ) - pExchgView->MarkObj( pSelectedObj, pPv ); + aExchgView.MarkObj( pSelectedObj, pPv ); else - pExchgView->MarkAllObj( pPv ); - Graphic aGraphic( pExchgView->GetMarkedObjMetaFile(true)); + aExchgView.MarkAllObj( pPv ); + Graphic aGraphic( aExchgView.GetMarkedObjMetaFile(true)); m_xMetaFileGraphic.set( aGraphic.GetXGraphic()); if ( m_bDrawing ) { - m_pMarkedObjModel = pExchgView->CreateMarkedObjModel().release(); + m_xMarkedObjModel = aExchgView.CreateMarkedObjModel(); } } @@ -89,7 +88,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c { if ( nFormat == SotClipboardFormatId::DRAWING ) { - bResult = SetObject( m_pMarkedObjModel, CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor ); + bResult = SetObject(m_xMarkedObjModel.get(), CHARTTRANSFER_OBJECTTYPE_DRAWMODEL, rFlavor); } else if ( nFormat == SotClipboardFormatId::GDIMETAFILE ) { @@ -106,7 +105,7 @@ bool ChartTransferable::GetData( const css::datatransfer::DataFlavor& rFlavor, c return bResult; } -bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, +bool ChartTransferable::WriteObject( SvStream& rOStm, void* pUserObject, sal_uInt32 nUserObjectId, const datatransfer::DataFlavor& /* rFlavor */ ) { // called from SetObject, put data into stream @@ -119,12 +118,12 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* SdrModel* pMarkedObjModel = static_cast< SdrModel* >( pUserObject ); if ( pMarkedObjModel ) { - rxOStm->SetBufferSize( 0xff00 ); + rOStm.SetBufferSize( 0xff00 ); // for the changed pool defaults from drawing layer pool set those // attributes as hard attributes to preserve them for saving const SfxItemPool& rItemPool = pMarkedObjModel->GetItemPool(); - const SvxFontHeightItem& rDefaultFontHeight = rItemPool.GetDefaultItem( EE_CHAR_FONTHEIGHT ); + const SvxFontHeightItem& rDefaultFontHeight = rItemPool.GetUserOrPoolDefaultItem( EE_CHAR_FONTHEIGHT ); sal_uInt16 nCount = pMarkedObjModel->GetPageCount(); for ( sal_uInt16 i = 0; i < nCount; ++i ) { @@ -141,10 +140,10 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* } } - Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( *rxOStm ) ); + Reference< io::XOutputStream > xDocOut( new utl::OOutputStreamWrapper( rOStm ) ); SvxDrawingLayerExport( pMarkedObjModel, xDocOut ); - bRet = ( rxOStm->GetError() == ERRCODE_NONE ); + bRet = ( rOStm.GetError() == ERRCODE_NONE ); } } break; |