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