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