Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / source / filter / FilterConfigCache.hxx
blobee83a39db2fb489d2d42d30bedf1f58013dc509c
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_VCL_SOURCE_FILTER_FILTERCONFIGCACHE_HXX
21 #define INCLUDED_VCL_SOURCE_FILTER_FILTERCONFIGCACHE_HXX
23 #include <com/sun/star/uno/Sequence.h>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <com/sun/star/container/XNameAccess.hpp>
27 #include <rtl/ustring.hxx>
28 #include <vector>
30 /** Cache to keep list of graphic filters + the filters themselves. */
31 class FilterConfigCache
33 struct FilterConfigCacheEntry
35 OUString sInternalFilterName;
36 OUString sType;
37 ::com::sun::star::uno::Sequence< OUString > lExtensionList;
38 OUString sUIName;
39 OUString sDocumentService;
40 OUString sFilterService;
41 OUString sTemplateName;
43 OUString sMediaType;
44 OUString sFilterType;
46 sal_Int32 nFlags;
47 sal_Int32 nFileFormatVersion;
49 // user data
50 OUString sFilterName;
51 bool bIsInternalFilter : 1;
52 bool bIsPixelFormat : 1;
54 bool CreateFilterName( const OUString& rUserDataEntry );
55 OUString GetShortName( );
57 static const char* InternalPixelFilterNameList[];
58 static const char* InternalVectorFilterNameList[];
59 static const char* ExternalPixelFilterNameList[];
62 typedef std::vector< FilterConfigCacheEntry > CacheVector;
64 CacheVector aImport;
65 CacheVector aExport;
66 bool bUseConfig;
68 static bool bInitialized;
69 static sal_Int32 nIndType;
70 static sal_Int32 nIndUIName;
71 static sal_Int32 nIndDocumentService;
72 static sal_Int32 nIndFilterService;
73 static sal_Int32 nIndFlags;
74 static sal_Int32 nIndUserData;
75 static sal_Int32 nIndFileFormatVersion;
76 static sal_Int32 nIndTemplateName;
78 static const char* InternalFilterListForSvxLight[];
80 void ImplInit();
81 void ImplInitSmart();
83 public:
85 sal_uInt16 GetImportFormatCount() const
86 { return sal::static_int_cast< sal_uInt16 >(aImport.size()); };
87 sal_uInt16 GetImportFormatNumber( const OUString& rFormatName );
88 sal_uInt16 GetImportFormatNumberForMediaType( const OUString& rMediaType );
89 sal_uInt16 GetImportFormatNumberForShortName( const OUString& rShortName );
90 sal_uInt16 GetImportFormatNumberForTypeName( const OUString& rType );
91 sal_uInt16 GetImportFormatNumberForExtension( const OUString& rExt );
92 OUString GetImportFilterName( sal_uInt16 nFormat );
93 OUString GetImportFormatName( sal_uInt16 nFormat );
94 OUString GetImportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0);
95 OUString GetImportFormatMediaType( sal_uInt16 nFormat );
96 OUString GetImportFormatShortName( sal_uInt16 nFormat );
97 OUString GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry );
98 OUString GetImportFilterType( sal_uInt16 nFormat );
99 OUString GetImportFilterTypeName( sal_uInt16 nFormat );
101 bool IsImportInternalFilter( sal_uInt16 nFormat );
102 bool IsImportPixelFormat( sal_uInt16 nFormat );
104 sal_uInt16 GetExportFormatCount() const
105 { return sal::static_int_cast< sal_uInt16 >(aExport.size()); };
106 sal_uInt16 GetExportFormatNumber( const OUString& rFormatName );
107 sal_uInt16 GetExportFormatNumberForMediaType( const OUString& rMediaType );
108 sal_uInt16 GetExportFormatNumberForShortName( const OUString& rShortName );
109 sal_uInt16 GetExportFormatNumberForTypeName( const OUString& rType );
110 OUString GetExportFilterName( sal_uInt16 nFormat );
111 OUString GetExportFormatName( sal_uInt16 nFormat );
112 OUString GetExportFormatExtension( sal_uInt16 nFormat, sal_Int32 nEntry = 0 );
113 OUString GetExportFormatMediaType( sal_uInt16 nFormat );
114 OUString GetExportFormatShortName( sal_uInt16 nFormat );
115 OUString GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry );
116 OUString GetExportFilterTypeName( sal_uInt16 nFormat );
117 OUString GetExportInternalFilterName( sal_uInt16 nFormat );
119 bool IsExportInternalFilter( sal_uInt16 nFormat );
120 bool IsExportPixelFormat( sal_uInt16 nFormat );
122 FilterConfigCache( bool bUseConfig );
123 ~FilterConfigCache();
126 #endif // INCLUDED_VCL_SOURCE_FILTER_FILTERCONFIGCACHE_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */