26#include <com/sun/star/chart2/data/XDataProvider.hpp>
34using ::com::sun::star::uno::Reference;
35using ::com::sun::star::uno::Sequence;
40std::vector< OUString > lcl_getStringsFromByteSequence(
43 std::vector< OUString > aResult;
44 const sal_Int32
nLength = aByteSequence.getLength();
45 const char * pBytes(
reinterpret_cast< const char*
>( aByteSequence.getConstArray()));
46 sal_Int32 nStartPos = 0;
49 if( pBytes[
nPos] ==
'\0' )
51 aResult.emplace_back( pBytes + nStartPos, (
nPos - nStartPos), RTL_TEXTENCODING_ASCII_US );
64 const Reference< datatransfer::dnd::XDropTarget >& rxDropTarget,
66 DropTargetHelper( rxDropTarget ),
67 m_xChartDocument(
std::move( xChartDocument ))
70ChartDropTargetHelper::~ChartDropTargetHelper()
73bool ChartDropTargetHelper::satisfiesPrerequisites()
const
75 return ( m_xChartDocument.is() &&
76 ! m_xChartDocument->hasInternalDataProvider());
85 satisfiesPrerequisites() &&
86 IsDropFormatSupported( SotClipboardFormatId::LINK ) )
102 satisfiesPrerequisites())
105 if( aDataHelper.
HasFormat( SotClipboardFormatId::LINK ))
108 if (aBytes.hasElements())
110 std::vector< OUString > aStrings( lcl_getStringsFromByteSequence( aBytes ));
111 if( aStrings.size() >= 3 && aStrings[0] ==
"soffice" )
113 OUString aRangeString( aStrings[2] );
114 if( m_xChartDocument.is())
117 if( xParentModel.is() &&
118 m_xChartDocument.is())
125 if( xDataProvider.is() && xDiagram.is() &&
126 DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument ))
129 DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument );
131 xDataProvider->detectArguments( xDataSource1 ));
134 beans::PropertyValue * pCellRange =
nullptr;
151 pCellRange->Value <<= aOldRange +
";" + aRangeString;
156 pCellRange->Value <<= aRangeString;
160 xDataProvider->createDataSource(
aArguments );
161 xDiagram->setDiagramData( xDataSource2,
aArguments );
css::uno::Sequence< sal_Int8 > GetSequence(SotClipboardFormatId nFormat, const OUString &rDestDoc) const
bool HasFormat(SotClipboardFormatId nFormat) const
ChartDropTargetHelper()=delete
Sequence< PropertyValue > aArguments
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent