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 : class FilterConfigCache
32 : {
33 14956 : struct FilterConfigCacheEntry
34 : {
35 : ::rtl::OUString sInternalFilterName;
36 : ::rtl::OUString sType;
37 : ::com::sun::star::uno::Sequence< ::rtl::OUString > lExtensionList;
38 : ::rtl::OUString sUIName;
39 : ::rtl::OUString sDocumentService;
40 : ::rtl::OUString sFilterService;
41 : ::rtl::OUString sTemplateName;
42 :
43 : ::rtl::OUString sMediaType;
44 : ::rtl::OUString sFilterType;
45 :
46 : sal_Int32 nFlags;
47 : sal_Int32 nFileFormatVersion;
48 :
49 : // user data
50 : String sFilterName;
51 : sal_Bool bHasDialog : 1;
52 : sal_Bool bIsInternalFilter : 1;
53 : sal_Bool bIsPixelFormat : 1;
54 :
55 : sal_Bool CreateFilterName( const ::rtl::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 :
66 : CacheVector aImport;
67 : CacheVector aExport;
68 : sal_Bool bUseConfig;
69 :
70 : static sal_Bool bInitialized;
71 : static sal_Int32 nIndType;
72 : static sal_Int32 nIndUIName;
73 : static sal_Int32 nIndDocumentService;
74 : static sal_Int32 nIndFilterService;
75 : static sal_Int32 nIndFlags;
76 : static sal_Int32 nIndUserData;
77 : static sal_Int32 nIndFileFormatVersion;
78 : static sal_Int32 nIndTemplateName;
79 :
80 : static const char* InternalFilterListForSvxLight[];
81 :
82 : void ImplInit();
83 : void ImplInitSmart();
84 :
85 : public :
86 :
87 2395 : sal_uInt16 GetImportFormatCount() const
88 2395 : { return sal::static_int_cast< sal_uInt16 >(aImport.size()); };
89 : sal_uInt16 GetImportFormatNumber( const String& rFormatName );
90 : sal_uInt16 GetImportFormatNumberForMediaType( const String& rMediaType );
91 : sal_uInt16 GetImportFormatNumberForShortName( const String& rShortName );
92 : sal_uInt16 GetImportFormatNumberForTypeName( const String& rType );
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 62 : sal_uInt16 GetExportFormatCount() const
106 62 : { 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 : sal_Bool IsExportDialog( sal_uInt16 nFormat );
123 :
124 : FilterConfigCache( sal_Bool bUseConfig );
125 : ~FilterConfigCache();
126 :
127 : };
128 :
129 : #endif // _FILTER_CONFIG_CACHE_HXX_
130 :
131 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|