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