/src/libreoffice/sot/source/base/exchange.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | |
20 | | #include <sal/config.h> |
21 | | |
22 | | #include <tools/debug.hxx> |
23 | | #include <tools/globname.hxx> |
24 | | #include <tools/lazydelete.hxx> |
25 | | #include <sot/exchange.hxx> |
26 | | #include <sot/formats.hxx> |
27 | | #include <comphelper/classids.hxx> |
28 | | #include <com/sun/star/datatransfer/DataFlavor.hpp> |
29 | | #include <comphelper/documentconstants.hxx> |
30 | | #include <o3tl/string_view.hxx> |
31 | | |
32 | | #include <memory> |
33 | | #include <vector> |
34 | | |
35 | | using namespace::com::sun::star::uno; |
36 | | using namespace::com::sun::star::datatransfer; |
37 | | |
38 | | namespace { |
39 | | |
40 | | /* |
41 | | * These tables contain all MimeTypes, format identifiers, and types used in |
42 | | * the Office. The table is sorted by SotClipboardFormatId, and each ID is |
43 | | * exactly 1 greater than its predecessor ID, so that the ID can be used as a |
44 | | * table index. |
45 | | */ |
46 | | |
47 | | const DataFlavor* FormatArray_Impl() |
48 | 219k | { |
49 | 219k | static const DataFlavor aInstance[] = |
50 | 219k | { |
51 | 219k | /* 0 NONE*/ { u""_ustr, u""_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
52 | 219k | /* 1 STRING*/ { u"text/plain;charset=utf-16"_ustr, u"Text"_ustr, cppu::UnoType<OUString>::get()}, |
53 | 219k | /* 2 BITMAP*/ { u"application/x-openoffice-bitmap;windows_formatname=\"Bitmap\""_ustr, u"Bitmap"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
54 | 219k | /* 3 GDIMETAFILE*/ { u"application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr, u"GDIMetaFile"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
55 | 219k | /* 4 PRIVATE*/ { u"application/x-openoffice-private;windows_formatname=\"Private\""_ustr, u"Private"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
56 | 219k | /* 5 SIMPLE_FILE*/ { u"application/x-openoffice-file;windows_formatname=\"FileNameW\""_ustr, u"FileNameW"_ustr, cppu::UnoType<OUString>::get() }, |
57 | 219k | /* 6 FILE_LIST*/ { u"application/x-openoffice-filelist;windows_formatname=\"FileList\""_ustr, u"FileList"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
58 | 219k | /* 7 EMPTY*/ { u""_ustr, u""_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
59 | 219k | /* 8 EMPTY*/ { u""_ustr, u""_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
60 | 219k | /* 9 EMPTY*/ { u""_ustr, u""_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
61 | 219k | /* 10 RTF*/ { u"text/rtf"_ustr, u"Rich Text Format"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
62 | 219k | /* 11 DRAWING*/ { u"application/x-openoffice-drawing;windows_formatname=\"Drawing Format\""_ustr, u"Drawing Format"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
63 | 219k | /* 12 SVXB*/ { u"application/x-openoffice-svxb;windows_formatname=\"SVXB (StarView Bitmap/Animation)\""_ustr, u"SVXB (StarView Bitmap/Animation)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
64 | 219k | /* 13 SVIM*/ { u"application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\""_ustr, u"SVIM (StarView ImageMap)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
65 | 219k | /* 14 XFA*/ { u"application/x-libreoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr Any)\""_ustr, u"XFA (XOutDev FillAttr Any)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
66 | 219k | /* 15 EDITENGINE_ODF_TEXT_FLAT*/ { u"application/vnd.oasis.opendocument.text-flat-xml"_ustr, u"Flat XML format (EditEngine ODF)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
67 | 219k | /* 16 INTERNALLINK_STATE*/ { u"application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo of SvxInternalLink\""_ustr, u"StatusInfo of SvxInternalLink"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
68 | 219k | /* 17 SOLK*/ { u"application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\""_ustr, u"SOLK (StarOffice Link)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
69 | 219k | /* 18 NETSCAPE_BOOKMARK*/ { u"application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\""_ustr, u"Netscape Bookmark"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
70 | 219k | /* 19 TREELISTBOX*/ { u"application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\""_ustr, u"SV_LBOX_DD_FORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
71 | 219k | /* 20 NATIVE*/ { u"application/x-openoffice-native;windows_formatname=\"Native\""_ustr, u"Native"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
72 | 219k | /* 21 OWNERLINK*/ { u"application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\""_ustr, u"OwnerLink"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
73 | 219k | /* 22 STARSERVER*/ { u"application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\""_ustr, u"StarServerFormat"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
74 | 219k | /* 23 STAROBJECT*/ { u"application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\""_ustr, u"StarObjectFormat"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
75 | 219k | /* 24 APPLETOBJECT*/ { u"application/x-openoffice-appletobject;windows_formatname=\"Applet Object\""_ustr, u"Applet Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
76 | 219k | /* 25 PLUGIN_OBJECT*/ { u"application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\""_ustr, u"PlugIn Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
77 | 219k | /* 26 STARWRITER_30*/ { u"application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\""_ustr, u"StarWriter 3.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
78 | 219k | /* 27 STARWRITER_40*/ { u"application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\""_ustr, u"StarWriter 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
79 | 219k | /* 28 STARWRITER_50*/ { u"application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\""_ustr, u"StarWriter 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
80 | 219k | /* 29 STARWRITERWEB_40*/ { u"application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\""_ustr, u"StarWriter/Web 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
81 | 219k | /* 30 STARWRITERWEB_50*/ { u"application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\""_ustr, u"StarWriter/Web 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
82 | 219k | /* 31 STARWRITERGLOB_40*/ { u"application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\""_ustr, u"StarWriter/Global 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
83 | 219k | /* 32 STARWRITERGLOB_50*/ { u"application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\""_ustr, u"StarWriter/Global 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
84 | 219k | /* 33 STARDRAW*/ { u"application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\""_ustr, u"StarDrawDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
85 | 219k | /* 34 STARDRAW_40*/ { u"application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\""_ustr, u"StarDrawDocument 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
86 | 219k | /* 35 STARIMPRESS_50*/ { u"application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\""_ustr, u"StarImpress 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
87 | 219k | /* 36 STARDRAW_50*/ { u"application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\""_ustr, u"StarDraw 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
88 | 219k | /* 37 STARCALC*/ { u"application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\""_ustr, u"StarCalcDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
89 | 219k | /* 38 STARCALC_40*/ { u"application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\""_ustr, u"StarCalc 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
90 | 219k | /* 39 STARCALC_50*/ { u"application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\""_ustr, u"StarCalc 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
91 | 219k | /* 40 STARCHART*/ { u"application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\""_ustr, u"StarChartDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
92 | 219k | /* 41 STARCHART_40*/ { u"application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\""_ustr, u"StarChartDocument 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
93 | 219k | /* 42 STARCHART_50*/ { u"application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\""_ustr, u"StarChart 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
94 | 219k | /* 43 STARIMAGE*/ { u"application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\""_ustr, u"StarImageDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
95 | 219k | /* 44 STARIMAGE_40*/ { u"application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\""_ustr, u"StarImageDocument 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
96 | 219k | /* 45 STARIMAGE_50*/ { u"application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\""_ustr, u"StarImage 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
97 | 219k | /* 46 STARMATH*/ { u"application/x-openoffice-starmath;windows_formatname=\"StarMath\""_ustr, u"StarMath"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
98 | 219k | /* 47 STARMATH_40*/ { u"application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\""_ustr, u"StarMathDocument 4.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
99 | 219k | /* 48 STARMATH_50*/ { u"application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\""_ustr, u"StarMath 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
100 | 219k | /* 49 STAROBJECT_PAINTDOC*/ { u"application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\""_ustr, u"StarObjectPaintDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
101 | 219k | /* 50 FILLED_AREA*/ { u"application/x-openoffice-filled-area;windows_formatname=\"FilledArea\""_ustr, u"FilledArea"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
102 | 219k | /* 51 HTML*/ { u"text/html"_ustr, u"HTML (HyperText Markup Language)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
103 | 219k | /* 52 HTML_SIMPLE*/ { u"application/x-openoffice-html-simple;windows_formatname=\"HTML Format\""_ustr, u"HTML Format"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
104 | 219k | /* 53 CHAOS*/ { u"application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\""_ustr, u"FORMAT_CHAOS"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
105 | 219k | /* 54 CNT_MSGATTACHFILE*/ { u"application/x-openoffice-cnt-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\""_ustr, u"CNT_MSGATTACHFILE_FORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
106 | 219k | /* 55 BIFF_5*/ { u"application/x-openoffice-biff5;windows_formatname=\"Biff5\""_ustr, u"Biff5"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
107 | 219k | /* 56 BIFF__5*/ { u"application/x-openoffice-biff-5;windows_formatname=\"Biff 5\""_ustr, u"Biff 5"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
108 | 219k | /* 57 SYLK*/ { u"application/x-openoffice-sylk;windows_formatname=\"Sylk\""_ustr, u"Sylk"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
109 | 219k | /* 58 SYLK_BIGCAPS*/ { u"application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\""_ustr, u"SYLK"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
110 | 219k | /* 59 LINK*/ { u"application/x-openoffice-link;windows_formatname=\"Link\""_ustr, u"Link"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
111 | 219k | /* 60 DIF*/ { u"application/x-openoffice-dif;windows_formatname=\"DIF\""_ustr, u"DIF"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
112 | 219k | /* 61 STARDRAW_TABBAR*/ { u"application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\""_ustr, u"StarDraw TabBar"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
113 | 219k | /* 62 SONLK*/ { u"application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\""_ustr, u"SONLK (StarOffice Navi Link)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
114 | 219k | /* 63 MSWORD_DOC*/ { u"application/msword"_ustr, u"MSWordDoc"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
115 | 219k | /* 64 STAR_FRAMESET_DOC*/ { u"application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\""_ustr, u"StarFrameSetDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
116 | 219k | /* 65 OFFICE_DOC*/ { u"application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\""_ustr, u"OfficeDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
117 | 219k | /* 66 NOTES_DOCINFO*/ { u"application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\""_ustr, u"NotesDocInfo"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
118 | 219k | /* 67 NOTES_HNOTE*/ { u"application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\""_ustr, u"NoteshNote"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
119 | 219k | /* 68 NOTES_NATIVE*/ { u"application/x-openoffice-notes-native;windows_formatname=\"Native\""_ustr, u"Native"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
120 | 219k | /* 69 SFX_DOC*/ { u"application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\""_ustr, u"SfxDocument"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
121 | 219k | /* 70 EVDF*/ { u"application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\""_ustr, u"EVDF (Explorer View Dummy Format)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
122 | 219k | /* 71 ESDF*/ { u"application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\""_ustr, u"ESDF (Explorer Search Dummy Format)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
123 | 219k | /* 72 IDF*/ { u"application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\""_ustr, u"IDF (Iconview Dummy Format)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
124 | 219k | /* 73 EFTP*/ { u"application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\""_ustr, u"EFTP (Explorer Ftp File)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
125 | 219k | /* 74 EFD*/ { u"application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\""_ustr, u"EFD (Explorer Ftp Dir)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
126 | 219k | /* 75 SVX_FORMFIELDEXCH*/ { u"application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\""_ustr, u"SvxFormFieldExch"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
127 | 219k | /* 76 EXTENDED_TABBAR*/ { u"application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\""_ustr, u"ExtendedTabBar"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
128 | 219k | /* 77 SBA_DATAEXCHANGE*/ { u"application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\""_ustr, u"SBA-DATAFORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
129 | 219k | /* 78 SBA_FIELDDATAEXCHANGE*/ { u"application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\""_ustr, u"SBA-FIELDFORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
130 | 219k | /* 79 SBA_PRIVATE_URL*/ { u"application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\""_ustr, u"SBA-PRIVATEURLFORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
131 | 219k | /* 80 SBA_TABED*/ { u"application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\""_ustr, u"Tabed"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
132 | 219k | /* 81 SBA_TABID*/ { u"application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\""_ustr, u"Tabid"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
133 | 219k | /* 82 SBA_JOIN*/ { u"application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\""_ustr, u"SBA-JOINFORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
134 | 219k | /* 83 OBJECTDESCRIPTOR*/ { u"application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\""_ustr, u"Star Object Descriptor (XML)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
135 | 219k | /* 84 LINKSRCDESCRIPTOR*/ { u"application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\""_ustr, u"Star Link Source Descriptor (XML)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
136 | 219k | /* 85 EMBED_SOURCE*/ { u"application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\""_ustr, u"Star Embed Source (XML)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
137 | 219k | /* 86 LINK_SOURCE*/ { u"application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\""_ustr, u"Star Link Source (XML)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
138 | 219k | /* 87 EMBEDDED_OBJ*/ { u"application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\""_ustr, u"Star Embedded Object (XML)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
139 | 219k | /* 88 FILECONTENT*/ { u"application/x-openoffice-filecontent;windows_formatname=\"FileContents\""_ustr, u"FileContents"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
140 | 219k | /* 89 FILEGRPDESCRIPTOR*/ { u"application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptorW\""_ustr, u"FileGroupDescriptorW"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
141 | 219k | /* 90 FILENAME*/ { u"application/x-openoffice-filename;windows_formatname=\"FileNameW\""_ustr, u"FileNameW"_ustr, cppu::UnoType<OUString>::get() }, |
142 | 219k | /* 91 SD_OLE*/ { u"application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\""_ustr, u"SD-OLE"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
143 | 219k | /* 92 EMBEDDED_OBJ_OLE*/ { u"application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\""_ustr, u"Embedded Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
144 | 219k | /* 93 EMBED_SOURCE_OLE*/ { u"application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\""_ustr, u"Embed Source"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
145 | 219k | /* 94 OBJECTDESCRIPTOR_OLE*/ { u"application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\""_ustr, u"Object Descriptor"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
146 | 219k | /* 95 LINKSRCDESCRIPTOR_OLE*/ { u"application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\""_ustr, u"Link Source Descriptor"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
147 | 219k | /* 96 LINK_SOURCE_OLE*/ { u"application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\""_ustr, u"Link Source"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
148 | 219k | /* 97 SBA_CTRLDATAEXCHANGE*/ { u"application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\""_ustr, u"SBA-CTRLFORMAT"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
149 | 219k | /* 98 OUTPLACE_OBJ*/ { u"application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\""_ustr, u"OutPlace Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
150 | 219k | /* 99 CNT_OWN_CLIP*/ { u"application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\""_ustr, u"CntOwnClipboard"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
151 | 219k | /*100 INET_IMAGE*/ { u"application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\""_ustr, u"SO-INet-Image"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
152 | 219k | /*101 NETSCAPE_IMAGE*/ { u"application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\""_ustr, u"Netscape Image Format"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
153 | 219k | /*102 SBA_FORMEXCHANGE*/ { u"application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\""_ustr, u"SBA_FORMEXCHANGE"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
154 | 219k | /*103 SBA_REPORTEXCHANGE*/ { u"application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\""_ustr, u"SBA_REPORTEXCHANGE"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
155 | 219k | /*104 UNIFORMRESOURCELOCATOR*/ { u"application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocatorW\""_ustr, u"UniformResourceLocatorW"_ustr, cppu::UnoType<OUString>::get() }, |
156 | 219k | /*105 STARCHARTDOCUMENT_50*/ { u"application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\""_ustr, u"StarChartDocument 5.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
157 | 219k | /*106 GRAPHOBJ*/ { u"application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\""_ustr, u"Graphic Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
158 | 219k | /*107 STARWRITER_60*/ { MIMETYPE_VND_SUN_XML_WRITER, u"Writer 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
159 | 219k | /*108 STARWRITERWEB_60*/ { MIMETYPE_VND_SUN_XML_WRITER_WEB, u"Writer/Web 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
160 | 219k | /*109 STARWRITERGLOB_60*/ { MIMETYPE_VND_SUN_XML_WRITER_GLOBAL, u"Writer/Global 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
161 | 219k | /*110 STARDRAW_60*/ { MIMETYPE_VND_SUN_XML_DRAW, u"Draw 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
162 | 219k | /*111 STARIMPRESS_60*/ { MIMETYPE_VND_SUN_XML_IMPRESS, u"Impress 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
163 | 219k | /*112 STARCALC_60*/ { MIMETYPE_VND_SUN_XML_CALC, u"Calc 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
164 | 219k | /*113 STARCHART_60*/ { MIMETYPE_VND_SUN_XML_CHART, u"Chart 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
165 | 219k | /*114 STARMATH_60*/ { MIMETYPE_VND_SUN_XML_MATH, u"Math 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
166 | 219k | /*115 WMF*/ { u"application/x-openoffice-wmf;windows_formatname=\"Image WMF\""_ustr, u"Windows MetaFile"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
167 | 219k | /*116 DBACCESS_QUERY*/ { u"application/x-openoffice-dbaccess-query;windows_formatname=\"Data source Query Object\""_ustr, u"Data source Query Object"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
168 | 219k | /*117 DBACCESS_TABLE*/ { u"application/x-openoffice-dbaccess-table;windows_formatname=\"Data source Table\""_ustr, u"Data source Table"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
169 | 219k | /*118 DBACCESS_COMMAND*/ { u"application/x-openoffice-dbaccess-command;windows_formatname=\"SQL query\""_ustr, u"SQL query"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
170 | 219k | /*119 DIALOG_60*/ { u"application/vnd.sun.xml.dialog"_ustr, u"Dialog 6.0"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
171 | 219k | /*120 EMF*/ { u"application/x-openoffice-emf;windows_formatname=\"Image EMF\""_ustr, u"Windows Enhanced MetaFile"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
172 | 219k | /*121 BIFF_8*/ { u"application/x-openoffice-biff-8;windows_formatname=\"Biff8\""_ustr, u"Biff8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
173 | 219k | /*122 BMP*/ { u"image/bmp"_ustr, u"Windows Bitmap"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
174 | 219k | /*123 HTML_NO_COMMENT */ { u"application/x-openoffice-html-no-comment;windows_formatname=\"HTML Format\""_ustr, u"HTML (no comment)"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
175 | 219k | /*124 STARWRITER_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT, u"Writer 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
176 | 219k | /*125 STARWRITERWEB_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB, u"Writer/Web 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
177 | 219k | /*126 STARWRITERGLOB_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL, u"Writer/Global 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
178 | 219k | /*127 STARWDRAW_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_DRAWING, u"Draw 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
179 | 219k | /*128 STARIMPRESS_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION, u"Impress 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
180 | 219k | /*129 STARCALC_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET, u"Calc 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
181 | 219k | /*130 STARCHART_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_CHART, u"Chart 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
182 | 219k | /*131 STARMATH_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_FORMULA, u"Math 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
183 | 219k | /*132 XFORMS */ { u"application/x-openoffice-xforms;windows_formatname=\"??? Format\""_ustr, u"???"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
184 | 219k | /*133 STARWRITER_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE, u"Writer 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
185 | 219k | /*134 STARWDRAW_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE, u"Draw 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
186 | 219k | /*135 STARIMPRESS_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE, u"Impress 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
187 | 219k | /*136 STARCALC_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE, u"Calc 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
188 | 219k | /*137 STARCHART_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE, u"Chart 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
189 | 219k | /*138 STARMATH_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE, u"Math 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
190 | 219k | /*139 STARBASE_8*/ { MIMETYPE_OASIS_OPENDOCUMENT_DATABASE, u"StarBase 8"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
191 | 219k | /*140 HC_GDIMETAFILE*/ { u"application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""_ustr, u"High Contrast GDIMetaFile"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
192 | 219k | /*141 PNG*/ { u"image/png"_ustr, u"PNG"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
193 | 219k | /*142 STARWRITERGLOB_8_TEMPLATE*/ { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_TEMPLATE, u"Writer/Global 8 Template"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
194 | 219k | /*143 MATHML*/ { u"application/mathml+xml"_ustr, u"MathML"_ustr, ::cppu::UnoType<const Sequence< sal_Int8 >>::get() }, |
195 | 219k | /*144 JPEG*/ { u"image/jpeg"_ustr, u"JPEG Bitmap"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
196 | 219k | /*145 RICHTEXT*/ { u"text/richtext"_ustr, u"Richtext Format"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
197 | 219k | /*146 STRING_TSVC*/ { u"application/x-libreoffice-tsvc"_ustr, u"Text TSV-Calc"_ustr, cppu::UnoType<OUString>::get() }, |
198 | 219k | /*147 PDF*/ { u"application/pdf"_ustr, u"PDF Document"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
199 | 219k | /*148 SVG*/ { u"image/svg+xml;windows_formatname=\"image/svg+xml\""_ustr, u"SVG"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
200 | 219k | /*149 MARKDOWN*/ { u"text/markdown"_ustr, u"Markdown"_ustr, cppu::UnoType<OUString>::get() }, |
201 | 219k | /*150 BIFF_12*/ { u"application/x-openoffice-biff-12;windows_formatname=\"Biff12\""_ustr, u"Biff12"_ustr, cppu::UnoType<Sequence<sal_Int8>>::get() }, |
202 | 219k | }; |
203 | 219k | static_assert(std::size(aInstance) == size_t(SotClipboardFormatId::USER_END) + 1); |
204 | 219k | return &aInstance[0]; |
205 | 219k | }; |
206 | | |
207 | | typedef std::vector<css::datatransfer::DataFlavor> tDataFlavorList; |
208 | | |
209 | | tDataFlavorList& InitFormats_Impl() |
210 | 854 | { |
211 | 854 | static tools::DeleteOnDeinit<tDataFlavorList> gImplData; |
212 | | |
213 | 854 | return *gImplData.get(); |
214 | 854 | } |
215 | | |
216 | | SotClipboardFormatId FormatIdOfDynamicFormat(size_t i) |
217 | 427 | { |
218 | 427 | assert(i < InitFormats_Impl().size()); |
219 | 427 | return static_cast<SotClipboardFormatId>(i + static_cast<int>(SotClipboardFormatId::USER_END) + 1); |
220 | 427 | } |
221 | | |
222 | | size_t PosOfDynamicFormat(SotClipboardFormatId nFormat) |
223 | 425 | { |
224 | 425 | assert(nFormat > SotClipboardFormatId::USER_END); |
225 | 425 | return static_cast<size_t>(nFormat) - static_cast<size_t>(SotClipboardFormatId::USER_END) - 1; |
226 | 425 | } |
227 | | |
228 | | SotClipboardFormatId AddDynamicFormat(const css::datatransfer::DataFlavor& rFlavor) |
229 | 2 | { |
230 | 2 | tDataFlavorList& rL = InitFormats_Impl(); |
231 | 2 | rL.push_back(rFlavor); |
232 | 2 | return FormatIdOfDynamicFormat(rL.size() - 1); |
233 | 2 | } |
234 | | |
235 | | SotClipboardFormatId GetFormatIdFromMimeType_impl(std::u16string_view rMimeType, |
236 | | bool allowMoreParams) |
237 | 44.3k | { |
238 | 44.3k | const DataFlavor* pFormatArray_Impl = FormatArray_Impl(); |
239 | 297k | for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) |
240 | 259k | if( rMimeType == pFormatArray_Impl[ static_cast<int>(i) ].MimeType ) |
241 | 6.07k | return i; |
242 | | |
243 | | // BM: the chart format 105 ("StarChartDocument 5.0") was written |
244 | | // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0") |
245 | | // The registry only contains the entry for the 42 format id. |
246 | 173k | for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) |
247 | 173k | if (std::u16string_view rest; |
248 | 173k | o3tl::starts_with(rMimeType, pFormatArray_Impl[static_cast<int>(i)].MimeType, &rest) |
249 | 37.8k | && (rest.empty() || (allowMoreParams && rest.starts_with(';')))) |
250 | 37.8k | return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) |
251 | 37.8k | ? SotClipboardFormatId::STARCHART_50 |
252 | 37.8k | : i ); |
253 | | |
254 | | // then in the dynamic list |
255 | 425 | tDataFlavorList& rL = InitFormats_Impl(); |
256 | 425 | for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ ) |
257 | 425 | { |
258 | 425 | if( rMimeType == rL[ i ].MimeType ) |
259 | 425 | return FormatIdOfDynamicFormat(i); |
260 | 425 | } |
261 | | |
262 | 0 | return SotClipboardFormatId::NONE; |
263 | 425 | } |
264 | | } |
265 | | |
266 | | /************************************************************************* |
267 | | |* Description CLIP.SDW |
268 | | *************************************************************************/ |
269 | | SotClipboardFormatId SotExchange::RegisterFormatName( const OUString& rName ) |
270 | 2 | { |
271 | 2 | const DataFlavor* pFormatArray_Impl = FormatArray_Impl(); |
272 | | // test the default first - name |
273 | 14 | for( SotClipboardFormatId i = SotClipboardFormatId::STRING; i <= SotClipboardFormatId::FILE_LIST; ++i ) |
274 | 12 | if( rName == pFormatArray_Impl[ static_cast<int>(i) ].HumanPresentableName ) |
275 | 0 | return i; |
276 | | |
277 | | // BM: the chart format 105 ("StarChartDocument 5.0") was written |
278 | | // only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0") |
279 | | // The registry only contains the entry for the 42 format id. |
280 | 284 | for( SotClipboardFormatId i = SotClipboardFormatId::RTF; i <= SotClipboardFormatId::USER_END; ++i ) |
281 | 282 | if( rName == pFormatArray_Impl[ static_cast<int>(i) ].HumanPresentableName ) |
282 | 0 | return ( (i == SotClipboardFormatId::STARCHARTDOCUMENT_50) |
283 | 0 | ? SotClipboardFormatId::STARCHART_50 |
284 | 0 | : i ); |
285 | | |
286 | | // then in the dynamic list |
287 | 2 | tDataFlavorList& rL = InitFormats_Impl(); |
288 | 2 | for( tDataFlavorList::size_type i = 0; i < rL.size(); i++ ) |
289 | 0 | { |
290 | 0 | auto const& rFlavor = rL[ i ]; |
291 | 0 | if( rName == rFlavor.HumanPresentableName ) |
292 | 0 | return FormatIdOfDynamicFormat(i); |
293 | 0 | } |
294 | | |
295 | 2 | return AddDynamicFormat({ rName, rName, cppu::UnoType<OUString>::get() }); |
296 | 2 | } |
297 | | |
298 | | SotClipboardFormatId SotExchange::RegisterFormatMimeType( const OUString& rMimeType ) |
299 | 0 | { |
300 | 0 | SotClipboardFormatId nRet = GetFormatIdFromMimeType(rMimeType); |
301 | |
|
302 | 0 | if( nRet == SotClipboardFormatId::NONE ) |
303 | 0 | nRet = AddDynamicFormat({ rMimeType, rMimeType, cppu::UnoType<OUString>::get() }); |
304 | |
|
305 | 0 | return nRet; |
306 | 0 | } |
307 | | |
308 | | /************************************************************************* |
309 | | |* Description CLIP.SDW |
310 | | *************************************************************************/ |
311 | | SotClipboardFormatId SotExchange::RegisterFormat( const DataFlavor& rFlavor ) |
312 | 0 | { |
313 | 0 | SotClipboardFormatId nRet = GetFormat( rFlavor ); |
314 | |
|
315 | 0 | if( nRet == SotClipboardFormatId::NONE ) |
316 | 0 | nRet = AddDynamicFormat(rFlavor); |
317 | |
|
318 | 0 | return nRet; |
319 | 0 | } |
320 | | |
321 | | bool SotExchange::GetFormatDataFlavor( SotClipboardFormatId nFormat, DataFlavor& rFlavor ) |
322 | 60.3k | { |
323 | 60.3k | bool bRet; |
324 | | |
325 | 60.3k | if( SotClipboardFormatId::USER_END >= nFormat ) |
326 | 59.9k | { |
327 | 59.9k | rFlavor = FormatArray_Impl()[static_cast<int>(nFormat)]; |
328 | | |
329 | 59.9k | bRet = true; |
330 | 59.9k | } |
331 | 425 | else |
332 | 425 | { |
333 | 425 | tDataFlavorList& rL = InitFormats_Impl(); |
334 | | |
335 | 425 | unsigned i = PosOfDynamicFormat(nFormat); |
336 | | |
337 | 425 | if( rL.size() > i ) |
338 | 425 | { |
339 | 425 | rFlavor = rL[ i ]; |
340 | 425 | bRet = true; |
341 | 425 | } |
342 | 0 | else |
343 | 0 | { |
344 | 0 | rFlavor = DataFlavor(); |
345 | 0 | bRet = false; |
346 | 0 | } |
347 | 425 | } |
348 | | |
349 | 60.3k | DBG_ASSERT( bRet, "SotExchange::GetFormatDataFlavor(): DataFlavor not initialized" ); |
350 | | |
351 | 60.3k | return bRet; |
352 | 60.3k | } |
353 | | |
354 | | OUString SotExchange::GetFormatMimeType( SotClipboardFormatId nFormat ) |
355 | 114k | { |
356 | 114k | OUString sMimeType; |
357 | 114k | if( SotClipboardFormatId::USER_END >= nFormat ) |
358 | 114k | sMimeType = FormatArray_Impl()[static_cast<int>(nFormat)].MimeType; |
359 | 0 | else |
360 | 0 | { |
361 | 0 | tDataFlavorList& rL = InitFormats_Impl(); |
362 | |
|
363 | 0 | unsigned i = PosOfDynamicFormat(nFormat); |
364 | |
|
365 | 0 | if( rL.size() > i ) |
366 | 0 | sMimeType = rL[ i ].MimeType; |
367 | 0 | } |
368 | | |
369 | 114k | DBG_ASSERT( !sMimeType.isEmpty(), "SotExchange::GetFormatMimeType(): DataFlavor not initialized" ); |
370 | | |
371 | 114k | return sMimeType; |
372 | 114k | } |
373 | | |
374 | | SotClipboardFormatId SotExchange::GetFormatIdFromMimeType( std::u16string_view rMimeType ) |
375 | 44.3k | { |
376 | 44.3k | return GetFormatIdFromMimeType_impl(rMimeType, false); |
377 | 44.3k | } |
378 | | |
379 | | /************************************************************************* |
380 | | |* Description CLIP.SDW |
381 | | *************************************************************************/ |
382 | | SotClipboardFormatId SotExchange::GetFormat( const DataFlavor& rFlavor ) |
383 | 0 | { |
384 | 0 | return GetFormatIdFromMimeType_impl(rFlavor.MimeType, true); |
385 | 0 | } |
386 | | |
387 | | /************************************************************************* |
388 | | |* Description CLIP.SDW |
389 | | *************************************************************************/ |
390 | | OUString SotExchange::GetFormatName( SotClipboardFormatId nFormat ) |
391 | 425 | { |
392 | 425 | DataFlavor aFlavor; |
393 | 425 | OUString aRet; |
394 | | |
395 | 425 | if( GetFormatDataFlavor( nFormat, aFlavor ) ) |
396 | 425 | aRet = aFlavor.HumanPresentableName; |
397 | | |
398 | 425 | return aRet; |
399 | 425 | } |
400 | | |
401 | | bool SotExchange::IsInternal( const SvGlobalName& rName ) |
402 | 0 | { |
403 | 0 | return rName == SvGlobalName(SO3_SW_CLASSID_60) || |
404 | 0 | rName == SvGlobalName(SO3_SC_CLASSID_60) || |
405 | 0 | rName == SvGlobalName(SO3_SIMPRESS_CLASSID_60) || |
406 | 0 | rName == SvGlobalName(SO3_SDRAW_CLASSID_60) || |
407 | 0 | rName == SvGlobalName(SO3_SCH_CLASSID_60) || |
408 | 0 | rName == SvGlobalName(SO3_SM_CLASSID_60) || |
409 | 0 | rName == SvGlobalName(SO3_SWWEB_CLASSID_60) || |
410 | 0 | rName == SvGlobalName(SO3_SWGLOB_CLASSID_60); |
411 | 0 | } |
412 | | |
413 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |