LibreOffice Module comphelper (master) 1
mimeconfighelper.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
21#define INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
22
23#include <com/sun/star/uno/Reference.hxx>
25#include <mutex>
26
27namespace com::sun::star::beans { struct NamedValue; }
28namespace com::sun::star::beans { struct PropertyValue; }
29namespace com::sun::star::container { class XContainerQuery; }
30namespace com::sun::star::container { class XNameAccess; }
31namespace com::sun::star::embed { struct VerbDescriptor; }
32namespace com::sun::star::lang { class XMultiServiceFactory; }
33namespace com::sun::star::uno { class XComponentContext; }
34
35enum class SfxFilterFlags;
36
37namespace comphelper {
38
40{
42 css::uno::Reference< css::uno::XComponentContext > m_xContext;
43 css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
44
45 css::uno::Reference< css::container::XNameAccess > m_xObjectConfig;
46 css::uno::Reference< css::container::XNameAccess > m_xVerbsConfig;
47 css::uno::Reference< css::container::XNameAccess > m_xMediaTypeConfig;
48
49 css::uno::Reference< css::container::XNameAccess > m_xFilterFactory;
50
51public:
52
53 MimeConfigurationHelper( css::uno::Reference< css::uno::XComponentContext > xContext );
54
55
56 static OUString GetStringClassIDRepresentation( const css::uno::Sequence< sal_Int8 >& aClassID );
57
58 static css::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( std::u16string_view aClassID );
59
60
61 css::uno::Reference< css::container::XNameAccess > GetObjConfiguration();
62 css::uno::Reference< css::container::XNameAccess > GetVerbsConfiguration();
63 css::uno::Reference< css::container::XNameAccess > GetMediaTypeConfiguration();
64
65
66 OUString GetDocServiceNameFromFilter( const OUString& aFilterName );
67
68 OUString GetDocServiceNameFromMediaType( const OUString& aMediaType );
69
70 css::uno::Sequence< css::beans::NamedValue > GetObjPropsFromConfigEntry(
71 const css::uno::Sequence< sal_Int8 >& aClassID,
72 const css::uno::Reference< css::container::XNameAccess >& xObjectProps );
73
74 bool GetVerbByShortcut( const OUString& aVerbShortcut,
75 css::embed::VerbDescriptor& aDescriptor );
76
77 OUString GetExplicitlyRegisteredObjClassID( const OUString& aMediaType );
78
79
80 // retrieving object description from configuration
81 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByStringClassID(
82 const OUString& aStringClassID );
83
84 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByClassID(
85 const css::uno::Sequence< sal_Int8 >& aClassID );
86
87 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByMediaType(
88 const OUString& aMediaType );
89
90 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByFilter(
91 const OUString& aFilterName );
92
93 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByDocumentName(
94 std::u16string_view aDocumentName );
95
96 // retrieving object factory from configuration
97 OUString GetFactoryNameByStringClassID( const OUString& aStringClassID );
98 OUString GetFactoryNameByClassID( const css::uno::Sequence< sal_Int8 >& aClassID );
99 OUString GetFactoryNameByDocumentName( std::u16string_view aDocName );
100 OUString GetFactoryNameByMediaType( const OUString& aMediaType );
101
102 // typedetection related
103 css::uno::Reference< css::container::XNameAccess > GetFilterFactory();
104
106 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
107 bool bIgnoreType );
109 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
110 css::uno::Sequence< css::beans::NamedValue >& aObject );
111#ifdef _WIN32
112 SfxFilterFlags GetFilterFlags( const OUString& aFilterName );
113
114 bool AddFilterNameCheckOwnFile(
115 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr );
116#endif
117
118 OUString GetDefaultFilterFromServiceName( const OUString& aServName, sal_Int32 nVersion );
119
120 OUString GetExportFilterFromImportFilter( const OUString& aImportFilterName );
121
122 static css::uno::Sequence< css::beans::PropertyValue > SearchForFilter(
123 const css::uno::Reference< css::container::XContainerQuery >& xFilterQuery,
124 const css::uno::Sequence< css::beans::NamedValue >& aSearchRequest,
125 SfxFilterFlags nMustFlags,
126 SfxFilterFlags nDontFlags );
127
128 static bool ClassIDsEqual( const css::uno::Sequence< sal_Int8 >& aClassID1,
129 const css::uno::Sequence< sal_Int8 >& aClassID2 );
130 static css::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
131 sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
132 sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
133private:
134 css::uno::Reference< css::container::XNameAccess >
135 GetConfigurationByPathImpl( const OUString& aPath );
136};
137
138}
139
140#endif // INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::container::XNameAccess > m_xFilterFactory
css::uno::Reference< css::container::XNameAccess > m_xMediaTypeConfig
css::uno::Reference< css::container::XNameAccess > m_xObjectConfig
OUString UpdateMediaDescriptorWithFilterName(css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, bool bIgnoreType)
css::uno::Reference< css::container::XNameAccess > m_xVerbsConfig
css::uno::Reference< css::uno::XComponentContext > m_xContext
css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider
OUString UpdateMediaDescriptorWithFilterName(css::uno::Sequence< css::beans::PropertyValue > &aMediaDescr, css::uno::Sequence< css::beans::NamedValue > &aObject)
#define COMPHELPER_DLLPUBLIC
SfxFilterFlags
sal_Int16 nVersion
std::mutex mutex
Definition: random.cxx:41
unsigned char sal_uInt8