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