[Libreoffice-commits] core.git: Branch 'feature/drawinglayercore' - vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Mon Feb 15 08:53:47 UTC 2021
vcl/source/filter/FilterConfigCache.cxx | 30 -----
vcl/source/filter/FilterConfigCache.hxx | 3
vcl/source/filter/graphicfilter.cxx | 187 --------------------------------
3 files changed, 220 deletions(-)
New commits:
commit 0c1734d8978601b9b4487e54db36fbc956b26ec4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Mon Feb 15 17:49:34 2021 +0900
Commit: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
CommitDate: Mon Feb 15 17:49:34 2021 +0900
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
diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx
index 411d44a5801d..40734b33fb64 100644
--- a/vcl/source/filter/FilterConfigCache.cxx
+++ b/vcl/source/filter/FilterConfigCache.cxx
@@ -55,11 +55,6 @@ 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;
@@ -78,16 +73,6 @@ void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString
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 +385,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 ) );
diff --git a/vcl/source/filter/FilterConfigCache.hxx b/vcl/source/filter/FilterConfigCache.hxx
index 4860bbc6f38b..40cc82887257 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;
@@ -49,7 +48,6 @@ class FilterConfigCache
static const char* InternalPixelFilterNameList[];
static const char* InternalVectorFilterNameList[];
- static const char* ExternalPixelFilterNameList[];
};
@@ -77,7 +75,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 43851e9a56b5..55c544b008e6 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -599,131 +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;
- PFilterCall mpfnImport;
-
- ImpFilterLibCacheEntry(const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName);
- bool operator==( std::u16string_view rFiltername ) const { return maFiltername == rFiltername; }
-
- PFilterCall GetImportFunction();
-};
-
-}
-
-ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName ) :
- mpNext ( nullptr ),
-#ifndef DISABLE_DYNLOADING
- maLibrary ( rPathname ),
-#endif
- maFiltername ( rFiltername ),
- maFormatName ( rFormatName ),
- mpfnImport ( nullptr )
-{
-#ifdef DISABLE_DYNLOADING
- (void) rPathname;
-#endif
-}
-
-PFilterCall ImpFilterLibCacheEntry::GetImportFunction()
-{
- return nullptr;
-}
-
-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)
{
@@ -1149,7 +1024,6 @@ 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;
@@ -1294,36 +1168,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;
- else
- {
- PFilterCall pFunc = pFilter->GetImportFunction();
-
- if (!pFunc)
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- else
- {
- OUString aShortName;
- if (nFormat != GRFILTER_FORMAT_DONTKNOW)
- aShortName = GetImportFormatShortName(nFormat).toAsciiUpperCase();
- }
- }
- }
if (nStatus == ERRCODE_NONE && eLinkType != GfxLinkType::NONE)
{
@@ -1741,7 +1585,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;
@@ -1783,7 +1626,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
*pDeterminedFormat = nFormat;
aFilterName = pConfig->GetImportFilterName( nFormat );
- aExternalFilterName = pConfig->GetExternalFilterName(nFormat, false);
}
else
{
@@ -1891,35 +1733,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;
- else
- {
- PFilterCall pFunc = pFilter->GetImportFunction();
-
- if( !pFunc )
- nStatus = ERRCODE_GRFILTER_FILTERERROR;
- else
- {
- if( !(*pFunc)( rIStream, rGraphic, nullptr ) )
- nStatus = ERRCODE_GRFILTER_FORMATERROR;
- }
- }
- }
if( nStatus == ERRCODE_NONE && ( eLinkType != GfxLinkType::NONE ) && !rGraphic.GetReaderContext() && !bLinkSet )
{
More information about the Libreoffice-commits
mailing list