26 #include <svtools/strings.hrc>
30 #include <com/sun/star/beans/PropertyValue.hpp>
33 : GenericDialogController(pParent,
"cui/ui/pastespecial.ui",
"PasteSpecialDialog")
34 , m_xFtObjectSource(m_xBuilder->weld_label(
"source"))
35 , m_xLbInsertList(m_xBuilder->weld_tree_view(
"list"))
86 if (rHelper.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
88 (
void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor(
89 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
94 OUString aSourceName, aTypeName;
100 DataFlavorExVector::iterator aIter( const_cast<DataFlavorExVector&>(*pFormats).begin() ),
101 aEnd( const_cast<DataFlavorExVector&>(*pFormats).end() );
102 while( aIter != aEnd )
106 std::map< SotClipboardFormatId, OUString >::iterator itName =
114 const OUString*
pName =
nullptr;
118 if ( !aName.isEmpty() )
123 pName = &(itName->second);
130 if( SotClipboardFormatId::EMBED_SOURCE == nFormat )
142 else if( SotClipboardFormatId::LINK_SOURCE == nFormat )
146 else if( aName.isEmpty() )
150 if (nFormat == SotClipboardFormatId::RICHTEXT &&
151 std::any_of(pFormats->begin(), pFormats->end(),
153 return rFlavor.mnSotId == SotClipboardFormatId::RTF;
161 ObjectLB().
append(OUString::number(static_cast<sal_uInt32>(nFormat)), aName);
166 if( aTypeName.isEmpty() && aSourceName.isEmpty() )
174 if( aTypeName.isEmpty() && aSourceName.isEmpty() )
177 aSourceName =
SvtResId(STR_UNKNOWN_SOURCE);
184 if( !aSourceName.isEmpty() )
186 if( !aTypeName.isEmpty() )
189 aTypeName += aSourceName;
205 if (rHelper.
HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
207 (
void)const_cast<TransferableDataHelper&>(rHelper).GetTransferableObjectDescriptor(
208 SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc);
213 OUString aSourceName, aTypeName;
219 for (
auto const& format : *pFormats)
223 std::map< SotClipboardFormatId, OUString >::iterator itName =
231 const OUString*
pName =
nullptr;
235 if ( !aName.isEmpty() )
240 pName = &(itName->second);
247 if( SotClipboardFormatId::EMBED_SOURCE == nFormat )
259 else if( SotClipboardFormatId::LINK_SOURCE == nFormat )
263 else if( aName.isEmpty() )
267 if (nFormat == SotClipboardFormatId::RICHTEXT &&
268 std::any_of(pFormats->begin(), pFormats->end(),
270 return rFlavor.mnSotId == SotClipboardFormatId::RTF;
278 ObjectLB().
append(OUString::number(static_cast<sal_uInt32>(nFormat)), aName);
283 if( aTypeName.isEmpty() && aSourceName.isEmpty() )
291 if( aTypeName.isEmpty() && aSourceName.isEmpty() )
294 aSourceName =
SvtResId(STR_UNKNOWN_SOURCE);
306 if( !aSourceName.isEmpty() )
308 if( !aTypeName.isEmpty() )
311 aTypeName += aSourceName;
319 if (
ObjectLB().get_selected_id().startsWithIgnoreAsciiCase(
".uno"))
322 nSelFormat = SotClipboardFormatId::NONE;
#define LINK(Instance, Class, Member)
OUString SvtResId(const char *pId)
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName)
::std::vector< DataFlavorEx > DataFlavorExVector
weld::TreeView & ObjectLB()
void SetObjName(const SvGlobalName &rClass, const OUString &rObjName)
bool HasFormat(SotClipboardFormatId nFormat) const
std::unique_ptr< weld::Button > m_xOKButton
void InsertUno(const OUString &sUnoCmd, const OUString &sLabel)
void connect_changed(const Link< TreeView &, void > &rLink)
std::unique_ptr< weld::Button > m_xOKButton
bool dispatchCommand(const OUString &rCommand, const uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Sequence< css::beans::PropertyValue > &rArguments, const uno::Reference< css::frame::XDispatchResultListener > &rListener)
std::map< SotClipboardFormatId, OUString > aSupplementMap
LineEnd GetSystemLineEnd()
SvPasteObjectDialog(weld::Window *pParent)
SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper)
GetFormat Prepares and runs the dialog, and returns a SotClipboardFormatId depending on the RET_OK re...
std::pair< OUString, OUString > aExtraCommand
SvGlobalName aObjClassName
void PreGetFormat(const TransferableDataHelper &aHelper)
PreGetFormat Prepares the dialog for running to get format of paste as a SotClipboardFormatId value b...
void connect_row_activated(const Link< TreeView &, bool > &rLink)
static OUString GetSotFormatUIName(SotClipboardFormatId nId)
std::unique_ptr< weld::TreeView > m_xLbInsertList
virtual int find_text(const OUString &rText) const =0
virtual OUString get_selected_id() const =0
SotClipboardFormatId GetFormatOnly()
GetFormatOnly Returns a SotClipboardFormatId value.
std::unique_ptr< weld::Label > m_xFtObjectSource
Reference< XExecutableDialog > m_xDialog
void append(TreeIter *pRet=nullptr)
IMPL_LINK_NOARG(SvPasteObjectDialog, SelectHdl, weld::TreeView &, void)
static bool GetEmbeddedName(const TransferableDataHelper &rData, OUString &_rName, OUString &_rSource, SotClipboardFormatId const &_nFormat)
const DataFlavorExVector & GetDataFlavorExVector() const