Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / vcl / source / filter / FilterConfigCache.hxx
blob829122fb88f18549ac9afb5c2b3eee21281ebea9
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 _FILTER_CONFIG_CACHE_HXX_
21 #define _FILTER_CONFIG_CACHE_HXX_
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>
29 #include <vector>
31 /** Cache to keep list of graphic filters + the filters themselves. */
32 class FilterConfigCache
34 struct FilterConfigCacheEntry
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;
44 OUString sMediaType;
45 OUString sFilterType;
47 sal_Int32 nFlags;
48 sal_Int32 nFileFormatVersion;
50 // user data
51 String sFilterName;
52 sal_Bool bHasDialog : 1;
53 sal_Bool bIsInternalFilter : 1;
54 sal_Bool bIsPixelFormat : 1;
56 sal_Bool CreateFilterName( const OUString& rUserDataEntry );
57 String GetShortName( );
59 static const char* InternalPixelFilterNameList[];
60 static const char* InternalVectorFilterNameList[];
61 static const char* ExternalPixelFilterNameList[];
64 typedef std::vector< FilterConfigCacheEntry > CacheVector;
66 CacheVector aImport;
67 CacheVector aExport;
68 sal_Bool bUseConfig;
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;
80 static const char* InternalFilterListForSvxLight[];
82 void ImplInit();
83 void ImplInitSmart();
85 public:
87 sal_uInt16 GetImportFormatCount() const
88 { 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 );
102 sal_Bool IsImportInternalFilter( sal_uInt16 nFormat );
103 sal_Bool IsImportPixelFormat( sal_uInt16 nFormat );
105 sal_uInt16 GetExportFormatCount() const
106 { 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 );
120 sal_Bool IsExportInternalFilter( sal_uInt16 nFormat );
121 sal_Bool IsExportPixelFormat( sal_uInt16 nFormat );
122 sal_Bool IsExportDialog( sal_uInt16 nFormat );
124 FilterConfigCache( sal_Bool bUseConfig );
125 ~FilterConfigCache();
128 #endif // _FILTER_CONFIG_CACHE_HXX_
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */