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