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