summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx61
1 files changed, 23 insertions, 38 deletions
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 59444c95d5fb..ffde81935376 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -489,47 +489,32 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons
void ChartController::executeDispatch_Copy()
{
- if ( m_pDrawViewWrapper )
+ SolarMutexGuard aSolarGuard;
+ if (!m_pDrawViewWrapper)
+ return;
+
+ OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
+ if (pOutlinerView)
+ pOutlinerView->Copy();
+ else
{
- OutlinerView* pOutlinerView = m_pDrawViewWrapper->GetTextEditOutlinerView();
- if ( pOutlinerView )
- {
- pOutlinerView->Copy();
- }
- else
+ SdrObject* pSelectedObj = nullptr;
+ ObjectIdentifier aSelOID(m_aSelection.getSelectedOID());
+
+ if (aSelOID.isAutoGeneratedObject())
+ pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() );
+ else if (aSelOID.isAdditionalShape())
+ pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() );
+
+ if (pSelectedObj)
{
- Reference< datatransfer::XTransferable > xTransferable;
+ Reference<datatransfer::clipboard::XClipboard> xClipboard(GetChartWindow()->GetClipboard());
+ if (xClipboard.is())
{
- SolarMutexGuard aSolarGuard;
- if ( m_pDrawModelWrapper )
- {
- SdrObject* pSelectedObj = nullptr;
- ObjectIdentifier aSelOID( m_aSelection.getSelectedOID() );
- if ( aSelOID.isAutoGeneratedObject() )
- {
- pSelectedObj = m_pDrawModelWrapper->getNamedSdrObject( aSelOID.getObjectCID() );
- }
- else if ( aSelOID.isAdditionalShape() )
- {
- pSelectedObj = DrawViewWrapper::getSdrObject( aSelOID.getAdditionalShape() );
- }
- if ( pSelectedObj )
- {
- xTransferable.set( new ChartTransferable(
- m_pDrawModelWrapper->getSdrModel(),
- pSelectedObj,
- aSelOID.isAdditionalShape() ) );
- }
- }
- }
- if ( xTransferable.is() )
- {
- SolarMutexGuard aSolarGuard;
- Reference<datatransfer::clipboard::XClipboard> xClipboard(GetChartWindow()->GetClipboard());
- if ( xClipboard.is() )
- {
- xClipboard->setContents( xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >() );
- }
+ Reference< datatransfer::XTransferable > xTransferable(
+ new ChartTransferable(m_pDrawModelWrapper->getSdrModel(),
+ pSelectedObj, aSelOID.isAdditionalShape()));
+ xClipboard->setContents(xTransferable, Reference< datatransfer::clipboard::XClipboardOwner >());
}
}
}