Kaydet (Commit) b7c59605 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

INTEGRATION: CWS sfxcleanup (1.18.10); FILE MERGED

2006/03/04 13:38:41 mba 1.18.10.2: #132394#: remove superfluous code
2006/03/03 16:31:50 mba 1.18.10.1: #132394#: remove superfluous code
üst b8a0bd0a
......@@ -4,9 +4,9 @@
*
* $RCSfile: docfilt.cxx,v $
*
* $Revision: 1.18 $
* $Revision: 1.19 $
*
* last change: $Author: rt $ $Date: 2006-02-09 14:07:09 $
* last change: $Author: rt $ $Date: 2006-05-02 16:41:45 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -45,27 +45,6 @@
#ifndef _SOT_EXCHANGE_HXX
#include <sot/exchange.hxx>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINMODE_HPP_
#include <com/sun/star/plugin/PluginMode.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINDESCRIPTION_HPP_
#include <com/sun/star/plugin/PluginDescription.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINEXCEPTION_HPP_
#include <com/sun/star/plugin/PluginException.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_PLUGINVARIABLE_HPP_
#include <com/sun/star/plugin/PluginVariable.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGIN_HPP_
#include <com/sun/star/plugin/XPlugin.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINMANAGER_HPP_
#include <com/sun/star/plugin/XPluginManager.hpp>
#endif
#ifndef _COM_SUN_STAR_PLUGIN_XPLUGINCONTEXT_HPP_
#include <com/sun/star/plugin/XPluginContext.hpp>
#endif
#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
#include <comphelper/processfactory.hxx>
#endif
......@@ -78,13 +57,10 @@
#pragma hdrstop
#include "docfac.hxx"
#include "docfilt.hxx"
#include "fltfnc.hxx"
#include "app.hxx"
#include "sfxresid.hxx"
#include "doc.hrc"
#include "sfxuno.hxx"
#include "objsh.hxx"
using namespace ::com::sun::star;
......@@ -96,71 +72,25 @@ SfxFilter::SfxFilter( const String &rName,
const String &rWildCard,
SfxFilterFlags nType,
sal_uInt32 lFmt,
const String &rMacTyp,
const String &rTypNm,
sal_uInt16 nIcon,
const String &rMimeType,
const SfxFilterContainer* pContainerP,
const String &rUsrDat,
const String &rServiceName ):
lFormat(lFmt),
nFormatType(nType),
aWildCard(rWildCard, ';'),
aMacType(rMacTyp),
aTypeName(rTypNm),
nDocIcon(nIcon),
aUserData(rUsrDat),
aName( rName ),
aMimeType( rMimeType ),
aFilterName( rName ),
aServiceName( rServiceName )
// ,pContainer( pContainerP )
{
InitMembers_Impl();
}
/*
SfxFilter::SfxFilter( const char* pName, const String &rWildCard,
SfxFilterFlags nType,
const SfxFilterContainer* pContainerP )
: lFormat(0),
nFormatType(nType),
aWildCard(rWildCard, ';'),
nDocIcon(0)
// ,pContainer( pContainerP )
{
aName = String::CreateFromAscii( pName );
aFilterName = String::CreateFromAscii( pName );
InitMembers_Impl();
}
SfxFilter::SfxFilter( const char* pName, const String &rWildCard,
SfxFilterFlags nType, const String &rTypeName,
const SfxFilterContainer* pContainerP )
: lFormat(0),
nFormatType(nType),
aWildCard(rWildCard, ';'),
aTypeName( rTypeName ),
nDocIcon(0)
// ,pContainer( pContainerP )
{
aName = String::CreateFromAscii( pName );
aFilterName = String::CreateFromAscii( pName );
InitMembers_Impl();
}
*/
void SfxFilter::InitMembers_Impl()
{
String aExts = GetWildcard()();
String aShort, aLong;
String aRet;
sal_uInt16 nMaxLength =
#if defined( WIN ) || defined( OS2 )
3
#else
USHRT_MAX
#endif
;
sal_uInt16 nMaxLength = USHRT_MAX;
String aTest;
sal_uInt16 nPos = 0;
while( ( aRet = aExts.GetToken( nPos++, ';' ) ).Len() )
......@@ -186,98 +116,18 @@ void SfxFilter::InitMembers_Impl()
aWildCard = aShort;
nVersion = SOFFICE_FILEFORMAT_50;
bPlugDataSearched = 0;
pPlugData = 0;
aUIName = aFilterName;
}
SfxFilter::~SfxFilter()
{
delete pPlugData;
}
const String& SfxFilter::GetTypeName() const
{
return
#ifdef MAC
aMacType;
#else
aTypeName;
#endif
}
const ::com::sun::star::plugin::PluginDescription* SfxFilter::GetPlugData()
{
if( !bPlugDataSearched )
{
bPlugDataSearched = sal_True;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMan = ::comphelper::getProcessServiceFactory();
::com::sun::star::uno::Reference< ::com::sun::star::plugin::XPluginManager >
xPlugMgr( xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.plugin.PluginManager" ) ), ::com::sun::star::uno::UNO_QUERY );
DBG_ASSERT( xPlugMgr.is(), "### cannot create instance com.sun.star.plugin.PluginManager!" );
if( xPlugMgr.is() )
{
::com::sun::star::uno::Sequence < ::com::sun::star::plugin::PluginDescription > aDescr = xPlugMgr->getPluginDescriptions();
const ::com::sun::star::plugin::PluginDescription *pArr = aDescr.getConstArray();
sal_uInt16 n;
for (n=0; n<aDescr.getLength(); n++ )
{
const ::com::sun::star::plugin::PluginDescription& rData = pArr[n];
String aTest = rData.Description;
aTest += DEFINE_CONST_UNICODE( " (PlugIn)" );
if( aTest == GetFilterName() )
break;
}
const ::com::sun::star::plugin::PluginDescription& rData = pArr[n];
::com::sun::star::plugin::PluginDescription *pPlug = new ::com::sun::star::plugin::PluginDescription;
pPlug->PluginName = rData.PluginName;
pPlug->Mimetype = rData.Mimetype;
pPlug->Extension = rData.Extension;
pPlug->Description = rData.Description;
pPlugData = pPlug;
}
}
return pPlugData;
}
sal_Bool SfxFilter::IsFirstPlugin() const
{
const ::com::sun::star::plugin::PluginDescription* pData = GetPlugData();
if( pData )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMan = ::comphelper::getProcessServiceFactory();
::com::sun::star::uno::Reference< ::com::sun::star::plugin::XPluginManager >
xPlugMgr( xMan->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.plugin.PluginManager" ) ), ::com::sun::star::uno::UNO_QUERY );
DBG_ASSERT( xPlugMgr.is(), "### cannot create instance com.sun.star.plugin.PluginManager!" );
if( xPlugMgr.is() )
{
::com::sun::star::uno::Sequence < ::com::sun::star::plugin::PluginDescription > aDescr = xPlugMgr->getPluginDescriptions();
String aPlug;
const ::com::sun::star::plugin::PluginDescription *pArr = aDescr.getConstArray();
String aTest;
for ( sal_uInt16 n=0; n<aDescr.getLength(); n++ )
{
if( pArr[n].Description == pData->Description )
return sal_True;
else if( pArr[n].PluginName == pData->PluginName )
return sal_False;
}
}
}
return sal_False;
}
String SfxFilter::GetDefaultExtension() const
{
return GetWildcard()().GetToken( 0, ';' );
}
String SfxFilter::GetSuffixes() const
{
String aRet = GetWildcard()();
......@@ -333,7 +183,7 @@ String SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
sal_Int32 nClipId = ((SotStorage&)rStg).GetFormat();
if ( nClipId )
{
const SfxFilter* pFilter = SFX_APP()->GetFilterMatcher().GetFilter4ClipBoardId( nClipId );
const SfxFilter* pFilter = SfxFilterMatcher().GetFilter4ClipBoardId( nClipId );
if ( pFilter )
return pFilter->GetTypeName();
}
......@@ -348,7 +198,7 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com:
lang::WrappedTargetException,
uno::RuntimeException )
{
SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher();
SfxFilterMatcher aMatcher;
const char* pType=0;
String aName;
if ( pFilterName )
......@@ -380,16 +230,16 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com:
const SfxFilter* pFilter = 0;
if ( aName.Len() )
// get preselected Filter if it matches the desired filter flags
pFilter = rMatcher.GetFilter4FilterName( aName, nMust, nDont );
pFilter = aMatcher.GetFilter4FilterName( aName, nMust, nDont );
if ( !pFilter || pFilter->GetFormat() != nClipId )
{
// get filter from storage MediaType
pFilter = rMatcher.GetFilter4ClipBoardId( nClipId, nMust, nDont );
pFilter = aMatcher.GetFilter4ClipBoardId( nClipId, nMust, nDont );
if ( !pFilter )
// template filter is asked for , but there isn't one; so at least the "normal" format should be detected
// or storage *is* a template, but bTemplate is not set
pFilter = rMatcher.GetFilter4ClipBoardId( nClipId );
pFilter = aMatcher.GetFilter4ClipBoardId( nClipId );
}
if ( pFilter )
......@@ -409,7 +259,7 @@ String SfxFilter::GetTypeFromStorage( const com::sun::star::uno::Reference< com:
{
aRet = String::CreateFromAscii(pType);
if ( pFilterName )
*pFilterName = rMatcher.GetFilter4EA( aRet )->GetName();
*pFilterName = aMatcher.GetFilter4EA( aRet )->GetName();
}
return aRet;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment