summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2021-02-15 17:49:34 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-02-18 07:07:44 +0100
commit6b8595417fcd2c998c481e865da0c30a223dda10 (patch)
treeefda83ac5493b90e6c7ec10ee17069408f949196
parent2270a58d7b25e683449c180576b7647f8d5256f4 (diff)
vcl: clean-up code used for loading of external graphic filters
All graphic filters have been moved into vcl, so there is no need to load an external library that contained graphic filters, so this code can be removed. Change-Id: Iac4f8dd78464e142f50837a55edd2d25720b8c13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111061 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--vcl/source/filter/FilterConfigCache.cxx50
-rw-r--r--vcl/source/filter/FilterConfigCache.hxx4
-rw-r--r--vcl/source/filter/graphicfilter.cxx158
3 files changed, 2 insertions, 210 deletions
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 411d44a5801d..482b8fed2ca0 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -55,39 +55,18 @@ const char* FilterConfigCache::FilterConfigCacheEntry::InternalVectorFilterNameL
IMP_EPS, EXP_EPS, nullptr
};
-const char* FilterConfigCache::FilterConfigCacheEntry::ExternalPixelFilterNameList[] =
-{
- nullptr
-};
-
void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString& rUserDataEntry )
{
- bIsPixelFormat = bIsInternalFilter = false;
+ bIsPixelFormat = false;
sFilterName = rUserDataEntry;
const char** pPtr;
- for ( pPtr = InternalPixelFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
+ for ( pPtr = InternalPixelFilterNameList; *pPtr; pPtr++ )
{
if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
{
- bIsInternalFilter = true;
bIsPixelFormat = true;
}
}
- for ( pPtr = InternalVectorFilterNameList; *pPtr && !bIsInternalFilter; pPtr++ )
- {
- if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
- bIsInternalFilter = true;
- }
- if ( !bIsInternalFilter )
- {
- for ( pPtr = ExternalPixelFilterNameList; *pPtr && !bIsPixelFormat; pPtr++ )
- {
- if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) )
- bIsPixelFormat = true;
- }
- sExternalFilterName = sFilterName;
- sFilterName = SVLIBRARY("gie");
- }
}
OUString FilterConfigCache::FilterConfigCacheEntry::GetShortName()
@@ -400,21 +379,6 @@ OUString FilterConfigCache::GetImportFilterTypeName( sal_uInt16 nFormat )
return OUString();
}
-OUString FilterConfigCache::GetExternalFilterName(sal_uInt16 nFormat, bool bExport)
-{
- if (bExport)
- {
- if (nFormat < aExport.size())
- return aExport[nFormat].sExternalFilterName;
- }
- else
- {
- if (nFormat < aImport.size())
- return aImport[nFormat].sExternalFilterName;
- }
- return OUString();
-}
-
OUString FilterConfigCache::GetImportWildcard(sal_uInt16 nFormat, sal_Int32 nEntry)
{
OUString aWildcard( GetImportFormatExtension( nFormat, nEntry ) );
@@ -423,11 +387,6 @@ OUString FilterConfigCache::GetImportWildcard(sal_uInt16 nFormat, sal_Int32 nEnt
return aWildcard;
}
-bool FilterConfigCache::IsImportInternalFilter( sal_uInt16 nFormat )
-{
- return (nFormat < aImport.size()) && aImport[ nFormat ].bIsInternalFilter;
-}
-
OUString FilterConfigCache::GetExportFilterName( sal_uInt16 nFormat )
{
if( nFormat < aExport.size() )
@@ -526,11 +485,6 @@ OUString FilterConfigCache::GetExportWildcard( sal_uInt16 nFormat, sal_Int32 nEn
return aWildcard;
}
-bool FilterConfigCache::IsExportInternalFilter( sal_uInt16 nFormat )
-{
- return (nFormat < aExport.size()) && aExport[ nFormat ].bIsInternalFilter;
-}
-
bool FilterConfigCache::IsExportPixelFormat( sal_uInt16 nFormat )
{
return (nFormat < aExport.size()) && aExport[ nFormat ].bIsPixelFormat;
diff --git a/vcl/source/filter/FilterConfigCache.hxx b/vcl/source/filter/FilterConfigCache.hxx
index 4860bbc6f38b..e6b0258bf803 100644
--- a/vcl/source/filter/FilterConfigCache.hxx
+++ b/vcl/source/filter/FilterConfigCache.hxx
@@ -32,7 +32,6 @@ class FilterConfigCache
OUString sType;
std::vector< OUString > lExtensionList;
OUString sUIName;
- OUString sExternalFilterName;
OUString sMediaType;
OUString sFilterType;
@@ -41,7 +40,6 @@ class FilterConfigCache
// user data
OUString sFilterName;
- bool bIsInternalFilter : 1;
bool bIsPixelFormat : 1;
void CreateFilterName( const OUString& rUserDataEntry );
@@ -49,7 +47,6 @@ class FilterConfigCache
static const char* InternalPixelFilterNameList[];
static const char* InternalVectorFilterNameList[];
- static const char* ExternalPixelFilterNameList[];
};
@@ -77,7 +74,6 @@ public:
OUString GetImportWildcard( sal_uInt16 nFormat, sal_Int32 nEntry );
OUString GetImportFilterType( sal_uInt16 nFormat );
OUString GetImportFilterTypeName( sal_uInt16 nFormat );
- OUString GetExternalFilterName(sal_uInt16 nFormat, bool bExport);
bool IsImportInternalFilter( sal_uInt16 nFormat );
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 6b6408076e80..09cc67c6c4bd 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -599,122 +599,6 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r
return aGraphic;
}
-static OUString ImpCreateFullFilterPath( const OUString& rPath, std::u16string_view rFilterName )
-{
- OUString aPathURL;
-
- ::osl::FileBase::getFileURLFromSystemPath( rPath, aPathURL );
- aPathURL += "/";
-
- OUString aSystemPath;
- ::osl::FileBase::getSystemPathFromFileURL( aPathURL, aSystemPath );
- aSystemPath += rFilterName;
-
- return aSystemPath;
-}
-
-namespace {
-
-class ImpFilterLibCache;
-
-struct ImpFilterLibCacheEntry
-{
- ImpFilterLibCacheEntry* mpNext;
-#ifndef DISABLE_DYNLOADING
- osl::Module maLibrary;
-#endif
- OUString maFiltername;
- OUString maFormatName;
-
- ImpFilterLibCacheEntry(const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName);
- bool operator==( std::u16string_view rFiltername ) const { return maFiltername == rFiltername; }
-};
-
-}
-
-ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName ) :
- mpNext ( nullptr ),
-#ifndef DISABLE_DYNLOADING
- maLibrary ( rPathname ),
-#endif
- maFiltername ( rFiltername ),
- maFormatName ( rFormatName )
-{
-#ifdef DISABLE_DYNLOADING
- (void) rPathname;
-#endif
-}
-
-namespace {
-
-class ImpFilterLibCache
-{
- ImpFilterLibCacheEntry* mpFirst;
- ImpFilterLibCacheEntry* mpLast;
-
-public:
- ImpFilterLibCache();
- ~ImpFilterLibCache();
-
- ImpFilterLibCacheEntry* GetFilter( const OUString& rFilterPath, const OUString& rFiltername, const OUString& rFormatName );
-};
-
-}
-
-ImpFilterLibCache::ImpFilterLibCache() :
- mpFirst ( nullptr ),
- mpLast ( nullptr )
-{
-}
-
-ImpFilterLibCache::~ImpFilterLibCache()
-{
- ImpFilterLibCacheEntry* pEntry = mpFirst;
- while( pEntry )
- {
- ImpFilterLibCacheEntry* pNext = pEntry->mpNext;
- delete pEntry;
- pEntry = pNext;
- }
-}
-
-ImpFilterLibCacheEntry* ImpFilterLibCache::GetFilter(const OUString& rFilterPath, const OUString& rFilterName, const OUString& rFormatName)
-{
- ImpFilterLibCacheEntry* pEntry = mpFirst;
-
- while( pEntry )
- {
- if( *pEntry == rFilterName && pEntry->maFormatName == rFormatName )
- break;
- else
- pEntry = pEntry->mpNext;
- }
- if( !pEntry )
- {
- OUString aPhysicalName( ImpCreateFullFilterPath( rFilterPath, rFilterName ) );
- pEntry = new ImpFilterLibCacheEntry(aPhysicalName, rFilterName, rFormatName );
-#ifndef DISABLE_DYNLOADING
- if ( pEntry->maLibrary.is() )
-#endif
- {
- if( !mpFirst )
- mpFirst = mpLast = pEntry;
- else
- mpLast = mpLast->mpNext = pEntry;
- }
-#ifndef DISABLE_DYNLOADING
- else
- {
- delete pEntry;
- pEntry = nullptr;
- }
-#endif
- }
- return pEntry;
-};
-
-namespace { struct Cache : public rtl::Static<ImpFilterLibCache, Cache> {}; }
-
GraphicFilter::GraphicFilter( bool bConfig )
: bUseConfig(bConfig)
{
@@ -1140,13 +1024,11 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
nStreamLength = sizeLimit;
OUString aFilterName = pConfig->GetImportFilterName(nFormat);
- OUString aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
std::unique_ptr<sal_uInt8[]> pGraphicContent;
sal_Int32 nGraphicContentSize = 0;
// read graphic
- if (pConfig->IsImportInternalFilter(nFormat))
{
if (aFilterName.equalsIgnoreAsciiCase(IMP_GIF))
{
@@ -1285,23 +1167,6 @@ Graphic GraphicFilter::ImportUnloadedGraphic(SvStream& rIStream, sal_uInt64 size
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
}
- else
- {
- ImpFilterLibCacheEntry* pFilter = nullptr;
-
- if (!aFilterPath.isEmpty())
- {
- // find first filter in filter paths
- ImpFilterLibCache &rCache = Cache::get();
- sal_Int32 nIdx{0};
- do {
- pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName);
- } while (nIdx>=0 && pFilter==nullptr);
- }
-
- if( !pFilter )
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- }
if (nStatus == ERRCODE_NONE && eLinkType != GfxLinkType::NONE)
{
@@ -1719,7 +1584,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
WmfExternal const *pExtHeader )
{
OUString aFilterName;
- OUString aExternalFilterName;
sal_uLong nStreamBegin;
ErrCode nStatus;
GfxLinkType eLinkType = GfxLinkType::NONE;
@@ -1761,7 +1625,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
*pDeterminedFormat = nFormat;
aFilterName = pConfig->GetImportFilterName( nFormat );
- aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
}
else
{
@@ -1772,7 +1635,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
}
// read graphic
- if ( pConfig->IsImportInternalFilter( nFormat ) )
{
if (aFilterName.equalsIgnoreAsciiCase(IMP_GIF))
{
@@ -1869,23 +1731,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
}
- else
- {
- ImpFilterLibCacheEntry* pFilter = nullptr;
-
- if (!aFilterPath.isEmpty())
- {
- // find first filter in filter paths
- ImpFilterLibCache &rCache = Cache::get();
- sal_Int32 nIdx{0};
- do {
- pFilter = rCache.GetFilter(aFilterPath.getToken(0, ';', nIdx), aFilterName, aExternalFilterName);
- } while (nIdx>=0 && pFilter==nullptr);
- }
-
- if( !pFilter )
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- }
if( nStatus == ERRCODE_NONE && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetReaderContext() && !bLinkSet )
{
@@ -2021,8 +1866,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
nStatus = ERRCODE_GRFILTER_IOERROR;
if( ERRCODE_NONE == nStatus )
{
- if ( pConfig->IsExportInternalFilter( nFormat ) )
- {
if( aFilterName.equalsIgnoreAsciiCase( EXP_BMP ) )
{
BitmapEx aBmp( aGraphic.GetBitmapEx() );
@@ -2279,7 +2122,6 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, const OUString& r
}
else
nStatus = ERRCODE_GRFILTER_FILTERERROR;
- }
}
if( nStatus != ERRCODE_NONE )
{