/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
bool OLocalExchange::GetData( const css::datatransfer::DataFlavor& /*_rFlavor*/, const OUString& /*rDestDoc*/ )
{ returnfalse; // do not have any formats by default
}
// try the formats we know if ( OControlExchange::hasControlPathFormat( aExchangedData.GetDataFlavorExVector() ) )
{ // paths to the controls, relative to a root
Sequence< Any > aControlPathData; if ( aExchangedData.GetAny(OControlExchange::getControlPathFormatId(), OUString()) >>= aControlPathData )
{
DBG_ASSERT( aControlPathData.getLength() >= 2, "OControlTransferData::OControlTransferData: invalid data for the control path format!" ); if ( aControlPathData.getLength() >= 2 )
{
aControlPathData[0] >>= m_xFormsRoot;
aControlPathData[1] >>= m_aControlPaths;
}
} else
{
OSL_FAIL( "OControlTransferData::OControlTransferData: invalid data for the control path format (2)!" );
}
} if ( OControlExchange::hasHiddenControlModelsFormat( aExchangedData.GetDataFlavorExVector() ) )
{ // sequence of models of hidden controls
aExchangedData.GetAny(OControlExchange::getHiddenControlModelsFormatId(), OUString()) >>= m_aHiddenControlModels;
}
sal_Int32 nEntryCount = m_aSelectedEntries.size(); if (nEntryCount == 0) return;
m_aControlPaths.realloc(nEntryCount);
css::uno::Sequence<sal_uInt32>* pAllPaths = m_aControlPaths.getArray(); for (constauto& rCurrentEntry : m_aSelectedEntries)
{ // first we collect the path in an array
::std::vector< sal_uInt32 > aCurrentPath;
if ( getControlPathFormatId( ) == nFormatId )
{ // ugly. We have to pack all the info into one object
Sequence< Any > aCompleteInfo( 2 );
OSL_ENSURE( m_xFormsRoot.is(), "OLocalExchange::GetData: invalid forms root for this format!" );
aCompleteInfo.getArray()[ 0 ] <<= m_xFormsRoot;
aCompleteInfo.getArray()[ 1 ] <<= m_aControlPaths;
SetAny( Any( aCompleteInfo ) );
} elseif ( getHiddenControlModelsFormatId() == nFormatId )
{ // just need to transfer the models
SetAny( Any( m_aHiddenControlModels ) );
} else return OLocalExchange::GetData(_rFlavor, rDestDoc);
returntrue;
}
void OControlExchange::AddSupportedFormats()
{ if (m_bFocusEntry && !m_aSelectedEntries.empty())
AddFormat(getFieldExchangeFormatId());
if (m_aControlPaths.hasElements())
AddFormat(getControlPathFormatId());
if (m_aHiddenControlModels.hasElements())
AddFormat(getHiddenControlModelsFormatId());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.