tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / comphelper / mimeconfighelper.hxx
blob5dd99664a70a219d64c2ac9470f3c155b65bc519
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
21 #define INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <comphelper/comphelperdllapi.h>
25 #include <mutex>
27 namespace com::sun::star::beans { struct NamedValue; }
28 namespace com::sun::star::beans { struct PropertyValue; }
29 namespace com::sun::star::container { class XContainerQuery; }
30 namespace com::sun::star::container { class XNameAccess; }
31 namespace com::sun::star::embed { struct VerbDescriptor; }
32 namespace com::sun::star::lang { class XMultiServiceFactory; }
33 namespace com::sun::star::uno { class XComponentContext; }
35 enum class SfxFilterFlags;
37 namespace comphelper {
39 class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
41 std::mutex m_aMutex;
42 css::uno::Reference< css::uno::XComponentContext > m_xContext;
43 css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
45 css::uno::Reference< css::container::XNameAccess > m_xObjectConfig;
46 css::uno::Reference< css::container::XNameAccess > m_xVerbsConfig;
47 css::uno::Reference< css::container::XNameAccess > m_xMediaTypeConfig;
49 css::uno::Reference< css::container::XNameAccess > m_xFilterFactory;
51 public:
53 MimeConfigurationHelper( css::uno::Reference< css::uno::XComponentContext > xContext );
56 static OUString GetStringClassIDRepresentation( const css::uno::Sequence< sal_Int8 >& aClassID );
58 static css::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( std::u16string_view aClassID );
61 css::uno::Reference< css::container::XNameAccess > GetObjConfiguration();
62 css::uno::Reference< css::container::XNameAccess > GetVerbsConfiguration();
63 css::uno::Reference< css::container::XNameAccess > GetMediaTypeConfiguration();
66 OUString GetDocServiceNameFromFilter( const OUString& aFilterName );
68 OUString GetDocServiceNameFromMediaType( const OUString& aMediaType );
70 css::uno::Sequence< css::beans::NamedValue > GetObjPropsFromConfigEntry(
71 const css::uno::Sequence< sal_Int8 >& aClassID,
72 const css::uno::Reference< css::container::XNameAccess >& xObjectProps );
74 bool GetVerbByShortcut( const OUString& aVerbShortcut,
75 css::embed::VerbDescriptor& aDescriptor );
77 OUString GetExplicitlyRegisteredObjClassID( const OUString& aMediaType );
80 // retrieving object description from configuration
81 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByStringClassID(
82 const OUString& aStringClassID );
84 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByClassID(
85 const css::uno::Sequence< sal_Int8 >& aClassID );
87 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByMediaType(
88 const OUString& aMediaType );
90 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByFilter(
91 const OUString& aFilterName );
93 css::uno::Sequence< css::beans::NamedValue > GetObjectPropsByDocumentName(
94 std::u16string_view aDocumentName );
96 // retrieving object factory from configuration
97 OUString GetFactoryNameByStringClassID( const OUString& aStringClassID );
98 OUString GetFactoryNameByClassID( const css::uno::Sequence< sal_Int8 >& aClassID );
99 OUString GetFactoryNameByDocumentName( std::u16string_view aDocName );
100 OUString GetFactoryNameByMediaType( const OUString& aMediaType );
102 // typedetection related
103 css::uno::Reference< css::container::XNameAccess > GetFilterFactory();
105 OUString UpdateMediaDescriptorWithFilterName(
106 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
107 bool bIgnoreType );
108 OUString UpdateMediaDescriptorWithFilterName(
109 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
110 css::uno::Sequence< css::beans::NamedValue >& aObject );
111 #ifdef _WIN32
112 SfxFilterFlags GetFilterFlags( const OUString& aFilterName );
114 bool AddFilterNameCheckOwnFile(
115 css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr );
116 #endif
118 OUString GetDefaultFilterFromServiceName( const OUString& aServName, sal_Int32 nVersion );
120 OUString GetExportFilterFromImportFilter( const OUString& aImportFilterName );
122 static css::uno::Sequence< css::beans::PropertyValue > SearchForFilter(
123 const css::uno::Reference< css::container::XContainerQuery >& xFilterQuery,
124 const css::uno::Sequence< css::beans::NamedValue >& aSearchRequest,
125 SfxFilterFlags nMustFlags,
126 SfxFilterFlags nDontFlags );
128 static bool ClassIDsEqual( const css::uno::Sequence< sal_Int8 >& aClassID1,
129 const css::uno::Sequence< sal_Int8 >& aClassID2 );
130 static css::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
131 sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
132 sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
133 private:
134 css::uno::Reference< css::container::XNameAccess >
135 GetConfigurationByPathImpl( const OUString& aPath );
140 #endif // INCLUDED_COMPHELPER_MIMECONFIGHELPER_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */