24#include <com/sun/star/xml/sax/XAttributeList.hpp>
25#include <com/sun/star/xml/sax/Writer.hpp>
26#include <com/sun/star/io/XActiveDataSource.hpp>
49 if( !rURL.isEmpty() &&
50 !rURL.startsWith(
"http:") &&
51 !rURL.startsWith(
"https:") &&
52 !rURL.startsWith(
"jar:") &&
53 !rURL.startsWith(
"ftp:") )
59 sal_Int32
nPos = rURL.lastIndexOf(
'/' );
70 return OUString( OUString::Concat(
"vnd.sun.star.Package:") + rFilterName +
"/" +
aName );
82 static constexpr OUStringLiteral
sComponentData (
u"oor:component-data" );
83 static constexpr OUStringLiteral sNode (
u"node" );
84 static constexpr OUStringLiteral
sName (
u"oor:name" );
85 static constexpr OUStringLiteral sWhiteSpace (
u" " );
86 static constexpr OUStringLiteral sUIName (
u"UIName" );
87 static constexpr OUStringLiteral sComma (
u"," );
88 static constexpr OUStringLiteral sDelim (
u";" );
89 static constexpr OUStringLiteral sData (
u"Data" );
90 static constexpr OUStringLiteral sDocTypePrefix (
u"doctype:" );
91 static constexpr OUStringLiteral sFilterAdaptorService(
u"com.sun.star.comp.Writer.XmlFilterAdaptor" );
92 static constexpr OUStringLiteral sXSLTFilterService (
u"com.sun.star.documentconversion.XSLTFilter" );
97 xHandler->setOutputStream( xOS );
100 pAttrList->AddAttribute (
"xmlns:oor",
"http://openoffice.org/2001/registry" );
101 pAttrList->AddAttribute (
"xmlns:xs",
"http://www.w3.org/2001/XMLSchema" );
102 pAttrList->AddAttribute (
sName,
"TypeDetection" );
103 pAttrList->AddAttribute (
"oor:package",
"org.openoffice.Office" );
105 xHandler->startDocument();
106 xHandler->ignorableWhitespace ( sWhiteSpace );
111 pAttrList = new ::comphelper::AttributeList;
112 pAttrList->AddAttribute (
sName,
"Types" );
113 xHandler->ignorableWhitespace ( sWhiteSpace );
114 xHandler->startElement( sNode, pAttrList );
116 for (
auto const&
filter : rFilters)
118 pAttrList = new ::comphelper::AttributeList;
120 xHandler->ignorableWhitespace ( sWhiteSpace );
121 xHandler->startElement( sNode, pAttrList );
122 OUString sValue =
"0" + sComma + sComma;
123 if( !
filter->maDocType.isEmpty() )
125 sValue += sDocTypePrefix +
filter->maDocType;
127 sValue += sComma + sComma +
filter->maExtension + sComma +
128 OUString::number(
filter->mnDocumentIconID ) + sComma;
132 xHandler->ignorableWhitespace ( sWhiteSpace );
133 xHandler->endElement( sNode );
136 xHandler->ignorableWhitespace ( sWhiteSpace );
137 xHandler->endElement( sNode );
142 pAttrList = new ::comphelper::AttributeList;
143 pAttrList->AddAttribute (
sName,
"Filters" );
144 xHandler->ignorableWhitespace ( sWhiteSpace );
145 xHandler->startElement( sNode, pAttrList );
147 for (
auto const&
filter : rFilters)
149 pAttrList = new ::comphelper::AttributeList;
150 pAttrList->AddAttribute(
sName,
filter->maFilterName );
151 xHandler->ignorableWhitespace ( sWhiteSpace );
152 xHandler->startElement( sNode, pAttrList );
161 filter->maDocumentService +
163 sFilterAdaptorService +
165 OUString::number(
filter->maFlags ) +
169 OUString::boolean(
filter->mbNeedsXSLT2 ) +
187 xHandler->ignorableWhitespace ( sWhiteSpace );
188 xHandler->endElement( sNode );
191 xHandler->endElement( sNode );
195 xHandler->ignorableWhitespace ( sWhiteSpace );
197 xHandler->endDocument();
209 static constexpr OUStringLiteral sProp(
u"prop" );
210 static constexpr OUStringLiteral sValue(
u"value" );
211 static constexpr OUStringLiteral sWhiteSpace (
u" " );
214 pAttrList->AddAttribute (
"oor:name", rName );
215 pAttrList->AddAttribute (
"oor:type",
"xs:string" );
217 xHandler->ignorableWhitespace ( sWhiteSpace );
218 xHandler->startElement( sProp, pAttrList );
219 xHandler->ignorableWhitespace ( sWhiteSpace );
220 xHandler->startElement( sValue, pAttrList );
221 xHandler->characters( rValue );
222 xHandler->endElement( sValue );
223 xHandler->ignorableWhitespace ( sWhiteSpace );
224 xHandler->endElement( sProp );
236 static constexpr OUStringLiteral sProp(
u"prop" );
237 static constexpr OUStringLiteral sValue(
u"value" );
238 static constexpr OUStringLiteral sWhiteSpace (
u" " );
241 pAttrList->AddAttribute (
"oor:name", rName );
242 pAttrList->AddAttribute (
"oor:type",
"xs:string" );
244 xHandler->ignorableWhitespace ( sWhiteSpace );
245 xHandler->startElement( sProp, pAttrList );
246 pAttrList = new ::comphelper::AttributeList;
247 pAttrList->AddAttribute (
"xml:lang",
"en-US" );
248 xHandler->ignorableWhitespace ( sWhiteSpace );
249 xHandler->startElement( sValue, pAttrList );
250 xHandler->characters( rValue );
251 xHandler->endElement( sValue );
252 xHandler->ignorableWhitespace ( sWhiteSpace );
253 xHandler->endElement( sProp );
constexpr OUStringLiteral sComponentData
css::uno::Reference< css::uno::XComponentContext > mxContext
void doExport(const css::uno::Reference< css::io::XOutputStream > &xOS, const std::vector< filter_info_impl * > &rFilters)
TypeDetectionExporter(css::uno::Reference< css::uno::XComponentContext > const &mxContext)
static void addLocaleProperty(const css::uno::Reference< css::xml::sax::XWriter > &xWriter, const OUString &rName, const OUString &rValue)
static void addProperty(const css::uno::Reference< css::xml::sax::XWriter > &xWriter, const OUString &rName, const OUString &rValue)
#define TOOLS_WARN_EXCEPTION(area, stream)
static OUString createRelativeURL(std::u16string_view rFilterName, const OUString &rURL)
const application_info_impl * getApplicationInfo(std::u16string_view rServiceName)