31 OLocalExchange::OLocalExchange( )
33 ,m_bClipboardOwner( false )
37 void OLocalExchange::copyToClipboard(
const weld::Widget& rWidget,
const GrantAccess&)
39 if ( m_bClipboardOwner )
41 m_aClipboardListener.Call( *
this );
44 m_bClipboardOwner =
true;
48 void OLocalExchange::clear()
50 if ( !isClipboardOwner() )
55 Reference< clipboard::XClipboard > xClipBoard( getOwnClipboard() );
56 if ( xClipBoard.is() )
57 xClipBoard->setContents(
nullptr,
nullptr );
59 catch(
const Exception& )
63 m_bClipboardOwner =
false;
66 void SAL_CALL OLocalExchange::lostOwnership(
const Reference< clipboard::XClipboard >& _rxClipboard,
const Reference< XTransferable >& _rxTrans )
69 m_bClipboardOwner =
false;
71 m_aClipboardListener.Call( *
this );
74 void OLocalExchange::setDragging(
bool bDragging)
76 m_bDragging = bDragging;
79 void OLocalExchange::DragFinished(
sal_Int8 nDropAction )
87 return std::any_of(_rFormats.begin(), _rFormats.end(),
88 [&_nFormatId](
const DataFlavorEx& rFormat) { return rFormat.mnSotId == _nFormatId; });
91 bool OLocalExchange::GetData(
const css::datatransfer::DataFlavor& ,
const OUString& )
96 OControlTransferData::OControlTransferData( )
97 : m_bFocusEntry(false)
102 : m_bFocusEntry(false)
109 Sequence< Any > aControlPathData;
112 DBG_ASSERT( aControlPathData.getLength() >= 2,
"OControlTransferData::OControlTransferData: invalid data for the control path format!" );
113 if ( aControlPathData.getLength() >= 2 )
121 OSL_FAIL(
"OControlTransferData::OControlTransferData: invalid data for the control path format (2)!" );
169 [pView, _pEntry](
const auto& rElem) {
170 return pView->iter_compare(*rElem, *_pEntry) == 0;
198 if (nEntryCount == 0)
202 css::uno::Sequence<sal_uInt32>* pAllPaths =
m_aControlPaths.getArray();
206 ::std::vector< sal_uInt32 > aCurrentPath;
208 std::unique_ptr<weld::TreeIter> xLoop(pTreeBox->
make_iterator(rCurrentEntry.get()));
213 assert(bLoop &&
"OControlTransferData::buildPathFormat: invalid root or entry !"); (void)bLoop;
217 Sequence<sal_uInt32>& rCurrentPath = *pAllPaths;
218 sal_Int32 nDepth = aCurrentPath.size();
220 rCurrentPath.realloc(nDepth);
221 sal_uInt32* pSeq = rCurrentPath.getArray();
223 for (j = nDepth - 1, k = 0; k<nDepth; --j, ++k)
224 pSeq[j] = aCurrentPath[k];
233 for (
const css::uno::Sequence<sal_uInt32>& rPaths : std::as_const(
m_aControlPaths))
235 std::unique_ptr<weld::TreeIter> xSearch(pTreeBox->
make_iterator(pRoot));
236 for (
const sal_uInt32 nThisPath : rPaths)
253 Sequence< Any > aCompleteInfo( 2 );
254 OSL_ENSURE(
m_xFormsRoot.is(),
"OLocalExchange::GetData: invalid forms root for this format!" );
258 SetAny(
Any( aCompleteInfo ) );
266 return OLocalExchange::GetData(_rFlavor, rDestDoc);
314 OLocalExchangeHelper::OLocalExchangeHelper()
318 OLocalExchangeHelper::~OLocalExchangeHelper()
323 void OLocalExchangeHelper::copyToClipboard(
const weld::Widget& rWidget)
const
325 DBG_ASSERT( m_xTransferable.is(),
"OLocalExchangeHelper::copyToClipboard: not prepared!" );
326 m_xTransferable->copyToClipboard(rWidget, OLocalExchange::GrantAccess());
329 void OLocalExchangeHelper::implReset()
331 if (m_xTransferable.is())
334 m_xTransferable.clear();
338 void OLocalExchangeHelper::prepareDrag( )
340 DBG_ASSERT(!m_xTransferable.is() || !m_xTransferable->isDragging(),
"OLocalExchangeHelper::prepareDrag: recursive DnD?");
343 m_xTransferable = createExchange();
static bool GetFormatDataFlavor(SotClipboardFormatId nFormat, css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId GetFormat(const css::datatransfer::DataFlavor &rFlavor)
static SotClipboardFormatId RegisterFormatName(const OUString &rName)
virtual void DragFinished(sal_Int8 nDropAction) override
void implCallOwnLostOwnership(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &_rxClipboard, const css::uno::Reference< css::datatransfer::XTransferable > &_rxTrans)
virtual std::unique_ptr< TreeIter > make_iterator(const TreeIter *pOrig=nullptr) const=0
virtual int get_iter_index_in_parent(const TreeIter &rIter) const=0
bool iter_nth_child(TreeIter &rIter, int nChild) const
virtual bool iter_parent(TreeIter &rIter) const=0
virtual int iter_compare(const TreeIter &a, const TreeIter &b) const=0
#define DBG_ASSERT(sCon, aError)
#define DBG_UNHANDLED_EXCEPTION(...)
::std::vector< DataFlavorEx > DataFlavorExVector
SotClipboardFormatId mnSotId